Skip to content

[STG-1738] feat: add upgrade command to browse-cli#1933

Open
shrey150 wants to merge 1 commit intomainfrom
feat/browse-cli-upgrade
Open

[STG-1738] feat: add upgrade command to browse-cli#1933
shrey150 wants to merge 1 commit intomainfrom
feat/browse-cli-upgrade

Conversation

@shrey150
Copy link
Copy Markdown
Contributor

@shrey150 shrey150 commented Mar 31, 2026

Summary

  • Adds a browse upgrade command that updates the globally installed @browserbasehq/browse-cli to the latest version
  • Auto-detects the user's package manager (npm/pnpm/bun/yarn) via npm_config_user_agent env var, falling back to checking which are available on PATH
  • Runs the appropriate global install command with inherited stdio so the user sees progress

Test plan

  • Run browse upgrade with npm installed globally
  • Verify it detects the correct package manager
  • Verify the upgrade command output is visible to the user

🤖 Generated with Claude Code


Summary by cubic

Add browse upgrade to let users update the globally installed @browserbasehq/browse-cli to the latest version in one step. Runs the correct global install for the user’s package manager with visible progress.

  • New Features
    • Detects package manager from npm_config_user_agent, falling back to checking what's on PATH.
    • Supports npm, pnpm, bun, and yarn.
    • Prints and executes the global install command with inherited stdio, then exits with the same status.

Written for commit fa7e822. Summary will update on new commits. Review in cubic

Adds a self-upgrade command that detects the user's package manager
(npm/pnpm/bun/yarn) and runs the appropriate global install command
to update @browserbasehq/browse-cli to the latest version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: fa7e822

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

This PR includes changesets to release 0 packages

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

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

@shrey150 shrey150 changed the title feat: add upgrade command to browse-cli [STG-1738] feat: add upgrade command to browse-cli Mar 31, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant U as "User"
    participant CLI as "browse-cli"
    participant Env as "Environment (Node.js)"
    participant OS as "OS / Shell"
    participant PM as "Package Manager (npm/pnpm/bun/yarn)"
    participant Registry as "Remote Registry (npm)"

    U->>CLI: browse upgrade

    CLI->>Env: NEW: Get npm_config_user_agent
    Env-->>CLI: User agent string (if exists)

    alt userAgent detected
        CLI->>CLI: Match pm (npm/pnpm/bun/yarn)
    else userAgent missing (fallback)
        loop through pnpm, bun, yarn, npm
            CLI->>OS: NEW: execFileSync("which", [candidate])
            OS-->>CLI: Path or error
            opt path found
                CLI->>CLI: Select candidate as pm
            end
        end
    end

    Note over CLI,PM: Command mapped (e.g., npm install -g @browserbasehq/browse-cli@latest)

    CLI->>PM: NEW: spawnSync(cmd, args, { stdio: "inherit" })
    
    activate PM
    PM->>Registry: Fetch latest version
    Registry-->>PM: Package data
    PM-->>U: Stream installation progress (stdout/stderr)
    deactivate PM

    PM-->>CLI: Return exit status
    CLI->>U: Exit with PM status code (0 or 1)
Loading

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.

1 participant