Skip to content

feat(pr): add comment view and threaded reply commands - #52

Open
sayyedaribhussain wants to merge 2 commits into
rbansal42:mainfrom
sayyedaribhussain:feat/pr-comment-view-reply
Open

feat(pr): add comment view and threaded reply commands#52
sayyedaribhussain wants to merge 2 commits into
rbansal42:mainfrom
sayyedaribhussain:feat/pr-comment-view-reply

Conversation

@sayyedaribhussain

@sayyedaribhussain sayyedaribhussain commented Jul 24, 2026

Copy link
Copy Markdown

Description

Adds two subcommands under bb pr comment for viewing and replying to pull request comments, backed by the Bitbucket Cloud REST pull request comments API. The existing bb 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 their file:line. Supports --json and 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 --body is omitted.

API layer (internal/api/pullrequests.go)

  • ListAllPRComments — paginates GET /repositories/{ws}/{repo}/pullrequests/{id}/comments to completion
  • GetPRComment — fetch a single comment by id
  • ReplyToPRComment — thin wrapper over the existing AddPRComment with a parent id

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

Added tests alongside the code (go test ./... passes):

  • API (internal/api/pullrequests_test.go): TestListAllPRComments (verifies pagination is followed across pages via the next link), TestGetPRComment, and TestReplyToPRComment (asserts the parent.id is sent in the request body).
  • Command (internal/cmd/pr/comment_test.go): TestDisplayCommentsThreading (ordering + reply nesting), TestDisplayCommentsEmpty, and TestResolveCommentPRNumber (input validation).

Also verified bb pr comment list live (formatted + --json) against a real PR; reply was verified via build, help output, and required-flag enforcement.

Checklist

  • Code follows the project's style guidelines
  • Tests added/updated for changes
  • Documentation updated if needed
  • go test ./... passes
  • go vet ./... reports no issues

Note 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])

sayyedaribhussain and others added 2 commits July 24, 2026 16:23
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant