Repository navigation
Make BROWSERBASE_PROJECT_ID optional in CLI - #1803
Conversation
🦋 Changeset detectedLatest commit: 99eb186 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile SummaryThis PR introduces the initial open-source release of the Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[browse env remote] --> B{hasBrowserbaseCredentials?}
B -- "BROWSERBASE_API_KEY set" --> C[assertModeSupported passes]
B -- "BROWSERBASE_API_KEY missing" --> D["Error: Remote mode requires BROWSERBASE_API_KEY"]
C --> E[Write mode-override file]
E --> F{Daemon running?}
F -- Yes, same mode --> G[No restart needed]
F -- Yes, different mode --> H[stopDaemonAndCleanup]
H --> I[ensureDaemon]
F -- No --> I
I --> J[Stagehand init with env=BROWSERBASE\nBROWSERBASE_PROJECT_ID passed via env if set]
Last reviewed commit: fae93c1 |
| const { exec } = await import("child_process"); | ||
| const { promisify } = await import("util"); |
There was a problem hiding this comment.
Dynamic imports of non-optional built-in modules
child_process is already statically imported at line 17 (import { spawn } from "child_process"), and util is a Node.js built-in that is always available. Both exec and promisify should be added to the existing top-level imports rather than being imported dynamically here.
| const { exec } = await import("child_process"); | |
| const { promisify } = await import("util"); | |
| const execAsync = promisify(exec); |
And at the top of the file, update the existing import and add util:
import { spawn, exec } from "child_process";
import { promisify } from "util";Rule Used: Use top-level imports instead of dynamic imports w... (source)
Learnt From
browserbase/stagehand#1072
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Only BROWSERBASE_API_KEY is required for remote mode, matching the core SDK changes in #1800. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
fae93c1 to
99eb186
Compare
## Summary - Stacked on browserbase#1800 - Only `BROWSERBASE_API_KEY` is required for remote mode in the CLI - `BROWSERBASE_PROJECT_ID` is still passed through if set, but no longer checked ## Changes - `packages/cli/src/index.ts` — `hasBrowserbaseCredentials()` only checks for API key - `packages/cli/tests/mode.test.ts` — Updated test to match new error message - `packages/cli/README.md` — Updated docs to reflect optional project ID ## Test plan - [x] Existing mode test updated - [x] Manual: `browse env remote` with only `BROWSERBASE_API_KEY` set 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Make `BROWSERBASE_PROJECT_ID` optional in the CLI for remote mode, so only `BROWSERBASE_API_KEY` is required. The project ID is still forwarded when provided. - **Bug Fixes** - Updated remote mode check and error message to only require `BROWSERBASE_API_KEY`. - Autodetection now defaults to `remote` when the API key is set; otherwise `local`. - Updated tests and `@browserbasehq/browse-cli` README to match. <sup>Written for commit 99eb186. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1803">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. -->
Summary
BROWSERBASE_API_KEYis required for remote mode in the CLIBROWSERBASE_PROJECT_IDis still passed through if set, but no longer checkedChanges
packages/cli/src/index.ts—hasBrowserbaseCredentials()only checks for API keypackages/cli/tests/mode.test.ts— Updated test to match new error messagepackages/cli/README.md— Updated docs to reflect optional project IDTest plan
browse env remotewith onlyBROWSERBASE_API_KEYset🤖 Generated with Claude Code
Summary by cubic
Make
BROWSERBASE_PROJECT_IDoptional in the CLI for remote mode, so onlyBROWSERBASE_API_KEYis required. The project ID is still forwarded when provided.BROWSERBASE_API_KEY.remotewhen the API key is set; otherwiselocal.@browserbasehq/browse-cliREADME to match.Written for commit 99eb186. Summary will update on new commits. Review in cubic