Skip to content

feat: copy for Claude Code handoff (WSL path translation)#9

Merged
DCCA merged 1 commit into
mainfrom
feat/copy-for-claude-code
Jun 27, 2026
Merged

feat: copy for Claude Code handoff (WSL path translation)#9
DCCA merged 1 commit into
mainfrom
feat/copy-for-claude-code

Conversation

@DCCA

@DCCA DCCA commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Why

Sharing a screenshot with a Claude Code session was broken in two ways: the Copy Local Share Link output produces a chrome-extension://… URL an LLM can't read, and when Claude runs in WSL while the browser runs in Windows, the only readable artifact is a file on disk — which the user had to hunt down manually. The Windows Downloads folder is visible from WSL at /mnt/c/…; this wires that up automatically.

What

A third editor output, Copy for Claude Code:

  1. Saves the annotated PNG to Downloads/shotback/ via chrome.downloads.
  2. Reads back the file's absolute on-disk path.
  3. Translates a Windows path (C:\Users\…\x.png) to its WSL mount (/mnt/c/Users/…/x.png); POSIX paths pass through unchanged.
  4. Copies a Claude-ready prompt (Review this screenshot: <path> + page URL + comments) to the clipboard.

If the absolute path can't be resolved within a short poll, it falls back to the relative Downloads/shotback/<name>.png and reports a non-success status (never a false success).

  • src/lib/wslPath.ts — pure toClaudePath() (unit-tested).
  • src/lib/feedback.tsbuildClaudeCodePrompt(), sharing comment formatting with buildExternalLlmPrompt (unit-tested).
  • public/manifest.json — add downloads permission; rationale in SECURITY.md.
  • src/editor/main.tsxcopyForClaudeCode() handler + button; the existing two outputs are untouched.

Spec: .docs/doing/2026-06-27-claude-code-capture-handoff/ (Change B).

Verification

  • npm run typecheck, npm run lint, npm run test (42 passing, +8 new), npm run format:check, npm run build — all green locally.
  • Dogfooded the dist/ output: manifest includes the downloads permission; editor.js bundle contains chrome.downloads, /mnt/, and the new prompt text.
  • The chrome.downloads flow (save + path read-back) is verified manually when loaded unpacked — no runner exists for the live extension; the pure translation/prompt logic is covered by unit tests.

🤖 Generated with Claude Code

Adds a third editor output, "Copy for Claude Code", that saves the
annotated PNG to Downloads/shotback/ via chrome.downloads, reads back its
absolute on-disk path, and copies a Claude-ready prompt referencing the
file. A Windows path (C:\...) is translated to its WSL /mnt equivalent so a
Claude Code session running in WSL can read the image directly; POSIX paths
pass through unchanged. If the absolute path can't be resolved, it falls
back to the relative Downloads/shotback path and signals a non-success
status rather than reporting success.

- src/lib/wslPath.ts: pure toClaudePath() + tests.
- src/lib/feedback.ts: buildClaudeCodePrompt() sharing comment formatting
  with buildExternalLlmPrompt; tests.
- public/manifest.json: add "downloads" permission; SECURITY.md rationale.
- src/editor/main.tsx: copyForClaudeCode() handler + button.
- Sync CLAUDE.md / README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DCCA
DCCA merged commit e38b8dd into main Jun 27, 2026
2 checks passed
@DCCA
DCCA deleted the feat/copy-for-claude-code branch June 27, 2026 20:30
DCCA added a commit that referenced this pull request Jun 27, 2026
Move the change folder to .docs/done with a completion summary; check off
tasks. Both features shipped in #8 and #9.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant