F3: document live attribution + test commands (#6)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-10 11:01:52 -07:00
parent 41b1cb4f3b
commit 644e7b77a6
+35 -2
View File
@@ -11,6 +11,9 @@ Registers one command, **`Cowriting: Show Cline SDK Info`**, which loads
catalog (a pure, key-free SDK call) in a notification and the
"Cowriting (Cline SDK)" output channel.
Features shipped so far: F2 region-anchored threads (Feature #4), F3 live
human/Claude attribution (Feature #6).
## Architecture
- CommonJS extension bundled with esbuild (`src/extension.ts``out/extension.cjs`).
@@ -43,10 +46,40 @@ sidecars under `.threads/<doc-path>.json` (plain, diffable JSON — no server).
Design: `vscode-cowriting-plugin-content/specs/coauthoring-inner-loop.md`. No live
`@cline/sdk` turn and no credentials are involved in F2.
## F3 — Live human/Claude attribution (Feature #6)
As you and Claude coauthor, every span in the buffer carries an author: human
edits render with a subtle left border, Claude-authored spans with a background
tint. Text that predates tracking stays plain — the honest record. Edits that
touch a boundary (split, merge, partial overwrite) are handled char-precisely.
Attribution is persisted git-natively in the same `.threads/` sidecars
(`attributions[]`, sharing the same `anchors` fingerprints as F2 threads). On
reload, fingerprints re-resolve spans against the current document; spans that
can't be confidently re-found are **orphaned** (status-bar count + "Cowriting
Attribution" output channel) rather than silently moved or discarded.
**Commands**
- **`Cowriting: Ask Claude to Edit Selection`** — select text → enter an
instruction → a live `@cline/sdk` turn runs on the built-in `claude-code`
provider (rides your local Claude Code Pro/Max login; the extension stores no
credentials). The replacement lands in the buffer as a Claude-attributed span.
- **`Cowriting: Toggle Attribution`** — show/hide attribution decorations.
- `cowriting.applyAgentEdit` _(palette-hidden)_ — the single machine-edit
ingress seam. Tests drive this directly so CI requires no LLM.
Design: `vscode-cowriting-plugin-content/specs/coauthoring-attribution.md`.
## Develop
- `npm run watch` — rebuild on change.
- `npm test` — vitest unit suite (SDK driver, schema, store, anchorer, thread mutations).
- `npx vitest run` unit suite (SDK driver, schema, store, anchorer, thread
mutations, attribution split/merge).
- `npm run test:e2e``@vscode/test-electron` host E2E
(create → reply → resolve → persist → reload → re-anchor → orphan).
(create → reply → resolve → persist → reload → re-anchor → orphan; drives
`cowriting.applyAgentEdit` directly — no LLM required).
- `npm run smoke:live` — scripted live-turn smoke test for F3; requires Claude
Code installed and signed in. See
[`docs/MANUAL-SMOKE-F3.md`](docs/MANUAL-SMOKE-F3.md).
- `npm run typecheck` — type-check without emit.