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.
Files changed (62) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +116 -47
  3. package/dist/template/.opencode/agent/build.md +16 -48
  4. package/dist/template/.opencode/agent/explore.md +13 -34
  5. package/dist/template/.opencode/agent/planner.md +41 -11
  6. package/dist/template/.opencode/agent/review.md +2 -23
  7. package/dist/template/.opencode/agent/rush.md +24 -65
  8. package/dist/template/.opencode/agent/scout.md +5 -21
  9. package/dist/template/.opencode/agent/vision.md +0 -14
  10. package/dist/template/.opencode/command/accessibility-check.md +293 -30
  11. package/dist/template/.opencode/command/analyze-mockup.md +406 -20
  12. package/dist/template/.opencode/command/analyze-project.md +439 -30
  13. package/dist/template/.opencode/command/brainstorm.md +288 -5
  14. package/dist/template/.opencode/command/commit.md +226 -17
  15. package/dist/template/.opencode/command/create.md +138 -35
  16. package/dist/template/.opencode/command/design-audit.md +477 -29
  17. package/dist/template/.opencode/command/design.md +609 -6
  18. package/dist/template/.opencode/command/edit-image.md +223 -20
  19. package/dist/template/.opencode/command/finish.md +162 -71
  20. package/dist/template/.opencode/command/fix-ci.md +296 -24
  21. package/dist/template/.opencode/command/fix-types.md +345 -13
  22. package/dist/template/.opencode/command/fix-ui.md +293 -13
  23. package/dist/template/.opencode/command/fix.md +256 -9
  24. package/dist/template/.opencode/command/generate-diagram.md +327 -26
  25. package/dist/template/.opencode/command/generate-icon.md +266 -22
  26. package/dist/template/.opencode/command/generate-image.md +232 -12
  27. package/dist/template/.opencode/command/generate-pattern.md +234 -20
  28. package/dist/template/.opencode/command/generate-storyboard.md +231 -21
  29. package/dist/template/.opencode/command/handoff.md +202 -30
  30. package/dist/template/.opencode/command/implement.md +162 -50
  31. package/dist/template/.opencode/command/import-plan.md +247 -51
  32. package/dist/template/.opencode/command/init.md +154 -35
  33. package/dist/template/.opencode/command/integration-test.md +405 -24
  34. package/dist/template/.opencode/command/issue.md +171 -21
  35. package/dist/template/.opencode/command/new-feature.md +382 -54
  36. package/dist/template/.opencode/command/plan.md +144 -118
  37. package/dist/template/.opencode/command/pr.md +229 -28
  38. package/dist/template/.opencode/command/quick-build.md +234 -5
  39. package/dist/template/.opencode/command/research-and-implement.md +436 -12
  40. package/dist/template/.opencode/command/research-ui.md +444 -34
  41. package/dist/template/.opencode/command/research.md +173 -45
  42. package/dist/template/.opencode/command/restore-image.md +416 -22
  43. package/dist/template/.opencode/command/resume.md +439 -63
  44. package/dist/template/.opencode/command/revert-feature.md +341 -64
  45. package/dist/template/.opencode/command/review-codebase.md +193 -4
  46. package/dist/template/.opencode/command/skill-create.md +506 -14
  47. package/dist/template/.opencode/command/skill-optimize.md +487 -16
  48. package/dist/template/.opencode/command/status.md +320 -60
  49. package/dist/template/.opencode/command/summarize.md +374 -33
  50. package/dist/template/.opencode/command/triage.md +355 -0
  51. package/dist/template/.opencode/command/ui-review.md +292 -25
  52. package/dist/template/.opencode/plugin/README.md +110 -98
  53. package/dist/template/.opencode/plugin/compactor.ts +95 -171
  54. package/dist/template/.opencode/plugin/enforcer.ts +177 -127
  55. package/dist/template/.opencode/plugin/injector.ts +150 -0
  56. package/dist/template/.opencode/plugin/lib/notify.ts +86 -0
  57. package/dist/template/.opencode/plugin/notification.ts +57 -123
  58. package/dist/template/.opencode/plugin/truncator.ts +60 -166
  59. package/dist/template/.opencode/skill/mqdh/SKILL.md +161 -0
  60. package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
  61. package/dist/template/.opencode/skill/v0/SKILL.md +154 -0
  62. package/package.json +1 -1
@@ -1,52 +1,324 @@
1
1
  ---
2
- description: Analyze Github Actions logs and fix issues with bead tracking
3
- argument-hint: "[github-actions-url]"
2
+ description: Analyze GitHub Actions logs and fix issues with bead tracking
3
+ argument-hint: "<github-actions-url or run-id>"
4
+ agent: build
4
5
  ---
5
6
 
6
- **Load skill:** `skill({ name: "systematic-debugging" })`
7
+ # Fix CI: $ARGUMENTS
7
8
 
8
- For deep tracing: `skill({ name: "root-cause-tracing" })`
9
+ ## Phase 1: Load Skills & Create Bead
9
10
 
10
- ## Github Actions URL
11
+ **Load skills:**
11
12
 
12
- <url>$ARGUMENTS</url>
13
-
14
- ## Create Bug Bead
13
+ ```typescript
14
+ skill({ name: "systematic-debugging" });
15
+ skill({ name: "root-cause-tracing" });
16
+ ```
15
17
 
16
- CI failures are P0 bugs. Create a bead to track:
18
+ **CI failures are P0 bugs.** Create bead immediately:
17
19
 
18
20
  ```typescript
19
21
  bd_add({
20
- title: "Fix CI: <failure summary>",
21
- type: "task",
22
+ title: "Fix CI: [failure summary]",
23
+ type: "bug",
22
24
  pri: 0,
23
- tags: ["bug"],
25
+ tags: ["ci", "bug"],
26
+ });
27
+ ```
28
+
29
+ **Reserve workflow files:**
30
+
31
+ ```typescript
32
+ bd_reserve({
33
+ paths: [".github/workflows/**", "package.json", "tsconfig.json"],
34
+ reason: "Fixing CI: $ARGUMENTS",
35
+ ttl: 600,
36
+ });
37
+ ```
38
+
39
+ ## Phase 2: Fetch CI Logs
40
+
41
+ **From URL:**
42
+
43
+ ```bash
44
+ # Extract run ID from URL
45
+ # https://github.com/owner/repo/actions/runs/12345678
46
+ gh run view 12345678 --log-failed
47
+ ```
48
+
49
+ **From run ID:**
50
+
51
+ ```bash
52
+ gh run view $ARGUMENTS --log-failed
53
+ ```
54
+
55
+ **List recent failed runs:**
56
+
57
+ ```bash
58
+ gh run list --status=failure --limit=5
59
+ ```
60
+
61
+ **Get full logs:**
62
+
63
+ ```bash
64
+ gh run view $ARGUMENTS --log > /tmp/ci-log.txt
65
+ ```
66
+
67
+ ## Phase 3: Extract Errors
68
+
69
+ Parse the CI log for errors:
70
+
71
+ ```bash
72
+ # Find error lines
73
+ grep -i "error\|failed\|exception" /tmp/ci-log.txt | head -30
74
+
75
+ # Find the failing step
76
+ gh run view $ARGUMENTS --json jobs --jq '.jobs[] | select(.conclusion=="failure") | {name, steps: [.steps[] | select(.conclusion=="failure")]}'
77
+ ```
78
+
79
+ **Extract key information:**
80
+
81
+ | Field | Extract |
82
+ | ----------------- | ------------------------------ |
83
+ | **Failing job** | Which job failed |
84
+ | **Failing step** | Which step in the job |
85
+ | **Error message** | Exact error text |
86
+ | **Exit code** | Process exit code if available |
87
+ | **Context** | Lines before/after error |
88
+
89
+ ```
90
+ CI Failure Analysis:
91
+ ━━━━━━━━━━━━━━━━━━━━
92
+
93
+ Job: [job name]
94
+ Step: [step name]
95
+ Error: [error message]
96
+
97
+ Context:
98
+ [relevant log lines]
99
+ ```
100
+
101
+ ## Phase 4: Identify Failure Pattern
102
+
103
+ Common CI failure patterns:
104
+
105
+ | Pattern | Symptoms | Typical Fix |
106
+ | ------------------------ | ---------------------------------- | ----------------------------------- |
107
+ | **Dependency issue** | "module not found", npm/yarn error | Update lockfile, check versions |
108
+ | **Environment mismatch** | Works locally, fails in CI | Check Node/Python version, env vars |
109
+ | **Test flakiness** | Intermittent failures | Add retries, fix race conditions |
110
+ | **Build timeout** | Job cancelled after N minutes | Optimize build, increase timeout |
111
+ | **Type error** | TypeScript compilation failed | Fix type errors locally first |
112
+ | **Lint error** | ESLint/Prettier failures | Run lint locally, fix issues |
113
+ | **Secret missing** | "secret not found" | Check repository secrets config |
114
+ | **Permission denied** | GITHUB_TOKEN issues | Check workflow permissions |
115
+ | **Cache issue** | Stale cache causing failures | Clear cache, update cache key |
116
+ | **Docker issue** | Image pull/build failures | Check Dockerfile, registry auth |
117
+
118
+ ## Phase 5: Estimate Complexity
119
+
120
+ | Signals | Estimate | Approach |
121
+ | ----------------------------------- | -------- | ------------------ |
122
+ | Single config change, obvious fix | S (~10) | Quick fix |
123
+ | Dependency update, env var fix | M (~30) | Systematic |
124
+ | Flaky tests, race conditions | L (~100) | Deep investigation |
125
+ | Workflow restructure, cross-cutting | XL | Plan first |
126
+
127
+ ## Phase 6: Reproduce Locally (if possible)
128
+
129
+ Try to reproduce the failure locally:
130
+
131
+ ```bash
132
+ # Run the same commands as CI
133
+ npm ci
134
+ npm run build
135
+ npm test
136
+ npm run lint
137
+ ```
138
+
139
+ If it passes locally but fails in CI:
140
+
141
+ ```bash
142
+ # Check for environment differences
143
+ node --version # Compare to CI
144
+ npm --version # Compare to CI
145
+ cat .nvmrc # If exists
146
+ ```
147
+
148
+ ## Phase 7: Fix
149
+
150
+ **For complex fixes (≥3 phases):**
151
+
152
+ ```typescript
153
+ task({
154
+ subagent_type: "planner",
155
+ description: "Plan CI fix",
156
+ prompt: "Create implementation plan for fixing CI: [failure description]",
157
+ });
158
+ ```
159
+
160
+ Save plan to `.beads/artifacts/<bead-id>/spec.md`
161
+
162
+ **Common fixes:**
163
+
164
+ ```bash
165
+ # Dependency issues
166
+ rm -rf node_modules package-lock.json
167
+ npm install
168
+
169
+ # Type errors
170
+ npm run type-check # Fix locally first
171
+
172
+ # Lint errors
173
+ npm run lint -- --fix
174
+
175
+ # Cache issues (add to workflow)
176
+ # - uses: actions/cache@v3
177
+ # with:
178
+ # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
179
+ ```
180
+
181
+ ## Phase 8: Verify Locally
182
+
183
+ Before pushing:
184
+
185
+ ```bash
186
+ npm run build
187
+ npm test
188
+ npm run lint
189
+ npm run type-check
190
+ ```
191
+
192
+ All must pass locally.
193
+
194
+ ## Phase 9: Push & Re-trigger CI
195
+
196
+ ```bash
197
+ git add <files>
198
+ git commit -m "fix(ci): <description>
199
+
200
+ Root cause: [what was wrong]
201
+ <bead-id>"
202
+
203
+ git push
204
+ ```
205
+
206
+ **Re-trigger CI:**
207
+
208
+ ```bash
209
+ gh workflow run <workflow-name>
210
+ # or
211
+ gh run rerun $ARGUMENTS --failed
212
+ ```
213
+
214
+ **Watch CI status:**
215
+
216
+ ```bash
217
+ gh run watch
218
+ ```
219
+
220
+ ```
221
+ CI Verification:
222
+ ━━━━━━━━━━━━━━━━
223
+
224
+ Run ID: [new run id]
225
+ Status: [pending/success/failure]
226
+ URL: [run url]
227
+ ```
228
+
229
+ ## Phase 10: Handle Results
230
+
231
+ **If CI passes:**
232
+
233
+ ```typescript
234
+ observation({
235
+ type: "bugfix",
236
+ title: "CI fix: [summary]",
237
+ content: `
238
+ ## Root Cause
239
+ [What was actually wrong]
240
+
241
+ ## Fix
242
+ [What we changed]
243
+
244
+ ## Prevention
245
+ [How to avoid in future]
246
+ `,
247
+ concepts: "ci, github-actions, [specific issue]",
248
+ bead_id: "<bead-id>",
24
249
  });
250
+
251
+ bd_done({ id: "<bead-id>", msg: "CI fixed: [summary]" });
25
252
  ```
26
253
 
27
- Save the bead ID for tracking. Add the CI run reference via `bd_msg` or notes.
254
+ **If CI still fails:**
28
255
 
29
- ## Workflow
256
+ Iterate:
30
257
 
31
- 1. **Analyze:** Use `build` agent to read the GitHub Actions logs, analyze and find the root causes of the issues.
258
+ 1. Fetch new logs
259
+ 2. Identify new/remaining error
260
+ 3. Fix and push again
261
+ 4. Maximum 3 iterations before escalating
32
262
 
33
- 2. **Plan:** For complex CI/CD problems (≥3 phases), delegate to `planner` agent to create a detailed implementation plan. Save plan to `.beads/artifacts/<bead-id>/spec.md`.
263
+ **If fix makes things worse:**
34
264
 
35
- 3. **Fix:** Use `build` agent to implement the fixes step by step.
265
+ ```bash
266
+ git revert HEAD
267
+ git push
268
+ ```
36
269
 
37
- 4. **Verify:** Use `review` agent to run tests, ensure quality and security, then report back.
270
+ Then reassess approach.
38
271
 
39
- 5. **Iterate:** If there are issues or failed tests, `build` agent will fix them and repeat the process until all tests pass.
272
+ ## Phase 11: Update Memory
40
273
 
41
- ## Close Bead
274
+ If this was a recurring CI issue:
42
275
 
43
- Once CI passes:
276
+ ```typescript
277
+ memory -
278
+ update({
279
+ file: "project/gotchas",
280
+ content: `
281
+ ## CI: [Issue Title]
282
+
283
+ **Symptom:** [What you see in CI logs]
284
+ **Cause:** [Root cause]
285
+ **Fix:** [How to resolve]
286
+ **Prevention:** [Config to prevent recurrence]
287
+ `,
288
+ mode: "append",
289
+ });
290
+ ```
291
+
292
+ ## Phase 12: Sync & Report
44
293
 
45
294
  ```typescript
46
- bd_done({ id: "<bead-id>", msg: "CI fixed: <summary of fix>" });
295
+ bd_release({ _: true });
296
+ bd_sync({ reason: "Fixed CI: $ARGUMENTS" });
297
+ ```
298
+
299
+ ```
300
+ CI Fixed: $ARGUMENTS
301
+ ━━━━━━━━━━━━━━━━━━━━
302
+
303
+ Estimate: [S/M/L]
304
+ Root cause: [brief description]
305
+ Pattern: [which common pattern]
306
+
307
+ Changes:
308
+ - [file] - [change]
309
+
310
+ CI Run: [new run URL]
311
+ Status: Passed ✓
312
+
313
+ Observation: Created ✓
314
+ Gotcha: [Added/Not needed]
315
+
316
+ Commit: [hash]
47
317
  ```
48
318
 
49
319
  ## Notes
50
320
 
51
- - If `gh` command is not available, instruct the user to install and authorize GitHub CLI first.
52
- - If the fix reveals systemic issues, create related beads for follow-up work.
321
+ - If `gh` CLI is not available: `brew install gh && gh auth login`
322
+ - If fix reveals systemic issues, create follow-up beads
323
+ - For flaky tests, consider adding retry logic or fixing race conditions
324
+ - Check if same failure happened before: `gh run list --status=failure --limit=20`
@@ -1,30 +1,362 @@
1
1
  ---
2
2
  description: Fix type errors with optional bead tracking
3
- argument-hint: "[bead-id]"
3
+ argument-hint: "[bead-id] [--strict]"
4
+ agent: build
4
5
  ---
5
6
 
6
7
  # Fix Type Errors
7
8
 
8
- **Load skill:** `skill({ name: "systematic-debugging" })`
9
+ ## Options
9
10
 
10
- Run `bun run typecheck` and fix all type errors.
11
+ - `--strict`: Also fix warnings and enable stricter checks
11
12
 
12
- ## Rules
13
+ ## Phase 1: Load Context
13
14
 
14
- - Fix all type errors and repeat the process until there are no more type errors.
15
- - Do not use `any` just to pass the type check.
16
- - Prefer proper typing over type assertions where possible.
15
+ **Load skill:**
17
16
 
18
- ## Bead Integration (Optional)
17
+ ```typescript
18
+ skill({ name: "systematic-debugging" });
19
+ ```
20
+
21
+ **Check for bead context:**
22
+
23
+ ```typescript
24
+ bd_show({ id: "$ARGUMENTS" });
25
+ ```
26
+
27
+ **Reserve files:**
28
+
29
+ ```typescript
30
+ bd_reserve({
31
+ paths: ["src/**/*.ts", "src/**/*.tsx"],
32
+ reason: "Fixing type errors",
33
+ ttl: 600,
34
+ });
35
+ ```
36
+
37
+ ## Phase 2: Detect Project & Run Type Check
38
+
39
+ **Detect type check command:**
40
+
41
+ ```bash
42
+ # Check package.json for type-check script
43
+ grep -q "type-check\|typecheck" package.json && echo "npm run type-check"
44
+
45
+ # Or use tsc directly
46
+ npx tsc --noEmit
47
+ ```
48
+
49
+ | Project Type | Type Check Command |
50
+ | ------------ | ------------------------------------------ |
51
+ | npm | `npm run type-check` or `npx tsc --noEmit` |
52
+ | bun | `bun run typecheck` |
53
+ | yarn | `yarn type-check` |
54
+ | pnpm | `pnpm type-check` |
55
+
56
+ **Capture initial error count:**
57
+
58
+ ```bash
59
+ npx tsc --noEmit 2>&1 | grep -c "error TS"
60
+ ```
61
+
62
+ ```
63
+ Type Check Status:
64
+ ━━━━━━━━━━━━━━━━━━
65
+
66
+ Initial errors: [N]
67
+ Files affected: [N]
68
+ ```
69
+
70
+ ## Phase 3: Use LSP for Semantic Analysis
71
+
72
+ Get errors with full context:
73
+
74
+ ```typescript
75
+ lsp_diagnostics({ filePath: "<file>", severity: "error" });
76
+ ```
77
+
78
+ For each file with errors:
79
+
80
+ ```typescript
81
+ lsp_hover({ filePath: "<file>", line: N, character: N }); // Understand types
82
+ lsp_goto_definition({ filePath: "<file>", line: N, character: N }); // Find source
83
+ ```
84
+
85
+ ## Phase 4: Categorize Errors
19
86
 
20
- If a bead ID is provided (`$ARGUMENTS`), track the type fixing work:
87
+ Group errors by pattern:
21
88
 
22
- 1. **Before fixing:** Note the initial error count via `bd_msg` or notes
89
+ | Category | Error Pattern | Typical Fix |
90
+ | ---------------------- | ----------------------------------- | -------------------------------- |
91
+ | **Missing type** | `implicitly has 'any' type` | Add explicit type annotation |
92
+ | **Incorrect type** | `Type 'X' is not assignable to 'Y'` | Fix type or add conversion |
93
+ | **Null/undefined** | `possibly 'null' or 'undefined'` | Add null check or optional chain |
94
+ | **Property missing** | `Property 'x' does not exist` | Add to interface or fix typo |
95
+ | **Generic constraint** | `does not satisfy constraint` | Fix generic or add constraint |
96
+ | **Import error** | `Cannot find module` | Fix import path or install dep |
97
+ | **Overload mismatch** | `No overload matches this call` | Check function signature |
98
+ | **Readonly violation** | `Cannot assign to 'x' (read-only)` | Remove mutation or cast |
23
99
 
24
- 2. **After fixing:** Update with resolution summary
100
+ ```
101
+ Error Categories:
102
+ ━━━━━━━━━━━━━━━━
103
+
104
+ - Missing types: [N]
105
+ - Incorrect types: [N]
106
+ - Null handling: [N]
107
+ - Property errors: [N]
108
+ - Other: [N]
109
+ ```
110
+
111
+ ## Phase 5: Estimate Complexity
112
+
113
+ | Signals | Estimate | Approach |
114
+ | ---------------------------------------- | -------- | ---------------- |
115
+ | <10 errors, single category | S (~10) | Quick fix |
116
+ | 10-30 errors, few categories | M (~30) | Systematic |
117
+ | 30-100 errors, multiple categories | L (~100) | Batch by pattern |
118
+ | >100 errors or architectural type issues | XL | Plan first |
119
+
120
+ ## Phase 6: Fix Errors
121
+
122
+ ### Rules (MUST follow)
123
+
124
+ - ❌ **Never** use `any` just to pass type check
125
+ - ❌ **Never** use `// @ts-ignore` without justification
126
+ - ❌ **Never** use `as unknown as T` pattern
127
+ - ✅ **Prefer** proper typing over type assertions
128
+ - ✅ **Prefer** narrowing with type guards
129
+ - ✅ **Prefer** `unknown` over `any` when type is truly unknown
130
+
131
+ ### Common Fixes
25
132
 
26
- If type errors reveal deeper issues requiring refactoring, create a follow-up bead:
133
+ **Missing type on parameter:**
27
134
 
28
135
  ```typescript
29
- bd_add({ title: "Refactor: <type issue summary>", type: "task", pri: 2 });
136
+ // Before
137
+ function process(data) { ... }
138
+
139
+ // After
140
+ function process(data: ProcessInput): ProcessOutput { ... }
141
+ ```
142
+
143
+ **Null/undefined handling:**
144
+
145
+ ```typescript
146
+ // Before
147
+ const name = user.name.toUpperCase();
148
+
149
+ // After (optional chaining)
150
+ const name = user?.name?.toUpperCase() ?? "Unknown";
151
+
152
+ // After (type guard)
153
+ if (user?.name) {
154
+ const name = user.name.toUpperCase();
155
+ }
156
+ ```
157
+
158
+ **Property doesn't exist:**
159
+
160
+ ```typescript
161
+ // Before
162
+ interface User {
163
+ name: string;
164
+ }
165
+ user.email; // Error
166
+
167
+ // After - extend interface
168
+ interface User {
169
+ name: string;
170
+ email?: string;
171
+ }
172
+ ```
173
+
174
+ **Generic constraint:**
175
+
176
+ ```typescript
177
+ // Before
178
+ function getValue<T>(obj: T, key: string) {
179
+ return obj[key]; // Error
180
+ }
181
+
182
+ // After
183
+ function getValue<T extends Record<string, unknown>>(obj: T, key: keyof T) {
184
+ return obj[key];
185
+ }
186
+ ```
187
+
188
+ ### Batch Fixing Strategy
189
+
190
+ For many errors of same type:
191
+
192
+ ```typescript
193
+ // Use AST grep to find patterns
194
+ ast - grep({ pattern: "function $NAME($PARAMS) {" }); // Find untyped functions
195
+ ```
196
+
197
+ Fix one, then apply pattern to similar cases.
198
+
199
+ ## Phase 7: Iterate Until Clean
200
+
201
+ ```bash
202
+ npx tsc --noEmit 2>&1
203
+ ```
204
+
205
+ Repeat until:
206
+
207
+ ```
208
+ Type Check: 0 errors ✓
209
+ ```
210
+
211
+ **Maximum iterations:** 5 passes. If still errors after 5, reassess approach.
212
+
213
+ ## Phase 8: Verification
214
+
215
+ **Type check passes:**
216
+
217
+ ```bash
218
+ npx tsc --noEmit
219
+ ```
220
+
221
+ **Tests still pass:**
222
+
223
+ ```bash
224
+ npm test
225
+ ```
226
+
227
+ **Lint still passes:**
228
+
229
+ ```bash
230
+ npm run lint
231
+ ```
232
+
233
+ ```
234
+ Verification:
235
+ ━━━━━━━━━━━━━
236
+
237
+ Types: 0 errors ✓
238
+ Tests: Passing ✓
239
+ Lint: Passing ✓
240
+ ```
241
+
242
+ ## Phase 9: Track Improvement
243
+
244
+ ```
245
+ Type Error Resolution:
246
+ ━━━━━━━━━━━━━━━━━━━━━━
247
+
248
+ Before: [N] errors
249
+ After: 0 errors
250
+ Reduction: 100%
251
+
252
+ By category:
253
+ - Missing types: [N] → 0
254
+ - Null handling: [N] → 0
255
+ - Property errors: [N] → 0
256
+ ```
257
+
258
+ ## Phase 10: Document Patterns
259
+
260
+ If you discovered useful type patterns:
261
+
262
+ ```typescript
263
+ observation({
264
+ type: "pattern",
265
+ title: "Type pattern: [name]",
266
+ content: `
267
+ ## Pattern
268
+ [Description of the type pattern]
269
+
270
+ ## Example
271
+ \`\`\`typescript
272
+ [Code showing the pattern]
273
+ \`\`\`
274
+
275
+ ## When to Use
276
+ [When this pattern applies]
277
+ `,
278
+ concepts: "typescript, types, [specific pattern]",
279
+ bead_id: "<bead-id>",
280
+ });
281
+ ```
282
+
283
+ Update conventions if this should be standard:
284
+
285
+ ```typescript
286
+ memory -
287
+ update({
288
+ file: "project/conventions",
289
+ content: `
290
+ ## Type Pattern: [Name]
291
+
292
+ [Pattern description and example]
293
+ `,
294
+ mode: "append",
295
+ });
296
+ ```
297
+
298
+ ## Phase 11: Handle Deep Issues
299
+
300
+ If type errors reveal architectural problems:
301
+
302
+ ```typescript
303
+ bd_add({
304
+ title: "Refactor: [type issue summary]",
305
+ type: "task",
306
+ pri: 2,
307
+ desc: "Type errors revealed need for: [description]",
308
+ });
309
+ ```
310
+
311
+ ## Phase 12: Commit & Sync
312
+
313
+ ```bash
314
+ git add <files>
315
+ git commit -m "fix(types): resolve type errors
316
+
317
+ - Fixed [N] type errors
318
+ - Categories: [list main categories]
319
+ - No 'any' types added
320
+ [bead-id if applicable]"
321
+ ```
322
+
323
+ ```typescript
324
+ bd_release({ _: true });
325
+ bd_sync({ reason: "Fixed type errors" });
326
+ ```
327
+
328
+ ## Output
329
+
330
+ ```
331
+ Type Errors Fixed
332
+ ━━━━━━━━━━━━━━━━━
333
+
334
+ Estimate: [S/M/L]
335
+ Before: [N] errors
336
+ After: 0 errors
337
+
338
+ Categories fixed:
339
+ - Missing types: [N]
340
+ - Null handling: [N]
341
+ - Property errors: [N]
342
+
343
+ Verification:
344
+ - Type check: ✓
345
+ - Tests: ✓
346
+ - Lint: ✓
347
+
348
+ 'any' types added: 0 ✓
349
+ Patterns documented: [N]
350
+
351
+ Commit: [hash]
352
+ ```
353
+
354
+ **Next steps:**
355
+
356
+ ```
357
+ If part of larger task:
358
+ /implement <bead-id>
359
+
360
+ If standalone:
361
+ /finish <bead-id>
30
362
  ```