[FEAT] add gh_pr_review tool to fetch PR review comments#13
[FEAT] add gh_pr_review tool to fetch PR review comments#13four-bytes-robby wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new Changesgh_pr_review Tool
GitLab API Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
The gh_pr_review tool was already merged via PR #19 (which fixed the bodyless-review bug). This PR's feature is superseded — closing as obsolete. |
Summary
Adds a new
gh_pr_reviewtool that fetches review comments and review submissions from a GitHub pull request, returning structured output (author, state, body, timestamp) instead of rawgh pr viewJSON.Motivation
The supertools plugin could already add a PR comment (
gh_pr_comment) and check PR status (gh_pr_status), but had no way to read review feedback. Code-reviewer subagents and humans had to scrapegh pr viewvia bash. This saves ~90% tokens on typical review-fetch flows.Changes
src/tools/gh-pr-review.ts(new, 107 lines) —ghPrReviewToolexportingpr: number, repo?: string. Callsgh pr view <N> --json comments,reviews, parses, formats into two sections:## Reviews— formal review submissions, with state badge[APPROVED],[COMMENTED],[CHANGES_REQUESTED], author, timestamp, body (truncated to 500 chars). Empty-body reviews (bare approval clicks) are filtered out.## Comments— issue/timeline comments with author, timestamp, body (truncated to 300 chars).No review comments on PR #N.src/four-opencode-supertools.ts— registered asgh_pr_review.Notes
gh pr view --jsonthat bothcommentsandreviewsare valid fields in currentghCLI.path/line) are NOT included in v1 — they require a separate GraphQL query againstrepository.pullRequest.reviews.comments. Out of scope for this PR; can be added as a follow-up if needed.gh-pr-comment.ts:runGh+resolveRepofrom../lib/gh-utils,logDebugEventfor observability.Verification
bun run build— passes (31 modules bundled, 105.77 KB output)bun test tests/gh-tools.test.ts— all 26 existing tests passnpx eslint src/tools/gh-pr-review.ts— cleanbun run typecheck— no new errors (pre-existinggitlab-utils.ts(69,47)TS2339 is unrelated to this PR; confirmed by stashing changes)anthropics/claude-code#1(39 comments, 11 reviews) — output renders correctly with empty-body reviews filteredCloses #12
Summary by cubic
Adds
gh_pr_reviewto fetch GitHub PR review submissions and timeline comments, returning compact, structured text for easier consumption. Addresses #12 by enabling tools and subagents to read review feedback without scrapinggh pr view.New Features
commentsandreviewsviagh pr view --json; outputs “Reviews” (state, author, timestamp, body) and “Comments”; truncates long bodies and filters empty-body approvals.prand optionalrepo; uses sharedrunGh/resolveRepowith debug logging.src/four-opencode-supertools.tsasgh_pr_review; v1 excludes inline diff comments.Bug Fixes
gitlab-utils.ts, castdatatoanywhen reading.messageto fix a typecheck error in error handling.Written for commit cbec041. Summary will update on new commits.
Summary by CodeRabbit