Skip to main content

Agent-friendly thin CLI for Bitbucket Data Center REST API pull request workflows.

Project description

btbkt

btbkt is an agent-facing CLI for Bitbucket Data Center / Server.

It is a thin wrapper over Bitbucket's REST API, with a small set of higher-level PR commands that return compact JSON for agent workflows: opening PRs, reviewing others' PRs, reading review comments, and responding after code changes.

Install

python -m pip install -e .

Run without installing:

PYTHONPATH=src python -m btbkt --help

Python >=3.9 is supported.

Authentication

Only these environment variables are read for authentication:

export BITBUCKET_BASE_URL="https://bitbucket.internal"
export BITBUCKET_USERNAME="alice"
export BITBUCKET_TOKEN="..."

BITBUCKET_PASSWORD can be used instead of BITBUCKET_TOKEN.

The CLI always sends HTTP Basic auth using BITBUCKET_USERNAME plus BITBUCKET_PASSWORD or BITBUCKET_TOKEN. Project, repo, source branch, and target branch are not read from env; they come from CLI flags or the current git checkout.

Skill

Agent workflow guidance lives here:

skills/using-btbkt-pr-workflows/SKILL.md

Use that skill when an agent needs to create a PR, review someone else's PR, or address review feedback on its own PR.

Examples

Find the PR for the current git branch:

btbkt pr current

Open a PR from the current branch:

btbkt pr create --title "feat: add config schema" --description "Adds schema validation." --reviewer alice

Start reviewing a PR:

btbkt pr review-summary 390
btbkt pr review-context 390 --path src/app.py --max-diff-lines 120

Read unresolved review comments, inspect terse comments with nearby diff context, and reply after fixing:

btbkt pr review-comments 390 --state OPEN --with-diff-context 5
btbkt pr reply 390 15450 --text "Fixed and covered by tests."

Reply to multiple handled comments from a reviewed JSON file:

btbkt pr reply-many 390 --input replies.json --dry-run
btbkt pr reply-many 390 --input replies.json

review-summary reports Bitbucket open state separately from reply state. A comment can remain OPEN after a reply, so use open_comments_without_replies for the remaining-unreplied count.

Submit a review decision:

btbkt pr review 390 --comment "Looks good." --approve
btbkt pr review 390 --comment "Please add a regression test." --needs-work

Notes

btbkt prints JSON. The high-level PR commands intentionally omit large raw Bitbucket payloads and include pagination metadata when the result may be partial.

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

btbkt-0.1.0.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

btbkt-0.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file btbkt-0.1.0.tar.gz.

File metadata

  • Download URL: btbkt-0.1.0.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for btbkt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f5d32d705361275be5f31106df09b0b5037a4f2b1bd5a6e1238b90faee3c535
MD5 3b928a2f5b245682215d8c575272d19b
BLAKE2b-256 0bf9dca7d3d3c85a82d96d7a12e89786f46e8d9c72e36988f204a635bc888dce

See more details on using hashes here.

File details

Details for the file btbkt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: btbkt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for btbkt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 782a4494ca7cbd7e72df33eef80c077a08ddfeb1ce24c5fa997e139766462c1c
MD5 0c018787861cee9eecea086fd6fce25e
BLAKE2b-256 2cb0f0673d64a3a5f5e2154e9d4f081c21b154e1eeb1b6f3ee1e80634488dede

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page