Skill v1.0.20
currentAutomated scan100/1003 files
name: bkt version: 1.0.20 description: Bitbucket CLI for Data Center and Cloud. Use when users need to manage repositories, pull requests, branches, issues, webhooks, or pipelines in Bitbucket. Triggers include "bitbucket", "bkt", "pull request", "PR", "repo list", "branch create", "Bitbucket Data Center", "Bitbucket Cloud", "keyring timeout". metadata: short-description: Bitbucket CLI for repos, PRs, branches compatibility: claude-code, codex-cli
Bitbucket CLI (bkt)
bkt is a unified CLI for Bitbucket Data Center and Bitbucket Cloud. It mirrors gh ergonomics and provides structured JSON/YAML output for automation.
Dependency Check
Before executing any `bkt` command, verify the CLI is installed:
bkt --version
If the command fails or bkt is not found, install it using one of these methods:
| Platform | Command | |
|---|---|---|
| macOS/Linux | brew install avivsinai/tap/bitbucket-cli | |
| Windows | scoop bucket add avivsinai https://github.com/avivsinai/scoop-bucket && scoop install bitbucket-cli | |
| Go | go install github.com/avivsinai/bitbucket-cli/cmd/bkt@latest | |
| Binary | Download from GitHub Releases |
Only proceed with `bkt` commands after confirming installation succeeds.
Authentication
# Data Center (opens browser for PAT creation)bkt auth login https://bitbucket.example.com --web# Data Center (direct)bkt auth login https://bitbucket.example.com --username alice --token <PAT># Bitbucket Cloudbkt auth login https://bitbucket.org --kind cloud --web# Check auth statusbkt auth status
Bitbucket Cloud Token Requirements:
- Create an "API token with scopes" (not a general API token)
- Select Bitbucket as the application
- Required scope: Account: Read (
read:user:bitbucket) - Additional scopes as needed: Repositories, Pull requests, Issues
Contexts
Contexts store host, project/workspace, and default repo settings:
# Create context for Data Centerbkt context create dc-prod --host bitbucket.example.com --project ABC --set-active# Create context for Cloudbkt context create cloud-team --host bitbucket.org --workspace myteam --set-active# List and switch contextsbkt context listbkt context use cloud-team
Quick Command Reference
| Task | Command | |
|---|---|---|
| List repos | bkt repo list | |
| View repo | bkt repo view <slug> | |
| Clone repo | bkt repo clone <slug> --ssh | |
| Create repo | bkt repo create <name> --description "..." | |
| List PRs | bkt pr list --state OPEN | |
| View PR | bkt pr view <id> | |
| Create PR | bkt pr create --title "..." --source feature --target main | |
| Merge PR | bkt pr merge <id> | |
| PR checks | bkt pr checks <id> --wait | |
| List branches | bkt branch list | |
| Create branch | bkt branch create <name> --from main | |
| Delete branch | bkt branch delete <name> | |
| List issues (Cloud) | bkt issue list --state open | |
| Create issue | bkt issue create -t "Bug title" -k bug | |
| Webhooks | bkt webhook list | |
| Run pipeline | bkt pipeline run --ref main | |
| API escape hatch | bkt api /rest/api/1.0/projects |
Repository Operations
bkt repo list --limit 20bkt repo list --workspace myteam # Cloud workspace overridebkt repo view platform-apibkt repo create data-pipeline --description "Data ingestion" --project DATAbkt repo browse --project DATA --repo platform-apibkt repo clone platform-api --ssh
Pull Request Workflows
# List and viewbkt pr list --state OPEN --limit 10bkt pr list --mine # PRs you authoredbkt pr view 42bkt pr view 42 --web # Open in browser# Create and editbkt pr create --title "feat: cache" --source feature/cache --target main --reviewer alicebkt pr edit 123 --title "New title" --body "Updated description"# Review and mergebkt pr approve 42bkt pr comment 42 --text "LGTM"bkt pr merge 42 --message "merge: feature/cache"bkt pr merge 42 --strategy fast-forward# CI/build statusbkt pr checks 42 # Show build statusbkt pr checks 42 --wait # Wait for builds to completebkt pr checks 42 --wait --timeout 5m # With timeoutbkt pr checks 42 --fail-fast # Exit on first failure# Checkout locallybkt pr checkout 42 # Fetches to pr/42 branch
Branch Management
bkt branch listbkt branch list --filter "feature/*"bkt branch create release/1.9 --from mainbkt branch delete feature/old-stuffbkt branch set-default main # DC onlybkt branch protect add main --type fast-forward-only # DC only
Issue Tracking (Bitbucket Cloud Only)
bkt issue list --state open --kind bugbkt issue view 42 --commentsbkt issue create -t "Login broken" -k bug -p majorbkt issue edit 42 --assignee "{uuid}" --priority criticalbkt issue close 42bkt issue reopen 42bkt issue comment 42 -b "Fixed in v1.2.0"bkt issue status # Your assigned/created issues
Issue kinds: bug, enhancement, proposal, task Priorities: trivial, minor, major, critical, blocker
Webhooks
bkt webhook listbkt webhook create --name "CI" --url https://ci.example.com/hook --event repo:refs_changedbkt webhook delete <id>bkt webhook test <id>
Pipelines (Cloud)
bkt pipeline run --ref main --var ENV=stagingbkt pipeline list # Recent runsbkt pipeline view <uuid> # Pipeline detailsbkt pipeline logs <uuid> # Fetch logsbkt status pipeline <uuid> # Alt: status check
Permissions (DC)
bkt perms project list --project DATAbkt perms project grant --project DATA --user alice --perm PROJECT_WRITEbkt perms repo list --project DATA --repo platform-apibkt perms repo grant --project DATA --repo api --user alice --perm REPO_WRITE
Raw API Access
For endpoints not yet wrapped:
bkt api /rest/api/1.0/projects --param limit=100 --jsonbkt api /repositories --param workspace=myteam --field pagelen=50
Output Modes
All commands support structured output:
bkt pr list --json # JSON outputbkt pr list --yaml # YAML outputbkt pr list --json | jq '.pull_requests[0].title'
Global Options
--json/--yaml— Structured output--context <name>— Use specific context--project <key>— Override project (DC)--workspace <name>— Override workspace (Cloud)--repo <slug>— Override repository
Environment Variables
BKT_CONFIG_DIR— Config directory overrideBKT_ALLOW_INSECURE_STORE— Allow file-based credential storageBKT_KEYRING_TIMEOUT— Keyring operation timeout (for example2m)
References
- Full command reference: See references/commands.md