name: bb-pr-comment-investigation
description: Use the bb Bitbucket CLI to authenticate, discover workspaces/repos, inspect pull requests, list comments, and prepare reply actions. Trigger this skill when the task involves navigating Bitbucket Cloud PRs/comments from the CLI, especially when repo or PR context must be discovered first.
BB CLI PR And Comment Workflow
Overview
Use this skill to operate the bb CLI end-to-end: auth, workspace/repo discovery, PR discovery, comment retrieval, and optional reply preparation.
CLI Setup
Build the binary before running behavior checks:
go build -o bb ./cmd/bb
Install globally for the current user and update after local changes:
# one-time PATH setup
export PATH="$HOME/.local/bin:$PATH"
# install from this repo
make install
# after code changes
make update
Verify global binary resolution:
which bb
bb version
Authenticate either with environment variables (non-persistent) or login profile (persistent):
# Non-persistent auth
export BITBUCKET_EMAIL='you@example.com'
export BITBUCKET_TOKEN='your_api_token'
# Persistent auth (stores token in keychain)
./bb auth login --email you@example.com
Check auth status:
./bb auth status
Command Map
./bb workspace list: list accessible workspaces./bb repo list [workspace]: list repositories./bb repo use <workspace> <repo>: set default repo context./bb pr list: list pull requests for a repo./bb pr comments <pr-id>: list comments (includes replies)./bb pr reply <pr-id> <comment-id> --body "...": post reply
Use --json for deterministic filtering and scripting.
Context Resolution Rules
For repo-scoped commands (pr list, pr comments, pr reply):
--workspaceand--repoflags- Saved defaults from
repo useorauth logindefaults - Bitbucket
git remote origininference
Prefer explicit flags during investigations to avoid ambiguity.
Discovery Workflow
- Discover workspace:
./bb workspace list --limit 100
- Discover repos in workspace:
./bb repo list <workspace> --limit 1000
- Confirm a specific repo slug exists:
./bb repo list <workspace> --limit 1000 --json \
| jq -r '.[] | select(.slug == "<repo>") | .full_name'
- Optionally set default context:
./bb repo use <workspace> <repo>
PR And Comment Workflow
- List PRs with broad states:
./bb pr list --workspace <workspace> --repo <repo> \
--state OPEN --state MERGED --state DECLINED --state SUPERSEDED \
--limit 200 --json
- Filter PRs by title keyword (example):
./bb pr list --workspace <workspace> --repo <repo> \
--state OPEN --state MERGED --state DECLINED --state SUPERSEDED \
--limit 200 --json \
| jq -c '.[] | select((.title // "") | test("action indexer"; "i")) | {id, state, updated_on, title}'
- Retrieve comments for a target PR:
./bb pr comments <pr_id> --workspace <workspace> --repo <repo> --limit 200 --json
- Keep comment threading context:
- Root comments have
parent = null - Replies have
parent.idset
Optional Time Window Filtering
Use this pattern for any time window (example: last 2 days in UTC):
CUTOFF=$(date -u -v-2d +"%Y-%m-%dT%H:%M:%SZ")
./bb pr comments <pr_id> --workspace <workspace> --repo <repo> --limit 200 --json \
| jq -c --arg cutoff "$CUTOFF" '.[] | select(.created_on >= $cutoff) | {id, parent:(.parent.id // null), author:.user.display_name, created_on, body:.content.raw}'
Treat this as one filter strategy, not the default workflow.
Reply Workflow (Write Action)
Validate target PR/comment with read commands first, then reply:
./bb pr reply <pr_id> <comment_id> --workspace <workspace> --repo <repo> --body "Thanks, updated."
For scripted replies, pass body by stdin:
echo "Thanks, updated." | ./bb pr reply <pr_id> <comment_id> --workspace <workspace> --repo <repo>
Investigation Practices
- Start read-only (
workspace list,repo list,pr list,pr comments) before any reply. - Use
--json+jqfor filtering, counting, and exporting. - Log exact workspace/repo/PR IDs in outputs to avoid targeting mistakes.