Fetch and filter GitHub PR review threads, comments, and nitpicks
npm install gh-pr-threads


CLI tool to fetch and filter GitHub Pull Request review threads, comments, and nitpicks.
- 🔍 Fetch all review threads with comments (from all users)
- 🤖 Parse nitpicks from CodeRabbit and other bots
- 🚫 Optional bot filtering with --ignore-bots
- 💾 Save comment processing state
- 🎯 Flexible filtering by data types
- 📊 Detailed PR statistics
Before using gh-pr-threads, ensure you have:
1. GitHub CLI (gh) installed and authenticated:
``bash`
# Install gh (macOS with Homebrew)
brew install gh
# Or download from https://github.com/cli/cli#installation
# Authenticate with GitHub
gh auth login
# Verify authentication
gh auth status
2. Node.js >= 18
`bash`
npx gh-pr-threads
Or globally:
`bash`
npm install -g gh-pr-threads
gh-pr-threads
`bashFrom PR URL
npx gh-pr-threads https://github.com/owner/repo/pull/123
$3
`bash
Show only threads (default shows everything)
npx gh-pr-threads --only=threadsInclude resolved threads/comments
npx gh-pr-threads --only=threads --with-resolvedShow all threads (including resolved review threads)
npx gh-pr-threads --allInclude threads/nitpicks marked as done/skip
npx gh-pr-threads --include-doneGet only specific data types
npx gh-pr-threads --only=threads,nitpicks
npx gh-pr-threads --only=summaries,filesExclude all bot comments and summaries
npx gh-pr-threads --ignore-botsCombine options
npx gh-pr-threads --all --include-done --with-resolved --only=threads --ignore-bots
`$3
`bash
npx gh-pr-threads --owner=owner --repo=repo-name --number=123
`$3
Clear all marked items (done/skip) from state:
`bash
Clear state for current PR
gh-pr-threads clearClear state for specific PR URL
gh-pr-threads clear https://github.com/owner/repo/pull/123Clear state with manual specification
gh-pr-threads clear --owner=owner --repo=repo-name --number=123
`This removes the state file, allowing you to restart review processing from scratch.
$3
Mark threads or nitpicks with a status:
`bash
Mark single item
gh-pr-threads mark done abc123
gh-pr-threads mark skip abc123Mark multiple items (batch)
gh-pr-threads mark done abc123 def456 ghi789
gh-pr-threads mark skip abc123 def456 --note "Out of scope"Clear mark
gh-pr-threads mark clear abc123
`Available statuses:
-
done - Mark as completed
- skip - Mark to skip (won't appear in default output)
- later - Mark to address later
- clear - Remove any existing mark$3
Reply to review threads:
`bash
Reply to single thread
gh-pr-threads reply "Your reply message" abc123Reply to multiple threads with same message (batch)
gh-pr-threads reply "Acknowledged, will fix in follow-up PR" abc123 def456Reply and mark as done
gh-pr-threads reply "Fixed" abc123 --mark done
`Note: Reply only works with review threads, not nitpicks.
$3
Resolve review threads on GitHub:
`bash
Resolve single thread
gh-pr-threads resolve abc123Resolve multiple threads (batch)
gh-pr-threads resolve abc123 def456 ghi789Resolve with reply
gh-pr-threads resolve abc123 --reply "Fixed in commit xyz"Resolve multiple with same reply
gh-pr-threads resolve abc123 def456 --reply "Addressed in refactoring"Resolve, reply, and mark
gh-pr-threads resolve abc123 --reply "Done" --mark done
`Note: Resolve only works with review threads, not nitpicks.
$3
Add reactions to review comments:
`bash
Add reaction to single comment
gh-pr-threads react THUMBS_UP abc123
gh-pr-threads react 👍 abc123Add reaction to multiple comments (batch)
gh-pr-threads react ❤️ abc123 def456 ghi789All supported reactions
gh-pr-threads react THUMBS_UP abc123 # 👍
gh-pr-threads react THUMBS_DOWN abc123 # 👎
gh-pr-threads react LAUGH abc123 # 😄
gh-pr-threads react HOORAY abc123 # 🎉
gh-pr-threads react CONFUSED abc123 # 😕
gh-pr-threads react HEART abc123 # ❤️
gh-pr-threads react ROCKET abc123 # 🚀
gh-pr-threads react EYES abc123 # 👀
`Supported reaction formats:
- Uppercase names:
THUMBS_UP, HEART, ROCKET
- Lowercase names: thumbs_up, heart, rocket
- Emoji: 👍, ❤️, 🚀Note: Reactions work with any review comment ID.
Filtering Options
$3
-
threads - Review threads with all comments (from users and bots)
- nitpicks - Nitpicks extracted from CodeRabbit comments
- summaries - Full summaries from bots (CodeRabbit, GitHub Actions, etc.)
- files - List of changed files in PRNote: To see only user comments without bots, use
--only=threads --ignore-bots$3
-
--ignore-bots - Exclude all bot comments, summaries, and nitpicks from output
- Detects bots by:
- GitHub GraphQL API __typename: "Bot" field (most reliable)
- Known bot usernames: coderabbitai, github-actions, sonarqubecloud, dependabot, renovate, greenkeeper$3
The tool automatically extracts nitpicks from CodeRabbit bot comments by parsing structured HTML
blocks:How it works:
1. Searches for
blocks with summary matching "Nitpick comments" or "Additional comments"
2. Within these blocks, finds nested blocks for each file (e.g., src/file.ts (5))
3. Extracts individual nitpicks formatted as 10-15: Fix this issue
4. Generates unique IDs based on file path and line number for state trackingExample CodeRabbit comment structure:
`html
Nitpick comments (10)
src/index.ts (3)
45-47: Consider using const instead of let
89: Add JSDoc comment
120-125: Extract this logic into a helper function
Access nitpicks:
`bash
Get all CodeRabbit nitpicks
gh-pr-threads --only=nitpicksExclude nitpicks already marked as done
gh-pr-threads --only=nitpicksInclude processed nitpicks
gh-pr-threads --only=nitpicks --include-done
`Each nitpick includes:
- path: File path (e.g.,
src/index.ts)
- line: Line number or range (e.g., 45 or 45-47)
- content: Nitpick description
- id: Unique identifier for state tracking
- status: Current processing status (if marked)$3
- Default: Only unresolved items are returned
-
--with-resolved - Include resolved threads and comments
- --all - Show all review threads (resolved and unresolved)
- --include-done - Include items marked as done or skip in stateOutput Format
$3
`json
{
"pr": {
"number": 123,
"title": "Fix bug",
"state": "OPEN",
"author": "username",
"isDraft": false,
"mergeable": "MERGEABLE",
"files": [...]
},
"statePath": "/Users/user/.cursor/reviews/owner-repo-123/pr-state.json",
"threads": [...],
"botSummaries": [...],
"summary": {
"totalThreads": 10,
"filteredCount": 5,
"unresolvedCount": 3,
"botSummariesCount": 2,
"nitpicksCount": 15
}
}
`$3
Grouped by file with syntax highlighting, thread IDs, and clickable URLs.
State
The tool saves processing state in:
`
~/.cursor/reviews/{owner}-{repo}-{number}/pr-state.json
`This allows marking threads and nitpicks as completed and filtering them on subsequent runs.
Requirements
- Node.js >= 18
- GitHub CLI (
gh) - See Prerequisites section above for installation and authenticationDevelopment
`bash
Install dependencies
npm installBuild
npm run buildDevelopment with hot-reload
npm run dev -- Run built version
node dist/index.js
`$3
The project includes automated quality checks:
`bash
Run all checks (typecheck, lint, tests)
npm run checkIndividual checks
npm run typecheck # TypeScript type checking
npm run lint # ESLint code quality
npm run lint:fix # Auto-fix linting issues
npm test # Run tests
npm run test:coverage # Test coverage report
`$3
Pre-commit hooks automatically run before each commit:
- ESLint with auto-fix on staged TypeScript files
- TypeScript type checking on the entire project
Hooks are automatically installed on
npm install via the prepare script.#### Skip Hooks (when needed)
`bash
Skip pre-commit hook for a specific commit
SKIP_SIMPLE_GIT_HOOKS=1 git commit -m "message"Or use --no-verify flag
git commit --no-verify -m "message"
`$3
GitHub Actions automatically run on every pull request and push to master:
- Tests on Node.js 18.x, 20.x, 22.x
- Type checking with TypeScript
- Linting with ESLint
- Build verification
- Coverage reporting (PR only)
See workflow status: CI Badge
Publishing
$3
1. Update version in
package.json:
`bash
npm version patch # or minor, major
`2. Build the project:
`bash
npm run build
`3. Publish to npm:
`bash
npm publish
`$3
`bash
In project directory
npm linkCommand is now available globally
gh-pr-threads --helpTo unlink
npm unlink -g gh-pr-threads
``MIT