gsd-opencode 1.20.3 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/agents/gsd-codebase-mapper.md +9 -1
  2. package/agents/gsd-debugger.md +66 -10
  3. package/agents/gsd-executor.md +36 -16
  4. package/agents/gsd-integration-checker.md +2 -0
  5. package/agents/gsd-nyquist-auditor.md +178 -0
  6. package/agents/gsd-phase-researcher.md +28 -34
  7. package/agents/gsd-plan-checker.md +42 -78
  8. package/agents/gsd-planner.md +139 -24
  9. package/agents/gsd-project-researcher.md +11 -1
  10. package/agents/gsd-research-synthesizer.md +13 -3
  11. package/agents/gsd-roadmapper.md +25 -15
  12. package/agents/gsd-verifier.md +29 -6
  13. package/bin/dm/lib/constants.js +6 -1
  14. package/bin/dm/src/services/file-ops.js +14 -1
  15. package/commands/gsd/gsd-add-phase.md +6 -6
  16. package/commands/gsd/gsd-add-tests.md +41 -0
  17. package/commands/gsd/gsd-add-todo.md +7 -7
  18. package/commands/gsd/gsd-audit-milestone.md +9 -9
  19. package/commands/gsd/gsd-check-profile.md +3 -3
  20. package/commands/gsd/gsd-check-todos.md +7 -7
  21. package/commands/gsd/gsd-cleanup.md +2 -2
  22. package/commands/gsd/gsd-complete-milestone.md +6 -6
  23. package/commands/gsd/gsd-debug.md +11 -7
  24. package/commands/gsd/gsd-discuss-phase.md +26 -19
  25. package/commands/gsd/gsd-execute-phase.md +13 -13
  26. package/commands/gsd/gsd-health.md +7 -7
  27. package/commands/gsd/gsd-help.md +2 -2
  28. package/commands/gsd/gsd-insert-phase.md +6 -6
  29. package/commands/gsd/gsd-join-discord.md +1 -1
  30. package/commands/gsd/gsd-list-phase-assumptions.md +6 -6
  31. package/commands/gsd/gsd-map-codebase.md +8 -8
  32. package/commands/gsd/gsd-new-milestone.md +12 -12
  33. package/commands/gsd/gsd-new-project.md +12 -12
  34. package/commands/gsd/gsd-pause-work.md +6 -6
  35. package/commands/gsd/gsd-plan-milestone-gaps.md +9 -9
  36. package/commands/gsd/gsd-plan-phase.md +14 -13
  37. package/commands/gsd/gsd-progress.md +8 -8
  38. package/commands/gsd/gsd-quick.md +17 -13
  39. package/commands/gsd/gsd-reapply-patches.md +19 -11
  40. package/commands/gsd/gsd-remove-phase.md +7 -7
  41. package/commands/gsd/gsd-research-phase.md +12 -11
  42. package/commands/gsd/gsd-resume-work.md +8 -8
  43. package/commands/gsd/gsd-set-profile.md +6 -6
  44. package/commands/gsd/gsd-settings.md +7 -7
  45. package/commands/gsd/gsd-update.md +5 -5
  46. package/commands/gsd/gsd-validate-phase.md +35 -0
  47. package/commands/gsd/gsd-verify-work.md +11 -11
  48. package/get-shit-done/bin/gsd-oc-commands/allow-read-config.cjs +235 -0
  49. package/get-shit-done/bin/gsd-oc-tools.cjs +11 -5
  50. package/get-shit-done/bin/gsd-tools.cjs +45 -6
  51. package/get-shit-done/bin/lib/commands.cjs +11 -19
  52. package/get-shit-done/bin/lib/config.cjs +8 -1
  53. package/get-shit-done/bin/lib/core.cjs +131 -16
  54. package/get-shit-done/bin/lib/init.cjs +28 -12
  55. package/get-shit-done/bin/lib/milestone.cjs +34 -8
  56. package/get-shit-done/bin/lib/phase.cjs +74 -50
  57. package/get-shit-done/bin/lib/roadmap.cjs +7 -7
  58. package/get-shit-done/bin/lib/state.cjs +294 -63
  59. package/get-shit-done/bin/lib/template.cjs +3 -3
  60. package/get-shit-done/bin/lib/verify.cjs +56 -8
  61. package/get-shit-done/bin/test/allow-read-config.test.cjs +262 -0
  62. package/get-shit-done/references/checkpoints.md +1 -1
  63. package/get-shit-done/references/decimal-phase-calculation.md +6 -6
  64. package/get-shit-done/references/git-integration.md +3 -3
  65. package/get-shit-done/references/git-planning-commit.md +2 -2
  66. package/get-shit-done/references/model-profile-resolution.md +1 -1
  67. package/get-shit-done/references/model-profiles.md +1 -0
  68. package/get-shit-done/references/phase-argument-parsing.md +4 -4
  69. package/get-shit-done/references/planning-config.md +10 -6
  70. package/get-shit-done/references/questioning.md +17 -0
  71. package/get-shit-done/references/verification-patterns.md +1 -1
  72. package/get-shit-done/templates/DEBUG.md +7 -2
  73. package/get-shit-done/templates/VALIDATION.md +18 -46
  74. package/get-shit-done/templates/codebase/structure.md +3 -3
  75. package/get-shit-done/templates/config.json +2 -2
  76. package/get-shit-done/templates/context.md +14 -0
  77. package/get-shit-done/templates/phase-prompt.md +10 -10
  78. package/get-shit-done/templates/retrospective.md +54 -0
  79. package/get-shit-done/templates/roadmap.md +1 -1
  80. package/get-shit-done/workflows/add-phase.md +3 -2
  81. package/get-shit-done/workflows/add-tests.md +351 -0
  82. package/get-shit-done/workflows/add-todo.md +4 -3
  83. package/get-shit-done/workflows/audit-milestone.md +40 -5
  84. package/get-shit-done/workflows/check-todos.md +3 -2
  85. package/get-shit-done/workflows/cleanup.md +1 -1
  86. package/get-shit-done/workflows/complete-milestone.md +69 -5
  87. package/get-shit-done/workflows/diagnose-issues.md +2 -2
  88. package/get-shit-done/workflows/discovery-phase.md +6 -6
  89. package/get-shit-done/workflows/discuss-phase.md +194 -58
  90. package/get-shit-done/workflows/execute-phase.md +29 -23
  91. package/get-shit-done/workflows/execute-plan.md +22 -18
  92. package/get-shit-done/workflows/health.md +5 -2
  93. package/get-shit-done/workflows/help.md +4 -1
  94. package/get-shit-done/workflows/insert-phase.md +3 -2
  95. package/get-shit-done/workflows/map-codebase.md +3 -2
  96. package/get-shit-done/workflows/new-milestone.md +12 -10
  97. package/get-shit-done/workflows/new-project.md +44 -49
  98. package/get-shit-done/workflows/oc-set-profile.md +24 -0
  99. package/get-shit-done/workflows/pause-work.md +2 -2
  100. package/get-shit-done/workflows/plan-milestone-gaps.md +3 -3
  101. package/get-shit-done/workflows/plan-phase.md +155 -73
  102. package/get-shit-done/workflows/progress.md +8 -7
  103. package/get-shit-done/workflows/quick.md +158 -10
  104. package/get-shit-done/workflows/remove-phase.md +5 -4
  105. package/get-shit-done/workflows/research-phase.md +5 -4
  106. package/get-shit-done/workflows/resume-project.md +3 -2
  107. package/get-shit-done/workflows/set-profile.md +3 -2
  108. package/get-shit-done/workflows/settings.md +6 -6
  109. package/get-shit-done/workflows/transition.md +5 -5
  110. package/get-shit-done/workflows/update.md +45 -19
  111. package/get-shit-done/workflows/validate-phase.md +167 -0
  112. package/get-shit-done/workflows/verify-phase.md +10 -9
  113. package/get-shit-done/workflows/verify-work.md +18 -4
  114. package/package.json +1 -1
@@ -9,9 +9,7 @@ created: {date}
9
9
 
10
10
  # Phase {N} — Validation Strategy
11
11
 
12
- > Generated by `gsd-phase-researcher` during `/gsd-plan-phase {N}`.
13
- > Updated by `gsd-plan-checker` after plan approval.
14
- > Governs feedback sampling during `/gsd-execute-phase {N}`.
12
+ > Per-phase validation contract for feedback sampling during execution.
15
13
 
16
14
  ---
17
15
 
@@ -20,22 +18,19 @@ created: {date}
20
18
  | Property | Value |
21
19
  |----------|-------|
22
20
  | **Framework** | {pytest 7.x / jest 29.x / vitest / go test / other} |
23
- | **Config file** | {path/to/pytest.ini or "none — Wave 0 installs"} |
24
- | **Quick run command** | `{e.g., pytest -x --tb=short}` |
25
- | **Full suite command** | `{e.g., pytest tests/ --tb=short}` |
21
+ | **Config file** | {path or "none — Wave 0 installs"} |
22
+ | **Quick run command** | `{quick command}` |
23
+ | **Full suite command** | `{full command}` |
26
24
  | **Estimated runtime** | ~{N} seconds |
27
- | **CI pipeline** | {.github/workflows/test.yml — exists / needs creation} |
28
25
 
29
26
  ---
30
27
 
31
- ## Nyquist Sampling Rate
32
-
33
- > The minimum feedback frequency required to reliably catch errors in this phase.
28
+ ## Sampling Rate
34
29
 
35
30
  - **After every task commit:** Run `{quick run command}`
36
31
  - **After every plan wave:** Run `{full suite command}`
37
32
  - **Before `/gsd-verify-work`:** Full suite must be green
38
- - **Maximum acceptable task feedback latency:** {N} seconds
33
+ - **Max feedback latency:** {N} seconds
39
34
 
40
35
  ---
41
36
 
@@ -43,62 +38,39 @@ created: {date}
43
38
 
44
39
  | task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
45
40
  |---------|------|------|-------------|-----------|-------------------|-------------|--------|
46
- | {N}-01-01 | 01 | 1 | REQ-{XX} | unit | `pytest tests/test_{module}.py::test_{name} -x` | ✅ / ❌ W0 | ⬜ pending |
47
- | {N}-01-02 | 01 | 1 | REQ-{XX} | integration | `pytest tests/test_{flow}.py -x` | ✅ / ❌ W0 | ⬜ pending |
48
- | {N}-02-01 | 02 | 2 | REQ-{XX} | smoke | `curl -s {endpoint} \| grep {expected}` | ✅ N/A | ⬜ pending |
41
+ | {N}-01-01 | 01 | 1 | REQ-{XX} | unit | `{command}` | ✅ / ❌ W0 | ⬜ pending |
49
42
 
50
- *Status values: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
43
+ *Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*
51
44
 
52
45
  ---
53
46
 
54
47
  ## Wave 0 Requirements
55
48
 
56
- > Test scaffolding committed BEFORE any implementation task. Executor runs Wave 0 first.
57
-
58
- - [ ] `{tests/test_file.py}` — stubs for REQ-{XX}, REQ-{XX}
49
+ - [ ] `{tests/test_file.py}` stubs for REQ-{XX}
59
50
  - [ ] `{tests/conftest.py}` — shared fixtures
60
51
  - [ ] `{framework install}` — if no framework detected
61
52
 
62
- *If none required: "Existing infrastructure covers all phase requirements — no Wave 0 test tasks needed."*
53
+ *If none: "Existing infrastructure covers all phase requirements."*
63
54
 
64
55
  ---
65
56
 
66
57
  ## Manual-Only Verifications
67
58
 
68
- > Behaviors that genuinely cannot be automated, with justification.
69
- > These are surfaced during `/gsd-verify-work` UAT.
70
-
71
59
  | Behavior | Requirement | Why Manual | Test Instructions |
72
60
  |----------|-------------|------------|-------------------|
73
- | {behavior} | REQ-{XX} | {reason: visual, third-party auth, physical device...} | {step-by-step} |
61
+ | {behavior} | REQ-{XX} | {reason} | {steps} |
74
62
 
75
- *If none: "All phase behaviors have automated verification coverage."*
63
+ *If none: "All phase behaviors have automated verification."*
76
64
 
77
65
  ---
78
66
 
79
67
  ## Validation Sign-Off
80
68
 
81
- Updated by `gsd-plan-checker` when plans are approved:
82
-
83
- - [ ] All tasks have `<automated>` verify commands or Wave 0 dependencies
84
- - [ ] No 3 consecutive implementation tasks without automated verify (sampling continuity)
85
- - [ ] Wave 0 test files cover all MISSING references
86
- - [ ] No watch-mode flags in any automated command
87
- - [ ] Feedback latency per task: < {N}s ✅
69
+ - [ ] All tasks have `<automated>` verify or Wave 0 dependencies
70
+ - [ ] Sampling continuity: no 3 consecutive tasks without automated verify
71
+ - [ ] Wave 0 covers all MISSING references
72
+ - [ ] No watch-mode flags
73
+ - [ ] Feedback latency < {N}s
88
74
  - [ ] `nyquist_compliant: true` set in frontmatter
89
75
 
90
- **Plan-checker approval:** {pending / approved on YYYY-MM-DD}
91
-
92
- ---
93
-
94
- ## Execution Tracking
95
-
96
- Updated during `/gsd-execute-phase {N}`:
97
-
98
- | Wave | Tasks | Tests Run | Pass | Fail | Sampling Status |
99
- |------|-------|-----------|------|------|-----------------|
100
- | 0 | {N} | — | — | — | scaffold |
101
- | 1 | {N} | {command} | {N} | {N} | ✅ sampled |
102
- | 2 | {N} | {command} | {N} | {N} | ✅ sampled |
103
-
104
- **Phase validation complete:** {pending / YYYY-MM-DD HH:MM}
76
+ **Approval:** {pending / approved YYYY-MM-DD}
@@ -216,7 +216,7 @@ get-shit-done/
216
216
 
217
217
  **New Workflow:**
218
218
  - Implementation: `get-shit-done/workflows/{name}.md`
219
- - Usage: Reference from command with `@~/.config/opencode/get-shit-done/workflows/{name}.md`
219
+ - Usage: Reference from command with `@$HOME/.config/opencode/get-shit-done/workflows/{name}.md`
220
220
 
221
221
  **New Reference Document:**
222
222
  - Implementation: `get-shit-done/references/{name}.md`
@@ -229,12 +229,12 @@ get-shit-done/
229
229
  ## Special Directories
230
230
 
231
231
  **get-shit-done/**
232
- - Purpose: Resources installed to ~/.config/opencode/
232
+ - Purpose: Resources installed to $HOME/.config/opencode/
233
233
  - Source: Copied by bin/install.js during installation
234
234
  - Committed: Yes (source of truth)
235
235
 
236
236
  **commands/**
237
- - Purpose: Slash commands installed to ~/.config/opencode/commands/
237
+ - Purpose: Slash commands installed to $HOME/.config/opencode/commands/
238
238
  - Source: Copied by bin/install.js during installation
239
239
  - Committed: Yes (source of truth)
240
240
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "mode": "interactive",
3
- "depth": "standard",
3
+ "granularity": "standard",
4
4
  "workflow": {
5
5
  "research": true,
6
6
  "plan_check": true,
7
7
  "verifier": true,
8
8
  "auto_advance": false,
9
- "nyquist_validation": false
9
+ "nyquist_validation": true
10
10
  },
11
11
  "planning": {
12
12
  "commit_docs": true,
@@ -54,6 +54,20 @@ Template for `.planning/phases/XX-name/{phase_num}-CONTEXT.md` - captures implem
54
54
 
55
55
  </specifics>
56
56
 
57
+ <code_context>
58
+ ## Existing Code Insights
59
+
60
+ ### Reusable Assets
61
+ - [Component/hook/utility]: [How it could be used in this phase]
62
+
63
+ ### Established Patterns
64
+ - [Pattern]: [How it constrains/enables this phase]
65
+
66
+ ### Integration Points
67
+ - [Where new code connects to existing system]
68
+
69
+ </code_context>
70
+
57
71
  <deferred>
58
72
  ## Deferred Ideas
59
73
 
@@ -38,10 +38,10 @@ Output: [What artifacts will be created]
38
38
  </objective>
39
39
 
40
40
  <execution_context>
41
- @~/.config/opencode/get-shit-done/workflows/execute-plan.md
42
- @~/.config/opencode/get-shit-done/templates/summary.md
41
+ @$HOME/.config/opencode/get-shit-done/workflows/execute-plan.md
42
+ @$HOME/.config/opencode/get-shit-done/templates/summary.md
43
43
  [If plan contains checkpoint tasks (type="checkpoint:*"), add:]
44
- @~/.config/opencode/get-shit-done/references/checkpoints.md
44
+ @$HOME/.config/opencode/get-shit-done/references/checkpoints.md
45
45
  </execution_context>
46
46
 
47
47
  <context>
@@ -76,7 +76,7 @@ Output: [What artifacts will be created]
76
76
  <done>[Acceptance criteria]</done>
77
77
  </task>
78
78
 
79
- <!-- For checkpoint task examples and patterns, see @~/.config/opencode/get-shit-done/references/checkpoints.md -->
79
+ <!-- For checkpoint task examples and patterns, see @$HOME/.config/opencode/get-shit-done/references/checkpoints.md -->
80
80
  <!-- Key rule: OpenCode starts dev server BEFORE human-verify checkpoints. User only visits URLs. -->
81
81
 
82
82
  <task type="checkpoint:decision" gate="blocking">
@@ -270,7 +270,7 @@ TDD features get dedicated plans with `type: tdd`.
270
270
  → Yes: Create a TDD plan
271
271
  → No: Standard task in standard plan
272
272
 
273
- See `~/.config/opencode/get-shit-done/references/tdd.md` for TDD plan structure.
273
+ See `$HOME/.config/opencode/get-shit-done/references/tdd.md` for TDD plan structure.
274
274
 
275
275
  ---
276
276
 
@@ -374,9 +374,9 @@ Output: Working dashboard component.
374
374
  </objective>
375
375
 
376
376
  <execution_context>
377
- @~/.config/opencode/get-shit-done/workflows/execute-plan.md
378
- @~/.config/opencode/get-shit-done/templates/summary.md
379
- @~/.config/opencode/get-shit-done/references/checkpoints.md
377
+ @$HOME/.config/opencode/get-shit-done/workflows/execute-plan.md
378
+ @$HOME/.config/opencode/get-shit-done/templates/summary.md
379
+ @$HOME/.config/opencode/get-shit-done/references/checkpoints.md
380
380
  </execution_context>
381
381
 
382
382
  <context>
@@ -499,7 +499,7 @@ user_setup:
499
499
 
500
500
  **Result:** Execute-plan generates `{phase}-USER-SETUP.md` with checklist for the user.
501
501
 
502
- See `~/.config/opencode/get-shit-done/templates/user-setup.md` for full schema and examples
502
+ See `$HOME/.config/opencode/get-shit-done/templates/user-setup.md` for full schema and examples
503
503
 
504
504
  ---
505
505
 
@@ -566,4 +566,4 @@ task completion ≠ Goal achievement. A task "create chat component" can complet
566
566
  5. Gaps found → fix plans created → execute → re-verify
567
567
  6. All must_haves pass → phase complete
568
568
 
569
- See `~/.config/opencode/get-shit-done/workflows/verify-phase.md` for verification logic.
569
+ See `$HOME/.config/opencode/get-shit-done/workflows/verify-phase.md` for verification logic.
@@ -0,0 +1,54 @@
1
+ # Project Retrospective
2
+
3
+ *A living document updated after each milestone. Lessons feed forward into future planning.*
4
+
5
+ ## Milestone: v{version} — {name}
6
+
7
+ **Shipped:** {date}
8
+ **Phases:** {count} | **Plans:** {count} | **Sessions:** {count}
9
+
10
+ ### What Was Built
11
+ - {Key deliverable 1}
12
+ - {Key deliverable 2}
13
+ - {Key deliverable 3}
14
+
15
+ ### What Worked
16
+ - {Efficiency win or successful pattern}
17
+ - {What went smoothly}
18
+
19
+ ### What Was Inefficient
20
+ - {Missed opportunity}
21
+ - {What took longer than expected}
22
+
23
+ ### Patterns Established
24
+ - {New pattern or convention that should persist}
25
+
26
+ ### Key Lessons
27
+ 1. {Specific, actionable lesson}
28
+ 2. {Another lesson}
29
+
30
+ ### Cost Observations
31
+ - Model mix: {X}% opus, {Y}% sonnet, {Z}% haiku
32
+ - Sessions: {count}
33
+ - Notable: {efficiency observation}
34
+
35
+ ---
36
+
37
+ ## Cross-Milestone Trends
38
+
39
+ ### Process Evolution
40
+
41
+ | Milestone | Sessions | Phases | Key Change |
42
+ |-----------|----------|--------|------------|
43
+ | v{X} | {N} | {M} | {What changed in process} |
44
+
45
+ ### Cumulative Quality
46
+
47
+ | Milestone | Tests | Coverage | Zero-Dep Additions |
48
+ |-----------|-------|----------|-------------------|
49
+ | v{X} | {N} | {Y}% | {count} |
50
+
51
+ ### Top Lessons (Verified Across Milestones)
52
+
53
+ 1. {Lesson verified by multiple milestones}
54
+ 2. {Another cross-validated lesson}
@@ -105,7 +105,7 @@ Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
105
105
 
106
106
  <guidelines>
107
107
  **Initial planning (v1.0):**
108
- - Phase count depends on depth setting (quick: 3-5, standard: 5-8, comprehensive: 8-12)
108
+ - Phase count depends on granularity setting (coarse: 3-5, standard: 5-8, fine: 8-12)
109
109
  - Each phase delivers something coherent
110
110
  - Phases can have 1+ plans (split if >3 tasks or multiple subsystems)
111
111
  - Plans use naming: {phase}-{plan}-PLAN.md (e.g., 01-02-PLAN.md)
@@ -29,7 +29,8 @@ Exit.
29
29
  Load phase operation context:
30
30
 
31
31
  ```bash
32
- INIT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs init phase-op "0")
32
+ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init phase-op "0")
33
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
33
34
  ```
34
35
 
35
36
  Check `roadmap_exists` from init JSON. If false:
@@ -44,7 +45,7 @@ Exit.
44
45
  **Delegate the phase addition to gsd-tools:**
45
46
 
46
47
  ```bash
47
- RESULT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs phase add "${description}")
48
+ RESULT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" phase add "${description}")
48
49
  ```
49
50
 
50
51
  The CLI handles:
@@ -0,0 +1,351 @@
1
+ <purpose>
2
+ Generate unit and E2E tests for a completed phase based on its SUMMARY.md, CONTEXT.md, and implementation. Classifies each changed file into TDD (unit), E2E (browser), or Skip categories, presents a test plan for user approval, then generates tests following RED-GREEN conventions.
3
+
4
+ Users currently hand-craft `/gsd-quick` prompts for test generation after each phase. This workflow standardizes the process with proper classification, quality gates, and gap reporting.
5
+ </purpose>
6
+
7
+ <required_reading>
8
+ read all files referenced by the invoking prompt's execution_context before starting.
9
+ </required_reading>
10
+
11
+ <process>
12
+
13
+ <step name="parse_arguments">
14
+ Parse `$ARGUMENTS` for:
15
+ - Phase number (integer, decimal, or letter-suffix) → store as `$PHASE_ARG`
16
+ - Remaining text after phase number → store as `$EXTRA_INSTRUCTIONS` (optional)
17
+
18
+ Example: `/gsd-add-tests 12 focus on edge cases` → `$PHASE_ARG=12`, `$EXTRA_INSTRUCTIONS="focus on edge cases"`
19
+
20
+ If no phase argument provided:
21
+
22
+ ```
23
+ ERROR: Phase number required
24
+ Usage: /gsd-add-tests <phase> [additional instructions]
25
+ Example: /gsd-add-tests 12
26
+ Example: /gsd-add-tests 12 focus on edge cases in the pricing module
27
+ ```
28
+
29
+ Exit.
30
+ </step>
31
+
32
+ <step name="init_context">
33
+ Load phase operation context:
34
+
35
+ ```bash
36
+ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}")
37
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
38
+ ```
39
+
40
+ Extract from init JSON: `phase_dir`, `phase_number`, `phase_name`.
41
+
42
+ Verify the phase directory exists. If not:
43
+ ```
44
+ ERROR: Phase directory not found for phase ${PHASE_ARG}
45
+ Ensure the phase exists in .planning/phases/
46
+ ```
47
+ Exit.
48
+
49
+ read the phase artifacts (in order of priority):
50
+ 1. `${phase_dir}/*-SUMMARY.md` — what was implemented, files changed
51
+ 2. `${phase_dir}/CONTEXT.md` — acceptance criteria, decisions
52
+ 3. `${phase_dir}/*-VERIFICATION.md` — user-verified scenarios (if UAT was done)
53
+
54
+ If no SUMMARY.md exists:
55
+ ```
56
+ ERROR: No SUMMARY.md found for phase ${PHASE_ARG}
57
+ This command works on completed phases. Run /gsd-execute-phase first.
58
+ ```
59
+ Exit.
60
+
61
+ Present banner:
62
+ ```
63
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
64
+ GSD ► ADD TESTS — Phase ${phase_number}: ${phase_name}
65
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66
+ ```
67
+ </step>
68
+
69
+ <step name="analyze_implementation">
70
+ Extract the list of files modified by the phase from SUMMARY.md ("Files Changed" or equivalent section).
71
+
72
+ For each file, classify into one of three categories:
73
+
74
+ | Category | Criteria | Test Type |
75
+ |----------|----------|-----------|
76
+ | **TDD** | Pure functions where `expect(fn(input)).toBe(output)` is writable | Unit tests |
77
+ | **E2E** | UI behavior verifiable by browser automation | Playwright/E2E tests |
78
+ | **Skip** | Not meaningfully testable or already covered | None |
79
+
80
+ **TDD classification — apply when:**
81
+ - Business logic: calculations, pricing, tax rules, validation
82
+ - Data transformations: mapping, filtering, aggregation, formatting
83
+ - Parsers: CSV, JSON, XML, custom format parsing
84
+ - Validators: input validation, schema validation, business rules
85
+ - State machines: status transitions, workflow steps
86
+ - Utilities: string manipulation, date handling, number formatting
87
+
88
+ **E2E classification — apply when:**
89
+ - Keyboard shortcuts: key bindings, modifier keys, chord sequences
90
+ - Navigation: page transitions, routing, breadcrumbs, back/forward
91
+ - Form interactions: submit, validation errors, field focus, autocomplete
92
+ - Selection: row selection, multi-select, shift-click ranges
93
+ - Drag and drop: reordering, moving between containers
94
+ - Modal dialogs: open, close, confirm, cancel
95
+ - Data grids: sorting, filtering, inline editing, column resize
96
+
97
+ **Skip classification — apply when:**
98
+ - UI layout/styling: CSS classes, visual appearance, responsive breakpoints
99
+ - Configuration: config files, environment variables, feature flags
100
+ - Glue code: dependency injection setup, middleware registration, routing tables
101
+ - Migrations: database migrations, schema changes
102
+ - Simple CRUD: basic create/read/update/delete with no business logic
103
+ - Type definitions: records, DTOs, interfaces with no logic
104
+
105
+ read each file to verify classification. Don't classify based on filename alone.
106
+ </step>
107
+
108
+ <step name="present_classification">
109
+ Present the classification to the user for confirmation before proceeding:
110
+
111
+ ```
112
+ question(
113
+ header: "Test Classification",
114
+ question: |
115
+ ## Files classified for testing
116
+
117
+ ### TDD (Unit Tests) — {N} files
118
+ {list of files with brief reason}
119
+
120
+ ### E2E (Browser Tests) — {M} files
121
+ {list of files with brief reason}
122
+
123
+ ### Skip — {K} files
124
+ {list of files with brief reason}
125
+
126
+ {if $EXTRA_INSTRUCTIONS: "Additional instructions: ${EXTRA_INSTRUCTIONS}"}
127
+
128
+ How would you like to proceed?
129
+ options:
130
+ - "Approve and generate test plan"
131
+ - "Adjust classification (I'll specify changes)"
132
+ - "Cancel"
133
+ )
134
+ ```
135
+
136
+ If user selects "Adjust classification": apply their changes and re-present.
137
+ If user selects "Cancel": exit gracefully.
138
+ </step>
139
+
140
+ <step name="discover_test_structure">
141
+ Before generating the test plan, discover the project's existing test structure:
142
+
143
+ ```bash
144
+ # Find existing test directories
145
+ find . -type d -name "*test*" -o -name "*spec*" -o -name "*__tests__*" 2>/dev/null | head -20
146
+ # Find existing test files for convention matching
147
+ find . -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "*Tests.fs" -o -name "*Test.fs" \) 2>/dev/null | head -20
148
+ # Check for test runners
149
+ ls package.json *.sln 2>/dev/null
150
+ ```
151
+
152
+ Identify:
153
+ - Test directory structure (where unit tests live, where E2E tests live)
154
+ - Naming conventions (`.test.ts`, `.spec.ts`, `*Tests.fs`, etc.)
155
+ - Test runner commands (how to execute unit tests, how to execute E2E tests)
156
+ - Test framework (xUnit, NUnit, Jest, Playwright, etc.)
157
+
158
+ If test structure is ambiguous, ask the user:
159
+ ```
160
+ question(
161
+ header: "Test Structure",
162
+ question: "I found multiple test locations. Where should I create tests?",
163
+ options: [list discovered locations]
164
+ )
165
+ ```
166
+ </step>
167
+
168
+ <step name="generate_test_plan">
169
+ For each approved file, create a detailed test plan.
170
+
171
+ **For TDD files**, plan tests following RED-GREEN-REFACTOR:
172
+ 1. Identify testable functions/methods in the file
173
+ 2. For each function: list input scenarios, expected outputs, edge cases
174
+ 3. Note: since code already exists, tests may pass immediately — that's OK, but verify they test the RIGHT behavior
175
+
176
+ **For E2E files**, plan tests following RED-GREEN gates:
177
+ 1. Identify user scenarios from CONTEXT.md/VERIFICATION.md
178
+ 2. For each scenario: describe the user action, expected outcome, assertions
179
+ 3. Note: RED gate means confirming the test would fail if the feature were broken
180
+
181
+ Present the complete test plan:
182
+
183
+ ```
184
+ question(
185
+ header: "Test Plan",
186
+ question: |
187
+ ## Test Generation Plan
188
+
189
+ ### Unit Tests ({N} tests across {M} files)
190
+ {for each file: test file path, list of test cases}
191
+
192
+ ### E2E Tests ({P} tests across {Q} files)
193
+ {for each file: test file path, list of test scenarios}
194
+
195
+ ### Test Commands
196
+ - Unit: {discovered test command}
197
+ - E2E: {discovered e2e command}
198
+
199
+ Ready to generate?
200
+ options:
201
+ - "Generate all"
202
+ - "Cherry-pick (I'll specify which)"
203
+ - "Adjust plan"
204
+ )
205
+ ```
206
+
207
+ If "Cherry-pick": ask user which tests to include.
208
+ If "Adjust plan": apply changes and re-present.
209
+ </step>
210
+
211
+ <step name="execute_tdd_generation">
212
+ For each approved TDD test:
213
+
214
+ 1. **Create test file** following discovered project conventions (directory, naming, imports)
215
+
216
+ 2. **write test** with clear arrange/act/assert structure:
217
+ ```
218
+ // Arrange — set up inputs and expected outputs
219
+ // Act — call the function under test
220
+ // Assert — verify the output matches expectations
221
+ ```
222
+
223
+ 3. **Run the test**:
224
+ ```bash
225
+ {discovered test command}
226
+ ```
227
+
228
+ 4. **Evaluate result:**
229
+ - **Test passes**: Good — the implementation satisfies the test. Verify the test checks meaningful behavior (not just that it compiles).
230
+ - **Test fails with assertion error**: This may be a genuine bug discovered by the test. Flag it:
231
+ ```
232
+ ⚠️ Potential bug found: {test name}
233
+ Expected: {expected}
234
+ Actual: {actual}
235
+ File: {implementation file}
236
+ ```
237
+ Do NOT fix the implementation — this is a test-generation command, not a fix command. Record the finding.
238
+ - **Test fails with error (import, syntax, etc.)**: This is a test error. Fix the test and re-run.
239
+ </step>
240
+
241
+ <step name="execute_e2e_generation">
242
+ For each approved E2E test:
243
+
244
+ 1. **Check for existing tests** covering the same scenario:
245
+ ```bash
246
+ grep -r "{scenario keyword}" {e2e test directory} 2>/dev/null
247
+ ```
248
+ If found, extend rather than duplicate.
249
+
250
+ 2. **Create test file** targeting the user scenario from CONTEXT.md/VERIFICATION.md
251
+
252
+ 3. **Run the E2E test**:
253
+ ```bash
254
+ {discovered e2e command}
255
+ ```
256
+
257
+ 4. **Evaluate result:**
258
+ - **GREEN (passes)**: Record success
259
+ - **RED (fails)**: Determine if it's a test issue or a genuine application bug. Flag bugs:
260
+ ```
261
+ ⚠️ E2E failure: {test name}
262
+ Scenario: {description}
263
+ Error: {error message}
264
+ ```
265
+ - **Cannot run**: Report blocker. Do NOT mark as complete.
266
+ ```
267
+ 🛑 E2E blocker: {reason tests cannot run}
268
+ ```
269
+
270
+ **No-skip rule:** If E2E tests cannot execute (missing dependencies, environment issues), report the blocker and mark the test as incomplete. Never mark success without actually running the test.
271
+ </step>
272
+
273
+ <step name="summary_and_commit">
274
+ Create a test coverage report and present to user:
275
+
276
+ ```
277
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
+ GSD ► TEST GENERATION COMPLETE
279
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
280
+
281
+ ## Results
282
+
283
+ | Category | Generated | Passing | Failing | Blocked |
284
+ |----------|-----------|---------|---------|---------|
285
+ | Unit | {N} | {n1} | {n2} | {n3} |
286
+ | E2E | {M} | {m1} | {m2} | {m3} |
287
+
288
+ ## Files Created/Modified
289
+ {list of test files with paths}
290
+
291
+ ## Coverage Gaps
292
+ {areas that couldn't be tested and why}
293
+
294
+ ## Bugs Discovered
295
+ {any assertion failures that indicate implementation bugs}
296
+ ```
297
+
298
+ Record test generation in project state:
299
+ ```bash
300
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" state-snapshot
301
+ ```
302
+
303
+ If there are passing tests to commit:
304
+
305
+ ```bash
306
+ git add {test files}
307
+ git commit -m "test(phase-${phase_number}): add unit and E2E tests from add-tests command"
308
+ ```
309
+
310
+ Present next steps:
311
+
312
+ ```
313
+ ---
314
+
315
+ ## ▶ Next Up
316
+
317
+ {if bugs discovered:}
318
+ **Fix discovered bugs:** `/gsd-quick fix the {N} test failures discovered in phase ${phase_number}`
319
+
320
+ {if blocked tests:}
321
+ **Resolve test blockers:** {description of what's needed}
322
+
323
+ {otherwise:}
324
+ **All tests passing!** Phase ${phase_number} is fully tested.
325
+
326
+ ---
327
+
328
+ **Also available:**
329
+ - `/gsd-add-tests {next_phase}` — test another phase
330
+ - `/gsd-verify-work {phase_number}` — run UAT verification
331
+
332
+ ---
333
+ ```
334
+ </step>
335
+
336
+ </process>
337
+
338
+ <success_criteria>
339
+ - [ ] Phase artifacts loaded (SUMMARY.md, CONTEXT.md, optionally VERIFICATION.md)
340
+ - [ ] All changed files classified into TDD/E2E/Skip categories
341
+ - [ ] Classification presented to user and approved
342
+ - [ ] Project test structure discovered (directories, conventions, runners)
343
+ - [ ] Test plan presented to user and approved
344
+ - [ ] TDD tests generated with arrange/act/assert structure
345
+ - [ ] E2E tests generated targeting user scenarios
346
+ - [ ] All tests executed — no untested tests marked as passing
347
+ - [ ] Bugs discovered by tests flagged (not fixed)
348
+ - [ ] Test files committed with proper message
349
+ - [ ] Coverage gaps documented
350
+ - [ ] Next steps presented to user
351
+ </success_criteria>