Skip to main content

Bitbucket Cloud CLI for PR review workflows

Project description

bb

gh for GitHub. bb for Bitbucket. The missing command-line tool for Bitbucket Cloud pull requests.

PyPI Python License: MIT

Why bb?

GitHub has gh. GitLab has glab. Bitbucket Cloud has nothing — until now.

If you use Bitbucket at work, you know the pain: context-switch to the browser to check PRs, post review comments, merge branches. bb lets you do all of that from the terminal, in the repo you're already working in.

  • Zero config — auto-detects workspace and repo from your git remote
  • Full PR lifecycle — list, create, review, comment, approve, merge
  • Inline code comments — comment on specific files and lines
  • Threaded discussions — reply to and resolve comment threads
  • JSON output — pipe to jq for scripting and automation
  • AI-ready — ships with a Claude Code skill for AI-assisted PR reviews

Quick Start

pip install bb-tool
bb setup        # authenticates + installs Claude Code skill
bb pr list

That's it. bb setup walks you through creating an API token (opens your browser), then installs the Claude Code skill. If you're in a Bitbucket repo, bb auto-detects your workspace and repo.

60-second workflow: review a PR from your terminal

# See what's open
bb pr list

# Pick a PR and get the overview
bb pr show 42
bb pr files 42

# Read the diff
bb pr diff 42

# Leave a comment on a specific line
bb pr comment 42 --body "This should use a context manager" --file src/db.py --line 15

# Approve and merge
bb pr approve 42
bb pr merge 42 --strategy squash --close-source

Installation

# pip
pip install bb-tool

# pipx (isolated install, recommended)
pipx install bb-tool

# uv
uv tool install bb-tool

Requires Python 3.10+.

Authentication

bb uses Atlassian API tokens for authentication. Create a token with the following scopes:

Read: read:me, read:pullrequest:bitbucket, read:repository:bitbucket, read:project:bitbucket, read:user:bitbucket

Write: write:pullrequest:bitbucket

bb auth login    # Opens browser to create a token, then prompts for credentials
bb auth status   # Verify credentials
bb auth logout   # Clear stored credentials

Credentials are stored in your system keyring. If keyring is unavailable, they fall back to ~/.config/bb/tokens.json (file mode 600).

Configuration

In most cases, you don't need any configuration — bb reads your git remote.

Config file (optional)

Create ~/.config/bb/config.toml to set defaults:

[defaults]
workspace = "myworkspace"
repo = "myrepo"
dest_branch = "main"

Environment variables

Override anything with env vars (highest priority):

  • BITBUCKET_WORKSPACE — workspace slug
  • BITBUCKET_REPO — repository slug
  • BITBUCKET_DEST_BRANCH — default destination branch for pr create

Resolution order: env vars > config file > git remote

Commands

Pull Requests

bb pr list                              # List open PRs
bb pr list --state MERGED --limit 10    # Filter and limit
bb pr list --json                       # JSON output (pipe to jq)

bb pr show 42                           # PR details
bb pr show 42 --json                    # JSON output
bb pr files 42                          # Changed files with line counts
bb pr diff 42                           # Full unified diff

bb pr create -t "Add feature X"        # Create from current branch
bb pr create -t "Fix" -s feat -d main  # Explicit branches
bb pr create -t "Update" --body "..."  # With description
bb pr create -t "Fix" --reviewer alice # Add reviewers

bb pr approve 42                        # Approve a PR
bb pr merge 42                          # Merge a PR
bb pr merge 42 --strategy squash       # Squash merge
bb pr merge 42 --close-source          # Delete source branch after merge

Comments

bb pr comments 42                                           # List all (threaded)
bb pr comment 42 --body "Looks good"                        # General comment
bb pr comment 42 --body "Nit" --file src/main.py --line 15  # Inline comment
bb pr reply 42 --comment-id 123 --body "Fixed"              # Reply to thread
bb pr resolve 42 --comment-id 123                           # Resolve thread

Workspace/Repo Override

All pr subcommands accept -w and -r flags:

bb pr -w myteam -r backend list
bb pr -w myteam -r backend show 99

Claude Code Integration

bb ships with a Claude Code skill for AI-assisted PR review workflows:

bb setup-skill   # installs to ~/.claude/skills/bb/

This is included automatically when you run bb setup. Once installed, Claude can list PRs, read diffs, post review comments, and manage threads on your behalf.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bb_tool-1.0.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bb_tool-1.0.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file bb_tool-1.0.1.tar.gz.

File metadata

  • Download URL: bb_tool-1.0.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bb_tool-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c24fb0a1af7120a484cac20f094a01a44ce07e3870eaacbb4b2e18c4b16ad9b5
MD5 2899ab2591c903b8335b5b919f094266
BLAKE2b-256 1851532ac1ef110877893414be97e18309f07348b073385ed96b1bfafb49629d

See more details on using hashes here.

Provenance

The following attestation bundles were made for bb_tool-1.0.1.tar.gz:

Publisher: publish.yml on alipga/bb-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bb_tool-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: bb_tool-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bb_tool-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20e86580d90b131f47dbfa3e532420211d31ec89e960f3e779de71f3b01ec52d
MD5 6f5c88c6a98f43ef4b21c61136d1df84
BLAKE2b-256 e4737091b0f7804d869afbfef7a3919d9fc488a387f8bcc672cf03600900e028

See more details on using hashes here.

Provenance

The following attestation bundles were made for bb_tool-1.0.1-py3-none-any.whl:

Publisher: publish.yml on alipga/bb-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page