Skip to content

Add reviews command to capture PRs reviewed by a user#11

Merged
maxbeizer merged 1 commit intomainfrom
add-reviews-command
Feb 26, 2026
Merged

Add reviews command to capture PRs reviewed by a user#11
maxbeizer merged 1 commit intomainfrom
add-reviews-command

Conversation

@maxbeizer
Copy link
Copy Markdown
Owner

Summary

Adds a new reviews <username> command that fetches PRs reviewed by the specified user using the reviewed-by: search qualifier. Reviews are also included in the all and graph commands.

This addresses one of the key gaps in gh-contrib — previously it only captured authored PRs and issues, missing the important signal of code review activity.

Changes

New reviews command

  • gh contrib reviews <username> — fetches PRs reviewed by the user
  • Uses reviewed-by:<user> qualifier on the existing search/issues API
  • Supports --body-only, --since, --org flags (same as pulls)

Updated all command

  • Now includes reviews as a Review type row in CSV output
  • Deduplicates: if a user both authored and reviewed a PR, it only appears once (as "Pull Request")

Updated graph command

  • Reviews appear with (closed) and (open) symbols
  • Legend and summary updated to include review counts
  • Same deduplication logic

New helper

  • deduplicateItems() — removes items from review results that already appear in authored PR results (matched by URL)

Testing

  • TestHandleReviewsCommand_CSV — verifies CSV output for reviews
  • TestHandleReviewsCommand_BodyOnly — verifies body-only output with review markers
  • TestBuildReviewQuery — verifies the reviewed-by: query construction
  • TestDeduplicateItems — verifies dedup logic
  • Updated TestHandleAllCommand_CSV to expect reviews in output
  • Updated TestHandleGraphCommand_Basic to expect 3 API calls

All 24 tests pass.

Closes #10 (partially — discussions support tracked separately)

Adds a new 'reviews <username>' command that fetches PRs reviewed by the
specified user using the 'reviewed-by:' search qualifier. Reviews are also
included in the 'all' and 'graph' commands with deduplication to avoid
counting PRs the user both authored and reviewed.

New features:
- 'reviews <username>' command with CSV and --body-only output
- Reviews included in 'all' output as 'Review' type rows
- Reviews included in 'graph' with ◆/◇ symbols for closed/open
- Deduplication of authored PRs from review results
- Updated help text

Closes #10

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maxbeizer maxbeizer merged commit 5cecf8c into main Feb 26, 2026
@maxbeizer maxbeizer deleted the add-reviews-command branch February 26, 2026 18:54
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.

Add reviews and discussions support

1 participant