Repository navigation
feat: use Claude Code instead of an API key, and start it from the Implement tab - #20
Merged
Merged
Conversation
…plement tab Adds a "How to reach Claude" option. With "Claude Code on this computer", the service worker sends requests through native messaging to a small helper (native-host/) that runs the user's own `claude -p` with the same system prompts, JSON schemas, model and effort. The Implement tab then creates a project folder with the prompt and the paper and starts Claude Code on it in a terminal window. Adds the nativeMessaging permission, documented in store/LISTING.md and PRIVACY.md. Tests use a fake claude: a native helper test and an end-to-end step through the real helper registered in the test profile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
New option, "How to reach Claude": Anthropic API, with an API key (default, unchanged) or Claude Code on this computer.
Claude Code backend.
background/claude-code.jssends each request throughchrome.runtime.connectNativeto a new native messaging helper,native-host/paper-qa-host.mjs. The helper runs the user's ownclaude -p --output-format stream-jsonin an empty temporary folder with:--system-prompt) and JSON schema (--json-schema), plus--modeland--effortfrom the options page;WebSearch/WebFetchwhen the web is allowed, no MCP servers and no saved session;Replies go through the same validators as API replies. Web sources are kept only if a search returned them or a fetch opened them, and a malformed reply is retried once.
Implement tab. With the Claude Code backend on, the button reads Write prompt & start Claude Code. Once the prompt is written, the helper creates
<folder>/<system-name>/withIMPLEMENTATION_PROMPT.mdandpaper.pdfand opens a terminal there, running Claude Code and asking it to carry out the prompt. The terminal is Terminal on macOS, the first one found on Linux, or the program inPAPER_QA_TERMINAL. Start in Claude Code starts it again in a new folder. The project folder is set on the options page (default~/paper-qa-projects).Setup.
native-host/install.sh <extension-id>(the options page shows the exact command) copies the helper to~/.paper-qa/, records wherenodeandclaudeare, and registers the helper for Chrome, plus Chromium, Brave and Edge if they're installed. Supports macOS and Linux, and--uninstall. The options page's Check Claude Code button confirms the setup works.Viewer. No API-key prompt or $ estimate in Claude Code mode. Setup and login errors show Open settings.
Why
This lets people use their Claude Code login and plan instead of an API key, and hands the implementation prompt straight to Claude Code instead of making the user copy it.
Permissions
Adds
nativeMessaging. The justification is instore/LISTING.md, andPRIVACY.mdnow describes the Claude Code backend: data passes to the user's local Claude Code, and the project folder gets the prompt and a copy of the PDF. The helper itself isn't in the store package; users install it from the repository.How it was tested
npm run check✓npm run test:native-host(new, also in CI) ✓: speaks the native messaging protocol to the helper, withtests/fake-claude.mjsstanding in for Claude Code and a fake terminal. Covers theclaude -parguments and stdin, web tool sources, the login error, a missingclaude, and project launches, including folder de-duplication.npm run test:e2e✓ (21/21): a new step registers the real helper in the headless test profile'sNativeMessagingHostswith the fakeclaude. It switches the backend on the options page, checks Check Claude Code, answers a question, starts Claude Code from a cached prompt, then writes a prompt again with web search, which starts Claude Code on its own. It also asserts the Claude API isn't called.claudebinary (it isn't installed on the dev machine). The flags follow the current Claude Code CLI reference.store/screenshot-4-options.png, which shows the new setting.🤖 Generated with Claude Code