feat(pr): add comment view and threaded reply commands - #52
Open
sayyedaribhussain wants to merge 2 commits into
Open
feat(pr): add comment view and threaded reply commands#52sayyedaribhussain wants to merge 2 commits into
sayyedaribhussain wants to merge 2 commits into
Conversation
Adds two subcommands under `bb pr comment`, backed by the Bitbucket Cloud
REST pull request comments API:
- `bb pr comment list [<number>]` (aliases: ls, view) — view all comments
on a PR, following pagination for the full set, rendered as a thread with
replies indented under their parent and inline comments showing file:line.
Supports `--json` and resolving the PR from the current branch.
- `bb pr comment reply <number> --comment <id>` — post a threaded reply to an
existing comment (editor opens when `--body` is omitted).
API layer (internal/api/pullrequests.go):
- ListAllPRComments — paginates GET .../pullrequests/{id}/comments to completion
- GetPRComment — fetch a single comment by id
- ReplyToPRComment — thin wrapper over AddPRComment with a parent id
The existing `bb pr comment` add behavior is unchanged and stays the default.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds tests required by CONTRIBUTING.md for the new comment commands: - API: ListAllPRComments (follows pagination across pages), GetPRComment, and ReplyToPRComment (asserts the parent id is sent in the request body). - Command: displayComments threaded rendering (ordering + reply nesting), the empty-state message, and resolveCommentPRNumber validation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds two subcommands under
bb pr commentfor viewing and replying to pull request comments, backed by the Bitbucket Cloud REST pull request comments API. The existingbb pr comment <number>add behavior is unchanged and remains the default.New commands
bb pr comment list [<number>](aliases:ls,view) — View all comments on a PR. Follows pagination for the complete set and renders them as a thread: replies are indented under the comment they respond to, and inline (code) comments show theirfile:line. Supports--jsonand resolves the PR from the current branch when no number is given.bb pr comment reply <number> --comment <id>— Post a threaded reply to an existing comment. Opens an editor when--bodyis omitted.API layer (
internal/api/pullrequests.go)ListAllPRComments— paginatesGET /repositories/{ws}/{repo}/pullrequests/{id}/commentsto completionGetPRComment— fetch a single comment by idReplyToPRComment— thin wrapper over the existingAddPRCommentwith a parent idType of Change
Testing
Added tests alongside the code (
go test ./...passes):internal/api/pullrequests_test.go):TestListAllPRComments(verifies pagination is followed across pages via thenextlink),TestGetPRComment, andTestReplyToPRComment(asserts theparent.idis sent in the request body).internal/cmd/pr/comment_test.go):TestDisplayCommentsThreading(ordering + reply nesting),TestDisplayCommentsEmpty, andTestResolveCommentPRNumber(input validation).Also verified
bb pr comment listlive (formatted +--json) against a real PR;replywas verified via build, help output, and required-flag enforcement.Checklist
go test ./...passesgo vet ./...reports no issuesNote on "Documentation updated": these commands are self-documenting via Cobra
--help(Short/Long/Examples are included); no separate docs file tracks per-command usage in this repo. Happy to add more if you'd like.🤖 Generated with Claude Code — model: Claude Opus 4.8 (1M context) (
claude-opus-4-8[1m])