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