Social Image Preprocessing Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Automatically prepare Bluesky-compatible social images for every changed Jekyll post before deployment.

Architecture: A focused Python script will inspect changed posts, resolve each header.og_image to a repository asset, and create a deterministic under-1 MB PNG derivative or JPEG fallback. The workflow will run it before Jekyll builds, commit generated assets/frontmatter, and make the Bluesky job check out the updated main branch so it posts using the new metadata.

Tech Stack: Python 3.12, Pillow, PyYAML, unittest, GitHub Actions, Jekyll.

Spec: docs/superpowers/specs/2026-11-23-social-image-preprocessing-design.md

Global Constraints

Review Focus


Task 1: Build and test the social-image processor

Files:

Interfaces:

Add unittest cases using temporary repositories and Pillow-generated fixtures:

def test_small_og_image_is_unchanged():
    changed = process_post(post, root)
    self.assertFalse(changed)
    self.assertFalse((asset_dir / "photo-social.png").exists())

def test_oversized_png_creates_small_png_and_updates_og_image():
    process_post(post, root)
    self.assertLess((asset_dir / "photo-social.png").stat().st_size, 1_000_000)
    self.assertIn("og_image: /assets/images/photo-social.png", post.read_text())
    self.assertIn("image: /assets/images/photo.png", post.read_text())

def test_png_falls_back_to_jpeg_when_png_cannot_meet_size_target():
    process_post(post, root)
    self.assertLess((asset_dir / "photo-social.jpg").stat().st_size, 1_000_000)
    self.assertIn("og_image: /assets/images/photo-social.jpg", post.read_text())

def test_absolute_site_url_resolves_and_external_url_is_rejected():
    ...

def test_invalid_frontmatter_or_missing_image_leaves_no_partial_output():
    ...

Run:

python3 -m unittest .github/tests/test_prepare_social_images.py -v

Expected: import/behavior failures because the processor does not exist.

Add a pinned Pillow version to .github/scripts/requirements.txt. Implement:

Run:

python3 -m unittest .github/tests/test_prepare_social_images.py -v

Expected: all processor tests pass.

Run:

python3 -m unittest .github/tests/test_bluesky_post.py -v

Expected: all existing tests pass, confirming the frontmatter changes remain compatible with the Bluesky message generator.

git add .github/scripts/prepare_social_images.py .github/tests/test_prepare_social_images.py .github/scripts/requirements.txt
git commit -m "feat: prepare small social images for Bluesky"

Task 2: Integrate preprocessing into the Pages workflow

Files:

Interfaces:

Extend the existing Python test or add a small shell assertion in the workflow logic so a changed oversized post is included in the processor input and a non-post change is ignored. The check must assert that the generated -social.* asset and updated og_image are present before Jekyll runs.

Run the relevant focused test command from Task 1 and inspect the workflow logic locally; expected failure is the absence of the preprocessing step and updated checkout behavior.

After detection and before Ruby/Jekyll setup:

Change its checkout to ref: main, so it sees the preprocessing commit and posts the updated og_image. Preserve existing Bluesky URL update behavior.

Run:

python3 -m unittest discover -s .github/tests -p 'test_*.py' -v
git diff --check

Expected: all Python tests pass and Git reports no whitespace errors.

git add .github/workflows/jekyll.yml
git commit -m "ci: prepare social images before Pages deployment"

Task 3: Verify the end-to-end changed-post behavior

Files:

Run:

python3 -m unittest discover -s .github/tests -p 'test_*.py' -v
git diff --check

Confirm only the processor, its tests, dependency manifest, workflow, and design/plan documentation changed; confirm no article header.image values were rewritten.

Using a temporary oversized PNG fixture, confirm the processor produces an under-1 MB social image, updates only header.og_image, and exits nonzero without partial files for invalid input.