Typer CLI for Bitbucket Data Center
Project description
bbdc-cli
A small, practical Typer CLI for Bitbucket Data Center / Server REST API.
It reads credentials from environment variables and provides high-signal PR workflows (list, create, comment, approve, merge, update metadata, manage reviewers/participants, review completion, diffs, etc.) without needing a full SDK.
Requirements
- Python 3.9+
pipxrecommended for isolated install
Install
From PyPI:
pipx install bbdc-cli
# or
pip install bbdc-cli
From source (repo root with pyproject.toml):
pipx install .
# If you are iterating locally:
pipx install -e .
# Reinstall after changes (non-editable install):
pipx reinstall bbdc-cli
# Uninstall:
pipx uninstall bbdc-cli
Configuration
The CLI uses two environment variables:
BITBUCKET_SERVER: base REST URL ending in/restBITBUCKET_API_TOKEN: Bitbucket personal access token (PAT)
Example (BBVA-style context path):
https://bitbucket.globaldevtools.bbva.com/bitbucket/rest
Set them:
export BITBUCKET_SERVER="https://bitbucket.globaldevtools.bbva.com/bitbucket/rest"
export BITBUCKET_API_TOKEN="YOUR_TOKEN"
Quick check
bbdc doctor
If this succeeds, your base URL + token are working.
Common commands
Show help:
bbdc --help
bbdc pr --help
List pull requests:
bbdc pr list --project GL_KAIF_APP-ID-2866825_DSG --repo mercury-viz
Get a pull request:
bbdc pr get -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
Create a pull request:
bbdc pr create \
--project GL_KAIF_APP-ID-2866825_DSG \
--repo mercury-viz \
--from-branch feature/my-branch \
--to-branch develop \
--title "Add viz panel" \
--description "Implements X"
Add reviewers (repeat --reviewer):
bbdc pr create \
-p GL_KAIF_APP-ID-2866825_DSG \
-r mercury-viz \
--from-branch feature/my-branch \
--to-branch develop \
--title "Add viz panel" \
--description "Implements X" \
--reviewer some.username \
--reviewer other.username
Approve, decline, merge:
bbdc pr approve -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
bbdc pr decline -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --comment "Not proceeding"
bbdc pr merge -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --message "LGTM"
Update metadata:
bbdc pr update -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 \
--title "New title" \
--description "Updated description" \
--reviewer some.username
Participants / reviewers:
bbdc pr participants list -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
bbdc pr participants add -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --user alice --role REVIEWER
bbdc pr participants status -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 alice --status APPROVED
Review completion and comments:
bbdc pr review complete -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --comment "Looks good" --status APPROVED
bbdc pr comments add -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --text "LGTM"
Diffs and commits:
bbdc pr commits -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
bbdc pr diff -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
bbdc pr diff-file -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 src/main.py
See the full command reference in docs/CLI.md and usage examples in docs/examples.md.
Troubleshooting
BITBUCKET_SERVER must end with /rest.
Use the REST base, not the UI URL. For instances hosted under /bitbucket, the REST base is often:
- UI:
https://host/bitbucket/... - REST:
https://host/bitbucket/rest
Unauthorized / 401 / 403:
- Token missing or incorrect
- Token lacks required permissions for that project/repo
- Your Bitbucket instance may require a different auth scheme (rare if PAT is enabled)
404 Not Found:
Usually one of:
- Wrong
BITBUCKET_SERVERbase path (/restvs/bitbucket/rest) - Wrong
--projectkey or--reposlug - PR id does not exist in that repo
Development
Run without installing:
python -m bbdc_cli --help
python -m bbdc_cli doctor
License
Mercury - BBVA
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bbdc_cli-0.3.1.tar.gz.
File metadata
- Download URL: bbdc_cli-0.3.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
651da65febd8e1aaac82209bace9c33aafc4fec9dff1afbf876558086f1f3a6b
|
|
| MD5 |
a3aad95e8e4be299760ea2315b6fbd70
|
|
| BLAKE2b-256 |
9d2043db7a41b335b103c1e1699f62636a123900b296d8b45df103aac3b3e198
|
File details
Details for the file bbdc_cli-0.3.1-py3-none-any.whl.
File metadata
- Download URL: bbdc_cli-0.3.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d27870b1bec3ed8a2bb2c5d05f3323c13184d5df52e8e42fe3ceb4171cce1d
|
|
| MD5 |
bac793cbe9ad73de64bbdbf8eee0526a
|
|
| BLAKE2b-256 |
abf0bb093ca316da2317d726e97edc5e366c053b06b1876d0aa0c0a7a8a3c987
|