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
_posts/*.md file in the existing HEAD~1..HEAD range.header.image and Markdown image links unchanged.-social.png; use -social.jpg only as a fallback.og_image, while the subsequent push does not look like a newly added post. Verify in Task 2.Files:
.github/scripts/prepare_social_images.py.github/tests/test_prepare_social_images.py.github/scripts/requirements.txtInterfaces:
process_post(post_path: Path, repository_root: Path, threshold: int = 1_000_000) -> bool, returning whether the post or an asset changed.process_posts(post_paths: Sequence[Path], repository_root: Path) -> int, returning the number of changed posts and raising a clear exception for any failure.The CLI accepts post paths as positional arguments and exits nonzero on any processing error.
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:
yaml.safe_load;og_image lookup under header and site-relative/https://rawlinson.us/ resolution;-social.png generation with dimension reduction and PNG
optimization;og_image frontmatter value;cleanup of partial output on failure and nonzero CLI exit.
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"
Files:
.github/workflows/jekyll.yml:38-100.github/workflows/jekyll.yml:130-145Interfaces:
HEAD~1..HEAD.python3 .github/scripts/prepare_social_images.py with every changed
post path.Produces a committed working tree whose og_image metadata is available to
the Jekyll build and to the later Bluesky job.
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:
HEAD~1..HEAD range;.github/scripts/requirements.txt before invoking the processor;git add generated assets and modified posts;allow a processing error to fail the job before deployment.
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"
Files:
Modify only temporary test fixtures or use a temporary branch/worktree; do not alter production content for this verification.
Step 1: Run the complete focused validation
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.