@opengsd/gsd-core 1.13.0 → 1.14.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 (257) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/agents/gsd-advisor-researcher.compact.md +85 -0
  4. package/agents/gsd-ai-researcher.compact.md +96 -0
  5. package/agents/gsd-assumptions-analyzer.compact.md +81 -0
  6. package/agents/gsd-code-fixer.compact.md +458 -0
  7. package/agents/gsd-code-fixer.md +5 -5
  8. package/agents/gsd-code-reviewer.compact.md +269 -0
  9. package/agents/gsd-code-reviewer.md +15 -3
  10. package/agents/gsd-codebase-mapper.compact.md +760 -0
  11. package/agents/gsd-debug-session-manager.compact.md +345 -0
  12. package/agents/gsd-doc-classifier.compact.md +192 -0
  13. package/agents/gsd-doc-synthesizer.compact.md +200 -0
  14. package/agents/gsd-doc-verifier.compact.md +143 -0
  15. package/agents/gsd-doc-writer.compact.md +440 -0
  16. package/agents/gsd-dom-verifier.compact.md +138 -0
  17. package/agents/gsd-domain-researcher.compact.md +141 -0
  18. package/agents/gsd-eval-auditor.compact.md +160 -0
  19. package/agents/gsd-eval-planner.compact.md +137 -0
  20. package/agents/gsd-framework-selector.compact.md +82 -0
  21. package/agents/gsd-integration-checker.compact.md +245 -0
  22. package/agents/gsd-intel-updater.compact.md +226 -0
  23. package/agents/gsd-mempalace-curator.compact.md +45 -0
  24. package/agents/gsd-nyquist-auditor.compact.md +179 -0
  25. package/agents/gsd-pattern-mapper.compact.md +275 -0
  26. package/agents/gsd-project-researcher.compact.md +587 -0
  27. package/agents/gsd-research-synthesizer.compact.md +212 -0
  28. package/agents/gsd-roadmapper.compact.md +454 -0
  29. package/agents/gsd-roadmapper.md +13 -0
  30. package/agents/gsd-security-auditor.compact.md +162 -0
  31. package/agents/gsd-ui-auditor.compact.md +404 -0
  32. package/agents/gsd-ui-checker.compact.md +277 -0
  33. package/agents/gsd-ui-researcher.compact.md +282 -0
  34. package/agents/gsd-user-profiler.compact.md +108 -0
  35. package/bin/install.js +206 -68
  36. package/commands/gsd/cleanup.md +1 -0
  37. package/commands/gsd/code-review.md +2 -1
  38. package/commands/gsd/complete-milestone.md +1 -0
  39. package/commands/gsd/config.md +1 -0
  40. package/commands/gsd/debug.md +1 -0
  41. package/commands/gsd/graphify.md +1 -0
  42. package/commands/gsd/health.md +1 -0
  43. package/commands/gsd/mempalace-capture.md +1 -0
  44. package/commands/gsd/mempalace-recall.md +1 -0
  45. package/commands/gsd/new-milestone.md +1 -0
  46. package/commands/gsd/new-project.md +1 -0
  47. package/commands/gsd/next.md +1 -0
  48. package/commands/gsd/pause-work.md +1 -0
  49. package/commands/gsd/phase.md +1 -0
  50. package/commands/gsd/pr-branch.md +1 -0
  51. package/commands/gsd/resume-work.md +1 -0
  52. package/commands/gsd/review-backlog.md +1 -0
  53. package/commands/gsd/settings.md +2 -1
  54. package/commands/gsd/stats.md +1 -0
  55. package/commands/gsd/thread.md +1 -0
  56. package/commands/gsd/workspace.md +1 -0
  57. package/commands/gsd/workstreams.md +1 -0
  58. package/gsd-core/bin/check-latest-version.cjs +8 -3
  59. package/gsd-core/bin/gsd-tools.cjs +338 -125
  60. package/gsd-core/bin/lib/adr-parser.cjs +1 -1
  61. package/gsd-core/bin/lib/artifacts.cjs +2 -1
  62. package/gsd-core/bin/lib/audit.cjs +39 -22
  63. package/gsd-core/bin/lib/broken-windows.cjs +168 -49
  64. package/gsd-core/bin/lib/capability-lifecycle.cjs +10 -6
  65. package/gsd-core/bin/lib/capability-loader.cjs +135 -1
  66. package/gsd-core/bin/lib/capability-registry.cjs +79 -67
  67. package/gsd-core/bin/lib/capability-source.cjs +19 -2
  68. package/gsd-core/bin/lib/capability-validator.cjs +14 -1
  69. package/gsd-core/bin/lib/check-command-router.cjs +113 -36
  70. package/gsd-core/bin/lib/code-review-depth.cjs +2 -2
  71. package/gsd-core/bin/lib/commands.cjs +650 -72
  72. package/gsd-core/bin/lib/config-loader.cjs +1 -0
  73. package/gsd-core/bin/lib/config.cjs +153 -38
  74. package/gsd-core/bin/lib/coverage.cjs +1 -1
  75. package/gsd-core/bin/lib/decisions.cjs +137 -34
  76. package/gsd-core/bin/lib/external-descriptor-trust.cjs +29 -14
  77. package/gsd-core/bin/lib/gsd2-import.cjs +1 -2
  78. package/gsd-core/bin/lib/health-diagnostic-rules/state-consistency.cjs +12 -1
  79. package/gsd-core/bin/lib/health-diagnostic-rules/worktree-health.cjs +1 -1
  80. package/gsd-core/bin/lib/init.cjs +409 -47
  81. package/gsd-core/bin/lib/install-engine.cjs +16 -3
  82. package/gsd-core/bin/lib/install-profiles.cjs +14 -0
  83. package/gsd-core/bin/lib/installer-migrations.cjs +33 -4
  84. package/gsd-core/bin/lib/loop-resolver.cjs +50 -31
  85. package/gsd-core/bin/lib/mcp-catalog.cjs +2 -2
  86. package/gsd-core/bin/lib/milestone.cjs +19 -8
  87. package/gsd-core/bin/lib/model-resolver.cjs +101 -10
  88. package/gsd-core/bin/lib/phase-command-router.cjs +7 -1
  89. package/gsd-core/bin/lib/phase-id.cjs +161 -22
  90. package/gsd-core/bin/lib/phase-lifecycle.cjs +61 -0
  91. package/gsd-core/bin/lib/phase.cjs +167 -63
  92. package/gsd-core/bin/lib/planning-inspect.cjs +34 -18
  93. package/gsd-core/bin/lib/planning-snapshot.cjs +61 -12
  94. package/gsd-core/bin/lib/planning-workspace.cjs +50 -1
  95. package/gsd-core/bin/lib/pristine-baseline.cjs +182 -0
  96. package/gsd-core/bin/lib/prohibition-enforcement.cjs +91 -4
  97. package/gsd-core/bin/lib/quick-batch.cjs +1 -1
  98. package/gsd-core/bin/lib/refactor-trigger-command-router.cjs +61 -2
  99. package/gsd-core/bin/lib/research-store.cjs +11 -12
  100. package/gsd-core/bin/lib/review-lane-invocation.cjs +23 -0
  101. package/gsd-core/bin/lib/reviewer-step-dispatch.cjs +337 -0
  102. package/gsd-core/bin/lib/roadmap-parser.cjs +56 -15
  103. package/gsd-core/bin/lib/roadmap.cjs +108 -14
  104. package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +27 -10
  105. package/gsd-core/bin/lib/runtime-artifact-install-plan.cjs +12 -3
  106. package/gsd-core/bin/lib/runtime-artifact-layout.cjs +13 -5
  107. package/gsd-core/bin/lib/runtime-hooks-surface.cjs +193 -4
  108. package/gsd-core/bin/lib/security.cjs +126 -7
  109. package/gsd-core/bin/lib/state-document.cjs +130 -28
  110. package/gsd-core/bin/lib/state-md-schema.cjs +21 -14
  111. package/gsd-core/bin/lib/state-transition.cjs +142 -28
  112. package/gsd-core/bin/lib/state.cjs +223 -27
  113. package/gsd-core/bin/lib/surface.cjs +60 -2
  114. package/gsd-core/bin/lib/task-command-router.cjs +12 -6
  115. package/gsd-core/bin/lib/uat.cjs +1 -1
  116. package/gsd-core/bin/lib/update-context.cjs +30 -24
  117. package/gsd-core/bin/lib/vendor/js-yaml.cjs +11 -3
  118. package/gsd-core/bin/lib/verification.cjs +47 -15
  119. package/gsd-core/bin/lib/verify-command-grounding.cjs +1 -1
  120. package/gsd-core/bin/lib/verify.cjs +188 -23
  121. package/gsd-core/bin/lib/workstream-inventory.cjs +1 -0
  122. package/gsd-core/bin/lib/worktree-safety.cjs +13 -7
  123. package/gsd-core/bin/shared/config-defaults.manifest.json +1 -0
  124. package/gsd-core/bin/shared/config-schema.manifest.json +5 -0
  125. package/gsd-core/bin/verify-reapply-patches.cjs +439 -80
  126. package/gsd-core/references/compact-content-gate.md +66 -0
  127. package/gsd-core/references/loop-hook-dispatch.md +18 -0
  128. package/gsd-core/references/model-profiles.md +12 -3
  129. package/gsd-core/references/planning-config.md +3 -0
  130. package/gsd-core/references/tdd.md +5 -2
  131. package/gsd-core/references/thinking-models-planning.md +18 -2
  132. package/gsd-core/references/verification-patterns.md +17 -4
  133. package/gsd-core/references/worktree-path-safety.md +112 -2
  134. package/gsd-core/templates/README.md +7 -1
  135. package/gsd-core/templates/state.md +6 -3
  136. package/gsd-core/templates/summary.compact.md +212 -0
  137. package/gsd-core/templates/user-setup.compact.md +199 -0
  138. package/gsd-core/templates/user-setup.md +0 -9
  139. package/gsd-core/workflows/add-todo.md +3 -2
  140. package/gsd-core/workflows/autonomous.md +13 -10
  141. package/gsd-core/workflows/check-todos.md +4 -2
  142. package/gsd-core/workflows/cleanup.md +3 -1
  143. package/gsd-core/workflows/code-review/steps/structural-pre-pass.md +7 -0
  144. package/gsd-core/workflows/code-review-fix.md +3 -3
  145. package/gsd-core/workflows/code-review.md +156 -30
  146. package/gsd-core/workflows/complete-milestone/detail/elaboration.md +274 -0
  147. package/gsd-core/workflows/complete-milestone.md +39 -262
  148. package/gsd-core/workflows/docs-update/detail/elaboration.md +179 -0
  149. package/gsd-core/workflows/docs-update.md +14 -155
  150. package/gsd-core/workflows/execute-phase/detail/elaboration.md +124 -0
  151. package/gsd-core/workflows/execute-phase/steps/codebase-drift-gate.md +18 -3
  152. package/gsd-core/workflows/execute-phase/steps/completion-reconciliation.md +56 -0
  153. package/gsd-core/workflows/execute-phase/steps/executor-isolation-dispatch.md +7 -2
  154. package/gsd-core/workflows/execute-phase/steps/executor-progress-policy.md +43 -0
  155. package/gsd-core/workflows/execute-phase/steps/sequential-root-pin.md +35 -0
  156. package/gsd-core/workflows/execute-phase.md +53 -152
  157. package/gsd-core/workflows/execute-plan.md +20 -7
  158. package/gsd-core/workflows/help/modes/full.compact.md +398 -0
  159. package/gsd-core/workflows/help.md +1 -1
  160. package/gsd-core/workflows/map-codebase.md +50 -3
  161. package/gsd-core/workflows/new-milestone.md +54 -12
  162. package/gsd-core/workflows/new-project/detail/elaboration.md +216 -0
  163. package/gsd-core/workflows/new-project.md +32 -202
  164. package/gsd-core/workflows/plan-phase/detail/elaboration.md +209 -0
  165. package/gsd-core/workflows/plan-phase.md +22 -181
  166. package/gsd-core/workflows/pr-branch.md +19 -7
  167. package/gsd-core/workflows/quick.md +8 -1
  168. package/gsd-core/workflows/reapply-patches.md +77 -3
  169. package/gsd-core/workflows/settings.md +18 -5
  170. package/gsd-core/workflows/update.md +7 -5
  171. package/gsd-core/workflows/verify-work/detail/elaboration.md +230 -0
  172. package/gsd-core/workflows/verify-work.md +20 -180
  173. package/hooks/dist/gsd-agent-isolation-guard.js +42 -16
  174. package/hooks/dist/gsd-context-monitor.js +88 -15
  175. package/hooks/dist/gsd-cursor-subagent-start.js +34 -14
  176. package/hooks/dist/gsd-secret-read-guard.js +44 -18
  177. package/hooks/dist/gsd-statusline.js +11 -7
  178. package/hooks/dist/gsd-validate-commit.sh +34 -4
  179. package/hooks/dist/gsd-worktree-path-guard.js +25 -14
  180. package/hooks/dist/gsd-write-guard.js +46 -1
  181. package/hooks/dist/lib/dispatch-identity.js +187 -0
  182. package/hooks/dist/lib/filename-classification.js +64 -0
  183. package/hooks/dist/lib/isolation-deny-reason.js +53 -1
  184. package/hooks/dist/lib/isolation-sentinel.js +58 -19
  185. package/hooks/gsd-agent-isolation-guard.js +42 -16
  186. package/hooks/gsd-context-monitor.js +88 -15
  187. package/hooks/gsd-cursor-subagent-start.js +34 -14
  188. package/hooks/gsd-secret-read-guard.js +44 -18
  189. package/hooks/gsd-statusline.js +11 -7
  190. package/hooks/gsd-validate-commit.sh +34 -4
  191. package/hooks/gsd-worktree-path-guard.js +25 -14
  192. package/hooks/gsd-write-guard.js +46 -1
  193. package/hooks/lib/dispatch-identity.js +187 -0
  194. package/hooks/lib/filename-classification.js +64 -0
  195. package/hooks/lib/isolation-deny-reason.js +53 -1
  196. package/hooks/lib/isolation-sentinel.js +58 -19
  197. package/package.json +10 -6
  198. package/scripts/benchmark-compact-content-variants.cjs +298 -0
  199. package/scripts/benchmark-compact-content.cjs +368 -0
  200. package/scripts/check-contract-drift.cjs +4 -1
  201. package/scripts/check-env.cjs +36 -8
  202. package/scripts/check-glossary-refs.cjs +25 -21
  203. package/scripts/ci-next-health.cjs +271 -0
  204. package/scripts/ci-prepare-test-scope.cjs +7 -7
  205. package/scripts/ci-test-scope.cjs +126 -20
  206. package/scripts/ci-timeout-report.cjs +1 -1
  207. package/scripts/diff-touches-shipped-paths.cjs +1 -1
  208. package/scripts/docs-guard-registry.cjs +7 -2
  209. package/scripts/gen-adr-index.cjs +8 -2
  210. package/scripts/gen-inventory-manifest.cjs +12 -0
  211. package/scripts/gen-platform-conformance-tier.cjs +557 -0
  212. package/scripts/lib/drift-scan.cjs +1 -1
  213. package/scripts/lib/macos-conformance-tier.generated.cjs +210 -0
  214. package/scripts/lib/npm-version-check-diagnosis.cjs +59 -0
  215. package/scripts/lib/platform-conformance-tier.generated.cjs +276 -0
  216. package/scripts/lib/suite-detection.cjs +32 -0
  217. package/scripts/lint-allowed-tools-parity.cjs +221 -0
  218. package/scripts/lint-docs-guard-registration.exempt-baseline.cjs +19 -2
  219. package/scripts/lint-phase-id-drift.cjs +338 -13
  220. package/scripts/lint-response-language-coverage.cjs +9 -3
  221. package/scripts/lint-source-test-name-collision.cjs +1 -1
  222. package/scripts/lint-test-file-count.allowlist.json +1 -0
  223. package/scripts/lint-vendored-deps.cjs +128 -17
  224. package/scripts/lint-workflow-shellcheck-baseline.json +85 -0
  225. package/scripts/prompt-injection-scan.sh +14 -0
  226. package/scripts/workflow-size.cjs +139 -0
  227. package/skills/gsd-cleanup/SKILL.md +1 -0
  228. package/skills/gsd-code-review/SKILL.md +2 -1
  229. package/skills/gsd-complete-milestone/SKILL.md +1 -0
  230. package/skills/gsd-config/SKILL.md +1 -0
  231. package/skills/gsd-debug/SKILL.md +1 -0
  232. package/skills/gsd-graphify/SKILL.md +1 -0
  233. package/skills/gsd-health/SKILL.md +1 -0
  234. package/skills/gsd-mempalace-capture/SKILL.md +1 -0
  235. package/skills/gsd-mempalace-recall/SKILL.md +1 -0
  236. package/skills/gsd-new-milestone/SKILL.md +1 -0
  237. package/skills/gsd-new-project/SKILL.md +1 -0
  238. package/skills/gsd-next/SKILL.md +1 -0
  239. package/skills/gsd-pause-work/SKILL.md +1 -0
  240. package/skills/gsd-phase/SKILL.md +1 -0
  241. package/skills/gsd-pr-branch/SKILL.md +1 -0
  242. package/skills/gsd-resume-work/SKILL.md +1 -0
  243. package/skills/gsd-review-backlog/SKILL.md +1 -0
  244. package/skills/gsd-settings/SKILL.md +2 -1
  245. package/skills/gsd-stats/SKILL.md +1 -0
  246. package/skills/gsd-thread/SKILL.md +1 -0
  247. package/skills/gsd-workspace/SKILL.md +1 -0
  248. package/skills/gsd-workstreams/SKILL.md +1 -0
  249. package/vscode/package.json +1 -1
  250. package/gsd-core/templates/claude-md.md +0 -145
  251. package/gsd-core/templates/codebase/concerns.md +0 -310
  252. package/gsd-core/templates/codebase/conventions.md +0 -307
  253. package/gsd-core/templates/codebase/integrations.md +0 -280
  254. package/gsd-core/templates/codebase/structure.md +0 -285
  255. package/gsd-core/templates/codebase/testing.md +0 -480
  256. package/gsd-core/templates/debug-subagent-prompt.md +0 -91
  257. package/gsd-core/templates/discovery.md +0 -146
@@ -1,480 +0,0 @@
1
- # Testing Patterns Template
2
-
3
- Template for `.planning/codebase/TESTING.md` - captures test framework and patterns.
4
-
5
- **Purpose:** Document how tests are written and run. Guide for adding tests that match existing patterns.
6
-
7
- ---
8
-
9
- ## File Template
10
-
11
- ```markdown
12
- # Testing Patterns
13
-
14
- **Analysis Date:** [YYYY-MM-DD]
15
-
16
- ## Test Framework
17
-
18
- **Runner:**
19
- - [Framework: e.g., "Jest 29.x", "Vitest 1.x"]
20
- - [Config: e.g., "jest.config.js in project root"]
21
-
22
- **Assertion Library:**
23
- - [Library: e.g., "built-in expect", "chai"]
24
- - [Matchers: e.g., "toBe, toEqual, toThrow"]
25
-
26
- **Run Commands:**
27
- ```bash
28
- [e.g., "npm test" or "npm run test"] # Run all tests
29
- [e.g., "npm test -- --watch"] # Watch mode
30
- [e.g., "npm test -- path/to/file.test.ts"] # Single file
31
- [e.g., "npm run test:coverage"] # Coverage report
32
- ```
33
-
34
- ## Test File Organization
35
-
36
- **Location:**
37
- - [Pattern: e.g., "*.test.ts alongside source files"]
38
- - [Alternative: e.g., "__tests__/ directory" or "separate tests/ tree"]
39
-
40
- **Naming:**
41
- - [Unit tests: e.g., "module-name.test.ts"]
42
- - [Integration: e.g., "feature-name.integration.test.ts"]
43
- - [E2E: e.g., "user-flow.e2e.test.ts"]
44
-
45
- **Structure:**
46
- ```
47
- [Show actual directory pattern, e.g.:
48
- src/
49
- lib/
50
- utils.ts
51
- utils.test.ts
52
- services/
53
- user-service.ts
54
- user-service.test.ts
55
- ]
56
- ```
57
-
58
- ## Test Structure
59
-
60
- **Suite Organization:**
61
- ```typescript
62
- [Show actual pattern used, e.g.:
63
-
64
- describe('ModuleName', () => {
65
- describe('functionName', () => {
66
- it('should handle success case', () => {
67
- // arrange
68
- // act
69
- // assert
70
- });
71
-
72
- it('should handle error case', () => {
73
- // test code
74
- });
75
- });
76
- });
77
- ]
78
- ```
79
-
80
- **Patterns:**
81
- - [Setup: e.g., "beforeEach for shared setup, avoid beforeAll"]
82
- - [Teardown: e.g., "afterEach to clean up, restore mocks"]
83
- - [Structure: e.g., "arrange/act/assert pattern required"]
84
-
85
- ## Mocking
86
-
87
- **Framework:**
88
- - [Tool: e.g., "Jest built-in mocking", "Vitest vi", "Sinon"]
89
- - [Import mocking: e.g., "vi.mock() at top of file"]
90
-
91
- **Patterns:**
92
- ```typescript
93
- [Show actual mocking pattern, e.g.:
94
-
95
- // Mock external dependency
96
- vi.mock('./external-service', () => ({
97
- fetchData: vi.fn()
98
- }));
99
-
100
- // Mock in test
101
- const mockFetch = vi.mocked(fetchData);
102
- mockFetch.mockResolvedValue({ data: 'test' });
103
- ]
104
- ```
105
-
106
- **What to Mock:**
107
- - [e.g., "External APIs, file system, database"]
108
- - [e.g., "Time/dates (use vi.useFakeTimers)"]
109
- - [e.g., "Network calls (use mock fetch)"]
110
-
111
- **What NOT to Mock:**
112
- - [e.g., "Pure functions, utilities"]
113
- - [e.g., "Internal business logic"]
114
-
115
- ## Fixtures and Factories
116
-
117
- **Test Data:**
118
- ```typescript
119
- [Show pattern for creating test data, e.g.:
120
-
121
- // Factory pattern
122
- function createTestUser(overrides?: Partial<User>): User {
123
- return {
124
- id: 'test-id',
125
- name: 'Test User',
126
- email: 'test@example.com',
127
- ...overrides
128
- };
129
- }
130
-
131
- // Fixture file
132
- // tests/fixtures/users.ts
133
- export const mockUsers = [/* ... */];
134
- ]
135
- ```
136
-
137
- **Location:**
138
- - [e.g., "tests/fixtures/ for shared fixtures"]
139
- - [e.g., "factory functions in test file or tests/factories/"]
140
-
141
- ## Coverage
142
-
143
- **Requirements:**
144
- - [Target: e.g., "80% line coverage", "no specific target"]
145
- - [Enforcement: e.g., "CI blocks <80%", "coverage for awareness only"]
146
-
147
- **Configuration:**
148
- - [Tool: e.g., "built-in coverage via --coverage flag"]
149
- - [Exclusions: e.g., "exclude *.test.ts, config files"]
150
-
151
- **View Coverage:**
152
- ```bash
153
- [e.g., "npm run test:coverage"]
154
- [e.g., "open coverage/index.html"]
155
- ```
156
-
157
- ## Test Types
158
-
159
- **Unit Tests:**
160
- - [Scope: e.g., "test single function/class in isolation"]
161
- - [Mocking: e.g., "mock all external dependencies"]
162
- - [Speed: e.g., "must run in <1s per test"]
163
-
164
- **Integration Tests:**
165
- - [Scope: e.g., "test multiple modules together"]
166
- - [Mocking: e.g., "mock external services, use real internal modules"]
167
- - [Setup: e.g., "use test database, seed data"]
168
-
169
- **E2E Tests:**
170
- - [Framework: e.g., "Playwright for E2E"]
171
- - [Scope: e.g., "test full user flows"]
172
- - [Location: e.g., "e2e/ directory separate from unit tests"]
173
-
174
- ## Common Patterns
175
-
176
- **Async Testing:**
177
- ```typescript
178
- [Show pattern, e.g.:
179
-
180
- it('should handle async operation', async () => {
181
- const result = await asyncFunction();
182
- expect(result).toBe('expected');
183
- });
184
- ]
185
- ```
186
-
187
- **Error Testing:**
188
- ```typescript
189
- [Show pattern, e.g.:
190
-
191
- it('should throw on invalid input', () => {
192
- expect(() => functionCall()).toThrow('error message');
193
- });
194
-
195
- // Async error
196
- it('should reject on failure', async () => {
197
- await expect(asyncCall()).rejects.toThrow('error message');
198
- });
199
- ]
200
- ```
201
-
202
- **Snapshot Testing:**
203
- - [Usage: e.g., "for React components only" or "not used"]
204
- - [Location: e.g., "__snapshots__/ directory"]
205
-
206
- ---
207
-
208
- *Testing analysis: [date]*
209
- *Update when test patterns change*
210
- ```
211
-
212
- <good_examples>
213
- ```markdown
214
- # Testing Patterns
215
-
216
- **Analysis Date:** 2025-01-20
217
-
218
- ## Test Framework
219
-
220
- **Runner:**
221
- - Vitest 1.0.4
222
- - Config: vitest.config.ts in project root
223
-
224
- **Assertion Library:**
225
- - Vitest built-in expect
226
- - Matchers: toBe, toEqual, toThrow, toMatchObject
227
-
228
- **Run Commands:**
229
- ```bash
230
- npm test # Run all tests
231
- npm test -- --watch # Watch mode
232
- npm test -- path/to/file.test.ts # Single file
233
- npm run test:coverage # Coverage report
234
- ```
235
-
236
- ## Test File Organization
237
-
238
- **Location:**
239
- - *.test.ts alongside source files
240
- - No separate tests/ directory
241
-
242
- **Naming:**
243
- - unit-name.test.ts for all tests
244
- - No distinction between unit/integration in filename
245
-
246
- **Structure:**
247
- ```
248
- src/
249
- lib/
250
- parser.ts
251
- parser.test.ts
252
- services/
253
- install-service.ts
254
- install-service.test.ts
255
- bin/
256
- install.ts
257
- (no test - integration tested via CLI)
258
- ```
259
-
260
- ## Test Structure
261
-
262
- **Suite Organization:**
263
- ```typescript
264
- import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
265
-
266
- describe('ModuleName', () => {
267
- describe('functionName', () => {
268
- beforeEach(() => {
269
- // reset state
270
- });
271
-
272
- it('should handle valid input', () => {
273
- // arrange
274
- const input = createTestInput();
275
-
276
- // act
277
- const result = functionName(input);
278
-
279
- // assert
280
- expect(result).toEqual(expectedOutput);
281
- });
282
-
283
- it('should throw on invalid input', () => {
284
- expect(() => functionName(null)).toThrow('Invalid input');
285
- });
286
- });
287
- });
288
- ```
289
-
290
- **Patterns:**
291
- - Use beforeEach for per-test setup, avoid beforeAll
292
- - Use afterEach to restore mocks: vi.restoreAllMocks()
293
- - Explicit arrange/act/assert comments in complex tests
294
- - One assertion focus per test (but multiple expects OK)
295
-
296
- ## Mocking
297
-
298
- **Framework:**
299
- - Vitest built-in mocking (vi)
300
- - Module mocking via vi.mock() at top of test file
301
-
302
- **Patterns:**
303
- ```typescript
304
- import { vi } from 'vitest';
305
- import { externalFunction } from './external';
306
-
307
- // Mock module
308
- vi.mock('./external', () => ({
309
- externalFunction: vi.fn()
310
- }));
311
-
312
- describe('test suite', () => {
313
- it('mocks function', () => {
314
- const mockFn = vi.mocked(externalFunction);
315
- mockFn.mockReturnValue('mocked result');
316
-
317
- // test code using mocked function
318
-
319
- expect(mockFn).toHaveBeenCalledWith('expected arg');
320
- });
321
- });
322
- ```
323
-
324
- **What to Mock:**
325
- - File system operations (fs-extra)
326
- - Child process execution (child_process.exec)
327
- - External API calls
328
- - Environment variables (process.env)
329
-
330
- **What NOT to Mock:**
331
- - Internal pure functions
332
- - Simple utilities (string manipulation, array helpers)
333
- - TypeScript types
334
-
335
- ## Fixtures and Factories
336
-
337
- **Test Data:**
338
- ```typescript
339
- // Factory functions in test file
340
- function createTestConfig(overrides?: Partial<Config>): Config {
341
- return {
342
- targetDir: '/tmp/test',
343
- global: false,
344
- ...overrides
345
- };
346
- }
347
-
348
- // Shared fixtures in tests/fixtures/
349
- // tests/fixtures/sample-command.md
350
- export const sampleCommand = `---
351
- description: Test command
352
- ---
353
- Content here`;
354
- ```
355
-
356
- **Location:**
357
- - Factory functions: define in test file near usage
358
- - Shared fixtures: tests/fixtures/ (for multi-file test data)
359
- - Mock data: inline in test when simple, factory when complex
360
-
361
- ## Coverage
362
-
363
- **Requirements:**
364
- - No enforced coverage target
365
- - Coverage tracked for awareness
366
- - Focus on critical paths (parsers, service logic)
367
-
368
- **Configuration:**
369
- - Vitest coverage via c8 (built-in)
370
- - Excludes: *.test.ts, bin/install.ts, config files
371
-
372
- **View Coverage:**
373
- ```bash
374
- npm run test:coverage
375
- open coverage/index.html
376
- ```
377
-
378
- ## Test Types
379
-
380
- **Unit Tests:**
381
- - Test single function in isolation
382
- - Mock all external dependencies (fs, child_process)
383
- - Fast: each test <100ms
384
- - Examples: parser.test.ts, validator.test.ts
385
-
386
- **Integration Tests:**
387
- - Test multiple modules together
388
- - Mock only external boundaries (file system, process)
389
- - Examples: install-service.test.ts (tests service + parser)
390
-
391
- **E2E Tests:**
392
- - Not currently used
393
- - CLI integration tested manually
394
-
395
- ## Common Patterns
396
-
397
- **Async Testing:**
398
- ```typescript
399
- it('should handle async operation', async () => {
400
- const result = await asyncFunction();
401
- expect(result).toBe('expected');
402
- });
403
- ```
404
-
405
- **Error Testing:**
406
- ```typescript
407
- it('should throw on invalid input', () => {
408
- expect(() => parse(null)).toThrow('Cannot parse null');
409
- });
410
-
411
- // Async error
412
- it('should reject on file not found', async () => {
413
- await expect(readConfig('invalid.txt')).rejects.toThrow('ENOENT');
414
- });
415
- ```
416
-
417
- **File System Mocking:**
418
- ```typescript
419
- import { vi } from 'vitest';
420
- import * as fs from 'fs-extra';
421
-
422
- vi.mock('fs-extra');
423
-
424
- it('mocks file system', () => {
425
- vi.mocked(fs.readFile).mockResolvedValue('file content');
426
- // test code
427
- });
428
- ```
429
-
430
- **Snapshot Testing:**
431
- - Not used in this codebase
432
- - Prefer explicit assertions for clarity
433
-
434
- ---
435
-
436
- *Testing analysis: 2025-01-20*
437
- *Update when test patterns change*
438
- ```
439
- </good_examples>
440
-
441
- <guidelines>
442
- **What belongs in TESTING.md:**
443
- - Test framework and runner configuration
444
- - Test file location and naming patterns
445
- - Test structure (describe/it, beforeEach patterns)
446
- - Mocking approach and examples
447
- - Fixture/factory patterns
448
- - Coverage requirements
449
- - How to run tests (commands)
450
- - Common testing patterns in actual code
451
-
452
- **What does NOT belong here:**
453
- - Specific test cases (defer to actual test files)
454
- - Technology choices (that's STACK.md)
455
- - CI/CD setup (that's deployment docs)
456
-
457
- **When filling this template:**
458
- - Check package.json scripts for test commands
459
- - Find test config file (jest.config.js, vitest.config.ts)
460
- - Read 3-5 existing test files to identify patterns
461
- - Look for test utilities in tests/ or test-utils/
462
- - Check for coverage configuration
463
- - Document actual patterns used, not ideal patterns
464
-
465
- **Useful for phase planning when:**
466
- - Adding new features (write matching tests)
467
- - Refactoring (maintain test patterns)
468
- - Fixing bugs (add regression tests)
469
- - Understanding verification approach
470
- - Setting up test infrastructure
471
-
472
- **Analysis approach:**
473
- - Check package.json for test framework and scripts
474
- - Read test config file for coverage, setup
475
- - Examine test file organization (collocated vs separate)
476
- - Review 5 test files for patterns (mocking, structure, assertions)
477
- - Look for test utilities, fixtures, factories
478
- - Note any test types (unit, integration, e2e)
479
- - Document commands for running tests
480
- </guidelines>
@@ -1,91 +0,0 @@
1
- # Debug Subagent Prompt Template
2
-
3
- Template for spawning gsd-debugger agent. The agent contains all debugging expertise - this template provides problem context only.
4
-
5
- ---
6
-
7
- ## Template
8
-
9
- ```markdown
10
- <objective>
11
- Investigate issue: {issue_id}
12
-
13
- **Summary:** {issue_summary}
14
- </objective>
15
-
16
- <symptoms>
17
- expected: {expected}
18
- actual: {actual}
19
- errors: {errors}
20
- reproduction: {reproduction}
21
- timeline: {timeline}
22
- </symptoms>
23
-
24
- <mode>
25
- symptoms_prefilled: {true_or_false}
26
- goal: {find_root_cause_only | find_and_fix}
27
- </mode>
28
-
29
- <debug_file>
30
- Create: .planning/debug/{slug}.md
31
- </debug_file>
32
- ```
33
-
34
- ---
35
-
36
- ## Placeholders
37
-
38
- | Placeholder | Source | Example |
39
- |-------------|--------|---------|
40
- | `{issue_id}` | Orchestrator-assigned | `auth-screen-dark` |
41
- | `{issue_summary}` | User description | `Auth screen is too dark` |
42
- | `{expected}` | From symptoms | `See logo clearly` |
43
- | `{actual}` | From symptoms | `Screen is dark` |
44
- | `{errors}` | From symptoms | `None in console` |
45
- | `{reproduction}` | From symptoms | `Open /auth page` |
46
- | `{timeline}` | From symptoms | `After recent deploy` |
47
- | `{goal}` | Orchestrator sets | `find_and_fix` |
48
- | `{slug}` | Generated | `auth-screen-dark` |
49
-
50
- ---
51
-
52
- ## Usage
53
-
54
- **From /gsd:debug:**
55
- ```python
56
- Task(
57
- prompt=filled_template,
58
- subagent_type="gsd-debugger",
59
- description="Debug {slug}"
60
- )
61
- ```
62
-
63
- **From diagnose-issues (UAT):**
64
- ```python
65
- Task(prompt=template, subagent_type="gsd-debugger", description="Debug UAT-001")
66
- ```
67
-
68
- ---
69
-
70
- ## Continuation
71
-
72
- For checkpoints, spawn fresh agent with:
73
-
74
- ```markdown
75
- <objective>
76
- Continue debugging {slug}. Evidence is in the debug file.
77
- </objective>
78
-
79
- <prior_state>
80
- Debug file: @.planning/debug/{slug}.md
81
- </prior_state>
82
-
83
- <checkpoint_response>
84
- **Type:** {checkpoint_type}
85
- **Response:** {user_response}
86
- </checkpoint_response>
87
-
88
- <mode>
89
- goal: {goal}
90
- </mode>
91
- ```
@@ -1,146 +0,0 @@
1
- # Discovery Template
2
-
3
- Template for `.planning/phases/XX-name/DISCOVERY.md` - shallow research for library/option decisions.
4
-
5
- **Purpose:** Answer "which library/option should we use" questions during mandatory discovery in plan-phase.
6
-
7
- For deep ecosystem research ("how do experts build this"), use `/gsd:plan-phase --research-phase` which produces RESEARCH.md.
8
-
9
- ---
10
-
11
- ## File Template
12
-
13
- ```markdown
14
- ---
15
- phase: XX-name
16
- type: discovery
17
- topic: [discovery-topic]
18
- ---
19
-
20
- <session_initialization>
21
- Before beginning discovery, verify today's date:
22
- !`date +%Y-%m-%d`
23
-
24
- Use this date when searching for "current" or "latest" information.
25
- Example: If today is 2025-11-22, search for "2025" not "2024".
26
- </session_initialization>
27
-
28
- <discovery_objective>
29
- Discover [topic] to inform [phase name] implementation.
30
-
31
- Purpose: [What decision/implementation this enables]
32
- Scope: [Boundaries]
33
- Output: DISCOVERY.md with recommendation
34
- </discovery_objective>
35
-
36
- <discovery_scope>
37
- <include>
38
- - [Question to answer]
39
- - [Area to investigate]
40
- - [Specific comparison if needed]
41
- </include>
42
-
43
- <exclude>
44
- - [Out of scope for this discovery]
45
- - [Defer to implementation phase]
46
- </exclude>
47
- </discovery_scope>
48
-
49
- <discovery_protocol>
50
-
51
- **Source Priority:**
52
- 1. **Context7 MCP** - For library/framework documentation (current, authoritative)
53
- 2. **Official Docs** - For platform-specific or non-indexed libraries
54
- 3. **WebSearch** - For comparisons, trends, community patterns (verify all findings)
55
-
56
- **Quality Checklist:**
57
- Before completing discovery, verify:
58
- - [ ] All claims have authoritative sources (Context7 or official docs)
59
- - [ ] Negative claims ("X is not possible") verified with official documentation
60
- - [ ] API syntax/configuration from Context7 or official docs (never WebSearch alone)
61
- - [ ] WebSearch findings cross-checked with authoritative sources
62
- - [ ] Recent updates/changelogs checked for breaking changes
63
- - [ ] Alternative approaches considered (not just first solution found)
64
-
65
- **Confidence Levels:**
66
- - HIGH: Context7 or official docs confirm
67
- - MEDIUM: WebSearch + Context7/official docs confirm
68
- - LOW: WebSearch only or training knowledge only (mark for validation)
69
-
70
- </discovery_protocol>
71
-
72
-
73
- <output_structure>
74
- Create `.planning/phases/XX-name/DISCOVERY.md`:
75
-
76
- ```markdown
77
- # [Topic] Discovery
78
-
79
- ## Summary
80
- [2-3 paragraph executive summary - what was researched, what was found, what's recommended]
81
-
82
- ## Primary Recommendation
83
- [What to do and why - be specific and actionable]
84
-
85
- ## Alternatives Considered
86
- [What else was evaluated and why not chosen]
87
-
88
- ## Key Findings
89
-
90
- ### [Category 1]
91
- - [Finding with source URL and relevance to our case]
92
-
93
- ### [Category 2]
94
- - [Finding with source URL and relevance]
95
-
96
- ## Code Examples
97
- [Relevant implementation patterns, if applicable]
98
-
99
- ## Metadata
100
-
101
- <metadata>
102
- <confidence level="high|medium|low">
103
- [Why this confidence level - based on source quality and verification]
104
- </confidence>
105
-
106
- <sources>
107
- - [Primary authoritative sources used]
108
- </sources>
109
-
110
- <open_questions>
111
- [What couldn't be determined or needs validation during implementation]
112
- </open_questions>
113
-
114
- <validation_checkpoints>
115
- [If confidence is LOW or MEDIUM, list specific things to verify during implementation]
116
- </validation_checkpoints>
117
- </metadata>
118
- ```
119
- </output_structure>
120
-
121
- <success_criteria>
122
- - All scope questions answered with authoritative sources
123
- - Quality checklist items completed
124
- - Clear primary recommendation
125
- - Low-confidence findings marked with validation checkpoints
126
- - Ready to inform PLAN.md creation
127
- </success_criteria>
128
-
129
- <guidelines>
130
- **When to use discovery:**
131
- - Technology choice unclear (library A vs B)
132
- - Best practices needed for unfamiliar integration
133
- - API/library investigation required
134
- - Single decision pending
135
-
136
- **When NOT to use:**
137
- - Established patterns (CRUD, auth with known library)
138
- - Implementation details (defer to execution)
139
- - Questions answerable from existing project context
140
-
141
- **When to use RESEARCH.md instead:**
142
- - Niche/complex domains (3D, games, audio, shaders)
143
- - Need ecosystem knowledge, not just library choice
144
- - "How do experts build this" questions
145
- - Use `/gsd:plan-phase --research-phase` for these
146
- </guidelines>