Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.3 KiB
vscode-cowriting-plugin
Non-shippable proof-of-concept (Feature #2 of Epic #1): a standalone VS Code
extension that drives @cline/sdk
— validating Approach A (own coauthoring extension on the Cline SDK, no fork).
What it does
Registers one command, Cowriting: Show Cline SDK Info, which loads
@cline/sdk and shows the SDK build version plus the agent's builtin tool
catalog (a pure, key-free SDK call) in a notification and the
"Cowriting (Cline SDK)" output channel.
Architecture
- CommonJS extension bundled with esbuild (
src/extension.ts→out/extension.cjs). @cline/sdkis ESM-only (Node ≥22) and usescreateRequire(import.meta.url), so it is not bundled — it is shipped innode_modulesand loaded at runtime via dynamicimport()from the vscode-freesrc/cline.ts.
Run it (F5)
npm installnpm run build- Press F5 (or Run → "Run Extension") to launch the Extension Development Host.
- In the new window: Cmd/Ctrl+Shift+P → "Cowriting: Show Cline SDK Info".
F2 — Region-anchored threads (Feature #4)
Attach durable, region-anchored discussion threads to any document. Threads
render in the native VS Code Comments gutter and persist as git-native
sidecars under .threads/<doc-path>.json (plain, diffable JSON — no server).
- Create: select text → run "Cowriting: Add Coauthoring Thread on Selection" (or the Comments gutter "+").
- Reply / Resolve: use the native Comments reply box and the thread's Resolve/Reopen actions.
- Survives edits, reload, and external change (
git pull): a hybrid anchor (durable content fingerprint + live offset tracking) re-resolves the thread. If the anchored text can't be confidently re-found, the thread is shown as orphaned at its last-known line — never silently moved.
Design: vscode-cowriting-plugin-content/specs/coauthoring-inner-loop.md. No live
@cline/sdk turn and no credentials are involved in F2.
Develop
npm run watch— rebuild on change.npm test— vitest unit suite (SDK driver, schema, store, anchorer, thread mutations).npm run test:e2e—@vscode/test-electronhost E2E (create → reply → resolve → persist → reload → re-anchor → orphan).npm run typecheck— type-check without emit.