universal-dev-standards 6.7.5 → 6.9.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 (213) hide show
  1. package/bin/uds.js +19 -2
  2. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +14 -2
  3. package/bundled/ai/standards/adr-standards.ai.yaml +14 -2
  4. package/bundled/ai/standards/ai-instruction-standards.ai.yaml +6 -6
  5. package/bundled/ai/standards/code-review.ai.yaml +13 -3
  6. package/bundled/ai/standards/commit-message.ai.yaml +8 -4
  7. package/bundled/ai/standards/deferred-item-exit.ai.yaml +225 -0
  8. package/bundled/ai/standards/feature-discovery-standards.ai.yaml +14 -2
  9. package/bundled/ai/standards/governance-layer.ai.yaml +128 -2
  10. package/bundled/ai/standards/logging.ai.yaml +2 -2
  11. package/bundled/ai/standards/retrospective-standards.ai.yaml +14 -2
  12. package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +73 -2
  13. package/bundled/ai/standards/security-standards.ai.yaml +2 -2
  14. package/bundled/ai/standards/spec-driven-development.ai.yaml +14 -2
  15. package/bundled/ai/standards/tech-debt-standards.ai.yaml +87 -3
  16. package/bundled/ai/standards/turn-completion-integrity.ai.yaml +131 -0
  17. package/bundled/core/acceptance-criteria-traceability.md +5 -2
  18. package/bundled/core/adr-standards.md +26 -2
  19. package/bundled/core/ai-instruction-standards.md +9 -7
  20. package/bundled/core/code-review-checklist.md +5 -2
  21. package/bundled/core/context-aware-loading.md +1 -1
  22. package/bundled/core/deferred-item-exit.md +254 -0
  23. package/bundled/core/feature-discovery-standards.md +5 -1
  24. package/bundled/core/governance-layer.md +114 -2
  25. package/bundled/core/retrospective-standards.md +4 -2
  26. package/bundled/core/reverse-engineering-standards.md +81 -2
  27. package/bundled/core/spec-driven-development.md +8 -2
  28. package/bundled/core/tech-debt-standards.md +67 -8
  29. package/bundled/core/turn-completion-integrity.md +196 -0
  30. package/bundled/hooks/check-dangerous-cmd.mjs +60 -0
  31. package/bundled/hooks/check-logging-standard.mjs +59 -0
  32. package/bundled/hooks/check-turn-completion.mjs +233 -0
  33. package/bundled/hooks/inject-standards.mjs +183 -0
  34. package/bundled/hooks/telemetry-wrapper.mjs +77 -0
  35. package/bundled/hooks/turn-completion/detect.mjs +99 -0
  36. package/bundled/hooks/turn-completion/locales/en.mjs +159 -0
  37. package/bundled/hooks/turn-completion/locales/zh-TW.mjs +166 -0
  38. package/bundled/hooks/validate-commit-msg.mjs +104 -0
  39. package/bundled/locales/zh-CN/CHANGELOG.md +65 -3
  40. package/bundled/locales/zh-CN/CLAUDE.md +1 -1
  41. package/bundled/locales/zh-CN/README.md +7 -7
  42. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  43. package/bundled/locales/zh-CN/core/adr-standards.md +1 -1
  44. package/bundled/locales/zh-CN/core/ai-instruction-standards.md +10 -8
  45. package/bundled/locales/zh-CN/core/governance-layer.md +118 -6
  46. package/bundled/locales/zh-CN/core/retrospective-standards.md +1 -1
  47. package/bundled/locales/zh-CN/core/tech-debt-standards.md +71 -4
  48. package/bundled/locales/zh-CN/core/turn-completion-integrity.md +190 -0
  49. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +27 -6
  50. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +29 -68
  51. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +172 -24
  52. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +1 -2
  53. package/bundled/locales/zh-CN/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  54. package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +3 -3
  55. package/bundled/locales/zh-CN/skills/agents/README.md +1 -1
  56. package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +2 -0
  57. package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +2 -0
  58. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +22 -12
  59. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +12 -9
  60. package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +1 -0
  61. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +17 -13
  62. package/bundled/locales/zh-CN/skills/commands/config.md +0 -1
  63. package/bundled/locales/zh-CN/skills/commands/init.md +1 -2
  64. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +2 -0
  65. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -0
  66. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +2 -0
  67. package/bundled/locales/zh-CN/skills/observability-assistant/SKILL.md +1 -0
  68. package/bundled/locales/zh-CN/skills/project-structure-guide/SKILL.md +1 -0
  69. package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +3 -0
  70. package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +2 -0
  71. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +3 -0
  72. package/bundled/locales/zh-CN/skills/reverse-engineer/tdd-analysis.md +13 -23
  73. package/bundled/locales/zh-CN/skills/runbook-assistant/SKILL.md +1 -0
  74. package/bundled/locales/zh-CN/skills/slo-assistant/SKILL.md +1 -0
  75. package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +2 -0
  76. package/bundled/locales/zh-CN/skills/workflows/README.md +2 -11
  77. package/bundled/locales/zh-TW/CHANGELOG.md +65 -3
  78. package/bundled/locales/zh-TW/CLAUDE.md +1 -1
  79. package/bundled/locales/zh-TW/README.md +7 -7
  80. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  81. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +2 -0
  82. package/bundled/locales/zh-TW/core/adr-standards.md +26 -5
  83. package/bundled/locales/zh-TW/core/ai-instruction-standards.md +10 -8
  84. package/bundled/locales/zh-TW/core/code-review-checklist.md +2 -0
  85. package/bundled/locales/zh-TW/core/container-image-standards.md +2 -2
  86. package/bundled/locales/zh-TW/core/contract-testing-standards.md +2 -2
  87. package/bundled/locales/zh-TW/core/cross-flow-regression.md +8 -7
  88. package/bundled/locales/zh-TW/core/data-contract.md +2 -2
  89. package/bundled/locales/zh-TW/core/data-migration-testing.md +2 -2
  90. package/bundled/locales/zh-TW/core/data-pipeline.md +2 -2
  91. package/bundled/locales/zh-TW/core/deferred-item-exit.md +251 -0
  92. package/bundled/locales/zh-TW/core/documentation-writing-standards.md +228 -3
  93. package/bundled/locales/zh-TW/core/full-coverage-testing.md +15 -2
  94. package/bundled/locales/zh-TW/core/governance-layer.md +118 -5
  95. package/bundled/locales/zh-TW/core/iac-design-principles.md +2 -2
  96. package/bundled/locales/zh-TW/core/incident-response.md +2 -2
  97. package/bundled/locales/zh-TW/core/model-provenance.md +4 -2
  98. package/bundled/locales/zh-TW/core/pii-classification.md +42 -6
  99. package/bundled/locales/zh-TW/core/prd-standards.md +4 -2
  100. package/bundled/locales/zh-TW/core/product-metrics-standards.md +4 -2
  101. package/bundled/locales/zh-TW/core/release-readiness-gate.md +2 -2
  102. package/bundled/locales/zh-TW/core/resource-cost-boundary.md +2 -2
  103. package/bundled/locales/zh-TW/core/retrospective-standards.md +5 -3
  104. package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +83 -5
  105. package/bundled/locales/zh-TW/core/runbook.md +2 -2
  106. package/bundled/locales/zh-TW/core/schema-evolution.md +2 -2
  107. package/bundled/locales/zh-TW/core/secret-management-standards.md +2 -2
  108. package/bundled/locales/zh-TW/core/slo-sli.md +2 -2
  109. package/bundled/locales/zh-TW/core/spec-driven-development.md +2 -0
  110. package/bundled/locales/zh-TW/core/tech-debt-standards.md +71 -4
  111. package/bundled/locales/zh-TW/core/turn-completion-integrity.md +190 -0
  112. package/bundled/locales/zh-TW/core/user-journey-testing.md +2 -2
  113. package/bundled/locales/zh-TW/core/user-story-mapping.md +2 -2
  114. package/bundled/locales/zh-TW/core/verification-oracle.md +2 -2
  115. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +27 -6
  116. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +29 -68
  117. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +172 -24
  118. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +1 -2
  119. package/bundled/locales/zh-TW/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  120. package/bundled/locales/zh-TW/integrations/google-antigravity/README.md +3 -3
  121. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
  122. package/bundled/locales/zh-TW/skills/agents/README.md +1 -1
  123. package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
  124. package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
  125. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +22 -12
  126. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +12 -9
  127. package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +1 -0
  128. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +17 -13
  129. package/bundled/locales/zh-TW/skills/commands/config.md +0 -1
  130. package/bundled/locales/zh-TW/skills/commands/init.md +1 -2
  131. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -0
  132. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +2 -1
  133. package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +2 -0
  134. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +1 -1
  135. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +2 -2
  136. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
  137. package/bundled/locales/zh-TW/skills/observability-assistant/SKILL.md +1 -0
  138. package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +1 -0
  139. package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +1 -0
  140. package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +3 -0
  141. package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +2 -0
  142. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +3 -0
  143. package/bundled/locales/zh-TW/skills/reverse-engineer/tdd-analysis.md +13 -23
  144. package/bundled/locales/zh-TW/skills/runbook-assistant/SKILL.md +1 -0
  145. package/bundled/locales/zh-TW/skills/slo-assistant/SKILL.md +1 -0
  146. package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +2 -0
  147. package/bundled/locales/zh-TW/skills/workflows/README.md +2 -11
  148. package/bundled/skills/agents/README.md +1 -1
  149. package/bundled/skills/atdd-assistant/SKILL.md +2 -0
  150. package/bundled/skills/bdd-assistant/SKILL.md +2 -0
  151. package/bundled/skills/brainstorm-assistant/SKILL.md +31 -13
  152. package/bundled/skills/brainstorm-assistant/guide.md +9 -6
  153. package/bundled/skills/code-review-assistant/SKILL.md +1 -0
  154. package/bundled/skills/commands/brainstorm.md +12 -9
  155. package/bundled/skills/commands/config.md +0 -1
  156. package/bundled/skills/commands/init.md +2 -3
  157. package/bundled/skills/commit-standards/SKILL.md +2 -0
  158. package/bundled/skills/contract-test-assistant/SKILL.md +1 -0
  159. package/bundled/skills/dev-methodology/SKILL.md +4 -0
  160. package/bundled/skills/observability-assistant/SKILL.md +1 -0
  161. package/bundled/skills/project-discovery/SKILL.md +1 -0
  162. package/bundled/skills/project-structure-guide/SKILL.md +1 -0
  163. package/bundled/skills/release-standards/SKILL.md +3 -0
  164. package/bundled/skills/requirement-assistant/SKILL.md +2 -0
  165. package/bundled/skills/reverse-engineer/SKILL.md +3 -0
  166. package/bundled/skills/reverse-engineer/tdd-analysis.md +16 -23
  167. package/bundled/skills/runbook-assistant/SKILL.md +1 -0
  168. package/bundled/skills/slo-assistant/SKILL.md +1 -0
  169. package/bundled/skills/tdd-assistant/SKILL.md +2 -0
  170. package/bundled/skills/workflows/README.md +2 -11
  171. package/bundled/templates/.ai-context.yaml.template +194 -0
  172. package/bundled/templates/CLAUDE.md.template +145 -0
  173. package/bundled/templates/DESIGN.md +237 -0
  174. package/bundled/templates/SKILL-BRIEF-TEMPLATE.md +57 -0
  175. package/bundled/templates/SKILL-CANDIDATES.md +39 -0
  176. package/bundled/templates/gates/check-error-exit.mjs +309 -0
  177. package/bundled/templates/mcp-config.json +10 -0
  178. package/bundled/templates/methodology-template.yaml +209 -0
  179. package/bundled/templates/migration-template.md +408 -0
  180. package/bundled/templates/requirement-checklist.md +410 -0
  181. package/bundled/templates/requirement-document-template.md +591 -0
  182. package/bundled/templates/requirement-template.md +881 -0
  183. package/bundled/templates/reverse-spec-template.md +409 -0
  184. package/bundled/templates/test-case-template.md +74 -0
  185. package/bundled/templates/test-plan-template.md +74 -0
  186. package/package.json +9 -5
  187. package/src/commands/audit.js +82 -0
  188. package/src/commands/check.js +66 -10
  189. package/src/commands/init.js +161 -16
  190. package/src/commands/lint.js +96 -0
  191. package/src/commands/quickstart.js +16 -13
  192. package/src/commands/update.js +286 -14
  193. package/src/compilers/claude-code-compiler.js +4 -1
  194. package/src/config/ai-agent-paths.js +62 -17
  195. package/src/core/constants.js +42 -11
  196. package/src/core/manifest.js +201 -3
  197. package/src/core/paths.js +2 -2
  198. package/src/i18n/messages.js +9 -32
  199. package/src/installers/hooks-installer.js +167 -75
  200. package/src/installers/integration-installer.js +9 -5
  201. package/src/prompts/init.js +14 -14
  202. package/src/reconciler/actual-state-scanner.js +14 -3
  203. package/src/utils/detector.js +21 -1
  204. package/src/utils/effect-boundary.js +1093 -0
  205. package/src/utils/hasher.js +229 -9
  206. package/src/utils/hook-stats.js +1 -1
  207. package/src/utils/integration-generator.js +100 -4
  208. package/src/utils/reference-sync.js +4 -1
  209. package/src/utils/skills-installer.js +17 -3
  210. package/src/utils/spec-linter.js +35 -76
  211. package/src/utils/yaml-generator.js +51 -9
  212. package/standards-registry.json +31 -8
  213. package/src/commands/sync.js +0 -133
@@ -0,0 +1,409 @@
1
+ # [SPEC-XXX] [Feature Name] (Reverse Engineered)
2
+
3
+ **Version**: 1.0.0
4
+ **Last Updated**: 2026-01-19
5
+
6
+ > ⚠️ **This specification was reverse engineered from existing code**
7
+ >
8
+ > - **Analysis Date**: YYYY-MM-DD
9
+ > - **Analyzed Path**: `path/to/code`
10
+ > - **Analyzer**: [AI/Human Name]
11
+ >
12
+ > Sections marked `[Unknown]` require human confirmation before this spec is considered complete.
13
+
14
+ ---
15
+
16
+ ## Human Review Checklist
17
+
18
+ Before considering this spec complete, verify:
19
+
20
+ ### Accuracy
21
+ - [ ] All `[Confirmed]` items verified against actual code
22
+ - [ ] Source citations (file:line) are correct
23
+ - [ ] No fabricated APIs, configurations, or behaviors
24
+
25
+ ### Inference Validation
26
+ - [ ] All `[Inferred]` items reviewed for accuracy
27
+ - [ ] Incorrect inferences corrected or removed
28
+ - [ ] Reasoning for inferences is sound
29
+
30
+ ### Required Human Input
31
+ - [ ] `Motivation` section completed (why this feature exists)
32
+ - [ ] `Risks` section completed (potential failure modes)
33
+ - [ ] `Out of Scope` section verified (intentional exclusions)
34
+ - [ ] `User Story` / business context added
35
+
36
+ ### Final Sign-off
37
+ - [ ] Original developer reviewed (if available)
38
+ - [ ] Product owner approved business context
39
+ - [ ] All `[Unknown]` labels resolved or acknowledged
40
+
41
+ ---
42
+
43
+ ## Summary
44
+
45
+ [Confirmed] Brief description of what the code does.
46
+
47
+ - [Source: Code] `primary_file.ts:start-end`
48
+
49
+ <!-- Example:
50
+ [Confirmed] This module provides user authentication via JWT tokens, supporting login, logout, and token refresh operations.
51
+
52
+ - [Source: Code] src/controllers/AuthController.ts:1-150
53
+ - [Source: Code] src/services/AuthService.ts:1-200
54
+ -->
55
+
56
+ ---
57
+
58
+ ## Motivation
59
+
60
+ [Unknown] **Requires human input**
61
+
62
+ Answer these questions:
63
+
64
+ 1. **Why was this feature built?**
65
+ <!-- What problem does it solve? What was the business driver? -->
66
+
67
+ 2. **Who requested this feature?**
68
+ <!-- Product owner, customer, internal team? -->
69
+
70
+ 3. **What user problem does it address?**
71
+ <!-- User pain points, workflow improvements -->
72
+
73
+ 4. **What was the original timeline/context?**
74
+ <!-- When was it built? Any relevant context? -->
75
+
76
+ ---
77
+
78
+ ## User Story
79
+
80
+ [Unknown] **Requires human input**
81
+
82
+ ```
83
+ As a [user type],
84
+ I want to [action/capability],
85
+ So that [benefit/value].
86
+ ```
87
+
88
+ <!-- Example:
89
+ As a registered user,
90
+ I want to log in with my email and password,
91
+ So that I can access my personal dashboard and data.
92
+ -->
93
+
94
+ ---
95
+
96
+ ## Detailed Design
97
+
98
+ ### Architecture Overview
99
+
100
+ [Confirmed/Inferred] High-level architecture extracted from code.
101
+
102
+ ```
103
+ ┌─────────────────────────────────────────────────────────────┐
104
+ │ Component Diagram │
105
+ ├─────────────────────────────────────────────────────────────┤
106
+ │ │
107
+ │ [Describe the main components and their relationships] │
108
+ │ │
109
+ └─────────────────────────────────────────────────────────────┘
110
+ ```
111
+
112
+ - [Source: Code] `src/architecture/` or inferred from imports
113
+
114
+ ### Component Details
115
+
116
+ #### Component 1: [Name]
117
+
118
+ [Confirmed] Description of component responsibility.
119
+
120
+ - **Location**: `path/to/component`
121
+ - **Dependencies**: List of dependencies
122
+ - **Key Methods**:
123
+ - `methodName()` - Description
124
+ - `anotherMethod()` - Description
125
+
126
+ - [Source: Code] `file.ts:lines`
127
+
128
+ #### Component 2: [Name]
129
+
130
+ [Confirmed/Inferred] Description.
131
+
132
+ - [Source: Code] `file.ts:lines`
133
+
134
+ ### Data Models
135
+
136
+ #### Model: [EntityName]
137
+
138
+ [Confirmed] Data structure definition.
139
+
140
+ | Field | Type | Required | Description |
141
+ |-------|------|----------|-------------|
142
+ | id | string | Yes | Primary identifier |
143
+ | field1 | type | Yes/No | [Confirmed] Description |
144
+ | field2 | type | Yes/No | [Inferred] Description |
145
+
146
+ - [Source: Code] `src/models/EntityName.ts:lines`
147
+
148
+ ### API / Interface
149
+
150
+ #### Endpoint/Method 1
151
+
152
+ [Confirmed] `METHOD /path/to/endpoint`
153
+
154
+ **Parameters**:
155
+ | Name | Location | Type | Required | Description |
156
+ |------|----------|------|----------|-------------|
157
+ | param1 | path/query/body | type | Yes/No | Description |
158
+
159
+ **Request Body** (if applicable):
160
+ ```json
161
+ {
162
+ "field": "value"
163
+ }
164
+ ```
165
+
166
+ **Response**:
167
+ ```json
168
+ {
169
+ "result": "value"
170
+ }
171
+ ```
172
+
173
+ **Error Codes**:
174
+ | Code | Description |
175
+ |------|-------------|
176
+ | 400 | [Inferred] Bad request |
177
+ | 401 | [Confirmed] Unauthorized |
178
+
179
+ - [Source: Code] `src/controllers/Controller.ts:lines`
180
+
181
+ ### Configuration
182
+
183
+ [Confirmed] Configuration extracted from code.
184
+
185
+ | Setting | Default | Description | Source |
186
+ |---------|---------|-------------|--------|
187
+ | SETTING_1 | value | Description | [Source: Code] config.ts:5 |
188
+ | SETTING_2 | value | Description | [Source: Code] .env.example:10 |
189
+
190
+ ---
191
+
192
+ ## E2E Scenarios(必填)
193
+
194
+ > 定義使用者或呼叫者視角的端對端場景。至少填 1 條 Happy Path。
195
+ > 若確實不需要 E2E,填寫 `e2e_not_required_reason` 並留空 Scenarios 區塊。
196
+
197
+ **e2e_not_required_reason**(若 Scenarios 為空,此欄必填):
198
+ <!-- 有效理由:純內部工具函式 | 已被 SPEC-NNN E2E 涵蓋,見 [SPEC-NNN] -->
199
+ <!-- 無效理由:「之後再補」「現在沒空」 -->
200
+
201
+ ### Happy Path: [場景名稱]
202
+
203
+ ```gherkin
204
+ Given [用戶或系統狀態前提]
205
+ When [觸發動作或 API 呼叫]
206
+ Then [可觀察的預期結果:HTTP status、資料庫狀態、回應 body]
207
+ ```
208
+
209
+ ### Error Path: [場景名稱](建議:安全相關、Quota、計費功能必填)
210
+
211
+ ```gherkin
212
+ Given [異常前提條件]
213
+ When [觸發動作]
214
+ Then [預期錯誤處理:status code、錯誤訊息、無副作用]
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Acceptance Criteria
220
+
221
+ ### Extracted from Tests
222
+
223
+ [Inferred] Acceptance criteria derived from test cases:
224
+
225
+ #### Feature Area 1
226
+
227
+ - [ ] [Inferred] Criterion from `test_should_do_something` (test_file.ts:10)
228
+ - [ ] [Inferred] Criterion from `test_should_handle_error` (test_file.ts:25)
229
+
230
+ #### Feature Area 2
231
+
232
+ - [ ] [Inferred] Criterion from test analysis
233
+
234
+ - [Source: Code] `src/tests/feature.test.ts`
235
+
236
+ ### Coverage Gaps
237
+
238
+ [Unknown] The following areas lack test coverage:
239
+
240
+ | Area | Risk Level | Recommendation |
241
+ |------|------------|----------------|
242
+ | Error handling | 🟡 Medium | Add tests before modification |
243
+ | Edge cases | 🔴 High | Requires documentation |
244
+
245
+ ---
246
+
247
+ ## Dependencies
248
+
249
+ ### External Dependencies
250
+
251
+ [Confirmed] Dependencies from package.json/requirements.txt:
252
+
253
+ | Package | Version | Purpose |
254
+ |---------|---------|---------|
255
+ | package1 | ^1.0.0 | Description |
256
+ | package2 | ^2.0.0 | Description |
257
+
258
+ - [Source: Code] `package.json:lines`
259
+
260
+ ### Internal Dependencies
261
+
262
+ [Confirmed] Internal module dependencies:
263
+
264
+ | Module | Depends On | Type |
265
+ |--------|------------|------|
266
+ | AuthService | UserRepository | Runtime |
267
+ | UserController | AuthService, UserService | Runtime |
268
+
269
+ ---
270
+
271
+ ## Risks
272
+
273
+ [Unknown] **Requires human input**
274
+
275
+ ### Technical Risks
276
+
277
+ | Risk | Likelihood | Impact | Mitigation |
278
+ |------|------------|--------|------------|
279
+ | <!-- Add technical risks --> | Low/Medium/High | Low/Medium/High | <!-- Mitigation strategy --> |
280
+
281
+ ### Business Risks
282
+
283
+ | Risk | Likelihood | Impact | Mitigation |
284
+ |------|------------|--------|------------|
285
+ | <!-- Add business risks --> | Low/Medium/High | Low/Medium/High | <!-- Mitigation strategy --> |
286
+
287
+ ### Known Issues / Tech Debt
288
+
289
+ [Unknown] Document any known issues discovered during analysis:
290
+
291
+ | Issue | Severity | Notes |
292
+ |-------|----------|-------|
293
+ | <!-- Add issues --> | Low/Medium/High | <!-- Additional context --> |
294
+
295
+ ---
296
+
297
+ ## Assumptions & Open Questions
298
+
299
+ ### Assumptions
300
+
301
+ | # | Assumption | Impact Scope | Verification Method | Status |
302
+ |---|-----------|--------------|---------------------|--------|
303
+ | A1 | [Assumption] <!-- describe assumption --> | <!-- affected area --> | <!-- how to verify --> | Unverified |
304
+
305
+ <!-- Example:
306
+ | A1 | [Assumption] Auth middleware validates JWT before reaching controller | AuthController, UserController | Check middleware chain in app.ts | Unverified |
307
+ | A2 | [Assumption] Database indexes exist for all query patterns | Performance | Run EXPLAIN on common queries | Unverified |
308
+ -->
309
+
310
+ ### Open Questions
311
+
312
+ | # | Question | Affected Area | Owner | Deadline |
313
+ |---|---------|--------------|-------|----------|
314
+ | Q1 | [Need Confirmation] <!-- question --> | <!-- area --> | <!-- who --> | <!-- when --> |
315
+
316
+ ---
317
+
318
+ ## Out of Scope
319
+
320
+ [Unknown] **Requires human input**
321
+
322
+ What was intentionally NOT included in this feature?
323
+
324
+ - [ ] <!-- Item 1 - was this intentionally excluded? -->
325
+ - [ ] <!-- Item 2 -->
326
+
327
+ ---
328
+
329
+ ## Historical Context
330
+
331
+ [Unknown] **Requires human input**
332
+
333
+ ### Design Decisions
334
+
335
+ | Decision | Rationale | Date | Decided By |
336
+ |----------|-----------|------|------------|
337
+ | <!-- What was decided --> | <!-- Why --> | <!-- When --> | <!-- Who --> |
338
+
339
+ ### Trade-offs Made
340
+
341
+ | Trade-off | Chosen Option | Alternative | Reason |
342
+ |-----------|---------------|-------------|--------|
343
+ | <!-- Trade-off description --> | <!-- What was chosen --> | <!-- What was rejected --> | <!-- Why --> |
344
+
345
+ ---
346
+
347
+ ## Related Resources
348
+
349
+ ### Code References
350
+
351
+ | Resource | Path | Description |
352
+ |----------|------|-------------|
353
+ | Main Implementation | `src/path/to/main` | Primary code location |
354
+ | Tests | `src/tests/path` | Test files |
355
+ | Configuration | `src/config/path` | Config files |
356
+
357
+ ### Documentation
358
+
359
+ [Unknown] Existing documentation (if any):
360
+
361
+ - [ ] README: `path/to/readme` (exists/missing)
362
+ - [ ] API Docs: `path/to/docs` (exists/missing)
363
+ - [ ] Architecture: `path/to/arch` (exists/missing)
364
+
365
+ ### Related Specs
366
+
367
+ - [ ] [SPEC-XXX] Related feature (if any)
368
+
369
+ ---
370
+
371
+ ## Analysis Metadata
372
+
373
+ | Attribute | Value |
374
+ |-----------|-------|
375
+ | **Analyzed By** | [AI Assistant / Human Name] |
376
+ | **Analysis Date** | YYYY-MM-DD |
377
+ | **Tool/Method** | `/reverse-spec` command |
378
+ | **Code Version** | Git commit hash or version |
379
+ | **Files Analyzed** | N files |
380
+ | **Lines of Code** | N lines |
381
+
382
+ ### Confidence Summary
383
+
384
+ | Certainty Level | Count | Percentage |
385
+ |-----------------|-------|------------|
386
+ | [Confirmed] | N | X% |
387
+ | [Inferred] | N | X% |
388
+ | [Unknown] | N | X% |
389
+
390
+ ---
391
+
392
+ ## Version History
393
+
394
+ | Version | Date | Changes | Author |
395
+ |---------|------|---------|--------|
396
+ | 1.0.0 | YYYY-MM-DD | Initial reverse-engineered spec | [Name] |
397
+
398
+ ---
399
+
400
+ ## Appendix: Raw Analysis Data
401
+
402
+ <details>
403
+ <summary>Click to expand code analysis output</summary>
404
+
405
+ ```
406
+ <!-- Paste raw analysis output here for reference -->
407
+ ```
408
+
409
+ </details>
@@ -0,0 +1,74 @@
1
+ # Test Case Template
2
+
3
+ > Inspired by ISO/IEC/IEEE 29119-3 Test Case Specification.
4
+
5
+ ## Test Case: TC-{NNN}
6
+
7
+ ### Metadata
8
+
9
+ | Field | Value |
10
+ |-------|-------|
11
+ | **ID** | TC-{NNN} |
12
+ | **Title** | {Descriptive test case title} |
13
+ | **Test Level** | Unit / Integration / System / E2E |
14
+ | **Priority** | High / Medium / Low |
15
+ | **Related Task** | T-{NNN} |
16
+ | **Author** | {name} |
17
+ | **Date** | {date} |
18
+
19
+ ### Preconditions
20
+
21
+ - {Required state or setup before test execution}
22
+
23
+ ### Test Steps
24
+
25
+ | Step | Action | Expected Result |
26
+ |------|--------|----------------|
27
+ | 1 | {action} | {expected} |
28
+ | 2 | {action} | {expected} |
29
+ | 3 | {action} | {expected} |
30
+
31
+ ### Verify Command
32
+
33
+ ```bash
34
+ {command to verify this test case passes}
35
+ ```
36
+
37
+ ### Test Data
38
+
39
+ - {Input data requirements}
40
+
41
+ ### Postconditions
42
+
43
+ - {Expected state after test execution}
44
+
45
+ ### Notes
46
+
47
+ - {Additional information, edge cases, or references}
48
+
49
+ ---
50
+
51
+ ## Example
52
+
53
+ ### Test Case: TC-001
54
+
55
+ | Field | Value |
56
+ |-------|-------|
57
+ | **ID** | TC-001 |
58
+ | **Title** | User login with valid credentials returns JWT token |
59
+ | **Test Level** | Integration |
60
+ | **Priority** | High |
61
+ | **Related Task** | T-003 |
62
+
63
+ **Preconditions**: Test database seeded with user `test@example.com`
64
+
65
+ | Step | Action | Expected Result |
66
+ |------|--------|----------------|
67
+ | 1 | POST /api/login with valid credentials | 200 OK |
68
+ | 2 | Check response body | Contains `token` field |
69
+ | 3 | Decode JWT token | Contains correct user ID |
70
+
71
+ **Verify Command**:
72
+ ```bash
73
+ vitest run src/auth/login.integration.test.ts
74
+ ```
@@ -0,0 +1,74 @@
1
+ # Test Plan Template
2
+
3
+ > Inspired by ISO/IEC/IEEE 29119-3.
4
+
5
+ ## 1. Test Plan Identifier
6
+
7
+ - **Plan ID**: TP-{project}-{version}
8
+ - **Project**: {project name}
9
+ - **Version**: {version}
10
+ - **Date**: {date}
11
+
12
+ ## 2. Test Scope
13
+
14
+ ### In Scope
15
+ - {Feature/component to test}
16
+
17
+ ### Out of Scope
18
+ - {Explicitly excluded items}
19
+
20
+ ## 3. Test Levels
21
+
22
+ | Level | Command | Timeout | Scope |
23
+ |-------|---------|---------|-------|
24
+ | Unit (UT) | `{test:unit command}` | 120000ms | Single function/method |
25
+ | Integration (IT) | `{test:integration command}` | 120000ms | Multiple components |
26
+ | System (ST) | `{test:system command}` | 300000ms | Complete subsystem |
27
+ | E2E | `{test:e2e command}` | 600000ms | Full user flows |
28
+
29
+ ## 4. Static Analysis
30
+
31
+ - **Command**: `{lint/type-check/analysis command}`
32
+ - **Tools**: {ESLint, ruff, mypy, etc.}
33
+
34
+ ## 5. Quality Thresholds
35
+
36
+ | Setting | Value |
37
+ |---------|-------|
38
+ | Profile | strict / standard / minimal / none |
39
+ | Verify | true/false |
40
+ | Max Retries | {number} |
41
+
42
+ ## 6. Test Completion Criteria
43
+
44
+ > ISO 29119: Test Completion Criteria / Test Exit Criteria
45
+ > Agile/Scrum: Definition of Done (DoD)
46
+
47
+ | Check | Command | Required |
48
+ |-------|---------|----------|
49
+ | All tests pass | `{test command}` | Yes |
50
+ | No lint errors | `{lint command}` | Yes |
51
+ | Type check clean | `{typecheck command}` | Yes |
52
+ | Static analysis clean | `{command}` | Yes |
53
+ | Documentation updated | _(manual review)_ | No |
54
+
55
+ ## 7. Test Environment
56
+
57
+ | Environment | Purpose | Mock Strategy |
58
+ |-------------|---------|---------------|
59
+ | local | UT, fast IT | In-memory mocks |
60
+ | ci | Full suite | Containerized deps |
61
+ | sit | ST | Stubbed external APIs |
62
+ | staging | E2E | No mocks |
63
+
64
+ ## 8. Risks and Mitigations
65
+
66
+ | Risk | Impact | Mitigation |
67
+ |------|--------|------------|
68
+ | {risk} | {impact} | {mitigation} |
69
+
70
+ ## 9. Approval
71
+
72
+ - **Author**: {name}
73
+ - **Reviewer**: {name}
74
+ - **Approved**: {date}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-dev-standards",
3
- "version": "6.7.5",
3
+ "version": "6.9.0",
4
4
  "description": "CLI tool for adopting Universal Development Standards",
5
5
  "keywords": [
6
6
  "documentation",
@@ -56,11 +56,15 @@
56
56
  "prepare": "node ../scripts/setup-husky.mjs",
57
57
  "test:upgrade": "node scripts/test-upgrade-path.mjs",
58
58
  "check:bundle-parity": "node scripts/check-bundle-parity.mjs",
59
- "prepack": "node scripts/prepack.mjs"
59
+ "prepack": "node scripts/prepack.mjs",
60
+ "check:reachability": "node scripts/check-module-reachability.mjs",
61
+ "check:command-existence": "node scripts/check-command-existence.mjs",
62
+ "check:effect-boundary": "node scripts/check-effect-boundary.mjs",
63
+ "check:effect-boundary:self-test": "node scripts/check-effect-boundary.mjs --self-test"
60
64
  },
61
65
  "dependencies": {
62
66
  "@inquirer/prompts": "^8.4.2",
63
- "chalk": "^5.3.0",
67
+ "chalk": "^6.0.0",
64
68
  "commander": "^15.0.0",
65
69
  "js-yaml": "^5.2.1",
66
70
  "ora": "^9.4.0",
@@ -69,8 +73,8 @@
69
73
  "devDependencies": {
70
74
  "@eslint/js": "^10.0.1",
71
75
  "@vitest/coverage-v8": "^4.1.5",
72
- "eslint": "10.7.0",
73
- "globals": "17.7.0",
76
+ "eslint": "10.8.0",
77
+ "globals": "17.11.0",
74
78
  "husky": "^9.1.7",
75
79
  "lint-staged": "^17.0.3",
76
80
  "vitest": "^4.1.5"
@@ -14,6 +14,15 @@
14
14
  import chalk from 'chalk';
15
15
  import { checkbox, input } from '@inquirer/prompts';
16
16
  import { createRequire } from 'node:module';
17
+ import { existsSync, readFileSync } from 'node:fs';
18
+ import { resolve as resolvePath } from 'node:path';
19
+ import {
20
+ analyseEffectBoundary,
21
+ formatReport,
22
+ parseBaselineTsv,
23
+ DEFAULT_CONFIG_PATH,
24
+ DEFAULT_BASELINE_PATH
25
+ } from '../utils/effect-boundary.js';
17
26
  import { readManifest, isInitialized } from '../utils/copier.js';
18
27
  import { runHealthCheck } from '../utils/health-checker.js';
19
28
  import { runHealthScore, saveScoreSnapshot, loadTrend } from '../utils/health-scorer.js';
@@ -59,6 +68,17 @@ export async function auditCommand(options = {}) {
59
68
  return handleScoreMode(projectPath, options);
60
69
  }
61
70
 
71
+ // Handle --effects mode (XSPEC-383 R8 — static effect boundary gate).
72
+ //
73
+ // It is its own mode rather than a fourth layer of the health/patterns/friction
74
+ // report for one reason: it has a THREE-state exit code (0 clean / 1 findings /
75
+ // 2 cannot measure), and folding it into a report that always exits 0 would
76
+ // erase exactly the state it exists to preserve — "we could not measure this"
77
+ // must not print the same thing as "this is fine".
78
+ if (options.effects) {
79
+ return handleEffectsMode(projectPath, options);
80
+ }
81
+
62
82
  // Determine which layers to run
63
83
  const hasLayerFlag = options.health || options.patterns || options.friction;
64
84
  const runHealth = hasLayerFlag ? !!options.health : true;
@@ -140,6 +160,68 @@ export async function auditCommand(options = {}) {
140
160
  }
141
161
  }
142
162
 
163
+ /**
164
+ * XSPEC-383 R8 — static effect boundary gate.
165
+ *
166
+ * Shape D: a component that is reachable, is called, runs, reports success, and
167
+ * does nothing. R3's reachability gate cannot see it — reachability asks who
168
+ * calls this file (in-edges); shape D lives in the out-edges (what it finally
169
+ * touches). Opposite direction.
170
+ *
171
+ * All judgement lives in utils/effect-boundary.js. This function is one of its
172
+ * two entry points; the other is scripts/check-effect-boundary.mjs, which CI
173
+ * and `npm run check:effect-boundary` use. The engine sits in src/ because
174
+ * `cli/scripts/` ships zero files (measured with `npm pack --dry-run`), so an
175
+ * engine living only there would not be on an adopter's disk at all.
176
+ *
177
+ * @param {string} projectPath
178
+ * @param {Object} options
179
+ */
180
+ function handleEffectsMode(projectPath, options) {
181
+ const configPath = resolvePath(projectPath, options.effectsConfig || DEFAULT_CONFIG_PATH);
182
+
183
+ if (!existsSync(configPath)) {
184
+ console.error(chalk.red('[effect-boundary] FATAL: no effect-family config at ') + configPath);
185
+ console.error(' This gate asks whether each implementation of an effect interface reaches');
186
+ console.error(' anything outside this process. It cannot answer that without being told');
187
+ console.error(' which implementations form a family.');
188
+ console.error('');
189
+ console.error(` Declare them by glob in ${DEFAULT_CONFIG_PATH} (or pass --effects-config <path>):`);
190
+ console.error(' { "families": [ { "name": "deploy-adapters",');
191
+ console.error(' "include": ["src/**/adapters/*.adapter.ts"] } ] }');
192
+ console.error('');
193
+ console.error(' Declared by glob, not by a list of filenames: a glob keeps matching the');
194
+ console.error(' adapter nobody has written yet, which is the one this gate exists to catch.');
195
+ console.error('');
196
+ console.error(chalk.yellow(' Exiting 2 (cannot measure), not 0. A gate with nothing to check must not print a green tick.'));
197
+ process.exit(2);
198
+ }
199
+
200
+ let config;
201
+ try {
202
+ config = JSON.parse(readFileSync(configPath, 'utf8'));
203
+ } catch (e) {
204
+ console.error(chalk.red(`[effect-boundary] FATAL: config exists but does not parse: ${configPath}: ${e.message}`));
205
+ console.error(' This is "cannot read the config", not "there is no config".');
206
+ process.exit(2);
207
+ }
208
+
209
+ const baselinePath = resolvePath(projectPath, DEFAULT_BASELINE_PATH);
210
+ const baseline = existsSync(baselinePath)
211
+ ? parseBaselineTsv(readFileSync(baselinePath, 'utf8'))
212
+ : { entries: [], errors: [] };
213
+
214
+ const result = analyseEffectBoundary({ projectPath, config });
215
+ const { lines, exitCode } = formatReport(result, baseline);
216
+
217
+ if (options.format === 'json') {
218
+ console.log(JSON.stringify({ exitCode, report: lines, result }, null, 2));
219
+ } else {
220
+ for (const line of lines) console.log(line);
221
+ }
222
+ process.exit(exitCode);
223
+ }
224
+
143
225
  /**
144
226
  * Output full terminal report
145
227
  * @param {Object} auditResult