[STG-1752] fix(cli): default browse env local to isolated
Merged
SH
8mo ago+566+566+012345678901234567890123456789-158-158-012345678901234567890123456789
Summary
- make
browse env localdefault back to an isolated local browser - add
browse env local --auto-connectas the explicit opt-in path for auto-discovering a debuggable local Chrome - keep explicit CDP attach via
browse env local <port|url>and add tests to lock in the strategy behavior
Why
browse env local was auto-attaching to an existing local Chrome by default. That can trigger Chrome's remote debugging approval dialog unexpectedly and makes isolated local usage less predictable.
Impact
Users now get a clean local browser by default, while still having two explicit ways to reuse an existing browser when they want to:
browse env local --auto-connectbrowse env local <port|url>
Test Plan
pnpm --filter @browserbasehq/browse-cli buildpnpm --filter @browserbasehq/browse-cli testpnpm exec prettier --check packages/cli && cd packages/cli && pnpm run eslint && pnpm run typecheck- e2e smoke test against a disposable Chrome CDP endpoint on
127.0.0.1:9229using a temporaryHOME/ user-data-dir so the checks do not touch a real browsing profile - verified
browse env localreturnslocalStrategy: "isolated" - verified
browse statusin isolated mode reportslocalSource: "isolated" - verified
browse env localandbrowse statusboth print the hint to usebrowse env local --auto-connectto reuse local credentials/cookies - verified
browse env local --auto-connectreturnslocalStrategy: "auto" - verified
browse env local --auto-connectprints the hint that plainbrowse env localswitches back to an isolated Chromium browser - verified
open https://example.comsucceeds after--auto-connect - verified
browse statusafter--auto-connectreportslocalSource: "attached-existing"with the resolved CDP URL and the isolated-browser hint - verified
browse env local 9229returnslocalStrategy: "cdp" - verified
browse statusafterbrowse env local 9229reportslocalSource: "attached-explicit"
Linear: STG-1752
Summary by cubic
Defaulted browse env local to a clean, isolated browser. Added --auto-connect to opt into reusing a debuggable Chrome, kept explicit CDP attach via browse env local <port|url>, and added mode hints to guide users. Addresses Linear STG-1752 to make local usage predictable and avoid surprise debugging prompts.
-
New Features
- Isolated local browser is now the default; auto-discovery only with
--auto-connect. - Mode hints in
browse env/browse statussuggest when to use--auto-connector switch back to isolated. browse env local <port|url>remains for explicit CDP targets.- Centralized strategy resolution in
src/local-strategy.tswith unit tests. - Clearer
browse envusage and validation; rejects mixing--auto-connect,--isolated, or a target.--isolatedis deprecated (accepted; hidden from help).
- Isolated local browser is now the default; auto-discovery only with
-
Migration
- To reuse an existing Chrome:
browse env local --auto-connect. - To attach to a specific target:
browse env local <port|url>. - No changes if you want a clean isolated browser by default.
- To reuse an existing Chrome: