Skip to content

refactor(cli): migrate contexts and extensions commands to Browserbase SDK - #3497

Open
shrey150 wants to merge 2 commits into
cursor/sdk-bump-861cfrom
cursor/contexts-extensions-sdk-861c
Open

shrey150 wants to merge 2 commits into
cursor/sdk-bump-861cfrom
cursor/contexts-extensions-sdk-861c

Conversation

@shrey150

@shrey150 shrey150 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Migrates contexts and extensions commands from raw HTTP calls to the Browserbase SDK client methods.

Changes

  • contexts/delete.ts → client.contexts.delete(id)
  • contexts/update.ts → client.contexts.update(id)
  • extensions/delete.ts → client.extensions.delete(id)
  • api.ts → Add success telemetry to withBrowserbaseApi to preserve requestHadHttpResponse tracking

Stack

  1. chore(cli): bump @browserbasehq/sdk to ^2.28.0 #3495 — SDK bump ← base
  2. This PR — Migrate contexts and extensions commands
  3. feat(cli): add search filtering options and migrate search to SDK #3481 — Add search filtering options and migrate search to SDK
Open in Web Open in Cursor 

Summary by cubic

Migrates the CLI's contexts and extensions commands from raw HTTP calls to the Browserbase SDK client methods.

  • contexts delete and contexts update now use client.contexts.delete and client.contexts.update.
  • extensions delete now uses client.extensions.delete.
  • withBrowserbaseApi now sets requestHadHttpResponse: true and httpStatus: 200 on success so telemetry tracking from the old raw HTTP calls is preserved.

Written for commit 179f4bb. Summary will update on new commits.

View guided diff Turn on auto-fix

…e SDK

Replace raw HTTP calls with SDK client methods:
- contexts/delete.ts: use client.contexts.delete()
- contexts/update.ts: use client.contexts.update()
- extensions/delete.ts: use client.extensions.delete()

Also add success telemetry to withBrowserbaseApi to preserve
requestHadHttpResponse tracking that raw HTTP calls had.

Co-authored-by: Shrey Pandya <shrey150@yahoo.com>
@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 179f4bb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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 4 files

Architecture diagram
sequenceDiagram
    participant CLI as CLI Command
    participant Resolver as Context Resolver
    participant API as Browserbase API Lib
    participant Client as SDK Client
    participant Remote as Browserbase Remote API
    participant Telemetry as Run Telemetry

    Note over CLI,Remote: Contexts Delete Flow
    CLI->>Resolver: resolveContextRefOrFail(args.id)
    Resolver-->>CLI: context id
    CLI->>API: createBrowserbaseClient(toApiOptions(flags))
    API-->>CLI: client
    CLI->>API: withBrowserbaseApi("contexts", () => client.contexts.delete(id))
    API->>Client: client.contexts.delete(id)
    Client->>Remote: DELETE /v1/contexts/{id}
    Remote-->>Client: 200 OK
    Client-->>API: success
    API->>Telemetry: setRunTelemetryCompletion({requestHadHttpResponse: true})
    API-->>CLI: success
    CLI->>CLI: removeContextAliasesById(id)

    Note over CLI,Remote: Contexts Update Flow
    CLI->>Resolver: resolveContextRefOrFail(args.id)
    Resolver-->>CLI: context id
    CLI->>API: createBrowserbaseClient(toApiOptions(flags))
    API-->>CLI: client
    CLI->>API: withBrowserbaseApi("contexts", () => client.contexts.update(id))
    API->>Client: client.contexts.update(id)
    Client->>Remote: PUT /v1/contexts/{id}
    Remote-->>Client: updated context
    Client-->>API: result
    API->>Telemetry: setRunTelemetryCompletion({requestHadHttpResponse: true})
    API-->>CLI: result
    CLI->>CLI: outputJson(result)

    Note over CLI,Remote: Extensions Delete Flow
    CLI->>API: createBrowserbaseClient(toApiOptions(flags))
    API-->>CLI: client
    CLI->>API: withBrowserbaseApi("extensions", () => client.extensions.delete(args.id))
    API->>Client: client.extensions.delete(args.id)
    Client->>Remote: DELETE /v1/extensions/{id}
    Remote-->>Client: 200 OK
    Client-->>API: success
    API->>Telemetry: setRunTelemetryCompletion({requestHadHttpResponse: true})
    API-->>CLI: success
    CLI->>CLI: outputJson({ok: true, id: args.id})

    alt Error Response
        Client-->>API: throws
        API->>API: rethrowBrowserbaseApiError(error, command)
        API-->>CLI: rethrows error
    end
Loading

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

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

Set httpStatus: 200 for successful SDK calls to maintain telemetry
parity with raw HTTP calls that recorded response.status.

Co-authored-by: Shrey Pandya <shrey150@yahoo.com>

This branch has not been deployed

No deployments
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.

2 participants