Skip to main content

Bitbucket Unofficial CLI

CI PyPI Python 3.14+ License: MIT Topics

Unofficial. This project is not affiliated with, endorsed by, or supported by Atlassian. "Bitbucket" is a trademark of Atlassian. Use at your own risk against the Bitbucket Cloud REST API.

Unofficial command-line interface for Bitbucket Cloud built on bitbucket-unofficial-sdk. It logs in with an Atlassian API token, an access token or an OAuth 2 consumer, and prints results as a table, JSON, JSON Lines, CSV or bare identifiers.

1.0.0 covers everything the SDK offers, and freezes the exit codes, the JSON output, the command surface and the settings keys; see docs/roadmap.md.

Table of contents

About

The CLI is a thin layer over the SDK: commands parse options, call one SDK method, and render the model it returns. It never builds a URL or sends a request by hand, except for the OAuth token exchange, which the SDK leaves to the application.

Key features

  • Three ways to authenticate. An Atlassian API token with your email, a repository, project or workspace access token, or an OAuth 2 consumer (authorization code or client credentials) that renews its own token.
  • Safe storage. Credentials go to the system keyring. A 0600 file is an explicit opt-in, and no secret is ever accepted as a command-line argument.
  • Scriptable output. table on a terminal, JSON when piped, plus jsonl, csv and id. Data goes to stdout; messages and errors go to stderr.
  • Stable exit codes. Each failure class has its own code, so a script can tell a missing credential from a missing repository.
  • Profiles. Keep several accounts and select one with --profile.

Architecture

flowchart TD
    main["main: Typer app and global options"] --> commands
    commands --> services["services: listing"]
    commands --> runtime["runtime: context, errors, exit codes"]
    runtime --> auth["auth: credentials, stores, OAuth"]
    runtime --> config["config: profiles and settings"]
    commands --> output["output: table, json, jsonl, csv, id"]
    runtime --> sdk["bitbucket-unofficial-sdk"]
    auth -. "token exchange" .-> oauth["Bitbucket OAuth endpoints"]
    sdk --> api["Bitbucket Cloud REST API"]

Layers point downward only. See docs/architecture/layering.md.

Getting started

Install the command from PyPI:

uv tool install bitbucket-unofficial-cli
# or
pipx install bitbucket-unofficial-cli

From a checkout, make install syncs the dependencies and registers the bitbucket command.

Log in, pick a workspace and look around:

bitbucket auth login                 # Atlassian email and API token
bitbucket workspace list
bitbucket workspace use my-workspace
bitbucket repo list

Usage

Authentication

Command What it stores
bitbucket auth login (or --api-token) Your Atlassian email and an API token
bitbucket auth login --access-token A repository, project or workspace access token, or any bearer token
bitbucket auth login --oauth An OAuth consumer's tokens, through your browser
bitbucket auth login --oauth --client-credentials An OAuth consumer's tokens, with no browser
bitbucket auth status Nothing: shows the active credential and the user it belongs to
bitbucket auth refresh Nothing: renews the stored OAuth token now
bitbucket auth token Nothing: prints the API token or bearer token, for scripts
bitbucket auth logout Nothing: removes the stored credential and profile

Secrets come from a hidden prompt, or from standard input with --with-token. For OAuth, set BITBUCKET_OAUTH_CLIENT_SECRET to skip the prompt. Setting up a consumer is in docs/auth/oauth-consumer.md.

In CI, skip auth login and set ATLASSIAN_USER_EMAIL with ATLASSIAN_API_TOKEN, or BITBUCKET_ACCESS_TOKEN. The environment wins over anything stored.

Commands

Command Does
bitbucket user me Show the user the credential belongs to
bitbucket workspace list List the workspaces the credential can access
bitbucket workspace get [SLUG] Show a workspace; defaults to the selected one
bitbucket workspace use SLUG Save the workspace in the active profile
bitbucket repo list List repositories (--query, --sort, --limit)
bitbucket repo get SLUG Show one repository
bitbucket repo create SLUG Create a repository (repo update, delete, fork, forks, watchers)
bitbucket project list Projects (get, create, update, delete)
bitbucket member list Workspace members (get)
bitbucket permission list Workspace and repository permissions (mine)
bitbucket webhook list Webhooks of a repository or workspace (get, create, update, delete)
bitbucket hook-event list TYPE Events a webhook can subscribe to (types)
bitbucket workspace gpg-key Print the workspace GPG public key
bitbucket config path Print the settings file location
bitbucket config list List profiles
bitbucket config use NAME Set the default profile

Bitbucket pages results by cursor, so list commands take --limit N to stop early, or --cursor URL to fetch one page; the cursor of the next page is printed to stderr.

Global options

Global options go before the command: bitbucket -o json repo list.

Option Environment Meaning
-p, --profile BITBUCKET_PROFILE Configuration profile to use
-w, --workspace BITBUCKET_WORKSPACE Workspace slug; overrides the profile
-o, --output BITBUCKET_OUTPUT table, json, jsonl, csv or id
-v, --verbose Print each HTTP request to stderr
--version Show the version and exit

Without --output, a terminal gets a table and a pipe gets JSON.

Exit codes

Code Meaning
0 Success
1 Unspecified failure
2 Usage error
3 Configuration: no credential, no workspace
4 Authentication failed
5 Forbidden
6 Not found
7 Validation or conflict
8 Rate limited
9 Bitbucket or the network is unavailable

Configuration

Variable Meaning
ATLASSIAN_USER_EMAIL Account email, with ATLASSIAN_API_TOKEN
ATLASSIAN_API_TOKEN Atlassian API token
BITBUCKET_ACCESS_TOKEN Access token sent as a bearer; not combined with the above
BITBUCKET_OAUTH_CLIENT_ID OAuth consumer key for auth login --oauth
BITBUCKET_OAUTH_CLIENT_SECRET OAuth consumer secret for auth login --oauth
BITBUCKET_WORKSPACE Default workspace slug
BITBUCKET_PROFILE Default profile
BITBUCKET_OUTPUT Default output format
BITBUCKET_CLI_CONFIG_DIR Where config.toml and credentials.toml live

Agent skills

The repository is also a Claude Code plugin. Pick one channel:

# Claude Code
/plugin marketplace add gajaguar/bitbucket-cli
/plugin install bitbucket-cli@bitbucket-cli-skills
# Any Agent Skills-compatible agent
npx skills add gajaguar/bitbucket-cli

# opencode
npx skills add gajaguar/bitbucket-cli -a opencode -y
  • bitbucket-pull-requests covers pr, its comments, tasks and statuses.
  • bitbucket-pipelines covers pipeline, environment and deployment.
  • bitbucket-cli covers authentication, profiles, workspaces, repositories, branches, commits, source, permissions, webhooks and snippets.

The skills follow the Agent Skills format, so other agents can read skills/ directly. They require the CLI to be installed and a user to have run bitbucket auth login. See docs/agents/ for what each install channel does.

Development

make install   # dependencies, the `bitbucket` command and the git hooks
make check     # lint, types, spelling, commit messages
make test      # the test suite, with a 90% coverage floor
make help      # every target

The live tests hit the real API and are skipped unless ATLASSIAN_USER_EMAIL, ATLASSIAN_API_TOKEN and BITBUCKET_WORKSPACE are set; run them with uv run pytest -m live.

Roadmap

  • 0.1.0 Foundation: authentication, configuration, output, user me, workspace and repository read commands
  • 0.2.0 Repositories, projects, members, webhooks
  • 0.3.0 Pull requests
  • 0.4.0 Branches, tags, commits, source, statuses, reports, downloads
  • 0.5.0 Branch restrictions, branching model, reviewers, permissions
  • 0.6.0 Pipelines
  • 0.7.0 Environments and deployments
  • 0.8.0 Keys, emails, search
  • 0.9.0 Snippets
  • 1.0.0 Every SDK capability, with the contracts frozen

The detail, and what 1.0.0 freezes, is in docs/roadmap.md. docs/coverage.md maps each SDK capability to its command.

Contributing

See CONTRIBUTING.md.

Security

Report a vulnerability privately to dev@gajaguar.com instead of opening a public issue.

License

See LICENSE.

Metadata

Release files for bitbucket-unofficial-cli 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitbucket-unofficial-cli 1.1.0
File Size Uploaded
bitbucket_unofficial_cli-1.1.0.tar.gz 200.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bitbucket-unofficial-cli 1.1.0
File Interpreter ABI Platform
bitbucket_unofficial_cli-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 307.1 kB

Release files / bitbucket_unofficial_cli-1.1.0.tar.gz

Download URL bitbucket_unofficial_cli-1.1.0.tar.gz
Size 200.2 kB
Tags Source
SHA-256 checksum
How to use checksums
eb69c1f9e6b1f5d393fe7429952e0e2b1b6c674d95667d36fc5d13aa59e4554e
BLAKE2b-256 checksum
How to use checksums
b4ac3a8eb2af0dded57eb205448e9dc237aa9796f229086612ac3ad311b0183a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / bitbucket_unofficial_cli-1.1.0-py3-none-any.whl

Download URL bitbucket_unofficial_cli-1.1.0-py3-none-any.whl
Size 106.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87c4848ee9042cfd12f8183a8ebeaaac1b1499849ae0a79097a019d89e0afb57
BLAKE2b-256 checksum
How to use checksums
c8b211853bc514a868ba5ead43250b9bc6d2bfe6b175df3edcfe67174c58146d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.1

2 release files

This release

1.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page