ai-workflow-init 7.0.0 → 7.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.
package/.claude/CLAUDE.md CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
  ### 2. Deep Understanding
29
29
  - If unclear about requirements, edge cases, or expected behavior → **Ask first**
30
- - Use `AskUserQuestion` tool to ask multiple questions at once (up to 4)
30
+ - Batch related questions into a single block (avoid asking one at a time)
31
31
  - Never assume or guess - clarification prevents wasted effort
32
32
  - Key questions:
33
33
  - "What should happen when X occurs?"
@@ -405,8 +405,9 @@ Create `docs/ai/requirements/req-{name}.md` with:
405
405
  ## Next Steps
406
406
 
407
407
  1. Review this requirement document
408
- 2. Run `/create-plan req-{name}` to generate implementation plan
409
- 3. Address open questions before implementation
408
+ 2. Address open questions before implementation
409
+ 3. Run `/create-plan` to generate implementation plan (small feature)
410
+ 4. Run `/manage-epic` to break into feature plans (large feature)
410
411
  ```
411
412
 
412
413
  ### File Naming & Versioning
@@ -457,8 +458,9 @@ AskUserQuestion(questions=[{
457
458
  question: "What would you like to do next?",
458
459
  header: "Next",
459
460
  options: [
461
+ { label: "Create plan (small feature)", description: "Run /create-plan — single feature plan" },
462
+ { label: "Create epic (large feature)", description: "Run /manage-epic — break into multiple feature plans" },
460
463
  { label: "View full document", description: "Display the consolidated requirement" },
461
- { label: "Create plan", description: "Run /create-plan for this requirement" },
462
464
  { label: "Continue refining", description: "Run more Q&A or agent passes" }
463
465
  ],
464
466
  multiSelect: false
@@ -19,6 +19,7 @@ Generate a single planning doc at `docs/ai/planning/feature-{name}.md` using the
19
19
 
20
20
  **Parse user request to identify:**
21
21
  - **Requirement doc reference:** Check if user provided path to `docs/ai/requirements/req-{name}.md`
22
+ - **Epic reference:** Check if user provided path to `docs/ai/planning/epic-{name}.md`
22
23
  - **Feature type:** UI/Page, API/Service, Data/Database, Full-stack, Other
23
24
  - **Explicit requirements:** Framework, libraries, constraints mentioned
24
25
  - **Design context:**
@@ -27,6 +28,13 @@ Generate a single planning doc at `docs/ai/planning/feature-{name}.md` using the
27
28
  - No design source? → Flag for Step 5 (theme selection)
28
29
  - **Scope hints:** MVP mentions, deadlines, specific exclusions
29
30
 
31
+ **If Epic Reference Provided:**
32
+ - Read the epic doc: `Read(file_path="docs/ai/planning/epic-{name}.md")`
33
+ - Extract: requirement link, feature plan list, which plan to create next
34
+ - Read the linked requirement doc (from epic's `requirement` frontmatter)
35
+ - Set `epic_plan` and `requirement` frontmatter in the generated feature plan
36
+ - After creating the feature plan, update the epic's Feature Plans table (status → `open`)
37
+
30
38
  **If Requirement Doc Provided:**
31
39
  - Read the requirement doc: `Read(file_path="docs/ai/requirements/req-{name}.md")`
32
40
  - Extract and map to planning sections:
@@ -244,8 +252,11 @@ Produce a Markdown doc following `docs/ai/planning/feature-template.md`.
244
252
  - Epic ID and title
245
253
  - Link to epic plan
246
254
 
247
- 0. **Requirements Reference** (if requirement doc was provided):
248
- - Link to requirement doc: `[req-{name}.md](../requirements/req-{name}.md)`
255
+ 0. **Related Documents** (ONLY if requirement doc or epic was provided — skip entirely if neither exists):
256
+ - Link to requirement doc: `[req-{name}.md](../requirements/req-{name}.md)` (if exists)
257
+ - Link to epic: `[epic-{name}.md](epic-{name}.md)` (if exists)
258
+ - Set `epic_plan` and `requirement` in frontmatter accordingly
259
+ - If standalone (no req, no epic): set both frontmatter to null and **omit this section**
249
260
 
250
261
  1. **Codebase Context** (if exploration was done):
251
262
  - Similar features found
@@ -286,14 +297,48 @@ Produce a Markdown doc following `docs/ai/planning/feature-template.md`.
286
297
  **For each phase:**
287
298
  - Phase name: Descriptive (e.g., "API Endpoints", "UI Components")
288
299
  - Tasks list: `[ ] [ACTION] path/to/file — Summary`
289
- - Pseudo-code: 3-5 lines, natural language, show inputs → logic → outputs
300
+ - Pseudo-code: Structured format with these sections:
290
301
  ```
291
302
  Example:
292
- - Parse username + password from request
293
- - Validate password strength → Hash with bcrypt
294
- - Store user in database → Return success + user ID
303
+ Function: POST /api/auth/register(email, password, name)
304
+
305
+ Input validation:
306
+ - email: Valid format (regex), max 255 chars, lowercase
307
+ - password: Min 8 chars, 1 uppercase, 1 number, 1 special
308
+ - name: 2-50 chars, alphanumeric + spaces only
309
+
310
+ Logic flow:
311
+ 1. Check if email exists in users table → If exists: return 409 Conflict
312
+ 2. Hash password using bcrypt (salt rounds: 10)
313
+ 3. Generate UUID for user_id
314
+ 4. Insert into users table: { id: UUID, email, password_hash, name, created_at: NOW() }
315
+ 5. Create JWT token with payload: { user_id, email } → Expiry: 24h, Secret: from env.JWT_SECRET
316
+
317
+ Return:
318
+ - Success (201): { user_id, email, name, token }
319
+ - Error: { status: 409/400/500, message, error_code }
320
+
321
+ Edge cases:
322
+ - Email already exists → 409 "Email already registered"
323
+ - Invalid email format → 400 "Invalid email"
324
+ - Weak password → 400 "Password must meet requirements"
325
+ - DB connection error → 500 "Registration failed, try again"
326
+ - Missing env.JWT_SECRET → 500 (log critical error)
327
+
328
+ Dependencies:
329
+ - bcrypt library (hash password)
330
+ - jsonwebtoken library (generate JWT)
331
+ - Database: users table (insert)
295
332
  ```
296
333
 
334
+ **Pseudo-code must include:**
335
+ - Function signature or endpoint route
336
+ - Input validation rules (types, constraints, formats)
337
+ - Logic flow with specific values/thresholds
338
+ - Return types for success + error cases
339
+ - Edge cases with handlers (HTTP status codes, error messages)
340
+ - Dependencies (external modules, APIs, DB tables)
341
+
297
342
  Create the file automatically:
298
343
 
299
344
  - `docs/ai/planning/feature-{name}.md` - Use complete structure from `feature-template.md`
@@ -325,10 +370,35 @@ Note: Test documentation will be created separately using the `writing-test` com
325
370
  **Requirement Doc** (`req-template.md`) focuses on **WHAT**:
326
371
  - Problem, Users, Business Rules, Functional Requirements
327
372
 
373
+ **Epic Doc** (`epic-template.md`) focuses on **TRACKING**:
374
+ - Links requirement to multiple feature plans
375
+ - Tracks status and dependencies between plans
376
+
328
377
  **Planning Doc** (`feature-template.md`) focuses on **HOW**:
329
378
  - Codebase Context, Design, Implementation Phases, Pseudo-code
330
379
 
380
+ ### Cross-Linking Flow
381
+
382
+ ```
383
+ req-{name}.md ←→ epic-{name}.md ←→ feature-{name}.md
384
+ (WHAT) (TRACKING) (HOW)
385
+ ```
386
+
387
+ **Standalone (no epic, no req):**
388
+ - feature-template: `requirement` → null, `epic_plan` → null
389
+ - **Remove** Section 0 "Related Documents" entirely
390
+
391
+ **With requirement only (no epic):**
392
+ - feature-template: `requirement` → req doc, `epic_plan` → null
393
+ - Include Section 0 with requirement link only
394
+
395
+ **With epic (and req from epic):**
396
+ - feature-template: `requirement` → req doc, `epic_plan` → epic doc
397
+ - Include Section 0 with both links
398
+ - After creation, update epic's Feature Plans table
399
+
331
400
  When requirement doc exists, planning doc should:
332
- 1. Link to requirement doc (Section 0)
401
+ 1. Link to requirement doc and epic (Section 0: Related Documents)
333
402
  2. Not duplicate requirement content - reference it instead
334
403
  3. Focus on technical implementation details
404
+ 4. After creation, update epic's Feature Plans table (if epic exists)
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: manage-epic
3
+ description: Create or update epic - tracks feature plans for a requirement.
4
+ ---
5
+
6
+ ## Goal
7
+
8
+ Manage epic documents that link requirements to feature plans. An epic is a simple tracking document that lists all feature plans needed to fulfill a requirement.
9
+
10
+ **When to use:**
11
+ - A requirement is too large for a single feature plan
12
+ - You need to break a requirement into multiple feature plans
13
+ - You need to update an epic with new feature plans or status changes
14
+
15
+ ---
16
+
17
+ ## Workflow Alignment
18
+
19
+ - Provide brief status updates (1–3 sentences) before/after important actions.
20
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
21
+ - Update todos immediately after progress; mark completed upon finish.
22
+
23
+ ---
24
+
25
+ ## Step 1: Detect Mode
26
+
27
+ **Parse user input to determine mode:**
28
+
29
+ | Input | Mode | Action |
30
+ |-------|------|--------|
31
+ | Requirement doc path provided | **Create** | Create new epic from requirement |
32
+ | Epic doc path provided | **Update** | Update existing epic |
33
+ | Feature plan path + epic path | **Link** | Add feature plan to epic |
34
+ | No specific path | **Ask** | Ask user what they want to do |
35
+
36
+ **If unclear, ask:**
37
+
38
+ ```
39
+ AskUserQuestion(questions=[{
40
+ question: "What would you like to do with the epic?",
41
+ header: "Mode",
42
+ options: [
43
+ { label: "Create new epic", description: "Break a requirement into feature plans" },
44
+ { label: "Update epic", description: "Add feature plan or update status" },
45
+ { label: "Sync status", description: "Update status of all linked documents" }
46
+ ],
47
+ multiSelect: false
48
+ }])
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Step 2: Create Mode
54
+
55
+ ### 2a: Read Requirement
56
+
57
+ ```
58
+ Read(file_path="docs/ai/requirements/req-{name}.md")
59
+ ```
60
+
61
+ Extract:
62
+ - Feature name
63
+ - Functional requirements (FR table)
64
+ - Implementation guidance / suggested phases
65
+ - Complexity level
66
+
67
+ ### 2b: Break into Feature Plans
68
+
69
+ Analyze the requirement and propose how to break it into feature plans.
70
+
71
+ **Guidelines:**
72
+ - Each feature plan should be independently implementable
73
+ - Group by: feature area, layer (frontend/backend), or dependency order
74
+ - Aim for 2-6 feature plans per epic
75
+ - Each plan should map to specific FRs from the requirement
76
+
77
+ **Ask user to confirm breakdown:**
78
+
79
+ ```
80
+ AskUserQuestion(questions=[{
81
+ question: "Here's the proposed breakdown. Does this look right?",
82
+ header: "Breakdown",
83
+ options: [
84
+ { label: "Looks good", description: "Create epic with this breakdown" },
85
+ { label: "Adjust", description: "I want to modify the breakdown" },
86
+ { label: "Fewer plans", description: "Merge some plans together" }
87
+ ],
88
+ multiSelect: false
89
+ }])
90
+ ```
91
+
92
+ ### 2c: Load Template & Generate Epic
93
+
94
+ ```
95
+ Read(file_path="docs/ai/planning/epic-template.md")
96
+ ```
97
+
98
+ Generate `docs/ai/planning/epic-{name}.md` with:
99
+ - `requirement` frontmatter pointing to the req doc
100
+ - Overview: 1-3 sentences from requirement's executive summary
101
+ - Feature Plans table: proposed feature plans with descriptions
102
+ - Dependency graph: show dependencies between feature plans
103
+ - Related Documents: link back to requirement
104
+
105
+ **Auto-name:** Derive from requirement name (kebab-case).
106
+ - Example: `req-user-authentication.md` → `epic-user-authentication.md`
107
+
108
+ **If file already exists:**
109
+ 1. Backup to `docs/ai/planning/archive/epic-{name}_{timestamp}.md`
110
+ 2. Overwrite main file
111
+ 3. Notify user of backup
112
+
113
+ ### 2d: Update Requirement Doc
114
+
115
+ After creating epic, update the requirement doc's frontmatter and Related Plans section:
116
+ - Set `epic_plan` in frontmatter
117
+ - Update Related Plans table with epic link
118
+
119
+ ---
120
+
121
+ ## Step 3: Update Mode
122
+
123
+ ### 3a: Read Current Epic
124
+
125
+ ```
126
+ Read(file_path="docs/ai/planning/epic-{name}.md")
127
+ ```
128
+
129
+ ### 3b: Determine Update Type
130
+
131
+ | Trigger | Action |
132
+ |---------|--------|
133
+ | New feature plan created | Add row to Feature Plans table |
134
+ | Feature plan completed | Update status to `completed` |
135
+ | Feature plan started | Update status to `in_progress` |
136
+ | Dependency changed | Update dependency graph |
137
+
138
+ ### 3c: Apply Update
139
+
140
+ Edit the epic document with the change. Keep all other content intact.
141
+
142
+ ---
143
+
144
+ ## Step 4: Link Mode
145
+
146
+ When a new feature plan is created (e.g., via `/create-plan`), link it to the epic:
147
+
148
+ 1. Read the epic document
149
+ 2. Add the feature plan to the Feature Plans table
150
+ 3. Update the feature plan's `epic_plan` frontmatter to point to the epic
151
+ 4. Update dependency graph if needed
152
+
153
+ ---
154
+
155
+ ## Step 5: Sync Status
156
+
157
+ Scan all linked documents and synchronize status:
158
+
159
+ 1. Read the epic document
160
+ 2. For each feature plan in the table:
161
+ - Read the feature plan
162
+ - Check if implementation tasks are completed
163
+ - Update status in epic table
164
+ 3. Update requirement doc if all feature plans are completed
165
+
166
+ ---
167
+
168
+ ## Step 6: Summary & Next Steps
169
+
170
+ ```markdown
171
+ ## Epic Updated
172
+
173
+ **File**: docs/ai/planning/epic-{name}.md
174
+
175
+ ### Feature Plans
176
+ | # | Plan | Status |
177
+ |---|------|--------|
178
+ | 1 | feature-{name}-part1.md | {status} |
179
+ | 2 | feature-{name}-part2.md | {status} |
180
+
181
+ ### Next Steps
182
+ - `/create-plan` → Create a feature plan listed in this epic
183
+ - `/execute-plan` → Implement a feature plan
184
+ - `/manage-epic` → Update status or add feature plans
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Cross-Linking Rules
190
+
191
+ When creating or updating documents, ensure cross-links are maintained.
192
+ **Only add links when they exist — never add placeholder/null links.**
193
+
194
+ ### Creating Epic from Requirement (`/manage-epic`)
195
+ 1. Epic: set `requirement` frontmatter → req doc path
196
+ 2. Req doc: add "Related Plans" section with epic link (this section doesn't exist by default)
197
+
198
+ ### Adding Feature Plan to Epic (`/create-plan` with epic context)
199
+ 1. Epic: add row to Feature Plans table
200
+ 2. Feature plan: set `epic_plan` frontmatter → epic path
201
+ 3. Feature plan: set `requirement` frontmatter → req doc path (from epic)
202
+ 4. Feature plan: include Section 0 "Related Documents" with both links
203
+
204
+ ### Creating Feature Plan standalone (`/create-plan` without epic or req)
205
+ 1. Feature plan: frontmatter `epic_plan` = null, `requirement` = null
206
+ 2. Feature plan: **remove** Section 0 "Related Documents" entirely
207
+ 3. No cross-linking needed
208
+
209
+ ---
210
+
211
+ ## Error Handling
212
+
213
+ | Error | Action |
214
+ |-------|--------|
215
+ | Requirement doc not found | Ask user for path or create requirement first |
216
+ | Epic already exists | Ask: update existing or create new (backup old) |
217
+ | Feature plan not found | Skip link, warn user |
218
+ | Template not found | Use minimal structure from this command |
219
+
220
+ ---
221
+
222
+ ## Notes
223
+
224
+ - Epic is purely a tracking document — no architecture or implementation details
225
+ - Feature plans contain all implementation details (via `/create-plan`)
226
+ - Requirement doc contains all WHAT details (via `/clarify-requirements`)
227
+ - Epic bridges the gap: tracks WHICH feature plans implement WHICH requirement
package/cli.js CHANGED
@@ -419,19 +419,6 @@ function installClaudeCode() {
419
419
  run(`wget -qO ${claudeMdPath} ${RAW_BASE}/.claude/CLAUDE.md`);
420
420
  }
421
421
 
422
- // Download settings.json from repo (project-level, shareable with team)
423
- step("🚚 Downloading Claude Code hooks (.claude/settings.json)...");
424
- const claudeSettingsPath = ".claude/settings.json";
425
- if (existsSync(claudeSettingsPath)) {
426
- skip(`Skipping (already exists): ${claudeSettingsPath}`);
427
- } else {
428
- try {
429
- run(`curl -fsSL ${RAW_BASE}/.claude/settings.json -o ${claudeSettingsPath}`);
430
- } catch (_) {
431
- run(`wget -qO ${claudeSettingsPath} ${RAW_BASE}/.claude/settings.json`);
432
- }
433
- success(`Downloaded: ${claudeSettingsPath}`);
434
- }
435
422
 
436
423
  // Download skills folder (always overwrite to get latest)
437
424
  step("🚚 Downloading Claude Code skills (.claude/skills)...");
@@ -8,141 +8,39 @@ requirement: {docs/ai/requirements/req-xxx.md or null}
8
8
 
9
9
  ## 1. Overview
10
10
 
11
- ### Problem Statement
12
- [Brief description of the problem this epic solves]
13
-
14
- ### Goals
15
- - [Primary goal]
16
- - [Secondary goal]
17
-
18
- ### Success Metrics
19
- - [How we measure success]
20
-
21
- ---
22
-
23
- ## 2. Architecture
24
-
25
- > **Note**: High-level architecture overview. Detailed implementation goes in task-level plans.
26
-
27
- ### System Diagram
28
- ```
29
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
30
- │ Component │────▶│ Component │────▶│ Component │
31
- └─────────────┘ └─────────────┘ └─────────────┘
32
- ```
33
-
34
- ### Key Components
35
- | Component | Responsibility | Location |
36
- |-----------|----------------|----------|
37
- | {Name} | {What it does} | {path/to/} |
38
-
39
- ### Technology Decisions
40
- | Decision | Choice | Rationale |
41
- |----------|--------|-----------|
42
- | {Area} | {Technology} | {Why this choice} |
43
-
44
- ---
45
-
46
- ## 3. Task Breakdown
47
-
48
- | # | Task | Priority | Status | Blocked By | Plan Doc |
49
- |---|------|----------|--------|------------|----------|
50
- | 1 | {Task title} | P{0-4} | {open/in_progress/closed} | {dependencies or -} | {feature-xxx.md or -} |
51
- | 2 | {Task title} | P{0-4} | {status} | Task 1 | {-} |
52
-
53
- ### Dependency Graph
54
- ```
55
- Task 1 ──────────────────────┐
56
-
57
- Task 3 ───▶ Task 2 ───▶ Task 4
58
- ```
11
+ [1-3 sentences: what this epic delivers and why it needs to be broken into multiple feature plans]
59
12
 
60
13
  ---
61
14
 
62
- ## 4. Data Flow
15
+ ## 2. Feature Plans
63
16
 
64
- ### Primary Flow: {Flow Name}
65
- 1. [Step 1]: {description}
66
- 2. [Step 2]: {description}
67
- 3. [Step 3]: {description}
17
+ | # | Feature Plan | Priority | Status | Description |
18
+ |---|-------------|----------|--------|-------------|
19
+ | 1 | [feature-{name}-part1.md](feature-{name}-part1.md) | P{0-4} | open | {Brief description} |
20
+ | 2 | [feature-{name}-part2.md](feature-{name}-part2.md) | P{0-4} | open | {Brief description} |
68
21
 
69
- ### Alternative Flow: {Flow Name} (Optional)
70
- 1. [Step 1]: {description}
71
-
72
- ### Error Handling
73
- - {Error case}: {How it's handled}
22
+ **Status values:** `open` | `in_progress` | `completed`
74
23
 
75
24
  ---
76
25
 
77
- ## 5. API Contracts (Optional)
78
-
79
- > **Note**: Include if epic involves API changes. Keep high-level; details in task plans.
26
+ ## 3. Dependency Graph
80
27
 
81
- ### Endpoints Overview
82
- | Method | Endpoint | Description |
83
- |--------|----------|-------------|
84
- | POST | /api/v1/{resource} | {What it does} |
85
- | GET | /api/v1/{resource}/:id | {What it does} |
86
-
87
- ### Key Data Models
88
28
  ```
89
- {ModelName}:
90
- - field1: type
91
- - field2: type
29
+ Feature 1 ──────────────────┐
30
+
31
+ Feature 3 ───▶ Feature 2 ───▶ Feature 4
92
32
  ```
93
33
 
94
34
  ---
95
35
 
96
- ## 6. Key Decisions & Trade-offs
97
-
98
- | Decision | Options Considered | Choice | Trade-off |
99
- |----------|-------------------|--------|-----------|
100
- | {Decision area} | {Option A, Option B} | {Chosen} | {What we gain/lose} |
101
-
102
- ---
103
-
104
- ## 7. Risks & Mitigations
105
-
106
- | Risk | Impact | Probability | Mitigation |
107
- |------|--------|-------------|------------|
108
- | {Risk description} | High/Medium/Low | High/Medium/Low | {How to mitigate} |
109
-
110
- ---
111
-
112
- ## 8. Dependencies
113
-
114
- ### External
115
- - {External service/API}: {What we need from it}
116
-
117
- ### Internal
118
- - {Internal service/team}: {What we need from it}
119
-
120
- ### Blockers
121
- - [ ] {Blocker that must be resolved before starting}
122
-
123
- ---
124
-
125
- ## 9. Milestones (Optional)
126
-
127
- > **Note**: Focus on task groupings and sequence, not time estimates.
128
-
129
- | Milestone | Tasks | Description |
130
- |-----------|-------|-------------|
131
- | {Milestone 1} | Task 1, Task 2 | {What this milestone delivers} |
132
- | {Milestone 2} | Task 3, Task 4 | {What this milestone delivers} |
133
-
134
- ---
135
-
136
- ## 10. References
36
+ ## 4. Related Documents
137
37
 
138
- - **Requirement Doc**: [req-{name}.md](../requirements/req-{name}.md)
139
- - **Related Epics**: {links to related epic plans}
140
- - **External Docs**: {links to external resources}
38
+ - **Requirement**: [req-{name}.md](../requirements/req-{name}.md)
141
39
 
142
40
  ---
143
41
 
144
42
  ## Changelog
145
43
 
146
- | Date | Author | Change |
147
- |------|--------|--------|
148
- | {YYYY-MM-DD} | {name} | Initial epic plan created |
44
+ | Date | Change |
45
+ |------|--------|
46
+ | {YYYY-MM-DD} | Epic created |
@@ -3,12 +3,18 @@
3
3
  Note: All content in this document must be written in English.
4
4
 
5
5
  ---
6
- epic_plan: {docs/ai/planning/epic-xxx.md or null}
6
+ epic_plan: null
7
+ requirement: null
7
8
  ---
8
9
 
9
- ## 0. Requirements Reference (Optional)
10
+ ## 0. Related Documents (Optional — remove if no linked docs)
10
11
 
11
- - **Requirement Doc**: [req-{feature-name}.md](../requirements/req-{feature-name}.md)
12
+ | Type | Document |
13
+ |------|----------|
14
+ | Requirement | [req-{name}.md](../requirements/req-{name}.md) |
15
+ | Epic | [epic-{name}.md](epic-{name}.md) |
16
+
17
+ > **Note**: Remove this entire section if no requirement or epic is linked. This section is added by `/manage-epic` or `/create-plan` when context is provided.
12
18
 
13
19
  ---
14
20
 
@@ -262,30 +268,75 @@ epic_plan: {docs/ai/planning/epic-xxx.md or null}
262
268
 
263
269
  - [ ] [ACTION] path/to/file — Summary of change
264
270
  ```
265
- Pseudo-code:
266
- - Step 1: describe what will be done
267
- - Step 2: validation or key logic
268
- - Step 3: output or return value
271
+ Function: functionName(param1: type, param2: type) OR Endpoint: METHOD /path
272
+
273
+ Input validation:
274
+ - param1: [validation rules, constraints, format]
275
+ - param2: [validation rules, constraints, format]
276
+
277
+ Logic flow:
278
+ 1. [Step with specific values/thresholds]
279
+ 2. [Branching: if X then Y, else Z]
280
+ 3. [External calls: DB queries, API calls with params]
281
+ 4. [Data transformations with format]
282
+
283
+ Return: { field1: type, field2: type } | Error(code, message)
284
+
285
+ Edge cases:
286
+ - [Scenario] → [Handler/Response]
287
+ - [Error case] → [HTTP status + message OR error handling]
288
+
289
+ Dependencies: [Other functions/modules/APIs called]
269
290
  ```
270
291
 
271
292
  - [ ] [ACTION] path/to/file — Summary of change
272
293
  ```
273
- Pseudo-code:
274
- - ...
294
+ Function: ...
295
+
296
+ Input validation:
297
+ - ...
298
+
299
+ Logic flow:
300
+ 1. ...
301
+
302
+ Return: ...
303
+
304
+ Edge cases:
305
+ - ...
306
+
307
+ Dependencies: ...
275
308
  ```
276
309
 
277
310
  ### Phase 2: [Phase Name]
278
311
 
279
312
  - [ ] [ACTION] path/to/file — Summary of change
280
313
  ```
281
- Pseudo-code:
282
- - ...
314
+ Function: ...
315
+
316
+ Input validation:
317
+ - ...
318
+
319
+ Logic flow:
320
+ 1. ...
321
+
322
+ Return: ...
323
+
324
+ Edge cases:
325
+ - ...
326
+
327
+ Dependencies: ...
283
328
  ```
284
329
 
285
330
  Notes:
286
331
  - ACTION must be one of: ADDED | MODIFIED | DELETED | RENAMED
287
332
  - For MODIFIED files, use sub-bullets for each distinct logic change and include line ranges
288
- - Pseudo-code shows logic structure and key steps, not actual implementation code
333
+ - Pseudo-code format uses structured sections for clarity:
334
+ - **Function/Endpoint**: Signature or route definition
335
+ - **Input validation**: All validation rules, data types, constraints
336
+ - **Logic flow**: Step-by-step with specific values, branches, external calls
337
+ - **Return**: Success response structure + error formats
338
+ - **Edge cases**: Error scenarios with handlers (HTTP status, messages, fallbacks)
339
+ - **Dependencies**: External modules, APIs, database tables
289
340
  - Each phase groups related tasks; phases execute sequentially
290
341
  - Use only one phase for small features (≤ 5 tasks); use multiple phases for larger features
291
342
 
@@ -240,4 +240,5 @@ See: [UI/UX Design Document](agents/uiux-{name}.md)
240
240
 
241
241
  1. [ ] Review this requirement document
242
242
  2. [ ] Address open questions
243
- 3. [ ] Run `/create-plan` to generate implementation plan
243
+ 3. [ ] Run `/create-plan` to generate implementation plan (small feature)
244
+ 4. [ ] Run `/manage-epic` to break into feature plans (large feature)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-init",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "Initialize AI workflow docs & commands into any repo with one command",
5
5
  "bin": {
6
6
  "ai-workflow-init": "./cli.js"
@@ -1,38 +0,0 @@
1
- ---
2
- name: init-chat
3
- description: Initializes chat by loading and aligning to AGENTS.md project rules.
4
- ---
5
-
6
- ## Goal
7
-
8
- Initialize a new chat by loading and aligning to `CLAUDE.md` so the AI agent consistently follows project rules (workflow, tooling, communication, language mirroring) from the first message.
9
-
10
- ## What this command does
11
-
12
- 1. Read `CLAUDE.md` and extract the actionable rules.
13
- 2. Summarize responsibilities and constraints the agent must follow in this session.
14
- 3. Confirm language-mirroring: respond in the user's chat language; default to English if the user's language is unclear or ambiguous.
15
- 4. Acknowledge the 4-phase workflow and TODO discipline for future commands.
16
-
17
- ## Steps
18
-
19
- 1. Open and read `CLAUDE.md` (project root).
20
- 2. Read `docs/ai/project/CODE_CONVENTIONS.md` and `docs/ai/project/PROJECT_STRUCTURE.md` if they exist in the repository.
21
- 3. Produce a short confirmation in the chat including:
22
- - Workflow alignment: Plan → Implement → Test → Review
23
- - Tooling strategy: semantic search first; parallelize independent steps
24
- - Communication: minimal Markdown; status updates; high-signal summaries; mirror user language (default English if unclear)
25
- - Code presentation: code references for existing code; fenced blocks for new code
26
- - TODO policy: create/update todos; keep only one `in_progress`
27
- 4. If any section is missing or unclear, ask a single concise clarification question; otherwise proceed silently in future commands.
28
-
29
- ## Output format (concise)
30
-
31
- - Use the language of the triggering user message (mirror). If ambiguous, use English.
32
- - One short paragraph confirming alignment + a 4–6 bullet checklist of the above items.
33
- - No code unless strictly needed.
34
-
35
- ## Notes
36
-
37
- - This command is idempotent—safe to re-run at the start of any chat.
38
- - It does not modify existing files; it only sets expectations for subsequent commands.
@@ -1,208 +0,0 @@
1
- ---
2
- name: modify-plan
3
- description: Modify plan and code after implementation; support revert or apply new approach.
4
- ---
5
-
6
- ## Goal
7
-
8
- Modify a feature plan after partial/full implementation. Support reverting to a previous git state or applying new requirement changes with both code and documentation sync.
9
-
10
- ## Prerequisites
11
-
12
- - Feature name (kebab-case, e.g., `user-authentication`)
13
- - Planning doc exists: `docs/ai/planning/feature-{name}.md`
14
- - Git repo initialized (for tracking code state)
15
-
16
- ## Workflow Alignment
17
-
18
- - Provide brief status updates (1–3 sentences) before/after important actions.
19
- - Update planning doc when making changes.
20
- - Do NOT auto-commit; user reviews all changes before pushing.
21
-
22
- ## Step 1: Load Current State
23
-
24
- Ask for feature name (must be kebab-case).
25
-
26
- Load and summarize:
27
-
28
- 1. **Planning doc**: Current goal, scope, implementation phases, completion status
29
-
30
- Display summary:
31
-
32
- ```
33
- Feature: user-authentication
34
- Plan: Create user login + registration endpoints
35
-
36
- Implementation Progress:
37
- - Phase 1 (Database): Complete [x]
38
- Files: src/db/schema.ts
39
- - Phase 2 (API Endpoints): In Progress [3/4]
40
- Files: src/api/users.ts, src/api/auth.ts
41
- - Phase 3 (Frontend): Not Started [ ]
42
- Files: src/components/Login.tsx
43
-
44
- Total files touched: 4
45
- ```
46
-
47
- ## Step 2: Scope of Change (Q&A)
48
-
49
- Ask user what's changing:
50
-
51
- **1. Type of modification:**
52
- a) Modify goal/scope (entire plan changes)
53
- b) Modify specific phase(s) (tactical change)
54
- c) Revert to previous approach (git reset)
55
- d) Other (describe)
56
-
57
- **2a. If modifying goal/scope:**
58
-
59
- - What's the new goal/scope?
60
- - How does it impact existing tasks?
61
-
62
- **2b. If modifying specific phase(s):**
63
-
64
- - Which phase(s)? (list by name)
65
- - What requirement/approach is changing?
66
-
67
- **2c. If reverting approach:**
68
-
69
- - Show last 5 commits; ask which to revert to
70
- - Or reset to specific phase (revert all code changes after phase X)?
71
-
72
- ## Step 3: Apply Changes
73
-
74
- ### Option A: Revert to Previous Git State
75
-
76
- If user selects revert:
77
-
78
- 1. **Identify affected files & changes**:
79
-
80
- - Parse planning doc; list all files modified in affected phase(s)
81
- - Show file list that needs reverting:
82
- ```
83
- Files to revert (manual):
84
- - src/api/users.ts (lines 45–120)
85
- - src/db/schema.ts (lines 10–30)
86
- - tests/api.test.ts (delete entire file)
87
- ```
88
-
89
- 2. **Manual revert guidance**:
90
-
91
- - For MODIFIED files: show current state vs. target state (code snippets/line ranges)
92
- - For DELETED files: ask user to delete manually
93
- - Ask: "Ready to manually revert these files?"
94
-
95
- 3. **If user confirms**:
96
-
97
- - User manually reverts files (copy-paste old code back, undo in IDE, etc.)
98
- - Update planning doc:
99
-
100
- - Mark affected phases/tasks `[ ]` (reset to pending)
101
- - Add "Modification History" entry:
102
-
103
- ```
104
- ## Modification History
105
-
106
- ### Revert [Date]: {Reason}
107
- - **Reverted phases**: Phase X, Y
108
- - **Reason**: [user provided]
109
- - **Files manually reverted**: [list]
110
- - **Affected tasks reset**: [ ] Task 1, [ ] Task 2, ...
111
- ```
112
-
113
- 4. **Result**: Docs updated; tasks reset; ready to re-implement with new approach
114
-
115
- ### Option B: Apply New Changes
116
-
117
- If user selects new approach:
118
-
119
- 1. **Update planning doc**:
120
-
121
- - Modify goal/scope section if changed
122
- - Update affected task(s) with new approach
123
- - Update pseudo-code to match new approach
124
- - Add "Modification History" section:
125
-
126
- ```
127
- ## Modification History
128
-
129
- ### Change [Date]: {Title}
130
- - **Previous approach**: [original details]
131
- - **New approach**: [new details]
132
- - **Reason**: [user provided]
133
- - **Affected phases**: Phase X, Y
134
- ```
135
-
136
- 2. **Update implementation phases**:
137
-
138
- - For affected phases:
139
- - Modify pseudo-code to match new approach
140
- - Reset incomplete tasks `[ ]` (if approach changed significantly)
141
- - Keep completed tasks as-is (do not re-implement)
142
- - Update "Implementation Plan" section with new structure (files/logic outline)
143
-
144
- 3. **Show git impact**:
145
- - Highlight files that may need re-editing
146
- - Ask: "Ready to re-implement with new approach?" (yes/no)
147
-
148
- ## Step 4: Confirmation & Audit Trail
149
-
150
- Before finalizing, show:
151
-
152
- 1. **Updated planning doc** snippet (modified sections)
153
- 2. **Git state** (files that will be changed)
154
-
155
- Ask: **"Apply changes and update doc?"** (yes/no)
156
-
157
- If **yes**:
158
-
159
- - Save updated planning doc
160
- - If revert: `git status` shows reverted files (unstaged)
161
- - If new approach: doc updated; code changes staged for review
162
-
163
- If **no**:
164
-
165
- - Rollback changes to doc
166
- - Discard any temporary changes
167
-
168
- ## Step 5: Next Actions
169
-
170
- **After manual revert**:
171
-
172
- - "Docs updated. Affected tasks reset to `[ ]`. Run `/execute-plan` to re-implement Phase X with new approach."
173
-
174
- **After apply new approach**:
175
-
176
- - If only pseudo-code/docs changed (no code revert needed): "Continue current phase with `/execute-plan`."
177
- - If code changes needed (revert old approach + implement new): "Manually update code files first, then run `/execute-plan`."
178
- - "When done, run `/code-review` to validate standards."
179
-
180
- ## Important Notes
181
-
182
- - **Manual revert**: User manually reverts code files (no git reset); AI guides the process
183
- - **Multi-feature safe**: Works when implementing multiple features simultaneously (selective revert possible)
184
- - **Backward compatible**: Works with both phase-based and non-phase-based planning docs
185
- - **Audit trail**: "Modification History" section preserves decision rationale and affected files
186
- - **Idempotent**: Safe to re-run; modification history accumulates
187
- - **Safe defaults**: Asks confirmation before any changes; user always has final say
188
-
189
- ## Example Flow
190
-
191
- ```
192
- User: I want to modify plan
193
- Agent: Load state, show summary
194
-
195
- User: Revert Phase 2 (API Endpoints) - use different auth approach
196
- Agent: Identify affected files (src/api/users.ts, src/api/auth.ts)
197
- Show current state vs. target state (pseudo-code + old implementation)
198
- Ask: Ready to manually revert these files?
199
-
200
- User: Yes, I'll manually revert
201
- Agent: (User manually copies old code back or undoes changes in IDE)
202
- Update planning doc:
203
- - Mark Phase 2 tasks [ ] (reset)
204
- - Add Modification History: Phase 2 reverted, reason: better auth strategy
205
-
206
- Agent: Phase 2 reset. Ready to re-implement with new auth approach?
207
- Run: /execute-plan
208
- ```