Skip to content

feat: add Launch Args setting for Claude provider#1971

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

feat: add Launch Args setting for Claude provider#1971
akarabach wants to merge 7 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 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, ClaudeAdapter now parses launchArgs and forwards the resulting flag map into the Claude SDK’s query options as extraArgs when starting a session.

Introduces a reusable parseCliArgs helper (with tests) and updates scripts/update-release-package-versions.ts to use it, improving handling of boolean flags like --github-output without 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

  • 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 4931df9.

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: 929caa65-3491-4cfc-93c9-173ed7d9ae4b

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
Comment thread apps/server/src/provider/Layers/ClaudeAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/ClaudeAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/ClaudeAdapter.ts Outdated
@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
Comment thread scripts/update-release-package-versions.ts Outdated
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.

Comment thread packages/shared/src/cliArgs.ts
),
);
const claudeBinaryPath = claudeSettings.binaryPath;
const extraArgs = parseCliArgs(claudeSettings.launchArgs).flags;
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.

if I enter some invalid value in the input box there's no indication of that and they'll be silently ignored?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, but Claude won't be able to start.

Screenshot 2026-04-14 at 01 01 31

Copy link
Copy Markdown
Author

@akarabach akarabach Apr 14, 2026

Choose a reason for hiding this comment

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

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:

  1. Runtime extraction - run claude --help when 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.

  2. 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.

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