Files
vscode-cowriting-plugin/README.md
T
Ben Stull 40c118e1a0 F2: document region-anchored threads + test commands (#4)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 06:59:45 -07:00

53 lines
2.3 KiB
Markdown

# vscode-cowriting-plugin
Non-shippable **proof-of-concept** (Feature #2 of Epic #1): a standalone VS Code
extension that drives **[`@cline/sdk`](https://www.npmjs.com/package/@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/sdk` is ESM-only (Node ≥22) and uses `createRequire(import.meta.url)`,
so it is **not** bundled — it is shipped in `node_modules` and loaded at
runtime via dynamic `import()` from the vscode-free `src/cline.ts`.
## Run it (F5)
1. `npm install`
2. `npm run build`
3. Press **F5** (or Run → "Run Extension") to launch the Extension Development Host.
4. 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-electron` host E2E
(create → reply → resolve → persist → reload → re-anchor → orphan).
- `npm run typecheck` — type-check without emit.