Skip to content

Commit f363558

Browse files
committed
feat: add test version of PR review command
- Creates a non-production PR review command for evaluation - Outputs review results locally without posting to GitHub - Allows multiple test runs without polluting PR with comments - Useful for evaluating review effectiveness before production use
1 parent 12f94fc commit f363558

File tree

1 file changed

+355
-0
lines changed

1 file changed

+355
-0
lines changed

.roo/commands/pr-review.md

Lines changed: 355 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,355 @@
1+
<!-- TOOL CALL -->
2+
```
3+
<update_todo_list>
4+
<todos>
5+
[ ] Fetch pull request information
6+
[ ] Fetch associated issue (if any)
7+
[ ] Fetch pull request diff
8+
[ ] Fetch existing PR comments and reviews
9+
[ ] Check out pull request locally
10+
[ ] Verify existing comments against current code
11+
[ ] Review changes
12+
[ ] Present review to the user
13+
</todos>
14+
</update_todo_list>
15+
```
16+
</instructions>
17+
18+
</step>
19+
20+
<step number="2">
21+
<name>Fetch Repository and Pull Request Information</name>
22+
<instructions>
23+
Get repo info:
24+
<!-- TOOL CALL -->
25+
```
26+
<execute_command>
27+
<command>gh repo view --json owner,name</command>
28+
</execute_command>
29+
```
30+
31+
Fetch PR details:
32+
<!-- TOOL CALL -->
33+
```
34+
<execute_command>
35+
<command>gh pr view [PR_NUMBER] --repo [owner]/[repo] --json number,title,body,author,state,url,headRefName,baseRefName,headRefOid,mergeable,isDraft,createdAt,updatedAt</command>
36+
</execute_command>
37+
```
38+
39+
<!-- TOOL CALL -->
40+
```
41+
<update_todo_list>
42+
<todos>
43+
[x] Fetch pull request information
44+
[ ] Fetch associated issue (if any)
45+
[ ] Fetch pull request diff
46+
[ ] Fetch existing PR comments and reviews
47+
[ ] Check out pull request locally
48+
[ ] Verify existing comments against current code
49+
[ ] Review changes
50+
[ ] Present review to the user
51+
</todos>
52+
</update_todo_list>
53+
```
54+
</instructions>
55+
56+
</step>
57+
58+
<step number="3">
59+
<name>Fetch Associated Issue (If Any)</name>
60+
<instructions>
61+
While reviewing check if the PR is within scope of the issue and it's actually an attempt at solving it.
62+
Check PR body for issue references (e.g., "Fixes #123"):
63+
<!-- TOOL CALL -->
64+
```
65+
<execute_command>
66+
<command>gh issue view [issue_number] --repo [owner]/[repo] --json number,title,body,author,state,url,createdAt,updatedAt,comments</command>
67+
</execute_command>
68+
```
69+
70+
<!-- TOOL CALL -->
71+
```
72+
<update_todo_list>
73+
<todos>
74+
[x] Fetch pull request information
75+
[x] Fetch associated issue (if any)
76+
[ ] Fetch pull request diff
77+
[ ] Fetch existing PR comments and reviews
78+
[ ] Check out pull request locally
79+
[ ] Verify existing comments against current code
80+
[ ] Review changes
81+
[ ] Present review to the user
82+
</todos>
83+
</update_todo_list>
84+
```
85+
</instructions>
86+
87+
</step>
88+
89+
<step number="4">
90+
<name>Fetch Pull Request Diff</name>
91+
<instructions>
92+
Get changes:
93+
<!-- TOOL CALL -->
94+
```
95+
<execute_command>
96+
<command>gh pr diff [PR_NUMBER] --repo [owner]/[repo]</command>
97+
</execute_command>
98+
```
99+
100+
<!-- TOOL CALL -->
101+
```
102+
<update_todo_list>
103+
<todos>
104+
[x] Fetch pull request information
105+
[x] Fetch associated issue (if any)
106+
[x] Fetch pull request diff
107+
[ ] Fetch existing PR comments and reviews
108+
[ ] Check out pull request locally
109+
[ ] Verify existing comments against current code
110+
[ ] Review changes
111+
[ ] Present review to the user
112+
</todos>
113+
</update_todo_list>
114+
```
115+
</instructions>
116+
117+
</step>
118+
119+
<step number="5">
120+
<name>Fetch Existing PR Comments and Reviews</name>
121+
<instructions>
122+
**CRITICAL:** Get existing feedback BEFORE reviewing:
123+
124+
<!-- TOOL CALL -->
125+
```
126+
<execute_command>
127+
<command>gh pr view [PR_NUMBER] --repo [owner]/[repo] --comments</command>
128+
</execute_command>
129+
```
130+
131+
<!-- TOOL CALL -->
132+
```
133+
<execute_command>
134+
<command>gh api repos/[owner]/[repo]/pulls/[PR_NUMBER]/reviews</command>
135+
</execute_command>
136+
```
137+
138+
Note all existing issues, files/lines mentioned, and resolution status.
139+
140+
<!-- TOOL CALL -->
141+
```
142+
<update_todo_list>
143+
<todos>
144+
[x] Fetch pull request information
145+
[x] Fetch associated issue (if any)
146+
[x] Fetch pull request diff
147+
[x] Fetch existing PR comments and reviews
148+
[ ] Check out pull request locally
149+
[ ] Verify existing comments against current code
150+
[ ] Review changes
151+
[ ] Present review to the user
152+
</todos>
153+
</update_todo_list>
154+
```
155+
</instructions>
156+
157+
</step>
158+
159+
<step number="6">
160+
<name>Check Out Pull Request Locally</name>
161+
<instructions>
162+
<!-- TOOL CALL -->
163+
```
164+
<execute_command>
165+
<command>gh pr checkout [PR_NUMBER] --repo [owner]/[repo]</command>
166+
</execute_command>
167+
```
168+
169+
<!-- TOOL CALL -->
170+
```
171+
<update_todo_list>
172+
<todos>
173+
[x] Fetch pull request information
174+
[x] Fetch associated issue (if any)
175+
[x] Fetch pull request diff
176+
[x] Fetch existing PR comments and reviews
177+
[x] Check out pull request locally
178+
[ ] Verify existing comments against current code
179+
[ ] Review changes
180+
[ ] Present review to the user
181+
</todos>
182+
</update_todo_list>
183+
```
184+
</instructions>
185+
186+
</step>
187+
188+
<step number="7">
189+
<name>Verify Existing Comments Against Current Code</name>
190+
<instructions>
191+
For each existing comment:
192+
- Check if issue addressed in current code
193+
- Mark as resolved or pending
194+
- Examine the relevant code areas to verify fixes
195+
196+
Track:
197+
- Resolved comments (DON'T repeat)
198+
- Still valid comments
199+
- New issues (main focus)
200+
201+
<update_todo_list>
202+
<todos>
203+
[x] Fetch pull request information
204+
[x] Fetch associated issue (if any)
205+
[x] Fetch pull request diff
206+
[x] Fetch existing PR comments and reviews
207+
[x] Check out pull request locally
208+
[x] Verify existing comments against current code
209+
[ ] Review changes
210+
[ ] Present review to the user
211+
</todos>
212+
</update_todo_list>
213+
</instructions>
214+
215+
</step>
216+
217+
<step number="8">
218+
<name>Review Changes</name>
219+
<instructions>
220+
**Review methodology:**
221+
222+
1. **Contract Consistency:**
223+
- Verify all referenced properties exist in their types/interfaces/classes
224+
- Check for invalid, missing, or renamed properties
225+
- Confirm changes don’t break inheritance, composition, or overrides
226+
- Look for contract violations across related entities
227+
228+
2. **Reference and Usage Review:**
229+
- Trace references to changed functions, methods, or classes
230+
- Ensure usages remain compatible with changes
231+
- Watch for subtle breaking changes
232+
233+
3. **Security review:**
234+
- Check for exposed sensitive data
235+
- Verify input validation
236+
- Look for injection vulnerabilities
237+
238+
4. **Code quality checks:**
239+
- Identify code smells (long methods, complex logic, tight coupling)
240+
- Find duplicated code that should be refactored
241+
- Check for hardcoded English strings (should use i18n)
242+
- Verify test coverage for new/changed code
243+
244+
5. **Performance considerations:**
245+
- Look for inefficient algorithms
246+
- Identify potential memory leaks
247+
248+
**NEVER** run tests or execute code - only review.
249+
250+
<!-- TOOL CALL -->
251+
```
252+
<update_todo_list>
253+
<todos>
254+
[x] Fetch pull request information
255+
[x] Fetch associated issue (if any)
256+
[x] Fetch pull request diff
257+
[x] Fetch existing PR comments and reviews
258+
[x] Check out pull request locally
259+
[x] Verify existing comments against current code
260+
[x] Review changes
261+
[ ] Present review to the user
262+
</todos>
263+
</update_todo_list>
264+
```
265+
</instructions>
266+
267+
</step>
268+
269+
<step number="9">
270+
<name>Present Review to the User</name>
271+
<instructions>
272+
<!-- TOOL CALL -->
273+
```
274+
<ask_followup_question>
275+
<question>I've completed my review of PR #[number]. Here's what I found:
276+
277+
[If applicable: **Existing comments resolved:**
278+
- Comment about X - now addressed]
279+
280+
**Review Findings:**
281+
- Critical, important, and minor items are summarized above.
282+
283+
Inline Comments (edit as needed):
284+
285+
List all review comments below using fenced code blocks, one per comment, with the info string "inline_comment".
286+
Use these fields:
287+
- path
288+
- line
289+
- side (LEFT/RIGHT)
290+
- body
291+
292+
Example format (replace with real comments):
293+
```inline_comment
294+
path: src/services/marketplace/SimpleInstaller.ts
295+
line: 87
296+
side: RIGHT
297+
body: Installing a marketplace mode overwrites a local mode with the same slug. Consider blocking or prompting to avoid unintended data loss.
298+
```
299+
300+
What would you like to do with these findings?</question>
301+
<follow_up>
302+
<suggest mode="code">Switch to Code mode and fix the issues/suggestions</suggest>
303+
<suggest>Let me modify the suggestions first</suggest>
304+
</follow_up>
305+
</ask_followup_question>
306+
```
307+
308+
**If switching to Code mode:**
309+
<!-- TOOL CALL -->
310+
```
311+
<update_todo_list>
312+
<todos>
313+
[x] Fetch pull request information
314+
[x] Fetch associated issue (if any)
315+
[x] Fetch pull request diff
316+
[x] Fetch existing PR comments and reviews
317+
[x] Check out pull request locally
318+
[x] Verify existing comments against current code
319+
[x] Review changes
320+
[x] Present review to the user
321+
[ ] Address critical issues
322+
[ ] Implement important suggestions
323+
[ ] Apply minor improvements (if time permits)
324+
[ ] Test changes
325+
[ ] Commit and push fixes
326+
</todos>
327+
</update_todo_list>
328+
```
329+
330+
<!-- TOOL CALL -->
331+
```
332+
<switch_mode>
333+
<mode_slug>code</mode_slug>
334+
<reason>User requested to fix the issues and suggestions found during PR review</reason>
335+
</switch_mode>
336+
```
337+
338+
<!-- TOOL CALL -->
339+
```
340+
<update_todo_list>
341+
<todos>
342+
[x] Fetch pull request information
343+
[x] Fetch associated issue (if any)
344+
[x] Fetch pull request diff
345+
[x] Fetch existing PR comments and reviews
346+
[x] Check out pull request locally
347+
[x] Verify existing comments against current code
348+
[x] Review changes
349+
[x] Present review to the user
350+
</todos>
351+
</update_todo_list>
352+
```
353+
</instructions>
354+
355+
</step>

0 commit comments

Comments
 (0)