bkt: A gh-inspired CLI for Bitbucket Cloud & Data Center

I’ve been working on a CLI for Bitbucket Cloud/Data Center that brings gh-style
commands to the terminal. It’s open source and available at

Main idea: fast, scriptable commands for PRs, branches, repos, webhooks, etc.
Works with both Cloud and Data Center APIs.

I’d appreciate feedback from anyone who:

  • Uses Bitbucket from the command line
  • Automates workflows or CI/CD with Bitbucket
  • Has pain points with the existing tooling

What features would actually be useful? What am I missing?

Install: go install github.com/avivsinai/bitbucket-cli/cmd/bkt@latest

Thanks for any input! :folded_hands:

2 Likes

Very handy tool @AvivSinai :+1:

I’m a big user of gh and so I like working with a tool like this for bitbucket.

Listing pipelines from the terminal is something I will use a lot. However the list doesn’t appear to be in date order? Is there a way to sort it?

Could you add the pipeline run number (eg. #10) and date time to the list details? I’m seeing just these values so it’s not easy to figure out which run it relates to:

{f9da75d6-daf2-44d8-8ba9-1f3cec21553a}	COMPLETED   		SUCCESSFUL

Also is this the correct usage for the other pipeline commands bkt pipeline view "{57d08fb6-96c1-4d17-8cb6-d5aff1de3095}"? I tried with and without the brackets but I get the following in both cases:

Error: 400 Bad Request: {"error": {"message": "Bad request", "detail": "Unexpected response body", "data": {"key": "unexpected.response.body", "arguments": {}}}}

Thanks for the great tool!

Thanks for the feedback! These are real gaps:

  1. Sorting & missing fields - You’re right, the list currently doesn’t sort by date and is missing the build number (#10) and timestamp. I’ll add these in the next release.

  2. The view command error - The 400 “unexpected.response.body” error might be happening because the command expects the UUID (the long {abc123…} value), not the build number (#10).
    Could you try:
    a. Run bkt pipeline list to get the UUID
    b. Use that UUID: bkt pipeline view abc123… (no quotes, braces optional)
    c. If still failing, try: bkt pipeline view --workspace --repo
    Let me know if you have other thoughts regarding this.

Workaround for timestamps: bkt status pipeline already shows Created/Completed times if you need that now.

I’ll open issues to track the sorting/display improvements - thanks for reporting! Thanks again, – aviv

1 Like

Update to the listing works great :+1:

About the btk pipeline view command. Yes I am using the UUID and have tried with and without ‘{’ ‘}’.

I added the --workspace and --repo commands but it’s still failing. I confirmed those args are passing through by adding bad values and seeing it return “resource not found”. When I pass the correct repo and workspace it goes back to the unexpected.response.body.

Any ideas? Maybe I can check it out locally and add a bit of logging to get the full API response?

Update: Fixed! :tada:

The pipeline view error is now resolved (merged in PR #39).

Root cause: Bitbucket Cloud API requires UUID braces to be URL-encoded. We were stripping them.

Bonus: You can now use build numbers directly - much easier than UUIDs:
bkt pipeline view 10
bkt pipeline logs 10

To get the fix now:
go install github.com/avivsinai/bitbucket-cli/cmd/bkt@latest

Will also be in the next release (v0.5.5). Thanks again for the detailed report - it helped us track down the issue quickly!

1 Like

Thanks @AvivSinai . To confirm that is working well now with v0.6. :+1: