F6: diff-view toggle (Feature #17) #18

Merged
benstull merged 9 commits from f6-diff-view-toggle into main 2026-06-11 14:21:46 +00:00
Owner

Implements F6 — diff-view toggle (Feature #17) from the graduated Solution Design vscode-cowriting-plugin-content/specs/coauthoring-diff-view.md.

One gesture (Cmd/Ctrl-Alt-D / Cowriting: Toggle Diff View) flips a tracked document into a native vscode.diff against a coauthoring baseline — readonly baseline left, the live editable document right — and back. The baseline initializes at first track, advances automatically at every machine landing (the seam is the single ingress, INV-9/18), and can be pinned on demand. Pure view, repo-free: the baseline lives in VS Code workspace storage, never the repo (INV-19) — .threads/, the cross-rung contract (INV-14..17), and SCHEMA_VERSION are untouched.

Slices (spec §7.2)

  • SLICE-1 BaselineStore (vscode-free) + vitest unit suite.
  • SLICE-2 additive onDidApplyAgentEdit seam event (INV-9/18); DiffViewController content provider + baseline lifecycle (ensure/advance/pin) + storage-unavailable fallback.
  • SLICE-3 toggle UX via tab groups; wired into extension.ts; package.json commands + ctrl+alt+d.
  • SLICE-4 host E2E (no LLM, programmatic seam ingress), no-folder stub regression, manual smoke + README.

Verification

  • npm run typecheck clean.
  • npx vitest run103 unit pass (incl. new baselineStore).
  • npm run test:e2e27 + 3 host E2E pass (exit 0), incl. the new F6 suite: opened baseline → toggle opens cowriting-baseline diff → type (baseline steady) → accept advances past the landing (INV-18) → operator delta → pin → on-disk baseline outside .threads/ (INV-19) → toggle closes → untracked warns.
  • No LLM in CI (host-E2E tier — a VS Code extension has no browser/deploy stage, the F2–F5 precedent).
  • Manual live smoke (docs/MANUAL-SMOKE-F6.md) is the one remaining operator gesture.

Session 0018. Plan: docs/superpowers/plans/2026-06-11-f6-diff-view-toggle.md.

🤖 Generated with Claude Code

Implements **F6 — diff-view toggle** (Feature #17) from the graduated Solution Design `vscode-cowriting-plugin-content/specs/coauthoring-diff-view.md`. One gesture (**Cmd/Ctrl-Alt-D** / **Cowriting: Toggle Diff View**) flips a tracked document into a native `vscode.diff` against a coauthoring baseline — readonly baseline left, the **live editable document** right — and back. The baseline initializes at first track, **advances automatically at every machine landing** (the seam is the single ingress, INV-9/18), and can be **pinned** on demand. Pure view, repo-free: the baseline lives in VS Code workspace storage, never the repo (INV-19) — `.threads/`, the cross-rung contract (INV-14..17), and `SCHEMA_VERSION` are untouched. ### Slices (spec §7.2) - **SLICE-1** `BaselineStore` (vscode-free) + vitest unit suite. - **SLICE-2** additive `onDidApplyAgentEdit` seam event (INV-9/18); `DiffViewController` content provider + baseline lifecycle (ensure/advance/pin) + storage-unavailable fallback. - **SLICE-3** toggle UX via tab groups; wired into `extension.ts`; `package.json` commands + `ctrl+alt+d`. - **SLICE-4** host E2E (no LLM, programmatic seam ingress), no-folder stub regression, manual smoke + README. ### Verification - `npm run typecheck` clean. - `npx vitest run` — **103 unit** pass (incl. new `baselineStore`). - `npm run test:e2e` — **27 + 3** host E2E pass (exit 0), incl. the new F6 suite: opened baseline → toggle opens `cowriting-baseline` diff → type (baseline steady) → accept advances past the landing (INV-18) → operator delta → pin → on-disk baseline outside `.threads/` (INV-19) → toggle closes → untracked warns. - **No LLM in CI** (host-E2E tier — a VS Code extension has no browser/deploy stage, the F2–F5 precedent). - Manual live smoke (`docs/MANUAL-SMOKE-F6.md`) is the one remaining operator gesture. Session 0018. Plan: `docs/superpowers/plans/2026-06-11-f6-diff-view-toggle.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
benstull added 9 commits 2026-06-11 14:21:38 +00:00
F6 §6.2/§6.3, INV-19. One JSON per docPath under VS Code workspace storage,
never the repo. Mirrors CoauthorStore; unit-tested round-trip/paths/overwrite.

Also lands the F6 implementation plan
(docs/superpowers/plans/2026-06-11-f6-diff-view-toggle.md).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
F6 §6.2/§6.4, INV-9/INV-18. Additive EventEmitter on the seam owner, fired
after a real (non-no-op) applyEdit succeeds. Seam signature/return unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
F6 §6.2/§6.4, INV-18/INV-19. ensure/advance/pin capture buffer text, persist
via BaselineStore, refresh the open diff via onDidChange. Storage-unavailable
degrades to in-memory + one warning. toggle UX lands in SLICE-3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
F6 §6.5 PUC-1. Detects the baseline diff tab (original scheme cowriting-baseline,
modified == the doc) to close-and-reveal; else opens vscode.diff with an epoch
title. Live document on the right — editor state preserved by construction.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
F6 §6.2. BaselineStore from context.storageUri (in-memory fallback), advance
subscribed to the seam's onDidApplyAgentEdit, ensureBaseline on first sight in
renderIfOpen, diffViewController on the CowritingApi, commands stubbed in the
no-folder path (#8 precedent).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
F6 §5/§6.4. Palette-visible commands; ctrl+alt+d (when editorTextFocus),
unbound in stock VS Code, user-remappable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
F6 §6.8. Drives the programmatic seam ingress (propose + accept, no LLM):
opened baseline → toggle opens cowriting-baseline diff → type (baseline steady)
→ accept advances past the landing (INV-18) → operator delta → pin → on-disk
baseline outside .threads (INV-19) → toggle closes (normal editor active) →
untracked warns.

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 da32e0c80b into main 2026-06-11 14:21:46 +00:00
Sign in to join this conversation.