Loading...
Loading...
Fetch unresolved PR comments (both code-level and PR-level), validate issues, and fix them. Also checks CI status and fixes failing tests, lint errors, and build issues. Use when reviewing and addressing GitHub PR feedback. Filters out resolved comments, keeps only the last claude[bot] comment per thread, validates issues, posts review report as a PR comment, then fixes validated issues.
npx skill4agent add arjenschwarz/agentic-coding pr-review-fixer# Get PR info
PR_NUM=$(gh pr view --json number --jq '.number')
# Get all PR comments via GraphQL (code-level AND PR-level)
gh api graphql -f query='
query($owner: String!, $repo: String!, $pr: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
# Code-level review comments (file/line specific)
reviewThreads(first: 100) {
nodes {
id
isResolved
comments(first: 50) {
nodes { id body author { login } path line }
}
}
}
# PR-level review comments (top-level review body)
reviews(first: 50) {
nodes {
id
body
state
author { login }
}
}
# PR-level issue comments (general discussion)
comments(first: 100) {
nodes {
id
body
author { login }
}
}
}
}
}
' -f owner=OWNER -f repo=REPO -F pr=$PR_NUMisResolved: trueclaude[bot]APPROVEDclaude[bot]claude[bot].claude/reviews/PR-[number]/claude[bot]# PR Review Overview - Iteration [N]
**PR**: #[number] | **Branch**: [name] | **Date**: [YYYY-MM-DD]
## Valid Issues
### Code-Level Issues
#### Issue 1: [title]
- **File**: `path:line`
- **Reviewer**: @user
- **Comment**: [quoted]
- **Validation**: [rationale]
### PR-Level Issues
#### Issue 2: [title]
- **Type**: review comment | discussion comment
- **Reviewer**: @user
- **Comment**: [quoted]
- **Validation**: [rationale]
## Invalid/Skipped Issues
### Issue A: [title]
- **Location**: `path:line` or PR-level
- **Reviewer**: @user
- **Comment**: [quoted]
- **Reason**: [why invalid]review-fixes-[N].mdrune create ${OUTPUT_DIR}/review-fixes-${N}.md \
--title "PR Review Fixes - Iteration ${N}" \
--reference ${OUTPUT_DIR}/review-overview-${N}.md
# Add tasks via batch for efficiency
rune batch ${OUTPUT_DIR}/review-fixes-${N}.md --input '{
"file": "review-fixes-'${N}'.md",
"operations": [
{"type": "add", "title": "Fix: [issue 1]"},
{"type": "add", "title": "Fix: [issue 2]"}
]
}'rune next [file]rune progress [file] [id]rune complete [file] [id]# Get check status for the PR
gh pr checks --json name,state,conclusion
# For failed checks, get details
gh run view [RUN_ID] --log-failedmake testmake lintmake typecheck# Run tests and capture output
make test 2>&1 | tee test-output.txt
# If using pytest
pytest --tb=short 2>&1 | tee test-output.txt
# If using go test
go test ./... 2>&1 | tee test-output.txt# For each fixed code-level thread, resolve it using its thread ID
gh api graphql -f query='
mutation($threadId: ID!) {
resolveReviewThread(input: {threadId: $threadId}) {
thread { isResolved }
}
}
' -f threadId=THREAD_NODE_ID# Post the review overview content as a PR comment
gh pr comment $PR_NUM --body "$(cat <<'EOF'
# PR Review Overview - Iteration [N]
**PR**: #[number] | **Branch**: [name] | **Date**: [YYYY-MM-DD]
## Valid Issues (fixed)
[List of validated and fixed issues with file:line, reviewer, and brief description]
## Invalid/Skipped Issues
[List of skipped issues with rationale]
## CI Status
[Summary of CI check results and any fixes applied]
EOF
)"review-overview-*.mdreview-fixes-*.md