Skip to content

docs(cli): update extension upload instructions to use --stagehand - #3275

Merged
shrey150 merged 1 commit into
cursor/cli-extension-upload-stagehand-81e3from
shrey/cli-extension-archive
Oct 27, 2026
Merged

shrey150 merged 1 commit into
cursor/cli-extension-upload-stagehand-81e3from
shrey/cli-extension-archive

Conversation

@shrey150

@shrey150 shrey150 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

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.

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.

Written for commit cc89ff3. Summary will update on new commits.

View guided diff Turn on auto-fix

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
Open in Web Open in Cursor 

@shrey150
shrey150 requested a review from a team as a code owner October 20, 2026 17:17
@changeset-bot

changeset-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 963298f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
browse Patch

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

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/cli/src/lib/functions/init.ts Resolved
@cursor
cursor Bot force-pushed the shrey/cli-extension-archive branch from 3754165 to 10f8662 Compare October 21, 2026 21:51
@cursor
cursor Bot changed the base branch from main to cursor/cli-extension-upload-stagehand-81e3 October 21, 2026 21:51
@cursor cursor Bot changed the title fix(cli): use public extension archive helper in function setup docs(cli): update extension upload instructions to use --stagehand Oct 21, 2026
@shrey150
shrey150 added this pull request to stack #3297 October 21, 2026 23:27
@cursor
cursor Bot force-pushed the shrey/cli-extension-archive branch from 10f8662 to cc89ff3 Compare October 22, 2026 00:34
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
shrey150 force-pushed the shrey/cli-extension-archive branch from cc89ff3 to 963298f Compare October 27, 2026 02:29
@shrey150
shrey150 merged commit 63078cf into main Oct 27, 2026
15 of 16 checks passed
@shrey150
shrey150 deleted the shrey/cli-extension-archive branch October 27, 2026 02:30
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>&nbsp;<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>&nbsp;</div>

---------

Co-authored-by: Cursor Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants