Skip to content

feat: add Launch Args setting for Claude provider#1971

Open
akarabach wants to merge 6 commits intopingdotgg:mainfrom
akarabach:feat/claude-chrome-integration
Open

feat: add Launch Args setting for Claude provider#1971
akarabach wants to merge 6 commits intopingdotgg:mainfrom
akarabach:feat/claude-chrome-integration

Conversation

@akarabach
Copy link
Copy Markdown

@akarabach akarabach commented Apr 12, 2026

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's query() function which never forwarded any of them. The SDK's extraArgs option (Record<string, string | null>) is the only way to pass additional flags.

Design decisions

Generic launchArgs string instead of enableChrome boolean — 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-in parseArgs requires 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 --chrome is boolean while --effort high takes a value. Our 15-line parseLaunchArgs uses the standard heuristic (if the next token doesn't start with --, it's a value) — same approach as minimist. We chose not to add an external dependency for this.

Changes (5 files)

  • packages/contracts/src/settings.ts — added launchArgs: string (default "") to ClaudeSettings schema and ClaudeSettingsPatch
  • apps/server/src/provider/Layers/ClaudeAdapter.ts — added parseLaunchArgs() that converts CLI-style input to the SDK's extraArgs format; wired into queryOptions
  • apps/web/src/components/settings/SettingsPanels.tsx — added Launch arguments text input in the Claude provider details panel
  • apps/server/src/provider/Layers/ClaudeAdapter.test.ts — 12 unit tests for parseLaunchArgs covering real Claude CLI flags (--chrome, --effort high, --model claude-sonnet-4-6, --max-budget-usd 5.00, etc.) and edge cases
  • apps/server/src/serverSettings.test.ts — updated assertions for new field

Screenshots

Screenshot 2026-04-13 at 01 31 49 Screenshot 2026-04-13 at 00 42 40

Settings panel with Launch arguments field

Tested

  • --chrome flag — confirmed Claude session launches with Chrome browser integration
  • --chrome --debug — multiple flags forwarded correctly
  • Clearing the field and starting a new session — no extra args passed
  • Unit tests pass for parseLaunchArgs (12 tests)

Test plan

  • Start T3 Code locally (bun run dev)
  • Open Settings → Claude provider → expand details
  • Verify "Launch arguments" input appears below the binary path field
  • Type --chrome → start a new Claude session → confirm Chrome/browser tools are available
  • Clear the field → start another session → confirm no Chrome tools
  • Fresh install (no existing settings) → confirm launchArgs defaults to empty string

Note

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 launchArgs into an extraArgs map and forwards it to the @anthropic-ai/claude-agent-sdk query options when creating a session.

Introduces a small shared parseCliArgs utility (with tests) and refactors scripts/update-release-package-versions.ts to 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

  • Adds a launchArgs string field to ClaudeSettings (defaulting to empty) and the patch schema in settings.ts, allowing users to pass extra CLI flags to the Claude agent on session start.
  • Adds a new parseCliArgs utility 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.
  • The Claude adapter in ClaudeAdapter.ts now parses launchArgs via parseCliArgs and forwards the resulting flags as extraArgs when building query options.
  • The settings UI in SettingsPanels.tsx exposes a "Launch arguments" input field for the Claude agent section.
  • Refactors parseArgs in update-release-package-versions.ts to use parseCliArgs, fixing --github-output incorrectly consuming the version positional.

Macroscope summarized 459c130.

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c8c34ab9-ae42-4140-b94b-6e70852e67c5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 12, 2026
@juliusmarminge
Copy link
Copy Markdown
Member

a setting for launchArgs or something feels more generic?

macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 12, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 12, 2026

Approvability

Verdict: 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.

@macroscopeapp macroscopeapp bot dismissed their stale review April 12, 2026 22:32

Dismissing prior approval to re-evaluate cfefd47

@akarabach akarabach changed the title feat: add Enable Chrome setting for Claude provider feat: add Launch Args setting for Claude provider Apr 12, 2026
* "--chrome --debug" → { chrome: null, debug: null }
* "--chrome --max-turns 5" → { chrome: null, "max-turns": "5" }
*/
export function parseLaunchArgs(args: string): Record<string, string | null> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure we already have one of these for git?

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 13, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 459c130. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants