jettypod 4.4.52 → 4.4.53

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.
@@ -0,0 +1,120 @@
1
+ # Command Whitelist Matrix: Feature Planning
2
+
3
+ This document defines what commands/actions are allowed at each step of the feature-planning skill. Hooks should enforce these rules and redirect the agent when violations occur.
4
+
5
+ ## Matrix
6
+
7
+ | Step | Description | Allowed Commands | Blocked Commands | Redirect Message |
8
+ |------|-------------|------------------|------------------|------------------|
9
+ | **1** | Get feature context | `work show`, `workflow start`, `backlog` | Any file writes, `work create`, `work start`, `work implement` | "You're in Step 1 - get context first with `work show <id>`" |
10
+ | **2** | Check epic decisions | `decisions --epic=X` | File writes, `work create`, `work start` | "Check for epic decisions before suggesting approaches" |
11
+ | **3** | Suggest 3 UX approaches | Read-only (Read, Glob, Grep) | File writes, `work create`, `work start` | "Wait for user to pick an approach - no changes yet" |
12
+ | **4** | Optional prototyping | Write to `prototypes/` only | Writes to `features/`, `src/`, `work create`, `work start` | "Prototypes go in prototypes/ - no production code yet" |
13
+ | **5** | Choose winner | `workflow checkpoint` | File writes, `work create`, `work start` | "Wait for user to confirm winner" |
14
+ | **6A** | Define integration contract | Read-only | File writes | "Define how users reach the feature first" |
15
+ | **6B** | Propose BDD scenarios | Read-only, `workflow checkpoint` | **Write to `features/`**, `work create`, `work start` | "**BDD files are written in Step 8D in a worktree, not now**" |
16
+ | **7** | Propose chores | Read-only (analyze codebase) | `work create`, `work start`, file writes | "Propose chores to user first - don't create yet" |
17
+ | **8B** | Create chores | `work create chore` | `work start`, writes to `features/` | "Create all chores before transitioning" |
18
+ | **8C** | Execute transition | `work implement`, `workflow checkpoint` | `work start` | "Transition the feature before starting chores" |
19
+ | **8D** | Write tests in worktree | `work tests start`, `work tests merge`, Write to **worktree path only**, `cucumber-js --dry-run` | Write to main repo paths, `work start` | "Write tests in the worktree, not main repo" |
20
+ | **8E** | Start first chore | `work start`, `workflow complete` | - | "Start the chore, then invoke speed-mode" |
21
+
22
+ ## Key Enforcement Points
23
+
24
+ ### 0. Allowlist-First Enforcement
25
+
26
+ **Principle:** Each step defines what IS allowed, not what's blocked. Anything not explicitly allowed is rejected.
27
+
28
+ This is simpler to reason about, safer by default, and guides the agent toward correct behavior rather than away from incorrect behavior.
29
+
30
+ **Enforcement logic:**
31
+ 1. Check if command/action is in the step's allowlist → allow
32
+ 2. Check if it matches a global bypass pattern (see below) → block with specific message
33
+ 3. Otherwise → block with generic "not allowed at this step" + list what IS allowed
34
+
35
+ ### 1. Common Bypass Patterns (Global Blocks)
36
+
37
+ Agents sometimes try shortcuts that bypass CLI commands entirely. Catch the common ones:
38
+
39
+ - **Direct SQL:** `sqlite3` commands, raw SQL (`INSERT`, `UPDATE`, `DELETE`) in bash
40
+ - **Inline Node execution:** `node -e` with database operations
41
+
42
+ **Redirect Message:** "Use CLI commands to modify work items, not direct SQL. Run `jettypod help` to see available commands."
43
+
44
+ We don't need to catch every possible bypass - these cover ~95% of cases. The redirect message does the real work.
45
+
46
+ ### 2. Step 6B is the Critical Trap
47
+
48
+ The agent often tries to write `.feature` files in Step 6B after proposing scenarios. This must be blocked.
49
+
50
+ **Rule:** Block all writes to `features/**` until Step 8D, and only then to the worktree path.
51
+
52
+ ### 3. Worktree Path Validation
53
+
54
+ In Step 8D, writes are only allowed to the active worktree path (`.jettypod-work/tests-*`), not anywhere in the main repo.
55
+
56
+ **Rule:** If a write targets a path that doesn't start with the active worktree path, block it.
57
+
58
+ ### 4. Order Enforcement
59
+
60
+ The following commands have strict ordering:
61
+ 1. `work create chore` - Only in Step 8B (after user confirms chores)
62
+ 2. `work implement` - Only in Step 8C (after chores created)
63
+ 3. `work tests start` - Only in Step 8D (after implement)
64
+ 4. `work tests merge` - Only in Step 8D (after tests written)
65
+ 5. `work start` - Only in Step 8E (after tests merged)
66
+
67
+ **Rule:** Each command should validate the previous step completed.
68
+
69
+ ## Context Required for Enforcement
70
+
71
+ Hooks need access to:
72
+ - **Current skill:** `feature-planning`
73
+ - **Current step:** 1-8E (from workflow checkpoint)
74
+ - **Feature ID:** The work item being planned
75
+ - **Worktree path:** For Step 8D validation (from `worktrees` table)
76
+
77
+ ## Example Hook Logic
78
+
79
+ ```javascript
80
+ // Pseudocode for pre-command hook
81
+ function validateCommand(command, context) {
82
+ const { skill, step, featureId, worktreePath } = context;
83
+
84
+ if (skill !== 'feature-planning') return { allowed: true };
85
+
86
+ // Step 6B: Block writes to features/
87
+ if (step === '6B' && command.type === 'write' && command.path.includes('features/')) {
88
+ return {
89
+ allowed: false,
90
+ message: "BDD files are written in Step 8D in a worktree, not now. You're proposing scenarios - wait for user confirmation."
91
+ };
92
+ }
93
+
94
+ // Step 8D: Only allow writes to worktree
95
+ if (step === '8D' && command.type === 'write') {
96
+ if (!command.path.startsWith(worktreePath)) {
97
+ return {
98
+ allowed: false,
99
+ message: `Write tests in the worktree (${worktreePath}), not the main repo.`
100
+ };
101
+ }
102
+ }
103
+
104
+ // Block work start until Step 8E
105
+ if (command.name === 'work start' && step !== '8E') {
106
+ return {
107
+ allowed: false,
108
+ message: `Cannot start chores yet. Complete steps through 8D first (tests must be merged to main).`
109
+ };
110
+ }
111
+
112
+ return { allowed: true };
113
+ }
114
+ ```
115
+
116
+ ## Open Questions
117
+
118
+ 1. **Step granularity:** Should we track sub-steps like 8B, 8C, 8D, 8E separately, or group them as "Step 8"?
119
+ 2. **Read operations:** Should we restrict what files can be read at certain steps, or only writes?
120
+ 3. **Skill transitions:** How do we handle the handoff to speed-mode at Step 8E?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jettypod",
3
- "version": "4.4.52",
3
+ "version": "4.4.53",
4
4
  "description": "AI-powered development workflow manager with TDD, BDD, and automatic test generation",
5
5
  "main": "jettypod.js",
6
6
  "bin": {
@@ -45,6 +45,22 @@ When this skill is activated, you are executing a standalone chore. The chore-pl
45
45
 
46
46
  ---
47
47
 
48
+ ## 🚨 SHELL CWD RECOVERY
49
+
50
+ **If ALL bash commands start failing with "Error: Exit code 1" and no output:**
51
+
52
+ Your shell's working directory was likely inside a worktree that was deleted. The CWD no longer exists.
53
+
54
+ **Recovery steps:**
55
+ 1. Get the main repo path from your session context (look for the project path in earlier messages)
56
+ 2. Run: `cd <main-repo-path>`
57
+ 3. Verify: `pwd && ls .jettypod`
58
+ 4. Resume your work
59
+
60
+ **Why this happens:** When a worktree is merged, it gets deleted. If your shell was inside that worktree directory, all subsequent commands fail because the CWD doesn't exist.
61
+
62
+ ---
63
+
48
64
  ## Implementation Steps
49
65
 
50
66
  ### Step 1: Receive and Display Context
@@ -355,12 +371,20 @@ Go back to Step 5 to fix issues.
355
371
  git add .
356
372
  git commit -m "chore: [brief description]"
357
373
  git push
374
+ ```
375
+
376
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
377
+
378
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
358
379
 
359
- # Switch to main repo before merging (merge cannot run from inside worktree)
360
- cd $(git rev-parse --show-toplevel)/..
380
+ ```bash
381
+ # CRITICAL: cd to main repo AND merge in SAME command
382
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [chore-id]
383
+ ```
361
384
 
362
- # Merge to main (auto-marks chore done)
363
- jettypod work merge [chore-id]
385
+ ```bash
386
+ # MANDATORY: Verify shell is in main repo
387
+ pwd && ls .jettypod
364
388
  ```
365
389
 
366
390
  **Display:**
@@ -48,6 +48,27 @@ When this skill is activated, you are helping implement a speed mode chore to ma
48
48
 
49
49
  ---
50
50
 
51
+ ## 🚨 SHELL CWD RECOVERY
52
+
53
+ **If ALL bash commands start failing with "Error: Exit code 1" and no output:**
54
+
55
+ Your shell's working directory was likely inside a worktree that was deleted. The CWD no longer exists.
56
+
57
+ **Recovery steps:**
58
+ 1. Get the main repo path from your session context (look for the project path in earlier messages)
59
+ 2. Run: `cd <main-repo-path>`
60
+ 3. Verify: `pwd && ls .jettypod`
61
+ 4. Resume your work
62
+
63
+ **Example:**
64
+ ```bash
65
+ cd /Users/erikspangenberg/personal-assistant && pwd
66
+ ```
67
+
68
+ **Why this happens:** When a worktree is merged, it gets deleted. If your shell was inside that worktree directory, all subsequent commands fail because the CWD doesn't exist.
69
+
70
+ ---
71
+
51
72
  ## 🛑 PRE-FLIGHT VALIDATION (REQUIRED)
52
73
 
53
74
  **Before proceeding with ANY implementation, you MUST validate the worktree exists.**
@@ -592,16 +613,23 @@ More speed mode chores remain. Starting next chore:
592
613
 
593
614
  **Merge and start next:**
594
615
 
616
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
617
+
618
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
619
+
595
620
  ```bash
596
621
  # Commit changes in the worktree
597
622
  git add . && git commit -m "feat: [brief description of what was implemented]"
623
+ ```
598
624
 
599
- # Return to main repo and merge (cannot merge from inside worktree)
600
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
601
- jettypod work merge [current-chore-id]
625
+ ```bash
626
+ # CRITICAL: cd to main repo AND merge in SAME command
627
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id]
628
+ ```
602
629
 
603
- # Start next speed chore
604
- jettypod work start [next-chore-id]
630
+ ```bash
631
+ # Verify shell is valid, then start next chore
632
+ pwd && jettypod work start [next-chore-id]
605
633
  ```
606
634
 
607
635
  The speed-mode skill will automatically re-invoke for the next chore.
@@ -640,15 +668,28 @@ npx cucumber-js <scenario-file-path> --name "User can reach" --format progress
640
668
 
641
669
  #### Step 7B: Merge Final Speed Chore
642
670
 
671
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
672
+
673
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
674
+
643
675
  ```bash
644
676
  # Commit changes in the worktree
645
677
  git add . && git commit -m "feat: [brief description of what was implemented]"
678
+ ```
646
679
 
647
- # Return to main repo and merge (cannot merge from inside worktree)
648
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
649
- jettypod work merge [current-chore-id] --with-transition
680
+ ```bash
681
+ # CRITICAL: cd to main repo AND merge in SAME command
682
+ # Using $(git rev-parse --show-toplevel)/.. exits worktree to main repo
683
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id] --with-transition
650
684
  ```
651
685
 
686
+ ```bash
687
+ # MANDATORY: Verify shell is in main repo (run immediately after merge)
688
+ pwd && ls .jettypod
689
+ ```
690
+
691
+ **If you see "No such file or directory" errors:** Your shell CWD was corrupted. Get the main repo path from your session context and run `cd <main-repo-path>`.
692
+
652
693
  After merge, you are on main branch. Ready to generate stable mode scenarios.
653
694
 
654
695
  #### Step 7C: Generate and Propose Stable Mode Chores
@@ -708,19 +749,35 @@ Scenario: [Edge case title]
708
749
 
709
750
  **6. Commit and merge the test worktree:**
710
751
 
752
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
753
+
754
+ The merge will delete the test worktree. If your shell is inside that worktree, ALL subsequent commands will fail. You MUST:
755
+ 1. Chain the cd and merge in a SINGLE bash command
756
+ 2. Verify your shell is in main repo AFTER merge
757
+
711
758
  ```bash
712
- # Commit in the test worktree
713
- cd <worktree-path>
714
- git add features/
715
- git commit -m "test: Add stable mode BDD scenarios and step definitions
759
+ # First: Commit in the test worktree (separate command is OK here)
760
+ cd <worktree-path> && git add features/ && git commit -m "test: Add stable mode BDD scenarios and step definitions
716
761
 
717
762
  Added error handling and edge case scenarios for stable mode.
718
763
  - [N] new stable mode scenarios
719
764
  - Step definitions for validation and error handling"
765
+ ```
766
+
767
+ ```bash
768
+ # CRITICAL: cd to main repo AND merge in SAME command
769
+ # This ensures shell is in main repo BEFORE worktree deletion
770
+ cd <main-repo-path> && jettypod work tests merge <feature-id>
771
+ ```
720
772
 
721
- # Return to main repo and merge
773
+ ```bash
774
+ # MANDATORY: Verify shell is in main repo (run this immediately after merge)
775
+ pwd && ls .jettypod
776
+ ```
777
+
778
+ **If you see "No such file or directory" errors:** Your shell CWD was corrupted. Run:
779
+ ```bash
722
780
  cd <main-repo-path>
723
- jettypod work tests merge <feature-id>
724
781
  ```
725
782
 
726
783
  **7. Present proposal to user:**
@@ -52,6 +52,22 @@ When this skill is activated, you are helping implement a stable mode chore to a
52
52
 
53
53
  ---
54
54
 
55
+ ## 🚨 SHELL CWD RECOVERY
56
+
57
+ **If ALL bash commands start failing with "Error: Exit code 1" and no output:**
58
+
59
+ Your shell's working directory was likely inside a worktree that was deleted. The CWD no longer exists.
60
+
61
+ **Recovery steps:**
62
+ 1. Get the main repo path from your session context (look for the project path in earlier messages)
63
+ 2. Run: `cd <main-repo-path>`
64
+ 3. Verify: `pwd && ls .jettypod`
65
+ 4. Resume your work
66
+
67
+ **Why this happens:** When a worktree is merged, it gets deleted. If your shell was inside that worktree directory, all subsequent commands fail because the CWD doesn't exist.
68
+
69
+ ---
70
+
55
71
  ## 🛑 PRE-FLIGHT VALIDATION (REQUIRED)
56
72
 
57
73
  **Before proceeding with ANY implementation, you MUST validate the worktree exists.**
@@ -556,16 +572,23 @@ More stable mode chores remain. Starting next chore:
556
572
 
557
573
  **Merge and start next:**
558
574
 
575
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
576
+
577
+ The merge will delete the worktree. Chain commands to ensure shell is in main repo BEFORE deletion.
578
+
559
579
  ```bash
560
580
  # Commit changes in the worktree
561
581
  git add . && git commit -m "feat: [brief description of error handling added]"
582
+ ```
562
583
 
563
- # Return to main repo and merge (cannot merge from inside worktree)
564
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
565
- jettypod work merge [current-chore-id]
584
+ ```bash
585
+ # CRITICAL: cd to main repo AND merge in SAME command
586
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id]
587
+ ```
566
588
 
567
- # Start next stable chore
568
- jettypod work start [next-chore-id]
589
+ ```bash
590
+ # Verify shell is valid, then start next chore
591
+ pwd && jettypod work start [next-chore-id]
569
592
  ```
570
593
 
571
594
  The stable-mode skill will automatically re-invoke for the next chore.
@@ -584,10 +607,20 @@ If the query returns no remaining chores, proceed to Step 7.
584
607
 
585
608
  **First, merge the final stable chore:**
586
609
 
610
+ **🚨 CRITICAL: Shell CWD Corruption Prevention**
611
+
587
612
  ```bash
588
613
  git add . && git commit -m "feat: [brief description of error handling added]"
589
- cd $(git rev-parse --show-toplevel)/.. # Exit worktree to main repo
590
- jettypod work merge [current-chore-id]
614
+ ```
615
+
616
+ ```bash
617
+ # CRITICAL: cd to main repo AND merge in SAME command
618
+ cd $(git rev-parse --show-toplevel)/.. && jettypod work merge [current-chore-id]
619
+ ```
620
+
621
+ ```bash
622
+ # MANDATORY: Verify shell is in main repo
623
+ pwd && ls .jettypod
591
624
  ```
592
625
 
593
626
  **Then check project state:**