@curdx/flow 1.1.2 → 1.1.4

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/cli/init.js CHANGED
@@ -8,6 +8,7 @@
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { existsSync } from "node:fs";
11
+ import { fileURLToPath } from "node:url";
11
12
  import {
12
13
  color,
13
14
  log,
@@ -17,6 +18,13 @@ import {
17
18
  runSync,
18
19
  } from "./utils.js";
19
20
 
21
+ // When installed via npm, this file lives at <pkg>/cli/init.js; the templates
22
+ // that ship with the npm package live at <pkg>/templates/. Always prefer those
23
+ // over plugin-cache templates so the version installed via npm controls which
24
+ // template language/content wins (plugin cache may lag behind npm releases).
25
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
26
+ const NPM_PKG_TEMPLATES = path.join(__dirname, "..", "templates");
27
+
20
28
  export async function init(args = []) {
21
29
  const force = args.includes("--force");
22
30
  const target = args.find((a) => !a.startsWith("--")) || process.cwd();
@@ -157,10 +165,18 @@ export async function init(args = []) {
157
165
  // ---------- Helpers ----------
158
166
 
159
167
  /**
160
- * Find the latest installed templates directory in plugin cache.
161
- * Returns null if plugin not installed.
168
+ * Resolve the templates directory. Priority:
169
+ * 1. npm package's own templates/ (shipped with this CLI version — authoritative)
170
+ * 2. Latest Claude Code plugin cache (fallback for local-dev / unbundled runs)
171
+ * 3. null → embedded fallback in embeddedTemplate() below
162
172
  */
163
173
  async function findLatestTemplatesDir() {
174
+ // 1. npm package ships its own templates (highest priority — never stale)
175
+ if (existsSync(NPM_PKG_TEMPLATES)) {
176
+ return NPM_PKG_TEMPLATES;
177
+ }
178
+
179
+ // 2. Claude Code plugin cache (for local-dev where pkg root is the plugin root)
164
180
  const pluginBase = pluginCacheDir();
165
181
  try {
166
182
  const versions = await fs.readdir(pluginBase);
package/cli/utils.js CHANGED
@@ -5,8 +5,17 @@
5
5
 
6
6
  import { spawn, spawnSync } from "node:child_process";
7
7
  import { createInterface } from "node:readline";
8
-
9
- export const VERSION = "1.1.1";
8
+ import { readFileSync } from "node:fs";
9
+ import { fileURLToPath } from "node:url";
10
+ import { dirname, join } from "node:path";
11
+
12
+ // Read version dynamically from package.json so `curdx-flow --version` always
13
+ // reflects the installed package version (avoids drift after npm version bumps).
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const pkgJson = JSON.parse(
16
+ readFileSync(join(__dirname, "..", "package.json"), "utf-8")
17
+ );
18
+ export const VERSION = pkgJson.version;
10
19
 
11
20
  // ---------- Color helpers (no chalk dep) ----------
12
21
  const isTTY = process.stdout.isTTY && process.env.TERM !== "dumb";
@@ -238,8 +247,8 @@ export function pluginCacheDir(pluginName = "curdx-flow", marketplace = "curdx-f
238
247
  // detection + self-healing: create a symlink to the user-level bun install
239
248
  // in a PATH-visible directory.
240
249
 
241
- import { existsSync, mkdirSync, symlinkSync, lstatSync, unlinkSync, readlinkSync } from "node:fs";
242
- import { join } from "node:path";
250
+ import { mkdirSync, symlinkSync, lstatSync, unlinkSync, readlinkSync } from "node:fs";
251
+ // `existsSync` and `join` already imported at the top of this file.
243
252
 
244
253
  const HOME = process.env.HOME || "";
245
254
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curdx/flow",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "CLI installer for CurDX-Flow — AI engineering workflow meta-framework for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,6 +12,7 @@
12
12
  "files": [
13
13
  "bin/",
14
14
  "cli/",
15
+ "templates/",
15
16
  "README.md"
16
17
  ],
17
18
  "engines": {
@@ -0,0 +1,53 @@
1
+ # {{PROJECT_NAME}} — User Preferences and Decisions
2
+
3
+ > CurDX-Flow Context — your coding, design, and interaction preferences. Agents read this to understand your taste.
4
+
5
+ ---
6
+
7
+ ## Code Style Preferences
8
+
9
+ - **Indentation**: <!-- 2 spaces / 4 spaces / Tab -->
10
+ - **Quotes**: <!-- single / double -->
11
+ - **Semicolons**: <!-- always / never / asi -->
12
+ - **Naming**: <!-- camelCase / snake_case / PascalCase -->
13
+ - **Comment density**: <!-- minimal / when non-obvious / generous -->
14
+
15
+ ## Architecture Preferences
16
+
17
+ - **Error handling**: <!-- try/catch / Result type / panics -->
18
+ - **Async pattern**: <!-- async/await / promises / callbacks -->
19
+ - **Dependency injection**: <!-- constructor / service locator / none -->
20
+ - **Testing style**: <!-- TDD / test-after / integration-heavy -->
21
+
22
+ ## UI/UX Preferences
23
+
24
+ - **Design style**: <!-- minimalist / brutalist / corporate / playful -->
25
+ - **Color scheme**: <!-- light / dark / auto / specific palette -->
26
+ - **Typography**: <!-- system / Inter / Space Grotesk / other -->
27
+ - **Density**: <!-- spacious / compact / mixed -->
28
+ - **Animation**: <!-- none / purposeful / expressive -->
29
+
30
+ ## Communication Preferences
31
+
32
+ - **Language**: <!-- Simplified Chinese / English / bilingual -->
33
+ - **Verbosity**: <!-- terse / balanced / verbose -->
34
+ - **Explanation depth**: <!-- surface / mechanism / first-principles -->
35
+ - **When to ask**: <!-- ask at any fork / only on major decisions / be autonomous -->
36
+
37
+ ## Tooling Preferences
38
+
39
+ - **Package manager**: <!-- npm / pnpm / yarn / bun -->
40
+ - **Runtime**: <!-- node / bun / deno -->
41
+ - **Test framework**: <!-- vitest / jest / other -->
42
+ - **Linter**: <!-- eslint / biome / other -->
43
+ - **Commit convention**: <!-- conventional / gitmoji / free -->
44
+
45
+ ## Special Requirements
46
+
47
+ <!-- Rules specific to this project -->
48
+
49
+ - TODO:
50
+
51
+ ---
52
+
53
+ _Generated by `/flow-init` on {{CREATED_DATE}}. Update to match your actual preferences._
@@ -0,0 +1,59 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ > CurDX-Flow project vision — 500 lines max, loaded on every session
4
+
5
+ ---
6
+
7
+ ## One-line Description
8
+
9
+ <!-- In one sentence, state what this project is, for whom, and what problem it solves -->
10
+
11
+ TODO: fill in the one-line description of the project
12
+
13
+ ## Why This Project Exists
14
+
15
+ <!-- Background, motivation, pain points to solve -->
16
+
17
+ TODO:
18
+
19
+ ## Core Users
20
+
21
+ <!-- Who will use it? Their typical scenarios? -->
22
+
23
+ TODO:
24
+
25
+ ## Success Criteria
26
+
27
+ <!-- 3-5 verifiable metrics (e.g. "first response < 100ms", "weekly active users > 1000") -->
28
+
29
+ 1. TODO:
30
+ 2. TODO:
31
+ 3. TODO:
32
+
33
+ ## Tech Stack (with Rationale)
34
+
35
+ <!-- Write the reasoning for each choice to avoid future second-guessing -->
36
+
37
+ | Layer | Choice | Rationale |
38
+ |---|-----|------|
39
+ | Frontend | TODO | TODO |
40
+ | Backend | TODO | TODO |
41
+ | Database | TODO | TODO |
42
+ | Deployment | TODO | TODO |
43
+
44
+ ## Out of Scope (Scope Guard)
45
+
46
+ <!-- Explicitly list what does not belong in this project, to prevent scope creep -->
47
+
48
+ - ✗ TODO:
49
+ - ✗ TODO:
50
+
51
+ ## Constraints
52
+
53
+ <!-- Budget, time, team size, compliance, etc. -->
54
+
55
+ - TODO:
56
+
57
+ ---
58
+
59
+ _Generated by `/flow-init` on {{CREATED_DATE}}. Maintainer: {{USER_NAME}}_
@@ -0,0 +1,50 @@
1
+ # {{PROJECT_NAME}} — Roadmap
2
+
3
+ > CurDX-Flow ROADMAP — phase plan and success criteria. Works alongside `.flow/specs/*`: ROADMAP sets direction, specs handle concrete implementation.
4
+
5
+ ---
6
+
7
+ ## Current Version: v0.1 (MVP)
8
+
9
+ **Goal**: <!-- one sentence -->
10
+
11
+ TODO: describe the minimum viable product to deliver in v0.1.
12
+
13
+ ### Success Criteria (v0.1)
14
+
15
+ <!-- Must be verifiable -->
16
+
17
+ - [ ] TODO:
18
+ - [ ] TODO:
19
+ - [ ] TODO:
20
+
21
+ ### Phases
22
+
23
+ <!-- List in development order -->
24
+
25
+ #### Phase 1 — TODO
26
+ - Goal:
27
+ - Related spec: `specs/<name>`
28
+ - Completion criteria:
29
+
30
+ #### Phase 2 — TODO
31
+ - Goal:
32
+ - Completion criteria:
33
+
34
+ ---
35
+
36
+ ## Next Version: v0.2
37
+
38
+ **Theme**: TODO
39
+
40
+ No details yet.
41
+
42
+ ---
43
+
44
+ ## Vision (12 months)
45
+
46
+ TODO: describe what this project should look like one year from now.
47
+
48
+ ---
49
+
50
+ _Initialized on {{CREATED_DATE}}. The roadmap is a statement of intent, not a commitment._
@@ -0,0 +1,49 @@
1
+ # {{PROJECT_NAME}} — Cross-Session State
2
+
3
+ > CurDX-Flow STATE — explicit decision log + important context. Agents read this file at the start of every session.
4
+ >
5
+ > Division of labor with claude-mem: claude-mem captures everything automatically; STATE.md only records **decisions you and the agent explicitly agreed on**.
6
+
7
+ ---
8
+
9
+ ## Key Decisions
10
+
11
+ <!--
12
+ Format: D-NN | YYYY-MM-DD | decision | why
13
+ Once a decision is recorded, subsequent agents must explicitly note "I challenge D-NN" before violating it.
14
+ -->
15
+
16
+ <!-- Example (delete on init):
17
+ - **D-01** | 2026-04-19 | Use JWT instead of session cookie | Support cross-origin SPA
18
+ - **D-02** | 2026-04-19 | bcrypt cost factor = 12 | Balance 10K QPS performance with security
19
+ -->
20
+
21
+ No decisions yet.
22
+
23
+ ## Blockers
24
+
25
+ <!-- Items currently blocking progress, and who/what is being waited on -->
26
+
27
+ No blockers.
28
+
29
+ ## Open Questions
30
+
31
+ <!-- Questions that need user answers or investigation -->
32
+
33
+ None yet.
34
+
35
+ ## Important Context
36
+
37
+ <!-- Long-standing context the agent should remember, not quite at "decision" level -->
38
+
39
+ None yet.
40
+
41
+ ## Milestones
42
+
43
+ <!-- Project-level major milestones -->
44
+
45
+ None yet.
46
+
47
+ ---
48
+
49
+ _Initialized on {{CREATED_DATE}}. This file will grow as the project evolves._
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/wdx/curdx-flow/main/schemas/config.schema.json",
3
+ "version": "1.0",
4
+ "mode": "standard",
5
+ "_mode_options": "sketch | fast | standard | enterprise | autonomous",
6
+
7
+ "execution": {
8
+ "strategy": "auto",
9
+ "_strategy_options": "auto | subagent | stop-hook | wave | linear",
10
+ "max_parallel": 5,
11
+ "subagent_threshold": 8
12
+ },
13
+
14
+ "gates": {
15
+ "always_on": [
16
+ "karpathy-gate",
17
+ "verification-gate"
18
+ ],
19
+ "standard_mode": [
20
+ "tdd-gate",
21
+ "coverage-audit-gate",
22
+ "simplicity-gate"
23
+ ],
24
+ "enterprise_mode": [
25
+ "adversarial-review-gate",
26
+ "edge-case-gate",
27
+ "hard-gate",
28
+ "security-gate"
29
+ ]
30
+ },
31
+
32
+ "specs": {
33
+ "directories": ["./.flow/specs"],
34
+ "default_task_size": "fine",
35
+ "_task_size_options": "fine (40-60 tasks) | coarse (10-20 tasks)"
36
+ },
37
+
38
+ "addons": {
39
+ "pua": {
40
+ "enabled": false,
41
+ "style": "alibaba",
42
+ "_style_options": "alibaba | bytedance | huawei | tencent | baidu | pdd | meituan | jd | xiaomi | netflix | musk | jobs | amazon",
43
+ "auto_trigger": "on-failure"
44
+ }
45
+ },
46
+
47
+ "created": "{{CREATED_DATE}}"
48
+ }
@@ -0,0 +1,163 @@
1
+ ---
2
+ spec: {{SPEC_NAME}}
3
+ phase: design
4
+ created: {{CREATED_DATE}}
5
+ version: 1.0
6
+ status: in_progress
7
+ depends_on: requirements.md
8
+ ---
9
+
10
+ # Technical Design: {{SPEC_NAME}}
11
+
12
+ > Conclusions from the flow-architect agent using at least 8 rounds of `sequential-thinking` reasoning.
13
+ > This document freezes the technical choices. Subsequent tasks / implementation strictly follow this design.
14
+
15
+ ---
16
+
17
+ ## Design Overview (one paragraph)
18
+
19
+ <!-- One-sentence summary of the architecture -->
20
+
21
+ ## Architecture Decisions
22
+
23
+ <!-- Each major decision gets an ID and is written to the decisions array in .flow/STATE.md -->
24
+
25
+ ### AD-01: ...
26
+ - **Decision**: Use X instead of Y
27
+ - **Rationale**: ...
28
+ - **Trade-off**: Accepted [downside] in exchange for [upside]
29
+ - **sequentialthinking rounds**: rounds 3-5
30
+
31
+ ### AD-02: ...
32
+
33
+ ## System Architecture Diagram
34
+
35
+ ```mermaid
36
+ flowchart TB
37
+ <!-- actual data flow generated by flow-architect -->
38
+ User[User] --> API[API Gateway]
39
+ API --> Auth[Auth Service]
40
+ Auth --> DB[(Database)]
41
+ ```
42
+
43
+ ## Component Design
44
+
45
+ <!-- Each component is independently testable. Interfaces are explicit. -->
46
+
47
+ ### Component: {{COMP_NAME_1}}
48
+ - **Responsibility**: ...
49
+ - **Input**:
50
+ ```ts
51
+ interface Input {
52
+ field: Type;
53
+ }
54
+ ```
55
+ - **Output**:
56
+ ```ts
57
+ interface Output {
58
+ field: Type;
59
+ }
60
+ ```
61
+ - **Dependencies**: Component X, Library Y
62
+ - **Errors**:
63
+ - `ErrorCode.X` — when ... happens
64
+ - `ErrorCode.Y` — when ... happens
65
+
66
+ ### Component: {{COMP_NAME_2}}
67
+ <!-- ... -->
68
+
69
+ ## Data Model
70
+
71
+ <!-- Database schema / data structures -->
72
+
73
+ ### Entity: ...
74
+ ```sql
75
+ CREATE TABLE ... (
76
+ id UUID PRIMARY KEY,
77
+ ...
78
+ );
79
+ ```
80
+
81
+ ### Or TypeScript types:
82
+ ```ts
83
+ interface Entity {
84
+ id: string;
85
+ ...
86
+ }
87
+ ```
88
+
89
+ ## State Machine (if applicable)
90
+
91
+ ```mermaid
92
+ stateDiagram-v2
93
+ [*] --> Pending
94
+ Pending --> Active: approve
95
+ Pending --> Rejected: reject
96
+ Active --> Completed: finish
97
+ ```
98
+
99
+ ## Error Path Design
100
+
101
+ <!-- Full flow on failure -->
102
+
103
+ | Scenario | Upstream Behavior | System Response | User-visible |
104
+ |-----|--------|---------|---------|
105
+ | DB connection lost | retry 3 times | return 503 | "Temporarily unavailable, retry in 1 minute" |
106
+ | Rate limit hit | none | return 429 | "Too many requests, retry in 60 seconds" |
107
+
108
+ ## API Contract
109
+
110
+ <!-- If this is an API project -->
111
+
112
+ ```yaml
113
+ POST /api/v1/...
114
+ Request:
115
+ body:
116
+ field: string
117
+ Response:
118
+ 200:
119
+ body:
120
+ field: string
121
+ 400:
122
+ body:
123
+ error: string
124
+ ```
125
+
126
+ ## Test Matrix
127
+
128
+ | Layer | Coverage | Tool |
129
+ |---|-----|------|
130
+ | Unit | All pure functions | vitest |
131
+ | Integration | Between components | vitest + supertest |
132
+ | E2E | Complete user flows | playwright / chrome-devtools MCP |
133
+
134
+ ### Key Test Scenarios
135
+ 1. Happy path: ...
136
+ 2. Edge case 1: ...
137
+ 3. Error recovery: ...
138
+
139
+ ## Suggested Implementation Order
140
+
141
+ <!-- Reference for decomposition in the tasks phase -->
142
+
143
+ 1. Build skeleton first (Component A → empty implementation)
144
+ 2. Then wire up the real logic (core logic of Component A)
145
+ 3. Connect DB (persistence for Component A)
146
+ 4. Then do Component B ...
147
+
148
+ ## Risks and Mitigations
149
+
150
+ | Risk | Level | Mitigation |
151
+ |-----|-----|------|
152
+ | ... | medium | ... |
153
+
154
+ ## Defer to Implementation
155
+
156
+ <!-- Decisions not worth spending time on in the design phase -->
157
+
158
+ - Logging library choice → reuse project's existing one during implementation
159
+ - Caching strategy → no caching initially, adjust based on data after launch
160
+
161
+ ---
162
+
163
+ _Generated by flow-architect agent on {{CREATED_DATE}}. After user reviews and approves AD-01~N, proceed to the tasks phase._
@@ -0,0 +1,58 @@
1
+ # Progress Log: {{SPEC_NAME}}
2
+
3
+ > Living document. The agent appends here every time a task is completed / a gotcha is discovered / a decision is made.
4
+ >
5
+ > On resume after an interruption, the agent reads this file to rebuild context.
6
+
7
+ ---
8
+
9
+ ## Reality Check (current actual state)
10
+
11
+ <!-- At the start of each session, the agent reconciles: expected state vs actual state -->
12
+
13
+ **Last updated**: {{CREATED_DATE}}
14
+
15
+ - Current phase: research
16
+ - Current task: N/A (tasks phase not yet entered)
17
+ - Blockers: none
18
+
19
+ ## Completed Tasks
20
+
21
+ <!-- List of completed tasks -->
22
+
23
+ _(not yet started)_
24
+
25
+ ## Learnings
26
+
27
+ <!-- Things the agent discovered during execution that are worth remembering (useful for similar future situations) -->
28
+
29
+ ### Gotchas
30
+ _(none)_
31
+
32
+ ### Patterns that worked
33
+ _(none)_
34
+
35
+ ### Approaches that didn't work
36
+ _(none)_
37
+
38
+ ## Decisions Made Here
39
+
40
+ <!-- Technical decisions made within this spec (major decisions should be synced to .flow/STATE.md) -->
41
+
42
+ _(none)_
43
+
44
+ ## Next Steps
45
+
46
+ <!-- What to do next. Must be filled in before ending the session. -->
47
+
48
+ - [ ] Enter the research phase: run `/flow-research`
49
+
50
+ ## Questions for User
51
+
52
+ <!-- Questions that need user answers -->
53
+
54
+ _(none)_
55
+
56
+ ---
57
+
58
+ _Spec initialized on {{CREATED_DATE}}._
@@ -0,0 +1,94 @@
1
+ ---
2
+ spec: {{SPEC_NAME}}
3
+ phase: requirements
4
+ created: {{CREATED_DATE}}
5
+ version: 1.0
6
+ status: in_progress
7
+ depends_on: research.md
8
+ ---
9
+
10
+ # Requirements Spec: {{SPEC_NAME}}
11
+
12
+ > **Recommended direction from the research phase**: {{RESEARCH_CONCLUSION}}
13
+ >
14
+ > This phase: translate "technically feasible" into "concrete behaviors users benefit from".
15
+
16
+ ---
17
+
18
+ ## User Stories
19
+
20
+ <!-- Each story follows the format: As X, I want Y, so that Z -->
21
+
22
+ ### US-01: ...
23
+ **As** [user role],
24
+ **I want** [capability],
25
+ **so that** [business value].
26
+
27
+ **Acceptance criteria**:
28
+ - AC-1.1: [verifiable behavior]
29
+ - AC-1.2: [verifiable behavior]
30
+ - AC-1.3: [edge case handling]
31
+
32
+ ### US-02: ...
33
+ <!-- ... -->
34
+
35
+ ## Functional Requirements
36
+
37
+ <!-- FR-NN format. Each FR must be a verifiable statement of "the system must X". -->
38
+
39
+ - **FR-01**: The system must ...
40
+ - **FR-02**: The system must ...
41
+ - **FR-03**: ...
42
+
43
+ ## Non-Functional Requirements
44
+
45
+ ### Performance
46
+ - **NFR-P-01**: [e.g. P95 response time < 200ms]
47
+ - **NFR-P-02**: ...
48
+
49
+ ### Security
50
+ - **NFR-S-01**: ...
51
+ - **NFR-S-02**: ...
52
+
53
+ ### Maintainability
54
+ - **NFR-M-01**: ...
55
+
56
+ ### Compatibility
57
+ - **NFR-C-01**: ...
58
+
59
+ ## Edge Cases and Error Handling
60
+
61
+ <!-- Must be explicit: what happens on failure? how are abnormal inputs handled? -->
62
+
63
+ | Scenario | Expected behavior |
64
+ |-----|--------|
65
+ | Network disconnected | ... |
66
+ | Database exception | ... |
67
+ | Invalid input | ... |
68
+ | Concurrent conflict | ... |
69
+
70
+ ## Out of Scope
71
+
72
+ <!-- Karpathy principle 2: simplicity first. Explicitly list "not this time" to prevent scope creep. -->
73
+
74
+ - ✗ Feature A — deferred to the next version
75
+ - ✗ Feature B — out of budget
76
+ - ✗ Feature C — needs its own spec
77
+
78
+ ## Success Metrics
79
+
80
+ <!-- Must be quantifiable -->
81
+
82
+ - Metric 1: [e.g. user signup completion rate > 80%]
83
+ - Metric 2: [e.g. complaint rate < 1%]
84
+
85
+ ## Open Questions
86
+
87
+ <!-- Questions that need user answers -->
88
+
89
+ 1. **Question 1**: ...
90
+ 2. **Question 2**: ...
91
+
92
+ ---
93
+
94
+ _Generated by flow-product-designer agent on {{CREATED_DATE}}. After user review, proceed to the design phase._
@@ -0,0 +1,114 @@
1
+ ---
2
+ spec: {{SPEC_NAME}}
3
+ phase: research
4
+ created: {{CREATED_DATE}}
5
+ version: 1.0
6
+ status: in_progress
7
+ ---
8
+
9
+ # Research Report: {{SPEC_NAME}}
10
+
11
+ > **Goal**: {{SPEC_GOAL}}
12
+ >
13
+ > Output of this phase. Subsequent requirements / design / tasks are all based on the conclusions of this document.
14
+
15
+ ---
16
+
17
+ ## Prior Experience (from claude-mem)
18
+
19
+ <!--
20
+ flow-researcher first calls mcp__claude_mem__search to retrieve relevant history.
21
+ If there are relevant observations, summarize them here; if not, write "(first research on this topic)".
22
+ -->
23
+
24
+ {{CLAUDE_MEM_FINDINGS}}
25
+
26
+ ## Problem Understanding
27
+
28
+ <!-- Translate the user's goal into technical language. Explicitly list assumptions. -->
29
+
30
+ ### Core Problem
31
+ <!-- One-line description of what we are solving -->
32
+
33
+ ### Explicit Assumptions
34
+ <!-- Karpathy principle 1: think before coding. List all assumptions for the user to confirm -->
35
+ - Assumption 1: ...
36
+ - Assumption 2: ...
37
+
38
+ ### Known Constraints
39
+ - Tech stack:
40
+ - Budget / time:
41
+ - Team capability:
42
+ - Compliance requirements:
43
+
44
+ ## Technical Solution Space
45
+
46
+ <!-- List 2-3 possible approaches with their pros and cons. Pick one in the design phase. -->
47
+
48
+ ### Option A: ...
49
+ - **Pros**:
50
+ - **Cons**:
51
+ - **Complexity**: low / medium / high
52
+ - **Docs (context7 queries)**:
53
+ - `library-name@version`: ...
54
+
55
+ ### Option B: ...
56
+ - **Pros**:
57
+ - **Cons**:
58
+ - **Complexity**: low / medium / high
59
+
60
+ ### Option C (optional): ...
61
+
62
+ ## Existing Code Analysis
63
+
64
+ <!-- Codebase scan results. Which existing modules can be reused? Which need to be new? -->
65
+
66
+ ### Reusable Modules
67
+ - `path/to/existing-module.ts` — ...
68
+
69
+ ### Modules to Create
70
+ - `path/to/new-module.ts` — ...
71
+
72
+ ### Modules to Modify
73
+ - `path/to/modify.ts` — ...
74
+
75
+ ## Latest Documentation Summary (context7)
76
+
77
+ <!-- Latest APIs / best practices found by flow-researcher via mcp__context7__* -->
78
+
79
+ ### {{LIBRARY_1}}
80
+ - Version:
81
+ - Relevant APIs:
82
+ - Gotchas / changes:
83
+
84
+ ### {{LIBRARY_2}}
85
+ - ...
86
+
87
+ ## Feasibility Assessment
88
+
89
+ <!-- Explicitly answer: can this be done? how hard is it? -->
90
+
91
+ - **Feasibility**: ✓ feasible / ⚠ risky / ✗ not recommended
92
+ - **Estimated complexity**: 1-10
93
+ - **Main risks**:
94
+ - Risk 1: ...
95
+ - Risk 2: ...
96
+
97
+ ## Recommended Direction
98
+
99
+ <!-- Research conclusion: which option is recommended and why. If multiple options need discussion, explain here. -->
100
+
101
+ **Recommendation**: Option ?
102
+ **Rationale**:
103
+ **To confirm in the design phase**:
104
+
105
+ ## Open Questions
106
+
107
+ <!-- Questions the research phase couldn't answer, to be deferred to later phases or asked of the user -->
108
+
109
+ 1. ...
110
+ 2. ...
111
+
112
+ ---
113
+
114
+ _Generated by flow-researcher agent on {{CREATED_DATE}}. Subsequent phases continue from this document._
@@ -0,0 +1,141 @@
1
+ ---
2
+ spec: {{SPEC_NAME}}
3
+ phase: tasks
4
+ created: {{CREATED_DATE}}
5
+ version: 1.0
6
+ status: in_progress
7
+ depends_on: design.md
8
+ task_size: fine
9
+ ---
10
+
11
+ # Task Breakdown: {{SPEC_NAME}}
12
+
13
+ > POC-First 5 Phases: **work → refactor → test → quality gates → PR lifecycle**.
14
+ >
15
+ > Each task includes: `Do`, `Files`, `Done-when`, `Verify`, `Commit`. Verifiable via automation.
16
+
17
+ ---
18
+
19
+ ## Marker Rules
20
+
21
+ - `[ ]` TODO / `[x]` done
22
+ - `[P]` parallel-safe (can be dispatched in parallel within the same wave)
23
+ - `[VERIFY]` quality checkpoint (run by the flow-verifier agent)
24
+ - `[SEQUENTIAL]` must be serial (breaks the parallel group)
25
+
26
+ ---
27
+
28
+ ## Phase 1: Make It Work (POC)
29
+
30
+ > Goal: get it running end-to-end. Hardcoding is acceptable; skip tests.
31
+
32
+ - [ ] **1.1** [P] Initialize module skeleton
33
+ - **Do**: create `src/{{MODULE}}/` directory, add `index.ts`, `types.ts`
34
+ - **Files**: `src/{{MODULE}}/index.ts`, `src/{{MODULE}}/types.ts`
35
+ - **Done when**: directory exists, `import {} from './{{MODULE}}'` does not error
36
+ - **Verify**: `npx tsc --noEmit`
37
+ - **Commit**: `feat({{MODULE}}): initialize module skeleton`
38
+ - _Requirements_: FR-01
39
+
40
+ - [ ] **1.2** [P] ...
41
+ - **Do**: ...
42
+ - **Files**: ...
43
+ - **Done when**: ...
44
+ - **Verify**: ...
45
+ - **Commit**: ...
46
+ - _Requirements_: ...
47
+ - _Design_: AD-01
48
+
49
+ - [ ] **1.3** [VERIFY] End-to-end POC verification
50
+ - **Do**: run the happy path manually, confirm the core scenario works
51
+ - **Verify**: `curl http://localhost:3000/... | jq`
52
+ - **Done when**: returns expected data (edge cases may still be wrong)
53
+
54
+ ## Phase 2: Refactoring
55
+
56
+ > Goal: clean up the code structure. Behavior unchanged.
57
+
58
+ - [ ] **2.1** Extract duplicated logic
59
+ - **Do**: ...
60
+ - **Verify**: `npx tsc --noEmit && git diff --stat`
61
+ - **Commit**: `refactor({{MODULE}}): extract common logic`
62
+
63
+ - [ ] **2.2** [VERIFY] Refactor does not break behavior
64
+ - **Verify**: rerun the manual test from Phase 1
65
+ - **Done when**: all outputs match
66
+
67
+ ## Phase 3: Testing (TDD red / green / yellow)
68
+
69
+ > Rule: tests first. Let the test fail first (RED), then implement (GREEN), then clean up (YELLOW).
70
+
71
+ - [ ] **3.1** [RED] Write failing tests — unit
72
+ - **Do**: write unit tests for core functions
73
+ - **Files**: `src/{{MODULE}}/*.test.ts`
74
+ - **Verify**: `npm test -- src/{{MODULE}}` — expected to fail
75
+ - **Commit**: `test({{MODULE}}): red - add unit tests for core logic`
76
+
77
+ - [ ] **3.2** [GREEN] Make tests pass
78
+ - **Do**: fix the implementation so the tests from 3.1 pass
79
+ - **Verify**: `npm test -- src/{{MODULE}}` — all green
80
+ - **Commit**: `feat({{MODULE}}): green - satisfy unit tests`
81
+
82
+ - [ ] **3.3** [YELLOW] Refactor and clean up
83
+ - **Do**: clean up the implementation, tests still pass
84
+ - **Commit**: `refactor({{MODULE}}): yellow - clean implementation`
85
+
86
+ - [ ] **3.4** [RED → GREEN → YELLOW] Integration tests
87
+ - <!-- Repeat the TDD cycle -->
88
+
89
+ - [ ] **3.5** [VERIFY] Coverage check
90
+ - **Verify**: `npm test -- --coverage` — core logic > 80%
91
+
92
+ ## Phase 4: Quality Gates
93
+
94
+ > Full local checks. Last gate before CI.
95
+
96
+ - [ ] **4.1** TypeScript strict check
97
+ - **Verify**: `npx tsc --strict --noEmit` — 0 errors
98
+ - **Commit**: `chore({{MODULE}}): tsc strict passes`
99
+
100
+ - [ ] **4.2** Lint
101
+ - **Verify**: `npx eslint src/{{MODULE}}` — 0 errors, 0 warnings
102
+
103
+ - [ ] **4.3** All tests pass
104
+ - **Verify**: `npm test` — all green
105
+
106
+ - [ ] **4.4** [VERIFY] Final health check
107
+ - **Do**: flow-verifier agent performs goal-driven reverse verification
108
+ - **Done when**: every FR-XX and AC-X.Y has a corresponding automated verification
109
+
110
+ ## Phase 5: PR Lifecycle
111
+
112
+ - [ ] **5.1** Generate PR
113
+ - **Do**: `/flow-ship` creates the PR
114
+ - **Done when**: PR URL returned, description is clear
115
+
116
+ - [ ] **5.2** Respond to review feedback
117
+ - **Do**: iterate until approved
118
+ - **Verify**: CI all green
119
+
120
+ - [ ] **5.3** Merge
121
+ - **Do**: `/flow-land`
122
+ - **Verify**: the main branch contains all commits for this spec
123
+
124
+ ---
125
+
126
+ ## Coverage Audit
127
+
128
+ <!-- Final step for flow-planner: confirm every FR / AC / AD / D has a corresponding task -->
129
+
130
+ | Requirement ID | Task(s) | Status |
131
+ |--------|---------|------|
132
+ | FR-01 | 1.2, 3.1 | ✓ |
133
+ | FR-02 | ... | ⚠ uncovered — needs adding |
134
+ | AD-01 | 1.1 | ✓ |
135
+ | D-05 (STATE.md) | ... | ✓ |
136
+
137
+ **Uncovered items must be handled**: add a task or document the deferral reason in STATE.md.
138
+
139
+ ---
140
+
141
+ _Generated by flow-planner agent on {{CREATED_DATE}}. N tasks total, estimated X hours._