Skip to main content

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

Metadata

Release files for bb-tool 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bb-tool 1.0.1
File Size Uploaded Provenance
bb_tool-1.0.1.tar.gz 15.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bb-tool 1.0.1
File Interpreter ABI Platform
bb_tool-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / bb_tool-1.0.1.tar.gz

Download URL bb_tool-1.0.1.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c24fb0a1af7120a484cac20f094a01a44ce07e3870eaacbb4b2e18c4b16ad9b5
BLAKE2b-256 checksum
How to use checksums
1851532ac1ef110877893414be97e18309f07348b073385ed96b1bfafb49629d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Release files / bb_tool-1.0.1-py3-none-any.whl

Download URL bb_tool-1.0.1-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20e86580d90b131f47dbfa3e532420211d31ec89e960f3e779de71f3b01ec52d
BLAKE2b-256 checksum
How to use checksums
e4737091b0f7804d869afbfef7a3919d9fc488a387f8bcc672cf03600900e028
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Security for bb-tool 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bb_tool-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page