@gurupanguji

Provider Embed Expansion 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: Resolve issue #121 by unifying standalone URL normalization across YouTube, X or Twitter, Mastodon, Bluesky, and Threads so all supported providers follow the same embed-or-markdown-fallback contract.

Architecture: Extend the existing scripts/normalize_post_media_links.py and scripts/validate_posts.py paths instead of creating a new parallel normalizer. Keep detection narrow: standalone supported provider URLs on their own line are eligible for official embeds, while provider URLs inside prose normalize only to [url](url). Successful embeds commit with repo-owned provider wrappers plus a *Source:* [Platform](URL) line that preserves the original authored URL. Provider fetch failures degrade to plain markdown links with logged reasons and must still pass validation.

Tech Stack: Python 3, unittest, git hooks, provider embed endpoints, Jekyll markdown content, _layouts/post.html inline post styling


Task 1: Capture The Unified Provider Contract In Tests

Files:

Cover:

Cover:

Cover:

Run:

python3 -m unittest tests/test_normalize_post_media_links.py

Expected: FAIL for the new unified-provider behaviors before implementation.

Task 2: Refactor The Normalizer Around Supported Providers

Files:

Make the classifier distinguish:

Update existing behavior so:

For each provider:

When a supported provider URL appears in prose:

Do not rewrite:

Run:

python3 -m unittest tests/test_normalize_post_media_links.py tests/test_normalize_wp_embeds.py

Expected: PASS

Task 3: Add Shared Wrapper Styling In The Post Layout

Files:

Add styling hooks for:

Verify the layout rules:

Keep these rules in _layouts/post.html because that file already owns embed presentation. Do not split this styling into a second CSS surface during this issue.

Task 4: Update Validator Rules To Match The New Contract

Files:

Cover:

Cover:

Validator should accept:

Validator should reject:

Run:

python3 -m unittest tests/test_validate_posts.py tests/test_normalize_post_media_links.py tests/test_normalize_wp_embeds.py

Expected: PASS

Task 5: Wire The Pre-Commit Path To The Unified Provider Policy

Files:

Keep the existing hook architecture. Do not invent a second provider-specific pre-commit entrypoint.

The hook should:

A provider fetch failure should not block commit if the staged file now contains the accepted markdown-link fallback.

Task 6: Verify Real-World Samples Before Repository-Wide Adoption

Files:

Include at least:

Use explicit-path or fixture-driven checks before broad rollout.

Confirm:

Task 7: Full Verification And Handoff

Files:

Run:

python3 -m unittest tests/test_normalize_post_media_links.py tests/test_normalize_wp_embeds.py tests/test_validate_posts.py

Expected: PASS

Run:

python3 scripts/validate_posts.py --today "$(date +%F)"

Expected: PASS

Confirm:

Use a commit message tied to #121.

The PR body should call out that this branch also aligns the older YouTube and X or Twitter behavior with the new shared provider contract instead of leaving them on legacy rules.