jettypod 4.1.2 → 4.1.4

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 (179) hide show
  1. package/.nvmrc +1 -0
  2. package/docs/COMPLETE-TESTING-STRATEGY.md +970 -0
  3. package/docs/DECISIONS.md +10 -12
  4. package/docs/NODE_VERSION.md +83 -0
  5. package/docs/TDD-INFRASTRUCTURE-STRATEGY.md +1374 -0
  6. package/docs/TESTING-FOR-NON-ENGINEERS.md +1588 -0
  7. package/docs/TESTING-STRATEGY-AUDIT.md +698 -0
  8. package/hooks/post-checkout +17 -0
  9. package/hooks/post-merge +17 -0
  10. package/hooks/pre-commit +30 -0
  11. package/jettypod.js +259 -120
  12. package/lib/coverage-tracker.js +218 -0
  13. package/lib/database.js +2 -0
  14. package/lib/db-export.js +192 -0
  15. package/lib/db-import.js +193 -0
  16. package/lib/external-transition-handler.js +32 -0
  17. package/lib/git-hook-helpers.js +174 -0
  18. package/lib/git-root.js +90 -0
  19. package/lib/infrastructure-chore-generator.js +45 -0
  20. package/lib/install-hooks.js +52 -0
  21. package/lib/jettypod-backup.js +238 -0
  22. package/lib/merge-lock.js +193 -0
  23. package/lib/migrations/012-add-worktree-path.js +38 -0
  24. package/lib/migrations/013-worktrees-table.js +86 -0
  25. package/lib/migrations/014-migrate-worktree-data.js +161 -0
  26. package/lib/migrations/015-merge-locks-table.js +67 -0
  27. package/lib/pattern-finder.js +152 -0
  28. package/lib/process-manager.js +140 -0
  29. package/lib/production-standards-reader.js +13 -2
  30. package/lib/production-standards-writer.js +85 -0
  31. package/lib/skills/feature-planning/dry-run-validator.js +135 -0
  32. package/lib/skills/feature-planning/validation-formatter.js +160 -0
  33. package/lib/smart-conflict-detection.js +168 -0
  34. package/lib/smart-fetch-rebase.js +614 -0
  35. package/lib/step-definition-parser.js +76 -0
  36. package/lib/unit-test-generator.js +232 -0
  37. package/lib/verification-command-generator.js +66 -0
  38. package/lib/worktree-diagnostics.js +413 -0
  39. package/lib/worktree-facade.js +174 -0
  40. package/lib/worktree-manager.js +636 -0
  41. package/lib/worktree-reconciler.js +429 -0
  42. package/package.json +30 -3
  43. package/skills-templates/external-transition/SKILL.md +34 -3
  44. package/skills-templates/feature-planning/SKILL.md +190 -24
  45. package/skills-templates/production-mode/SKILL.md +127 -9
  46. package/skills-templates/speed-mode/SKILL.md +454 -51
  47. package/skills-templates/stable-mode/SKILL.md +285 -76
  48. package/.claude/PROTECT_SKILLS.md +0 -28
  49. package/.claude/settings.json +0 -24
  50. package/.claude/settings.local.json +0 -16
  51. package/.claude/skills/epic-planning/SKILL.md +0 -297
  52. package/.claude/skills/external-transition/SKILL.md +0 -384
  53. package/.claude/skills/feature-planning/SKILL.md +0 -464
  54. package/.claude/skills/production-mode/SKILL.md +0 -369
  55. package/.claude/skills/speed-mode/SKILL.md +0 -481
  56. package/.claude/skills/stable-mode/SKILL.md +0 -713
  57. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/epic-planning/SKILL.md +0 -297
  58. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/feature-planning/SKILL.md +0 -464
  59. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/speed-mode/SKILL.md +0 -467
  60. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/stable-mode/SKILL.md +0 -673
  61. package/.claude/skills.backup-2025-11-11T16-15-10-070Z/epic-discover/SKILL.md +0 -297
  62. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/epic-planning/SKILL.md +0 -297
  63. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/feature-planning/SKILL.md +0 -464
  64. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/speed-mode/SKILL.md +0 -467
  65. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/stable-mode/SKILL.md +0 -673
  66. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/epic-planning/SKILL.md +0 -297
  67. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/feature-planning/SKILL.md +0 -464
  68. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/speed-mode/SKILL.md +0 -467
  69. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/stable-mode/SKILL.md +0 -673
  70. package/.devpod/current-work.json +0 -10
  71. package/.devpod/work.db +0 -0
  72. package/.github/workflows/test-safety.yml +0 -85
  73. package/.jettypod/config.json +0 -5
  74. package/.jettypod/current-work.json +0 -10
  75. package/.jettypod/hooks/README.md +0 -77
  76. package/.jettypod/hooks/protect-claude-md.js +0 -338
  77. package/.jettypod/test-work.db +0 -0
  78. package/.jettypod/work.db +0 -0
  79. package/CLAUDE.md +0 -49
  80. package/SPEED-STABLE-AUDIT.md +0 -853
  81. package/SYSTEM-BEHAVIOR.md +0 -2199
  82. package/TEST_SAFETY_AUDIT.md +0 -314
  83. package/TEST_SAFETY_IMPLEMENTATION.md +0 -97
  84. package/cucumber-report.html +0 -45
  85. package/dist/devpod-linux +0 -0
  86. package/dist/devpod-macos +0 -0
  87. package/dist/devpod-win.exe +0 -0
  88. package/docs/features/jettypod-standards-explained.md +0 -543
  89. package/docs/features/standards-inventory.md +0 -257
  90. package/features/auto-generate-production-chores.feature +0 -13
  91. package/features/backlog-command.feature +0 -26
  92. package/features/backlog-filtering-production.feature +0 -10
  93. package/features/claude-md-protection/steps.js +0 -498
  94. package/features/decisions/index.js +0 -490
  95. package/features/decisions/index.test.js +0 -208
  96. package/features/fix-text-wrapping.feature +0 -42
  97. package/features/git-hooks/git-hooks.feature +0 -30
  98. package/features/git-hooks/index.js +0 -93
  99. package/features/git-hooks/index.test.js +0 -137
  100. package/features/git-hooks/post-commit +0 -56
  101. package/features/git-hooks/post-merge +0 -47
  102. package/features/git-hooks/pre-commit +0 -28
  103. package/features/git-hooks/simple-steps.js +0 -53
  104. package/features/git-hooks/simple-test.feature +0 -10
  105. package/features/git-hooks/steps.js +0 -196
  106. package/features/jettypod-update-command.feature +0 -46
  107. package/features/mode-prompts/index.js +0 -95
  108. package/features/mode-prompts/simple-steps.js +0 -44
  109. package/features/mode-prompts/simple-test.feature +0 -9
  110. package/features/mode-prompts/validation.test.js +0 -120
  111. package/features/multiple-claude-instances.feature +0 -121
  112. package/features/production-mode-skill.feature +0 -121
  113. package/features/refactor-mode/steps.js +0 -217
  114. package/features/refactor-mode.feature +0 -49
  115. package/features/simplify-external-transition.feature +0 -166
  116. package/features/skills-update/index.test.js +0 -216
  117. package/features/step_definitions/backlog-command.steps.js +0 -37
  118. package/features/step_definitions/fix-text-wrapping.steps.js +0 -271
  119. package/features/step_definitions/multiple-claude-instances.steps.js +0 -621
  120. package/features/step_definitions/production-mode-skill.steps.js +0 -862
  121. package/features/step_definitions/simplify-external-transition.steps.js +0 -370
  122. package/features/step_definitions/terminal-logo.steps.js +0 -145
  123. package/features/step_definitions/update-command.steps.js +0 -183
  124. package/features/support/hooks.js +0 -9
  125. package/features/terminal-logo/index.js +0 -39
  126. package/features/terminal-logo/terminal-logo.feature +0 -30
  127. package/features/update-command/index.js +0 -181
  128. package/features/update-command/index.test.js +0 -225
  129. package/features/work-commands/bug-workflow-display.feature +0 -22
  130. package/features/work-commands/index.js +0 -498
  131. package/features/work-commands/simple-steps.js +0 -69
  132. package/features/work-commands/stable-tests.feature +0 -57
  133. package/features/work-commands/steps.js +0 -1174
  134. package/features/work-commands/validation.test.js +0 -88
  135. package/features/work-commands/work-commands.feature +0 -13
  136. package/features/work-tracking/discovery-validation.test.js +0 -228
  137. package/features/work-tracking/index.js +0 -1921
  138. package/features/work-tracking/mode-required.feature +0 -112
  139. package/features/work-tracking/phase-tracking.test.js +0 -482
  140. package/features/work-tracking/prototype-tracking.test.js +0 -485
  141. package/features/work-tracking/tree-view.test.js +0 -310
  142. package/features/work-tracking/work-set-mode.feature +0 -71
  143. package/features/work-tracking/work-start-mode.feature +0 -88
  144. package/full-test.txt +0 -0
  145. package/lib/bug-workflow.test.js +0 -177
  146. package/lib/claudemd.test.js +0 -195
  147. package/lib/config.test.js +0 -511
  148. package/lib/constants.test.js +0 -164
  149. package/lib/current-work.test.js +0 -146
  150. package/lib/database-project-config.test.js +0 -111
  151. package/lib/database.test.js +0 -106
  152. package/lib/decisions-generator.test.js +0 -457
  153. package/lib/decisions-helpers.test.js +0 -310
  154. package/lib/git-coordinator.js +0 -167
  155. package/lib/git.test.js +0 -145
  156. package/lib/migrations/002-default-work-item-modes.test.js +0 -351
  157. package/lib/production-chore-generator.test.js +0 -432
  158. package/lib/production-context-detector.test.js +0 -277
  159. package/lib/production-scenario-appender.test.js +0 -235
  160. package/lib/production-scenario-validator.test.js +0 -246
  161. package/lib/production-standards-reader.test.js +0 -270
  162. package/lib/project-state.test.js +0 -92
  163. package/lib/push-queue.js +0 -417
  164. package/lib/queue-processor.js +0 -74
  165. package/lib/test-helpers.js +0 -202
  166. package/lib/test-helpers.test.js +0 -255
  167. package/prototypes/2025-01-11-production-mode-autonomous.js +0 -119
  168. package/prototypes/2025-01-11-production-mode-collaborative.js +0 -166
  169. package/prototypes/2025-01-11-production-mode-guided.js +0 -217
  170. package/prototypes/2025-01-11-production-mode-smart-context.js +0 -347
  171. package/prototypes/2025-01-11-production-standards-example.md +0 -204
  172. package/prototypes/2025-11-10-backlog-filtering-tree-aware.js +0 -242
  173. package/prototypes/test/index.html +0 -1
  174. package/setup-dist-repo.sh +0 -68
  175. package/test-production-standards-engine.js +0 -130
  176. package/test-results.json +0 -2195
  177. package/test-safety-check.sh +0 -80
  178. package/work-item-tracking-plan.md +0 -199
  179. /package/{.jettypod/devpod.db → jettypod.db} +0 -0
@@ -13,24 +13,84 @@ When this skill is activated, you are helping implement a stable mode chore to a
13
13
 
14
14
  ### Overview
15
15
 
16
- **Stable Mode Goal:** Add error handling, validation, and edge case coverage to the speed mode implementation.
16
+ **Stable Mode Goal:** Transform speed mode's "prove it works" implementation into production-ready code with comprehensive robustness.
17
17
 
18
18
  **CRITICAL DISTINCTION:**
19
19
  - **Speed mode implemented ALL functionality** - every feature/function is already working on the happy path
20
- - **Stable mode adds robustness** - error handling, validation, edge cases, error messages
20
+ - **Stable mode adds COMPLETE robustness** - NOT just error handling, but comprehensive production readiness
21
+
22
+ **Stable Mode is NOT just error handling. It includes:**
23
+
24
+ 1. **Comprehensive Error Handling**
25
+ - Catch all failure modes (network errors, file system errors, database errors)
26
+ - User-friendly error messages that explain what went wrong
27
+ - Graceful degradation when things fail
28
+ - Proper error propagation vs. recovery
29
+
30
+ 2. **Input Validation**
31
+ - Null/undefined checks before using values
32
+ - Type validation (is this actually a number/string/object?)
33
+ - Range validation (min/max values, length limits)
34
+ - Format validation (email format, URL format, date format)
35
+ - Sanitization (prevent injection attacks, XSS)
36
+
37
+ 3. **Edge Case Handling**
38
+ - Empty arrays/objects/strings
39
+ - Missing or optional properties
40
+ - Boundary values (0, -1, MAX_INT, empty string)
41
+ - Concurrent access (race conditions, simultaneous operations)
42
+ - Resource limits (too many items, files too large)
43
+
44
+ 4. **State Consistency & Data Integrity**
45
+ - Transaction handling (all-or-nothing operations)
46
+ - Cleanup on failure (rollback partial changes)
47
+ - Prevent corrupted state
48
+ - Handle interrupted operations
49
+
50
+ 5. **All BDD Scenarios Pass**
51
+ - Happy path (already passing from speed mode)
52
+ - Error scenarios (how does it handle failures?)
53
+ - Edge case scenarios (boundary conditions, unusual inputs)
54
+ - Concurrent access scenarios (multiple instances)
21
55
 
22
56
  **Key Principles:**
23
- - **Build on speed implementation** - do not re-implement features, ADD to them
24
- - **Comprehensive error handling** - catch all failure modes, show clear error messages
25
- - **Input validation** - validate all inputs, handle edge cases (empty, null, max values, wrong types)
26
- - **Edge case coverage** - handle boundary conditions, race conditions, state consistency
27
- - **All BDD scenarios pass** - happy path AND error/edge case scenarios
57
+ - **Build on speed implementation** - do not re-implement features, ADD robustness to them
28
58
  - **Autonomous execution** - Claude Code writes code, user confirms approach
59
+ - **Quality focus** - code should be stable, maintainable, and production-ready
29
60
 
30
61
  **User Profile:** May not know how to code - Claude Code does the implementation autonomously.
31
62
 
32
63
  ---
33
64
 
65
+ ## ⚠️ CRITICAL: Stable Mode Workflow Requirements for External Products
66
+
67
+ **If the product is EXTERNAL (project_state: 'external'), DO NOT mark features as complete after stable mode.**
68
+
69
+ For external products accepting real users, stable mode is NOT the final step. Production mode is REQUIRED for:
70
+ - Performance optimization and load testing
71
+ - Security hardening (rate limiting, input sanitization, authentication)
72
+ - Monitoring and observability
73
+ - Operational readiness (logging, metrics, alerting)
74
+
75
+ **Required workflow for EXTERNAL products after stable mode implementation:**
76
+
77
+ 1. ✅ **Complete ALL stable mode chores** - Add error handling and edge cases
78
+ 2. ✅ **Generate production mode chores** - Use `jettypod work elevate <feature-id> production`
79
+ 3. ✅ **Implement production mode chores** - Add performance, security, monitoring
80
+ 4. ❌ **NEVER mark feature complete in stable mode for external products** - This bypasses critical production hardening
81
+
82
+ **For INTERNAL products (staging/preview only), stable mode IS the final step.**
83
+
84
+ **If you attempt to mark an external product feature complete while in stable mode, the system will block you with an error.**
85
+
86
+ The validation will require you to either:
87
+ - Generate production mode chores: `jettypod work elevate <feature-id> production`
88
+ - Or explicitly skip (not recommended): `jettypod work set-mode <feature-id> production --force`
89
+
90
+ **Remember:** Stable mode makes it robust. Production mode makes it ready for real users at scale.
91
+
92
+ ---
93
+
34
94
  ## Implementation Steps
35
95
 
36
96
  ### Step 0: Create Additional Scenarios (If First Stable Chore)
@@ -63,6 +123,12 @@ Scenario: [Edge case title]
63
123
  - Follow existing patterns from happy path steps
64
124
  - Include proper error assertions
65
125
 
126
+ **Update unit tests with edge cases:**
127
+ - Speed mode generated basic unit tests with TODO placeholders
128
+ - Stable mode should fill in edge case tests for error handling
129
+ - Add tests for: null/undefined inputs, invalid data, boundary conditions
130
+ - Use existing test files at `test/[path]/[file].test.js`
131
+
66
132
  **IMPORTANT:** Only do this ONCE per feature (first stable chore). Subsequent stable chores implement existing scenarios.
67
133
 
68
134
  ### Step 1: Analyze Scenario to Implement
@@ -431,11 +497,28 @@ If user adjusts: revise proposal and confirm again.
431
497
  **Execution loop (with iteration limits and error handling):**
432
498
 
433
499
  ```javascript
434
- const MAX_ITERATIONS = 10; // Prevent infinite loops
435
- const TEST_TIMEOUT = 60000; // 60 second timeout per test run
500
+ // Import test-runner utilities
501
+ const {
502
+ MAX_ITERATIONS,
503
+ TEST_TIMEOUT,
504
+ runBddTestWithTimeout,
505
+ runBddScenarioWithTimeout,
506
+ getScenarioLineByName,
507
+ parseTestProgress,
508
+ extractErrors,
509
+ findNewlyPassingSteps
510
+ } = require('../../.claude/skills/speed-mode/test-runner');
511
+
512
+ // Identify target scenario line from targetScenario.title
513
+ const scenarioLine = getScenarioLineByName(feature.scenario_file, targetScenario.title);
514
+ if (!scenarioLine) {
515
+ console.error('❌ Cannot find scenario line number for:', targetScenario.title);
516
+ return;
517
+ }
436
518
 
437
519
  let iteration = 0;
438
520
  let scenarioPasses = false;
521
+ let previousResult = null;
439
522
 
440
523
  while (!scenarioPasses && iteration < MAX_ITERATIONS) {
441
524
  iteration++;
@@ -453,73 +536,67 @@ while (!scenarioPasses && iteration < MAX_ITERATIONS) {
453
536
  continue;
454
537
  }
455
538
 
456
- // 2. Run tests with timeout
539
+ // 2. Run tests with timeout - only target scenario during iteration
457
540
  console.log('🧪 Running tests...');
458
541
 
459
- let testsPassed = false;
460
- try {
461
- const { exec } = require('child_process');
462
- const util = require('util');
463
- const execPromise = util.promisify(exec);
464
-
465
- const { stdout, stderr } = await execPromise('npm run test:bdd -- features/[feature-slug].feature', {
466
- timeout: TEST_TIMEOUT,
467
- killSignal: 'SIGTERM'
468
- });
469
-
470
- // Parse BDD test output to check if target scenario passes
471
- // Step definitions (created during feature discovery) execute your code
472
- const targetScenarioPassed = stdout.includes('[scenario-title]') && stdout.includes('✓');
473
-
474
- if (targetScenarioPassed) {
475
- console.log('✅ Target scenario passes!');
542
+ const result = await runBddScenarioWithTimeout(feature.scenario_file, scenarioLine, TEST_TIMEOUT);
476
543
 
477
- // Check if ALL scenarios still pass
478
- const allPass = !stdout.includes('✗') && !stdout.includes('failing');
544
+ // Check for timeout
545
+ if (result.timedOut) {
546
+ console.error('❌ Tests timed out after 60 seconds');
547
+ console.log('This might indicate an infinite loop or hung process.');
548
+ console.log('Suggestion: Check for blocking operations or missing async/await');
549
+ break;
550
+ }
479
551
 
480
- if (allPass) {
481
- console.log('✅ All scenarios still passing!');
482
- scenarioPasses = true;
483
- } else {
484
- console.log('⚠️ Target scenario passes but other scenarios broke.');
485
- console.log('Adjusting to fix regressions...');
486
- }
487
- } else {
488
- console.log('❌ Target scenario still failing');
552
+ // Parse results
553
+ const currentResult = parseTestProgress(result.stdout);
489
554
 
490
- // Extract failure reason from test output
491
- const failureMatch = stdout.match(/AssertionError: (.+)/);
492
- const failureReason = failureMatch ? failureMatch[1] : 'Unknown failure';
555
+ // Track progress
556
+ const newlyPassing = findNewlyPassingSteps(previousResult, currentResult);
493
557
 
494
- console.log(`Reason: ${failureReason}`);
495
- console.log('Analyzing and adjusting...');
496
- }
558
+ // Display progress
559
+ console.log(`\n📊 Progress: ${currentResult.passed}/${currentResult.total} steps passing`);
497
560
 
498
- } catch (testErr) {
499
- // Error handling: Test timeout
500
- if (testErr.killed && testErr.signal === 'SIGTERM') {
501
- console.error('❌ Tests timed out after 60 seconds');
502
- console.log('This might indicate an infinite loop or hung process.');
503
- console.log('Suggestion: Check for blocking operations or missing async/await');
561
+ if (newlyPassing.length > 0) {
562
+ console.log(`\n✅ Newly passing:`);
563
+ newlyPassing.forEach(step => console.log(` • ${step}`));
564
+ }
504
565
 
505
- // Ask user if they want to continue
506
- console.log('\n⚠️ Test timeout - continue trying? (yes/no)');
507
- // If no, break
508
- break;
566
+ // Check if target scenario passes
567
+ if (currentResult.passed === currentResult.total && currentResult.total > 0) {
568
+ console.log('\n✅ Target scenario passing!');
569
+
570
+ // Run full verification (all scenarios) once for regression detection
571
+ console.log('\n🔍 Running full verification (all scenarios)...');
572
+ const fullResult = await runBddTestWithTimeout(feature.scenario_file, TEST_TIMEOUT);
573
+
574
+ if (fullResult.timedOut) {
575
+ console.log('⚠️ Full verification timed out');
576
+ } else if (fullResult.exitCode !== 0) {
577
+ const fullProgress = parseTestProgress(fullResult.stdout + fullResult.stderr);
578
+ console.log(`⚠️ Full verification found regressions: ${fullProgress.total - fullProgress.passed} scenarios failing`);
579
+ console.log('Continuing iterations to fix regressions...');
580
+ scenarioPasses = false;
581
+ } else {
582
+ console.log('✅ Full verification passed - all scenarios passing!');
583
+ scenarioPasses = true;
509
584
  }
510
-
511
- // Error handling: Test execution errors
512
- console.error('❌ Test execution error:', testErr.message);
513
-
514
- // Check if it's a missing test file
515
- if (testErr.message.includes('No tests found') || testErr.message.includes('Cannot find module')) {
516
- console.error('Test file might not exist or is misconfigured.');
517
- console.log('Suggestion: Create the test file or check test configuration');
518
- break;
585
+ } else {
586
+ console.log(`\n❌ ${currentResult.total - currentResult.passed} scenarios still failing`);
587
+
588
+ // Extract and display errors
589
+ const errors = extractErrors(result.stdout + result.stderr);
590
+ if (errors.errors.length > 0) {
591
+ console.log('\n🔧 Next failure to address:');
592
+ const firstError = errors.errors[0];
593
+ console.log(` Step: ${firstError.step}`);
594
+ console.log(` Error: ${firstError.message}`);
519
595
  }
520
-
521
- console.log('Retrying...');
522
596
  }
597
+
598
+ // Update previousResult for next iteration
599
+ previousResult = currentResult;
523
600
  }
524
601
 
525
602
  // Error handling: Max iterations reached
@@ -580,6 +657,43 @@ Implementation complete:
580
657
  • All scenarios: ✅ Passing
581
658
  ```
582
659
 
660
+ **Run unit test coverage tracking:**
661
+ ```javascript
662
+ const { trackFeatureCoverage } = require('../../lib/coverage-tracker');
663
+
664
+ // Track coverage for modified implementation files
665
+ const implementationFiles = [
666
+ // List of .js files modified during implementation (exclude test files)
667
+ ];
668
+
669
+ console.log('\n📊 Running unit test coverage...');
670
+ const coverageResult = trackFeatureCoverage(implementationFiles, {
671
+ coverageThreshold: 80, // 80% coverage target
672
+ verbose: false
673
+ });
674
+
675
+ console.log(coverageResult.report);
676
+
677
+ if (!coverageResult.success) {
678
+ console.log('\n⚠️ Coverage below 80% threshold');
679
+ console.log('Consider adding more unit tests to cover edge cases');
680
+ console.log('\nTest files:');
681
+ coverageResult.testFiles.forEach(f => console.log(` • ${f}`));
682
+ }
683
+ ```
684
+
685
+ **Display coverage summary:**
686
+ ```
687
+ 📊 Unit Test Coverage Report
688
+ ─────────────────────────────
689
+ Statements: ✅ 85.23%
690
+ Branches: ✅ 82.15%
691
+ Functions: ✅ 88.50%
692
+ Lines: ✅ 84.90%
693
+ ─────────────────────────────
694
+ ✅ All coverage metrics meet 80% threshold
695
+ ```
696
+
583
697
  ### Step 4: Check for Production Mode (When All Stable Chores Complete)
584
698
 
585
699
  **CRITICAL: This step ONLY happens when ALL stable chores for the feature are complete. Otherwise skip to marking chore as done.**
@@ -621,25 +735,65 @@ db.get(`
621
735
  });
622
736
  ```
623
737
 
624
- **If all stable chores are done AND project is INTERNAL:**
738
+ **CRITICAL: Check project state to determine next step:**
739
+
740
+ Check if project is internal or external:
741
+ ```bash
742
+ # Check project_state in database
743
+ node jettypod.js work show 1 | grep "Project state:"
744
+ # OR read CLAUDE.md <project_state> tag
745
+ ```
746
+
747
+ ---
748
+
749
+ ### Option A: Project is INTERNAL
750
+
751
+ **For internal projects, stable mode is the FINAL state.**
752
+
753
+ **ACTION REQUIRED:** Mark the feature as done:
754
+ ```bash
755
+ node jettypod.js work status [feature-id] done
756
+ ```
757
+
758
+ Then display to user:
625
759
 
626
760
  ```
627
761
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
628
- ✅ FEATURE COMPLETE!
762
+ ✅ FEATURE #[id] COMPLETE!
629
763
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
630
764
 
765
+ Feature: [Feature Title]
766
+ Status: ✅ DONE
767
+
631
768
  What we accomplished:
632
769
  ✅ All BDD scenarios passing (happy path + error handling + edge cases)
633
770
  ✅ Comprehensive error handling and validation
634
- Feature stable and ready to use
771
+ Input validation and edge case coverage
772
+ ✅ State consistency and data integrity
773
+ ✅ All code merged to main and pushed to GitHub
774
+
775
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
776
+ 📝 INTERNAL PROJECT - STABLE MODE IS COMPLETE
777
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
778
+
779
+ This is an internal project - stable mode is the end state.
780
+ No production hardening needed.
635
781
 
636
- This is an internal project - no production hardening needed.
782
+ Feature is complete and ready to use!
637
783
 
638
- If you later transition to external state, production chores will be
639
- automatically generated from production standards.
784
+ Note: If you later transition to external state (accepting real users),
785
+ you can run the external-transition skill to generate production chores.
786
+
787
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
640
788
  ```
641
789
 
642
- **If all stable chores are done AND project is EXTERNAL:**
790
+ **End skill.** The feature is DONE.
791
+
792
+ ---
793
+
794
+ ### Option B: Project is EXTERNAL
795
+
796
+ **For external projects, continue to production mode.**
643
797
 
644
798
  Use the Skill tool to invoke the production-mode skill:
645
799
 
@@ -696,18 +850,73 @@ Remaining stable mode chores: [count]
696
850
 
697
851
  **Mark current chore as done:**
698
852
 
699
- Use Bash tool to commit, push, and merge to main:
853
+ ⚠️ **CRITICAL: Exclude CLAUDE.md from commits in worktrees**
854
+
855
+ CLAUDE.md contains work tracking metadata that changes frequently and causes merge conflicts. When committing in a worktree, **always reset CLAUDE.md** before committing:
856
+
700
857
  ```bash
701
- git add . && git commit -m "feat: [brief description of what was implemented]" && git push
858
+ git checkout HEAD -- CLAUDE.md # Reset CLAUDE.md to avoid merge conflicts
859
+ git add . # Stage other changes
860
+ git commit -m "feat: [brief description of what was implemented]"
861
+ git push
702
862
  ```
703
863
 
704
- Then merge to main (which auto-marks chore as done via git hooks):
864
+ Then use the merge command to merge to main (which auto-marks chore as done via post-merge hook):
705
865
  ```bash
706
- git checkout main && git pull && git merge [branch-name] && git push
866
+ jettypod work merge
707
867
  ```
708
868
 
709
869
  The post-merge hook will automatically mark the chore as done when merged to main.
710
870
 
871
+ ---
872
+
873
+ ⚠️ **CRITICAL: SEQUENTIAL WORKFLOW FOR STABLE MODE CHORES**
874
+
875
+ **Stable mode chores MUST be completed sequentially, not in parallel.**
876
+
877
+ **Why Sequential?**
878
+ - Multiple chores modify the same files (e.g., lib/merge-lock.js, step definitions)
879
+ - Later chores build on earlier implementations
880
+ - Tests and BDD scenarios depend on cumulative changes
881
+ - Parallel worktrees branch from main independently, missing each other's changes
882
+
883
+ **MANDATORY PROCESS:**
884
+
885
+ After completing EACH stable chore:
886
+ 1. ✅ Commit changes in worktree (excluding CLAUDE.md)
887
+ 2. ✅ Push worktree branch
888
+ 3. ✅ **Merge to main immediately**
889
+ 4. ✅ **Push main**
890
+ 5. ✅ ONLY THEN start the next stable chore
891
+
892
+ **DO NOT:**
893
+ ❌ Start multiple stable chores without merging previous ones
894
+ ❌ Leave stable chores unmerged "for later"
895
+ ❌ Assume worktrees will have each other's changes
896
+
897
+ **Example correct flow:**
898
+ ```bash
899
+ # Complete chore #1854
900
+ git add . && git commit && git push
901
+ jettypod work merge
902
+
903
+ # NOW start chore #1855 (main has #1854's changes)
904
+ jettypod work start 1855
905
+
906
+ # Complete chore #1855
907
+ git add . && git commit && git push
908
+ jettypod work merge
909
+
910
+ # NOW start chore #1856 (main has #1854 + #1855's changes)
911
+ jettypod work start 1856
912
+ ```
913
+
914
+ If you fail to follow this sequential process, later worktrees will be missing earlier implementations, causing:
915
+ - Missing functions/exports
916
+ - Incomplete test coverage
917
+ - Step definition errors
918
+ - Duplicate work
919
+
711
920
  **End skill.**
712
921
 
713
922
 
@@ -1,28 +0,0 @@
1
- # ⚠️ CRITICAL: Skills Directory Protection
2
-
3
- The `.claude/skills/` directory contains essential skill files:
4
- - epic-planning
5
- - feature-planning
6
- - speed-mode
7
- - stable-mode
8
-
9
- **These files should NEVER be deleted or modified by automated processes.**
10
-
11
- If skills go missing, restore from git:
12
- ```bash
13
- git restore .claude/skills/
14
- ```
15
-
16
- ## Root Cause Investigation
17
-
18
- The skills have been mysteriously deleted multiple times. Safety checks added to:
19
- - `features/work-commands/steps.js`
20
- - `features/work-commands/simple-steps.js`
21
-
22
- All `fs.rmSync()` operations now verify the target is in `/tmp/` before deleting.
23
-
24
- **If this keeps happening, check:**
25
- 1. IDE file watchers or plugins
26
- 2. Git hooks or operations
27
- 3. Claude Code's internal file management
28
- 4. Any other test cleanup scripts
@@ -1,24 +0,0 @@
1
- {
2
- "hooks": {
3
- "PreToolUse": [
4
- {
5
- "matcher": "Edit",
6
- "hooks": [
7
- {
8
- "type": "command",
9
- "command": ".jettypod/hooks/protect-claude-md.js"
10
- }
11
- ]
12
- },
13
- {
14
- "matcher": "Write",
15
- "hooks": [
16
- {
17
- "type": "command",
18
- "command": ".jettypod/hooks/protect-claude-md.js"
19
- }
20
- ]
21
- }
22
- ]
23
- }
24
- }
@@ -1,16 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(git reset:*)",
5
- "Bash(mv:*)",
6
- "Bash(npm install)",
7
- "Bash(npx cucumber-js:*)",
8
- "Bash(git add:*)",
9
- "Bash(npm test:*)",
10
- "Bash(npx cucumber:*)",
11
- "Bash(find:*)"
12
- ],
13
- "deny": [],
14
- "ask": []
15
- }
16
- }