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.
Files changed (47) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/agent/planner.md +3 -2
  3. package/dist/template/.opencode/command/accessibility-check.md +297 -30
  4. package/dist/template/.opencode/command/analyze-mockup.md +412 -20
  5. package/dist/template/.opencode/command/analyze-project.md +445 -30
  6. package/dist/template/.opencode/command/brainstorm.md +294 -5
  7. package/dist/template/.opencode/command/commit.md +231 -17
  8. package/dist/template/.opencode/command/create.md +415 -77
  9. package/dist/template/.opencode/command/design-audit.md +483 -29
  10. package/dist/template/.opencode/command/design.md +615 -6
  11. package/dist/template/.opencode/command/edit-image.md +223 -20
  12. package/dist/template/.opencode/command/finish.md +163 -71
  13. package/dist/template/.opencode/command/fix-ci.md +297 -24
  14. package/dist/template/.opencode/command/fix-types.md +351 -13
  15. package/dist/template/.opencode/command/fix-ui.md +299 -13
  16. package/dist/template/.opencode/command/fix.md +262 -9
  17. package/dist/template/.opencode/command/generate-diagram.md +327 -26
  18. package/dist/template/.opencode/command/generate-icon.md +266 -22
  19. package/dist/template/.opencode/command/generate-image.md +232 -12
  20. package/dist/template/.opencode/command/generate-pattern.md +234 -20
  21. package/dist/template/.opencode/command/generate-storyboard.md +231 -21
  22. package/dist/template/.opencode/command/handoff.md +208 -31
  23. package/dist/template/.opencode/command/implement.md +163 -50
  24. package/dist/template/.opencode/command/import-plan.md +253 -52
  25. package/dist/template/.opencode/command/init.md +154 -35
  26. package/dist/template/.opencode/command/integration-test.md +410 -24
  27. package/dist/template/.opencode/command/issue.md +177 -21
  28. package/dist/template/.opencode/command/new-feature.md +390 -54
  29. package/dist/template/.opencode/command/plan.md +394 -107
  30. package/dist/template/.opencode/command/pr.md +235 -29
  31. package/dist/template/.opencode/command/quick-build.md +234 -5
  32. package/dist/template/.opencode/command/research-and-implement.md +442 -12
  33. package/dist/template/.opencode/command/research-ui.md +444 -34
  34. package/dist/template/.opencode/command/research.md +179 -45
  35. package/dist/template/.opencode/command/restore-image.md +416 -22
  36. package/dist/template/.opencode/command/resume.md +447 -63
  37. package/dist/template/.opencode/command/revert-feature.md +347 -65
  38. package/dist/template/.opencode/command/review-codebase.md +199 -4
  39. package/dist/template/.opencode/command/skill-create.md +506 -14
  40. package/dist/template/.opencode/command/skill-optimize.md +487 -16
  41. package/dist/template/.opencode/command/status.md +326 -60
  42. package/dist/template/.opencode/command/summarize.md +374 -33
  43. package/dist/template/.opencode/command/triage.md +361 -0
  44. package/dist/template/.opencode/command/ui-review.md +296 -25
  45. package/dist/template/.opencode/skill/beads/SKILL.md +108 -3
  46. package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
  47. package/package.json +1 -1
@@ -1,56 +1,192 @@
1
1
  ---
2
- description: Resume work on a bead from handoff
2
+ description: Resume work on a bead from handoff with full context recovery
3
3
  argument-hint: "<bead-id>"
4
4
  agent: build
5
5
  ---
6
6
 
7
- # Resume
7
+ # Resume: $ARGUMENTS
8
8
 
9
- **Load skill:** `skill({ name: "executing-plans" })`
9
+ Recover full context from a previous session and continue work on an in-progress task.
10
10
 
11
- ## Phase 1: Load Previous Session Context
11
+ ## Load Beads Skill
12
12
 
13
- **Check recent sessions:**
13
+ ```typescript
14
+ skill({ name: "beads" });
15
+ ```
14
16
 
15
- ```bash
16
- list_sessions(project="current", limit=5)
17
+ This skill provides the session protocol for proper context recovery.
18
+
19
+ ## Prerequisites
20
+
21
+ - Bead ID must exist
22
+ - Handoff file should be present (created by `/handoff`)
23
+ - Previous session context should be accessible
24
+
25
+ ## Phase 1: Initialize Environment
26
+
27
+ ```typescript
28
+ bd_init({ _: true, team: "project", role: "builder" });
17
29
  ```
18
30
 
19
- **Load last session context:**
31
+ ## Phase 2: Validate Bead Exists
20
32
 
21
- ```bash
22
- read_session("last", project="current")
33
+ ```typescript
34
+ bd_show({ id: "$ARGUMENTS" });
23
35
  ```
24
36
 
25
- Review:
37
+ **If bead not found:**
26
38
 
27
- - What was implemented
28
- - File changes made
29
- - Where work stopped
39
+ ```
40
+ ERROR: Bead '$ARGUMENTS' not found
41
+
42
+ Available beads:
43
+ [list from bd_ls]
44
+
45
+ Did you mean:
46
+ - bd-abc12 (similar prefix)
47
+ - bd-xyz99 (in progress)
30
48
 
31
- ## Phase 2: Load Bead
49
+ Commands:
50
+ - /status # See all beads
51
+ - /start <id> # Start a new bead
52
+ ```
53
+
54
+ ## Phase 3: Check Messages and Blockers
55
+
56
+ Before diving in, check for coordination updates:
32
57
 
33
58
  ```typescript
34
- bd_show({ id: "$ARGUMENTS" });
59
+ bd_inbox({ n: 10, unread: true, global: true });
60
+ bd_reservations({ reason: "Check for conflicting locks" });
35
61
  ```
36
62
 
37
- ## Phase 3: Find Latest Handoff
63
+ **If blocking messages found:**
38
64
 
39
- ```bash
40
- ls -t .beads/artifacts/<bead-id>/handoffs/ 2>/dev/null | head -1
41
65
  ```
66
+ ⚠️ ATTENTION REQUIRED
67
+ ━━━━━━━━━━━━━━━━━━━━━
42
68
 
43
- If no handoffs: "No handoff found. Use `/start <bead-id>` instead."
69
+ Message from qa-agent (2h ago):
70
+ "Found regression in auth flow - hold on bd-abc12 until fixed"
44
71
 
45
- Read latest handoff:
72
+ Options:
73
+ 1. Acknowledge and continue anyway
74
+ 2. Switch to different task (/triage)
75
+ 3. Reply for clarification
76
+ ```
77
+
78
+ **If conflicting file locks:**
79
+
80
+ ```
81
+ ⚠️ FILE CONFLICT
82
+ ━━━━━━━━━━━━━━━━
83
+
84
+ Files you need are locked:
85
+
86
+ src/auth/service.ts - locked by be-agent (expires 8m)
87
+ src/auth/types.ts - locked by be-agent (expires 8m)
88
+
89
+ Options:
90
+ 1. Wait for lock to expire
91
+ 2. Message be-agent to coordinate
92
+ 3. Work on non-conflicting files first
93
+ ```
94
+
95
+ ## Phase 4: Load Previous Session Context
96
+
97
+ ### Step 1: Find Related Sessions
98
+
99
+ ```typescript
100
+ list_sessions({ project: "current", limit: 10, _: true });
101
+ ```
102
+
103
+ ### Step 2: Identify Relevant Session
104
+
105
+ Look for sessions that:
106
+
107
+ - Mention the bead ID
108
+ - Modified files in the bead's scope
109
+ - Have handoff mentions
110
+
111
+ ```typescript
112
+ read_session("last", { project: "current", focus: "$ARGUMENTS" });
113
+ ```
114
+
115
+ ### Step 3: Extract Key Context
116
+
117
+ From session, note:
118
+
119
+ - Files modified
120
+ - Decisions made
121
+ - Where work stopped
122
+ - Blockers encountered
123
+
124
+ ## Phase 5: Find and Load Handoff
125
+
126
+ ### Locate Handoff File
46
127
 
47
128
  ```bash
48
- cat .beads/artifacts/<bead-id>/handoffs/<latest>.md
129
+ ls -t .beads/artifacts/$ARGUMENTS/handoffs/ 2>/dev/null | head -1
130
+ ```
131
+
132
+ **If no handoffs directory:**
133
+
134
+ ```
135
+ No handoff found for $ARGUMENTS
136
+
137
+ This bead may not have been started with /start, or
138
+ no handoff was created before the previous session ended.
139
+
140
+ Fallback: Loading from bead spec and plan...
141
+ ```
142
+
143
+ ### Load Handoff Content
144
+
145
+ ```typescript
146
+ read({ filePath: ".beads/artifacts/$ARGUMENTS/handoffs/<latest>.md" });
147
+ ```
148
+
149
+ ### Parse Handoff Structure
150
+
151
+ Expected format:
152
+
153
+ ```markdown
154
+ # Handoff: $ARGUMENTS
155
+
156
+ ## Summary
157
+
158
+ [What was accomplished]
159
+
160
+ ## Progress
161
+
162
+ - [x] Step 1
163
+ - [x] Step 2
164
+ - [ ] Step 3 ← STOPPED HERE
165
+ - [ ] Step 4
166
+
167
+ ## Current State
168
+
169
+ - Branch: feature/auth
170
+ - Commit: abc1234
171
+ - Working: src/auth/service.ts
172
+
173
+ ## Resume Instructions
174
+
175
+ [Specific next actions]
176
+
177
+ ## Blockers
178
+
179
+ [Any known issues]
180
+
181
+ ## Files Modified
182
+
183
+ - src/auth/service.ts (+45/-12)
184
+ - src/auth/types.ts (+8/-0)
49
185
  ```
50
186
 
51
- ## Phase 4: Verify Git State
187
+ ## Phase 6: Verify Git State
52
188
 
53
- Check current state matches handoff:
189
+ ### Check Current State
54
190
 
55
191
  ```bash
56
192
  git branch --show-current
@@ -58,72 +194,320 @@ git rev-parse HEAD
58
194
  git status --porcelain
59
195
  ```
60
196
 
61
- **If branch mismatch:**
197
+ ### Compare with Handoff
198
+
199
+ ```typescript
200
+ const handoffCommit = parseHandoff().commit;
201
+ const currentCommit = getCurrentCommit();
202
+
203
+ if (handoffCommit !== currentCommit) {
204
+ // Check if we're ahead or behind
205
+ const isAhead = isAncestor(handoffCommit, currentCommit);
206
+ const isBehind = isAncestor(currentCommit, handoffCommit);
207
+
208
+ if (isAhead) {
209
+ console.log(
210
+ "Current branch is ahead of handoff - new commits since handoff",
211
+ );
212
+ } else if (isBehind) {
213
+ console.log(
214
+ "WARNING: Current branch is behind handoff - commits may be lost",
215
+ );
216
+ } else {
217
+ console.log("WARNING: Branches have diverged");
218
+ }
219
+ }
220
+ ```
221
+
222
+ **Mismatch Handling:**
223
+
224
+ ```
225
+ ⚠️ GIT STATE MISMATCH
226
+ ━━━━━━━━━━━━━━━━━━━━━
227
+
228
+ Handoff Commit: abc1234 "feat: add auth middleware"
229
+ Current Commit: def5678 "fix: typo in readme"
230
+ Branch: main (expected: feature/auth)
231
+
232
+ Options:
233
+ 1. Switch to correct branch:
234
+ git checkout feature/auth
235
+
236
+ 2. Continue on current branch:
237
+ [Work may not align with handoff]
238
+
239
+ 3. View diff between commits:
240
+ git diff abc1234..def5678
241
+ ```
242
+
243
+ ### Branch Checkout (if needed)
62
244
 
63
245
  ```bash
64
- git checkout <bead-id>
246
+ # Check if branch exists
247
+ git branch --list "feature/$ARGUMENTS" "$ARGUMENTS"
248
+
249
+ # Checkout if found
250
+ git checkout "$ARGUMENTS" 2>/dev/null || git checkout "feature/$ARGUMENTS"
65
251
  ```
66
252
 
67
- **If commit mismatch:**
253
+ ## Phase 7: Load All Artifacts
254
+
255
+ Read all bead context in parallel:
68
256
 
257
+ ```typescript
258
+ read({ filePath: ".beads/artifacts/$ARGUMENTS/spec.md" });
259
+ read({ filePath: ".beads/artifacts/$ARGUMENTS/research.md" });
260
+ read({ filePath: ".beads/artifacts/$ARGUMENTS/plan.md" });
261
+ read({ filePath: ".beads/artifacts/$ARGUMENTS/review.md" });
69
262
  ```
70
- Warning: Current commit differs from handoff.
71
- Handoff: [hash from handoff]
72
- Current: [current hash]
73
263
 
74
- Continue anyway? (yes/no)
264
+ **If files missing, note gaps:**
265
+
266
+ ```
267
+ Artifact Status:
268
+ ✓ spec.md - loaded
269
+ ✓ plan.md - loaded
270
+ ✗ research.md - not found (may not be needed)
271
+ ✗ review.md - not found (will create during work)
75
272
  ```
76
273
 
77
- ## Phase 5: Load Context
274
+ ## Phase 8: Stale Handoff Detection
78
275
 
79
- Read all artifacts:
276
+ Check if handoff is too old:
80
277
 
81
- ```bash
82
- cat .beads/artifacts/<bead-id>/spec.md
83
- cat .beads/artifacts/<bead-id>/research.md 2>/dev/null
84
- cat .beads/artifacts/<bead-id>/plan.md 2>/dev/null
278
+ ```typescript
279
+ const handoffAge = Date.now() - new Date(handoff.timestamp);
280
+ const hoursOld = handoffAge / (1000 * 60 * 60);
281
+
282
+ if (hoursOld > 72) {
283
+ // 3 days
284
+ console.warn(`⚠️ Handoff is ${Math.floor(hoursOld / 24)} days old`);
285
+ console.warn("Context may be outdated. Consider:");
286
+ console.warn("1. Re-reading current file state");
287
+ console.warn("2. Checking for changes by others");
288
+ console.warn("3. Re-running /research if needed");
289
+ }
290
+ ```
291
+
292
+ **Stale Handoff Warning:**
293
+
294
+ ```
295
+ ⚠️ STALE HANDOFF DETECTED
296
+ ━━━━━━━━━━━━━━━━━━━━━━━━━
297
+
298
+ Handoff created: 5 days ago
299
+ Last commit on branch: 5 days ago
300
+
301
+ Since then:
302
+ - 12 commits on main
303
+ - 3 files modified that you touched
304
+
305
+ Recommendation:
306
+ 1. Check for merge conflicts: git merge --no-commit main
307
+ 2. Re-read key files to refresh context
308
+ 3. Update plan if approach changed
309
+ ```
310
+
311
+ ## Phase 9: Reserve Required Files
312
+
313
+ Based on handoff and plan, reserve files for editing:
314
+
315
+ ```typescript
316
+ const filesToEdit = extractFilesFromPlan(plan);
317
+ bd_reserve({ paths: filesToEdit, ttl: 600, reason: "Resuming $ARGUMENTS" });
85
318
  ```
86
319
 
87
- ## Phase 6: Report & Continue
320
+ ## Phase 10: Generate Resume Report
88
321
 
89
322
  ```
90
- Resuming: <bead-id>
323
+ ╔══════════════════════════════════════════════════════════════════════════╗
324
+ ║ RESUMING: $ARGUMENTS ║
325
+ ╠══════════════════════════════════════════════════════════════════════════╣
326
+
327
+ TASK INFO
328
+ ━━━━━━━━━
329
+ Title: [from bead]
330
+ Priority: [P0-P4]
331
+ Status: In Progress
332
+ Created: [date]
333
+
334
+
335
+ CONTEXT SOURCES
336
+ ━━━━━━━━━━━━━━━
337
+ Source │ Status │ Age
338
+ ────────────────────┼────────┼────────
339
+ Handoff │ ✓ │ 2 days
340
+ Previous Session │ ✓ │ 2 days
341
+ Spec │ ✓ │ -
342
+ Plan │ ✓ │ -
343
+
344
+
345
+ PREVIOUS SESSION SUMMARY
346
+ ━━━━━━━━━━━━━━━━━━━━━━━━
347
+ Session: ses_abc123 (2 days ago)
348
+ Duration: 45 min
349
+ Messages: 34
350
+ Focus: Implementing auth middleware
351
+
352
+ Key Actions:
353
+ - Created AuthMiddleware class
354
+ - Added token validation
355
+ - Stopped at: refresh token logic
356
+
357
+
358
+ PROGRESS
359
+ ━━━━━━━━
360
+ [x] Set up project structure
361
+ [x] Create base service class
362
+ [x] Add authentication logic
363
+ [ ] Implement refresh tokens ← RESUME HERE
364
+ [ ] Add rate limiting
365
+ [ ] Write tests
366
+ [ ] Update documentation
367
+
368
+ Completed: 3/7 (43%)
369
+
370
+
371
+ GIT STATE
372
+ ━━━━━━━━━
373
+ Branch: feature/auth
374
+ Commit: abc1234 "feat: add auth middleware"
375
+ Status: Clean ✓
376
+
377
+
378
+ RESUME INSTRUCTIONS
379
+ ━━━━━━━━━━━━━━━━━━━
380
+ From handoff:
381
+
382
+ "Left off implementing refresh token rotation. The TokenService
383
+ is ready but needs the rotateToken() method. See TODO in
384
+ src/auth/token-service.ts:45. Tests are set up but empty."
385
+
386
+
387
+ FILES TO MODIFY
388
+ ━━━━━━━━━━━━━━━
389
+ src/auth/token-service.ts (add rotateToken method)
390
+ src/auth/token-service.test.ts (add tests)
391
+
392
+
393
+ FILE LOCKS ACQUIRED
394
+ ━━━━━━━━━━━━━━━━━━━
395
+ ✓ src/auth/token-service.ts (10 min)
396
+ ✓ src/auth/token-service.test.ts (10 min)
397
+
398
+
399
+ BLOCKERS
400
+ ━━━━━━━━
401
+ [If any blockers from handoff:]
402
+ - Waiting on API spec for refresh endpoint (ask be-agent)
403
+
404
+ [If no blockers:]
405
+ No known blockers
406
+
407
+
408
+ READY TO CONTINUE
91
409
  ━━━━━━━━━━━━━━━━━
92
410
 
93
- Title: [title]
94
- Branch: [branch]
95
- Handoff: [timestamp]
96
- Last Session: [from read_session]
411
+ Load skill: skill({ name: "executing-plans" })
97
412
 
98
- ## Progress
413
+ Then continue with:
414
+ /implement $ARGUMENTS
99
415
 
100
- Completed:
101
- - [x] [from handoff]
416
+ Or if you need to re-orient:
417
+ - Read src/auth/token-service.ts to see current state
418
+ - Check plan.md for detailed steps
102
419
 
103
- In Progress:
104
- - [ ] [from handoff] - [where stopped]
420
+ ╚══════════════════════════════════════════════════════════════════════════╝
421
+ ```
105
422
 
106
- Remaining:
107
- - [ ] [from handoff]
423
+ ## Phase 11: Determine Next Action
108
424
 
109
- ## Previous Session Summary
425
+ Based on state, recommend action:
110
426
 
111
- [Key points from read_session output]
427
+ ```typescript
428
+ const nextAction = determineNextAction({
429
+ hasSpec: !!spec,
430
+ hasResearch: !!research,
431
+ hasPlan: !!plan,
432
+ planProgress: calculateProgress(plan),
433
+ hasBlockers: blockers.length > 0,
434
+ });
435
+
436
+ switch (nextAction) {
437
+ case "NEEDS_SPEC":
438
+ return "/create $ARGUMENTS - Add specification";
439
+ case "NEEDS_RESEARCH":
440
+ return "/research $ARGUMENTS - Research required";
441
+ case "NEEDS_PLAN":
442
+ return "/plan $ARGUMENTS - Create implementation plan";
443
+ case "CONTINUE_IMPLEMENTATION":
444
+ return "/implement $ARGUMENTS - Continue building";
445
+ case "BLOCKED":
446
+ return "Address blockers first, then /implement";
447
+ case "READY_TO_FINISH":
448
+ return "/finish $ARGUMENTS - Complete and close";
449
+ }
450
+ ```
112
451
 
113
- ## Resume Instructions
452
+ **Decision Table:**
453
+
454
+ | State | Action |
455
+ | ----------------------------- | ----------------------- |
456
+ | No spec.md | `/create $ARGUMENTS` |
457
+ | No research.md (complex task) | `/research $ARGUMENTS` |
458
+ | No plan.md | `/plan $ARGUMENTS` |
459
+ | Plan < 100% complete | `/implement $ARGUMENTS` |
460
+ | Plan 100% + tests pass | `/finish $ARGUMENTS` |
461
+ | Has blockers | Address blockers first |
462
+
463
+ ## Error Recovery
114
464
 
115
- [Instructions from handoff]
465
+ ### No Bead Found
116
466
 
117
- ## Next Action
467
+ ```
468
+ ERROR: Bead not found
469
+
470
+ Possible causes:
471
+ 1. Typo in bead ID
472
+ 2. Bead was closed/deleted
473
+ 3. Using wrong project
474
+
475
+ Check: bd_ls({ status: "all", limit: 20, offset: 0 })
476
+ ```
477
+
478
+ ### No Session Context
479
+
480
+ ```
481
+ WARNING: No previous session found for this bead
482
+
483
+ Proceeding with spec and plan only.
484
+ Context may be limited.
485
+
486
+ Recommendation: Read key files manually before continuing.
487
+ ```
118
488
 
119
- [Based on progress, suggest next command]
489
+ ### Corrupted Handoff
490
+
491
+ ```
492
+ ERROR: Handoff file is corrupted or incomplete
493
+
494
+ Missing required sections:
495
+ - Progress checklist
496
+ - Resume instructions
497
+
498
+ Fallback: Using plan.md for progress tracking
499
+ ```
500
+
501
+ ## Integration
502
+
503
+ After resume, the loaded skill will guide execution:
504
+
505
+ ```typescript
506
+ skill({ name: "executing-plans" });
120
507
  ```
121
508
 
122
- **Determine next action:**
509
+ This ensures:
123
510
 
124
- | State | Action |
125
- | -------------------------- | ---------------------- |
126
- | No research.md | `/research <bead-id>` |
127
- | No plan.md | `/plan <bead-id>` |
128
- | Has plan, incomplete steps | `/implement <bead-id>` |
129
- | All steps complete | `/finish <bead-id>` |
511
+ - Plan is followed step-by-step
512
+ - Progress is tracked in plan.md
513
+ - Handoff is created before context limit