@curdx/flow 1.1.11 → 2.0.0-beta.10
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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +4 -11
- package/CHANGELOG.md +99 -0
- package/README.md +74 -102
- package/README.zh.md +2 -2
- package/agent-preamble/preamble.md +81 -11
- package/agents/flow-adversary.md +41 -56
- package/agents/flow-architect.md +24 -11
- package/agents/flow-debugger.md +2 -2
- package/agents/flow-edge-hunter.md +20 -6
- package/agents/flow-executor.md +3 -3
- package/agents/flow-planner.md +51 -48
- package/agents/flow-product-designer.md +15 -2
- package/agents/flow-qa-engineer.md +4 -4
- package/agents/flow-researcher.md +18 -3
- package/agents/flow-reviewer.md +5 -1
- package/agents/flow-security-auditor.md +2 -2
- package/agents/flow-triage-analyst.md +4 -4
- package/agents/flow-ui-researcher.md +7 -7
- package/agents/flow-ux-designer.md +3 -3
- package/agents/flow-verifier.md +47 -14
- package/bin/curdx-flow.js +13 -1
- package/cli/doctor.js +28 -13
- package/cli/install.js +62 -36
- package/cli/protocols.js +63 -10
- package/cli/registry.js +73 -0
- package/cli/uninstall.js +9 -11
- package/cli/upgrade.js +6 -10
- package/cli/utils.js +104 -56
- package/commands/debug.md +10 -10
- package/commands/fast.md +1 -1
- package/commands/help.md +109 -87
- package/commands/implement.md +7 -7
- package/commands/init.md +18 -7
- package/commands/review.md +114 -130
- package/commands/spec.md +131 -89
- package/commands/start.md +130 -153
- package/commands/verify.md +110 -92
- package/gates/adversarial-review-gate.md +20 -20
- package/gates/coverage-audit-gate.md +1 -1
- package/gates/devex-gate.md +5 -6
- package/gates/edge-case-gate.md +2 -2
- package/gates/security-gate.md +3 -3
- package/hooks/hooks.json +0 -11
- package/hooks/scripts/quick-mode-guard.sh +12 -9
- package/hooks/scripts/session-start.sh +2 -2
- package/hooks/scripts/stop-watcher.sh +25 -15
- package/knowledge/epic-decomposition.md +2 -2
- package/knowledge/execution-strategies.md +10 -9
- package/knowledge/planning-reviews.md +6 -6
- package/knowledge/spec-driven-development.md +11 -10
- package/knowledge/two-stage-review.md +6 -5
- package/knowledge/wave-execution.md +5 -5
- package/package.json +4 -2
- package/skills/brownfield-index/SKILL.md +62 -0
- package/skills/browser-qa/SKILL.md +50 -0
- package/skills/epic/SKILL.md +68 -0
- package/skills/security-audit/SKILL.md +50 -0
- package/skills/ui-sketch/SKILL.md +49 -0
- package/templates/config.json.tmpl +1 -1
- package/templates/design.md.tmpl +32 -112
- package/templates/requirements.md.tmpl +25 -43
- package/templates/research.md.tmpl +37 -68
- package/templates/tasks.md.tmpl +27 -84
- package/agents/persona-amelia.md +0 -128
- package/agents/persona-david.md +0 -141
- package/agents/persona-emma.md +0 -179
- package/agents/persona-john.md +0 -105
- package/agents/persona-mary.md +0 -95
- package/agents/persona-oliver.md +0 -136
- package/agents/persona-rachel.md +0 -126
- package/agents/persona-serena.md +0 -175
- package/agents/persona-winston.md +0 -117
- package/commands/audit.md +0 -170
- package/commands/autoplan.md +0 -184
- package/commands/design.md +0 -155
- package/commands/discuss.md +0 -162
- package/commands/doctor.md +0 -124
- package/commands/index.md +0 -261
- package/commands/install-deps.md +0 -128
- package/commands/party.md +0 -241
- package/commands/plan-ceo.md +0 -117
- package/commands/plan-design.md +0 -107
- package/commands/plan-dx.md +0 -104
- package/commands/plan-eng.md +0 -108
- package/commands/qa.md +0 -118
- package/commands/requirements.md +0 -146
- package/commands/research.md +0 -141
- package/commands/security.md +0 -109
- package/commands/sketch.md +0 -118
- package/commands/spike.md +0 -181
- package/commands/status.md +0 -139
- package/commands/switch.md +0 -95
- package/commands/tasks.md +0 -189
- package/commands/triage.md +0 -160
- package/hooks/scripts/fail-tracker.sh +0 -31
package/commands/init.md
CHANGED
|
@@ -22,7 +22,7 @@ ls -la
|
|
|
22
22
|
- If the current directory is a dangerous location such as the home directory or a system directory, stop and ask the user to switch
|
|
23
23
|
- If `.flow/` already exists:
|
|
24
24
|
- With `--force` → continue but warn about overwriting
|
|
25
|
-
- Without `--force` → stop and prompt the user to run `/curdx-flow:
|
|
25
|
+
- Without `--force` → stop and prompt the user to inspect `.flow/` directly, or run `/curdx-flow:start --list` to see existing specs
|
|
26
26
|
|
|
27
27
|
### Step 2: Create Directory Skeleton
|
|
28
28
|
|
|
@@ -71,9 +71,20 @@ Append (if not already present):
|
|
|
71
71
|
|
|
72
72
|
### Step 5: Health Check
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
Do NOT shell out to a new terminal for this step — you are already inside
|
|
75
|
+
Claude Code. Verify inline via the information the plugin already has:
|
|
76
|
+
|
|
77
|
+
- Read `~/.claude/plugins/data/curdx-flow/.deps-checked` (optional — the
|
|
78
|
+
SessionStart hook already refreshes this once per day).
|
|
79
|
+
- If the user asks for the full report, suggest they run
|
|
80
|
+
`npx @curdx/flow doctor` in a separate terminal — don't try to spawn
|
|
81
|
+
it from inside the Claude Code session (output won't render cleanly
|
|
82
|
+
and the user has to alt-tab to see it).
|
|
83
|
+
|
|
84
|
+
Items the CLI doctor covers (for user reference):
|
|
85
|
+
- 2 bundled MCPs (context7 / sequential-thinking) — visible in `claude mcp list`
|
|
86
|
+
- 4 recommended plugins (pua / claude-mem / frontend-design / chrome-devtools-mcp)
|
|
87
|
+
- Runtime PATH guards for `bun` / `uv` (relevant only when claude-mem is installed)
|
|
77
88
|
|
|
78
89
|
### Step 6: Prompt Next Steps
|
|
79
90
|
|
|
@@ -90,9 +101,9 @@ Output:
|
|
|
90
101
|
|
|
91
102
|
Next steps (in order):
|
|
92
103
|
1. Edit .flow/PROJECT.md to add the project goal
|
|
93
|
-
2.
|
|
94
|
-
3. /
|
|
95
|
-
4. /curdx-flow:
|
|
104
|
+
2. (already handled) — recommended plugins installed via `npx @curdx/flow install --all`
|
|
105
|
+
3. npx @curdx/flow doctor — verify health
|
|
106
|
+
4. /curdx-flow:start <name> "<goal>" — begin your first feature spec
|
|
96
107
|
|
|
97
108
|
Start development (after Phase 1 ships):
|
|
98
109
|
5. /curdx-flow:start <name> "<goal>" — kick off the first spec
|
package/commands/review.md
CHANGED
|
@@ -1,168 +1,152 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review
|
|
3
|
-
description: Two-
|
|
4
|
-
argument-hint: "[
|
|
3
|
+
description: Two-stage code review — Stage 1 spec compliance, Stage 2 code quality. Optional flags add adversarial review or edge-case hunting.
|
|
4
|
+
argument-hint: "[--stage=<1|2|both>] [--adversarial] [--edge-case]"
|
|
5
5
|
allowed-tools: [Read, Bash, Task, Grep, Glob]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Two-Stage Code Review
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Distinct from `/curdx-flow:verify`:
|
|
11
|
+
- **verify** checks that the spec's stated goals actually work (goal-backward).
|
|
12
|
+
- **review** checks that the code is good (spec compliance + craftsmanship).
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
Optionally layer on deep reviews from `flow-adversary` and `flow-edge-hunter`.
|
|
14
|
+
## Flags
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
| Flag | Default | Purpose |
|
|
17
|
+
|------|---------|---------|
|
|
18
|
+
| `--stage=<1\|2\|both>` | `both` | Stage 1 = spec compliance only. Stage 2 = code quality only. `both` = sequential. |
|
|
19
|
+
| `--adversarial` | off | Add an adversarial review pass across applicable categories (zero findings requires proof-of-checking, not fabrication). |
|
|
20
|
+
| `--edge-case` | off | Add edge-case hunting across applicable categories. Produces a test-gap checklist. |
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
- Before PR
|
|
19
|
-
- When the user explicitly requests a deep review (add --adversarial / --edge-case / --both)
|
|
20
|
-
|
|
21
|
-
## Step 1: Parse arguments
|
|
22
|
+
## Preflight
|
|
22
23
|
|
|
23
24
|
```bash
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
[ ! -d ".flow" ] && { echo "✗ Not a CurDX-Flow project."; exit 1; }
|
|
26
|
+
|
|
27
|
+
SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
|
|
28
|
+
[ -z "$SPEC_NAME" ] && { echo "✗ No active spec."; exit 1; }
|
|
29
|
+
|
|
30
|
+
# Review needs a design.md + implementation to compare against
|
|
31
|
+
for f in design.md; do
|
|
32
|
+
[ ! -f ".flow/specs/$SPEC_NAME/$f" ] && {
|
|
33
|
+
echo "✗ Missing $f. Run /curdx-flow:spec first.";
|
|
34
|
+
exit 1;
|
|
35
|
+
}
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
FLAG_STAGE=$(echo "$ARGUMENTS" | grep -oP -- '--stage=\K[^\s]+' || echo "both")
|
|
39
|
+
FLAG_ADV=$(echo "$ARGUMENTS" | grep -q -- '--adversarial' && echo 1 || echo 0)
|
|
40
|
+
FLAG_EDGE=$(echo "$ARGUMENTS" | grep -q -- '--edge-case' && echo 1 || echo 0)
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
##
|
|
43
|
+
## Stage 1 — Spec compliance
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
Dispatch `flow-reviewer` in Stage 1 mode. It checks:
|
|
46
|
+
- Implementation actually addresses every US / AC / FR / NFR in `requirements.md`
|
|
47
|
+
- Code structure reflects AD-NN decisions from `design.md`
|
|
48
|
+
- Task checklist in `tasks.md` is genuinely complete (all tasks marked `[x]` have real code)
|
|
49
|
+
- Conventional-commit log (`git log`) matches the tasks declared completed
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
if [ ! -f "$DIR/verification-report.md" ]; then
|
|
44
|
-
echo "⚠ /curdx-flow:verify not run. Recommend running goal-reverse verification first."
|
|
45
|
-
echo "Continue? (y/N)"
|
|
46
|
-
# AskUserQuestion
|
|
47
|
-
fi
|
|
48
|
-
```
|
|
51
|
+
Output: Stage-1 section of the report with any compliance gaps.
|
|
49
52
|
|
|
50
|
-
##
|
|
53
|
+
## Stage 2 — Code quality
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Spec files to read:
|
|
61
|
-
- .flow/specs/$SPEC_NAME/requirements.md
|
|
62
|
-
- .flow/specs/$SPEC_NAME/design.md
|
|
63
|
-
- .flow/specs/$SPEC_NAME/tasks.md
|
|
64
|
-
- .flow/specs/$SPEC_NAME/.state.json
|
|
65
|
-
- .flow/specs/$SPEC_NAME/verification-report.md (if exists)
|
|
66
|
-
|
|
67
|
-
Enabled Gates (from .flow/config.json):
|
|
68
|
-
- karpathy-gate (always)
|
|
69
|
-
- verification-gate (always)
|
|
70
|
-
- tdd-gate (standard+)
|
|
71
|
-
- coverage-audit-gate (standard+)
|
|
72
|
-
|
|
73
|
-
Tasks:
|
|
74
|
-
Stage 1: Spec compliance review
|
|
75
|
-
- Judge each FR / AC / AD / error path as ✓/⚠/✗
|
|
76
|
-
- Check Out of Scope adherence
|
|
77
|
-
|
|
78
|
-
Stage 2: Code quality review
|
|
79
|
-
- Apply all enabled Gates
|
|
80
|
-
- Emit per-Gate check results
|
|
81
|
-
|
|
82
|
-
Combined verdict:
|
|
83
|
-
- APPROVED / APPROVED_WITH_WARNINGS / NEEDS_FIXES / BLOCKED
|
|
84
|
-
|
|
85
|
-
Output:
|
|
86
|
-
.flow/specs/$SPEC_NAME/review-report.md
|
|
87
|
-
|
|
88
|
-
Return a brief to me: Stage 1/2 verdicts, blocking/warning counts, and the top 3 fix suggestions
|
|
89
|
-
```
|
|
55
|
+
Dispatch `flow-reviewer` in Stage 2 mode. It checks:
|
|
56
|
+
- Naming, comments, structure
|
|
57
|
+
- Error handling completeness
|
|
58
|
+
- Test coverage and test quality
|
|
59
|
+
- Performance / resource usage concerns
|
|
60
|
+
- Security smells (not a full security audit — that's `security-audit` skill)
|
|
61
|
+
- Karpathy 4 principles applied
|
|
90
62
|
|
|
91
|
-
|
|
63
|
+
Output: Stage-2 section of the report.
|
|
64
|
+
|
|
65
|
+
## Optional: adversarial review
|
|
92
66
|
|
|
93
67
|
If `--adversarial`:
|
|
68
|
+
Dispatch `flow-adversary`. It scans the applicable categories (Architecture / Implementation / Testing / Security / Maintainability / UX — skip N/A with reason) using `sequential-thinking` proportional to the residual uncertainty, probing:
|
|
69
|
+
1. What's missing?
|
|
70
|
+
2. What's overengineered?
|
|
71
|
+
3. What would break first in production?
|
|
72
|
+
4. What's undocumented that a new maintainer would misunderstand?
|
|
73
|
+
5. What decision locks us out of a future option?
|
|
74
|
+
6. What would a skeptical reviewer reject?
|
|
94
75
|
|
|
95
|
-
|
|
96
|
-
Task:
|
|
97
|
-
subagent_type: general-purpose
|
|
98
|
-
description: "Adversarial review $SPEC_NAME"
|
|
99
|
-
prompt: |
|
|
100
|
-
You are the flow-adversary agent. Full definition:
|
|
101
|
-
${CLAUDE_PLUGIN_ROOT}/agents/flow-adversary.md
|
|
102
|
-
|
|
103
|
-
Core rule: zero findings are forbidden — must find ≥ 3 categories of issues
|
|
104
|
-
|
|
105
|
-
Scan:
|
|
106
|
-
- .flow/specs/$SPEC_NAME/*.md
|
|
107
|
-
- Related code (git diff)
|
|
108
|
-
- Recent commits
|
|
109
|
-
|
|
110
|
-
Use sequential-thinking ≥ 12 rounds (2 rounds × 6 dimensions)
|
|
111
|
-
|
|
112
|
-
Output: .flow/specs/$SPEC_NAME/adversarial-review.md
|
|
113
|
-
```
|
|
76
|
+
**Zero findings requires proof-of-checking, not fabrication** — honest "clean" verdicts are fine if the agent lists what it examined. Per `@${CLAUDE_PLUGIN_ROOT}/gates/adversarial-review-gate.md`.
|
|
114
77
|
|
|
115
|
-
##
|
|
78
|
+
## Optional: edge-case hunting
|
|
116
79
|
|
|
117
80
|
If `--edge-case`:
|
|
81
|
+
Dispatch `flow-edge-hunter` across the applicable categories (skip N/A with one-line reason):
|
|
82
|
+
1. Boundary values (0, MAX, empty, one-over-limit)
|
|
83
|
+
2. Concurrency / race conditions
|
|
84
|
+
3. Network failure / partial failure
|
|
85
|
+
4. Malformed input
|
|
86
|
+
5. Permission / auth failure
|
|
87
|
+
6. Resource exhaustion
|
|
88
|
+
7. Time / locale / timezone
|
|
118
89
|
|
|
119
|
-
|
|
120
|
-
Task:
|
|
121
|
-
subagent_type: general-purpose
|
|
122
|
-
description: "Edge-case scan $SPEC_NAME"
|
|
123
|
-
prompt: |
|
|
124
|
-
You are the flow-edge-hunter agent. Full definition:
|
|
125
|
-
${CLAUDE_PLUGIN_ROOT}/agents/flow-edge-hunter.md
|
|
126
|
-
|
|
127
|
-
Scan the subject's coverage across 7 categories:
|
|
128
|
-
- Boundary values / nulls / concurrency / error recovery / security / i18n / performance
|
|
129
|
-
|
|
130
|
-
Use sequential-thinking ≥ 3 rounds per category
|
|
131
|
-
|
|
132
|
-
Output: .flow/specs/$SPEC_NAME/edge-cases.md
|
|
133
|
-
```
|
|
90
|
+
Output: test-gap checklist with suggested test cases.
|
|
134
91
|
|
|
135
|
-
##
|
|
92
|
+
## Report
|
|
136
93
|
|
|
137
|
-
|
|
138
|
-
MAIN_REPORT="$DIR/review-report.md"
|
|
139
|
-
ADV_REPORT="$DIR/adversarial-review.md"
|
|
140
|
-
EDGE_REPORT="$DIR/edge-cases.md"
|
|
94
|
+
**Landing check**: sub-agent responses can be truncated. After dispatching review agents, verify the report actually landed on disk:
|
|
141
95
|
|
|
142
|
-
|
|
143
|
-
|
|
96
|
+
```bash
|
|
97
|
+
REPORT=".flow/specs/$SPEC_NAME/review-report.md"
|
|
98
|
+
if [ ! -f "$REPORT" ] || [ "$(wc -c < "$REPORT" 2>/dev/null | tr -d ' ')" -lt 300 ]; then
|
|
99
|
+
echo "⚠ Report missing or truncated. Re-dispatching flow-reviewer with a terse 'Write the report now, no narration' prompt."
|
|
100
|
+
fi
|
|
144
101
|
```
|
|
145
102
|
|
|
146
|
-
|
|
103
|
+
Consolidated output: `.flow/specs/$SPEC_NAME/review-report.md`:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
# Review Report — <spec-name>
|
|
107
|
+
|
|
108
|
+
## Stage 1 — Spec Compliance
|
|
109
|
+
- ✓ FR-01: implemented in src/auth.ts
|
|
110
|
+
- ✗ FR-04: missing — add handler for token refresh
|
|
111
|
+
- ⚠ AC-2.1: no integration test asserting 403 on expired token
|
|
147
112
|
|
|
113
|
+
## Stage 2 — Code Quality
|
|
114
|
+
- Blocker: duplicated error-handling pattern in 3 files — extract helper
|
|
115
|
+
- Warning: function foo() in src/a.ts: 90 lines, split
|
|
116
|
+
- Nit: inconsistent naming (getUserId vs fetchUser)
|
|
117
|
+
|
|
118
|
+
## Adversarial (if run)
|
|
119
|
+
...
|
|
120
|
+
|
|
121
|
+
## Edge Cases (if run)
|
|
122
|
+
...
|
|
123
|
+
|
|
124
|
+
## Verdict
|
|
125
|
+
- [ ] APPROVED
|
|
126
|
+
- [X] CHANGES REQUIRED — <n> blockers
|
|
127
|
+
- [ ] REJECTED
|
|
148
128
|
```
|
|
149
|
-
✓ Review complete: $SPEC_NAME
|
|
150
129
|
|
|
151
|
-
|
|
152
|
-
|
|
130
|
+
## Reporting
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
✓ Review complete
|
|
134
|
+
Stage 1 findings: <n>
|
|
135
|
+
Stage 2 findings: <n>
|
|
136
|
+
Adversarial findings: <n> (if --adversarial)
|
|
137
|
+
Edge-case gaps: <n> (if --edge-case)
|
|
138
|
+
Verdict: CHANGES REQUIRED
|
|
153
139
|
|
|
154
|
-
|
|
155
|
-
$([ "$EDGE" = "1" ] && echo "Edge-case scan: $EDGE_REPORT")
|
|
140
|
+
Report: .flow/specs/<name>/review-report.md
|
|
156
141
|
|
|
157
|
-
Next
|
|
158
|
-
$([ "$VERDICT" = "APPROVED" ] && echo " ✓ Proceed to /curdx-flow:ship (Phase 6+)")
|
|
159
|
-
$([ "$VERDICT" = "APPROVED_WITH_WARNINGS" ] && echo " ⚠ Recommend fixing warnings first, then /curdx-flow:ship")
|
|
160
|
-
$([ "$VERDICT" = "NEEDS_FIXES" ] && echo " ❌ Fix blockers → /curdx-flow:implement --task=... → /curdx-flow:review re-review")
|
|
161
|
-
$([ "$VERDICT" = "BLOCKED_BY_SPEC" ] && echo " ❌ Back to /curdx-flow:implement to fill missing FR/AD")
|
|
142
|
+
Next: address blockers, then re-run /curdx-flow:review.
|
|
162
143
|
```
|
|
163
144
|
|
|
164
|
-
##
|
|
145
|
+
## References
|
|
165
146
|
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
147
|
+
- `flow-reviewer` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-reviewer.md`
|
|
148
|
+
- `flow-adversary` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-adversary.md`
|
|
149
|
+
- `flow-edge-hunter` agent: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-edge-hunter.md`
|
|
150
|
+
- `adversarial-review-gate`: `@${CLAUDE_PLUGIN_ROOT}/gates/adversarial-review-gate.md`
|
|
151
|
+
- `edge-case-gate`: `@${CLAUDE_PLUGIN_ROOT}/gates/edge-case-gate.md`
|
|
152
|
+
- Knowledge: `@${CLAUDE_PLUGIN_ROOT}/knowledge/two-stage-review.md`
|
package/commands/spec.md
CHANGED
|
@@ -1,135 +1,177 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec
|
|
3
|
-
description:
|
|
4
|
-
argument-hint: "[
|
|
3
|
+
description: Generate or refresh a feature specification. By default runs research → requirements → design → tasks in sequence. Flags let you target a single phase, stop early, regenerate, or tack on a multi-dimensional planning review.
|
|
4
|
+
argument-hint: "[--phase=<X[,Y,...]>] [--until=<X>] [--review[=<dim[,dim]>]] [--regenerate] [--resume]"
|
|
5
5
|
allowed-tools: [Read, Write, Bash, Task, AskUserQuestion]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Generate or Refresh the Active Spec
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
This command writes the four spec documents (`research.md`, `requirements.md`, `design.md`, `tasks.md`) inside `.flow/specs/<active-spec>/`. It replaces the v1 commands `/research`, `/requirements`, `/design`, `/tasks`, `/plan-ceo`, `/plan-eng`, `/plan-design`, `/plan-dx`, and `/autoplan` — all expressed here as flags.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Flags
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
| Flag | Default | Purpose |
|
|
15
|
+
|------|---------|---------|
|
|
16
|
+
| `--phase=<X[,Y]>` | (inferred from `.state.json`) | Run only the listed phase(s). `X ∈ {research, requirements, design, tasks}`. Accepts comma-separated list. |
|
|
17
|
+
| `--until=<X>` | (none) | Run from the current phase forward, stopping after `X`. Mutually exclusive with `--phase`. |
|
|
18
|
+
| `--review[=<dim[,dim]>]` | (not run) | After phases complete, run a planning review. `dim ∈ {ceo, eng, design, dx, all}`. Bare `--review` = `--review=all`. |
|
|
19
|
+
| `--regenerate` | (resume) | Wipe existing phase output for the targeted phases and rebuild from scratch. |
|
|
20
|
+
| `--resume` | (default) | Continue from `.state.json.phase`. This is the default when no flag is given. |
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
[ -z "$SPEC_NAME" ] && SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
|
|
22
|
+
## Preflight
|
|
19
23
|
|
|
24
|
+
```bash
|
|
25
|
+
# 1. A .flow project must exist
|
|
26
|
+
[ ! -d ".flow" ] && {
|
|
27
|
+
echo "✗ Not a CurDX-Flow project. Run /curdx-flow:init first.";
|
|
28
|
+
exit 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# 2. An active spec must be set
|
|
32
|
+
SPEC_NAME=$(cat .flow/.active-spec 2>/dev/null)
|
|
20
33
|
if [ -z "$SPEC_NAME" ]; then
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
echo "✗ No active spec. Run /curdx-flow:start <name> \"<goal>\" first.";
|
|
35
|
+
exit 1;
|
|
23
36
|
fi
|
|
37
|
+
SPEC_DIR=".flow/specs/$SPEC_NAME"
|
|
38
|
+
STATE_FILE="$SPEC_DIR/.state.json"
|
|
39
|
+
[ ! -f "$STATE_FILE" ] && { echo "✗ Missing $STATE_FILE"; exit 1; }
|
|
24
40
|
```
|
|
25
41
|
|
|
26
|
-
##
|
|
42
|
+
## Flag parsing
|
|
27
43
|
|
|
28
44
|
```bash
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
# $ARGUMENTS is the raw argument string
|
|
46
|
+
FLAG_PHASE=$(echo "$ARGUMENTS" | grep -oP -- '--phase=\K[^\s]+' || true)
|
|
47
|
+
FLAG_UNTIL=$(echo "$ARGUMENTS" | grep -oP -- '--until=\K[^\s]+' || true)
|
|
48
|
+
FLAG_REVIEW=$(echo "$ARGUMENTS" | grep -oP -- '--review(?:=[^\s]+)?' || true)
|
|
49
|
+
FLAG_REGENERATE=$(echo "$ARGUMENTS" | grep -q -- '--regenerate' && echo "1" || echo "0")
|
|
50
|
+
|
|
51
|
+
# Rule: --phase and --until are mutually exclusive
|
|
52
|
+
if [ -n "$FLAG_PHASE" ] && [ -n "$FLAG_UNTIL" ]; then
|
|
53
|
+
echo "✗ --phase and --until cannot be combined. Pick one.";
|
|
54
|
+
exit 1;
|
|
55
|
+
fi
|
|
37
56
|
```
|
|
38
57
|
|
|
39
|
-
##
|
|
58
|
+
## Phase resolution
|
|
40
59
|
|
|
41
|
-
|
|
60
|
+
The ordered pipeline is `research → requirements → design → tasks`. Resolve which phases to run:
|
|
42
61
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
else
|
|
50
|
-
echo "▶ Running research stage..."
|
|
51
|
-
# Via SlashCommand or directly dispatch the agent
|
|
52
|
-
# Recommended: directly invoke the /curdx-flow:research logic (inline or via the SlashCommand tool)
|
|
53
|
-
fi
|
|
54
|
-
```
|
|
62
|
+
- No flags → start at `state.json.phase`, run forward to `tasks`.
|
|
63
|
+
- `--phase=design` → run only `design`.
|
|
64
|
+
- `--phase=design,tasks` → run `design` then `tasks`.
|
|
65
|
+
- `--until=design` → start at `state.json.phase`, stop after `design`.
|
|
66
|
+
- `--regenerate` (no other phase flag) → same as default but clear existing output for each phase before running.
|
|
67
|
+
- `--regenerate --phase=X` → clear `X`'s output, re-run only `X`.
|
|
55
68
|
|
|
56
|
-
|
|
69
|
+
Read and update `.state.json.phase` after each phase succeeds.
|
|
57
70
|
|
|
58
|
-
|
|
71
|
+
## Phase execution
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
SlashCommand: /curdx-flow:research $SPEC_NAME
|
|
63
|
-
```
|
|
73
|
+
For each phase in the resolved list, dispatch a sub-agent via the `Task` tool:
|
|
64
74
|
|
|
65
|
-
###
|
|
75
|
+
### research → `flow-researcher`
|
|
76
|
+
Inputs: spec goal + one-line description from `.state.json`.
|
|
77
|
+
Output: `research.md` covering problem space, prior art (library candidates via `context7`), constraints, technical recommendation.
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
### requirements → `flow-product-designer`
|
|
80
|
+
Inputs: `research.md`.
|
|
81
|
+
Output: `requirements.md` with user stories (US-NN), acceptance criteria (AC-N.N), functional requirements (FR-NN), non-functional requirements (NFR-*).
|
|
82
|
+
|
|
83
|
+
### design → `flow-architect`
|
|
84
|
+
Inputs: `research.md` + `requirements.md`.
|
|
85
|
+
Output: `design.md` with architecture decisions (AD-NN), component boundaries, data models, error-path design, mermaid diagrams (when they clarify). Uses `sequential-thinking` MCP proportional to the genuine tradeoff surface.
|
|
69
86
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
### tasks → `flow-planner`
|
|
88
|
+
Inputs: all three prior files + `.flow/PROJECT.md` tech stack.
|
|
89
|
+
Output: `tasks.md` — POC-First 5-phase decomposition with per-task Verify commands, multi-source coverage audit against FR/AC/AD/Research/Decisions.
|
|
73
90
|
|
|
74
|
-
|
|
75
|
-
Q1: ...
|
|
91
|
+
After each phase completes successfully, update `.state.json`:
|
|
76
92
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"phase": "<just-completed-phase>",
|
|
96
|
+
"phase_status": { "<phase>": "completed" },
|
|
97
|
+
"updated": "<ISO8601 timestamp>"
|
|
98
|
+
}
|
|
81
99
|
```
|
|
82
100
|
|
|
83
|
-
|
|
101
|
+
### Artifact landing check (mandatory after every phase)
|
|
84
102
|
|
|
85
|
-
|
|
103
|
+
Sub-agent responses can be truncated by the model's output-length limit, which means the `Write` tool call for the phase's Markdown artifact may never fire. Do NOT trust the agent's return value alone — always verify the file actually landed.
|
|
86
104
|
|
|
87
|
-
|
|
105
|
+
For each phase just dispatched, run:
|
|
88
106
|
|
|
89
|
-
|
|
107
|
+
```bash
|
|
108
|
+
ARTIFACT=".flow/specs/$SPEC_NAME/<phase>.md"
|
|
109
|
+
if [ ! -f "$ARTIFACT" ]; then
|
|
110
|
+
echo "⚠ $ARTIFACT did not land. Re-dispatching <phase> agent with an explicit 'write the file' prompt."
|
|
111
|
+
# Re-dispatch the same agent, but in the prompt, front-load:
|
|
112
|
+
# "Your ONLY job is to call the Write tool with the full <phase>.md content now.
|
|
113
|
+
# Do not explain. Do not narrate. Write the file and stop."
|
|
114
|
+
# This pattern produces an artifact even when prior verbosity caused truncation.
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
# Minimum-size sanity check — if the file is <500 bytes, the write likely truncated
|
|
118
|
+
if [ -f "$ARTIFACT" ] && [ "$(wc -c < "$ARTIFACT" | tr -d ' ')" -lt 500 ]; then
|
|
119
|
+
echo "⚠ $ARTIFACT looks truncated (<500 bytes). Re-dispatching to complete it."
|
|
120
|
+
fi
|
|
121
|
+
```
|
|
90
122
|
|
|
91
|
-
|
|
123
|
+
Only advance `.state.json.phase` after both the file exists AND passes the size sanity check. If a re-dispatch also fails to produce the artifact, stop and surface the issue to the user instead of silently advancing — that prevents later phases from consuming an empty upstream file.
|
|
92
124
|
|
|
93
|
-
|
|
125
|
+
## Optional planning review
|
|
94
126
|
|
|
95
|
-
|
|
127
|
+
If `--review` (or `--review=<dims>`) is present:
|
|
96
128
|
|
|
97
|
-
|
|
129
|
+
1. **Precondition**: `design.md` must exist. If missing, error: "Design missing. Run `/curdx-flow:spec --phase=design` first."
|
|
130
|
+
2. Parse the dims: `all` expands to `ceo,eng,design,dx`.
|
|
131
|
+
3. Dispatch review agents in parallel via `Task` (one per dim):
|
|
98
132
|
|
|
99
|
-
|
|
133
|
+
| Dim | Agent | Focus |
|
|
134
|
+
|-----|-------|-------|
|
|
135
|
+
| `ceo` | `flow-architect` (review mode) | Strategic: scope fit, ROI, opportunity cost |
|
|
136
|
+
| `eng` | `flow-architect` (review mode) | Engineering: architecture lock-in, risk, technical debt |
|
|
137
|
+
| `design` | `flow-ux-designer` | UX / UI / accessibility / design system |
|
|
138
|
+
| `dx` | `flow-architect` (review mode) | Developer experience: naming, comments, structure, error handling, setup, types, tests, dev loop |
|
|
100
139
|
|
|
101
|
-
|
|
140
|
+
4. Aggregate findings into `.flow/specs/<active>/spec-review.md` with one section per dim and a consolidated verdict (GO / GO-WITH-CHANGES / HOLD).
|
|
141
|
+
|
|
142
|
+
## Reporting
|
|
143
|
+
|
|
144
|
+
Final console output:
|
|
102
145
|
|
|
103
146
|
```
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Requirements: P US, Q FR, R AC
|
|
116
|
-
Design: S AD, T components
|
|
117
|
-
Tasks: U tasks (fine / coarse)
|
|
118
|
-
|
|
119
|
-
Next steps:
|
|
120
|
-
- Review all 4 files
|
|
121
|
-
- To modify, run /curdx-flow:research / /curdx-flow:requirements / ... individually
|
|
122
|
-
- After Phase 2 ships: /curdx-flow:implement
|
|
147
|
+
✓ Spec <name> refreshed
|
|
148
|
+
Phases run: research, requirements, design, tasks
|
|
149
|
+
Review dims: ceo, eng, design, dx (if --review was used)
|
|
150
|
+
Files:
|
|
151
|
+
.flow/specs/<name>/research.md
|
|
152
|
+
.flow/specs/<name>/requirements.md
|
|
153
|
+
.flow/specs/<name>/design.md
|
|
154
|
+
.flow/specs/<name>/tasks.md
|
|
155
|
+
.flow/specs/<name>/spec-review.md (if --review was used)
|
|
156
|
+
|
|
157
|
+
Next: /curdx-flow:implement
|
|
123
158
|
```
|
|
124
159
|
|
|
125
|
-
##
|
|
126
|
-
|
|
127
|
-
If the user passes `--yolo`, all intermediate confirmations default to `continue`, running through in one pass.
|
|
160
|
+
## Common invocations
|
|
128
161
|
|
|
129
|
-
|
|
162
|
+
```
|
|
163
|
+
/curdx-flow:spec # full spec from current state
|
|
164
|
+
/curdx-flow:spec --phase=design # re-run only design (e.g., after requirements changed)
|
|
165
|
+
/curdx-flow:spec --phase=design,tasks # re-run design and tasks
|
|
166
|
+
/curdx-flow:spec --until=design # run up through design, stop (human review checkpoint)
|
|
167
|
+
/curdx-flow:spec --review # full spec + all 4 planning dimensions
|
|
168
|
+
/curdx-flow:spec --review=eng,dx # full spec + engineering + DX review only
|
|
169
|
+
/curdx-flow:spec --regenerate # clear all four phases and rebuild
|
|
170
|
+
/curdx-flow:spec --regenerate --phase=tasks # only rebuild tasks (keep research/requirements/design)
|
|
171
|
+
```
|
|
130
172
|
|
|
131
|
-
##
|
|
173
|
+
## References
|
|
132
174
|
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
175
|
+
- Agents: `@${CLAUDE_PLUGIN_ROOT}/agents/flow-researcher.md`, `flow-product-designer.md`, `flow-architect.md`, `flow-planner.md`, `flow-ux-designer.md`
|
|
176
|
+
- Knowledge: `@${CLAUDE_PLUGIN_ROOT}/knowledge/spec-driven-development.md`, `poc-first-workflow.md`
|
|
177
|
+
- Preamble: `@${CLAUDE_PLUGIN_ROOT}/agent-preamble/preamble.md`
|