diff --git a/README.md b/README.md index 405e96f..73cccb5 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ catalog (a pure, key-free SDK call) in a notification and the Features shipped so far: F2 region-anchored threads (Feature #4), F3 live human/Claude attribution (Feature #6), F4 propose/accept diff flow (Feature #12), F5 cross-rung sidecar contract (Feature #14), F6 diff-view -toggle (Feature #17), and F10 interactive review — **write left / review -right** (Feature #29). +toggle (Feature #17), F10 interactive review — **write left / review +right** (Feature #29), and F11 — the **preview toolbar as the primary +interaction surface** (Feature #43). ## Architecture @@ -262,6 +263,33 @@ they are no longer separate user surfaces. Design: `vscode-cowriting-plugin-content/specs/coauthoring-interactive-review.md`. Live smoke: [`docs/MANUAL-SMOKE-F10.md`](docs/MANUAL-SMOKE-F10.md). +## F11 — Preview toolbar as the primary interaction surface (Feature #43) + +The review preview's **header toolbar** becomes the cockpit for the inner loop. +Beside the existing **Annotations** switch it gains two controls: + +- **⌖ Pin baseline** — pins the previewed document's review baseline to now and + clears the change-marks (homes the previously-orphaned `pinDiffBaseline` + command, which is reachable from the palette again too). +- **✦ Ask Claude…** — one **adaptive** button. Its label flips on the preview's + selection: **Edit Selection** when text is selected in the rendered preview, + **Edit Document** otherwise. Clicking it opens a host input box for the + instruction (the LLM turn and prompt stay host-side — the sealed webview gains + no LLM/credential surface), then surfaces the result as F4 proposals — **one** + for a selection (mapped back to its source block-union), or **one per changed + hunk** for a whole-document rewrite (`diffToHunks`), each independently ✓/✗-able. + +The pure render layer emits `data-src-start`/`data-src-end` on every block in +**both** modes (INV-36); the webview's only mapping duty is walking a selection +to its nearest `data-src` ancestor. Right-clicking a markdown tab → **Open Review +Preview** is the minimal gateway making the surface reachable end to end (#41/#42 +expand it). Edit controls are disabled on a non-authorable doc (reading stays +allowed). No new model, no new persistence — pin via the F6 store, edits via the +F4 propose/accept seam with F3 attribution (INV-35..37). + +Design: [`docs/superpowers/specs/2026-06-12-f11-preview-toolbar-interaction-surface.md`](docs/superpowers/specs/2026-06-12-f11-preview-toolbar-interaction-surface.md). +Live smoke: [`docs/MANUAL-SMOKE-F11.md`](docs/MANUAL-SMOKE-F11.md). + ## Develop - `npm run watch` — rebuild on change. diff --git a/docs/MANUAL-SMOKE-F11.md b/docs/MANUAL-SMOKE-F11.md new file mode 100644 index 0000000..3ccdae1 --- /dev/null +++ b/docs/MANUAL-SMOKE-F11.md @@ -0,0 +1,67 @@ +# Manual smoke — F11 preview toolbar as the primary interaction surface (#43) + +F11 makes the rendered preview's **header toolbar** the primary interaction +surface: beside the existing **Annotations** switch it gains a **Pin baseline** +button and a **single adaptive Ask-Claude button** (Edit Selection when text is +selected in the preview, Edit Document otherwise). The webview's *visual* +behavior — the buttons, the live label flip, and the selection→source mapping — +is verified **here**, not in the automated host E2E (the webview is a sealed +sandbox; the host's message→seam wiring is covered by the F11 E2E suite). Run +once per change that touches F11. Live turns hit the SDK; use a trivial +instruction to keep them quick. + +## Setup + +1. `npm run build` +2. Launch the Extension Development Host (F5 in VS Code, or the Run panel) with + `sandbox/` open. +3. Open a markdown document with a few paragraphs (e.g. copy + `test/e2e/fixtures/workspace/docs/preview.md`). + +## Steps + +1. **Right-click gateway (PUC-6).** Right-click the markdown editor **tab** (or + use the editor title bar) → **"Cowriting: Open Review Preview"**. The preview + opens beside the editor. (The palette entry and `Ctrl+Alt+R` still work too.) +2. **Three header controls (PUC-1).** The header row shows, left to right: the + **☑ Annotations** checkbox (on), a **⌖ Pin baseline** button, and a **✦ Ask + Claude to Edit Document** button. They restyle with the theme. +3. **Adaptive label — selection (PUC-2).** Select a paragraph **in the preview** + (drag across rendered text). The Ask-Claude button label flips live to **"✦ + Ask Claude to Edit Selection"**. Click elsewhere to clear the selection → it + flips back to **"✦ Ask Claude to Edit Document"**. +4. **Edit Selection (PUC-3).** With a paragraph selected in the preview, click + **Ask Claude to Edit Selection** → a host input box appears → type an + instruction (e.g. "tighten this") → submit. A **blue `cw-proposal` block** + appears **inline at that paragraph** with **✓ / ✗** (the selection mapped back + to its source block; the edit ran host-side). The editor does **not** change + (INV-10). Accept with **✓**: the replacement lands; the block clears. +5. **Edit Document (PUC-4).** Clear the selection (button reads "Edit Document"). + Click it → instruct (e.g. "fix any typos and tighten") → submit. Claude's + whole-document rewrite surfaces as **one or more** independent blue proposal + blocks (one per changed hunk), each independently **✓ / ✗**-able. Accept some, + reject others — each behaves as an ordinary F10 proposal. +6. **Pin baseline (PUC-5).** Make (or accept) a few changes so the preview shows + change-marks and a non-zero summary. Click **⌖ Pin baseline**. Expect: the + change-marks **clear**, the summary resets to `+0 −0`, and the header epoch + reads **`pinned