Monitor PR Comments
Poll a PR for new comments at regular intervals and address them as they come in.
Usage
- •
/git-monitor-pr-comments- Monitor PR for current branch - •
/git-monitor-pr-comments <pr-number>- Monitor specific PR - •
/git-monitor-pr-comments <pr-number> <interval>- Custom interval (default: 30s)
Reference Files
- •@init-tracking.sh - Initialize the processed comments tracking file
- •@monitor-script.sh - Background polling script
Instructions
1. Get repo info and PR number
bash
REPO=$(gh repo view --json owner,name --jq '.owner.login + "/" + .name') PR=<pr-number> # From args or current branch's PR
2. Initialize tracking
Run the init script to mark all current comments as "already seen":
bash
bash .claude/commands/git-monitor-pr-comments/init-tracking.sh "$REPO" "$PR"
3. Start background monitor
Copy the monitor script to /tmp and run with run_in_background: true:
bash
cp .claude/commands/git-monitor-pr-comments/monitor-script.sh ./tmp/ chmod +x ./tmp/monitor-script.sh ./tmp/monitor-script.sh "$REPO" "$PR" "30"
This returns a task ID and output file path.
4. Check for new comments
Periodically read the output file:
bash
tail -20 /path/to/task/output
5. When a new comment is detected
- •
Add to processed list immediately to avoid re-detection:
bashecho "<comment_id>" >> ./tmp/pr${PR}_processed_comments.txt - •
Fetch full comment details:
bashgh api repos/$REPO/pulls/$PR/comments/<id>
- •
Categorize and address using
/git-address-pr-reviewworkflow - •
Refresh baseline after replying (to exclude your own replies):
bashbash .claude/commands/git-monitor-pr-comments/init-tracking.sh "$REPO" "$PR"
6. Stop monitoring
Use TaskStop tool with the background task ID.
Key Details
- •Two comment sources: PR review comments (
/pulls/{pr}/comments) and issue comments (/issues/{pr}/comments) - •Tracking file:
./tmp/pr<number>_processed_comments.txt- one ID per line - •Output format: Truncated to 150 chars; fetch full comment when processing
- •Background execution: Monitor runs via
run_in_backgroundso you can continue working