Instrucciones de origen · Vista previa de solo lectura
name
coderabbit-conversations
description
List and resolve all unresolved CodeRabbit review conversations from the current PR
version
1.0.0
license
Apache-2.0
allowed-tools
Bash,Read,edit_file,todo_write
metadata
{"command":"gh api graphql","tags":"github pr review coderabbit"}
CodeRabbit Conversations
List all unresolved CodeRabbit review conversations from the current PR, create a TODO list to address each one, and resolve them all once fixed.
Why GraphQL Instead of REST
The gh pr view --json reviews,comments approach only returns review-level data and misses individual conversation threads. GitHub's GraphQL API exposes the reviewThreads connection which gives us:
Per-thread resolution status (isResolved)
Whether the comment is outdated/outside diff (isOutdated)
The exact file path and line number
The full comment body
Thread IDs needed for the resolveReviewThread mutation
Fetch all review threads from the PR using GitHub's GraphQL API with cursor-based pagination (PRs may have >100 threads). This collects every conversation thread with its resolution status, outdated status, file path, line number, and comment body into $ALL_THREADS.
Copy-paste this to quickly list all unresolved CodeRabbit conversations for the current PR. This fetches the first 100 threads and warns if there are more (use the paginated Step 3 workflow above for PRs with >100 threads):
PR_NUMBER=$(gh pr view --json number --jq '.number') && REPO_INFO=$(gh repo view --json owner,name) && OWNER=$(echo"$REPO_INFO" | jq -r '.owner.login') && REPO=$(echo"$REPO_INFO" | jq -r '.name') && RESULT=$(gh api graphql -f query='{ repository(owner: "'"$OWNER"'", name: "'"$REPO"'") { pullRequest(number: '"$PR_NUMBER"') { reviewThreads(first: 100) { totalCount nodes { id isResolved isOutdated comments(first: 1) { nodes { author { login } path line body } } } } } } }') && TOTAL=$(echo"$RESULT" | jq -r '.data.repository.pullRequest.reviewThreads.totalCount') && FETCHED=$(echo"$RESULT" | jq '.data.repository.pullRequest.reviewThreads.nodes | length') && if [ "$TOTAL" -gt "$FETCHED" ]; thenecho"⚠️ WARNING: PR has $TOTAL threads but only $FETCHED were fetched. Use the paginated workflow in Steps 3-4 to get all threads."; fi && echo"$RESULT" | jq -r '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | select(.isOutdated == false) | select(.comments.nodes[0].author.login == "coderabbitai")] | "Unresolved CodeRabbit conversations: \(length)\n", (to_entries[] | "\(.key + 1). [\(.value.id)] \(.value.comments.nodes[0].path):\(.value.comments.nodes[0].line // "N/A")\n \(.value.comments.nodes[0].body | split("\n")[0:5] | join("\n "))\n")'
Guidelines
Always fetch threads via GraphQL, not gh pr view --json reviews (which misses thread-level data)
Only process unresolved, non-outdated threads from coderabbitai
Create one TODO per conversation thread for tracking
Fix all issues before resolving conversations
Resolve conversations only after the code changes are committed
Steps 3 and 6 use cursor-based pagination to handle PRs with >100 threads; the one-liner warns if threads are truncated