agent-reviews 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +13 -0
- package/LICENSE +21 -0
- package/README.md +152 -0
- package/bin/agent-reviews.js +506 -0
- package/lib/comments.js +334 -0
- package/lib/format.js +166 -0
- package/lib/github.js +128 -0
- package/package.json +33 -0
- package/skills/agent-reviews/SKILL.md +189 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-reviews
|
|
3
|
+
description: Review and fix PR review bot findings on current PR, loop until resolved
|
|
4
|
+
allowed-tools: Bash(npx agent-reviews *), Bash(gh *), Bash(git *), Read, Glob, Grep, Edit, Write, AskUserQuestion, Task, TaskOutput
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Automatically review, fix, and respond to findings from PR review bots on the current PR. Uses a deterministic two-phase workflow: first fix all existing issues, then poll once for new ones.
|
|
8
|
+
|
|
9
|
+
## Phase 1: FETCH & FIX (synchronous)
|
|
10
|
+
|
|
11
|
+
### Step 1: Identify Current PR
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gh pr view --json number,url,headRefName
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If no PR exists, notify the user and exit.
|
|
18
|
+
|
|
19
|
+
### Step 2: Fetch All Bot Comments
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx agent-reviews --bots-only --json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Parse the JSON output. Count how many have `hasAnyReply: false` (unanswered).
|
|
26
|
+
|
|
27
|
+
If zero unanswered comments, print "No unanswered bot comments found" and skip to Phase 2.
|
|
28
|
+
|
|
29
|
+
### Step 3: Process Each Unanswered Comment
|
|
30
|
+
|
|
31
|
+
For each comment where `hasAnyReply === false`:
|
|
32
|
+
|
|
33
|
+
#### A. Get Full Detail
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx agent-reviews --detail <comment_id>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This shows the full comment body (no truncation), the diff hunk (code context), and all replies. Use this instead of `gh` CLI for comment details.
|
|
40
|
+
|
|
41
|
+
For structured data, use:
|
|
42
|
+
```bash
|
|
43
|
+
npx agent-reviews --detail <comment_id> --json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### B. Evaluate the Finding
|
|
47
|
+
|
|
48
|
+
Read the referenced code and determine:
|
|
49
|
+
|
|
50
|
+
1. **TRUE POSITIVE** - A real bug that needs fixing
|
|
51
|
+
2. **FALSE POSITIVE** - Not actually a bug (intentional behavior, bot misunderstanding)
|
|
52
|
+
3. **UNCERTAIN** - Not sure; ask the user
|
|
53
|
+
|
|
54
|
+
**Likely TRUE POSITIVE:**
|
|
55
|
+
- Code obviously violates stated behavior
|
|
56
|
+
- Missing null checks on potentially undefined values
|
|
57
|
+
- Type mismatches or incorrect function signatures
|
|
58
|
+
- Logic errors in conditionals
|
|
59
|
+
- Missing error handling for documented failure cases
|
|
60
|
+
|
|
61
|
+
**Likely FALSE POSITIVE:**
|
|
62
|
+
- Bot doesn't understand the framework/library patterns
|
|
63
|
+
- Code is intentionally structured that way (with comments explaining why)
|
|
64
|
+
- Bot is flagging style preferences, not bugs
|
|
65
|
+
- The "bug" is actually a feature or intentional behavior
|
|
66
|
+
- Bot misread the code flow
|
|
67
|
+
|
|
68
|
+
**When UNCERTAIN — use `AskUserQuestion`:**
|
|
69
|
+
- The fix would require architectural changes
|
|
70
|
+
- You're genuinely unsure if the behavior is intentional
|
|
71
|
+
- The "bug" relates to business logic you don't fully understand
|
|
72
|
+
- Multiple valid interpretations exist
|
|
73
|
+
- The fix could have unintended side effects
|
|
74
|
+
|
|
75
|
+
#### C. Handle Based on Evaluation
|
|
76
|
+
|
|
77
|
+
**If TRUE POSITIVE:**
|
|
78
|
+
1. Fix the code
|
|
79
|
+
2. Run type-check and lint to verify the fix
|
|
80
|
+
3. Reply to the comment:
|
|
81
|
+
```bash
|
|
82
|
+
npx agent-reviews --reply <comment_id> "✅ **Fixed in commit {hash}**
|
|
83
|
+
|
|
84
|
+
{Brief description of the fix}"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**If FALSE POSITIVE:**
|
|
88
|
+
1. Do NOT change the code
|
|
89
|
+
2. Reply to the comment:
|
|
90
|
+
```bash
|
|
91
|
+
npx agent-reviews --reply <comment_id> "⚠️ **Won't fix - {reason}**
|
|
92
|
+
|
|
93
|
+
{Explanation of why this is intentional or not applicable}"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**If user chose to skip:**
|
|
97
|
+
```bash
|
|
98
|
+
npx agent-reviews --reply <comment_id> "⏭️ Skipped per user request"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Step 4: Commit and Push
|
|
102
|
+
|
|
103
|
+
After processing ALL unanswered comments (not one at a time):
|
|
104
|
+
|
|
105
|
+
1. Run your project's lint and type-check
|
|
106
|
+
2. Stage, commit, and push:
|
|
107
|
+
```bash
|
|
108
|
+
git add -A
|
|
109
|
+
git commit -m "fix: address PR review bot findings
|
|
110
|
+
|
|
111
|
+
{List of bugs fixed, grouped by bot}"
|
|
112
|
+
git push
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**DO NOT start Phase 2 until all current issues are fixed and pushed.**
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Phase 2: POLL FOR NEW COMMENTS (10-minute inactivity timeout)
|
|
120
|
+
|
|
121
|
+
### Step 5: Start Watcher
|
|
122
|
+
|
|
123
|
+
Launch the watcher in the background. It polls every 30 seconds and exits after 10 minutes of inactivity (no new comments):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx agent-reviews --watch --bots-only
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This runs as a background task.
|
|
130
|
+
|
|
131
|
+
**CRITICAL: DO NOT cancel the background task early. Let it complete its full cycle.**
|
|
132
|
+
|
|
133
|
+
### Step 6: Wait for Results
|
|
134
|
+
|
|
135
|
+
Use `TaskOutput` to wait for the watcher to complete (blocks up to 12 minutes).
|
|
136
|
+
|
|
137
|
+
### Step 7: Process New Comments (if any)
|
|
138
|
+
|
|
139
|
+
If the watcher found new comments:
|
|
140
|
+
1. Process them exactly as in Phase 1, Steps 3-4
|
|
141
|
+
2. Use `--detail <id>` to read each new comment
|
|
142
|
+
|
|
143
|
+
If no new comments were found, move to the summary.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Summary Report
|
|
148
|
+
|
|
149
|
+
After both phases complete, provide a summary:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
## PR Review Bot Resolution Summary
|
|
153
|
+
|
|
154
|
+
### Results
|
|
155
|
+
- Fixed: X bugs
|
|
156
|
+
- Already fixed: X bugs
|
|
157
|
+
- Won't fix (false positives): X
|
|
158
|
+
- Skipped per user: X
|
|
159
|
+
|
|
160
|
+
### By Bot
|
|
161
|
+
#### cursor[bot]
|
|
162
|
+
- BUG-001: {description} - Fixed in {commit}
|
|
163
|
+
- BUG-002: {description} - Won't fix: {reason}
|
|
164
|
+
|
|
165
|
+
#### Copilot
|
|
166
|
+
- {description} - Fixed in {commit}
|
|
167
|
+
|
|
168
|
+
### Status
|
|
169
|
+
✅ All findings addressed. Watch completed.
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Important Notes
|
|
173
|
+
|
|
174
|
+
### Response Policy
|
|
175
|
+
- **Every finding gets a response** - No silent ignores
|
|
176
|
+
- Responses help train bots and document decisions
|
|
177
|
+
- "Won't fix" responses prevent the same false positive from being re-raised
|
|
178
|
+
|
|
179
|
+
### User Interaction
|
|
180
|
+
- Use `AskUserQuestion` when uncertain about a finding
|
|
181
|
+
- Don't guess on architectural or business logic questions
|
|
182
|
+
- It's better to ask than to make a wrong fix or wrong dismissal
|
|
183
|
+
|
|
184
|
+
### Best Practices
|
|
185
|
+
- Verify findings before fixing - bots have false positives
|
|
186
|
+
- Keep fixes minimal and focused - don't refactor unrelated code
|
|
187
|
+
- Ensure type-check and lint pass before committing
|
|
188
|
+
- Group related fixes into a single commit
|
|
189
|
+
- Copilot `suggestion` blocks often contain ready-to-use fixes
|