Parse PR review comments, categorize them, and create beads tasks for required changes
Parses PR review comments from GitHub, categorizes them by type and priority, and creates beads tasks for required changes. Supports marking the PR ready for re-review once all blocking comments are addressed.
# Process PR feedback
/bkff:prfeedback --pr=123
# Process by URL
/bkff:prfeedback --pr=https://github.com/owner/repo/pull/123
# Mark ready for re-review after addressing comments
/bkff:prfeedback --pr=123 --ready=true
# Output as JSON for automation
/bkff:prfeedback --pr=123 --format=json
Comments are categorized by type and priority based on content analysis:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā COMMENT CATEGORIZATION ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā FETCH PR COMMENTS ā
ā ⢠Review comments ā
ā ⢠Inline code comments ā
ā ⢠Conversation threads ā
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ANALYZE EACH COMMENT ā
ā ⢠Extract action indicators ā
ā ⢠Detect blocking keywords ā
ā ⢠Identify suggestions ā
ā ⢠Check resolution status ā
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā CATEGORIZE ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Type: ā
ā ⢠BLOCKING - Must fix ā
ā ⢠SUGGESTION - Should consider ā
ā ⢠QUESTION - Needs response ā
ā ⢠PRAISE - No action needed ā
ā ⢠NIT - Minor/optional ā
ā ā
ā Priority: ā
ā ⢠P0 - Critical/Security ā
ā ⢠P1 - Must fix before merge ā
ā ⢠P2 - Should fix ā
ā ⢠P3 - Nice to have ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
| Category | Detected By | Priority |
|---|---|---|
| BLOCKING | "must", "required", "fix", "blocker", changes_requested review | P1 |
| SECURITY | "vulnerability", "security", "XSS", "injection", "CVE" | P0 |
| SUGGESTION | "suggest", "consider", "could", "might", "optional" | P2 |
| QUESTION | "?", "why", "how", "what", "can you explain" | P2 |
| NIT | "nit:", "nitpick", "minor", "style" | P3 |
| PRAISE | "LGTM", "nice", "great", "well done", approved review | None |
BLOCKING patterns:
- "please fix"
- "this needs to"
- "must be"
- "required"
- "blocker"
- "cannot merge until"
- Review state: CHANGES_REQUESTED
SECURITY patterns:
- "security"
- "vulnerability"
- "injection"
- "XSS"
- "CSRF"
- "authentication"
- "authorization"
- "CVE-"
SUGGESTION patterns:
- "consider"
- "suggestion:"
- "you could"
- "might want to"
- "alternatively"
- "optional:"
NIT patterns:
- "nit:"
- "nitpick"
- "minor:"
- "style:"
- "formatting"
When blocking or high-priority comments are found, beads tasks are created:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā TASK CREATION FLOW ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Categorized Comments:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā BLOCKING: 2 comments ā
ā SECURITY: 1 comment ā
ā SUGGESTION: 3 comments ā
ā NIT: 2 comments ā
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā
ā
ā Create tasks for P0-P2
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā CREATE BEADS TASKS ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā bd create --type=task ā
ā --title="PR #123: Fix SQL ā
ā injection in query" ā
ā --priority=0 ā
ā --description="..." ā
ā ā
ā bd create --type=task ā
ā --title="PR #123: Add input ā
ā validation" ā
ā --priority=1 ā
ā --description="..." ā
ā ā
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā
ā
ā Link to parent issue
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā SET DEPENDENCIES ā
ā ā
ā ⢠Link tasks to PR feature/epic ā
ā ⢠Add dependency on PR approval ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Title: PR #123: [Comment summary]
Description:
From PR review comment by @reviewer:
> [Original comment text]
File: src/api/query.ts
Line: 42
Action Required:
[Extracted action from comment]
---
PR: https://github.com/owner/repo/pull/123
Comment: https://github.com/owner/repo/pull/123#discussion_r123456
| Comment Type | Task Created | Priority |
|---|---|---|
| SECURITY | Yes | P0 |
| BLOCKING | Yes | P1 |
| SUGGESTION (with "should") | Yes | P2 |
| SUGGESTION (with "could") | No (logged only) | - |
| QUESTION | No (needs response) | - |
| NIT | No (logged only) | - |
| PRAISE | No | - |
When --ready=true is specified:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā RE-REVIEW FLOW ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā CHECK BLOCKING COMMENTS ā
ā ā
ā Scan for unresolved BLOCKING and ā
ā SECURITY comments ā
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāā“āāāāāāāāāā
ā ā
ā¼ ā¼
āāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā
ā All ā ā Unresolved ā
ā Resolved ā ā Comments Remain ā
āāāāāā¬āāāāāā āāāāāāāāāā¬āāāāāāāāāā
ā ā
ā¼ ā¼
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā
ā Request ā ā List unresolved ā
ā Re-review ā ā Exit with error ā
ā via gh CLI ā ā ā
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā
Re-review request:
gh pr ready 123
gh pr edit 123 --add-reviewer @original-reviewer
Before marking ready:
Comments may become stale when code changes after the review:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā STALE DETECTION ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Comment on src/api/query.ts:42
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā @reviewer: "Fix the SQL injection" ā
ā Posted: 2 days ago ā
ā Line content: "SELECT * FROM..." ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā Compare with current
ā¼
Current src/api/query.ts:42
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā // Using parameterized queries ā
ā Line changed since comment ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā STALE COMMENT DETECTED ā
ā ā
ā Possible reasons: ā
ā ⢠Already addressed ā
ā ⢠Code refactored ā
ā ⢠Line moved ā
ā ā
ā Action: Mark as potentially stale ā
ā Require manual verification ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
| Indicator | Confidence | Action |
|---|---|---|
| Line deleted | High | Mark as likely resolved |
| Line content changed | Medium | Mark as potentially resolved |
| Commit after comment | Low | Needs verification |
| Resolved in GitHub | Certain | Skip comment |
Stale Comments (require verification):
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
src/api/query.ts:42 - BLOCKING
Comment: "Fix the SQL injection"
Status: LINE_CHANGED
Reason: Line content no longer matches
Recommendation: Verify fix and resolve in GitHub
PR Review Feedback Analysis
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
PR: #123 - Add user authentication
Author: @contributor
Reviewers: @reviewer1, @reviewer2
Comment Summary
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
SECURITY: 1
BLOCKING: 2
SUGGESTION: 3
QUESTION: 1
NIT: 2
PRAISE: 1
Required Actions (tasks created)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā beads-abc123: PR #123: Fix SQL injection vulnerability (P0)
ā beads-def456: PR #123: Add input validation (P1)
ā beads-ghi789: PR #123: Handle edge case in auth flow (P1)
Suggestions (logged, no task)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
⢠src/auth.ts:15 - Consider using bcrypt instead of sha256
⢠src/api.ts:42 - Could add rate limiting here
⢠src/utils.ts:8 - Might want to extract this to a helper
Questions (need response)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
⢠src/config.ts:22 - Why is this timeout set to 30s?
Stale Comments
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā src/old-code.ts:10 - Line no longer exists (likely resolved)
Status: 3 blocking items require attention
{
"pr": {
"number": 123,
"title": "Add user authentication",
"author": "contributor",
"reviewers": ["reviewer1", "reviewer2"],
"url": "https://github.com/owner/repo/pull/123"
},
"summary": {
"security": 1,
"blocking": 2,
"suggestion": 3,
"question": 1,
"nit": 2,
"praise": 1
},
"tasks_created": [
{
"beads_id": "beads-abc123",
"title": "PR #123: Fix SQL injection vulnerability",
"priority": 0,
"comment_url": "https://github.com/.../discussion_r123"
}
],
"comments": [
{
"id": "123456",
"type": "SECURITY",
"priority": 0,
"file": "src/api/query.ts",
"line": 42,
"author": "reviewer1",
"body": "This query is vulnerable to SQL injection",
"resolved": false,
"stale": false,
"task_created": "beads-abc123"
}
],
"stale_comments": [
{
"id": "789",
"reason": "LINE_DELETED",
"file": "src/old-code.ts",
"line": 10
}
],
"ready_for_review": false,
"blocking_count": 3
}
gh CLI authenticated with repo access0 - Success (or ready for re-review)1 - Processing failed2 - PR not found3 - Blocking comments remain (when --ready=true)4 - gh CLI not authenticated/bkff:verifytask - Verify task completion/bkff:tasks2issues - Convert tasks to beads issues#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
source "$PLUGIN_DIR/lib/common.sh"
# Parse arguments
pr_ref=""
ready_mode="false"
format="human"
for arg in "$@"; do
case "$arg" in
--pr=*) pr_ref="${arg#--pr=}" ;;
--ready=*) ready_mode="${arg#--ready=}" ;;
--format=json) format="json" ;;
--format=human) format="human" ;;
--json) format="json" ;;
esac
done
# Validate prerequisites
require_worktree
if [[ -z "$pr_ref" ]]; then
error_exit "PR reference required. Use --pr=<number|url>"
fi
# Extract PR number from URL if needed
pr_number="$pr_ref"
if [[ "$pr_ref" =~ /pull/([0-9]+) ]]; then
pr_number="${BASH_REMATCH[1]}"
fi
# Check gh CLI
if ! command -v gh &>/dev/null; then
error_exit "GitHub CLI (gh) is required but not installed"
fi
if ! gh auth status &>/dev/null; then
error_exit "GitHub CLI not authenticated. Run 'gh auth login'"
fi
info "Processing PR #$pr_number feedback"
# Fetch PR comments using gh CLI
# Categorization and task creation is performed by Claude
echo "Ready to fetch and analyze PR comments via gh CLI"