opencodekit 0.10.0 → 0.11.1
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/dist/index.js +1 -1
- package/dist/template/.opencode/agent/planner.md +3 -2
- package/dist/template/.opencode/command/accessibility-check.md +297 -30
- package/dist/template/.opencode/command/analyze-mockup.md +412 -20
- package/dist/template/.opencode/command/analyze-project.md +445 -30
- package/dist/template/.opencode/command/brainstorm.md +294 -5
- package/dist/template/.opencode/command/commit.md +231 -17
- package/dist/template/.opencode/command/create.md +415 -77
- package/dist/template/.opencode/command/design-audit.md +483 -29
- package/dist/template/.opencode/command/design.md +615 -6
- package/dist/template/.opencode/command/edit-image.md +223 -20
- package/dist/template/.opencode/command/finish.md +163 -71
- package/dist/template/.opencode/command/fix-ci.md +297 -24
- package/dist/template/.opencode/command/fix-types.md +351 -13
- package/dist/template/.opencode/command/fix-ui.md +299 -13
- package/dist/template/.opencode/command/fix.md +262 -9
- package/dist/template/.opencode/command/generate-diagram.md +327 -26
- package/dist/template/.opencode/command/generate-icon.md +266 -22
- package/dist/template/.opencode/command/generate-image.md +232 -12
- package/dist/template/.opencode/command/generate-pattern.md +234 -20
- package/dist/template/.opencode/command/generate-storyboard.md +231 -21
- package/dist/template/.opencode/command/handoff.md +208 -31
- package/dist/template/.opencode/command/implement.md +163 -50
- package/dist/template/.opencode/command/import-plan.md +253 -52
- package/dist/template/.opencode/command/init.md +154 -35
- package/dist/template/.opencode/command/integration-test.md +410 -24
- package/dist/template/.opencode/command/issue.md +177 -21
- package/dist/template/.opencode/command/new-feature.md +390 -54
- package/dist/template/.opencode/command/plan.md +394 -107
- package/dist/template/.opencode/command/pr.md +235 -29
- package/dist/template/.opencode/command/quick-build.md +234 -5
- package/dist/template/.opencode/command/research-and-implement.md +442 -12
- package/dist/template/.opencode/command/research-ui.md +444 -34
- package/dist/template/.opencode/command/research.md +179 -45
- package/dist/template/.opencode/command/restore-image.md +416 -22
- package/dist/template/.opencode/command/resume.md +447 -63
- package/dist/template/.opencode/command/revert-feature.md +347 -65
- package/dist/template/.opencode/command/review-codebase.md +199 -4
- package/dist/template/.opencode/command/skill-create.md +506 -14
- package/dist/template/.opencode/command/skill-optimize.md +487 -16
- package/dist/template/.opencode/command/status.md +326 -60
- package/dist/template/.opencode/command/summarize.md +374 -33
- package/dist/template/.opencode/command/triage.md +361 -0
- package/dist/template/.opencode/command/ui-review.md +296 -25
- package/dist/template/.opencode/skill/beads/SKILL.md +108 -3
- package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
- package/package.json +1 -1
|
@@ -1,127 +1,409 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Smart git-aware revert for a bead/feature
|
|
3
|
-
argument-hint: "<bead-id> [--phase=N] [--task=N] [--soft]"
|
|
2
|
+
description: Smart git-aware revert for a bead/feature with safety checks
|
|
3
|
+
argument-hint: "<bead-id> [--phase=N] [--task=N] [--soft] [--dry-run] [--interactive]"
|
|
4
4
|
agent: build
|
|
5
5
|
model: proxypal/gemini-3-flash-preview
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Revert Feature: $ARGUMENTS
|
|
9
9
|
|
|
10
|
-
**Load
|
|
10
|
+
**Load skills:**
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
```typescript
|
|
13
|
+
skill({ name: "beads" }); // Session protocol
|
|
14
|
+
skill({ name: "verification-before-completion" });
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Intelligently revert changes for a bead with comprehensive safety checks.
|
|
18
|
+
|
|
19
|
+
## Parse Arguments
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
| Argument | Default | Description |
|
|
22
|
+
| ---------------------- | -------- | --------------------------------- |
|
|
23
|
+
| Bead ID | required | Feature to revert |
|
|
24
|
+
| `--phase=N` | all | Revert only specific phase |
|
|
25
|
+
| `--task=N` | all | Revert only specific task |
|
|
26
|
+
| `--soft` | false | Stage reverts without committing |
|
|
27
|
+
| `--dry-run` | false | Preview changes without executing |
|
|
28
|
+
| `--interactive` | false | Choose which commits to revert |
|
|
29
|
+
| `--include-migrations` | false | Also revert database migrations |
|
|
15
30
|
|
|
16
|
-
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Phase 1: Pre-Revert Checklist
|
|
17
34
|
|
|
18
|
-
|
|
19
|
-
- `--phase=N`: Revert only specific phase
|
|
20
|
-
- `--task=N`: Revert only specific task
|
|
21
|
-
- `--soft`: Stage reverts without committing
|
|
35
|
+
Before any action, verify:
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
```bash
|
|
38
|
+
# Check for uncommitted changes
|
|
39
|
+
git status --short
|
|
24
40
|
|
|
25
|
-
|
|
41
|
+
# Check CI status
|
|
42
|
+
gh run list --limit 1
|
|
43
|
+
|
|
44
|
+
# Check if on correct branch
|
|
45
|
+
git branch --show-current
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Safety Gates
|
|
49
|
+
|
|
50
|
+
| Check | Pass | Action if Fail |
|
|
51
|
+
| ------------------ | ---------------------- | -------------------------- |
|
|
52
|
+
| Clean working tree | No uncommitted changes | Stash or commit first |
|
|
53
|
+
| CI passing | Latest run succeeded | Warn, confirm continue |
|
|
54
|
+
| Not on main/master | On feature branch | Require `--force` for main |
|
|
55
|
+
| Bead exists | `bd_show` returns data | Abort with error |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Phase 2: Analyze Bead History
|
|
26
60
|
|
|
27
61
|
```typescript
|
|
28
62
|
bd_show({ id: "[bead-id]" });
|
|
29
63
|
```
|
|
30
64
|
|
|
31
|
-
|
|
65
|
+
```bash
|
|
66
|
+
# Find all commits for this bead
|
|
67
|
+
git log --oneline --all --grep="[bead-id]"
|
|
68
|
+
|
|
69
|
+
# Show affected files
|
|
70
|
+
git log --name-only --grep="[bead-id]" --pretty=format:""
|
|
71
|
+
|
|
72
|
+
# Count changes
|
|
73
|
+
git log --shortstat --grep="[bead-id]"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Impact Report
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Revert Analysis: [bead-id]
|
|
80
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
|
|
82
|
+
Bead: [title]
|
|
83
|
+
Status: [in_progress/closed]
|
|
84
|
+
Created: [date]
|
|
85
|
+
|
|
86
|
+
Commits found: 5
|
|
87
|
+
├── abc1234 feat: add login form (Phase 1)
|
|
88
|
+
├── def5678 feat: add validation (Phase 1)
|
|
89
|
+
├── ghi9012 feat: JWT tokens (Phase 2)
|
|
90
|
+
├── jkl3456 test: add auth tests (Phase 3)
|
|
91
|
+
└── mno7890 docs: update README (Phase 3)
|
|
92
|
+
|
|
93
|
+
Files affected: 12
|
|
94
|
+
├── src/auth/login.ts (created)
|
|
95
|
+
├── src/auth/jwt.ts (created)
|
|
96
|
+
├── src/api/routes.ts (modified)
|
|
97
|
+
├── tests/auth.test.ts (created)
|
|
98
|
+
└── ... 8 more files
|
|
99
|
+
|
|
100
|
+
Lines: +456 / -23
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Phase 3: Check Downstream Impact
|
|
106
|
+
|
|
107
|
+
Before reverting, check what depends on this:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// Check for dependent beads
|
|
111
|
+
bd_ls({ status: "all", limit: 50, offset: 0 });
|
|
112
|
+
// Filter for beads that depend on this one
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Check for imports of new files
|
|
117
|
+
grep -r "from './auth/" src/ --include="*.ts"
|
|
118
|
+
|
|
119
|
+
# Check for references in other features
|
|
120
|
+
git log --oneline --all -- src/auth/ | grep -v "[bead-id]"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Downstream Report
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
Downstream Impact Analysis
|
|
127
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
128
|
+
|
|
129
|
+
Dependent beads:
|
|
130
|
+
⚠ bd-xyz789: "User dashboard" imports from src/auth/
|
|
131
|
+
⚠ bd-uvw456: "Profile page" uses JWT utilities
|
|
132
|
+
|
|
133
|
+
Other code referencing these files:
|
|
134
|
+
- src/api/middleware.ts:15 imports { verifyToken }
|
|
135
|
+
- src/pages/profile.tsx:8 imports { useAuth }
|
|
136
|
+
|
|
137
|
+
Database migrations:
|
|
138
|
+
- 001_create_users.sql (would need revert)
|
|
139
|
+
- 002_add_sessions.sql (would need revert)
|
|
140
|
+
|
|
141
|
+
Feature flags:
|
|
142
|
+
- AUTH_ENABLED flag in production
|
|
143
|
+
|
|
144
|
+
CAUTION: Reverting may break dependent features.
|
|
145
|
+
Proceed? (yes/abort/revert-cascade)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
32
149
|
|
|
33
|
-
|
|
34
|
-
- Files changed per phase/task
|
|
35
|
-
- Current phase and task
|
|
150
|
+
## Phase 4: Determine Revert Scope
|
|
36
151
|
|
|
37
|
-
|
|
152
|
+
| Scope | Flag | What Gets Reverted |
|
|
153
|
+
| ----------- | --------------- | -------------------------------- |
|
|
154
|
+
| Full | (default) | All commits for bead |
|
|
155
|
+
| Phase | `--phase=N` | Only commits tagged with phase N |
|
|
156
|
+
| Task | `--task=N` | Only commits for specific task |
|
|
157
|
+
| Interactive | `--interactive` | User selects commits |
|
|
38
158
|
|
|
39
|
-
|
|
159
|
+
### Interactive Mode
|
|
40
160
|
|
|
41
|
-
|
|
42
|
-
|
|
161
|
+
```
|
|
162
|
+
Select commits to revert:
|
|
163
|
+
━━━━━━━━━━━━━━━━━━━━━━━━
|
|
43
164
|
|
|
44
|
-
|
|
165
|
+
[x] abc1234 feat: add login form
|
|
166
|
+
[x] def5678 feat: add validation
|
|
167
|
+
[ ] ghi9012 feat: JWT tokens (skip - needed by other features)
|
|
168
|
+
[x] jkl3456 test: add auth tests
|
|
169
|
+
[ ] mno7890 docs: update README (skip - harmless)
|
|
45
170
|
|
|
46
|
-
|
|
47
|
-
|
|
171
|
+
Selected: 3 commits
|
|
172
|
+
Press Enter to continue, or 'a' to abort
|
|
173
|
+
```
|
|
48
174
|
|
|
49
|
-
|
|
175
|
+
---
|
|
50
176
|
|
|
51
|
-
|
|
52
|
-
- Keep bead in current phase
|
|
177
|
+
## Phase 5: Create Backup
|
|
53
178
|
|
|
54
|
-
|
|
179
|
+
Before reverting, create safety backup:
|
|
55
180
|
|
|
56
181
|
```bash
|
|
57
|
-
#
|
|
58
|
-
git
|
|
182
|
+
# Create backup branch
|
|
183
|
+
git branch backup/[bead-id]-pre-revert
|
|
184
|
+
|
|
185
|
+
# Or stash current state
|
|
186
|
+
git stash push -m "pre-revert-[bead-id]"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Backup Created
|
|
191
|
+
━━━━━━━━━━━━━━
|
|
192
|
+
|
|
193
|
+
Branch: backup/[bead-id]-pre-revert
|
|
194
|
+
Commit: [current-sha]
|
|
195
|
+
|
|
196
|
+
To undo this revert later:
|
|
197
|
+
git checkout backup/[bead-id]-pre-revert
|
|
198
|
+
git cherry-pick [reverted-commits]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Phase 6: Handle Database Migrations
|
|
204
|
+
|
|
205
|
+
If `--include-migrations` or migrations detected:
|
|
59
206
|
|
|
60
|
-
|
|
61
|
-
|
|
207
|
+
```bash
|
|
208
|
+
# Check for migration files in commits
|
|
209
|
+
git log --name-only --grep="[bead-id]" -- "**/migrations/**"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Migration Revert Strategy
|
|
213
|
+
|
|
214
|
+
| Scenario | Action |
|
|
215
|
+
| ------------------------------ | ------------------------------ |
|
|
216
|
+
| Migrations not yet run in prod | Safe to delete migration files |
|
|
217
|
+
| Migrations run in prod | Need down migration |
|
|
218
|
+
| No down migration exists | Manual intervention required |
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Run down migrations (if applicable)
|
|
222
|
+
npm run migrate:down -- --to=[pre-feature-version]
|
|
223
|
+
# or
|
|
224
|
+
python manage.py migrate [app] [previous_migration]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**CAUTION:** Database reverts can cause data loss. Always backup first.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Phase 7: Handle Feature Flags
|
|
232
|
+
|
|
233
|
+
If feature is behind a flag:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Disable feature flag first
|
|
237
|
+
# This prevents errors while code is being reverted
|
|
238
|
+
|
|
239
|
+
# Example: Update feature flag config
|
|
240
|
+
echo "AUTH_ENABLED=false" >> .env
|
|
62
241
|
```
|
|
63
242
|
|
|
64
|
-
|
|
243
|
+
### Feature Flag Checklist
|
|
65
244
|
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
245
|
+
- [ ] Disable flag in development
|
|
246
|
+
- [ ] Disable flag in staging
|
|
247
|
+
- [ ] Disable flag in production
|
|
248
|
+
- [ ] THEN revert code
|
|
69
249
|
|
|
70
|
-
|
|
250
|
+
---
|
|
71
251
|
|
|
72
|
-
|
|
252
|
+
## Phase 8: Execute Revert
|
|
73
253
|
|
|
74
|
-
|
|
254
|
+
### Dry Run (--dry-run)
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# Show what WOULD be reverted
|
|
258
|
+
git revert --no-commit [commits...] --dry-run 2>&1 || \
|
|
259
|
+
git diff [oldest-commit]^..[newest-commit] --stat
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
DRY RUN - No changes made
|
|
264
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
265
|
+
|
|
266
|
+
Would revert:
|
|
267
|
+
├── abc1234 feat: add login form
|
|
268
|
+
├── def5678 feat: add validation
|
|
269
|
+
└── jkl3456 test: add auth tests
|
|
270
|
+
|
|
271
|
+
Files that would be modified:
|
|
272
|
+
├── src/auth/login.ts (deleted)
|
|
273
|
+
├── src/api/routes.ts (restored to previous)
|
|
274
|
+
└── tests/auth.test.ts (deleted)
|
|
275
|
+
|
|
276
|
+
Run without --dry-run to execute.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Soft Revert (--soft)
|
|
75
280
|
|
|
76
281
|
```bash
|
|
77
282
|
git revert --no-commit [commits...]
|
|
78
|
-
|
|
283
|
+
# Changes staged but not committed
|
|
79
284
|
```
|
|
80
285
|
|
|
81
|
-
|
|
286
|
+
### Hard Revert (default)
|
|
82
287
|
|
|
83
288
|
```bash
|
|
84
289
|
git revert --no-commit [commits...]
|
|
85
|
-
|
|
290
|
+
git commit -m "revert([bead-id]): [scope description]
|
|
291
|
+
|
|
292
|
+
Reverts commits: [list]
|
|
293
|
+
Reason: [user-provided or default]
|
|
294
|
+
|
|
295
|
+
Backup branch: backup/[bead-id]-pre-revert"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Phase 9: Handle Conflicts
|
|
301
|
+
|
|
302
|
+
If conflicts occur:
|
|
303
|
+
|
|
86
304
|
```
|
|
305
|
+
Conflicts Detected
|
|
306
|
+
━━━━━━━━━━━━━━━━━━
|
|
87
307
|
|
|
88
|
-
|
|
308
|
+
Conflicting files:
|
|
309
|
+
├── src/api/routes.ts
|
|
310
|
+
└── src/config/index.ts
|
|
89
311
|
|
|
90
|
-
|
|
312
|
+
Options:
|
|
313
|
+
1. Abort revert (git revert --abort)
|
|
314
|
+
2. Resolve manually and continue
|
|
315
|
+
3. Accept theirs (keep current)
|
|
316
|
+
4. Accept ours (use reverted)
|
|
91
317
|
|
|
92
|
-
|
|
318
|
+
Select option (1/2/3/4):
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Conflict Resolution Guidance
|
|
93
322
|
|
|
94
|
-
|
|
323
|
+
```bash
|
|
324
|
+
# To abort
|
|
325
|
+
git revert --abort
|
|
95
326
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
327
|
+
# To resolve manually
|
|
328
|
+
# Edit conflicting files, then:
|
|
329
|
+
git add [resolved-files]
|
|
330
|
+
git revert --continue
|
|
100
331
|
|
|
101
|
-
|
|
332
|
+
# To accept one side
|
|
333
|
+
git checkout --theirs [file] # Keep current
|
|
334
|
+
git checkout --ours [file] # Use reverted
|
|
335
|
+
```
|
|
102
336
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Phase 10: Update Bead Status
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
bd_msg({
|
|
343
|
+
subj: "Reverted: [bead-id]",
|
|
344
|
+
body: "Feature reverted at [timestamp]\nReason: [reason]\nBackup: backup/[bead-id]-pre-revert",
|
|
345
|
+
to: "all",
|
|
346
|
+
importance: "normal",
|
|
347
|
+
global: false,
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Optionally close or re-open bead
|
|
351
|
+
bd_update({ id: "[bead-id]", status: "open" });
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
106
355
|
|
|
107
356
|
## Output
|
|
108
357
|
|
|
109
|
-
|
|
358
|
+
```
|
|
359
|
+
Revert Complete: [bead-id]
|
|
360
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
110
361
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
- Next steps
|
|
362
|
+
Commits reverted: 3
|
|
363
|
+
Files restored: 8
|
|
364
|
+
Lines removed: +456 / -23 → net -433
|
|
115
365
|
|
|
116
|
-
|
|
366
|
+
Revert commit: [new-sha]
|
|
367
|
+
Backup branch: backup/[bead-id]-pre-revert
|
|
368
|
+
|
|
369
|
+
Bead status: Updated to 'open'
|
|
370
|
+
|
|
371
|
+
To undo this revert:
|
|
372
|
+
git revert [new-sha]
|
|
373
|
+
# or
|
|
374
|
+
git cherry-pick [original-commits]
|
|
375
|
+
|
|
376
|
+
Next steps:
|
|
377
|
+
├── Verify app works: npm test
|
|
378
|
+
├── Check dependent features
|
|
379
|
+
└── Re-implement if needed: /implement [bead-id]
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Undo the Revert
|
|
385
|
+
|
|
386
|
+
If the revert was wrong:
|
|
117
387
|
|
|
118
388
|
```bash
|
|
119
|
-
#
|
|
120
|
-
|
|
389
|
+
# Option 1: Revert the revert
|
|
390
|
+
git revert [revert-commit-sha]
|
|
121
391
|
|
|
122
|
-
#
|
|
123
|
-
|
|
392
|
+
# Option 2: Cherry-pick original commits
|
|
393
|
+
git cherry-pick [original-commits...]
|
|
124
394
|
|
|
125
|
-
#
|
|
126
|
-
/
|
|
395
|
+
# Option 3: Restore from backup branch
|
|
396
|
+
git checkout backup/[bead-id]-pre-revert -- .
|
|
397
|
+
git commit -m "restore: [bead-id] from backup"
|
|
127
398
|
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Related Commands
|
|
403
|
+
|
|
404
|
+
| Need | Command |
|
|
405
|
+
| -------------------- | ------------------------------ |
|
|
406
|
+
| View bead history | `bd_show({ id: "[bead-id]" })` |
|
|
407
|
+
| Re-implement feature | `/implement [bead-id]` |
|
|
408
|
+
| Check status | `/status [bead-id]` |
|
|
409
|
+
| Create new feature | `/new-feature` |
|
|
@@ -1,13 +1,208 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Review code for quality and compliance
|
|
3
|
-
argument-hint: "[path
|
|
2
|
+
description: Review code for quality, security, and compliance
|
|
3
|
+
argument-hint: "[path|bead-id|pr-number|'all'] [--quick|--thorough]"
|
|
4
4
|
agent: review
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Review: $ARGUMENTS
|
|
8
8
|
|
|
9
|
+
## Load Beads Skill
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
skill({ name: "beads" });
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Phase 1: Determine Scope
|
|
16
|
+
|
|
17
|
+
Parse `$ARGUMENTS` to determine what to review:
|
|
18
|
+
|
|
19
|
+
| Input | Scope | How to Get Code |
|
|
20
|
+
| ------------------------ | ---------------------- | ------------------------------------------- |
|
|
21
|
+
| File/directory path | That path only | `read` or `glob` + `read` |
|
|
22
|
+
| Bead ID (e.g., `bd-123`) | Implementation vs spec | `bd_show()` then `git diff` from spec |
|
|
23
|
+
| PR number (e.g., `#45`) | PR changes | `gh pr diff 45` |
|
|
24
|
+
| `all` or empty | Recent changes | `git diff main...HEAD` or `git diff HEAD~5` |
|
|
25
|
+
|
|
26
|
+
If bead exists, load spec from `.beads/artifacts/$ID/spec.md` and review against constraints.
|
|
27
|
+
|
|
28
|
+
## Phase 2: Automated Analysis
|
|
29
|
+
|
|
30
|
+
Run these checks first (batch for speed):
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
# Type/lint errors
|
|
34
|
+
lsp_diagnostics() for each changed file
|
|
35
|
+
npm run type-check || tsc --noEmit
|
|
36
|
+
npm run lint || true
|
|
37
|
+
|
|
38
|
+
# Anti-pattern detection with ast-grep
|
|
39
|
+
ast-grep pattern="console.log($$$)" # Debug statements
|
|
40
|
+
ast-grep pattern="any" # TypeScript any
|
|
41
|
+
ast-grep pattern="// TODO" OR grep "TODO|FIXME|HACK|XXX"
|
|
42
|
+
ast-grep pattern="password = \"$$$\"" # Hardcoded secrets
|
|
43
|
+
|
|
44
|
+
# Test status
|
|
45
|
+
npm test || pytest || cargo test
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Collect all automated findings before manual review.
|
|
49
|
+
|
|
50
|
+
## Phase 3: Manual Review Categories
|
|
51
|
+
|
|
9
52
|
skill({ name: "requesting-code-review" })
|
|
10
53
|
|
|
11
|
-
|
|
54
|
+
Review each category with specific focus:
|
|
55
|
+
|
|
56
|
+
### Security
|
|
57
|
+
|
|
58
|
+
- Authentication/authorization checks on all endpoints
|
|
59
|
+
- Input validation and sanitization
|
|
60
|
+
- No secrets in code (API keys, passwords, tokens)
|
|
61
|
+
- SQL/command injection prevention
|
|
62
|
+
- XSS prevention (output encoding)
|
|
63
|
+
|
|
64
|
+
### Performance
|
|
65
|
+
|
|
66
|
+
- N+1 query patterns
|
|
67
|
+
- Unbounded loops or recursion
|
|
68
|
+
- Missing pagination on large datasets
|
|
69
|
+
- Expensive operations in hot paths
|
|
70
|
+
- Missing caching where appropriate
|
|
71
|
+
|
|
72
|
+
### Maintainability
|
|
73
|
+
|
|
74
|
+
- Cyclomatic complexity (functions > 10 branches)
|
|
75
|
+
- DRY violations (duplicated logic)
|
|
76
|
+
- Dead code or unreachable branches
|
|
77
|
+
- Naming clarity (can you understand without comments?)
|
|
78
|
+
- Single Responsibility violations
|
|
79
|
+
|
|
80
|
+
### Error Handling
|
|
81
|
+
|
|
82
|
+
- All async operations have error handling
|
|
83
|
+
- Errors are logged with context
|
|
84
|
+
- User-facing errors are sanitized (no stack traces)
|
|
85
|
+
- Graceful degradation where appropriate
|
|
86
|
+
|
|
87
|
+
### Testing
|
|
88
|
+
|
|
89
|
+
- Test coverage on new/changed code
|
|
90
|
+
- Tests verify behavior, not implementation
|
|
91
|
+
- Edge cases covered (empty, null, boundary)
|
|
92
|
+
- No excessive mocking (tests actually test something)
|
|
93
|
+
|
|
94
|
+
### Type Safety (TypeScript/typed languages)
|
|
95
|
+
|
|
96
|
+
- No `any` types without justification
|
|
97
|
+
- Proper null/undefined handling
|
|
98
|
+
- Generic types used appropriately
|
|
99
|
+
- Return types explicit on public APIs
|
|
100
|
+
|
|
101
|
+
## Phase 4: Create Tracking Issues
|
|
102
|
+
|
|
103
|
+
For each Critical or Important finding:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
bd_add({
|
|
107
|
+
title: "[Review] <brief issue description>",
|
|
108
|
+
desc: "File: <path>:<line>\nIssue: <what's wrong>\nFix: <how to fix>",
|
|
109
|
+
type: "bug",
|
|
110
|
+
pri: 1, # Critical=0, Important=1, Minor=2
|
|
111
|
+
tags: ["review", "security|perf|maintainability"]
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Skip creating beads for Minor issues (just report them).
|
|
116
|
+
|
|
117
|
+
## Phase 5: Output Format
|
|
118
|
+
|
|
119
|
+
### Summary
|
|
120
|
+
|
|
121
|
+
| Metric | Value |
|
|
122
|
+
| ------------------ | ------- |
|
|
123
|
+
| Files reviewed | X |
|
|
124
|
+
| Lines changed | +X / -Y |
|
|
125
|
+
| Critical issues | X |
|
|
126
|
+
| Important issues | X |
|
|
127
|
+
| Minor issues | X |
|
|
128
|
+
| Automated findings | X |
|
|
129
|
+
|
|
130
|
+
### Automated Findings
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
[LSP] src/auth.ts:45 - Type 'string' is not assignable to type 'User'
|
|
134
|
+
[AST] src/utils.ts:12 - console.log detected
|
|
135
|
+
[GREP] src/config.ts:8 - TODO: implement rate limiting
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Manual Findings
|
|
139
|
+
|
|
140
|
+
#### Critical (Must Fix Before Merge)
|
|
141
|
+
|
|
142
|
+
| File:Line | Issue | Category | Fix |
|
|
143
|
+
| ---------------- | ------------------------------------ | -------- | ------------------------------ |
|
|
144
|
+
| `src/auth.ts:45` | Missing auth check on admin endpoint | Security | Add `requireAuth()` middleware |
|
|
145
|
+
|
|
146
|
+
#### Important (Should Fix)
|
|
147
|
+
|
|
148
|
+
| File:Line | Issue | Category | Fix |
|
|
149
|
+
| -------------- | ---------------------- | ----------- | ---------------------------- |
|
|
150
|
+
| `src/db.ts:89` | N+1 query in user list | Performance | Use `include` or batch query |
|
|
151
|
+
|
|
152
|
+
#### Minor (Nice to Have)
|
|
153
|
+
|
|
154
|
+
| File:Line | Issue | Category | Fix |
|
|
155
|
+
| ----------------- | ------------------------ | --------------- | --------------------------- |
|
|
156
|
+
| `src/utils.ts:12` | Console.log left in code | Maintainability | Remove or use proper logger |
|
|
157
|
+
|
|
158
|
+
### Strengths
|
|
159
|
+
|
|
160
|
+
- [What's done well - be specific with file:line]
|
|
161
|
+
|
|
162
|
+
### Recommendations
|
|
163
|
+
|
|
164
|
+
- [Improvements beyond immediate fixes]
|
|
165
|
+
|
|
166
|
+
### Verdict
|
|
167
|
+
|
|
168
|
+
**Ready to merge:** Yes | No | With Fixes
|
|
169
|
+
|
|
170
|
+
**Reasoning:** [1-2 sentences explaining the decision]
|
|
171
|
+
|
|
172
|
+
**Beads created:** [List bead IDs for Critical/Important findings, or "None"]
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Depth Levels
|
|
177
|
+
|
|
178
|
+
**--quick** (~5-10 min): Automated checks + skim changed files, focus on Critical only
|
|
179
|
+
**--thorough** (default, ~15-30 min): Full automated + manual review of all categories
|
|
180
|
+
**--security**: Focus only on security category with deeper analysis
|
|
181
|
+
|
|
182
|
+
## Examples
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Review a specific file
|
|
186
|
+
/review-codebase src/auth/login.ts
|
|
187
|
+
|
|
188
|
+
# Review against a bead spec
|
|
189
|
+
/review-codebase bd-feature-auth
|
|
190
|
+
|
|
191
|
+
# Review a PR
|
|
192
|
+
/review-codebase #45
|
|
193
|
+
|
|
194
|
+
# Quick review of recent changes
|
|
195
|
+
/review-codebase all --quick
|
|
196
|
+
|
|
197
|
+
# Security-focused review
|
|
198
|
+
/review-codebase src/api/ --security
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Anti-Patterns (Don't Do This)
|
|
12
202
|
|
|
13
|
-
|
|
203
|
+
- "LGTM" without actually reviewing
|
|
204
|
+
- Marking style issues as Critical
|
|
205
|
+
- Reviewing code you didn't read
|
|
206
|
+
- Vague feedback ("improve error handling" - WHERE? HOW?)
|
|
207
|
+
- Skipping automated checks "to save time"
|
|
208
|
+
- Not creating beads for real issues (they get forgotten)
|