@curdx/flow 2.0.21 → 2.2.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 (57) hide show
  1. package/.claude-plugin/marketplace.json +25 -2
  2. package/.claude-plugin/plugin.json +10 -1
  3. package/CHANGELOG.md +106 -3
  4. package/README.md +3 -0
  5. package/README.zh.md +14 -5
  6. package/agent-preamble/preamble.md +3 -6
  7. package/agents/flow-qa-engineer.md +16 -15
  8. package/agents/flow-ui-researcher.md +2 -2
  9. package/agents/flow-verifier.md +3 -3
  10. package/bin/curdx-flow +5 -0
  11. package/cli/README.md +10 -9
  12. package/cli/install-bundled-mcps.js +37 -0
  13. package/cli/install-companions.js +19 -252
  14. package/cli/install-context7-config.js +97 -0
  15. package/cli/install-recommended-plugins.js +104 -0
  16. package/cli/install-required-plugins.js +57 -0
  17. package/cli/install-self-update.js +2 -91
  18. package/cli/install.js +12 -1
  19. package/cli/lib/claude.js +42 -11
  20. package/cli/lib/doctor-report.js +47 -8
  21. package/cli/lib/semver.js +95 -0
  22. package/cli/protocols-body.md +3 -2
  23. package/cli/utils.js +1 -0
  24. package/hooks/scripts/quick-mode-guard.sh +6 -7
  25. package/hooks/scripts/session-start.sh +6 -3
  26. package/knowledge/execution-strategies.md +5 -5
  27. package/knowledge/planning-reviews.md +2 -2
  28. package/knowledge/wave-execution.md +17 -17
  29. package/package.json +3 -3
  30. package/schemas/agent-frontmatter.schema.json +66 -0
  31. package/schemas/config.schema.json +24 -4
  32. package/schemas/gate-frontmatter.schema.json +30 -0
  33. package/schemas/hooks.schema.json +83 -0
  34. package/schemas/plugin-manifest.schema.json +66 -0
  35. package/schemas/skill-frontmatter.schema.json +72 -0
  36. package/schemas/spec-state.schema.json +7 -2
  37. package/skills/brownfield-index/SKILL.md +2 -1
  38. package/skills/browser-qa/SKILL.md +5 -4
  39. package/skills/debug/SKILL.md +105 -0
  40. package/skills/epic/SKILL.md +2 -1
  41. package/{commands/fast.md → skills/fast/SKILL.md} +2 -1
  42. package/{commands/help.md → skills/help/SKILL.md} +15 -5
  43. package/{commands/implement.md → skills/implement/SKILL.md} +14 -154
  44. package/skills/implement/references/wave-execution.md +162 -0
  45. package/{commands/init.md → skills/init/SKILL.md} +1 -0
  46. package/{commands/review.md → skills/review/SKILL.md} +38 -3
  47. package/skills/security-audit/SKILL.md +2 -1
  48. package/{commands/spec.md → skills/spec/SKILL.md} +4 -3
  49. package/{commands/start.md → skills/start/SKILL.md} +2 -1
  50. package/skills/ui-sketch/SKILL.md +2 -1
  51. package/skills/verify/SKILL.md +99 -0
  52. package/templates/CONTEXT.md.tmpl +1 -1
  53. package/templates/PROJECT.md.tmpl +1 -1
  54. package/templates/config.json.tmpl +6 -6
  55. package/templates/progress.md.tmpl +2 -2
  56. package/commands/debug.md +0 -199
  57. package/commands/verify.md +0 -142
package/commands/debug.md DELETED
@@ -1,199 +0,0 @@
1
- ---
2
- name: debug
3
- description: Systematic debugging — 4-phase methodology (root cause → pattern → hypothesis → fix); ≥3 failures triggers architectural questioning. Dispatches flow-debugger.
4
- argument-hint: "\"<bug description>\""
5
- allowed-tools: [Read, Write, Edit, Bash, Task, Grep, Glob]
6
- ---
7
-
8
- # Flow Debug — Systematic Debugging
9
-
10
- @${CLAUDE_PLUGIN_ROOT}/knowledge/systematic-debugging.md
11
-
12
- Dispatches the `flow-debugger` agent to perform systematic 4-phase debugging.
13
-
14
- ## When to use
15
-
16
- - Clearly defined bug (with error message / reproduction steps)
17
- - Tests suddenly failing
18
- - Weird production behavior
19
- - Tasks repeatedly failed by flow-executor
20
-
21
- ## When not to use
22
-
23
- - Still in coding phase → use the normal flow-executor flow
24
- - Question needs investigation → use `/curdx-flow:fast` with a prompt like "spike: verify X with minimal tests"
25
- - Performance issue needing benchmarks → performance tuning is not debug
26
-
27
- ## Step 1: Parse bug description
28
-
29
- ```bash
30
- BUG_DESC="$ARGUMENTS"
31
- [ -z "$BUG_DESC" ] && { echo "Usage: /curdx-flow:debug \"<bug description>\""; exit 1; }
32
- ```
33
-
34
- ## Step 2: Collect prerequisites (main agent, no dispatch)
35
-
36
- Before dispatching the debugger, the main agent (you) collects first:
37
-
38
- ```bash
39
- # 1. Recent commit history (bug may be introduced by a new commit)
40
- git log --oneline -20
41
-
42
- # 2. Current modifications (uncommitted)
43
- git status
44
- git diff --stat
45
-
46
- # 3. If there is an active spec, read it
47
- ACTIVE=$(cat .flow/.active-spec 2>/dev/null)
48
- ```
49
-
50
- ## Step 3: Dispatch flow-debugger
51
-
52
- ```
53
- Task:
54
- subagent_type: general-purpose
55
- description: "Debug: $BUG_DESC"
56
- prompt: |
57
- You are the flow-debugger agent. Full definition:
58
- ${CLAUDE_PLUGIN_ROOT}/agents/flow-debugger.md
59
-
60
- Methodology knowledge base:
61
- ${CLAUDE_PLUGIN_ROOT}/knowledge/systematic-debugging.md
62
-
63
- Bug description:
64
- $BUG_DESC
65
-
66
- Workspace:
67
- $(pwd)
68
-
69
- Prerequisites:
70
- - Recent commits: $(git log --oneline -10)
71
- - Current diff: $(git status --short)
72
- - Active spec: $ACTIVE
73
- - Spec directory (if any): .flow/specs/$ACTIVE/
74
-
75
- Mandatory 4 phases:
76
-
77
- Phase 1: Root-cause investigation
78
- - Read the error carefully (stack trace + message + location)
79
- - Build a minimal reproduction
80
- - Check recent changes
81
- - Trace the data flow
82
- - **By the end of Phase 1 you must state the root cause in one sentence; "maybe it's..." is not allowed**
83
-
84
- Phase 2: Pattern analysis
85
- - Find working examples
86
- - Pinpoint the difference
87
- - Decide isolated case vs systemic
88
-
89
- Phase 3: Hypothesis & testing
90
- - Single hypothesis
91
- - Minimal test (verify in memory, don't commit)
92
- - If confirmed, enter Phase 4; if disproved → return to Phase 1
93
-
94
- Phase 4: Implement the fix
95
- - Write a failing test
96
- - Test actually fails (commit: test(scope): red - ...)
97
- - Fix the root cause (not the symptom)
98
- - Test passes (commit: fix(scope): green - ...)
99
- - Full regression test passes
100
- - Sweep for other isolated cases identified in Phase 2 and fix together
101
-
102
- **3-failure guard**:
103
- If Phase 4 has tried 3 different approaches and all failed, **stop**.
104
- Do not try a 4th. Report back to me:
105
- - The 3 approaches tried
106
- - Why each failed
107
- - Possible root issue (architecture / dependency / data)
108
- - Recommend user intervention
109
-
110
- Forbidden:
111
- - Prayer-driven programming (retry 10 times)
112
- - "Maybe it's..." as a root cause
113
- - A fix without a failing test
114
- - Bypassing the root cause (adding null check / try-catch to mask it)
115
- - Fixing multiple things at once (adds variables)
116
-
117
- Output to me a brief:
118
- - Phase 1 root-cause statement
119
- - Phase 2 pattern-analysis conclusion
120
- - Phase 3 hypothesis + verification
121
- - Phase 4 fix commits
122
- - Learnings (suggestions to append to .progress.md)
123
- ```
124
-
125
- ## Step 4: Report to user
126
-
127
- ```
128
- ✓ Debug complete
129
-
130
- Root cause: <Phase 1 conclusion>
131
- Pattern: <Phase 2 conclusion>
132
-
133
- Fix commits:
134
- - <hash>: test - failing test
135
- - <hash>: fix - root-cause fix
136
- - <hash>: (additional) fixed N similar issues
137
-
138
- Verification:
139
- - Failing test now PASS ✓
140
- - Full test suite has no regressions ✓
141
-
142
- 📝 Learnings (can be appended to .progress.md):
143
- - <lesson 1>
144
- - <lesson 2>
145
-
146
- Next steps:
147
- - Review commits
148
- - If the active spec has .progress.md, consider appending learnings
149
- ```
150
-
151
- ## Special case: 3 failures
152
-
153
- If the debugger reports 3 failures:
154
-
155
- ```
156
- ⚠ Systematic debugging failed (3 attempts)
157
-
158
- Attempts:
159
- 1. <method 1>: <why failed>
160
- 2. <method 2>: <why failed>
161
- 3. <method 3>: <why failed>
162
-
163
- Possible root issues:
164
- - Wrong architectural assumption
165
- - Dependency version / compatibility
166
- - Data-layer issue
167
-
168
- Suggestions:
169
- - Review the debugger's detailed report analysis
170
- - Ask Claude directly: "from an architect's and debugger's perspective, what architectural issue does this bug hint at?"
171
- - Or temporarily @ts-ignore / skip test and record as tech debt in STATE.md
172
- ```
173
-
174
- ## Forbidden
175
-
176
- - ✗ Omitting the bug description
177
- - ✗ Expecting "one-shot fix" (debug is a process, not an event)
178
- - ✗ Skipping the debugger and editing code yourself (loses the systematic methodology)
179
- - ✗ Accepting "maybe it's..." as a root cause
180
-
181
- ## Relationship to other commands
182
-
183
- - `/curdx-flow:debug`: for **existing bugs**
184
- - `/curdx-flow:implement`: may encounter bugs, but flow-executor retries 5 times itself before considering `/curdx-flow:debug`
185
- - `/curdx-flow:verify`: finding a "false implementation" counts as a bug, can spawn `/curdx-flow:debug`
186
-
187
- ## Typical scenarios
188
-
189
- ```
190
- Scenario 1: Test suddenly failing
191
- You: "npm test keeps failing a specific test lately but I can't tell why"
192
- /curdx-flow:debug "login test in auth.test.ts fails in CI but passes locally"
193
-
194
- Scenario 2: Production bug
195
- /curdx-flow:debug "production environment returns 500 for some API, stack trace: ..."
196
-
197
- Scenario 3: Bug introduced by refactor
198
- /curdx-flow:debug "login broken after refactor of auth module; pre-refactor version works"
199
- ```
@@ -1,142 +0,0 @@
1
- ---
2
- name: verify
3
- description: Goal-backward verification — trace from every FR / AC / AD in the spec to the code and tests, detect stubs and fake completions. The differentiator command. Optionally adds multi-source coverage audit with --strict.
4
- argument-hint: "[--strict]"
5
- allowed-tools: [Read, Bash, Task, Grep, Glob]
6
- ---
7
-
8
- # Goal-Backward Verification
9
-
10
- This is the **differentiator command**: it scans the implementation against the spec's own requirements and catches the most common Claude failure mode — claiming "done" while actual code is a stub or fake completion.
11
-
12
- ## Flags
13
-
14
- | Flag | Default | Purpose |
15
- |------|---------|---------|
16
- | `--strict` | off | Also run multi-source coverage audit (FR / AC / AD / Research conclusions / D-NN decisions) — replaces v1's `/audit` command. |
17
-
18
- ## Preflight
19
-
20
- ```bash
21
- [ ! -d ".flow" ] && { echo "✗ Not a CurdX-Flow project."; exit 1; }
22
-
23
- SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
24
- [ -z "$SPEC_NAME" ] && { echo "✗ No active spec. Run /curdx-flow:start first."; exit 1; }
25
-
26
- SPEC_DIR=".flow/specs/$SPEC_NAME"
27
- for f in requirements.md design.md tasks.md; do
28
- [ ! -f "$SPEC_DIR/$f" ] && {
29
- echo "✗ $SPEC_DIR/$f missing. Run /curdx-flow:spec first.";
30
- exit 1;
31
- }
32
- done
33
-
34
- FLAG_STRICT=$(echo "$ARGUMENTS" | grep -q -- '--strict' && echo 1 || echo 0)
35
- ```
36
-
37
- ## Workflow
38
-
39
- ### Step 1: Dispatch `flow-verifier`
40
-
41
- Delegate to the `flow-verifier` agent with:
42
- - `requirements.md` (source of FR-NN, AC-N.N, US-NN)
43
- - `design.md` (source of AD-NN)
44
- - `tasks.md` (source of T-N.M and their Verify commands)
45
- - Repository root (to scan code + tests)
46
-
47
- The agent performs goal-backward tracing:
48
- 1. For each **FR-NN**: search for code that implements it. Classify as `IMPLEMENTED` / `STUB` / `MISSING` / `UNCERTAIN`.
49
- 2. For each **AC-N.N**: search for a test that exercises it. Classify as `TESTED` / `UNTESTED`.
50
- 3. For each **AD-NN**: check that the design decision is reflected in code structure / interfaces.
51
- 4. Detect suspicious patterns:
52
- - `throw new Error("not implemented")` / `TODO` / `NotImplementedError`
53
- - `return null` / `return {}` in places that should produce real output
54
- - test files with only `it.skip(...)` or no assertions
55
- - code that returns mocked fixtures instead of calling real collaborators
56
-
57
- ### Step 2: Run the Verify commands from `tasks.md`
58
-
59
- For every task listed in `tasks.md`, run its declared `Verify:` command and record pass/fail. This is the most objective check — if the task said `npm test -- auth.spec.ts`, run exactly that.
60
-
61
- ### Step 3: (Strict only) Multi-source coverage audit
62
-
63
- If `--strict`:
64
- - Cross-check every FR / AC / AD / decision against the implementation
65
- - Cross-check every research conclusion: was the recommended library / approach actually used?
66
- - Cross-check every D-NN decision in `.flow/STATE.md` that references this spec
67
-
68
- ### Step 4: Produce `verification-report.md`
69
-
70
- **Landing check**: sub-agent responses can be truncated by the model's output-length limit. After dispatching `flow-verifier`, verify the report actually landed:
71
-
72
- ```bash
73
- REPORT=".flow/specs/$SPEC_NAME/verification-report.md"
74
- if [ ! -f "$REPORT" ] || [ "$(wc -c < "$REPORT" 2>/dev/null | tr -d ' ')" -lt 300 ]; then
75
- echo "⚠ Report missing or truncated. Re-dispatching flow-verifier with a terse 'write the report now' prompt."
76
- # Re-dispatch pattern:
77
- # "Your only job right now is to Write the verification-report.md using the
78
- # findings you already gathered. Do not re-scan. Do not narrate. Write
79
- # the file and stop."
80
- fi
81
- ```
82
-
83
- Write to `.flow/specs/$SPEC_NAME/verification-report.md`:
84
-
85
- ```markdown
86
- # Verification Report — <spec-name>
87
-
88
- **Generated**: <ISO8601>
89
- **Mode**: strict | normal
90
-
91
- ## Summary
92
- - FR coverage: N/M implemented (K stubs, L missing)
93
- - AC coverage: N/M tested
94
- - AD coverage: N/M reflected
95
- - Verify commands: N/M passing
96
-
97
- ## Findings
98
-
99
- ### Missing implementations
100
- - FR-02: <description>. No matching code found in <paths searched>.
101
-
102
- ### Stubs / fake completions
103
- - FR-05: Implemented in `src/auth.ts:42` but body is `throw new Error("not implemented")`.
104
-
105
- ### Untested acceptance criteria
106
- - AC-1.3: No test asserts token refresh after 15 min expiry.
107
-
108
- ### Failing Verify commands
109
- - T-2.1: `npm test auth.spec.ts` → 3 failed
110
-
111
- ## Verdict
112
- - [ ] PASS — all items covered and passing
113
- - [X] PARTIAL — <n> findings must be addressed before shipping
114
- - [ ] MISSING — substantive implementation gaps
115
- ```
116
-
117
- ### Step 5: Apply `verification-gate`
118
-
119
- Hard rule from `@${CLAUDE_PLUGIN_ROOT}/gates/verification-gate.md`:
120
- - Any `STUB` or `MISSING` finding on a non-deferred FR blocks completion.
121
- - Any failing Verify command blocks completion.
122
- - Waive only with an explicit user D-NN decision logged to `.flow/STATE.md`.
123
-
124
- ## Reporting
125
-
126
- ```
127
- ✓ Verification complete
128
- FR coverage: 8/10 implemented (1 stub, 1 missing)
129
- AC coverage: 9/12 tested
130
- Verify commands: 14/15 passing
131
- Verdict: PARTIAL
132
-
133
- Findings written to: .flow/specs/<name>/verification-report.md
134
-
135
- Next: address findings, then re-run /curdx-flow:verify, or run /curdx-flow:review.
136
- ```
137
-
138
- ## References
139
-
140
- - `flow-verifier` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-verifier.md`
141
- - `verification-gate`: `@${CLAUDE_PLUGIN_ROOT}/gates/verification-gate.md`
142
- - `coverage-audit-gate` (used in strict mode): `@${CLAUDE_PLUGIN_ROOT}/gates/coverage-audit-gate.md`