Skip to content

feat: add Launch Args setting for Claude provider#1971

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

feat: add Launch Args setting for Claude provider#1971
akarabach wants to merge 5 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 a new user-configurable string that is parsed and forwarded as extraArgs into the Claude Code runtime startup, which could change session behavior and introduce new failure modes if invalid flags are provided.

Overview
Adds a new providers.claudeAgent.launchArgs setting (defaulting to empty) and exposes it in the web settings UI so users can enter arbitrary Claude Code CLI flags.

On the server, the Claude adapter now parses this string into an extraArgs map and forwards it to the Claude SDK query options when starting a session; settings/tests are updated accordingly. Also introduces a shared parseCliArgs utility (with tests) and reuses it to simplify argument parsing in scripts/update-release-package-versions.ts.

Reviewed by Cursor Bugbot for commit 5533364. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Launch Args setting to Claude provider for passing CLI flags to Claude Code

  • Adds a launchArgs string field to ClaudeSettings (defaulting to empty string) in settings.ts, parsed using a new parseCliArgs utility in cliArgs.ts.
  • The settings UI in SettingsPanels.tsx exposes a 'Launch arguments' input under the Claude provider section; the panel auto-expands if launchArgs is set.
  • ClaudeAdapter.ts parses launchArgs on session start and injects the resulting flags as extraArgs into the query options passed to the Claude agent.
  • parseCliArgs supports --flag, --key value, and --key=value syntaxes; also used to refactor parseArgs in update-release-package-versions.ts.

Macroscope summarized 5533364.

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: 3f121933-40f4-441f-a3e2-2e9053a3392e

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) that propagates configuration to Claude Code sessions at runtime. Additionally, there's an unresolved bug report about a behavioral regression in the CLI argument parser affecting boolean flags before positionals.

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 5533364. Configure here.

writeGithubOutput = true;
continue;
}
const { flags, positionals } = parseCliArgs(argv);
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.

Boolean flag before positional silently consumed as value

Medium Severity

The refactoring of parseArgs to use the generic parseCliArgs introduces a behavioral regression. The old code explicitly knew --github-output was a boolean flag. The new generic parser uses a heuristic where any non--- token after a flag is consumed as that flag's value. So parseArgs(["--github-output", "1.2.3"]) now fails — "1.2.3" is eaten as the value of --github-output, leaving zero positionals and throwing a usage error. The old code returned the correct result. The existing test for "flags before positional" only passes because --github-output is followed by another ---prefixed flag, masking this regression.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5533364. 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