#42 (SLICE-1, reach): selection-aware Ask-Claude from editor body + tab #49

Merged
benstull merged 1 commits from f12-slice1-ask-claude-menus into main 2026-06-13 14:27:10 +00:00
Owner

SLICE-1 — #42 (reach) of the document-edit flow (specs/coauthoring-document-edit-flow.md §7.2, INV-38).

Makes "Ask Claude to Edit" reachable from the editor body and the editor tab, selection-aware — a selection routes to editSelection, no selection to editDocument — both gated to markdown/authorable docs, both flowing through the single runEditAndPropose path (no divergent edit code).

Changes

  • package.json — add editSelection + editDocument to editor/context (selection-aware, markdown + file/untitled) and editor/title/context (selection-aware, resourceLangId == markdown). Markdown-gate the existing editor/context editSelection entry to match INV-38 (command handler unchanged; palette still reaches any authorable doc).
  • trackChangesPreview.tscowriting.editDocument accepts the clicked tab's resource Uri (editor/title/context), targeting that document (opening it if needed) and falling back to the active editor with no arg — mirroring showTrackChangesPreview's #41 clicked-doc resolution.
  • test/e2e/suite/f12Reach.test.ts — menu entries present + selection-aware + markdown-gated; editDocument(uri) targets the tab doc not the active editor; no-arg falls back to the active editor.
  • docs/MANUAL-SMOKE-F12.md — SLICE-1 reach smoke steps.

Tests

208 unit + 65/5 host E2E green (4 new F12 tests + existing editDocument test).

Deferred decision (for review)

Markdown-gating editSelection's editor/context entry: spec §5/INV-38 want both Ask-Claude entries markdown-gated, but F8 made the editSelection command work on any authorable doc. Followed the spec for the menu (removes the body right-click Edit-Selection on non-markdown files; the F10 review surface is markdown-only anyway); command behavior intact.

Session 0043. Next slices: #47 (review, P1), #46 (accept).

🤖 Generated with Claude Code

**SLICE-1 — #42 (reach)** of the document-edit flow (`specs/coauthoring-document-edit-flow.md` §7.2, INV-38). Makes "Ask Claude to Edit" reachable from the editor **body** and the editor **tab**, selection-aware — a selection routes to `editSelection`, no selection to `editDocument` — both gated to markdown/authorable docs, both flowing through the single `runEditAndPropose` path (no divergent edit code). ## Changes - **package.json** — add `editSelection` + `editDocument` to `editor/context` (selection-aware, markdown + `file`/`untitled`) and `editor/title/context` (selection-aware, `resourceLangId == markdown`). Markdown-gate the existing `editor/context` `editSelection` entry to match INV-38 (command handler unchanged; palette still reaches any authorable doc). - **trackChangesPreview.ts** — `cowriting.editDocument` accepts the clicked tab's resource Uri (`editor/title/context`), targeting that document (opening it if needed) and falling back to the active editor with no arg — mirroring `showTrackChangesPreview`'s #41 clicked-doc resolution. - **test/e2e/suite/f12Reach.test.ts** — menu entries present + selection-aware + markdown-gated; `editDocument(uri)` targets the tab doc not the active editor; no-arg falls back to the active editor. - **docs/MANUAL-SMOKE-F12.md** — SLICE-1 reach smoke steps. ## Tests 208 unit + 65/5 host E2E green (4 new F12 tests + existing editDocument test). ## Deferred decision (for review) Markdown-gating `editSelection`'s `editor/context` entry: spec §5/INV-38 want both Ask-Claude entries markdown-gated, but F8 made the `editSelection` *command* work on any authorable doc. Followed the spec for the **menu** (removes the body right-click Edit-Selection on non-markdown files; the F10 review surface is markdown-only anyway); command behavior intact. Session 0043. Next slices: #47 (review, P1), #46 (accept). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
benstull added 1 commit 2026-06-13 14:26:55 +00:00
Document-edit flow SLICE-1 (specs/coauthoring-document-edit-flow.md §7.2,
INV-38): make "Ask Claude to Edit" reachable from the editor body AND the
editor tab, selection-aware — a selection routes to editSelection, no
selection to editDocument — both gated to markdown/authorable docs, both
flowing through the single runEditAndPropose path (no divergent edit code).

- package.json: add editSelection + editDocument to editor/context (selection-
  aware, markdown + file/untitled) and editor/title/context (selection-aware,
  resourceLangId == markdown). Markdown-gate the existing editor/context
  editSelection entry to match (its command handler is unchanged; the palette
  still reaches any authorable doc — see transcript Deferred decisions).
- trackChangesPreview.ts: cowriting.editDocument accepts the clicked tab's
  resource Uri (editor/title/context), targeting THAT document (opening it if
  needed) and falling back to the active editor when invoked with no arg —
  mirroring showTrackChangesPreview's #41 clicked-doc resolution.
- E2E (test/e2e/suite/f12Reach.test.ts): menu entries present, selection-aware,
  markdown-gated; editDocument(uri) targets the tab doc not the active editor;
  no-arg falls back to the active editor.
- docs/MANUAL-SMOKE-F12.md: SLICE-1 reach smoke steps.

208 unit + 65/5 host E2E green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
benstull merged commit e804c46ba0 into main 2026-06-13 14:27:10 +00:00
Sign in to join this conversation.