feat: add Launch Args setting for Claude provider#1971
feat: add Launch Args setting for Claude provider#1971akarabach wants to merge 7 commits intopingdotgg:mainfrom
Conversation
Claude Code supports a --chrome flag to launch with Chrome browser integration, but the SDK query path used by T3 Code never passed it. Add an `enableChrome` boolean to Claude provider settings (default off) and forward it via the SDK's `extraArgs` option when enabled.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
a setting for |
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (Launch Args setting for Claude) that propagates user input to CLI invocations. An unresolved review comment identifies a parsing bug with quoted multi-word values, and another reviewer questions potential code duplication with an existing CLI parser. You can customize Macroscope's approvability policy. Learn more. |
- fix test - add tests for parser
Dismissing prior approval to re-evaluate cfefd47
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 459c130. Configure here.
| ), | ||
| ); | ||
| const claudeBinaryPath = claudeSettings.binaryPath; | ||
| const extraArgs = parseCliArgs(claudeSettings.launchArgs).flags; |
There was a problem hiding this comment.
if I enter some invalid value in the input box there's no indication of that and they'll be silently ignored?
There was a problem hiding this comment.
I considered a few approaches for validating the launch args input and decided to keep it as a plain text field without validation. Here's the reasoning:
-
Runtime extraction - run
claude --helpwhen the user opens settings, parse the output to get valid flags, validate against them. Problems: --help output is unstructured text (no --json option), parsing is fragile across CLI versions, and we'd need to filter out flags the SDK already handles (--model, --effort, --resume, etc.) to avoid conflicts. -
Hardcoded flag list - maintain a static list of valid Claude CLI flags. Problems: Claude CLI updates frequently, the list would go stale fast, and false negatives on new valid flags would be worse than no validation.


What changed
Added a generic Launch arguments text field to the Claude provider settings. Users can pass any CLI flags (e.g.
--chrome,--effort high,--debug) that get forwarded to the Claude Code process on session start.This addresses the original need (Chrome browser integration) while being generic enough to support any future CLI flag without further code changes.
Why
Claude Code supports many CLI flags (see
claude --help), but T3 Code uses@anthropic-ai/claude-agent-sdk'squery()function which never forwarded any of them. The SDK'sextraArgsoption (Record<string, string | null>) is the only way to pass additional flags.Design decisions
Generic
launchArgsstring instead ofenableChromeboolean — per review feedback from @juliusmarminge, a generic field is more future-proof than a Chrome-specific toggle.Custom parser instead of
node:util.parseArgs— Node's built-inparseArgsrequires explicit type definitions for each flag to distinguish boolean flags from value-taking flags. Since we accept arbitrary user-provided flags, it can't determine that--chromeis boolean while--effort hightakes a value. Our 15-lineparseLaunchArgsuses the standard heuristic (if the next token doesn't start with--, it's a value) — same approach asminimist. We chose not to add an external dependency for this.Changes (5 files)
packages/contracts/src/settings.ts— addedlaunchArgs: string(default"") toClaudeSettingsschema andClaudeSettingsPatchapps/server/src/provider/Layers/ClaudeAdapter.ts— addedparseLaunchArgs()that converts CLI-style input to the SDK'sextraArgsformat; wired intoqueryOptionsapps/web/src/components/settings/SettingsPanels.tsx— added Launch arguments text input in the Claude provider details panelapps/server/src/provider/Layers/ClaudeAdapter.test.ts— 12 unit tests forparseLaunchArgscovering real Claude CLI flags (--chrome,--effort high,--model claude-sonnet-4-6,--max-budget-usd 5.00, etc.) and edge casesapps/server/src/serverSettings.test.ts— updated assertions for new fieldScreenshots
Settings panel with Launch arguments field
Tested
--chromeflag — confirmed Claude session launches with Chrome browser integration--chrome --debug— multiple flags forwarded correctlyparseLaunchArgs(12 tests)Test plan
bun run dev)--chrome→ start a new Claude session → confirm Chrome/browser tools are availablelaunchArgsdefaults to empty stringNote
Medium Risk
Adds a new user-configurable field that is forwarded into Claude Code process startup via SDK
extraArgs, which can change runtime behavior and is sensitive to parsing/flag handling. Also refactors a release-version script’s argument parsing, which could affect automation if edge cases differ from the previous behavior.Overview
Adds a new Claude provider setting,
launchArgs, surfaced in the web settings UI and persisted via the settings contracts/schema (defaulting to empty).On the server,
ClaudeAdapternow parseslaunchArgsand forwards the resulting flag map into the Claude SDK’squeryoptions asextraArgswhen starting a session.Introduces a reusable
parseCliArgshelper (with tests) and updatesscripts/update-release-package-versions.tsto use it, improving handling of boolean flags like--github-outputwithout consuming the version positional.Reviewed by Cursor Bugbot for commit 4931df9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Launch Args setting for Claude provider
launchArgsstring field toClaudeSettings(defaulting to empty) and the patch schema in settings.ts, allowing users to pass extra CLI flags to the Claude agent on session start.parseCliArgsutility in packages/shared/src/cliArgs.ts that parses a string or argv array into{ flags, positionals }, supporting--key value,--key=value, and boolean flag forms.launchArgsviaparseCliArgsand forwards the resulting flags asextraArgswhen building query options.parseArgsin update-release-package-versions.ts to useparseCliArgs, fixing--github-outputincorrectly consuming the version positional.Macroscope summarized 4931df9.