A GitHub CLI-inspired command line interface for Bitbucket Cloud, bundled with a browser-based PR review workspace.
bb-cli aims to make Bitbucket Cloud workflows feel as convenient as GitHub CLI (gh).
It provides a bb command for common Bitbucket tasks:
bb auth login
bb api /user
bb repo view workspace/repo
bb pr list --repo workspace/repo
bb pr view 123 --repo workspace/repo
bb pr diff 123 --repo workspace/repo
bb pr review 123 --repo workspace/repoThe project also bundles a browser-based review UI, derived from ko-difit, so large pull request diffs can be inspected visually instead of being read only in the terminal.
MVP / experimental.
Verified locally:
- TypeScript build
- CLI unit tests
- mock Bitbucket API E2E tests
bb pr diffmock flowbb pr reviewpiping a fetched PR diff into the bundled review UI- review UI startup from stdin diff
Not yet verified against a real Bitbucket PR:
bb auth loginwith a real Bitbucket accountbb pr review <id>against a real PR- browser visual review against a real PR diff
- publishing inline comments back to Bitbucket
packages/
cli/ # bb CLI
review-ui/ # bundled PR review workspace based on ko-difit
Responsibilities:
packages/cli- Bitbucket Cloud authentication
- Bitbucket REST API calls
- repository and pull request commands
- PR diff fetching
- launching the bundled review UI
packages/review-ui- browser-based unified/split diff viewer
- local review comments
- optional agent-assisted discussion
npm install
npm run build
npm testRun the CLI directly:
node packages/cli/dist/cli.js --help
node packages/cli/dist/cli.js pr --helpUse it as a linked local CLI:
npm link -w packages/cli
bb --helpThe MVP uses Bitbucket Cloud username + app password/API token authentication.
bb auth login
bb auth status
bb auth logoutFor non-interactive usage:
BITBUCKET_USERNAME=your-id \
BITBUCKET_APP_PASSWORD=your-token \
bb api /userCredentials are stored at:
~/.config/bb-cli/config.json
bb api /user
bb api /repositories/workspace/repo
bb api /repositories/workspace/repo/pullrequestsbb repo view workspace/repo
bb repo clone workspace/repo
bb repo clone workspace/repo my-folderbb pr list --repo workspace/repo
bb pr view 123 --repo workspace/repo
bb pr create --repo workspace/repo --title "Fix bug" --head fix/bug --base main
bb pr checkout 123 --repo workspace/repo
bb pr merge 123 --repo workspace/repoPrint a patch in the terminal:
bb pr diff 123 --repo workspace/repoOpen the diff in the bundled review UI:
bb pr diff 123 --repo workspace/repo --webbb pr review 123 --repo workspace/repoFlow:
- Fetch the Bitbucket Cloud PR diff.
- Fetch lightweight PR metadata: title, description, branch info, author, URL, and changed files summary.
- Pipe the unified diff into the bundled review UI.
- Open a browser-based diff review workspace.
- Keep the agent orchestrator disabled by default.
When agent mode is enabled, the review UI prompt includes this PR metadata as Pull Request Context in addition to the commented file, selected line/range, nearby code, and thread history.
Enable agent-assisted discussion explicitly:
bb pr review 123 --repo workspace/repo --agentThe review UI orchestrator now uses a provider layer instead of being hard-wired to Claude Code.
DIFIT_AGENT_PROVIDER=claude # default, backward-compatible
DIFIT_AGENT_PROVIDER=pi
DIFIT_AGENT_PROVIDER=codex
DIFIT_AGENT_PROVIDER=auto
DIFIT_AGENT_PROVIDER=custom
DIFIT_AGENT_PROVIDER=noneUseful provider-specific environment variables:
# Claude Code-compatible provider
CLAUDE_BIN=claude
CLAUDE_MODEL=opus
# pi provider
PI_BIN=pi
PI_MODEL=openai/gpt-4o
# Codex provider
CODEX_BIN=codex
CODEX_MODEL=gpt-5.1-codex
# Custom stdin/stdout agent command
DIFIT_AGENT_PROVIDER=custom
DIFIT_AGENT_COMMAND=/path/to/agent-commandProvider behavior:
claude: uses Claude Code print mode with session resume support.pi: usespi -pin no-session/full-history mode.codex: usescodex execin full-history mode.custom: executes a stdin/stdout command.auto: picks the first available provider frompi,claude,codex.none: disables agent replies.
| GitHub CLI | bb CLI |
|---|---|
gh auth login |
bb auth login |
gh repo clone owner/repo |
bb repo clone workspace/repo |
gh repo view |
bb repo view |
gh pr list |
bb pr list |
gh pr view 123 |
bb pr view 123 |
gh pr create |
bb pr create |
gh pr checkout 123 |
bb pr checkout 123 |
gh pr merge 123 |
bb pr merge 123 |
gh api ... |
bb api ... |
The CLI supports a mockable API base URL:
BB_API_BASE_URL=http://127.0.0.1:4000/2.0Automated tests use this to verify:
bb pr diff
→ receives diff from mock Bitbucket API
→ prints patch
bb pr review
→ receives diff from mock Bitbucket API
→ pipes diff into review-ui stdin
Run:
npm testPotential next steps:
- Pass Bitbucket PR metadata into the review UI.
- Separate local notes, agent questions, and publishable PR comments.
- Publish selected review comments as Bitbucket inline comments.
- Add
bb pr comments publish <id> --file comments.json. - Add agent provider abstraction:
none,auto,claude,pi,codex. - Add pipeline status/log commands.
- Add workspace/project discovery commands.
MIT