[STG-1738] feat: add upgrade command to browse-cli#1933
Open
[STG-1738] feat: add upgrade command to browse-cli#1933
Conversation
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 detectedLatest commit: fa7e822 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
Contributor
There was a problem hiding this comment.
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)
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.
Summary
browse upgradecommand that updates the globally installed@browserbasehq/browse-clito the latest versionnpm_config_user_agentenv var, falling back to checking which are available on PATHTest plan
browse upgradewith npm installed globally🤖 Generated with Claude Code
Summary by cubic
Add
browse upgradeto let users update the globally installed@browserbasehq/browse-clito the latest version in one step. Runs the correct global install for the user’s package manager with visible progress.npm_config_user_agent, falling back to checking what's on PATH.npm,pnpm,bun, andyarn.Written for commit fa7e822. Summary will update on new commits. Review in cubic