Ben Stull c0bae8c774 Fix #8: register warning stubs when no workspace folder; F5 opens the repo. Add selection context menus (#9)
- extension.ts: with no folder open, every contributed coauthoring command now
  registers a warning stub ('open a folder first') instead of being absent —
  the palette no longer errors 'command not found'. Opening a folder reloads
  the window and re-activates with a real root.
- .vscode/launch.json: the EDH now opens the repo as its workspace, so plain
  F5 lands in a working state.
- package.json: editor/context menu entries for 'Ask Claude to Edit
  Selection' and 'Add Coauthoring Thread on Selection', shown only when text
  is highlighted in a file-scheme editor (editorHasSelection).
- E2E: second no-workspace pass (suite-no-workspace) pins the #8 regression.

Fixes #8. Fixes #9.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 14:26:59 -07:00

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.

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.tsout/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.

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.
  • 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; 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.
  • npm run typecheck — type-check without emit.
S
Description
Plugin for collaborative writing with machines
Readme 3.4 MiB
Languages
TypeScript 97.7%
JavaScript 1.9%
CSS 0.4%