opencodekit 0.9.2 → 0.11.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/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +116 -47
- package/dist/template/.opencode/agent/build.md +16 -48
- package/dist/template/.opencode/agent/explore.md +13 -34
- package/dist/template/.opencode/agent/planner.md +41 -11
- package/dist/template/.opencode/agent/review.md +2 -23
- package/dist/template/.opencode/agent/rush.md +24 -65
- package/dist/template/.opencode/agent/scout.md +5 -21
- package/dist/template/.opencode/agent/vision.md +0 -14
- package/dist/template/.opencode/command/accessibility-check.md +293 -30
- package/dist/template/.opencode/command/analyze-mockup.md +406 -20
- package/dist/template/.opencode/command/analyze-project.md +439 -30
- package/dist/template/.opencode/command/brainstorm.md +288 -5
- package/dist/template/.opencode/command/commit.md +226 -17
- package/dist/template/.opencode/command/create.md +138 -35
- package/dist/template/.opencode/command/design-audit.md +477 -29
- package/dist/template/.opencode/command/design.md +609 -6
- package/dist/template/.opencode/command/edit-image.md +223 -20
- package/dist/template/.opencode/command/finish.md +162 -71
- package/dist/template/.opencode/command/fix-ci.md +296 -24
- package/dist/template/.opencode/command/fix-types.md +345 -13
- package/dist/template/.opencode/command/fix-ui.md +293 -13
- package/dist/template/.opencode/command/fix.md +256 -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 +202 -30
- package/dist/template/.opencode/command/implement.md +162 -50
- package/dist/template/.opencode/command/import-plan.md +247 -51
- package/dist/template/.opencode/command/init.md +154 -35
- package/dist/template/.opencode/command/integration-test.md +405 -24
- package/dist/template/.opencode/command/issue.md +171 -21
- package/dist/template/.opencode/command/new-feature.md +382 -54
- package/dist/template/.opencode/command/plan.md +144 -118
- package/dist/template/.opencode/command/pr.md +229 -28
- package/dist/template/.opencode/command/quick-build.md +234 -5
- package/dist/template/.opencode/command/research-and-implement.md +436 -12
- package/dist/template/.opencode/command/research-ui.md +444 -34
- package/dist/template/.opencode/command/research.md +173 -45
- package/dist/template/.opencode/command/restore-image.md +416 -22
- package/dist/template/.opencode/command/resume.md +439 -63
- package/dist/template/.opencode/command/revert-feature.md +341 -64
- package/dist/template/.opencode/command/review-codebase.md +193 -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 +320 -60
- package/dist/template/.opencode/command/summarize.md +374 -33
- package/dist/template/.opencode/command/triage.md +355 -0
- package/dist/template/.opencode/command/ui-review.md +292 -25
- package/dist/template/.opencode/plugin/README.md +110 -98
- package/dist/template/.opencode/plugin/compactor.ts +95 -171
- package/dist/template/.opencode/plugin/enforcer.ts +177 -127
- package/dist/template/.opencode/plugin/injector.ts +150 -0
- package/dist/template/.opencode/plugin/lib/notify.ts +86 -0
- package/dist/template/.opencode/plugin/notification.ts +57 -123
- package/dist/template/.opencode/plugin/truncator.ts +60 -166
- package/dist/template/.opencode/skill/mqdh/SKILL.md +161 -0
- package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
- package/dist/template/.opencode/skill/v0/SKILL.md +154 -0
- package/package.json +1 -1
|
@@ -1,22 +1,302 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Analyze and fix UI issues
|
|
3
|
-
argument-hint: "[
|
|
3
|
+
argument-hint: "<issue or bead-id> [--a11y]"
|
|
4
4
|
agent: build
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Fix UI: $ARGUMENTS
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Options
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- If screenshots/videos provided, @vision describes issue in detail
|
|
13
|
-
- For large UI analysis, @vision uses Gemini CLI: `gemini -m gemini-2.5-flash` then `@[image] Analyze issue`
|
|
14
|
-
2. **Research:** @vision checks design guidelines, component patterns
|
|
15
|
-
- Apply `frontend-aesthetics` criteria (typography, color, motion, backgrounds)
|
|
16
|
-
3. **Fix:** Implement step by step
|
|
17
|
-
- Avoid generic AI aesthetics (Inter font, purple gradients, flat backgrounds)
|
|
18
|
-
- Use distinctive typography, cohesive themes, meaningful motion
|
|
19
|
-
4. **Verify:** Screenshot/test the fix
|
|
20
|
-
5. **Review:** Run tests, ensure quality
|
|
11
|
+
- `--a11y`: Include full accessibility audit
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
## Phase 1: Load Context
|
|
14
|
+
|
|
15
|
+
**Check for bead context:**
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
bd_show({ id: "$ARGUMENTS" });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Load skill:**
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
skill({ name: "frontend-aesthetics" });
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Reserve UI files:**
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
bd_reserve({
|
|
31
|
+
paths: ["src/components/**", "src/styles/**"],
|
|
32
|
+
reason: "Fixing UI: $ARGUMENTS",
|
|
33
|
+
ttl: 600,
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Phase 2: Capture Before State
|
|
38
|
+
|
|
39
|
+
Take screenshot before making changes:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// Using Playwright skill
|
|
43
|
+
skill({ name: "playwright" });
|
|
44
|
+
skill_mcp({
|
|
45
|
+
skill_name: "playwright",
|
|
46
|
+
tool_name: "browser_screenshot",
|
|
47
|
+
arguments: '{"name": "before-fix"}',
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or use browser DevTools:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
skill({ name: "chrome-devtools" });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Save screenshot to `.beads/artifacts/<bead-id>/before.png`
|
|
58
|
+
|
|
59
|
+
## Phase 3: Analyze with Vision
|
|
60
|
+
|
|
61
|
+
Delegate to @vision for initial assessment:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
task({
|
|
65
|
+
subagent_type: "vision",
|
|
66
|
+
description: "Analyze UI issue",
|
|
67
|
+
prompt: `
|
|
68
|
+
TASK: Analyze UI issue: $ARGUMENTS
|
|
69
|
+
|
|
70
|
+
EXPECTED OUTCOME:
|
|
71
|
+
- Describe the visual problem in detail
|
|
72
|
+
- Identify affected components
|
|
73
|
+
- Suggest fix approach
|
|
74
|
+
- Check against frontend-aesthetics anti-patterns
|
|
75
|
+
|
|
76
|
+
MUST DO:
|
|
77
|
+
- Load the before screenshot
|
|
78
|
+
- Identify specific CSS/component issues
|
|
79
|
+
- Check for AI slop patterns (Inter font, purple gradients, flat backgrounds)
|
|
80
|
+
- Assess color contrast and typography
|
|
81
|
+
|
|
82
|
+
MUST NOT DO:
|
|
83
|
+
- Don't make changes, just analyze
|
|
84
|
+
- Don't suggest generic solutions
|
|
85
|
+
|
|
86
|
+
CONTEXT:
|
|
87
|
+
- Screenshot: .beads/artifacts/<bead-id>/before.png
|
|
88
|
+
- Issue: $ARGUMENTS
|
|
89
|
+
`,
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Phase 4: Estimate Complexity
|
|
94
|
+
|
|
95
|
+
| Signals | Estimate | Approach |
|
|
96
|
+
| ---------------------------------------- | -------- | --------------- |
|
|
97
|
+
| Single component, CSS tweak | S (~10) | Quick fix |
|
|
98
|
+
| Multiple components, layout issue | M (~30) | Systematic fix |
|
|
99
|
+
| Cross-cutting, design system change | L (~100) | Design review |
|
|
100
|
+
| Responsive + a11y + multiple breakpoints | XL | Decompose first |
|
|
101
|
+
|
|
102
|
+
## Phase 5: Design System Check
|
|
103
|
+
|
|
104
|
+
Before fixing, verify design tokens:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Check for design tokens/variables
|
|
108
|
+
grep -r "var(--" src/styles/ | head -20
|
|
109
|
+
grep -r "theme\." src/components/ | head -20
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Verify fix will use:**
|
|
113
|
+
|
|
114
|
+
- [ ] Existing color tokens (not hardcoded colors)
|
|
115
|
+
- [ ] Existing spacing scale (not arbitrary px values)
|
|
116
|
+
- [ ] Existing typography scale
|
|
117
|
+
- [ ] Existing breakpoints
|
|
118
|
+
|
|
119
|
+
## Phase 6: Implement Fix
|
|
120
|
+
|
|
121
|
+
**Anti-AI-slop checklist:**
|
|
122
|
+
|
|
123
|
+
| Avoid | Use Instead |
|
|
124
|
+
| ---------------------------- | ------------------------------ |
|
|
125
|
+
| Inter/system-ui everywhere | Distinctive, intentional fonts |
|
|
126
|
+
| Purple/blue gradients | Cohesive project color palette |
|
|
127
|
+
| Flat, shadowless backgrounds | Subtle depth and texture |
|
|
128
|
+
| Generic rounded corners | Consistent border-radius scale |
|
|
129
|
+
| No motion | Meaningful, subtle animations |
|
|
130
|
+
|
|
131
|
+
**Make changes:**
|
|
132
|
+
|
|
133
|
+
1. Identify affected files
|
|
134
|
+
2. Make minimal, focused CSS/component changes
|
|
135
|
+
3. Use existing design tokens
|
|
136
|
+
4. Test in browser during development
|
|
137
|
+
|
|
138
|
+
## Phase 7: Capture After State
|
|
139
|
+
|
|
140
|
+
Take screenshot after changes:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
skill_mcp({
|
|
144
|
+
skill_name: "playwright",
|
|
145
|
+
tool_name: "browser_screenshot",
|
|
146
|
+
arguments: '{"name": "after-fix"}',
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Save to `.beads/artifacts/<bead-id>/after.png`
|
|
151
|
+
|
|
152
|
+
## Phase 8: Verification
|
|
153
|
+
|
|
154
|
+
### Visual Verification
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
task({
|
|
158
|
+
subagent_type: "vision",
|
|
159
|
+
description: "Compare before/after",
|
|
160
|
+
prompt: `
|
|
161
|
+
Compare these screenshots:
|
|
162
|
+
- Before: .beads/artifacts/<bead-id>/before.png
|
|
163
|
+
- After: .beads/artifacts/<bead-id>/after.png
|
|
164
|
+
|
|
165
|
+
Verify:
|
|
166
|
+
1. Issue is fixed
|
|
167
|
+
2. No visual regressions
|
|
168
|
+
3. Follows frontend-aesthetics principles
|
|
169
|
+
4. No AI slop patterns introduced
|
|
170
|
+
`,
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Responsive Verification
|
|
175
|
+
|
|
176
|
+
Test at multiple breakpoints:
|
|
177
|
+
|
|
178
|
+
| Breakpoint | Width | Check |
|
|
179
|
+
| ---------- | ------ | -------------------- |
|
|
180
|
+
| Mobile | 375px | Layout doesn't break |
|
|
181
|
+
| Tablet | 768px | Spacing appropriate |
|
|
182
|
+
| Desktop | 1280px | Full layout correct |
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
skill_mcp({
|
|
186
|
+
skill_name: "playwright",
|
|
187
|
+
tool_name: "browser_resize",
|
|
188
|
+
arguments: '{"width": 375, "height": 812}',
|
|
189
|
+
});
|
|
190
|
+
// Screenshot and verify
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Accessibility Verification (--a11y or always for M+ fixes)
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
skill({ name: "accessibility-audit" });
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Check:
|
|
200
|
+
|
|
201
|
+
- [ ] Color contrast (4.5:1 for text, 3:1 for large text)
|
|
202
|
+
- [ ] Keyboard navigation works
|
|
203
|
+
- [ ] Focus states visible
|
|
204
|
+
- [ ] Screen reader text present for icons
|
|
205
|
+
- [ ] No motion for prefers-reduced-motion users
|
|
206
|
+
|
|
207
|
+
### Automated Tests
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm test -- --grep "component-name"
|
|
211
|
+
npm run test:visual # If visual regression tests exist
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
Verification:
|
|
216
|
+
━━━━━━━━━━━━━
|
|
217
|
+
|
|
218
|
+
Visual: Issue fixed ✓
|
|
219
|
+
Responsive:
|
|
220
|
+
- Mobile (375px): ✓
|
|
221
|
+
- Tablet (768px): ✓
|
|
222
|
+
- Desktop (1280px): ✓
|
|
223
|
+
Accessibility: [✓/⚠️ needs review]
|
|
224
|
+
Tests: [✓/✗]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Phase 9: Document & Observe
|
|
228
|
+
|
|
229
|
+
If this revealed a UI pattern worth remembering:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
observation({
|
|
233
|
+
type: "pattern",
|
|
234
|
+
title: "[UI pattern name]",
|
|
235
|
+
content: `
|
|
236
|
+
## Pattern
|
|
237
|
+
[What we learned about UI implementation]
|
|
238
|
+
|
|
239
|
+
## Example
|
|
240
|
+
\`\`\`css
|
|
241
|
+
[Code snippet]
|
|
242
|
+
\`\`\`
|
|
243
|
+
|
|
244
|
+
## When to Use
|
|
245
|
+
[When this pattern applies]
|
|
246
|
+
`,
|
|
247
|
+
concepts: "ui, css, [component-type]",
|
|
248
|
+
files: "[affected files]",
|
|
249
|
+
bead_id: "<bead-id>",
|
|
250
|
+
});
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Phase 10: Commit & Sync
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
git add <files>
|
|
257
|
+
git commit -m "fix(ui): <description>
|
|
258
|
+
|
|
259
|
+
- [what changed]
|
|
260
|
+
- [visual improvement]
|
|
261
|
+
[bead-id if applicable]"
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
bd_release({ _: true });
|
|
266
|
+
bd_sync({ reason: "Fixed UI: $ARGUMENTS" });
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Output
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
UI Fixed: $ARGUMENTS
|
|
273
|
+
━━━━━━━━━━━━━━━━━━━━
|
|
274
|
+
|
|
275
|
+
Estimate: [S/M/L]
|
|
276
|
+
Components: [list]
|
|
277
|
+
|
|
278
|
+
Before: .beads/artifacts/<bead-id>/before.png
|
|
279
|
+
After: .beads/artifacts/<bead-id>/after.png
|
|
280
|
+
|
|
281
|
+
Verification:
|
|
282
|
+
- Visual: ✓
|
|
283
|
+
- Responsive: ✓
|
|
284
|
+
- Accessibility: [✓/⚠️]
|
|
285
|
+
- Tests: ✓
|
|
286
|
+
|
|
287
|
+
Design system: Used existing tokens ✓
|
|
288
|
+
AI slop check: None detected ✓
|
|
289
|
+
|
|
290
|
+
Commit: [hash]
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Next steps:**
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
If part of larger task:
|
|
297
|
+
/implement <bead-id>
|
|
298
|
+
|
|
299
|
+
If standalone fix:
|
|
300
|
+
/finish <bead-id>
|
|
301
|
+
/pr <bead-id>
|
|
302
|
+
```
|
|
@@ -1,22 +1,269 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Debug and fix issues
|
|
3
|
-
argument-hint: "[
|
|
3
|
+
argument-hint: "<issue or bead-id> [--quick]"
|
|
4
4
|
agent: build
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Fix: $ARGUMENTS
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Options
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- `--quick`: Skip deep analysis, fix directly (for obvious bugs)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Phase 1: Load Context
|
|
14
|
+
|
|
15
|
+
**Check for bead context:**
|
|
16
|
+
|
|
17
|
+
If `$ARGUMENTS` looks like a bead ID (e.g., `bd-abc123`):
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
bd_show({ id: "$ARGUMENTS" });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Load constraints from `.beads/artifacts/<bead-id>/spec.md` if it exists.
|
|
24
|
+
|
|
25
|
+
**Check for messages about this issue:**
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
bd_inbox({ n: 5, unread: true, global: false });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Phase 2: Parse Error Information
|
|
32
|
+
|
|
33
|
+
Extract from the issue:
|
|
34
|
+
|
|
35
|
+
| Field | Extract |
|
|
36
|
+
| ----------------- | ------------------------------------ |
|
|
37
|
+
| **Error message** | Exact error text |
|
|
38
|
+
| **Stack trace** | Call stack with file:line references |
|
|
39
|
+
| **Reproduction** | Steps to trigger the bug |
|
|
40
|
+
| **Expected** | What should happen |
|
|
41
|
+
| **Actual** | What happens instead |
|
|
42
|
+
|
|
43
|
+
**For stack traces:**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Find the first application code (skip node_modules, stdlib)
|
|
47
|
+
grep -E "at .*(src/|lib/|app/)" <<< "[stack trace]"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Phase 3: Estimate Complexity
|
|
51
|
+
|
|
52
|
+
| Signals | Estimate | Approach |
|
|
53
|
+
| ------------------------------------------- | -------- | ------------------ |
|
|
54
|
+
| Error points to exact line, obvious fix | S (~10) | Quick fix |
|
|
55
|
+
| Error in known area, clear reproduction | M (~30) | Systematic debug |
|
|
56
|
+
| Intermittent, unclear cause, multiple files | L (~100) | Deep investigation |
|
|
57
|
+
| No reproduction, architectural issue | XL | Research first |
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Fix Estimate: [S/M/L/XL]
|
|
61
|
+
━━━━━━━━━━━━━━━━━━━━━━━
|
|
62
|
+
|
|
63
|
+
Complexity: [description]
|
|
64
|
+
Approach: [quick fix / systematic / deep investigation]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Phase 4: Reserve Files
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
bd_reservations({ reason: "Checking for conflicts before fix" });
|
|
71
|
+
bd_reserve({
|
|
72
|
+
paths: ["<files-to-investigate>"],
|
|
73
|
+
reason: "Fixing $ARGUMENTS",
|
|
74
|
+
ttl: 600,
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Phase 5: Investigation & Fix
|
|
79
|
+
|
|
80
|
+
### Quick Fix (S estimate or --quick)
|
|
81
|
+
|
|
82
|
+
1. Go directly to error location
|
|
83
|
+
2. Identify obvious cause
|
|
84
|
+
3. Make minimal fix
|
|
85
|
+
4. Run targeted test
|
|
86
|
+
5. Commit
|
|
87
|
+
|
|
88
|
+
### Systematic Debug (M/L estimate)
|
|
89
|
+
|
|
90
|
+
**Load skill:**
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
skill({ name: "systematic-debugging" });
|
|
94
|
+
```
|
|
14
95
|
|
|
15
96
|
Follow four phases:
|
|
16
97
|
|
|
17
|
-
1. Root
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
98
|
+
**1. Root Cause Investigation (NO fixes yet)**
|
|
99
|
+
|
|
100
|
+
- Read error location and surrounding code
|
|
101
|
+
- Trace data flow backward
|
|
102
|
+
- Check recent changes: `git log -p --since="1 week ago" -- <file>`
|
|
103
|
+
- Add logging/instrumentation if needed
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Root Cause Hypothesis:
|
|
107
|
+
━━━━━━━━━━━━━━━━━━━━━
|
|
108
|
+
|
|
109
|
+
Cause: [what's actually wrong]
|
|
110
|
+
Evidence: [how we know]
|
|
111
|
+
Confidence: [High/Medium/Low]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**2. Pattern Analysis**
|
|
115
|
+
|
|
116
|
+
- Is this a known pattern? Check gotchas.md
|
|
117
|
+
- Similar bugs in history? `git log --grep="fix" --oneline`
|
|
118
|
+
- Related code with same issue?
|
|
119
|
+
|
|
120
|
+
**3. Hypothesis Testing**
|
|
121
|
+
|
|
122
|
+
- Write a failing test that reproduces the bug
|
|
123
|
+
- Verify hypothesis by checking test fails for right reason
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm test -- --grep "<bug-related-test>"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**4. Implementation with TDD**
|
|
130
|
+
|
|
131
|
+
- Fix the code
|
|
132
|
+
- Verify test now passes
|
|
133
|
+
- Run full test suite for regression
|
|
134
|
+
|
|
135
|
+
### Rollback Strategy
|
|
136
|
+
|
|
137
|
+
Before making changes, note rollback point:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
git stash # or
|
|
141
|
+
git rev-parse HEAD # Save current commit
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
If fix makes things worse:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
git checkout -- <file> # Revert single file
|
|
148
|
+
git stash pop # Restore stashed changes
|
|
149
|
+
git reset --hard <hash> # Nuclear option
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Phase 6: Verification
|
|
153
|
+
|
|
154
|
+
**Targeted verification:**
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm test -- --grep "<related-test>"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Regression check:**
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npm test
|
|
164
|
+
npm run lint
|
|
165
|
+
npm run type-check
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
Verification:
|
|
170
|
+
━━━━━━━━━━━━━
|
|
171
|
+
|
|
172
|
+
Bug test: [✓ now passes]
|
|
173
|
+
Full tests: [✓/✗]
|
|
174
|
+
Lint: [✓/✗]
|
|
175
|
+
Types: [✓/✗]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**If verification fails:** Iterate or rollback.
|
|
179
|
+
|
|
180
|
+
## Phase 7: Document Root Cause
|
|
181
|
+
|
|
182
|
+
Create observation for future reference:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
observation({
|
|
186
|
+
type: "bugfix",
|
|
187
|
+
title: "[Brief description of bug]",
|
|
188
|
+
content: `
|
|
189
|
+
## Root Cause
|
|
190
|
+
[What was actually wrong]
|
|
191
|
+
|
|
192
|
+
## Fix
|
|
193
|
+
[What we changed and why]
|
|
194
|
+
|
|
195
|
+
## Prevention
|
|
196
|
+
[How to avoid this in future]
|
|
197
|
+
`,
|
|
198
|
+
concepts: "[relevant keywords]",
|
|
199
|
+
files: "[affected files]",
|
|
200
|
+
bead_id: "<bead-id>",
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Phase 8: Update Memory
|
|
205
|
+
|
|
206
|
+
If this was a gotcha worth remembering:
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
memory -
|
|
210
|
+
update({
|
|
211
|
+
file: "project/gotchas",
|
|
212
|
+
content: `
|
|
213
|
+
## [Bug Title]
|
|
214
|
+
|
|
215
|
+
**Symptom:** [What you see]
|
|
216
|
+
**Cause:** [What's actually wrong]
|
|
217
|
+
**Fix:** [How to resolve]
|
|
218
|
+
**Prevention:** [How to avoid]
|
|
219
|
+
`,
|
|
220
|
+
mode: "append",
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Phase 9: Commit & Sync
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
git add <files>
|
|
228
|
+
git commit -m "fix(<scope>): <description>
|
|
229
|
+
|
|
230
|
+
Root cause: [brief explanation]
|
|
231
|
+
[bead-id if applicable]"
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Release locks and sync:
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
bd_release({ _: true });
|
|
238
|
+
bd_sync({ reason: "Fixed $ARGUMENTS" });
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Output
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
Fixed: $ARGUMENTS
|
|
245
|
+
━━━━━━━━━━━━━━━━━
|
|
246
|
+
|
|
247
|
+
Estimate: [S/M/L] (actual: [N] tool calls)
|
|
248
|
+
Root cause: [brief description]
|
|
249
|
+
|
|
250
|
+
Changes:
|
|
251
|
+
- [file:line] - [what changed]
|
|
252
|
+
|
|
253
|
+
Verification: All tests pass ✓
|
|
254
|
+
Observation: Created ✓
|
|
255
|
+
Gotcha: [Added to memory / Not needed]
|
|
256
|
+
|
|
257
|
+
Commit: [hash]
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Next steps:**
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
If part of larger task:
|
|
264
|
+
/implement <bead-id> # Continue implementation
|
|
21
265
|
|
|
22
|
-
If
|
|
266
|
+
If standalone fix:
|
|
267
|
+
/finish <bead-id> # Close the bead
|
|
268
|
+
/pr <bead-id> # Create PR
|
|
269
|
+
```
|