F9: authorship view in the rendered preview #27

Merged
benstull merged 9 commits from f9-authorship-preview into main 2026-06-11 21:40:58 +00:00
Owner

Adds an Authorship mode to the F7 rendered preview, surfaced as friction during F8 testing ("the preview doesn't show the Claude-composed annotations"). Design: docs/superpowers/specs/2026-06-11-authorship-preview-design.md. Session 0026.

What changes

The preview header gains a [ Track changes | Authorship ] toggle (per-panel, default Track changes — unchanged). Authorship mode re-renders the current document with each span colored by its F3 author — Claude (blue) vs you (green), inline and char-precise — with a header legend. Because it reads F3 attribution directly (not the F6 baseline), Claude's contributions stay visible even after the baseline absorbs a landing (INV-18). Code/mermaid fences get a block-level author badge (atomic, INV-27).

How

  • trackChangesModel.ts: splitBlocksWithRanges (block source offsets) + pure renderAuthorship(currentText, spans) — PUA sentinel injection through markdown-it, post-processed to <span class="cw-by-claude|cw-by-human">; fences atomic.
  • AttributionController.spansFor(document) — maps live F3 spans to authorship spans (resolves the URI-vs-keyOf key mismatch).
  • trackChangesPreview.ts: per-panel mode + setMode message + render branch; extension.ts reorders the F7 controller after attribution.
  • media/: segmented toggle, legend, .cw-by-* CSS.
  • model.ts/store.ts/mergeArtifacts.ts/diffViewController.ts/baselineStore.ts untouched; track-changes mode behavior unchanged.

Invariants

INV-26 (authorship is baseline-independent), INV-27 (fences atomic), INV-28 (pure renderAuthorship).

Tests

  • Unit (vitest): 161 passing (+ splitBlocksWithRanges, renderAuthorship incl. adjacency / atomic-fence / sentinel-leak / determinism).
  • Host E2E (no LLM): 37 with-workspace (incl. new F9 authorship suite) + 5 no-workspace; all F2–F8 regressions green.

Docs: docs/MANUAL-SMOKE-F9.md, README F9 section. Plan: docs/superpowers/plans/2026-06-11-f9-authorship-preview.md.

🤖 Generated with Claude Code

Adds an **Authorship** mode to the F7 rendered preview, surfaced as friction during F8 testing ("the preview doesn't show the Claude-composed annotations"). Design: `docs/superpowers/specs/2026-06-11-authorship-preview-design.md`. Session 0026. ## What changes The preview header gains a `[ Track changes | Authorship ]` toggle (per-panel, default **Track changes** — unchanged). **Authorship** mode re-renders the *current* document with each span colored by its F3 author — Claude (blue) vs you (green), **inline and char-precise** — with a header legend. Because it reads F3 attribution directly (not the F6 baseline), Claude's contributions stay visible even after the baseline absorbs a landing (INV-18). Code/mermaid fences get a block-level author badge (atomic, INV-27). ## How - `trackChangesModel.ts`: `splitBlocksWithRanges` (block source offsets) + pure `renderAuthorship(currentText, spans)` — PUA sentinel injection through markdown-it, post-processed to `<span class="cw-by-claude|cw-by-human">`; fences atomic. - `AttributionController.spansFor(document)` — maps live F3 spans to authorship spans (resolves the URI-vs-keyOf key mismatch). - `trackChangesPreview.ts`: per-panel mode + `setMode` message + render branch; `extension.ts` reorders the F7 controller after attribution. - `media/`: segmented toggle, legend, `.cw-by-*` CSS. - **`model.ts`/`store.ts`/`mergeArtifacts.ts`/`diffViewController.ts`/`baselineStore.ts` untouched**; track-changes mode behavior unchanged. ## Invariants INV-26 (authorship is baseline-independent), INV-27 (fences atomic), INV-28 (pure `renderAuthorship`). ## Tests - Unit (vitest): **161 passing** (+ `splitBlocksWithRanges`, `renderAuthorship` incl. adjacency / atomic-fence / sentinel-leak / determinism). - Host E2E (no LLM): **37** with-workspace (incl. new F9 authorship suite) + **5** no-workspace; all F2–F8 regressions green. Docs: `docs/MANUAL-SMOKE-F9.md`, README F9 section. Plan: `docs/superpowers/plans/2026-06-11-f9-authorship-preview.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
benstull added 9 commits 2026-06-11 21:40:49 +00:00
F7 gains an Authorship mode (segmented header toggle) that renders the current doc
with each span colored by its F3 author (Claude blue / human green), inline and
char-precise via PUA sentinel injection; code/mermaid fences get a block-level
author badge. Baseline-independent (INV-26), reads AttributionController.spansFor.
INV-26..28. Surfaced as friction during F8 testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PUA sentinel injection through markdown-it; adjacent-span ordering handled;
code/mermaid fences atomic with a block-level author badge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per-panel mode (default changes); refresh branches to renderAuthorship reading
AttributionController.spansFor; webview setMode message; extension.ts reorders the
F7 controller after attribution. getMode/setMode test seams.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
benstull merged commit 96be1dd070 into main 2026-06-11 21:40:58 +00:00
benstull deleted branch f9-authorship-preview 2026-06-11 21:40:58 +00:00
Sign in to join this conversation.