jettypod 4.2.11 β 4.3.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/hooks/post-checkout +78 -3
- package/hooks/pre-push +33 -0
- package/jettypod.js +5 -1
- package/lib/claudemd.js +12 -4
- package/lib/current-work.js +97 -84
- package/lib/merge-lock.js +30 -0
- package/lib/session-writer.js +20 -0
- package/lib/worktree-facade.js +43 -0
- package/package.json +1 -1
- package/skills-templates/feature-planning/SKILL.md +155 -105
- package/skills-templates/production-mode/SKILL.md +4 -7
- package/skills-templates/speed-mode/SKILL.md +471 -463
- package/skills-templates/stable-mode/SKILL.md +319 -371
- package/lib/migrations/016-worktree-sessions-table.js +0 -84
- package/lib/worktree-sessions.js +0 -186
|
@@ -22,15 +22,28 @@ Guides Claude Code through speed mode implementation with autonomous analysis an
|
|
|
22
22
|
|
|
23
23
|
## Instructions
|
|
24
24
|
|
|
25
|
-
When this skill is activated, you are helping implement a speed mode chore to make
|
|
25
|
+
When this skill is activated, you are helping implement a speed mode chore to make all success scenarios pass. Follow this structured approach:
|
|
26
|
+
|
|
27
|
+
## π Critical Context
|
|
28
|
+
|
|
29
|
+
**You are working in an isolated git worktree:**
|
|
30
|
+
- `work start [chore-id]` created a dedicated worktree for this chore
|
|
31
|
+
- All file operations must use **absolute paths** from the worktree (not relative paths)
|
|
32
|
+
- The worktree has its own branch - changes are isolated from main
|
|
33
|
+
- BDD tests and unit tests run in the worktree context
|
|
34
|
+
|
|
35
|
+
**Worktree path is available in Step 0 output** - use it for all file operations.
|
|
36
|
+
|
|
37
|
+
---
|
|
26
38
|
|
|
27
39
|
### Overview
|
|
28
40
|
|
|
29
|
-
**Speed Mode Goal:**
|
|
41
|
+
**Speed Mode Goal:** Make it work - implement ALL functionality (required + optional features) to make success scenarios pass, assuming everything works correctly.
|
|
30
42
|
|
|
31
43
|
**Key Principles:**
|
|
32
|
-
- **Implement ALL features/functions** defined in
|
|
33
|
-
- **
|
|
44
|
+
- **Implement ALL features/functions** defined in scenarios - both required and optional functionality
|
|
45
|
+
- **All success paths** - every workflow that should work when inputs are valid
|
|
46
|
+
- **Assume success** - assume inputs are valid, files upload successfully, types are correct
|
|
34
47
|
- **No error handling** - no validation, no edge case handling, no error messages (that's for stable mode)
|
|
35
48
|
- **Fast iteration** - single file when possible, inline code over abstraction
|
|
36
49
|
- **Use real infrastructure** - use the actual database/storage from your tech stack, not mocks
|
|
@@ -40,20 +53,136 @@ When this skill is activated, you are helping implement a speed mode chore to ma
|
|
|
40
53
|
|
|
41
54
|
---
|
|
42
55
|
|
|
56
|
+
## π§ͺ Unit Testing in Speed Mode - True TDD
|
|
57
|
+
|
|
58
|
+
**Unit tests are written DURING the REDβGREEN loop, not after.**
|
|
59
|
+
|
|
60
|
+
**The TDD workflow (each iteration):**
|
|
61
|
+
1. **Identify next failing BDD step** - Which scenario step needs to pass next?
|
|
62
|
+
2. **Write unit test for the function** - Test the specific function/logic needed
|
|
63
|
+
3. **Watch unit test fail (RED)** - Confirm test catches the missing implementation
|
|
64
|
+
4. **Write minimal code** - Just enough to make the unit test pass
|
|
65
|
+
5. **Run unit test (GREEN)** - Verify the function works in isolation
|
|
66
|
+
6. **Run BDD scenarios** - Check if this makes any BDD steps pass
|
|
67
|
+
7. **Next iteration** - Repeat for next failing step
|
|
68
|
+
|
|
69
|
+
**What to unit test:**
|
|
70
|
+
- New functions you're creating (not framework/library code)
|
|
71
|
+
- Core logic and business rules
|
|
72
|
+
- Success scenarios only (no error cases - that's stable mode)
|
|
73
|
+
|
|
74
|
+
**Where to put unit tests:**
|
|
75
|
+
- Follow project conventions: `test/`, `__tests__/`, or `*.test.js` alongside code
|
|
76
|
+
- Check existing test files for patterns
|
|
77
|
+
|
|
78
|
+
**Example of TDD iteration:**
|
|
79
|
+
```javascript
|
|
80
|
+
// Iteration 1: BDD step "Given a user exists" is failing
|
|
81
|
+
|
|
82
|
+
// 1. Write unit test first (RED)
|
|
83
|
+
test('createUser creates user with valid data', () => {
|
|
84
|
+
const user = createUser('John', 'john@example.com');
|
|
85
|
+
expect(user.name).toBe('John');
|
|
86
|
+
expect(user.email).toBe('john@example.com');
|
|
87
|
+
});
|
|
88
|
+
// Run: FAILS - createUser doesn't exist
|
|
89
|
+
|
|
90
|
+
// 2. Write minimal implementation (GREEN)
|
|
91
|
+
function createUser(name, email) {
|
|
92
|
+
return { name, email };
|
|
93
|
+
}
|
|
94
|
+
// Run unit test: PASSES
|
|
95
|
+
// Run BDD: "Given a user exists" now passes
|
|
96
|
+
|
|
97
|
+
// Iteration 2: Next failing BDD step...
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Unit test scope in speed mode:**
|
|
101
|
+
```javascript
|
|
102
|
+
// β
Speed mode unit tests (success paths)
|
|
103
|
+
test('createUser creates user with valid data', () => {
|
|
104
|
+
const user = createUser('John', 'john@example.com');
|
|
105
|
+
expect(user.name).toBe('John');
|
|
106
|
+
expect(user.email).toBe('john@example.com');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// β NOT in speed mode (stable mode adds these)
|
|
110
|
+
test('createUser throws error for invalid email', () => {
|
|
111
|
+
expect(() => createUser('John', 'invalid')).toThrow();
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
<details>
|
|
116
|
+
<summary><strong>π Speed Mode Constraints (click to expand)</strong></summary>
|
|
117
|
+
|
|
118
|
+
**What to implement:**
|
|
119
|
+
- ALL scoped functionality - required features AND optional features from all success scenarios
|
|
120
|
+
- Multiple valid workflows if the feature supports them
|
|
121
|
+
- Success variations (different outcomes that are all correct)
|
|
122
|
+
|
|
123
|
+
**What NOT to implement:**
|
|
124
|
+
- β Error handling (try/catch, validation, edge cases)
|
|
125
|
+
- β Input validation (null checks, type checks, range validation)
|
|
126
|
+
- β Error messages for failures
|
|
127
|
+
- β Edge case handling (empty arrays, boundary values, race conditions)
|
|
128
|
+
|
|
129
|
+
**Code organization:**
|
|
130
|
+
- Single file when possible - keep it simple
|
|
131
|
+
- Inline code over separate modules initially
|
|
132
|
+
- Use real infrastructure (actual database/storage from your tech stack, not mocks)
|
|
133
|
+
- Focus: Make. All. Features. Work. (all success paths)
|
|
134
|
+
|
|
135
|
+
</details>
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### Step 0: Initialize Speed Mode Context
|
|
140
|
+
|
|
141
|
+
**You are now in speed mode,** implementing a chore to make success scenarios pass.
|
|
142
|
+
|
|
143
|
+
**Get the current work context:**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
sqlite3 .jettypod/work.db "SELECT wi.id, wi.title, wi.parent_id, parent.title as parent_title, parent.scenario_file, wt.worktree_path, wt.branch_name FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id LEFT JOIN worktrees wt ON wi.id = wt.work_item_id WHERE wi.status = 'in_progress' AND wi.type = 'chore'"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Display to user:**
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
ββββββββββββββββββββββββββββββββββββββββββ
|
|
153
|
+
π SPEED MODE: Implementing Chore #[id]
|
|
154
|
+
ββββββββββββββββββββββββββββββββββββββββββ
|
|
155
|
+
|
|
156
|
+
Chore: [title]
|
|
157
|
+
Feature: #[parent-id] [parent-title]
|
|
158
|
+
Worktree: [worktree_path]
|
|
159
|
+
Branch: [branch_name]
|
|
160
|
+
|
|
161
|
+
Analyzing BDD scenarios to determine implementation approach...
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Then proceed to Step 1.**
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
43
168
|
## Quick Reference: Async Boundaries
|
|
44
169
|
|
|
45
170
|
**Where Claude Code MUST wait for user confirmation:**
|
|
46
171
|
|
|
47
|
-
| Phase | Location | Why |
|
|
48
|
-
|
|
49
|
-
| Step
|
|
50
|
-
| Step
|
|
172
|
+
| Phase | Location | Why | Condition |
|
|
173
|
+
|-------|----------|-----|-----------|
|
|
174
|
+
| Step 3A | Before implementing (conditional) | User confirms implementation approach | Only if approach is ambiguous or multiple valid paths |
|
|
175
|
+
| Step 6 Phase 2 | Before creating stable chores | User confirms proposed stable mode chores | Always |
|
|
51
176
|
|
|
52
177
|
**Where Claude Code executes autonomously:**
|
|
53
|
-
- Step
|
|
178
|
+
- Step 0: Initialize context
|
|
179
|
+
- Step 1: Scenario analysis and breadcrumb check
|
|
54
180
|
- Step 2: Codebase analysis
|
|
55
|
-
- Step 3
|
|
56
|
-
- Step 4
|
|
181
|
+
- Step 3: Decision to skip/ask for confirmation
|
|
182
|
+
- Step 4: Establish RED baseline
|
|
183
|
+
- Step 5: REDβGREENβREFACTOR loop (true TDD)
|
|
184
|
+
- Step 6 Phase 1: Generate stable mode scenarios/steps
|
|
185
|
+
- Step 6 Phases 3-5: Create chores and invoke stable-mode skill
|
|
57
186
|
|
|
58
187
|
---
|
|
59
188
|
|
|
@@ -61,7 +190,7 @@ When this skill is activated, you are helping implement a speed mode chore to ma
|
|
|
61
190
|
|
|
62
191
|
**DO NOT mark features as complete after speed mode implementation.**
|
|
63
192
|
|
|
64
|
-
Speed mode is ONLY a checkpoint to prove
|
|
193
|
+
Speed mode is ONLY a checkpoint to prove functionality works. Features are INCOMPLETE without stable mode chores that add:
|
|
65
194
|
- Error handling and validation
|
|
66
195
|
- Edge case coverage
|
|
67
196
|
- Comprehensive testing
|
|
@@ -69,7 +198,7 @@ Speed mode is ONLY a checkpoint to prove the happy path works. Features are INCO
|
|
|
69
198
|
|
|
70
199
|
**Required workflow after speed mode implementation:**
|
|
71
200
|
|
|
72
|
-
1. β
**Complete ALL speed mode chores** - Implement
|
|
201
|
+
1. β
**Complete ALL speed mode chores** - Implement all success scenarios (required + optional features)
|
|
73
202
|
2. β
**Elevate to stable mode** - Use `node jettypod.js work set-mode <feature-id> stable` to auto-generate stable mode chores
|
|
74
203
|
3. β
**Implement stable mode chores** - Add error handling and edge cases
|
|
75
204
|
4. β **NEVER mark feature complete in speed mode** - This bypasses critical quality gates
|
|
@@ -81,17 +210,12 @@ The validation will require you to:
|
|
|
81
210
|
- This will automatically analyze the implementation and generate appropriate stable mode chores
|
|
82
211
|
- Or explicitly skip (not recommended): `node jettypod.js work set-mode <feature-id> stable --force`
|
|
83
212
|
|
|
84
|
-
**Remember:** Speed mode
|
|
213
|
+
**Remember:** Speed mode makes it work (all success scenarios). Stable mode makes it robust (handles failures).
|
|
85
214
|
|
|
86
215
|
---
|
|
87
216
|
|
|
88
217
|
## Implementation Steps
|
|
89
218
|
|
|
90
|
-
<!-- βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
91
|
-
PHASE 1: AUTONOMOUS ANALYSIS
|
|
92
|
-
No user input required - Claude Code executes independently
|
|
93
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -->
|
|
94
|
-
|
|
95
219
|
### Step 1: Check for Breadcrumbs and Analyze Scenario
|
|
96
220
|
|
|
97
221
|
**CRITICAL:** Claude Code executes this autonomously - no user permission needed.
|
|
@@ -106,15 +230,8 @@ The validation will require you to:
|
|
|
106
230
|
**To get current work and check for breadcrumbs:**
|
|
107
231
|
|
|
108
232
|
```bash
|
|
109
|
-
# Get current work item with description
|
|
110
|
-
jettypod
|
|
111
|
-
|
|
112
|
-
# Get parent feature details including scenario_file
|
|
113
|
-
jettypod work show <parent-feature-id>
|
|
114
|
-
|
|
115
|
-
# Or query database directly
|
|
116
|
-
sqlite3 .jettypod/work.db "SELECT id, title, description, parent_id FROM work_items WHERE status = 'in_progress' AND type = 'chore'"
|
|
117
|
-
sqlite3 .jettypod/work.db "SELECT id, title, scenario_file FROM work_items WHERE id = <parent-feature-id>"
|
|
233
|
+
# Get current work item with description and parent feature's scenario_file
|
|
234
|
+
sqlite3 .jettypod/work.db "SELECT wi.id, wi.title, wi.description, wi.parent_id, parent.title as parent_title, parent.scenario_file FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id WHERE wi.status = 'in_progress' AND wi.type = 'chore'"
|
|
118
235
|
```
|
|
119
236
|
|
|
120
237
|
**Check for breadcrumbs** by examining the chore's description for:
|
|
@@ -127,8 +244,8 @@ If all three sections exist, use them. Otherwise, fall back to autonomous analys
|
|
|
127
244
|
**Then read the scenario file** using the Read tool on the path returned by `scenario_file`.
|
|
128
245
|
|
|
129
246
|
**Parse Gherkin:**
|
|
130
|
-
- Extract
|
|
131
|
-
- Parse Given/When/Then/And steps
|
|
247
|
+
- Extract all `Scenario:` blocks (all success paths - required + optional features)
|
|
248
|
+
- Parse Given/When/Then/And steps for each scenario
|
|
132
249
|
- Identify:
|
|
133
250
|
- Initial state setup (Given)
|
|
134
251
|
- User actions (When)
|
|
@@ -241,65 +358,62 @@ Integration Points:
|
|
|
241
358
|
Now proposing implementation approach...
|
|
242
359
|
```
|
|
243
360
|
|
|
244
|
-
|
|
361
|
+
### Step 3: Decide if Confirmation Needed
|
|
362
|
+
|
|
363
|
+
**Evaluate if you need user confirmation before implementing:**
|
|
245
364
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
365
|
+
**Skip confirmation (proceed directly to Step 4) if:**
|
|
366
|
+
- Breadcrumbs are comprehensive (files, patterns, functions all specified)
|
|
367
|
+
- Implementation approach is clear and unambiguous
|
|
368
|
+
- Only one reasonable way to implement the scenario
|
|
369
|
+
- Epic architectural decisions are clear and constraining
|
|
250
370
|
|
|
251
|
-
|
|
371
|
+
**Ask for confirmation (Step 3A) if:**
|
|
372
|
+
- Multiple valid implementation approaches exist
|
|
373
|
+
- Breadcrumbs are vague or missing key details
|
|
374
|
+
- Architectural choice impacts other features
|
|
375
|
+
- You're uncertain about the right approach
|
|
252
376
|
|
|
253
|
-
|
|
377
|
+
### Step 3A: Propose Implementation Approach (Conditional)
|
|
254
378
|
|
|
255
|
-
|
|
379
|
+
**β‘ ASYNC BOUNDARY - Only execute this if confirmation needed**
|
|
256
380
|
|
|
257
|
-
**Present your analysis and proposal:**
|
|
381
|
+
**Present your analysis and proposal to the user:**
|
|
258
382
|
|
|
259
383
|
```
|
|
260
384
|
π‘ Implementation Proposal
|
|
261
385
|
|
|
262
|
-
|
|
386
|
+
I see multiple ways to approach this. Here's what I'm thinking:
|
|
263
387
|
|
|
264
|
-
**
|
|
265
|
-
|
|
266
|
-
|
|
388
|
+
**Option I'm recommending:**
|
|
389
|
+
β’ Files to create/modify: [specific paths]
|
|
390
|
+
β’ Key approach: [what makes this the right choice]
|
|
391
|
+
β’ Why: [rationale - why this over alternatives]
|
|
267
392
|
|
|
268
|
-
**
|
|
269
|
-
β’ [
|
|
270
|
-
β’ [Point 2]: [specific approach]
|
|
271
|
-
β’ [Point 3]: [specific approach]
|
|
393
|
+
**Alternative considered:**
|
|
394
|
+
β’ [Brief description] - not choosing because [reason]
|
|
272
395
|
|
|
273
|
-
|
|
274
|
-
[Brief explanation of how this satisfies the scenario while following codebase patterns]
|
|
275
|
-
|
|
276
|
-
Sound good? I'll implement this autonomously once you confirm.
|
|
396
|
+
Sound good, or would you prefer a different approach?
|
|
277
397
|
```
|
|
278
398
|
|
|
279
|
-
|
|
399
|
+
**β‘ WAIT for user confirmation or adjustments.**
|
|
280
400
|
|
|
281
|
-
If user adjusts: revise proposal and confirm again.
|
|
401
|
+
If user adjusts: revise proposal and confirm again before proceeding.
|
|
282
402
|
|
|
283
|
-
|
|
284
|
-
PHASE 3: AUTONOMOUS EXECUTION
|
|
285
|
-
User has confirmed - Claude Code executes REDβGREEN loop independently
|
|
286
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -->
|
|
403
|
+
**If you skipped this step:** Proceed directly to Step 4.
|
|
287
404
|
|
|
288
|
-
|
|
405
|
+
---
|
|
289
406
|
|
|
290
|
-
|
|
407
|
+
### Step 4: Establish RED Baseline
|
|
291
408
|
|
|
292
|
-
**
|
|
409
|
+
**CRITICAL:** After user confirms, execute autonomously - no permission needed for code changes.
|
|
293
410
|
|
|
294
411
|
Before writing any implementation code, run tests to establish the RED state:
|
|
295
412
|
|
|
296
413
|
```bash
|
|
297
414
|
# Get current work and parent feature's scenario file
|
|
298
|
-
jettypod
|
|
299
|
-
#
|
|
300
|
-
|
|
301
|
-
sqlite3 .jettypod/work.db "SELECT scenario_file FROM work_items WHERE id = <parent-feature-id>"
|
|
302
|
-
# This gives you the path to the .feature file
|
|
415
|
+
sqlite3 .jettypod/work.db "SELECT wi.id, wi.parent_id, parent.scenario_file FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id WHERE wi.status = 'in_progress'"
|
|
416
|
+
# This gives you the chore ID, parent feature ID, and path to the .feature file
|
|
303
417
|
|
|
304
418
|
# Run BDD tests to establish RED baseline
|
|
305
419
|
npx cucumber-js <scenario-file-path> --format progress
|
|
@@ -334,441 +448,360 @@ First error:
|
|
|
334
448
|
Now implementing...
|
|
335
449
|
```
|
|
336
450
|
|
|
337
|
-
|
|
451
|
+
---
|
|
338
452
|
|
|
339
|
-
|
|
453
|
+
### Step 5: REDβGREENβREFACTOR Loop
|
|
340
454
|
|
|
341
|
-
|
|
342
|
-
β π ITERATION LOOP: REDβGREEN β
|
|
343
|
-
β β
|
|
344
|
-
β Progress Tracking: β
|
|
345
|
-
β β’ Display: "Iteration X/10" at start of each cycle β
|
|
346
|
-
β β’ Track: steps passing vs total, newly passing steps β
|
|
347
|
-
β β’ Goal: All steps pass (exit code 0) β
|
|
348
|
-
β β
|
|
349
|
-
β Return Points: β
|
|
350
|
-
β β’ CHECKPOINT_ITERATION: Resume at specific iteration number β
|
|
351
|
-
β β’ CHECKPOINT_PROGRESS: Resume with known passing step count β
|
|
352
|
-
β β’ If session interrupted, can resume from last known iteration β
|
|
353
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -->
|
|
455
|
+
**Execute autonomously** - iterate until tests pass (max 10 iterations).
|
|
354
456
|
|
|
355
|
-
|
|
356
|
-
// --- Imports and setup ---
|
|
357
|
-
const { runBddScenarioWithTimeout, parseTestProgress, findNewlyPassingSteps, extractErrors, MAX_ITERATIONS } = require('./.claude/skills/speed-mode/test-runner');
|
|
358
|
-
|
|
359
|
-
let previousResult = global.redBaseline; // From Step 1
|
|
360
|
-
let iteration = 0;
|
|
361
|
-
|
|
362
|
-
// --- Main iteration loop ---
|
|
363
|
-
// π PROGRESS: Iteration {iteration}/{MAX_ITERATIONS} | Steps: {passed}/{total}
|
|
364
|
-
while (iteration < MAX_ITERATIONS) {
|
|
365
|
-
iteration++;
|
|
366
|
-
console.log(`\nβββ Iteration ${iteration}/${MAX_ITERATIONS} βββ`);
|
|
367
|
-
|
|
368
|
-
// --- Make code changes ---
|
|
369
|
-
console.log(`\nβοΈ Making code changes...`);
|
|
370
|
-
// [Claude Code writes implementation code here using Write/Edit tools]
|
|
371
|
-
|
|
372
|
-
// --- Run tests ---
|
|
373
|
-
console.log(`\nπ§ͺ Running tests...`);
|
|
374
|
-
const result = await runBddScenarioWithTimeout(feature.scenario_file, happyPathLine);
|
|
375
|
-
|
|
376
|
-
// --- Handle timeout ---
|
|
377
|
-
if (result.timedOut) {
|
|
378
|
-
console.log(`β οΈ Test execution timed out - tests may be hanging`);
|
|
379
|
-
console.log(`Stopping iteration loop`);
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
457
|
+
**Each iteration (True TDD):**
|
|
382
458
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
459
|
+
1. **Identify next failing BDD step** - Which scenario step to tackle?
|
|
460
|
+
2. **Write unit test** - Test the function/logic needed for that step (watch it fail - RED)
|
|
461
|
+
3. **Write minimal implementation** - Just enough code to pass the unit test
|
|
462
|
+
4. **Run unit test** - Verify it passes (GREEN)
|
|
463
|
+
5. **Run BDD scenarios** - Check if BDD step now passes
|
|
464
|
+
6. **Display progress** - Show what's passing, what's next
|
|
465
|
+
7. **Continue or exit** - If all BDD scenarios pass β REFACTOR. Otherwise, repeat.
|
|
387
466
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
467
|
+
**Show progress each iteration:**
|
|
468
|
+
```
|
|
469
|
+
βββ Iteration 3/10 βββ
|
|
470
|
+
π Unit test: test/dashboard.test.js - sortActivityByDate()
|
|
471
|
+
RED: Test fails - function doesn't exist yet
|
|
472
|
+
βοΈ Implementation: src/dashboard.js - added sortActivityByDate()
|
|
473
|
+
GREEN: Unit test passes
|
|
474
|
+
π§ͺ Running BDD scenarios...
|
|
475
|
+
π Progress: 7/8 BDD steps passing
|
|
476
|
+
β
Newly passing: And activity should be sorted by date
|
|
477
|
+
π§ Next failure: And activity should be filterable
|
|
478
|
+
BDD step: When I filter by category "work"
|
|
479
|
+
```
|
|
395
480
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
481
|
+
**When GREEN achieved:**
|
|
482
|
+
```
|
|
483
|
+
π GREEN: All success scenarios passing!
|
|
484
|
+
```
|
|
401
485
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
console.log(` Error: ${nextError.message}`);
|
|
408
|
-
if (nextError.stack) {
|
|
409
|
-
console.log(` Stack: ${nextError.stack.split('\n')[0]}`);
|
|
410
|
-
}
|
|
411
|
-
} else if (currentResult.failedSteps.length > 0) {
|
|
412
|
-
console.log(`\nπ§ Still failing:`);
|
|
413
|
-
currentResult.failedSteps.slice(0, 3).forEach(step => console.log(` β’ ${step}`));
|
|
414
|
-
if (currentResult.failedSteps.length > 3) {
|
|
415
|
-
console.log(` ... and ${currentResult.failedSteps.length - 3} more`);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
486
|
+
**Then REFACTOR (quick pass, 5 min max):**
|
|
487
|
+
- Extract duplicated code
|
|
488
|
+
- Rename unclear variables
|
|
489
|
+
- Simplify complex expressions
|
|
490
|
+
- Remove dead code
|
|
418
491
|
|
|
419
|
-
|
|
420
|
-
}
|
|
492
|
+
**Re-run tests after refactor** to ensure nothing broke.
|
|
421
493
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
console.log(`\nβ οΈ Maximum iterations (${MAX_ITERATIONS}) reached without achieving GREEN`);
|
|
425
|
-
console.log(`Final progress: ${previousResult.passed}/${previousResult.total} steps passing`);
|
|
426
|
-
console.log(`\nConsider:`);
|
|
427
|
-
console.log(` β’ Breaking down the chore into smaller pieces`);
|
|
428
|
-
console.log(` β’ Reviewing the implementation approach`);
|
|
429
|
-
console.log(` β’ Checking for incorrect assumptions`);
|
|
430
|
-
}
|
|
431
|
-
```
|
|
494
|
+
<details>
|
|
495
|
+
<summary><strong>π TDD Loop Guidelines (click to expand)</strong></summary>
|
|
432
496
|
|
|
433
|
-
**
|
|
434
|
-
|
|
435
|
-
|
|
497
|
+
**Iteration strategy:**
|
|
498
|
+
- Start with first failing step
|
|
499
|
+
- Make minimal change to pass that step
|
|
500
|
+
- Run tests immediately
|
|
501
|
+
- Move to next failure
|
|
436
502
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
503
|
+
**If stuck after 5 iterations:**
|
|
504
|
+
- Review approach - is there a simpler path?
|
|
505
|
+
- Check assumptions - are you solving the right problem?
|
|
506
|
+
- Break down the change - can you make smaller steps?
|
|
440
507
|
|
|
441
|
-
|
|
508
|
+
**Max 10 iterations:**
|
|
509
|
+
- If you hit max without GREEN, stop
|
|
510
|
+
- Display final progress and suggest next steps
|
|
511
|
+
- Consider breaking chore into smaller pieces
|
|
442
512
|
|
|
443
|
-
|
|
513
|
+
</details>
|
|
444
514
|
|
|
445
|
-
|
|
446
|
-
β’ Given a user is logged in
|
|
447
|
-
β’ When they click the dashboard button
|
|
515
|
+
---
|
|
448
516
|
|
|
449
|
-
|
|
450
|
-
Step: Then they should see their dashboard
|
|
451
|
-
Error: Cannot read property 'innerText' of null
|
|
452
|
-
Stack: at Dashboard.render (src/dashboard.js:12:15)
|
|
517
|
+
**CRITICAL: Check if ALL speed mode chores are complete. Stable mode transition happens ONLY after all speed chores are done.**
|
|
453
518
|
|
|
454
|
-
|
|
519
|
+
<!-- βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
520
|
+
β π COMPLETION CHECK: Speed Chores β
|
|
521
|
+
β β
|
|
522
|
+
β Progress Tracking: β
|
|
523
|
+
β β’ Query: Count incomplete speed chores for feature β
|
|
524
|
+
β β’ Display: "X speed mode chores remaining" or "All complete" β
|
|
525
|
+
β β’ Action: Generate stable scenarios/steps/chores if all complete β
|
|
526
|
+
β β
|
|
527
|
+
β Return Point: β
|
|
528
|
+
β β’ CHECKPOINT_CHORE_COUNT: Known incomplete count from last check β
|
|
529
|
+
β β’ If session interrupted, re-query to get current count β
|
|
530
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -->
|
|
455
531
|
|
|
456
|
-
|
|
457
|
-
Created src/dashboard.js
|
|
458
|
-
Modified src/app.js
|
|
532
|
+
**Check for incomplete speed chores:**
|
|
459
533
|
|
|
460
|
-
|
|
534
|
+
```bash
|
|
535
|
+
# Get current work to find parent feature ID
|
|
536
|
+
sqlite3 .jettypod/work.db "SELECT wi.parent_id FROM work_items wi WHERE wi.status = 'in_progress'"
|
|
461
537
|
|
|
462
|
-
|
|
538
|
+
# Get list of remaining speed chores (excluding current chore)
|
|
539
|
+
sqlite3 .jettypod/work.db "SELECT id, title FROM work_items WHERE parent_id = <feature-id> AND type = 'chore' AND mode = 'speed' AND status != 'done' AND id != <current-chore-id> ORDER BY created_at LIMIT 1"
|
|
540
|
+
```
|
|
463
541
|
|
|
464
|
-
|
|
465
|
-
β’ Then they should see their dashboard
|
|
466
|
-
β’ And the dashboard should show their username
|
|
467
|
-
β’ And the dashboard should show their recent activity
|
|
542
|
+
**If speed chores remain, display and start next chore:**
|
|
468
543
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
544
|
+
```
|
|
545
|
+
ββββββββββββββββββββββββββββββββββββββββββ
|
|
546
|
+
π― Speed Mode Chore Complete
|
|
547
|
+
ββββββββββββββββββββββββββββββββββββββββββ
|
|
472
548
|
|
|
473
|
-
|
|
549
|
+
β
Success scenarios pass for this chore
|
|
474
550
|
|
|
475
|
-
|
|
476
|
-
|
|
551
|
+
More speed mode chores remain. Starting next chore:
|
|
552
|
+
#[next-chore-id]: [next-chore-title]
|
|
553
|
+
```
|
|
477
554
|
|
|
478
|
-
|
|
555
|
+
**Then immediately merge current chore and start next:**
|
|
479
556
|
|
|
480
|
-
|
|
557
|
+
```bash
|
|
558
|
+
# Commit changes in the worktree
|
|
559
|
+
git add . && git commit -m "feat: [brief description of what was implemented]"
|
|
481
560
|
|
|
482
|
-
|
|
483
|
-
|
|
561
|
+
# Merge current chore - this automatically marks it as done
|
|
562
|
+
jettypod work merge
|
|
484
563
|
|
|
485
|
-
|
|
564
|
+
# Start next speed chore
|
|
565
|
+
jettypod work start [next-chore-id]
|
|
486
566
|
```
|
|
487
567
|
|
|
488
|
-
**
|
|
489
|
-
-
|
|
490
|
-
-
|
|
491
|
-
-
|
|
492
|
-
-
|
|
493
|
-
- **Use real infrastructure** - actual database/storage from your tech stack
|
|
494
|
-
- **Inline code over separate modules** - keep it simple
|
|
495
|
-
- **Focus: Make. All. Features. Work.** (on the happy path)
|
|
568
|
+
**CRITICAL: Use ONLY `jettypod work merge` to complete chores.**
|
|
569
|
+
- β DO NOT use `jettypod work status <id> done`
|
|
570
|
+
- β DO NOT use `jettypod work complete <id>`
|
|
571
|
+
- β DO NOT use `jettypod work set-mode <id> done`
|
|
572
|
+
- β
ONLY use `jettypod work merge`
|
|
496
573
|
|
|
497
|
-
|
|
574
|
+
The merge command handles everything: pushes branch, merges to main, marks chore done, cleans up worktree.
|
|
498
575
|
|
|
499
|
-
|
|
576
|
+
The speed-mode skill will automatically re-invoke for the next chore.
|
|
500
577
|
|
|
501
|
-
|
|
502
|
-
2. **Rename unclear variables** - make intent obvious
|
|
503
|
-
3. **Simplify complex expressions** - break into readable steps
|
|
504
|
-
4. **Remove dead code** - delete unused variables/functions
|
|
578
|
+
**If all speed chores are done (count = 0), continue to Step 6 below.**
|
|
505
579
|
|
|
506
|
-
|
|
580
|
+
---
|
|
507
581
|
|
|
508
|
-
|
|
582
|
+
### Step 6: Transition to Stable Mode (After All Speed Chores Complete)
|
|
509
583
|
|
|
510
|
-
|
|
511
|
-
const result = await runBddScenarioWithTimeout(feature.scenario_file, scenarioLine);
|
|
512
|
-
if (result.exitCode !== 0) {
|
|
513
|
-
console.log('β οΈ Refactoring broke tests - revert and try again');
|
|
514
|
-
}
|
|
515
|
-
```
|
|
584
|
+
**β‘ ASYNC BOUNDARY - Must wait for user to confirm proposed scenarios/chores**
|
|
516
585
|
|
|
517
|
-
**
|
|
586
|
+
**CRITICAL:** This step ONLY runs after ALL speed chores are complete. This is the transition from speed mode to stable mode.
|
|
518
587
|
|
|
519
|
-
|
|
588
|
+
**Workflow: Merge last chore β Generate scenarios β Generate step definitions β Propose chores β Commit BDD files β Create chores β Set mode to stable β Invoke stable-mode skill**
|
|
520
589
|
|
|
521
|
-
|
|
522
|
-
// After iteration loop succeeds (GREEN achieved)
|
|
523
|
-
if (currentResult.exitCode === 0 || currentResult.passed === currentResult.total) {
|
|
524
|
-
console.log(`\nπ GREEN: Happy path scenario passing!`);
|
|
525
|
-
console.log(`\nπ Running full verification (all scenarios)...`);
|
|
526
|
-
|
|
527
|
-
// Run entire feature file once for regression detection
|
|
528
|
-
// Uses the already imported runBddScenarioWithTimeout with no line number to run all scenarios
|
|
529
|
-
const fullResult = await runBddScenarioWithTimeout(feature.scenario_file);
|
|
530
|
-
|
|
531
|
-
if (fullResult.timedOut) {
|
|
532
|
-
console.log(`β οΈ Full verification timed out`);
|
|
533
|
-
} else if (fullResult.exitCode !== 0) {
|
|
534
|
-
const fullProgress = parseTestProgress(fullResult.stdout + fullResult.stderr);
|
|
535
|
-
console.log(`β οΈ Full verification found regressions: ${fullProgress.total - fullProgress.passed} scenarios failing`);
|
|
536
|
-
console.log(`This is expected in speed mode - stable mode will address additional scenarios.`);
|
|
537
|
-
} else {
|
|
538
|
-
console.log(`β
Full verification passed - all scenarios passing!`);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
Display comprehensive results:
|
|
590
|
+
#### Phase 1: Merge Final Speed Chore
|
|
544
591
|
|
|
545
|
-
**
|
|
592
|
+
**Complete the current (final) speed chore:**
|
|
546
593
|
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
const filesModified = [/* list of modified files */];
|
|
594
|
+
```bash
|
|
595
|
+
# Commit changes in the worktree
|
|
596
|
+
git add . && git commit -m "feat: [brief description of what was implemented]"
|
|
551
597
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
598
|
+
# Merge to main with lock held for transition phase
|
|
599
|
+
# This prevents race conditions when multiple instances generate BDD files simultaneously
|
|
600
|
+
jettypod work merge --with-transition
|
|
601
|
+
```
|
|
555
602
|
|
|
556
|
-
|
|
603
|
+
<details>
|
|
604
|
+
<summary>π‘ Why --with-transition? (click to expand)</summary>
|
|
557
605
|
|
|
558
|
-
|
|
559
|
-
console.log(` Iterations: ${iteration}/${MAX_ITERATIONS}`);
|
|
560
|
-
console.log(` Test steps: ${currentResult.passed}/${currentResult.total} passing\n`);
|
|
606
|
+
The `--with-transition` flag holds the merge lock through the entire BDD generation phase (Phases 2-6).
|
|
561
607
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
608
|
+
**Without this flag:**
|
|
609
|
+
- Instance A merges β generates BDD β appends to step_definitions/auth.steps.js
|
|
610
|
+
- Instance B merges β generates BDD β appends to step_definitions/auth.steps.js (CONFLICT!)
|
|
611
|
+
- Second write can overwrite first write, losing step definitions
|
|
567
612
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
613
|
+
**With this flag:**
|
|
614
|
+
- Instance A acquires lock β merges β generates BDD β commits β releases lock
|
|
615
|
+
- Instance B waits β acquires lock β merges β generates BDD β commits β releases lock
|
|
616
|
+
- No conflicts, all step definitions preserved
|
|
573
617
|
|
|
574
|
-
|
|
575
|
-
|
|
618
|
+
You'll release the lock in Phase 6 after committing BDD files.
|
|
619
|
+
</details>
|
|
576
620
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
621
|
+
**CRITICAL: Use ONLY `jettypod work merge` to complete chores.**
|
|
622
|
+
- β DO NOT use `jettypod work status <id> done`
|
|
623
|
+
- β DO NOT use `jettypod work complete <id>`
|
|
624
|
+
- β DO NOT use `jettypod work set-mode <id> done`
|
|
625
|
+
- β
ONLY use `jettypod work merge`
|
|
581
626
|
|
|
582
|
-
|
|
583
|
-
it('should handle valid input successfully', () => {
|
|
584
|
-
// Arrange
|
|
585
|
-
const input = validTestData;
|
|
627
|
+
After merge, you are now on main branch. Ready to generate stable mode scenarios.
|
|
586
628
|
|
|
587
|
-
|
|
588
|
-
const result = functionName(input);
|
|
629
|
+
#### Phase 2: Generate Stable Mode BDD Scenarios
|
|
589
630
|
|
|
590
|
-
|
|
591
|
-
expect(result).toEqual(expectedOutput);
|
|
592
|
-
});
|
|
593
|
-
});
|
|
594
|
-
*/
|
|
631
|
+
**Your task:** Create BDD scenarios for error handling, edge cases, and validation.
|
|
595
632
|
|
|
596
|
-
|
|
597
|
-
// - Happy path with valid input
|
|
598
|
-
// - One successful operation per function
|
|
599
|
-
// - Basic return value verification
|
|
633
|
+
**Read the feature's existing scenario file:**
|
|
600
634
|
|
|
601
|
-
|
|
635
|
+
```bash
|
|
636
|
+
# Find the feature's scenario file
|
|
637
|
+
sqlite3 .jettypod/work.db "SELECT id, title FROM work_items WHERE id = <feature-id>"
|
|
638
|
+
# Look for: features/bdd/<epic-slug>/<feature-slug>.feature
|
|
602
639
|
```
|
|
603
640
|
|
|
604
|
-
**
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
641
|
+
**Analysis checklist for new scenarios:**
|
|
642
|
+
|
|
643
|
+
1. **Error scenarios** - What can go wrong?
|
|
644
|
+
- Invalid user input (wrong types, out of range, malformed data)
|
|
645
|
+
- Missing required parameters
|
|
646
|
+
- System errors (file not found, network errors, database errors)
|
|
647
|
+
- Permission/authorization failures
|
|
648
|
+
|
|
649
|
+
2. **Edge case scenarios** - Boundary conditions
|
|
650
|
+
- Empty inputs (empty strings, empty arrays, null values)
|
|
651
|
+
- Maximum values (large numbers, long strings, many items)
|
|
652
|
+
- Minimum values (zero, negative numbers)
|
|
653
|
+
- Special characters and Unicode
|
|
609
654
|
|
|
610
|
-
|
|
655
|
+
3. **State consistency scenarios** - Data integrity
|
|
656
|
+
- Concurrent operations (race conditions)
|
|
657
|
+
- Partial failures (transaction rollbacks)
|
|
658
|
+
- State transitions (invalid state changes)
|
|
611
659
|
|
|
612
|
-
|
|
613
|
-
Iterations: 3/10
|
|
614
|
-
Test steps: 8/8 passing
|
|
660
|
+
**Generate stable scenarios and append to feature file:**
|
|
615
661
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
662
|
+
```gherkin
|
|
663
|
+
Scenario: Handle missing required parameter
|
|
664
|
+
Given the system is initialized
|
|
665
|
+
When I call the function with missing "name" parameter
|
|
666
|
+
Then it should throw a validation error
|
|
667
|
+
And the error message should be "Parameter 'name' is required"
|
|
619
668
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
669
|
+
Scenario: Handle empty input
|
|
670
|
+
Given the system is initialized
|
|
671
|
+
When I provide an empty string as input
|
|
672
|
+
Then it should return an appropriate error
|
|
673
|
+
And the error code should be "INVALID_INPUT"
|
|
623
674
|
|
|
624
|
-
|
|
625
|
-
|
|
675
|
+
Scenario: Handle maximum boundary value
|
|
676
|
+
Given the system is initialized
|
|
677
|
+
When I provide the maximum allowed value
|
|
678
|
+
Then it should process successfully
|
|
679
|
+
And return the expected result
|
|
626
680
|
```
|
|
627
681
|
|
|
628
|
-
**
|
|
682
|
+
**Append scenarios to the feature file** (don't overwrite existing speed scenarios):
|
|
629
683
|
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
console.log(`β οΈ SPEED MODE INCOMPLETE - STILL IN RED STATE`);
|
|
634
|
-
console.log(`ββββββββββββββββββββββββββββββββββββββββββ\n`);
|
|
635
|
-
|
|
636
|
-
// --- Handle timeout case ---
|
|
637
|
-
if (result.timedOut) {
|
|
638
|
-
console.log(`β Test execution timed out`);
|
|
639
|
-
console.log(`\nPossible causes:`);
|
|
640
|
-
console.log(` β’ Infinite loop in implementation code`);
|
|
641
|
-
console.log(` β’ Test is waiting for async operation that never completes`);
|
|
642
|
-
console.log(` β’ Step definition has blocking code`);
|
|
643
|
-
} else {
|
|
644
|
-
// --- Handle max iterations case ---
|
|
645
|
-
console.log(`β Maximum iterations (${MAX_ITERATIONS}) reached\n`);
|
|
646
|
-
console.log(`Final Progress: ${previousResult.passed}/${previousResult.total} steps passing\n`);
|
|
647
|
-
|
|
648
|
-
// --- Display failing steps ---
|
|
649
|
-
if (previousResult.failedSteps.length > 0) {
|
|
650
|
-
console.log(`Still failing:`);
|
|
651
|
-
previousResult.failedSteps.forEach(step => console.log(` β ${step}`));
|
|
652
|
-
console.log();
|
|
653
|
-
}
|
|
684
|
+
```bash
|
|
685
|
+
# Append to existing .feature file
|
|
686
|
+
cat >> features/bdd/<epic-slug>/<feature-slug>.feature << 'EOF'
|
|
654
687
|
|
|
655
|
-
|
|
656
|
-
const errors = extractErrors(result.stdout + result.stderr);
|
|
657
|
-
if (errors.errors.length > 0) {
|
|
658
|
-
console.log(`Remaining errors:`);
|
|
659
|
-
errors.errors.slice(0, 3).forEach(err => {
|
|
660
|
-
console.log(` Step: ${err.step}`);
|
|
661
|
-
console.log(` Error: ${err.message}\n`);
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
}
|
|
688
|
+
# Stable Mode Scenarios - Error Handling and Edge Cases
|
|
665
689
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
console.log(` β’ Consider breaking this chore into smaller pieces`);
|
|
671
|
-
console.log(` β’ Verify step definitions match what implementation provides`);
|
|
672
|
-
console.log(`\nDO NOT proceed to generate stable mode chores until GREEN is achieved.`);
|
|
673
|
-
```
|
|
690
|
+
Scenario: [Title]
|
|
691
|
+
Given [context]
|
|
692
|
+
When [action]
|
|
693
|
+
Then [expected behavior]
|
|
674
694
|
|
|
675
|
-
|
|
695
|
+
Scenario: [Title]
|
|
696
|
+
Given [context]
|
|
697
|
+
When [action]
|
|
698
|
+
Then [expected behavior]
|
|
699
|
+
EOF
|
|
676
700
|
```
|
|
677
|
-
ββββββββββββββββββββββββββββββββββββββββββ
|
|
678
|
-
β οΈ SPEED MODE INCOMPLETE - STILL IN RED STATE
|
|
679
|
-
ββββββββββββββββββββββββββββββββββββββββββ
|
|
680
|
-
|
|
681
|
-
β Maximum iterations (10) reached
|
|
682
701
|
|
|
683
|
-
|
|
702
|
+
#### Phase 3: Generate Stable Mode Step Definitions
|
|
684
703
|
|
|
685
|
-
|
|
686
|
-
β Then they should see their dashboard
|
|
687
|
-
β And the dashboard should show their username
|
|
688
|
-
β And the dashboard should show their recent activity
|
|
704
|
+
**Your task:** Create step definition files for the new stable scenarios.
|
|
689
705
|
|
|
690
|
-
|
|
691
|
-
Step: Then they should see their dashboard
|
|
692
|
-
Error: Cannot read property 'innerText' of null
|
|
706
|
+
**Identify new step definitions needed:**
|
|
693
707
|
|
|
694
|
-
|
|
695
|
-
|
|
708
|
+
1. Read the stable scenarios you just created
|
|
709
|
+
2. Extract unique Given/When/Then steps
|
|
710
|
+
3. Check if step definitions already exist in `features/bdd/<epic-slug>/steps/`
|
|
711
|
+
4. Create new step definition files for missing steps
|
|
696
712
|
|
|
697
|
-
|
|
698
|
-
β’ Review implementation approach - is it the right strategy?
|
|
699
|
-
β’ Check for incorrect assumptions about existing code
|
|
700
|
-
β’ Consider breaking this chore into smaller pieces
|
|
701
|
-
β’ Verify step definitions match what implementation provides
|
|
713
|
+
**Generate step definition files:**
|
|
702
714
|
|
|
703
|
-
|
|
704
|
-
|
|
715
|
+
```javascript
|
|
716
|
+
// features/bdd/<epic-slug>/steps/<feature-slug>-stable.steps.js
|
|
717
|
+
|
|
718
|
+
const { Given, When, Then } = require('@cucumber/cucumber');
|
|
719
|
+
const { expect } = require('chai');
|
|
720
|
+
|
|
721
|
+
// Error handling steps
|
|
722
|
+
When('I call the function with missing {string} parameter', async function(paramName) {
|
|
723
|
+
try {
|
|
724
|
+
// Implementation that calls function without parameter
|
|
725
|
+
this.error = null;
|
|
726
|
+
} catch (err) {
|
|
727
|
+
this.error = err;
|
|
728
|
+
}
|
|
729
|
+
});
|
|
705
730
|
|
|
706
|
-
|
|
731
|
+
Then('it should throw a validation error', function() {
|
|
732
|
+
expect(this.error).to.exist;
|
|
733
|
+
expect(this.error.name).to.equal('ValidationError');
|
|
734
|
+
});
|
|
707
735
|
|
|
708
|
-
|
|
736
|
+
Then('the error message should be {string}', function(expectedMessage) {
|
|
737
|
+
expect(this.error.message).to.equal(expectedMessage);
|
|
738
|
+
});
|
|
709
739
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
740
|
+
// Edge case steps
|
|
741
|
+
When('I provide an empty string as input', async function() {
|
|
742
|
+
this.result = await this.functionUnderTest('');
|
|
743
|
+
});
|
|
714
744
|
|
|
715
|
-
|
|
745
|
+
When('I provide the maximum allowed value', async function() {
|
|
746
|
+
this.result = await this.functionUnderTest(Number.MAX_SAFE_INTEGER);
|
|
747
|
+
});
|
|
748
|
+
```
|
|
716
749
|
|
|
717
|
-
**
|
|
750
|
+
**Create step definition files:**
|
|
718
751
|
|
|
719
|
-
|
|
752
|
+
```bash
|
|
753
|
+
# Create the step definition file
|
|
754
|
+
touch features/bdd/<epic-slug>/steps/<feature-slug>-stable.steps.js
|
|
755
|
+
# Write the step definitions to the file
|
|
756
|
+
```
|
|
720
757
|
|
|
721
|
-
#### Phase
|
|
758
|
+
#### Phase 4: Analyze Implementation and Propose Stable Mode Chores
|
|
722
759
|
|
|
723
|
-
**Your task:**
|
|
760
|
+
**Your task:** Based on the stable scenarios and step definitions, identify what needs to be implemented.
|
|
724
761
|
|
|
725
762
|
**Analysis checklist:**
|
|
726
763
|
|
|
727
764
|
1. **Error handling gaps**
|
|
728
|
-
- What
|
|
729
|
-
- What
|
|
730
|
-
- What
|
|
731
|
-
|
|
732
|
-
2. **Edge
|
|
733
|
-
-
|
|
734
|
-
-
|
|
735
|
-
-
|
|
736
|
-
|
|
737
|
-
3. **Non-happy-path scenarios**
|
|
738
|
-
- Read the full scenario file (not just happy path)
|
|
739
|
-
- Identify scenarios 2+ (error handling, edge cases)
|
|
740
|
-
- Check what additional behavior is needed
|
|
741
|
-
|
|
742
|
-
4. **Code quality needs**
|
|
743
|
-
- What needs better structure/organization?
|
|
744
|
-
- What needs proper error messages?
|
|
745
|
-
- What needs logging/debugging support?
|
|
765
|
+
- What validation needs to be added?
|
|
766
|
+
- What error types need to be thrown?
|
|
767
|
+
- What error messages need to be user-friendly?
|
|
768
|
+
|
|
769
|
+
2. **Edge case handling**
|
|
770
|
+
- What boundary checks are needed?
|
|
771
|
+
- What null/undefined checks are missing?
|
|
772
|
+
- What type validation is needed?
|
|
746
773
|
|
|
747
|
-
|
|
774
|
+
3. **Code that needs refactoring**
|
|
775
|
+
- What needs better structure for error handling?
|
|
776
|
+
- What needs logging/debugging support?
|
|
777
|
+
- What needs better separation of concerns?
|
|
748
778
|
|
|
749
779
|
**Present your analysis:**
|
|
750
780
|
|
|
751
781
|
```
|
|
752
782
|
π Stable Mode Chores Proposal
|
|
753
783
|
|
|
754
|
-
I've
|
|
784
|
+
I've generated [N] stable mode scenarios covering error handling and edge cases.
|
|
785
|
+
I've created step definitions for these scenarios.
|
|
786
|
+
|
|
787
|
+
Here are the chores needed to make these scenarios pass:
|
|
755
788
|
|
|
756
789
|
**Chore 1: [Title]**
|
|
757
790
|
- Why: [What gap this fills]
|
|
758
791
|
- Scope: [What specifically needs to be done]
|
|
759
|
-
-
|
|
792
|
+
- Scenarios: [Which BDD scenarios this addresses]
|
|
760
793
|
|
|
761
794
|
**Chore 2: [Title]**
|
|
762
795
|
- Why: [What gap this fills]
|
|
763
796
|
- Scope: [What specifically needs to be done]
|
|
764
|
-
-
|
|
797
|
+
- Scenarios: [Which BDD scenarios this addresses]
|
|
765
798
|
|
|
766
799
|
**Chore 3: [Title]**
|
|
767
800
|
- Why: [What gap this fills]
|
|
768
801
|
- Scope: [What specifically needs to be done]
|
|
769
|
-
-
|
|
802
|
+
- Scenarios: [Which BDD scenarios this addresses]
|
|
770
803
|
|
|
771
|
-
These chores will make all
|
|
804
|
+
These chores will make all stable mode scenarios pass with proper error handling and edge case coverage.
|
|
772
805
|
|
|
773
806
|
Sound good? I'll create these chores once you confirm.
|
|
774
807
|
```
|
|
@@ -777,12 +810,7 @@ Sound good? I'll create these chores once you confirm.
|
|
|
777
810
|
|
|
778
811
|
If user adjusts: revise chores and confirm again.
|
|
779
812
|
|
|
780
|
-
|
|
781
|
-
PHASE 5: AUTONOMOUS COMPLETION
|
|
782
|
-
User has confirmed chores - create them and finalize
|
|
783
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -->
|
|
784
|
-
|
|
785
|
-
#### Phase 3: Create Chores Autonomously
|
|
813
|
+
#### Phase 5: Create Chores Autonomously
|
|
786
814
|
|
|
787
815
|
**CRITICAL:** After user confirms, create chores programmatically - no additional permission needed.
|
|
788
816
|
|
|
@@ -790,7 +818,7 @@ If user adjusts: revise chores and confirm again.
|
|
|
790
818
|
|
|
791
819
|
```javascript
|
|
792
820
|
const { create } = require('./features/work-tracking');
|
|
793
|
-
const { getCurrentWork } = require('
|
|
821
|
+
const { getCurrentWork } = require('./lib/current-work');
|
|
794
822
|
|
|
795
823
|
(async () => {
|
|
796
824
|
const currentWork = await getCurrentWork();
|
|
@@ -812,46 +840,47 @@ Chores created:
|
|
|
812
840
|
β’ #[ID]: [Title]
|
|
813
841
|
```
|
|
814
842
|
|
|
815
|
-
#### Phase
|
|
843
|
+
#### Phase 6: Commit Stable Mode Scenarios and Steps to Main
|
|
816
844
|
|
|
817
|
-
**CRITICAL:
|
|
845
|
+
**CRITICAL: Commit the BDD files to main BEFORE starting stable chores.**
|
|
818
846
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
β β’ Display: "X speed mode chores remaining" or "All complete" β
|
|
825
|
-
β β’ Action: Auto-elevate if all complete β
|
|
826
|
-
β β
|
|
827
|
-
β Return Point: β
|
|
828
|
-
β β’ CHECKPOINT_CHORE_COUNT: Known incomplete count from last check β
|
|
829
|
-
β β’ If session interrupted, re-query to get current count β
|
|
830
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -->
|
|
847
|
+
```bash
|
|
848
|
+
# You're currently on main after merging the last speed chore
|
|
849
|
+
# Commit the stable mode scenarios and step definitions
|
|
850
|
+
git add features/
|
|
851
|
+
git commit -m "test: Add stable mode BDD scenarios and step definitions
|
|
831
852
|
|
|
832
|
-
|
|
853
|
+
Added error handling and edge case scenarios for stable mode implementation.
|
|
833
854
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
jettypod work current
|
|
855
|
+
- [N] new stable mode scenarios
|
|
856
|
+
- Step definitions for validation, error handling, and edge cases"
|
|
837
857
|
|
|
838
|
-
#
|
|
839
|
-
|
|
858
|
+
# Push to remote
|
|
859
|
+
git push
|
|
860
|
+
|
|
861
|
+
# Release the merge lock (held since Phase 1)
|
|
862
|
+
jettypod work merge --release-lock
|
|
840
863
|
```
|
|
841
864
|
|
|
842
|
-
|
|
865
|
+
This ensures stable mode BDD files are in main and will be present in stable chore worktrees.
|
|
866
|
+
|
|
867
|
+
The merge lock is now released - other instances can proceed with their transitions.
|
|
868
|
+
|
|
869
|
+
#### Phase 7: Set Feature Mode to Stable
|
|
870
|
+
|
|
871
|
+
**Set the feature mode:**
|
|
843
872
|
|
|
844
873
|
```bash
|
|
845
874
|
jettypod work set-mode <feature-id> stable
|
|
846
875
|
```
|
|
847
876
|
|
|
848
|
-
|
|
877
|
+
#### Phase 8: Invoke Stable Mode Skill
|
|
849
878
|
|
|
850
|
-
|
|
879
|
+
**CRITICAL: Immediately transition to stable-mode skill to start implementing stable chores.**
|
|
851
880
|
|
|
852
881
|
```
|
|
853
882
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
854
|
-
π― Speed Mode Complete!
|
|
883
|
+
π― Speed Mode Complete! Transitioning to Stable Mode
|
|
855
884
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
856
885
|
|
|
857
886
|
β οΈ CRITICAL: Speed mode is ONLY a checkpoint to prove functionality works.
|
|
@@ -859,56 +888,35 @@ The feature is INCOMPLETE without stable mode - error handling, validation,
|
|
|
859
888
|
edge cases, and comprehensive testing are ALL required.
|
|
860
889
|
|
|
861
890
|
What we accomplished:
|
|
862
|
-
β
Happy path scenario passes
|
|
863
891
|
β
All speed mode chores complete
|
|
864
|
-
β
|
|
865
|
-
β
|
|
892
|
+
β
Generated [N] stable mode BDD scenarios
|
|
893
|
+
β
Created step definitions for stable scenarios
|
|
894
|
+
β
Created [N] stable mode chores
|
|
895
|
+
β
Feature mode set to stable
|
|
866
896
|
|
|
867
|
-
π NEVER leave a feature in speed mode
|
|
897
|
+
π NEVER leave a feature in speed mode.
|
|
868
898
|
Stable mode adds:
|
|
869
899
|
β’ Comprehensive error handling and user-friendly error messages
|
|
870
900
|
β’ Input validation (null checks, type checks, range validation)
|
|
871
901
|
β’ Edge case handling (empty arrays, boundary values, race conditions)
|
|
872
902
|
β’ State consistency and data integrity
|
|
873
|
-
β’ All BDD scenarios passing (
|
|
874
|
-
|
|
875
|
-
**Next step:** IMMEDIATELY start the first stable mode chore
|
|
876
|
-
jettypod work start [first-stable-chore-id]
|
|
877
|
-
```
|
|
878
|
-
|
|
879
|
-
**If speed chores remain, display:**
|
|
903
|
+
β’ All BDD scenarios passing (success scenarios + error/edge cases)
|
|
880
904
|
|
|
905
|
+
**Next step:** I'm now invoking the stable-mode skill to start implementing the first stable chore.
|
|
881
906
|
```
|
|
882
|
-
ββββββββββββββββββββββββββββββββββββββββββ
|
|
883
|
-
π― Speed Mode Chore Done - Stable Chores Created
|
|
884
|
-
ββββββββββββββββββββββββββββββββββββββββββ
|
|
885
|
-
|
|
886
|
-
What we accomplished:
|
|
887
|
-
β
Happy path scenario passes for this chore
|
|
888
|
-
β
Stable mode chores created for when speed mode finishes
|
|
889
907
|
|
|
890
|
-
|
|
908
|
+
**Invoke the stable-mode skill:**
|
|
891
909
|
|
|
892
|
-
|
|
893
|
-
You can take a break here - stable mode chores exist and work can resume.
|
|
910
|
+
Use the Skill tool to automatically transition to stable mode implementation:
|
|
894
911
|
|
|
895
|
-
**Next step:** Continue with next speed mode chore
|
|
896
|
-
jettypod work start [next-speed-chore-id]
|
|
897
912
|
```
|
|
898
|
-
|
|
899
|
-
**Mark current chore as done:**
|
|
900
|
-
|
|
901
|
-
Use Bash tool to commit and push:
|
|
902
|
-
```bash
|
|
903
|
-
git add . && git commit -m "feat: [brief description of what was implemented]" && git push
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
Then use the merge command to merge to main (which auto-marks chore as done via post-merge hook):
|
|
907
|
-
```bash
|
|
908
|
-
jettypod work merge
|
|
913
|
+
Skill tool with skill="stable-mode"
|
|
909
914
|
```
|
|
910
915
|
|
|
911
|
-
The
|
|
916
|
+
The stable-mode skill will:
|
|
917
|
+
1. Start the first stable chore automatically
|
|
918
|
+
2. Guide implementation to make stable scenarios pass
|
|
919
|
+
3. Continue with remaining stable chores
|
|
912
920
|
|
|
913
|
-
**End skill.**
|
|
921
|
+
**End speed-mode skill.**
|
|
914
922
|
|