@gurupanguji

Bluesky Link Facets 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: Update Bluesky publishing so snippet links become real Bluesky rich-text links, covering both raw URLs and markdown links.

Architecture: Add one narrow Bluesky text-preparation helper that converts authored snippet text into final visible Bluesky text plus non-overlapping UTF-8 byte-indexed link facets. Keep the change local to the Bluesky path in scripts/publish_social.py, and add focused unit tests for parsing, rewriting, and payload construction.

Tech Stack: Python 3, atproto client library, Bluesky rich-text facets, unittest


Task 1: Add Failing Tests For Bluesky Text Preparation

Files:

Write a test that feeds Bluesky snippet text with a plain canonical URL into a new helper and asserts:

Run: python3 -m unittest tests/test_publish_social.py -k raw_url Expected: FAIL because the helper does not exist yet

Write a test that uses [this essay](https://example.com) and asserts:

Run: python3 -m unittest tests/test_publish_social.py -k markdown_link Expected: FAIL because the behavior is not implemented yet

Task 2: Implement A Narrow Bluesky Text-To-Facets Helper

Files:

Implement a helper that scans snippet text, replaces [label](url) with label, and records the linked span in the final visible text.

Detect plain http or https URLs that remain in the final text after markdown link rewriting.

Convert visible-text character positions into Bluesky byteStart and byteEnd values using UTF-8 encoded prefix lengths.

Ensure the helper returns only valid non-overlapping facets.

Run: python3 -m unittest tests/test_publish_social.py Expected: helper tests PASS

Task 3: Cover Punctuation And Unicode Edge Cases

Files:

Write a test for a sentence like:

Read this: https://example.com/path.

Assert that the final facet excludes the trailing period.

Write a test with non-ASCII text before the linked span, for example an emoji or accented text, and assert the UTF-8 byte offsets match the intended visible span.

Write a test with one markdown link and one raw URL in the same snippet and assert:

Run: python3 -m unittest tests/test_publish_social.py Expected: PASS with edge cases covered

Task 4: Wire The Helper Into Bluesky Publishing

Files:

Call the new helper before posting and capture:

Update the post creation path so it includes the facets along with the final text and existing image embed.

Mock the Bluesky client boundary lightly and assert the final outgoing post uses:

Run: python3 -m unittest tests/test_publish_social.py -k bluesky Expected: PASS

Task 5: Verify The Social Publisher Still Behaves Cleanly

Files:

Run: python3 -m unittest tests/test_publish_social.py Expected: PASS

Run: python3 -m unittest tests/test_validate_posts.py Expected: PASS

Run: python3 scripts/publish_social.py --help Expected: script loads cleanly and prints usage without syntax or import errors

Run: git diff --stat Expected: scripts/publish_social.py, tests/test_publish_social.py, and the design and plan docs only

Task 6: Land The Change Set

Files:

git add docs/superpowers/specs/2026-03-26-bluesky-link-facets-design.md docs/superpowers/plans/2026-03-26-bluesky-link-facets-implementation-plan.md scripts/publish_social.py tests/test_publish_social.py
git commit -m "feat: add bluesky link facets for social snippets"