Quick Start
npm install -g @pilatos/bitbucket-clibb auth loginbb repo clone myworkspace/myrepobb pr create -t "My feature"Prerequisites
Section titled “Prerequisites”- Bun runtime 1.0+. Installing via npm or pnpm does not install Bun. Without it,
bbexits withError: This CLI requires the Bun runtime.See Installation. - 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 loginThis opens your browser to authorize the CLI with your Bitbucket account. No token setup needed.
For CI/CD or headless environments, pipe an API token in on stdin:
Terminal window echo "$BB_API_TOKEN" | bb auth login -u your-username --with-tokenIf
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 installRestart 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'──────────────────────────────────────────────────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