Repository navigation
feat(cli): add --stagehand flag to browse cloud extensions upload - #3289
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 1eaf09d 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 User as CLI User
participant CLI as Browse CLI ExtensionsUpload
participant SDK as @browserbasehq/stagehand
participant BB as Browserbase API
participant FS as Local File System
Note over User,BB: Cloud Extension Upload Flow
User->>CLI: browse cloud extensions upload [file] [--stagehand]
CLI->>CLI: Parse args & flags
alt --stagehand flag set
CLI->>SDK: getExtensionArchive() - get bundled Stagehand extension
SDK-->>CLI: Byte archive data
CLI->>CLI: toFile(archive, "stagehand-extension.zip", {type: "application/zip"})
else file path provided
CLI->>FS: Read extension ZIP file
FS-->>CLI: Uploadable file
end
CLI->>BB: POST /v1/extensions (multipart/form-data)
alt Success
BB-->>CLI: 200 Response with extension ID
CLI-->>User: Output JSON result
else Error (401, 400, etc.)
BB-->>CLI: Error response
CLI-->>User: Error message
end
Note over CLI: Validation branches
alt both --stagehand and file path
CLI-->>User: Error: Cannot specify both
else neither --stagehand nor file path
CLI-->>User: Error: Provide a file path or use --stagehand
end
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
seanmcguire12
approved these changes
Oct 26, 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. Co-authored-by: Shrey Pandya <shrey150@yahoo.com>
Co-authored-by: Shrey Pandya <shrey150@yahoo.com>
shrey150
force-pushed
the
cursor/cli-extension-upload-stagehand-81e3
branch
from
October 27, 2026 02:29
3e27ee2 to
1eaf09d
Compare
shrey150
added a commit
that referenced
this pull request
Oct 27, 2026
…3275) # why `browse functions init` still instructed users to upload the Stagehand extension from a hardcoded path inside `node_modules`. The public `getExtensionArchive()` helper lets them export the bundled ZIP without depending on the SDK's package layout. # what changed - Export `stagehand-extension.zip` with `getExtensionArchive()` before uploading it in the initializer's next steps and generated starter comments. - Update the deployment guide's starter example to match its existing export instructions. - Add a Browse patch changeset. # test plan - CLI build, changed-file formatting and lint, changeset validation, and Mintlify docs validation passed. - All 81 Functions and cloud API contract tests passed. - Initialized a fresh project with npm and published Stagehand 4.3.0, ran the exact generated export command, and verified the resulting ZIP contains a valid Manifest V3 extension. Confirmed the command matches the starter comments and deployment guide. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updates `browse functions init` and the deployment guide so extension upload instructions use `browse cloud extensions upload --stagehand` instead of exporting the bundled ZIP or referencing a hardcoded `node_modules` path. - Drops the `node -e` export command from the deployment guide's upload step. - Adds `--stagehand` to the CLI skill examples and includes a patch changeset for `browse`. <sup>Written for commit cc89ff3. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/3275?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/3275?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3275&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 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 - Update `functions init` template comment and `nextSteps` output - Simplify deployment guide's extension upload step - Add `--stagehand` example to CLI skill # test plan - 505 CLI tests pass - Build, lint, and formatting pass <!-- 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 <cursoragent@cursor.com>
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.
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
Summary by cubic
Adds a
--stagehandflag tobrowse cloud extensions uploadso the bundled Stagehand extension can be uploaded without a file path; the archive bytes come fromgetExtensionArchive()and are sent to the Browserbase API without writing a temp file.fileargument is now optional; you must provide either a file path or--stagehand.--stagehandand a file path errors out.Written for commit 3e27ee2. Summary will update on new commits.
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 intonode_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--stagehandflag that handles the export and upload in one step.what changed
--stagehandboolean flag tobrowse cloud extensions upload--stagehand: callgetExtensionArchive()from@browserbasehq/stagehandto get theUint8Array, wrap it with the Browserbase SDK'stoFile(bytes, "stagehand-extension.zip", { type: "application/zip" }), and pass that toclient.extensions.create(). No temp file is written.filepositional arg optional (was required)--stagehandandfileare 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."<file>path behavior unchanged—still usesresolveUploadableFile()to stream from diskextensions.create(includesid)packages/cli/tests/cli-cloud-contract.test.ts:extensions upload --stagehand uploads the bundled Stagehand extension: verifies multipart POST to/v1/extensionswithfilename="stagehand-extension.zip"extensions upload rejects both --stagehand and a file path: verifies exit 1 and error messageextensions upload requires --stagehand or a file path: verifies exit 1 and error message when neither providedBefore:
After:
test plan
pnpm format:checkpassespnpm eslintpassespnpm turbo run build --filter=browsesucceeds (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.Summary by cubic
Adds a
--stagehandflag tobrowse cloud extensions uploadso the bundled Stagehand extension can be uploaded without a file path.fileargument is now optional; you must provide either a file path or--stagehand.--stagehandand a file path errors out.Written for commit 81444f9. Summary will update on new commits.