Fetch Bitbucket Cloud pull requests for AI agent review.
bbpr 605 # review PR from current repo
bbpr https://bitbucket.org/ws/repo/pull-requests/605 # review any PR by URL
bbpr 605 diff # just the diff
bbpr 605 diff -n # diff with line numbers
bbpr 605 comments # just the comments
bbpr setup # configure credentials
Works with Claude Code, Cursor, Codex CLI, OpenCode — any agent that can run shell commands.
bash <(curl -fsSL https://raw.githubusercontent.com/tejasnafde/bbpr/main/install.sh)Or clone if you prefer:
git clone https://github.com/tejasnafde/bbpr.git && cd bbpr && ./install.shThe installer:
- Creates a Python venv at
~/.local/bitbucket-review/ - Installs
bbprto~/.local/bin/ - Installs the agent skill file to your agent's skills directory (you choose where)
- Walks you through setting up Bitbucket credentials
You'll need an Atlassian API token. Go to: https://id.atlassian.com/manage-profile/security/api-tokens
Important: click "Create API token with scopes" — not the plain "Create API token". The plain one won't work.
Required scopes (just 2):
read:user:bitbucketread:pullrequest:bitbucket
Then run the setup wizard:
bbpr setupOr set env vars directly:
export BITBUCKET_EMAIL=you@company.com
export BITBUCKET_API_TOKEN=your-tokenOr write them to ~/.config/bbpr/credentials:
BITBUCKET_EMAIL=you@company.com
BITBUCKET_API_TOKEN=your-token
(The file should be chmod 600. bbpr setup handles this automatically.)
bbpr <pr-url-or-number> [section]
| Section | Output |
|---|---|
info |
PR title, state, author, branches, description, reviewers |
files |
Changed files with +/- line counts |
diff |
Full unified diff |
comments |
All review comments with file/line context |
activity |
Approval/update timeline |
builds |
CI build statuses on the PR |
status |
One-line fingerprint for polling (state, head, builds, comment counts) |
all |
Everything (default) |
diff takes -n / --line-numbers to prefix each line with its resolved
old/new file line number — that's the number comment --line wants.
Need the write:pullrequest:bitbucket scope on the token.
bbpr 605 comment -m "text" # general PR comment
bbpr 605 comment --path src/f.py --line 42 -m "..." # inline on a new-file line
bbpr 605 comment --path src/f.py --old-line 40 -m "..." # inline on a deleted line
bbpr 605 comment --reply-to 865329914 -m "..." # reply in a thread
bbpr 605 comment --path src/f.py --line 42 # body from stdin
bbpr 605 approve | request-changes | unapprove
bbpr 605 resolve 865329914 # resolve a comment thread
Prints the created comment's id and link.
install.sh installs skill.md (or skill.mdc for Cursor) to your agent's skills
directory. This teaches the agent:
- When to call
bbpr(trigger phrases, Bitbucket URLs) - Which section to fetch for a given task
- How to synthesize a review from the output
- What to tell you if credentials are missing
Installed paths are recorded in ~/.config/bbpr/skill-paths, so the daily
self-update refreshes the skill file too — not just the script.
Supported agent locations detected automatically:
| Agent | Skill path |
|---|---|
| Claude Code | ~/.claude/skills/bbpr/SKILL.md |
| Cursor | ~/.cursor/rules/bbpr.mdc |
| OpenCode | ~/.config/opencode/bbpr.md |
| Codex CLI | ~/.codex/bbpr.md |
| Custom | any path you enter during install |
./uninstall.shRemoves the binary, venv, credentials, and any installed skill files.
- macOS or Linux
- Python 3.8+
- Internet access to
api.bitbucket.org