Quick Start
npm install -g @pilatos/bitbucket-clibb auth loginbb repo clone myworkspace/myrepocd myrepo# Push your feature branch before creating a pull request.bb pr create -t "My feature"Prerequisites
Section titled “Prerequisites”- Bun runtime 1.1.30+ for the npm package. Installing via npm or pnpm does not install Bun. Without it,
bbfails to start with an error thatbunwas not found, such asenv: bun: No such file or directory. The standalone binary needs no runtime. - A Bitbucket Cloud account.
Step-by-step setup
Section titled “Step-by-step setup”-
Install the CLI
Terminal window npm install -g @pilatos/bitbucket-cliVerify the installation:
Terminal window bb --version -
Authenticate
Terminal window bb auth loginIn an interactive terminal, choose OAuth to authorize in your browser, or API token to enter your email and token. Without prompts, a bare login starts OAuth unless API-token flags or
BB_API_TOKENselect token auth.For CI/CD or headless environments, load
BB_API_TOKENfrom your secret store and pipe it in on stdin.-utakes your Atlassian account email:Terminal window If
BB_API_TOKENis set in your environment, a barebb auth loginuses API token auth instead of OAuth.Verify it worked:
Terminal window bb auth statusSee the Authentication guide for full details.
-
Clone a repository
Terminal window bb repo clone myworkspace/myrepocd myrepo -
Create your first pull request
Terminal window git checkout -b feature/my-feature# Make some changes...git add .git commit -m "Add my feature"git push -u origin feature/my-featurebb pr create -t "Add my feature"
Common commands
Section titled “Common commands”| Command | Description |
|---|---|
bb pr list |
List open pull requests |
bb pr view 42 |
View PR #42 details |
bb pr activity 42 |
View PR #42 activity log |
bb pr create -t "Title" |
Create a new PR |
bb pr merge 42 |
Merge PR #42 |
bb pr checkout 42 |
Checkout PR #42 locally |
bb pr diff 42 |
View PR #42 diff |
bb repo list |
List repositories |
bb browse 42 |
Open PR #42 in your browser |
bb browse src/cli.ts:20 |
Open a file at a specific line in your browser |
bb api /user |
Call any Bitbucket API endpoint (escape hatch) |
Set a default workspace
Section titled “Set a default workspace”Not sure what your workspace slug is? List the workspaces you have access to:
bb workspace listIf you work primarily in one workspace, set it as default:
bb config set defaultWorkspace myworkspaceNow commands will use this workspace automatically:
bb repo list # Lists repositories in "myworkspace"bb pr list -r myrepo # Lists PRs in "myworkspace/myrepo"Enable tab completion
Section titled “Enable tab completion”bb completion installOn PowerShell (or to load the script yourself in any shell), print it with
bb completion <bash|zsh|fish|powershell>; see
Completion Commands.
Add-Content $PROFILE 'bb completion powershell | Out-String | Invoke-Expression'Restart your shell, then try:
bb <Tab> # Shows every top-level commandbb pr <Tab> # Shows: activity, approve, checkout, checks, comments, create, decline, diff, edit, list, merge, ready, reviewers, viewbb pr create -<Tab> # Shows available flagsbb pr merge 42 --strategy <Tab> # Shows: merge_commit, squash, fast_forward, ...Scripting with JSON
Section titled “Scripting with JSON”Every command accepts --json for machine-readable output. You can project to a comma-separated field list and filter results through a built-in jq engine; no external jq binary required:
# Project to specific fieldsbb pr list --json id,title,state
# Filter through built-in jqbb pr list --json --jq '.pullRequests[] | select(.state == "OPEN") | .title'Update notifications
Section titled “Update notifications”When a newer version is available on npm, bb writes a one-time notice to stderr after the next command finishes:
──────────────────────────────────────────────────A new version is available: 1.23.0 (you have 1.22.0) Run 'bun install -g @pilatos/bitbucket-cli' to update Or disable with 'bb config set skipVersionCheck true'──────────────────────────────────────────────────The update line follows where bb is installed: pnpm add -g for a pnpm global install, bun install -g for a Bun global install, a download link for the standalone binary, and npm install -g for any other node_modules install. Outside node_modules, such as a source checkout, it suggests bun install -g.
Under --no-unicode or BB_NO_UNICODE, the horizontal rules are drawn with - instead of ─.
The notice never appears with --json, when stderr is not a TTY, or in CI environments. The check itself runs at most once every versionCheckInterval days (default: 1). Disable it permanently with:
bb config set skipVersionCheck trueSee the Configuration File reference for related settings.
Next steps
Section titled “Next steps”- Command Reference - Full documentation for all commands
- Repository Context - How the CLI detects your workspace/repository
- Scripting & Automation - Use bb in scripts and CI/CD
- JSON Output Reference - Field projection,
--jqfiltering, output shapes - AI Agent Integration - Wire the CLI into Claude Code, Cursor, or Windsurf
- Changelog - What’s new in recent releases
- Troubleshooting - Common issues and solutions