feat: add Launch Args setting for Claude provider#1971
feat: add Launch Args setting for Claude provider#1971akarabach wants to merge 6 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
| * "--chrome --debug" → { chrome: null, debug: null } | ||
| * "--chrome --max-turns 5" → { chrome: null, "max-turns": "5" } | ||
| */ | ||
| export function parseLaunchArgs(args: string): Record<string, string | null> { |
There was a problem hiding this comment.
Pretty sure we already have one of these for git?
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.
| */ | ||
| export function parseCliArgs(args: string | readonly string[], options?: ParseCliArgsOptions): ParsedCliArgs { | ||
| const tokens = | ||
| typeof args === "string" ? args.trim().split(/\s+/).filter(Boolean) : Array.from(args); |
There was a problem hiding this comment.
Whitespace splitting silently misparses quoted multi-word values
Medium Severity
The string input path in parseCliArgs uses args.trim().split(/\s+/) without any quote handling. When a user enters something like --append-system-prompt "think step by step" in the Launch arguments field, the tokenizer splits on every space, producing ["--append-system-prompt", '"think', "step", "by", 'step"']. The flag captures only "think (with a literal quote char) as its value, while the remaining words become positionals. Since the Claude adapter only uses .flags and silently discards .positionals, the user gets a corrupted, truncated flag value with no error or warning. Claude CLI flags like --append-system-prompt naturally accept multi-word values, making this a realistic user scenario.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 459c130. Configure here.


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 user-configurable CLI arguments that are forwarded into Claude session startup, which can change provider runtime behavior and could cause unexpected failures if malformed flags are entered.
Overview
Adds a new Claude provider setting,
launchArgs, exposed in the web Settings UI and defaulted/patchable via the contracts schema.On the server, Claude session startup now parses
launchArgsinto anextraArgsmap and forwards it to the@anthropic-ai/claude-agent-sdkquery options when creating a session.Introduces a small shared
parseCliArgsutility (with tests) and refactorsscripts/update-release-package-versions.tsto use it; server settings tests are updated for the new default field.Reviewed by Cursor Bugbot for commit 459c130. 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 459c130.