Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 963298f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Architecture diagram
sequenceDiagram
participant Dev as Developer
participant CLI as browse CLI (init)
participant SDK as @browserbasehq/stagehand
participant FS as Local Filesystem
participant Cloud as Browserbase Cloud
Note over Dev,Cloud: NEW: Public Extension Export Flow
Dev->>CLI: Run "browse functions init" in project dir
CLI->>CLI: Generate starter index.ts with extension comments
CLI-->>Dev: Show next steps (export + upload)
Note over Dev,SDK: Step 1: Export Extension Archive
Dev->>SDK: Call getExtensionArchive() (ESM import)
SDK->>SDK: Bundle extension ZIP in memory
SDK-->>Dev: Return extension archive (Buffer)
Dev->>FS: Write stagehand-extension.zip to project root
Note over Dev,Cloud: Step 2: Upload Extension
Dev->>CLI: Run "browse cloud extensions upload stagehand-extension.zip"
CLI->>FS: Read ZIP from project directory
CLI->>Cloud: Upload extension archive
Cloud-->>CLI: Return extension ID
CLI-->>Dev: Display extension ID
Note over Dev,CLI: Step 3: Configure Function
Dev->>CLI: Paste extension ID into index.ts (sessionConfig)
CLI->>Cloud: browse functions dev index.ts
CLI->>Cloud: browse functions publish index.ts
Note over Dev,SDK: Key Design: Public API (getExtensionArchive) avoids SDK internal path coupling
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
cursor
Bot
force-pushed
the
shrey/cli-extension-archive
branch
from
October 21, 2026 21:51
3754165 to
10f8662
Compare
cursor
Bot
changed the base branch from
main
to
cursor/cli-extension-upload-stagehand-81e3
October 21, 2026 21:51
4 tasks done
cursor
Bot
force-pushed
the
shrey/cli-extension-archive
branch
from
October 22, 2026 00:34
10f8662 to
cc89ff3
Compare
seanmcguire12
approved these changes
Oct 26, 2026
Replace the node -e export command and hardcoded filepath with the simpler browse cloud extensions upload --stagehand command in: - functions init template and nextSteps - deployment guide - CLI skill Co-authored-by: Shrey Pandya <[email protected]>
shrey150
force-pushed
the
shrey/cli-extension-archive
branch
from
October 27, 2026 02:29
cc89ff3 to
963298f
Compare
shrey150
added a commit
that referenced
this pull request
Oct 27, 2026
) Upload the bundled Stagehand extension directly without requiring a file path. Uses getExtensionArchive() from @browserbasehq/stagehand and passes the bytes via toFile() to the Browserbase API. # why # what changed # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a `--stagehand` flag to `browse cloud extensions upload` so the bundled Stagehand extension can be uploaded without a file path; the archive bytes come from `getExtensionArchive()` and are sent to the Browserbase API without writing a temp file. - The `file` argument is now optional; you must provide either a file path or `--stagehand`. - Passing both `--stagehand` and a file path errors out. <sup>Written for commit 3e27ee2. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/3289?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/browserbase/stagehand/3289?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3289&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. --> <!-- CURSOR_AGENT_PR_BODY_BEGIN --> # why Sean added a public `getExtensionArchive()` helper to the Stagehand SDK (`packages/sdk-ts/src/extensionAssets.ts`, #3267) so users can get the bundled extension ZIP without reaching into `node_modules/@browserbasehq/stagehand/dist/assets/stagehand-extension.zip`—a path that may change across releases. He asked for the CLI and docs to use it. The existing `browse cloud extensions upload <file>` command only accepts a filesystem path, so users had to pass that brittle internal path directly. This adds a `--stagehand` flag that handles the export and upload in one step. # what changed - Add `--stagehand` boolean flag to `browse cloud extensions upload` - With `--stagehand`: call `getExtensionArchive()` from `@browserbasehq/stagehand` to get the `Uint8Array`, wrap it with the Browserbase SDK's `toFile(bytes, "stagehand-extension.zip", { type: "application/zip" })`, and pass that to `client.extensions.create()`. No temp file is written. - Make the `file` positional arg optional (was required) - Validation: `--stagehand` and `file` are mutually exclusive; providing both exits 1 with `"Cannot specify both --stagehand and a file path."`. Providing neither exits 1 with `"Provide a file path or use --stagehand to upload the Stagehand extension."` - Existing `<file>` path behavior unchanged—still uses `resolveUploadableFile()` to stream from disk - Output unchanged: prints the JSON response from `extensions.create` (includes `id`) - Update command description and examples in help - Add Browse patch changeset - Add 3 tests in `packages/cli/tests/cli-cloud-contract.test.ts`: - `extensions upload --stagehand uploads the bundled Stagehand extension`: verifies multipart POST to `/v1/extensions` with `filename="stagehand-extension.zip"` - `extensions upload rejects both --stagehand and a file path`: verifies exit 1 and error message - `extensions upload requires --stagehand or a file path`: verifies exit 1 and error message when neither provided **Before:** ```bash browse cloud extensions upload node_modules/@browserbasehq/stagehand/dist/assets/stagehand-extension.zip ``` **After:** ```bash browse cloud extensions upload --stagehand ``` # test plan - [x] 505 CLI tests pass (38 test files), including the 3 new tests - [x] `pnpm format:check` passes - [x] `pnpm eslint` passes - [x] `pnpm turbo run build --filter=browse` succeeds (TypeScript compiles, oclif manifest generates) --- PR 1 of 2. #3275 is stacked on this and updates the user-facing instructions (functions init, deployment docs, CLI skill) to use `--stagehand`. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a `--stagehand` flag to `browse cloud extensions upload` so the bundled Stagehand extension can be uploaded without a file path. - The `file` argument is now optional; you must provide either a file path or `--stagehand`. - Passing both `--stagehand` and a file path errors out. <sup>Written for commit 81444f9. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/3289?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/browserbase/stagehand/3289?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3289&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. --> <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-036e53ad-deeb-5484-9f72-e4ced49d81e3?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-036e53ad-deeb-5484-9f72-e4ced49d81e3&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> --------- Co-authored-by: Cursor Agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
browse functions initstill instructed users to upload the Stagehand extension from a hardcoded path insidenode_modules. The publicgetExtensionArchive()helper lets them export the bundled ZIP without depending on the SDK's package layout.what changed
stagehand-extension.zipwithgetExtensionArchive()before uploading it in the initializer's next steps and generated starter comments.test plan
Summary by cubic
Updates
browse functions initand the deployment guide so extension upload instructions usebrowse cloud extensions upload --stagehandinstead of exporting the bundled ZIP or referencing a hardcodednode_modulespath.node -eexport command from the deployment guide's upload step.--stagehandto the CLI skill examples and includes a patch changeset forbrowse.Written for commit cc89ff3. Summary will update on new commits.
why
PR 2 of 2, stacked on #3289. The parent adds
browse cloud extensions upload --stagehand. This updates the user-facing instructions to use it.what changed
functions inittemplate comment andnextStepsoutput--stagehandexample to CLI skilltest plan