5-phase-workflow 1.0.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/README.md +332 -0
- package/bin/install.js +408 -0
- package/docs/workflow-guide.md +1024 -0
- package/package.json +34 -0
- package/src/agents/integration-agent.md +219 -0
- package/src/agents/review-processor.md +160 -0
- package/src/agents/step-executor.md +108 -0
- package/src/agents/step-fixer.md +132 -0
- package/src/agents/step-verifier.md +125 -0
- package/src/agents/verification-agent.md +411 -0
- package/src/commands/5/configure.md +309 -0
- package/src/commands/5/discuss-feature.md +393 -0
- package/src/commands/5/implement-feature.md +502 -0
- package/src/commands/5/plan-feature.md +285 -0
- package/src/commands/5/plan-implementation.md +376 -0
- package/src/commands/5/quick-implement.md +263 -0
- package/src/commands/5/review-code.md +583 -0
- package/src/commands/5/verify-implementation.md +277 -0
- package/src/hooks/statusline.js +53 -0
- package/src/settings.json +6 -0
- package/src/skills/build-project/SKILL.md +277 -0
- package/src/skills/configure-project/SKILL.md +355 -0
- package/src/skills/generate-readme/EXAMPLES.md +168 -0
- package/src/skills/generate-readme/SKILL.md +123 -0
- package/src/skills/generate-readme/TEMPLATE.md +141 -0
- package/src/skills/run-tests/SKILL.md +365 -0
- package/src/templates/ARCHITECTURE.md +64 -0
- package/src/templates/CONCERNS.md +75 -0
- package/src/templates/CONVENTIONS.md +75 -0
- package/src/templates/INTEGRATIONS.md +65 -0
- package/src/templates/STACK.md +60 -0
- package/src/templates/STRUCTURE.md +60 -0
- package/src/templates/TESTING.md +107 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 5:review-code
|
|
3
|
+
description: Reviews code changes using CodeRabbit CLI by delegating execution and parsing to review-processor agent. Handles user interaction and fix application in main context.
|
|
4
|
+
allowed-tools: Bash, Read, Edit, Write, Glob, Grep, AskUserQuestion, Task, mcp__jetbrains__*
|
|
5
|
+
model: sonnet
|
|
6
|
+
context: fork
|
|
7
|
+
user-invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Review Code with CodeRabbit (Phase 5)
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
This skill automates code review using the CodeRabbit CLI. It supports two workflows:
|
|
15
|
+
|
|
16
|
+
**Workflow A: Interactive Review** (default)
|
|
17
|
+
1. Checks prerequisites in main context
|
|
18
|
+
2. Asks user what to review
|
|
19
|
+
3. Delegates CodeRabbit execution and output parsing to review-processor agent
|
|
20
|
+
4. Presents structured results and asks user for decisions
|
|
21
|
+
5. Applies fixes based on user approval
|
|
22
|
+
6. Reports results
|
|
23
|
+
|
|
24
|
+
**Workflow B: File-Based Annotation** (user preference)
|
|
25
|
+
1. Runs CodeRabbit and saves findings to `.5/{feature-name}/review-{timestamp}-findings.md`
|
|
26
|
+
2. User edits the file to mark which findings to fix ([FIX], [SKIP], [MANUAL])
|
|
27
|
+
3. User runs `/review-code apply` to read annotations and apply marked fixes
|
|
28
|
+
|
|
29
|
+
**Architecture:** `Command -> Agent -> CodeRabbit CLI`
|
|
30
|
+
- This command stays in the main context (user interaction, fix application)
|
|
31
|
+
- review-processor agent runs CodeRabbit and categorizes findings (forked context)
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
|
|
35
|
+
**Required:**
|
|
36
|
+
- CodeRabbit CLI installed (`coderabbit` command available)
|
|
37
|
+
- User logged in to CodeRabbit (`coderabbit auth status` shows authenticated)
|
|
38
|
+
- Git repository with changes to review
|
|
39
|
+
|
|
40
|
+
**Installation:**
|
|
41
|
+
If CodeRabbit is not installed, see: https://docs.coderabbit.ai/cli/installation
|
|
42
|
+
|
|
43
|
+
## Review Process
|
|
44
|
+
|
|
45
|
+
### Step 1: Check Prerequisites
|
|
46
|
+
|
|
47
|
+
Check if CodeRabbit CLI is installed and user is authenticated:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Check if coderabbit command exists
|
|
51
|
+
which coderabbit
|
|
52
|
+
|
|
53
|
+
# Check authentication status
|
|
54
|
+
coderabbit auth status
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**If not installed or not logged in:**
|
|
58
|
+
- Inform user: "CodeRabbit CLI is not installed or you're not logged in."
|
|
59
|
+
- Provide installation/login instructions
|
|
60
|
+
- Exit without reviewing
|
|
61
|
+
|
|
62
|
+
### Step 2: Check for Special Modes
|
|
63
|
+
|
|
64
|
+
**Check if user invoked with `apply` argument:**
|
|
65
|
+
```
|
|
66
|
+
/review-code apply
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If `apply` mode:
|
|
70
|
+
- Skip to Step 11 (Apply Annotated Findings)
|
|
71
|
+
- Do NOT run a new review
|
|
72
|
+
|
|
73
|
+
**Otherwise, proceed with new review:**
|
|
74
|
+
|
|
75
|
+
### Step 3: Determine What to Review
|
|
76
|
+
|
|
77
|
+
Ask the user what to review and how to present results using AskUserQuestion:
|
|
78
|
+
|
|
79
|
+
**Question 1: What to review?**
|
|
80
|
+
1. **Staged changes** (default) - Review `git diff --cached`
|
|
81
|
+
2. **Unstaged changes** - Review `git diff`
|
|
82
|
+
3. **All changes** - Review both staged and unstaged
|
|
83
|
+
4. **Current branch** - Review all commits on current branch vs main/master
|
|
84
|
+
5. **Specific files** - User specifies file paths
|
|
85
|
+
|
|
86
|
+
**Question 2: How to review?**
|
|
87
|
+
1. **Interactive** (default) - Show findings and apply fixes immediately
|
|
88
|
+
2. **Save to file** - Save findings to `.5/{feature-name}/` for later annotation
|
|
89
|
+
|
|
90
|
+
### Step 4: Spawn review-processor Agent
|
|
91
|
+
|
|
92
|
+
Read `.claude/agents/review-processor.md` for agent instructions, then spawn via Task tool:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Task tool call:
|
|
96
|
+
subagent_type: general-purpose
|
|
97
|
+
description: "Run CodeRabbit review"
|
|
98
|
+
prompt: |
|
|
99
|
+
{Contents of review-processor.md}
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Your Task
|
|
104
|
+
|
|
105
|
+
Review Scope: {scope from Step 3}
|
|
106
|
+
Base Branch: {branch-name if scope is "branch"}
|
|
107
|
+
Files: [{file-paths if scope is "files"}]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 5: Process Agent Results
|
|
111
|
+
|
|
112
|
+
Receive structured results from review-processor:
|
|
113
|
+
- Total issues count
|
|
114
|
+
- Categorized findings: fixable, questions, manual
|
|
115
|
+
- Raw CodeRabbit output
|
|
116
|
+
|
|
117
|
+
If agent returned failure (CodeRabbit failed), report error and exit.
|
|
118
|
+
|
|
119
|
+
### Step 6: Branch Based on Review Mode
|
|
120
|
+
|
|
121
|
+
**If user selected "Save to file":**
|
|
122
|
+
- Skip to Step 10 (Save Findings to File)
|
|
123
|
+
|
|
124
|
+
**If user selected "Interactive":**
|
|
125
|
+
- Continue to Step 7
|
|
126
|
+
|
|
127
|
+
### Step 7: Provide Overview and Ask User
|
|
128
|
+
|
|
129
|
+
Present a concise overview of all findings:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
CodeRabbit Review Results:
|
|
133
|
+
|
|
134
|
+
Summary:
|
|
135
|
+
- Total Issues: {N}
|
|
136
|
+
- Fixable: {N} (can be applied automatically)
|
|
137
|
+
- Questions: {N} (need clarification)
|
|
138
|
+
- Manual Review: {N} (require judgment)
|
|
139
|
+
|
|
140
|
+
Fixable Issues:
|
|
141
|
+
- ProductFactory.ts:45 - Remove unused import
|
|
142
|
+
- OrderValidator.ts:23 - Add null check for parameter
|
|
143
|
+
|
|
144
|
+
Questions:
|
|
145
|
+
? ProductFactory.ts:67 - Should validation check for empty strings?
|
|
146
|
+
|
|
147
|
+
Manual Review Needed:
|
|
148
|
+
- ProductFactory.ts:120 - Consider extracting method (complexity: 15)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Use AskUserQuestion to ask:**
|
|
152
|
+
- Which fixable issues should be applied? (options: All, Selected, None)
|
|
153
|
+
|
|
154
|
+
### Step 8: Apply Fixes Based on User Agreement
|
|
155
|
+
|
|
156
|
+
Only apply fixes that the user has agreed to:
|
|
157
|
+
|
|
158
|
+
**If user chose "All fixable issues":**
|
|
159
|
+
- Apply all fixable issues automatically
|
|
160
|
+
- Track applied fixes
|
|
161
|
+
|
|
162
|
+
**If user chose "Selected":**
|
|
163
|
+
- Ask which specific fixes to apply
|
|
164
|
+
- Apply only selected fixes
|
|
165
|
+
|
|
166
|
+
**If user chose "None":**
|
|
167
|
+
- Skip to reporting
|
|
168
|
+
|
|
169
|
+
**For each fix to apply:**
|
|
170
|
+
1. Read the file
|
|
171
|
+
2. Apply the suggested fix using Edit tool
|
|
172
|
+
3. Format using IDE (if available) `reformat_file` if available
|
|
173
|
+
4. Track applied fixes
|
|
174
|
+
|
|
175
|
+
### Step 9: Handle Questions Based on User Preference
|
|
176
|
+
|
|
177
|
+
If there are questions from CodeRabbit, use AskUserQuestion:
|
|
178
|
+
|
|
179
|
+
**Options:**
|
|
180
|
+
1. "Ask me for each" - Present each question individually
|
|
181
|
+
2. "Skip all" - Add to manual review list
|
|
182
|
+
|
|
183
|
+
**If "Ask me for each":**
|
|
184
|
+
- For each question, use AskUserQuestion to get answer
|
|
185
|
+
- If answer requires code change, apply it
|
|
186
|
+
- Track as user-resolved
|
|
187
|
+
|
|
188
|
+
### Step 9b: Verify Changes
|
|
189
|
+
|
|
190
|
+
After applying fixes:
|
|
191
|
+
|
|
192
|
+
1. **Compile:**
|
|
193
|
+
Use the `/build-project` skill to compile:
|
|
194
|
+
```
|
|
195
|
+
Skill tool call:
|
|
196
|
+
skill: "build-project"
|
|
197
|
+
args: "target=compile"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
2. **Check for problems:**
|
|
201
|
+
Use IDE (if available) `get_file_problems` on modified files
|
|
202
|
+
|
|
203
|
+
3. **Run tests:**
|
|
204
|
+
Use the `/run-tests` skill to run tests:
|
|
205
|
+
```
|
|
206
|
+
Skill tool call:
|
|
207
|
+
skill: "run-tests"
|
|
208
|
+
args: "target=all"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
4. **Report results:**
|
|
212
|
+
- If compilation fails: Revert problematic fixes, report to user
|
|
213
|
+
- If tests fail: Report which tests failed, suggest manual review
|
|
214
|
+
- If all pass: Confirm fixes are successful
|
|
215
|
+
|
|
216
|
+
### Step 9c: Generate Review Summary
|
|
217
|
+
|
|
218
|
+
Create comprehensive summary report:
|
|
219
|
+
|
|
220
|
+
```markdown
|
|
221
|
+
# CodeRabbit Review Summary
|
|
222
|
+
|
|
223
|
+
**Reviewed:** {scope}
|
|
224
|
+
**Timestamp:** {timestamp in ISO 8601 format, e.g., 2026-01-28T10:30:45Z}
|
|
225
|
+
**User Decisions:** {summary of user choices}
|
|
226
|
+
|
|
227
|
+
## Summary
|
|
228
|
+
|
|
229
|
+
- **Total Issues:** {N}
|
|
230
|
+
- **Applied with User Approval:** {N}
|
|
231
|
+
- **User-Resolved Questions:** {N}
|
|
232
|
+
- **Manual Review Needed:** {N}
|
|
233
|
+
- **Skipped by User:** {N}
|
|
234
|
+
|
|
235
|
+
## Applied Fixes (User Approved)
|
|
236
|
+
|
|
237
|
+
- `ProductFactory.ts:45` - Added null check for parameter
|
|
238
|
+
- `OrderValidator.ts:23` - Removed unused import
|
|
239
|
+
|
|
240
|
+
## User-Resolved Questions
|
|
241
|
+
|
|
242
|
+
- `ProductFactory.ts:67` - Added empty string validation (user answered: yes)
|
|
243
|
+
|
|
244
|
+
## Manual Review Needed
|
|
245
|
+
|
|
246
|
+
- `ProductFactory.ts:120` - Consider extracting this method (complexity: 15)
|
|
247
|
+
|
|
248
|
+
## Skipped Issues
|
|
249
|
+
|
|
250
|
+
- `ProductFactory.ts:200` - User chose not to apply
|
|
251
|
+
|
|
252
|
+
## Files Modified
|
|
253
|
+
|
|
254
|
+
- ProductFactory.ts (2 fixes applied)
|
|
255
|
+
- OrderValidator.ts (1 fix applied)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Step 10: Save Findings to File (File-Based Mode)
|
|
259
|
+
|
|
260
|
+
When user selects "Save to file", create a structured findings file that allows user annotation.
|
|
261
|
+
|
|
262
|
+
**Determine feature name:**
|
|
263
|
+
- Check most recent state file in `.5/*/state.json` to find current feature
|
|
264
|
+
- Or ask user which feature they're reviewing
|
|
265
|
+
- Use feature name for organizing review files
|
|
266
|
+
|
|
267
|
+
**Create directory if needed:**
|
|
268
|
+
```bash
|
|
269
|
+
mkdir -p .5/{feature-name}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Generate timestamp:**
|
|
273
|
+
```
|
|
274
|
+
{timestamp} = Custom timestamp format: YYYYMMDD-HHmmss
|
|
275
|
+
Example: 20260128-103045
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**File path:**
|
|
279
|
+
```
|
|
280
|
+
.5/{feature-name}/review-{timestamp}-findings.md
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**File format:**
|
|
284
|
+
|
|
285
|
+
```markdown
|
|
286
|
+
# Code Review Findings
|
|
287
|
+
|
|
288
|
+
**Generated:** {timestamp in ISO 8601 format, e.g., 2026-01-28T10:30:45Z}
|
|
289
|
+
**Scope:** {what was reviewed}
|
|
290
|
+
**Total Findings:** {N}
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## How to Use This File
|
|
295
|
+
|
|
296
|
+
1. Review each finding below
|
|
297
|
+
2. For each finding, choose an action:
|
|
298
|
+
- `[FIX]` - Apply this fix automatically (leave as-is)
|
|
299
|
+
- `[SKIP]` - Don't apply this fix (change FIX to SKIP)
|
|
300
|
+
- `[MANUAL]` - Custom instructions (change FIX to MANUAL and add instructions)
|
|
301
|
+
3. Save this file
|
|
302
|
+
4. Run: `/review-code apply`
|
|
303
|
+
|
|
304
|
+
The apply command will read your annotations and apply marked fixes.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Finding 1/{total}
|
|
309
|
+
|
|
310
|
+
**File:** {file-path}
|
|
311
|
+
**Line:** {line-number}
|
|
312
|
+
**Category:** {Fixable|Question|Manual}
|
|
313
|
+
**Severity:** {error|warning|suggestion}
|
|
314
|
+
|
|
315
|
+
**Description:**
|
|
316
|
+
{what CodeRabbit found}
|
|
317
|
+
|
|
318
|
+
**Suggested Fix:**
|
|
319
|
+
{how to fix it - can be multi-line}
|
|
320
|
+
|
|
321
|
+
**Original CodeRabbit Message:**
|
|
322
|
+
```
|
|
323
|
+
{raw output from CodeRabbit}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Action:** [FIX]
|
|
327
|
+
|
|
328
|
+
**Custom Instructions:** (only if you selected [MANUAL])
|
|
329
|
+
<!-- Add detailed instructions here if you want a custom fix -->
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Finding 2/{total}
|
|
335
|
+
|
|
336
|
+
...
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Summary
|
|
341
|
+
|
|
342
|
+
- Total: {N}
|
|
343
|
+
- Fixable: {N}
|
|
344
|
+
- Questions: {N}
|
|
345
|
+
- Manual Review: {N}
|
|
346
|
+
|
|
347
|
+
**Next Steps:**
|
|
348
|
+
1. Edit this file to mark which findings to fix
|
|
349
|
+
2. Run: `/review-code apply`
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**After saving file:**
|
|
353
|
+
- Inform user: "Findings saved to .5/{feature-name}/review-{timestamp}-findings.md"
|
|
354
|
+
- Provide instructions: "Edit the file to mark findings, then run: /review-code apply"
|
|
355
|
+
- Skip remaining steps (don't apply fixes interactively)
|
|
356
|
+
|
|
357
|
+
### Step 11: Apply Annotated Findings
|
|
358
|
+
|
|
359
|
+
When user runs `/review-code apply`, read the most recent findings file and apply marked fixes.
|
|
360
|
+
|
|
361
|
+
**Determine feature name:**
|
|
362
|
+
- Check most recent state file in `.5/*/state.json` to find current feature
|
|
363
|
+
- Or ask user which feature they're reviewing
|
|
364
|
+
|
|
365
|
+
**Find the most recent findings file:**
|
|
366
|
+
```bash
|
|
367
|
+
# Find most recent review findings file in the feature folder
|
|
368
|
+
ls -t .5/{feature-name}/review-*-findings.md | head -1
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**If no findings file exists:**
|
|
372
|
+
- Inform user: "No findings file found. Run /review-code first to generate findings."
|
|
373
|
+
- Exit
|
|
374
|
+
|
|
375
|
+
**Read the findings file:**
|
|
376
|
+
- Parse each finding section
|
|
377
|
+
- Extract action marker: [FIX], [SKIP], or [MANUAL]
|
|
378
|
+
- For [MANUAL], also extract custom instructions
|
|
379
|
+
|
|
380
|
+
**Apply fixes:**
|
|
381
|
+
|
|
382
|
+
For each finding marked `[FIX]`:
|
|
383
|
+
1. Read the file specified in the finding
|
|
384
|
+
2. Apply the suggested fix using Edit tool
|
|
385
|
+
3. Track applied fix
|
|
386
|
+
|
|
387
|
+
For each finding marked `[MANUAL]` with custom instructions:
|
|
388
|
+
1. Read the file
|
|
389
|
+
2. Use the custom instructions to determine what to change
|
|
390
|
+
3. Apply the change using Edit tool
|
|
391
|
+
4. Track applied fix
|
|
392
|
+
|
|
393
|
+
For findings marked `[SKIP]`:
|
|
394
|
+
- Skip, don't apply
|
|
395
|
+
|
|
396
|
+
**After applying all marked fixes:**
|
|
397
|
+
- Continue to Step 9b (Verify Changes)
|
|
398
|
+
- Then Step 12 (Update Findings File)
|
|
399
|
+
|
|
400
|
+
### Step 12: Update Findings File After Apply
|
|
401
|
+
|
|
402
|
+
After applying fixes from an annotated file, update the findings file with results:
|
|
403
|
+
|
|
404
|
+
**Append to the end of the findings file:**
|
|
405
|
+
|
|
406
|
+
```markdown
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Application Results
|
|
411
|
+
|
|
412
|
+
**Applied:** {timestamp in ISO 8601 format, e.g., 2026-01-28T10:30:45Z}
|
|
413
|
+
**Fixes Applied:** {N}
|
|
414
|
+
**Custom Fixes:** {N}
|
|
415
|
+
**Skipped:** {N}
|
|
416
|
+
|
|
417
|
+
### Applied Fixes
|
|
418
|
+
|
|
419
|
+
- Finding #1 - {file}:{line} - {description} - ✓ Applied
|
|
420
|
+
- Finding #5 - {file}:{line} - {description} - ✓ Applied
|
|
421
|
+
|
|
422
|
+
### Custom Fixes
|
|
423
|
+
|
|
424
|
+
- Finding #3 - {file}:{line} - {description} - ✓ Applied with custom instructions
|
|
425
|
+
|
|
426
|
+
### Skipped
|
|
427
|
+
|
|
428
|
+
- Finding #2 - {file}:{line} - {description} - Skipped by user
|
|
429
|
+
- Finding #4 - {file}:{line} - {description} - Skipped by user
|
|
430
|
+
|
|
431
|
+
### Verification
|
|
432
|
+
|
|
433
|
+
**Compilation:** {success|failed}
|
|
434
|
+
**Tests:** {passed|failed|skipped}
|
|
435
|
+
|
|
436
|
+
{any error messages if failed}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**Inform user:**
|
|
440
|
+
- Show summary of applied fixes
|
|
441
|
+
- Reference the updated findings file
|
|
442
|
+
- Indicate if compilation/tests passed
|
|
443
|
+
|
|
444
|
+
### Step 13: Save Review Report (Interactive Mode)
|
|
445
|
+
|
|
446
|
+
For interactive mode only, save the review summary to:
|
|
447
|
+
```
|
|
448
|
+
.5/{feature-name}/review-{timestamp}.md
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
## Instructions Summary
|
|
452
|
+
|
|
453
|
+
### Interactive Mode (Default)
|
|
454
|
+
1. **Check prerequisites** - CodeRabbit installed and logged in
|
|
455
|
+
2. **Ask what to review** - Staged, unstaged, branch, or specific files
|
|
456
|
+
3. **Ask review mode** - Interactive or save to file
|
|
457
|
+
4. **Spawn review-processor** - Delegate CodeRabbit execution and parsing
|
|
458
|
+
5. **Process results** - Receive categorized findings
|
|
459
|
+
6. **Provide overview** - Show concise summary to user
|
|
460
|
+
7. **Ask user** - Which fixes to apply, how to handle questions
|
|
461
|
+
8. **Apply fixes** - Only user-approved fixes, using Edit tool
|
|
462
|
+
9. **Handle questions** - Ask user for each if requested
|
|
463
|
+
10. **Verify changes** - Compile and test after applying fixes
|
|
464
|
+
11. **Save report** - Store in `.5/{feature-name}/`
|
|
465
|
+
|
|
466
|
+
### File-Based Annotation Mode
|
|
467
|
+
1. **Check prerequisites** - CodeRabbit installed and logged in
|
|
468
|
+
2. **Ask what to review** - Staged, unstaged, branch, or specific files
|
|
469
|
+
3. **User selects "Save to file"**
|
|
470
|
+
4. **Spawn review-processor** - Delegate CodeRabbit execution and parsing
|
|
471
|
+
5. **Process results** - Receive categorized findings
|
|
472
|
+
6. **Save findings file** - Store structured findings in `.5/{feature-name}/review-{timestamp}-findings.md`
|
|
473
|
+
7. **User edits file** - Mark findings as [FIX], [SKIP], or [MANUAL] with instructions
|
|
474
|
+
8. **User runs `/review-code apply`** - Apply annotated fixes
|
|
475
|
+
9. **Parse annotations** - Read user's action markers and custom instructions
|
|
476
|
+
10. **Apply marked fixes** - Apply [FIX] and [MANUAL] fixes automatically
|
|
477
|
+
11. **Verify changes** - Compile and test after applying fixes
|
|
478
|
+
12. **Update findings file** - Append application results
|
|
479
|
+
|
|
480
|
+
## Key Principles
|
|
481
|
+
|
|
482
|
+
1. **Thin orchestrator** - Delegate CodeRabbit execution to agent, keep interaction in main context
|
|
483
|
+
2. **User consent first** - Always get user approval before applying any fixes
|
|
484
|
+
3. **Provide overview** - Give user a clear summary before asking for decisions
|
|
485
|
+
4. **Transparency** - Report all actions taken and user decisions made
|
|
486
|
+
5. **Verification** - Always compile and test after applying fixes
|
|
487
|
+
6. **Non-intrusive** - If not installed or logged in, gracefully exit
|
|
488
|
+
|
|
489
|
+
## DO NOT
|
|
490
|
+
|
|
491
|
+
- DO NOT run CodeRabbit directly (agent handles this)
|
|
492
|
+
- DO NOT parse CodeRabbit output directly (agent handles this)
|
|
493
|
+
- DO NOT apply fixes without user approval
|
|
494
|
+
- DO NOT auto-apply complex refactoring suggestions
|
|
495
|
+
- DO NOT skip the overview step
|
|
496
|
+
- DO NOT skip verification (compilation/tests)
|
|
497
|
+
- DO NOT proceed if CodeRabbit is not installed
|
|
498
|
+
- DO NOT assume user wants all fixes applied
|
|
499
|
+
|
|
500
|
+
## Error Handling
|
|
501
|
+
|
|
502
|
+
### CodeRabbit Not Installed
|
|
503
|
+
```
|
|
504
|
+
CodeRabbit CLI is not installed.
|
|
505
|
+
|
|
506
|
+
To install:
|
|
507
|
+
1. Visit: https://docs.coderabbit.ai/cli/installation
|
|
508
|
+
2. Follow installation instructions for your OS
|
|
509
|
+
3. Run: coderabbit auth login
|
|
510
|
+
4. Then re-run: /review-code
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### User Not Logged In
|
|
514
|
+
```
|
|
515
|
+
You're not logged in to CodeRabbit.
|
|
516
|
+
|
|
517
|
+
To log in:
|
|
518
|
+
1. Run: coderabbit auth login
|
|
519
|
+
2. Follow authentication prompts
|
|
520
|
+
3. Then re-run: /review-code
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Agent Failed
|
|
524
|
+
```
|
|
525
|
+
CodeRabbit review failed.
|
|
526
|
+
|
|
527
|
+
Error: {error from agent}
|
|
528
|
+
|
|
529
|
+
Troubleshooting:
|
|
530
|
+
1. Check if you have internet connection
|
|
531
|
+
2. Verify CodeRabbit CLI is up to date: coderabbit update
|
|
532
|
+
3. Check if git repository is valid
|
|
533
|
+
4. Try running manually: coderabbit review --plain
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Compilation Failed After Fixes
|
|
537
|
+
```
|
|
538
|
+
Compilation failed after applying fixes.
|
|
539
|
+
|
|
540
|
+
Reverting problematic fixes:
|
|
541
|
+
- ProductFactory.ts:45 (reverted)
|
|
542
|
+
|
|
543
|
+
Error:
|
|
544
|
+
{compilation error}
|
|
545
|
+
|
|
546
|
+
Action: Please review the suggested fix manually.
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
## Integration with Workflow
|
|
550
|
+
|
|
551
|
+
**When to use:**
|
|
552
|
+
- Before committing changes
|
|
553
|
+
- After completing a feature (before PR)
|
|
554
|
+
- When fixing bugs (to catch additional issues)
|
|
555
|
+
|
|
556
|
+
**Workflow integration:**
|
|
557
|
+
```
|
|
558
|
+
1. Make code changes
|
|
559
|
+
2. Stage changes: git add .
|
|
560
|
+
3. Run review: /review-code
|
|
561
|
+
4. Address manual issues if needed
|
|
562
|
+
5. Verify: /verify-implementation (if part of feature workflow)
|
|
563
|
+
6. Commit: git commit -m "message"
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
## Configuration
|
|
567
|
+
|
|
568
|
+
**Directory:** `.5/{feature-name}/` (organized by feature)
|
|
569
|
+
|
|
570
|
+
**File Types:**
|
|
571
|
+
- `review-{timestamp}-findings.md` - Annotatable findings (file-based mode)
|
|
572
|
+
- `review-{timestamp}.md` - Review summary reports (interactive mode)
|
|
573
|
+
|
|
574
|
+
**Timestamp Format:** Custom format `YYYYMMDD-HHmmss` (e.g., `20260128-103045`)
|
|
575
|
+
|
|
576
|
+
**Feature Detection:** Review files are organized by feature. The command will:
|
|
577
|
+
- Check most recent state file in `.5/*/state.json` to find current feature
|
|
578
|
+
- Or ask user which feature they're reviewing if unclear
|
|
579
|
+
|
|
580
|
+
## Related Documentation
|
|
581
|
+
|
|
582
|
+
- [Agent: review-processor](../agents/review-processor.md)
|
|
583
|
+
- [Workflow Guide](../docs/workflow-guide.md)
|