@curdx/flow 3.0.0 → 3.1.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 (219) hide show
  1. package/CHANGELOG.md +21 -87
  2. package/LICENSE +1 -1
  3. package/README.md +28 -129
  4. package/dist/index.mjs +995 -0
  5. package/package.json +33 -44
  6. package/.claude-plugin/marketplace.json +0 -48
  7. package/.claude-plugin/plugin.json +0 -52
  8. package/agent-preamble/preamble.md +0 -314
  9. package/agents/flow-adversary.md +0 -203
  10. package/agents/flow-architect.md +0 -198
  11. package/agents/flow-brownfield-analyst.md +0 -143
  12. package/agents/flow-debugger.md +0 -321
  13. package/agents/flow-edge-hunter.md +0 -289
  14. package/agents/flow-executor.md +0 -269
  15. package/agents/flow-orchestrator.md +0 -145
  16. package/agents/flow-planner.md +0 -247
  17. package/agents/flow-product-designer.md +0 -159
  18. package/agents/flow-qa-engineer.md +0 -282
  19. package/agents/flow-researcher.md +0 -166
  20. package/agents/flow-reviewer.md +0 -304
  21. package/agents/flow-security-auditor.md +0 -401
  22. package/agents/flow-triage-analyst.md +0 -272
  23. package/agents/flow-ui-researcher.md +0 -230
  24. package/agents/flow-ux-designer.md +0 -221
  25. package/agents/flow-verifier.md +0 -350
  26. package/bin/curdx-flow +0 -5
  27. package/bin/curdx-flow-state +0 -104
  28. package/bin/curdx-flow.js +0 -54
  29. package/cli/README.md +0 -104
  30. package/cli/doctor-workflow.js +0 -483
  31. package/cli/doctor.js +0 -73
  32. package/cli/help.js +0 -59
  33. package/cli/install-bundled-mcps.js +0 -37
  34. package/cli/install-companions.js +0 -19
  35. package/cli/install-context7-config.js +0 -80
  36. package/cli/install-curdx-plugin.js +0 -96
  37. package/cli/install-language.js +0 -35
  38. package/cli/install-next-steps.js +0 -29
  39. package/cli/install-options.js +0 -9
  40. package/cli/install-paths.js +0 -52
  41. package/cli/install-recommended-plugins.js +0 -104
  42. package/cli/install-required-plugins.js +0 -57
  43. package/cli/install-self-update.js +0 -62
  44. package/cli/install-workflow.js +0 -209
  45. package/cli/install.js +0 -101
  46. package/cli/lib/claude-commands.js +0 -41
  47. package/cli/lib/claude-ops.js +0 -47
  48. package/cli/lib/claude.js +0 -183
  49. package/cli/lib/config.js +0 -24
  50. package/cli/lib/doctor-claude-settings.js +0 -1186
  51. package/cli/lib/doctor-report.js +0 -978
  52. package/cli/lib/doctor-runtime-environment.js +0 -196
  53. package/cli/lib/frontmatter.js +0 -44
  54. package/cli/lib/json-schema.js +0 -57
  55. package/cli/lib/logging.js +0 -25
  56. package/cli/lib/process.js +0 -60
  57. package/cli/lib/prompts.js +0 -135
  58. package/cli/lib/runtime.js +0 -107
  59. package/cli/lib/semver.js +0 -109
  60. package/cli/lib/version.js +0 -12
  61. package/cli/protocols-body.md +0 -22
  62. package/cli/protocols.js +0 -162
  63. package/cli/registry.js +0 -123
  64. package/cli/router.js +0 -49
  65. package/cli/uninstall-actions.js +0 -360
  66. package/cli/uninstall-workflow.js +0 -146
  67. package/cli/uninstall.js +0 -42
  68. package/cli/upgrade-workflow.js +0 -80
  69. package/cli/upgrade.js +0 -91
  70. package/cli/utils.js +0 -40
  71. package/gates/adversarial-review-gate.md +0 -219
  72. package/gates/coverage-audit-gate.md +0 -182
  73. package/gates/devex-gate.md +0 -254
  74. package/gates/edge-case-gate.md +0 -194
  75. package/gates/karpathy-gate.md +0 -130
  76. package/gates/security-gate.md +0 -218
  77. package/gates/tdd-gate.md +0 -182
  78. package/gates/test-quality-gate.md +0 -59
  79. package/gates/verification-gate.md +0 -179
  80. package/hooks/hooks.json +0 -130
  81. package/hooks/scripts/common.sh +0 -237
  82. package/hooks/scripts/config-change-guard.sh +0 -94
  83. package/hooks/scripts/flow-context-watch.sh +0 -94
  84. package/hooks/scripts/inject-karpathy.sh +0 -53
  85. package/hooks/scripts/quick-mode-guard.sh +0 -69
  86. package/hooks/scripts/session-start.sh +0 -94
  87. package/hooks/scripts/session-title.sh +0 -87
  88. package/hooks/scripts/stop-watcher.sh +0 -231
  89. package/hooks/scripts/subagent-artifact-guard.sh +0 -92
  90. package/hooks/scripts/subagent-statusline.sh +0 -111
  91. package/hooks/scripts/task-lifecycle-guard.sh +0 -106
  92. package/hooks/scripts/teammate-idle-guard.sh +0 -83
  93. package/knowledge/artifact-output-discipline.md +0 -24
  94. package/knowledge/artifact-summary-contracts.md +0 -50
  95. package/knowledge/atomic-commits.md +0 -262
  96. package/knowledge/claude-code-runtime-contracts.md +0 -240
  97. package/knowledge/epic-decomposition.md +0 -307
  98. package/knowledge/execution-strategies.md +0 -303
  99. package/knowledge/karpathy-guidelines.md +0 -219
  100. package/knowledge/planning-reviews.md +0 -211
  101. package/knowledge/poc-first-workflow.md +0 -223
  102. package/knowledge/review-feedback-intake.md +0 -57
  103. package/knowledge/spec-driven-development.md +0 -180
  104. package/knowledge/systematic-debugging.md +0 -378
  105. package/knowledge/two-stage-review.md +0 -249
  106. package/knowledge/wave-execution.md +0 -403
  107. package/monitors/monitors.json +0 -8
  108. package/monitors/scripts/flow-state-monitor.sh +0 -102
  109. package/output-styles/curdx-evidence-first.md +0 -34
  110. package/output-styles/curdx-fast-mode.md +0 -42
  111. package/output-styles/curdx-spec-mode.md +0 -46
  112. package/schemas/agent-frontmatter.schema.json +0 -66
  113. package/schemas/config.schema.json +0 -134
  114. package/schemas/gate-frontmatter.schema.json +0 -30
  115. package/schemas/hooks.schema.json +0 -115
  116. package/schemas/output-style-frontmatter.schema.json +0 -22
  117. package/schemas/plugin-manifest.schema.json +0 -436
  118. package/schemas/plugin-settings.schema.json +0 -29
  119. package/schemas/skill-frontmatter.schema.json +0 -177
  120. package/schemas/spec-frontmatter.schema.json +0 -42
  121. package/schemas/spec-state.schema.json +0 -165
  122. package/settings.json +0 -8
  123. package/skills/brownfield-index/SKILL.md +0 -53
  124. package/skills/brownfield-index/references/applicability.md +0 -12
  125. package/skills/brownfield-index/references/handoff.md +0 -8
  126. package/skills/brownfield-index/references/index-contract.md +0 -10
  127. package/skills/browser-qa/SKILL.md +0 -39
  128. package/skills/browser-qa/references/handoff.md +0 -6
  129. package/skills/browser-qa/references/prerequisites.md +0 -10
  130. package/skills/browser-qa/references/qa-contract.md +0 -20
  131. package/skills/cancel/SKILL.md +0 -41
  132. package/skills/cancel/references/destructive-mode.md +0 -17
  133. package/skills/cancel/references/reporting.md +0 -18
  134. package/skills/cancel/references/state-recovery.md +0 -30
  135. package/skills/cancel/references/target-resolution.md +0 -7
  136. package/skills/debug/SKILL.md +0 -45
  137. package/skills/debug/references/context-gathering.md +0 -11
  138. package/skills/debug/references/failure-guard.md +0 -25
  139. package/skills/debug/references/intake.md +0 -12
  140. package/skills/debug/references/phase-workflow.md +0 -34
  141. package/skills/debug/references/reporting.md +0 -20
  142. package/skills/epic/SKILL.md +0 -39
  143. package/skills/epic/references/epic-artifacts.md +0 -20
  144. package/skills/epic/references/epic-intake.md +0 -9
  145. package/skills/epic/references/slice-handoff.md +0 -16
  146. package/skills/fast/SKILL.md +0 -62
  147. package/skills/fast/references/applicability.md +0 -25
  148. package/skills/fast/references/clarification.md +0 -20
  149. package/skills/fast/references/execution-contract.md +0 -56
  150. package/skills/help/SKILL.md +0 -55
  151. package/skills/help/references/dispatch.md +0 -20
  152. package/skills/help/references/overview.md +0 -39
  153. package/skills/help/references/troubleshoot.md +0 -47
  154. package/skills/help/references/workflow.md +0 -37
  155. package/skills/implement/SKILL.md +0 -104
  156. package/skills/implement/references/error-recovery.md +0 -36
  157. package/skills/implement/references/linear-execution.md +0 -43
  158. package/skills/implement/references/native-task-sync.md +0 -107
  159. package/skills/implement/references/preflight.md +0 -43
  160. package/skills/implement/references/progress-contract.md +0 -36
  161. package/skills/implement/references/state-init.md +0 -36
  162. package/skills/implement/references/stop-hook-execution.md +0 -50
  163. package/skills/implement/references/strategy-router.md +0 -38
  164. package/skills/implement/references/subagent-execution.md +0 -57
  165. package/skills/implement/references/wave-execution.md +0 -180
  166. package/skills/init/SKILL.md +0 -49
  167. package/skills/init/references/gitignore-and-health.md +0 -26
  168. package/skills/init/references/next-steps.md +0 -22
  169. package/skills/init/references/preflight.md +0 -15
  170. package/skills/init/references/scaffold-contract.md +0 -27
  171. package/skills/review/SKILL.md +0 -82
  172. package/skills/review/references/optional-passes.md +0 -48
  173. package/skills/review/references/preflight.md +0 -38
  174. package/skills/review/references/report-contract.md +0 -49
  175. package/skills/review/references/reporting.md +0 -20
  176. package/skills/review/references/stage-execution.md +0 -32
  177. package/skills/security-audit/SKILL.md +0 -47
  178. package/skills/security-audit/references/audit-contract.md +0 -21
  179. package/skills/security-audit/references/gate-handoff.md +0 -8
  180. package/skills/security-audit/references/scope-and-depth.md +0 -9
  181. package/skills/spec/SKILL.md +0 -100
  182. package/skills/spec/references/artifact-landing.md +0 -31
  183. package/skills/spec/references/phase-execution.md +0 -50
  184. package/skills/spec/references/planning-review.md +0 -31
  185. package/skills/spec/references/preflight-and-routing.md +0 -46
  186. package/skills/spec/references/reporting.md +0 -21
  187. package/skills/start/SKILL.md +0 -84
  188. package/skills/start/references/branch-routing.md +0 -51
  189. package/skills/start/references/mode-semantics.md +0 -12
  190. package/skills/start/references/preflight.md +0 -13
  191. package/skills/start/references/reporting.md +0 -20
  192. package/skills/start/references/state-seeding.md +0 -44
  193. package/skills/start/references/workflow-handoff.md +0 -26
  194. package/skills/status/SKILL.md +0 -41
  195. package/skills/status/references/gather-contract.md +0 -30
  196. package/skills/status/references/health-rules.md +0 -27
  197. package/skills/status/references/output-contract.md +0 -25
  198. package/skills/status/references/preflight.md +0 -10
  199. package/skills/status/references/recovery-hints.md +0 -18
  200. package/skills/ui-sketch/SKILL.md +0 -39
  201. package/skills/ui-sketch/references/brief-intake.md +0 -10
  202. package/skills/ui-sketch/references/iteration-handoff.md +0 -5
  203. package/skills/ui-sketch/references/variant-contract.md +0 -15
  204. package/skills/verify/SKILL.md +0 -56
  205. package/skills/verify/references/evidence-workflow.md +0 -39
  206. package/skills/verify/references/output-contract.md +0 -23
  207. package/skills/verify/references/preflight.md +0 -11
  208. package/skills/verify/references/report-handoff.md +0 -35
  209. package/skills/verify/references/strict-mode.md +0 -12
  210. package/templates/CONTEXT.md.tmpl +0 -53
  211. package/templates/PROJECT.md.tmpl +0 -59
  212. package/templates/ROADMAP.md.tmpl +0 -50
  213. package/templates/STATE.md.tmpl +0 -49
  214. package/templates/config.json.tmpl +0 -51
  215. package/templates/design.md.tmpl +0 -83
  216. package/templates/progress.md.tmpl +0 -77
  217. package/templates/requirements.md.tmpl +0 -76
  218. package/templates/research.md.tmpl +0 -83
  219. package/templates/tasks.md.tmpl +0 -107
package/cli/utils.js DELETED
@@ -1,40 +0,0 @@
1
- /**
2
- * Shared utilities for curdx-flow CLI.
3
- *
4
- * This module is kept as the stable public import surface for existing CLI
5
- * commands. Implementations live under cli/lib/ so each concern stays small.
6
- */
7
-
8
- export { VERSION } from "./lib/version.js";
9
- export { color, log } from "./lib/logging.js";
10
- export { has, resultLastLine, resultOutput, run, runSync } from "./lib/process.js";
11
- export {
12
- confirm,
13
- intro,
14
- multiSelect,
15
- multiselectClack,
16
- note,
17
- outro,
18
- select,
19
- spinner,
20
- text,
21
- } from "./lib/prompts.js";
22
- export { readConfig, writeConfig } from "./lib/config.js";
23
- export {
24
- claudeVersion,
25
- findDuplicateMcps,
26
- findPluginByRegistryEntry,
27
- hasMarketplace,
28
- listMcps,
29
- listPluginMarketplaces,
30
- listPlugins,
31
- parseMcpList,
32
- parsePluginListJson,
33
- readUserMcpConfig,
34
- } from "./lib/claude.js";
35
- export {
36
- ensureClaudeMemRuntimes,
37
- ensureRuntimeInPath,
38
- inspectClaudeMemRuntimes,
39
- inspectRuntimeInPath,
40
- } from "./lib/runtime.js";
@@ -1,219 +0,0 @@
1
- ---
2
- gate: adversarial-review-gate
3
- category: enterprise-mode
4
- severity: warning
5
- depends_on: []
6
- ---
7
-
8
- # Adversarial Review Gate
9
-
10
- > Derived from BMAD-METHOD's "Adversarial Review Prompts".
11
- >
12
- > **Core**: The reviewer must find problems. "Zero findings" triggers re-analysis. This forcibly breaks confirmation bias.
13
-
14
- ---
15
-
16
- ## Trigger Timing
17
-
18
- - /curdx-flow:review command
19
- - Before Phase transitions (requirements → design, design → tasks)
20
- - Before code merge or human PR/release handoff
21
- - Enabled by default in Enterprise mode
22
-
23
- ---
24
-
25
- ## Core Rules
26
-
27
- ### Rule 1: Zero Findings Forbidden
28
-
29
- A reviewer agent's output of "everything looks fine, no issues found" is an **invalid conclusion**.
30
-
31
- **Reasons**:
32
- - Real systems inevitably contain trade-offs, boundaries, and risks
33
- - "Looks good" is usually confirmation bias (the agent only checked the obvious)
34
- - AI tends to please the user ("great job!") — fight this tendency
35
-
36
- **Forced actions when the agent reports "no issues"**:
37
- 1. Automatically trigger a second round framed as "what would a senior skeptic reject in this PR?"
38
- 2. If both rounds still honestly yield no findings, the agent must emit a **proof-of-checking report**:
39
- - Every category it examined (with "N/A" for categories that don't apply)
40
- - For each examined category, the specific code/file locations inspected
41
- - Counterfactual hypotheses of "what this would look like if there were a problem" and why that signature is absent
42
- 3. Fabricating findings to avoid the proof-of-checking step is a violation of L3 red line #2 (fact-driven). Better to emit "clean verdict with proof" than invent issues.
43
-
44
- ---
45
-
46
- ### Rule 2: Coverage proportional to feature scope
47
-
48
- A complete adversarial review covers every category that applies to the feature, marks the rest as N/A with reason. Number of findings per category is proportional to real issues, not a quota:
49
-
50
- 1. **Architecture layer**: Are decisions sound? Future-extensible? Lock-in risks?
51
- 2. **Implementation layer**: Code quality? Error handling? Performance?
52
- 3. **Test layer**: Coverage? Edge cases? Over-mocking?
53
- 4. **Security layer**: Injection risks? Permission checks? Sensitive data leakage?
54
- 5. **Maintainability layer**: Documentation? Naming? Readability?
55
- 6. **User experience layer**: Error messages? Loading states? Accessibility?
56
-
57
- ---
58
-
59
- ### Rule 3: Findings Must Have Evidence + Recommendation
60
-
61
- Format for each finding:
62
-
63
- ```markdown
64
- ### [Category] Issue Title
65
-
66
- **Location**: src/auth/login.ts:42
67
-
68
- **Observation**: <what was specifically seen>
69
-
70
- **Risk**: <what problem will this cause? High/Medium/Low?>
71
-
72
- **Evidence**: <code snippet / test output / scenario>
73
-
74
- **Recommendation**: <specifically how to fix>
75
- ```
76
-
77
- Not allowed:
78
- - ✗ "The code could be better" (too vague)
79
- - ✗ "I think... maybe..." (no specific basis)
80
-
81
- ---
82
-
83
- ## Execution Flow
84
-
85
- ```
86
- Input: object under review (code range / spec / PR diff)
87
-
88
- Round 1 (agent self-analysis):
89
- - Use sequential-thinking proportional to the surface being probed
90
- - Scan each applicable category; mark N/A ones with reason
91
- - Output findings list
92
-
93
- Decision:
94
- - Any real findings? → output report with findings
95
- - Zero findings after honest Round 1? → force Round 2 framed as skeptic
96
-
97
- Round 2 (deep analysis):
98
- - sequential-thinking proportional to residual uncertainty
99
- - Focus on "seemingly no issues" parts (trust but verify)
100
- - Optionally introduce external perspectives (read issues from similar projects)
101
-
102
- Decision:
103
- - Still zero findings? → agent must emit proof-of-checking report (NOT invent findings)
104
- - Findings exist? → output report
105
-
106
- Output: review-report.md
107
- ```
108
-
109
- ---
110
-
111
- ## Typical Finding Patterns (for agent reference)
112
-
113
- ### Architecture
114
- - "New component X depends on Y, but Y is not mentioned in design.md → introduces implicit coupling"
115
- - "AD-03 chooses JWT, but does not handle token revocation → user logout is not thorough"
116
-
117
- ### Implementation
118
- - "src/auth/login.ts:42 catches all exceptions and returns 500, but bcrypt timeout should return 429"
119
- - "Verify in tasks.md is `npm test`, no specific test file specified → may have run unrelated tests"
120
-
121
- ### Testing
122
- - "login.test.ts has 5 tests, but AC-1.3 (empty password) is not covered"
123
- - "Tests use `jest.fn()` to mock DB; actual DB constraints are not tested → may fail in production"
124
-
125
- ### Security
126
- - "Error message returns `User not found`, can be identified by enumeration attack for existence"
127
- - "JWT secret comes from process.env with no fallback → crashes when environment variable is missing"
128
-
129
- ---
130
-
131
- ## Output Format
132
-
133
- ```markdown
134
- ## Adversarial Review Report
135
-
136
- Object under review: auth-system spec (commits abc..xyz)
137
- Review time: 2026-04-19
138
- Review rounds: 2 (Round 1 found 2, triggered Round 2)
139
-
140
- ## Total findings: 5
141
-
142
- ### [Architecture] Token revocation not designed
143
- Location: design.md AD-01
144
- Observation: stateless JWT was chosen, but requirements FR-04 requires "user logout immediately invalidates other sessions"
145
- Risk: High — violates an explicit requirement
146
- Evidence: AD-01 only says "use JWT", does not say how to revoke
147
- Recommendation: Add AD-06 explaining the use of Redis blacklist + check-on-each-request
148
-
149
- ### [Implementation] bcrypt error handling missing
150
- Location: src/auth/login.ts:58
151
- Observation: await bcrypt.compare() has no try-catch
152
- Risk: Medium — bcrypt crash will cause 500 exposing internal stack
153
- Evidence: (code snippet omitted)
154
- Recommendation: wrap in try-catch, return 401
155
-
156
- ### [Test] AC-1.3 not covered
157
- Location: login.test.ts
158
- Observation: requirements AC-1.3 requires "empty password returns 400", but there is no corresponding test
159
- Risk: Medium — regression risk
160
- Evidence: grep "empty password" → 0 matches
161
- Recommendation: add test("rejects empty password", ...)
162
-
163
- ### [Security] User enumeration leak
164
- Location: src/auth/login.ts:45-50
165
- Observation: email not found → "User not found"; email found pwd wrong → "Wrong password"
166
- Risk: High — can be used to enumerate registered emails
167
- Evidence: (code snippet)
168
- Recommendation: unify error message to "Invalid credentials"
169
-
170
- ### [Maintainability] Inconsistent log format
171
- Location: src/auth/login.ts:42 vs src/auth/logout.ts:18
172
- Observation: one uses `console.log`, the other uses `logger.info`
173
- Risk: Low — does not affect functionality, but future monitoring will be messy
174
- Evidence: grep log → 2 patterns
175
- Recommendation: unify to logger.info
176
-
177
- ## Summary
178
-
179
- Blockers: 2 ([Architecture] token revocation, [Security] user enumeration)
180
- Warnings: 3
181
-
182
- Fix loop:
183
- 1. Dispatch flow-executor to fix security + architecture (high priority)
184
- 2. Add tests
185
- 3. Unify log
186
- 4. Re-run /curdx-flow:review for re-review
187
- ```
188
-
189
- ---
190
-
191
- ## Failure Recovery
192
-
193
- If after Round 2 the honest verdict is still zero findings, emit a proof-of-checking report (do NOT fabricate to hit a quota — there is no quota):
194
-
195
- ```markdown
196
- ## Adversarial Review — Proof of Checking (zero findings)
197
-
198
- I have examined the following dimensions across 2 rounds of analysis:
199
-
200
- 1. Architecture: checked AD-01~04 and corresponding implementations, no obvious issues found
201
- 2. Implementation: checked src/auth/*.ts totaling 342 lines, no obvious issues found
202
- 3. Tests: checked 15 tests, covered all ACs, no gaps found
203
- 4. Security: checked input validation, error messages, secret management, no issues found
204
- 5. Maintainability: naming and structure are consistent
205
-
206
- ⚠ Note: this does not mean there are truly no issues. It may be that:
207
- - the object under review is indeed high quality
208
- - or my review capability has blind spots (e.g., specific domains)
209
- - or there are hidden issues that will only surface at runtime
210
-
211
- Recommendations:
212
- - Human review (at least walk through the diff once)
213
- - Consider the `browser-qa` skill for real browser/integration testing (Phase 5+)
214
- - Wait until deployment to staging to observe
215
- ```
216
-
217
- ---
218
-
219
- _Source: BMAD-METHOD's adversarial review prompts._
@@ -1,182 +0,0 @@
1
- ---
2
- gate: coverage-audit-gate
3
- category: standard-mode
4
- severity: blocking
5
- depends_on: []
6
- ---
7
-
8
- # Coverage Audit Gate — Multi-Source Coverage Audit
9
-
10
- > Rule: every claim in the spec must be covered by implementation/tests. Uncovered = missed = future bug.
11
-
12
- ---
13
-
14
- ## Trigger Timing
15
-
16
- - End of the tasks phase (last step of flow-planner)
17
- - Before the execution phase completes (when /curdx-flow:verify runs)
18
- - Explicitly requested by /curdx-flow:verify --strict
19
-
20
- ---
21
-
22
- ## Audit Sources (4 categories)
23
-
24
- ### Source 1: Requirements (FR + AC)
25
-
26
- **Source**: `requirements.md`
27
-
28
- **Checks**:
29
- - Does every FR-NN have a corresponding task in tasks.md?
30
- - Does every AC-X.Y have a corresponding test in code?
31
-
32
- **Missing handling**:
33
- - Uncovered FR → block, must add task or exempt
34
- - Uncovered AC → warning, recommend adding test
35
-
36
- ---
37
-
38
- ### Source 2: Design (AD + Components)
39
-
40
- **Source**: `design.md`
41
-
42
- **Checks**:
43
- - Does every AD-NN have a corresponding implementation task in tasks.md?
44
- - Does every Component have a skeleton task + core logic task in tasks.md?
45
- - Does every error path have a corresponding scenario in tests?
46
-
47
- **Missing handling**:
48
- - Uncovered AD → block (an architecture decision not landed = design failure)
49
- - Uncovered error path → warning
50
-
51
- ---
52
-
53
- ### Source 3: Research recommendations
54
-
55
- **Source**: the "recommendations" section of `research.md`
56
-
57
- **Checks**:
58
- - Are the technical approaches recommended by research implemented in design.md?
59
- - Are the pitfalls found by research avoided in the implementation?
60
-
61
- **Missing handling**:
62
- - Recommended direction not adopted → warning (design.md must explain why not)
63
- - Pitfall not avoided → block
64
-
65
- ---
66
-
67
- ### Source 4: Project-level decisions (D-NN)
68
-
69
- **Source**: the decisions array in `.flow/STATE.md`
70
-
71
- **Checks**:
72
- - Which D-NN are involved in this spec?
73
- - Is each relevant D-NN referenced in design.md / tasks.md?
74
- - Does the implementation comply with the decision?
75
-
76
- **Missing handling**:
77
- - Violates D-NN → block, must either return to the design phase to challenge the decision or modify the implementation
78
- - Not referenced but actually compliant → warning (prompt to add reference)
79
-
80
- ---
81
-
82
- ## Execution Flow
83
-
84
- ```python
85
- # pseudocode
86
- def audit(spec_name):
87
- req = parse_requirements(spec_name)
88
- design = parse_design(spec_name)
89
- research = parse_research(spec_name)
90
- state = parse_global_state()
91
- tasks = parse_tasks(spec_name)
92
- commits = git_log_for_spec(spec_name)
93
-
94
- missing = []
95
-
96
- # Source 1
97
- for fr in req.functional_requirements:
98
- if not any(fr.id in t.requirements_ref for t in tasks):
99
- missing.append(("FR", fr.id, "no task covers"))
100
-
101
- for ac in req.acceptance_criteria:
102
- if not any(ac.id in c.body for c in commits):
103
- missing.append(("AC", ac.id, "no test covers"))
104
-
105
- # Source 2
106
- for ad in design.architecture_decisions:
107
- if not any(ad.id in t.design_ref for t in tasks):
108
- missing.append(("AD", ad.id, "no task implements"))
109
-
110
- # Source 3
111
- for rec in research.recommendations:
112
- if rec not in design.chosen_approaches:
113
- missing.append(("Research", rec.summary, "not adopted, no rationale"))
114
-
115
- # Source 4
116
- relevant_decisions = [d for d in state.decisions if spec_touches(d)]
117
- for d in relevant_decisions:
118
- if not any(d.id in text for text in [design.content, tasks.content]):
119
- missing.append(("D", d.id, "not referenced"))
120
-
121
- return missing
122
- ```
123
-
124
- ---
125
-
126
- ## Violation Levels
127
-
128
- | Missing Type | Level | Action |
129
- |---------|------|------|
130
- | FR uncovered | **block** | add task |
131
- | AC uncovered | warning | add test (recommended) |
132
- | AD uncovered | **block** | add implementation task |
133
- | Component uncovered | **block** | add skeleton + logic tasks |
134
- | Error path uncovered | warning | add error test |
135
- | Research recommendation not adopted | warning | add rejection rationale to design.md |
136
- | Project decision violated | **block** | challenge decision or fix implementation |
137
-
138
- ---
139
-
140
- ## Output Format
141
-
142
- ```markdown
143
- ## Coverage Audit Report
144
-
145
- Spec: auth-system
146
- Audit time: 2026-04-19
147
-
148
- ### Source 1: Requirements
149
- - FR-01 login: ✓ tasks 1.1, 1.2
150
- - FR-02 logout: ✓ tasks 2.1
151
- - FR-03 refresh token: ✗ **uncovered**
152
- - AC-1.1: ✓ test in tasks 3.1
153
- - AC-1.2: ⚠ no corresponding test
154
- - AC-2.1: ✓ test in tasks 3.2
155
-
156
- ### Source 2: Design
157
- - AD-01 JWT vs Session: ✓ tasks 1.1
158
- - AD-02 bcrypt cost 12: ✓ tasks 1.2
159
- - AD-03 refresh rotation: ✗ **uncovered** (maps to FR-03)
160
- - Component TokenManager: ✗ **uncovered**
161
- - Error path: network fail: ⚠ no test
162
-
163
- ### Source 3: Research
164
- - Recommendation: use Redis to store blacklist → ✓ adopted in design
165
- - Pitfall: bcrypt cost > 15 will be slow → ✓ design limits ≤ 12
166
-
167
- ### Source 4: Decisions
168
- - D-07 session storage → ✓ referenced by AD-01
169
- - D-12 error log format → ⚠ not mentioned in design/tasks
170
-
171
- ### Summary
172
- Blockers: 3 (FR-03, AD-03, Component TokenManager)
173
- Warnings: 3
174
-
175
- Fix recommendations:
176
- 1. Add tasks to cover FR-03 / AD-03 / TokenManager, or
177
- 2. Explicitly exempt in STATE.md (defer to next spec)
178
- ```
179
-
180
- ---
181
-
182
- _Source: CurDX-Flow multi-source coverage audit contract._
@@ -1,254 +0,0 @@
1
- ---
2
- gate: devex-gate
3
- category: enterprise-mode
4
- severity: warning
5
- depends_on: []
6
- ---
7
-
8
- # DevEx Gate — Developer Experience Review
9
-
10
- > Optional in Enterprise mode. Reviews whether code is friendly to **the next maintainer**.
11
-
12
- ---
13
-
14
- ## Trigger Timing
15
-
16
- - When `/curdx-flow:spec --review=dx` runs (design phase)
17
- - When `/curdx-flow:review --devex` runs (code phase)
18
- - Enabled by default in open-source / multi-person collaboration scenarios
19
-
20
- ---
21
-
22
- ## Core Question
23
-
24
- **"Six months from now, can I (or my colleague) quickly take over this code?"**
25
-
26
- Not considering this → code becomes legacy → maintenance cost grows exponentially.
27
-
28
- ---
29
-
30
- ## 8 Dimensions
31
-
32
- ### DX-01: Clear Naming
33
-
34
- Naming = the most important documentation.
35
-
36
- ❌ Bad:
37
- ```typescript
38
- function doStuff(x, y) { ... }
39
- const d = new Date()
40
- let flag = true
41
- ```
42
-
43
- ✓ Good:
44
- ```typescript
45
- function validateEmailFormat(email: string): boolean { ... }
46
- const currentTimestamp = new Date()
47
- let isAuthenticationPending = true
48
- ```
49
-
50
- **Checks**:
51
- - Abbreviations (`usr`, `pwd`, `addr`) should be expanded (unless domain-standard like `API`, `URL`)
52
- - Booleans use `is/has/can/should` prefix
53
- - Functions start with verbs
54
- - Variables use nouns
55
- - Single letters only in loops/lambdas (`i`, `x`)
56
-
57
- ---
58
-
59
- ### DX-02: Intent Comments
60
-
61
- Comments explain **why**, not **what**.
62
-
63
- ❌ Bad (comment adds no value):
64
- ```typescript
65
- // get the user
66
- const user = await getUser(id)
67
-
68
- // increment i by 1
69
- i++
70
- ```
71
-
72
- ✓ Good (comment explains why):
73
- ```typescript
74
- // bcrypt.compare has fixed execution time; run it even when the user does not exist to prevent timing attacks
75
- const hash = user?.passwordHash ?? FAKE_HASH
76
- await bcrypt.compare(inputPwd, hash)
77
- ```
78
-
79
- **Checks**:
80
- - Are there low-value comments (`// set x to 1`)?
81
- - Are there magic numbers / odd practices lacking explanation?
82
- - Do public APIs have doc comments?
83
-
84
- ---
85
-
86
- ### DX-03: Discoverable File Structure
87
-
88
- ```
89
- src/auth/
90
- ├── index.ts ← export entry
91
- ├── login.ts ← business logic
92
- ├── login.test.ts ← tests (colocated)
93
- ├── types.ts ← types
94
- └── __mocks__/ ← mocks (if any)
95
- ```
96
-
97
- **Checks**:
98
- - Are new files placed in the right location (follow existing patterns)?
99
- - Naming conventions are consistent (don't mix `login.ts` with `LoginService.ts`)
100
- - Depth does not exceed 4 levels
101
-
102
- ---
103
-
104
- ### DX-04: Useful Error Messages
105
-
106
- ❌ Bad:
107
- ```
108
- Error: Failed
109
- Error: Validation error
110
- ```
111
-
112
- ✓ Good:
113
- ```
114
- Error: Failed to send email to user@example.com (SMTP 554 - rejected)
115
- Error: email must match pattern /^[^@]+@[^@]+\.[^@]+$/, got ""
116
- ```
117
-
118
- **Checks**:
119
- - Error messages include **where it went wrong**, **what went wrong**, and **what the user/developer can do**
120
-
121
- ---
122
-
123
- ### DX-05: Easy Setup
124
-
125
- After a newcomer clones the repo:
126
-
127
- ```bash
128
- git clone ...
129
- cd project
130
- <single command to run>
131
- ```
132
-
133
- Should start with one command (`npm install && npm run dev`).
134
-
135
- **Checks**:
136
- - README has a "Getting Started" section
137
- - No hidden dependencies ("must install PostgreSQL and create a user first")
138
- - Or a single docker-compose command
139
-
140
- ---
141
-
142
- ### DX-06: Clear Types
143
-
144
- TypeScript / Python with types:
145
- ```typescript
146
- // ❌ any hell
147
- function process(data: any): any { ... }
148
-
149
- // ✓ explicit types
150
- function processUser(user: User): ProcessedUser { ... }
151
- ```
152
-
153
- **Checks**:
154
- - `any` usage (the less the better)
155
- - `unknown` for boundary inputs
156
- - Interfaces / Types have meaningful names
157
-
158
- ---
159
-
160
- ### DX-07: Tests as Documentation
161
-
162
- ```typescript
163
- describe("login endpoint", () => {
164
- test("rejects empty email with 400", async () => { ... })
165
- test("rejects invalid format email with 400", async () => { ... })
166
- test("rejects unknown email with 401", async () => { ... })
167
- test("rejects wrong password with 401", async () => { ... })
168
- test("accepts valid credentials with 200 + JWT", async () => { ... })
169
- })
170
- ```
171
-
172
- Reading these test names = reading API behavior documentation.
173
-
174
- **Checks**:
175
- - Test names describe **behavior** ("returns 400 for empty email"), not implementation ("calls validateEmail")
176
- - Tests cover happy + edge + error paths
177
- - Each test is independent (does not depend on order)
178
-
179
- ---
180
-
181
- ### DX-08: Fast Dev Loop
182
-
183
- - Is build time acceptable? (< 30s to change one line)
184
- - Is test time acceptable? (< 60s to run relevant tests)
185
- - Does HMR / live reload work?
186
-
187
- **Checks**:
188
- - tsc --watch / bundler configuration is reasonable
189
- - Test runner supports --watch
190
- - Non-critical tests are optional (e.g. E2E in CI, not on every commit)
191
-
192
- ---
193
-
194
- ## Checking Methods
195
-
196
- ### Agent Automatic
197
-
198
- When `flow-ux-designer` / `flow-reviewer` applies this gate, use sequential-thinking proportional to the complexity of the codebase being scanned.
199
-
200
- ### Human Review
201
-
202
- Attach a DevEx checklist at PR time:
203
- - [ ] Clear naming (re-read until obvious to a new maintainer)
204
- - [ ] Critical comments exist
205
- - [ ] Consistent structure
206
- - [ ] Actionable error messages
207
- - [ ] Tests as docs
208
-
209
- ---
210
-
211
- ## Scoring
212
-
213
- Score each **applicable** dimension 0-10 (N/A dimensions are excluded from the total):
214
-
215
- ```
216
- 10 = best practice
217
- 8 = good
218
- 5 = pass (production-usable)
219
- 3 = needs improvement
220
- 0 = serious issue
221
- ```
222
-
223
- Emit the per-dimension scores with evidence. The gate itself does not block on a numeric threshold; it surfaces the weaknesses for the user (or the reviewing agent) to decide whether any of them rise to a blocker. A single 0/10 on a material dimension is a blocker regardless of the total.
224
-
225
- ---
226
-
227
- ## Output Format
228
-
229
- ```markdown
230
- ## DevEx Gate Report
231
-
232
- Scores:
233
- DX-01 naming: 7/10 — 2 abbreviations (usr, pwd)
234
- DX-02 comments: 8/10 — magic number 42 not explained
235
- DX-03 structure: 9/10 — consistent
236
- DX-04 errors: 5/10 — 2 uninformative "Failed"
237
- DX-05 Setup: 8/10 — README complete
238
- DX-06 types: 7/10 — 3 instances of any
239
- DX-07 tests: 6/10 — test names too implementation-detail
240
- DX-08 dev loop: 9/10 — HMR works well
241
-
242
- Total: 59/80 (pass)
243
-
244
- Improvement recommendations:
245
- 1. Replace usr/pwd with user/password
246
- 2. Comment magic number 42 (reason for timeout=42s)
247
- 3. Change error message "Failed" → specific reason
248
- 4. Several any usages can be typed explicitly
249
- 5. Rewrite test names with "behavior" descriptions
250
- ```
251
-
252
- ---
253
-
254
- _source: years of development experience + gstack's DX review philosophy._