F11 — Preview toolbar as the primary interaction surface (#43) #44
Reference in New Issue
Block a user
Delete Branch "f11-preview-toolbar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
F11 — Preview Toolbar as the Primary Interaction Surface (#43)
Makes the rendered review preview's header toolbar the primary interaction surface. Per the graduated Solution Design
docs/superpowers/specs/2026-06-12-f11-preview-toolbar-interaction-surface.md(brainstorming session 0036); built in planning-and-executing session 0037.Beside the existing Annotations checkbox the toolbar gains:
cowriting.pinDiffBaseline, reachable from the palette again).A minimal right-click → Open Review Preview gateway (
editor/title) makes the surface reachable end to end (#41/#42 expand it). No new model, no new persistence — pin via the F6 store, edits via the F4 propose/accept seam with F3 attribution. INV-35..37.Slices (each green before the next)
pinDiffBaseline.data-src-start/endemission in both render modes (INV-36).diffToHunks→ per-hunk F4 proposals (INV-37).editor/titlegateway, non-authorable disabling, docs.Code review (self, pre-merge) — fixes applied
resolveorphans → proposal could never be accepted).diffToHunksnow anchors insertions to an adjacent source token; new E2E accepts a rewrite-with-insertion end to end and asserts accept-all reconstructs the intended document.renderPlainper-block rendering can't resolve cross-block reference-link defs — documented as a conscious tradeoff of the operator-locked block-level mapping (renderReview already rendered per-block; this keeps both modes consistent) with a characterization test.turnId(one per gesture).Tests
undoMarkstiming flake — proven by isolation (it fails identically with all F11 tests removed; root cause isexecuteCommand("undo")not reverting programmaticWorkspaceEdits in test-electron). Recommend a dedicated follow-up to redesign that test offexecuteCommand("undo").Live smoke:
docs/MANUAL-SMOKE-F11.md(manual, sealed-webview territory).🤖 Generated with Claude Code
Homes the orphaned cowriting.pinDiffBaseline command and gives the writer a reachable Pin control in the preview toolbar. Per spec §7.2 SLICE-1 (docs/superpowers/specs/2026-06-12-f11-preview-toolbar-interaction-surface.md). - trackChangesPreview: extract onDidReceiveMessage into handleWebviewMessage; add the F11 `pinBaseline` intent → DiffViewController.pin(previewedDoc) (the bound doc, not activeTextEditor — §6.7); ToolbarMsg union; receiveMessage test seam exercising the real message→seam wiring (INV-35). - webview: ⌖ Pin baseline button in #cw-header posting { type: "pinBaseline" }; theme-aware toolbar-button CSS (light/dark/high-contrast, disabled state). - package.json: unhide pinDiffBaseline — commandPalette `when` false → editorLangId == markdown (resolves the #34 orphan from the command side). - host E2E (test/e2e/suite/f11Toolbar.test.ts): pinBaseline message clears the change-marks + advances the baseline to `pinned`; palette `when` is reachable. Also archives the F11 implementation plan to docs/superpowers/plans/. 197 unit + 47 host E2E green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>The one Ask-Claude toolbar button now adapts: its label flips on selectionchange (Edit Selection when live text is selected in the preview, Edit Document otherwise), and a click resolves the preview selection to a SOURCE range via the nearest data-src ancestors (INV-36) — the webview's sole mapping duty. A selection touching no live-source block falls back to document scope. Per spec §6.5 PUC-2/3 / §7.2 SLICE-4. - webview (media/preview.ts): nearestSrc() DOM walk + selectionSrcRange() block-union; updateAskLabel() on selectionchange + after each render; the adaptive click posts { askClaude, scope:"selection", start, end } or falls back to document scope. Sealed (INV-21): reads data-src only, posts intent. - host: runEditAndPropose's range branch (already shared from SLICE-3) records one single-range F4 proposal over the resolved block-union. - host E2E: stubbed selection turn → exactly one proposal over the resolved range (turn receives exactly the selected source; replaced == the range; doc untouched); an unchanged replacement proposes nothing. (The webview DOM selection→data-src lookup is sealed-sandbox → manual smoke, spec §6.8.) 205 unit + 51 host E2E green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>