bitbottle

module
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT

README

bitbottle

Bitbucket CLI for Cloud and Server / Data Center — built with the same philosophy as GitHub CLI.

CI npm

Work with Bitbucket from your terminal — pull requests, repos, branches, tags, commits, pipelines, and raw API access. One tool, both backends, same commands.

$ bitbottle pr list
#47  feat: seamless audit            main ← feat/audit       OPEN   alice
#46  fix: 409 on concurrent merge    main ← fix/merge-race   MERGED bob

$ bitbottle pr create --title "fix: handle empty diff" --base main
✓ Created PR #48 — https://bitbucket.example.com/projects/PROJ/repos/api/pull-requests/48

Installation

npm (recommended — works everywhere Node is installed):

npm install -g @proggarapsody/bitbottle

Go install:

go install github.com/proggarapsody/bitbottle/cmd/bitbottle@latest

Homebrew / binary / deb / rpm / Docker — see the latest release.


Authentication

# Bitbucket Cloud
echo "YOUR_APP_PASSWORD" | bitbottle auth login --hostname bitbucket.org --with-token

# Bitbucket Server / Data Center (PAT, self-signed cert)
echo "BBDC-YOUR-PAT" | bitbottle auth login \
  --hostname git.example.com \
  --with-token \
  --git-protocol https \
  --skip-tls-verify

# Verify
bitbottle auth status

Credentials are stored in ~/.config/bitbottle/hosts.yml. Inside a git repo with a Bitbucket remote the host and project/repo are detected automatically. Outside a repo, use -R HOST/PROJECT/REPO.


Commands

Group Commands
auth login logout status token refresh
pr list view create merge approve unapprove diff checkout edit decline ready request-review comment
repo list view create delete clone set-default
branch list create delete checkout
tag list create delete
commit log view
pipeline list view run (Cloud only)
api Raw REST passthrough with pagination, --jq, variable expansion
alias Custom command shortcuts
config Editor, pager, git protocol per-host
completion bash zsh fish powershell
mcp MCP stdio server for AI assistants

All listing commands support --json fields, --jq expr, --limit N, --hostname HOST. TTY output is aligned and coloured; piped output is plain tab-separated for scripting.


Key Workflows

Pull Requests
# Open PRs in current repo
bitbottle pr list

# Create a PR
bitbottle pr create --title "feat: add retry logic" --base main

# Review
bitbottle pr diff 42 | delta
bitbottle pr checkout 42

# Approve and merge
bitbottle pr approve 42
bitbottle pr merge 42 --squash --delete-branch

# Add reviewers
bitbottle pr request-review 42 --reviewer alice --reviewer bob
Repos & Branches
bitbottle repo list --limit 20
bitbottle repo create my-service --project MYPROJ
bitbottle repo clone MYPROJ/my-service

bitbottle branch list
bitbottle branch create MYPROJ/my-service feature/x --start-at main
bitbottle branch delete MYPROJ/my-service feature/x
Pipelines (Cloud only)
bitbottle pipeline list MYWORKSPACE/my-service
bitbottle pipeline run  MYWORKSPACE/my-service --branch main
bitbottle pipeline view MYWORKSPACE/my-service {uuid} --web
Raw API
# Any endpoint not yet wrapped
bitbottle api 2.0/user
bitbottle api --paginate --jq '.[].full_name' '2.0/repositories/{workspace}'
bitbottle api -X POST -F 'title=hotfix' -F 'source.branch.name=hotfix/x' \
  '2.0/repositories/{workspace}/{repo_slug}/pullrequests'
Outside a git repo
bitbottle pr list   -R git.example.com/PROJ/api
bitbottle pr merge 42 -R git.example.com/PROJ/api

MCP Server — AI Assistant Integration

bitbottle mcp serve exposes all CLI operations as Model Context Protocol tools. Claude Desktop, Claude Code, and any MCP client can call Bitbucket as native tools — no raw API, no output parsing.

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "bitbottle": {
      "command": "bitbottle",
      "args": ["mcp", "serve"]
    }
  }
}

Claude Code (.mcp.json in project root):

{
  "mcpServers": {
    "bitbottle": {
      "command": "bitbottle",
      "args": ["mcp", "serve"]
    }
  }
}

Docker (no local install required):

docker run --rm -i \
  -v ~/.config/bitbottle:/root/.config/bitbottle \
  proggarapsody/bitbottle mcp serve

The MCP server uses the same ~/.config/bitbottle/hosts.yml credentials as the CLI — no separate auth setup needed.


Cloud vs Server / Data Center

bitbottle automatically routes to the correct backend based on hostname: bitbucket.org → Cloud; anything else → Server/DC. Override with backend_type: cloud|server in hosts.yml.

The same commands and flags work on both backends. Differences in API shape, pagination style, and endpoint paths are handled internally — no --cloud / --server flags needed.


Shell Completion

bitbottle completion --shell bash   >> ~/.bash_profile
bitbottle completion --shell zsh    >> ~/.zshrc
bitbottle completion --shell fish   > ~/.config/fish/completions/bitbottle.fish
bitbottle completion --shell powershell >> $PROFILE

Environment Variables

Variable Effect
BB_TOKEN Override auth token
BB_HOST Default hostname
BB_REPO Override [HOST/]PROJECT/REPO
BB_FORCE_TTY Force aligned/coloured output in pipes
NO_COLOR Disable colour (standard)

Full list in internal/envvars/envvars.go.


Contributing

See CONTRIBUTING.md. Run go test ./... before sending a PR.

License

MIT

Directories

Path Synopsis
api
cloud
Package cloud is the Bitbucket Cloud adapter for the backend.Client interface.
Package cloud is the Bitbucket Cloud adapter for the backend.Client interface.
internal/httpx
Package httpx is the shared HTTP transport used by the Bitbucket Server/DC and Cloud API adapters.
Package httpx is the shared HTTP transport used by the Bitbucket Server/DC and Cloud API adapters.
internal/paging
Package paging bounds typed pagination above httpx.Transport.GetAllJSON.
Package paging bounds typed pagination above httpx.Transport.GetAllJSON.
server
Package server is the Bitbucket Data Center (a.k.a.
Package server is the Bitbucket Data Center (a.k.a.
cmd
bitbottle command
Package git wraps internal/run.Runner to provide git-specific operations.
Package git wraps internal/run.Runner to provide git-specific operations.
internal
aliases
Package aliases stores user-defined command shortcuts in ~/.config/bitbottle/aliases.yml.
Package aliases stores user-defined command shortcuts in ~/.config/bitbottle/aliases.yml.
envvars
Package envvars is the single source of truth for environment variables that influence bitbottle's behavior.
Package envvars is the single source of truth for environment variables that influence bitbottle's behavior.
run
userconfig
Package userconfig stores bitbottle user preferences in ~/.config/bitbottle/config.yml.
Package userconfig stores bitbottle user preferences in ~/.config/bitbottle/config.yml.
pkg
cmd/alias
Package alias implements `bitbottle alias` — user-defined command shortcuts.
Package alias implements `bitbottle alias` — user-defined command shortcuts.
cmd/api
Package api implements `bitbottle api` — a generic Bitbucket REST passthrough modeled on `gh api`.
Package api implements `bitbottle api` — a generic Bitbucket REST passthrough modeled on `gh api`.
cmd/config
Package config implements `bitbottle config` — get/set/list user preferences stored in ~/.config/bitbottle/config.yml.
Package config implements `bitbottle config` — get/set/list user preferences stored in ~/.config/bitbottle/config.yml.
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL