You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[STG-2080] feat: add managed local Chrome args (browserbase#2201)
## Summary
Port of
[browserbase/cli#127](browserbase/cli#127) into
the stagehand monorepo, where the browse CLI now lives at `packages/cli`
(package `browse`). The old `browserbase/cli` repo is deprecated.
Adds a managed-local Chrome launch-arg surface to the browse CLI,
matching the Playwright / Puppeteer / chrome-launcher convention (three
repeatable/boolean flags, no JSON):
- `--chrome-arg <flag>` (repeatable) — append a launch arg on top of
Chrome's defaults
- `--ignore-default-chrome-arg <flag>` (repeatable) — drop a specific
default arg
- `--no-default-chrome-args` — launch without any of Chrome's default
args
All three are **managed-local only** (rejected with `--remote` / `--cdp`
/ `--auto-connect`); `--no-default-chrome-args` and
`--ignore-default-chrome-arg` are mutually exclusive. Args are threaded
into Stagehand `localBrowserLaunchOptions` (`args` /
`ignoreDefaultArgs`) and tracked as part of daemon target compatibility
so session reuse respects them.
**Usage note:** because `--chrome-arg` / `--ignore-default-chrome-arg`
are variadic, pass the URL *before* them (`browse open <url> --local
--chrome-arg=--foo`) or terminate flags with `--`. The CLI prints a
clear error pointing this out otherwise.
## Files
- `packages/cli/src/lib/driver/flags.ts` — new flag definitions
- `packages/cli/src/lib/driver/mode.ts` — flag parsing, conflict checks,
`managedLocalTarget(...)` / `resolveChromeArgs(...)` helpers, chrome-arg
target-compatibility comparison (merged on top of the monorepo's
`getRemote()` / async `stagehandOptions` refactor)
- `packages/cli/src/lib/driver/command-cli.ts` —
`hasChromeArgFlags(flags)` wired into `hasExplicitDriverTarget` /
`hasModeOnlyFlag`
- `packages/cli/src/lib/driver/types.ts` — `chromeArgs` /
`ignoreDefaultArgs` / `noDefaultChromeArgs` on the managed-local target
- `packages/cli/src/lib/driver/session-manager.ts` — forwards args into
`localBrowserLaunchOptions`
- `packages/cli/README.md` — flag table rows + example
- `packages/cli/tests/driver-{commands,foundation}.test.ts` — parsing,
conflicts, compatibility, pass-through
- `.changeset/managed-local-chrome-args.md` — `browse` patch
## E2E Test Matrix
| Command / flow | Observed output | Confidence / sufficiency |
| --- | --- | --- |
| `npx turbo run build --filter=browse` | `4 successful, 4 total` —
builds `@browserbasehq/stagehand` (with `gen-version` +
`build-dom-scripts` prereqs) then `browse`; `tsc` + oclif manifest clean
| Proves the merged driver files compile against the monorepo's
refactored core. |
| `pnpm test` (in `packages/cli`) | `Test Files 15 passed (15)` / `Tests
212 passed (212)` — incl. the new managed-local chrome-arg foundation
tests and driver-command parsing/conflict/compatibility tests | Unit +
contract coverage for flag parsing, conflict rules, daemon target
compatibility/reuse, and Stagehand option pass-through. |
| `pnpm lint` (in `packages/cli`) | `prettier --check` clean, `eslint`
clean, `tsc --noEmit` clean | Format / lint / typecheck green on the
ported + merged files. |
Linear: https://linear.app/browserbase/issue/STG-2080
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds managed-local Chrome launch-arg flags to the `browse` CLI so users
can add or override Chrome defaults. Fulfills Linear STG-2080 and
ensures daemon session reuse only when these options match.
- **New Features**
- New flags: `--chrome-arg <flag>` (repeatable),
`--ignore-default-chrome-arg <flag>` (repeatable),
`--no-default-chrome-args`.
- Managed-local only; rejected with `--remote`, `--cdp`,
`--auto-connect`, or implicit remote mode.
- `--no-default-chrome-args` and `--ignore-default-chrome-arg` are
mutually exclusive.
- Flags flow into `localBrowserLaunchOptions` (`args`,
`ignoreDefaultArgs`) for `@browserbasehq/stagehand`.
- Daemon session reuse now compares these args; chrome-arg flags also
mark an explicit driver target.
- **Refactors**
- Use Node’s `isDeepStrictEqual` to compare `chromeArgs` and
`ignoreDefaultArgs` for target compatibility.
- Restored `browse` patch changeset for the decoupled release workflow.
<sup>Written for commit e3a9531.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/browserbase/stagehand/pull/2201?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Add Chrome launch arg flags for managed local browser sessions: `--chrome-arg <flag>` (repeatable) appends launch args on top of Chrome's defaults, `--ignore-default-chrome-arg <flag>` (repeatable) drops specific default args, and `--no-default-chrome-args` launches without any of Chrome's defaults.
0 commit comments