ai-flow-dev 2.2.4 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +46 -2
  2. package/dist/cli.js +8 -18
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +1 -1
  5. package/prompts/backend/flow-build-phase-0.md +16 -3
  6. package/prompts/backend/flow-build-phase-10.md +11 -11
  7. package/prompts/backend/flow-build-phase-5.md +1 -1
  8. package/prompts/backend/flow-build-phase-9.md +4 -4
  9. package/prompts/backend/flow-work-feature.md +24 -18
  10. package/prompts/backend/flow-work-fix.md +14 -11
  11. package/prompts/backend/flow-work-refactor.md +20 -14
  12. package/prompts/backend/flow-work-resume.md +11 -9
  13. package/prompts/backend/flow-work.md +311 -27
  14. package/prompts/frontend/flow-build-phase-0.md +16 -3
  15. package/prompts/frontend/flow-build-phase-10.md +3 -3
  16. package/prompts/frontend/flow-build-phase-5.md +1 -1
  17. package/prompts/frontend/flow-build-phase-9.md +1 -1
  18. package/prompts/frontend/flow-work-feature.md +24 -18
  19. package/prompts/frontend/flow-work-fix.md +14 -11
  20. package/prompts/frontend/flow-work-refactor.md +20 -14
  21. package/prompts/frontend/flow-work-resume.md +11 -9
  22. package/prompts/frontend/flow-work.md +311 -27
  23. package/prompts/mobile/flow-build-phase-0.md +16 -3
  24. package/prompts/mobile/flow-build-phase-10.md +2 -2
  25. package/prompts/mobile/flow-build-phase-5.md +1 -1
  26. package/prompts/mobile/flow-build-phase-9.md +1 -1
  27. package/prompts/mobile/flow-work-feature.md +24 -18
  28. package/prompts/mobile/flow-work-fix.md +14 -11
  29. package/prompts/mobile/flow-work-refactor.md +20 -14
  30. package/prompts/mobile/flow-work-resume.md +11 -9
  31. package/prompts/mobile/flow-work.md +311 -27
  32. package/templates/work.template.md +47 -0
@@ -29,36 +29,72 @@ Provide a single, intelligent entry point for all development work (New Features
29
29
 
30
30
  | Input Pattern | Mode | Source / Action |
31
31
  |---------------|------|-----------------|
32
- | `HU-\d{3}-\d{3}` | `USER_STORY` | Load from `docs/user-stories/**/HU-XXX-XXX.md` |
32
+ | `HU-\d{3}-\d{3}` | `USER_STORY` | Load from `planning/user-stories/**/HU-XXX-XXX.md` |
33
33
  | `EP-\d{3}` | `EPIC` | Analyze/List User Stories for Epic `EP-XXX` |
34
34
  | `T\d{3}(-T\d{3})?` | `TASKS` | Target specific task or range (e.g., `T025-T030`) |
35
35
  | `HU-XXX-XXX TXXX-TXXX`| `STORY_TASKS` | Targeted tasks within a specific User Story |
36
- | Matches `docs/roadmap.md` | `ROADMAP_FEATURE`| Extract section from `docs/roadmap.md` (Partial matches allowed) |
36
+ | Matches `planning/roadmap.md` | `ROADMAP_FEATURE`| Extract section from `planning/roadmap.md` (Partial matches allowed) |
37
37
  | "refactor", "move", "extract" | `REFACTOR` | Use `flow-work-refactor.md` |
38
38
  | "fix", "bug", "error", "falla" | `FIX` | Detect complexity (Quick vs Complex) |
39
39
  | "implement", "create", "new" | `FEATURE` | Use `flow-work-feature.md` |
40
- | No arguments | `RESUME` | Search for paused work in `specs/ai-flow/work/` |
40
+ | No arguments | `RESUME` | Search for paused work in `.ai-flow/work/` |
41
41
 
42
42
  **2. Detection Logic Details:**
43
- - **USER_STORY / EPIC**: Load metadata from `docs/user-stories/` or `docs/roadmap.md`.
44
- - **ROADMAP_FEATURE**: Fuzzy search in `docs/roadmap.md` for titles like "User Management" or "Feature 2.2".
43
+ - **USER_STORY / EPIC**: Load metadata from `planning/user-stories/` or `planning/roadmap.md`.
44
+ - **ROADMAP_FEATURE**: Fuzzy search in `planning/roadmap.md` for titles like "User Management" or "Feature 2.2".
45
45
  - **TASK RANGES**: If `T025-T030` is provided, find the parent Story or Feature in current context or roadmap.
46
46
  - **SIMPLE FIX**: Affects 1 file, obvious cause, <10 lines fix. → Use `flow-work-fix.md` (Quick).
47
47
  - **COMPLEX FIX**: Multi-file, architectural, performance/security. → Use `flow-work-fix.md` (Deep).
48
48
 
49
49
  ---
50
- ## Phase 1: Interactive Analysis
50
+ ## Phase 1: Analysis & Refinement
51
51
 
52
52
  **1. Context Loading (Multi-Source):**
53
+
53
54
  **CRITICAL**: Regardless of whether a `USER_STORY` ID or a `ROADMAP_FEATURE` name is provided, you MUST attempt to load context from **BOTH** sources:
54
- - **`docs/roadmap.md`**: To understand high-level scope, epic relationships, and technical dependencies.
55
- - **`docs/user-stories/**/HU-XXX-XXX.md`**: To get granular details (Acceptance Criteria, Gherkin Scenarios, QA cases).
55
+ - **`planning/roadmap.md`**: To understand high-level scope, epic relationships, and technical dependencies.
56
+ - **`planning/user-stories/**/HU-XXX-XXX.md`**: To get granular details (Acceptance Criteria, Gherkin Scenarios, QA cases).
57
+
58
+ **2. Detail Level Detection (if Manual input):**
59
+
60
+ IF input is manual description (not HU/Roadmap):
61
+
62
+ ```python
63
+ detail_level = analyze_description(input)
64
+
65
+ # Criteria for HIGH detail (Feature):
66
+ # - Mentions technology/method (JWT, OAuth, bcrypt, etc.)
67
+ # - Describes flow (registration, login, CRUD, etc.)
68
+ # - Includes technical constraints (hashing, tokens, validation, etc.)
69
+
70
+ # Criteria for HIGH detail (Refactor):
71
+ # - Describes what to extract/move
72
+ # - Mentions destination (file/class)
73
+ # - References pattern to follow
74
+
75
+ # Criteria for HIGH detail (Fix):
76
+ # - Describes symptom (error 500, crash, null pointer, etc.)
77
+ # - Mentions probable cause
78
+ # - Suggests fix approach
79
+ ```
80
+
81
+ **3. Interactive Refinement (Conditional):**
56
82
 
57
- **2. Interactive Questions:**
58
- - IF both sources provide 100% clarity: Skip questions.
59
- - IF there is missing info or ambiguity: Ask 3-5 key questions with **Multiple Choice Options** and **Defaults (marked with ⭐)**.
83
+ **IF detail_level == "HIGH":**
84
+ - Skip refinement questions
85
+ - Proceed directly to Phase 2 (Planning)
86
+ - Show: "✅ Sufficient detail detected. Proceeding with planning..."
60
87
 
61
- **Example Interaction:**
88
+ **IF detail_level == "MEDIUM":**
89
+ - Ask 1-2 targeted questions (only missing items)
90
+ - Use Multiple Choice with defaults (⭐)
91
+
92
+ **IF detail_level == "LOW":**
93
+ - Full refinement flow (3-5 questions)
94
+ - Use Multiple Choice with defaults (⭐)
95
+ - Focus on: approach, scope, constraints, priorities
96
+
97
+ **Example Interaction (LOW detail):**
62
98
  > 📝 I need to clarify some details for this feature:
63
99
  > 1. What authentication provider should we use? [default: A]
64
100
  > A) JWT (Local) ⭐
@@ -68,19 +104,235 @@ Provide a single, intelligent entry point for all development work (New Features
68
104
  > 2. Should we implement audit logs for this? [default: B]
69
105
  > A) Yes
70
106
  > B) No ⭐
107
+ >
108
+ > Your answers (or Enter for defaults): _
109
+
110
+ **4. Refined Objective Generation (if Manual):**
111
+
112
+ After refinement, generate clear objective statement:
113
+ ```
114
+ ✅ Refined Objective:
115
+
116
+ [Clear 1-2 paragraph description of WHAT will be implemented]
117
+
118
+ **Scope**:
119
+ - [List in-scope items]
120
+
121
+ **Out of Scope**:
122
+ - [List out-of-scope items]
123
+
124
+ Is this correct? (Yes/Edit/Cancel): _
125
+ ```
126
+
127
+ **5. Documentation Compliance Check:**
128
+
129
+ Read relevant documentation:
130
+ - `ai-instructions.md` (NEVER/ALWAYS rules)
131
+ - `docs/architecture.md` (patterns, structure)
132
+ - `docs/code-standards.md` (naming, quality)
133
+ - IF auth/security: `specs/security.md`
134
+ - IF database: `docs/data-model.md`
135
+ - IF API: `docs/api.md`
136
+
137
+ Compare refined objective against documentation:
138
+
139
+ **IF deviation detected:**
140
+ ```
141
+ 🚨 POTENTIAL DEVIATION
142
+
143
+ From [document]:
144
+ ❌ NEVER: [rule being violated]
145
+ ✅ ALWAYS: [rule being ignored]
146
+
147
+ Your request: [conflicting part]
148
+
149
+ Options:
150
+ A) Modify request to align with documentation
151
+ B) Proceed with deviation (requires justification)
152
+ C) Cancel
153
+
154
+ Your choice: _
155
+ ```
156
+
157
+ **IF user chooses B (Override):**
158
+ ```
159
+ ⚠️ OVERRIDE CONFIRMATION
160
+
161
+ You are implementing something that deviates from:
162
+ - [list violated documents/rules]
163
+
164
+ Type "I UNDERSTAND THE RISKS" to proceed: _
165
+
166
+ Provide justification: _
167
+ ```
71
168
 
72
169
  ---
73
170
  ## Phase 2: Planning & Documentation
74
171
 
75
- 1. **`spec.md`**: Generate/Update in `specs/ai-flow/work/[task-name]/spec.md`.
76
- - Ask for user approval.
77
- 2. **`plan.md`**: Generate technical approach and task list.
78
- - Assign Feature Number (NNN).
79
- - Story Points estimation (Fibonacci).
80
- - Phase organization.
81
- - Ask for user approval.
82
- 3. **`task.md`**: Generate the checklist of tactical tasks.
83
- 4. **`status.json`**: Initialize/Update metadata (progress, branch, validation state).
172
+ **1. Read Required Documentation (MANDATORY)**
173
+
174
+ Before generating work.md, read relevant documentation:
175
+ - `ai-instructions.md` Extract NEVER/ALWAYS rules
176
+ - `docs/architecture.md` Identify layer, pattern, file structure
177
+ - `docs/code-standards.md` → Extract naming conventions, quality rules
178
+ - IF touching database: `docs/data-model.md`
179
+ - IF auth/security: `specs/security.md`
180
+ - IF creating/modifying API: `docs/api.md`
181
+ - IF tests required: `docs/testing.md`
182
+
183
+ **2. Analyze Existing Codebase (MANDATORY)**
184
+
185
+ Find similar features/patterns in codebase:
186
+ - Identify existing files to use as reference (e.g., ProductService.ts for UserService.ts)
187
+ - Check naming conventions in actual code
188
+ - Verify architectural consistency
189
+ - Look for reusable components/services
190
+
191
+ **3. Generate work.md**
192
+
193
+ Create single consolidated file: `.ai-flow/work/[task-name]/work.md`
194
+
195
+ **Structure** (~30-40 lines):
196
+
197
+ ```markdown
198
+ # [Type]: [Feature Name]
199
+
200
+ ## Context
201
+ **Source**: HU-001-002 | Roadmap 2.3 | Manual [+ DEVIATION if override]
202
+ **SP**: 5 | **Branch**: feature/user-auth | **Deps**: None
203
+
204
+ ## Objective
205
+ [1-2 clear paragraphs describing WHAT will be implemented]
206
+
207
+ ## Documentation Constraints
208
+ **Read**: ai-instructions.md, architecture.md, code-standards.md, [security.md]
209
+
210
+ **Key Rules**:
211
+ - ✅ ALWAYS: [List specific rules that apply]
212
+ - ❌ NEVER: [List specific prohibitions]
213
+ - 📐 Pattern: [Architectural pattern from docs]
214
+ - 📁 Location: [File structure from architecture.md]
215
+
216
+ ## Approach
217
+ **Layer**: [Data | Business Logic | API | UI]
218
+ **Files**: [List files to create/modify]
219
+ **Reference**: [Existing file to follow as pattern]
220
+
221
+ **Phases**:
222
+ 1. [Phase 1 description]
223
+ 2. [Phase 2 description]
224
+ 3. [Phase 3 description]
225
+ 4. [Phase 4 description]
226
+
227
+ ## Tasks
228
+ [SEE TASK GENERATION LOGIC BELOW]
229
+
230
+ ## Validation
231
+ - [ ] All NEVER/ALWAYS rules followed
232
+ - [ ] Tests pass (coverage per docs/testing.md)
233
+ - [ ] No hardcoded secrets
234
+ - [ ] Follows existing patterns
235
+ - [ ] [Add specific validations based on type]
236
+ ```
237
+
238
+ **Task Generation Logic:**
239
+
240
+ **IF source is User Story:**
241
+ ```python
242
+ tasks = read_user_story_tasks()
243
+ if tasks.are_detailed(): # Has: path, constraints, SP, deps
244
+ work_md.tasks = """
245
+ **Source**: planning/user-stories/EP-XXX/HU-XXX-XXX.md
246
+
247
+ Tasks already detailed in User Story (see linked file).
248
+
249
+ **Summary**: [N] tasks, [X] SP total
250
+ - [Brief phase breakdown]
251
+ """
252
+ else:
253
+ work_md.tasks = generate_detailed_tasks()
254
+ ```
255
+
256
+ **IF source is Roadmap:**
257
+ ```python
258
+ feature = read_roadmap_feature()
259
+ if feature.has_detailed_tasks():
260
+ work_md.tasks = """
261
+ **Source**: planning/roadmap.md Feature X.X
262
+
263
+ Tasks already detailed in Roadmap (see linked file).
264
+
265
+ **Summary**: [N] tasks, [X] SP total
266
+ """
267
+ else:
268
+ work_md.tasks = generate_detailed_tasks()
269
+ ```
270
+
271
+ **IF source is Manual OR tasks need expansion:**
272
+
273
+ Generate detailed tasks with this format:
274
+ ```markdown
275
+ ## Tasks
276
+ **Source**: Manual | Roadmap X.X (expanded) | HU-XXX-XXX (expanded)
277
+
278
+ - [ ] T001 [D] Create User entity → src/entities/User.ts • 1 SP
279
+ - Follow Product.ts pattern, hash passwords (bcrypt)
280
+ - [ ] T002 [L] UserService.register() → src/services/ • 2 SP
281
+ - Validate email, hash password, return JWT (deps: T001)
282
+ - [ ] T003 [A] POST /users/register → src/controllers/ • 1 SP
283
+ - Return 201, rate limit, follow api.md (deps: T002)
284
+ - [ ] T004 [T] Unit tests → tests/services/ • 2 SP
285
+ - 80% coverage, edge cases (deps: T002)
286
+ ```
287
+
288
+ **Task Detail Requirements:**
289
+ - Specific file path
290
+ - Pattern/reference to follow
291
+ - Key constraints from docs
292
+ - Dependencies (if applicable)
293
+ - Story Points
294
+
295
+ **4. Generate status.json**
296
+
297
+ Create: `.ai-flow/work/[task-name]/status.json`
298
+
299
+ ```json
300
+ {
301
+ "type": "feature|refactor|fix",
302
+ "source": "HU-001-002|roadmap-2.3|manual",
303
+ "deviation": false,
304
+ "progress": {
305
+ "totalTasks": 4,
306
+ "completedTasks": 0,
307
+ "percentage": 0
308
+ },
309
+ "git": {
310
+ "branchName": "feature/user-auth",
311
+ "commits": []
312
+ },
313
+ "timestamps": {
314
+ "created": "2025-12-22T23:00:00-03:00",
315
+ "lastUpdated": "2025-12-22T23:00:00-03:00"
316
+ },
317
+ "validation": {
318
+ "tests": { "executed": false },
319
+ "lint": { "executed": false }
320
+ }
321
+ }
322
+ ```
323
+
324
+ **5. User Approval**
325
+
326
+ Show work.md for review:
327
+ ```
328
+ 📄 Generated: .ai-flow/work/[task-name]/work.md
329
+
330
+ Review work.md? (Yes/Edit/No): _
331
+ ```
332
+
333
+ - **Yes**: Proceed to Phase 3
334
+ - **Edit**: Allow user to modify work.md, then re-read
335
+ - **No**: Cancel workflow
84
336
 
85
337
  ---
86
338
  ## Phase 3: Execution (Branch Creation)
@@ -94,24 +346,56 @@ Provide a single, intelligent entry point for all development work (New Features
94
346
  2. **Execute**: `git checkout -b [branch-name]`.
95
347
  3. **Update `status.json`**: Record branch name and start timestamp.
96
348
  4. **Implementation**: Proceed according to the selected mode (Auto, Phase-by-phase, Task-by-task).
349
+ - Follow tasks in `work.md`
350
+ - Update task checkboxes as completed
351
+ - Update `status.json` progress
97
352
 
98
353
  ---
99
354
  ## Phase 4: Finalization & Archiving
100
355
 
101
- **When all tasks in `task.md` are complete (✅) and validated:**
356
+ **When all tasks in `work.md` are complete (✅) and validated:**
357
+
358
+ 1. **Update Source Documentation (Automatic - ALWAYS UPDATE BOTH IF BOTH EXIST)**:
359
+
360
+ **Step 1a: Check and Update User Story (if exists)**
361
+ - Look for User Story reference in `status.json` or work context
362
+ - IF User Story `HU-XXX-XXX` exists:
363
+ - Read `planning/user-stories/EP-XXX/HU-XXX-XXX.md`
364
+ - Mark ALL DoD checklist items as complete: `- [ ]` → `- [x]`
365
+ - Add completion timestamp comment: `<!-- Completed: YYYY-MM-DD HH:MM -->`
366
+ - Save file
367
+
368
+ **Step 1b: Check and Update Roadmap (if exists)**
369
+ - Look for Feature reference in `status.json` or work context
370
+ - IF Feature exists in `planning/roadmap.md`:
371
+ - Read `planning/roadmap.md`
372
+ - Find the Feature section by name/number
373
+ - Mark Feature checkbox as complete: `- [ ]` → `- [x]`
374
+ - Save file
375
+
376
+ **Step 1c: Show Completion Summary**
377
+ - IF both updated: "✅ Updated roadmap.md (Feature X.X) AND HU-XXX-XXX.md (Y/Y DoD items)"
378
+ - IF only roadmap: "✅ Updated roadmap.md (Feature X.X)"
379
+ - IF only user story: "✅ Updated HU-XXX-XXX.md (Y/Y DoD items)"
380
+ - IF neither exists: "⚠️ No roadmap or user story found to update"
381
+
382
+ **Error Handling:**
383
+ - If file doesn't exist: Log warning, continue with other file
384
+ - If checkbox not found: Log warning with helpful message, continue
385
+ - Never fail the entire finalization due to documentation update errors
102
386
 
103
- 1. **Sugerir Próximos Pasos**:
387
+ 2. **Sugerir Próximos Pasos**:
104
388
  - **`/flow-check`**: Ejecutar tests y revisión de código combinada.
105
389
  - **`/flow-docs-sync`**: Sincronizar la documentación técnica.
106
390
  - **`/flow-commit`**: Crear commits atómicos.
107
391
 
108
- 2. **Proceso de Archivado (Automático tras aprobación)**:
392
+ 3. **Proceso de Archivado (Automático tras aprobación)**:
109
393
  - Una vez el usuario confirma que el trabajo está listo para ser cerrado:
110
- - **Mover**: `specs/ai-flow/work/[task-name]/` → `specs/ai-flow/archive/YYYY-MM/[task-name]/`.
394
+ - **Mover**: `.ai-flow/work/[task-name]/` → `.ai-flow/archive/YYYY-MM/[task-name]/`.
111
395
  - **Actualizar `status.json`**: Cambiar `status` a `"COMPLETED"` y registrar `timestamps.completed`.
112
396
  - **Cleanup**: Mantener limpia la carpeta `work` para que `/flow-work` detecte solo tareas activas.
113
397
 
114
- 3. **Resumen Final**:
398
+ 4. **Resumen Final**:
115
399
  - Mostrar estadísticas finales de tiempo, archivos y cobertura antes de archivar.
116
400
 
117
401
  ---
@@ -123,7 +407,7 @@ Provide a single, intelligent entry point for all development work (New Features
123
407
  - Detailed Refactor logic → `@flow-work-refactor.md`
124
408
  - Detailed Fix logic → `@flow-work-fix.md`
125
409
  - Resume logic → `@flow-work-resume.md`
126
- - **State Persistence**: Always read/write to `specs/ai-flow/work/[name]/status.json` to maintain state across sessions.
410
+ - **State Persistence**: Always read/write to `.ai-flow/work/[name]/status.json` to maintain state across sessions.
127
411
 
128
412
  ---
129
413
  **BEGIN EXECUTION when user runs `/flow-work [args]`**
@@ -13,9 +13,11 @@ Efficiently analyze existing projects using a **layered, incremental approach**.
13
13
 
14
14
  ## 🚫 Critical Exclusion Rules
15
15
  To avoid false-positive detections, **IGNORE** the following folders and files during all detection steps:
16
- - `.ai-flow/` (contains AI Flow internal cache and prompts)
16
+ - `.ai-flow/work/` (contains active development tasks)
17
+ - `.ai-flow/archive/` (contains completed tasks)
17
18
  - `.agent/` (contains AI workflows)
18
19
  - `docs/` and `specs/` (if they contain AI Flow generated documentation)
20
+ - `planning/` (if it contains AI Flow generated roadmap and user stories)
19
21
  - `project-brief.md`, `ai-instructions.md`, `AGENT.md`
20
22
 
21
23
  **A project is considered "Existing" only if it contains functional source code or framework configuration files OUTSIDE these excluded paths.**
@@ -100,6 +102,12 @@ Use stratified sampling to read only the most relevant files (e.g., core control
100
102
  Show the final "🔍 BACKEND STACK DETECTED" report and ask for confirmation.
101
103
 
102
104
  ### 💾 Cache & Pre-populate
105
+
106
+ **Create directory structure (if not exists):**
107
+ ```bash
108
+ mkdir -p .ai-flow/cache
109
+ ```
110
+
103
111
  1. **Export:** Save results to `.ai-flow/cache/docs-analysis.json`.
104
112
  2. **Pre-populate:** Fill answers for Phases 1-7 based on detected data.
105
113
 
@@ -322,7 +330,7 @@ C) Cancel /flow-build (fix manually first)
322
330
  "reason": "Final documentation complete and up-to-date"
323
331
  },
324
332
  "phase9": {
325
- "file": "docs/roadmap.md",
333
+ "file": "planning/roadmap.md",
326
334
  "exists": false,
327
335
  "consistencyScore": 0,
328
336
  "recommendation": "SKIP",
@@ -330,7 +338,7 @@ C) Cancel /flow-build (fix manually first)
330
338
  "reason": "Project already implemented - roadmap not needed for existing code"
331
339
  },
332
340
  "phase10": {
333
- "file": "docs/user-stories/",
341
+ "file": "planning/user-stories/",
334
342
  "exists": false,
335
343
  "consistencyScore": 0,
336
344
  "recommendation": "SKIP",
@@ -370,6 +378,11 @@ Ask for confirmation to proceed to Phase 1.
370
378
 
371
379
  ### 💾 Cache & Pre-populate
372
380
 
381
+ **Create directory structure (if not exists):**
382
+ ```bash
383
+ mkdir -p .ai-flow/cache .ai-flow/work .ai-flow/archive
384
+ ```
385
+
373
386
  1. **Export code analysis:** `.ai-flow/cache/docs-analysis.json`
374
387
  2. **Export audit data:** `.ai-flow/cache/audit-data.json` (if Layer 4 executed)
375
388
  3. **Pre-populate:** Fill answers for Phases 1-7 based on detected data
@@ -11,13 +11,13 @@ Break down technical roadmap tasks into user-centric Agile requirements (User St
11
11
 
12
12
  // turbo
13
13
  ### Step 10.1: Load Context from Roadmap
14
- Extract context variables and epics from `docs/roadmap.md`.
14
+ Extract context variables and epics from `planning/roadmap.md`.
15
15
 
16
16
  ### Step 10.2: Select Scope
17
17
  Choose: All Epics, Sprint 1, or Specific Epics.
18
18
 
19
19
  ### Step 10.3: Generate User Story Documents
20
- Create `docs/user-stories/EP-XXX/HU-XXX-YYY.md`.
20
+ Create `planning/user-stories/EP-XXX/HU-XXX-YYY.md`.
21
21
 
22
22
  **Frontend specific Acceptance Criteria focus:**
23
23
  - **UX/Interaction:** "When I click X, Y happens with a smooth transition."
@@ -26,7 +26,7 @@ Create `docs/user-stories/EP-XXX/HU-XXX-YYY.md`.
26
26
  - **Validation:** "Show inline error message if field is empty."
27
27
 
28
28
  ### Step 10.4: Generate Test Cases
29
- Create `docs/user-stories/EP-XXX/tests/TC-XXX-YYY.md`.
29
+ Create `planning/user-stories/EP-XXX/tests/TC-XXX-YYY.md`.
30
30
 
31
31
  ---
32
32
  _Version: 4.2 (Antigravity Optimized)_
@@ -275,7 +275,7 @@ src/
275
275
  utils/
276
276
  infrastructure/
277
277
  database/
278
- cache/
278
+ .ai-flow/cache/
279
279
 
280
280
  Your choice: __
281
281
  Why?
@@ -87,7 +87,7 @@ Check for gaps.
87
87
 
88
88
  ---
89
89
 
90
- ### Step 9.6: Generate Document (docs/roadmap.md)
90
+ ### Step 9.6: Generate Document (planning/roadmap.md)
91
91
 
92
92
  ---
93
93
  _Version: 4.2 (Antigravity Optimized)_
@@ -9,33 +9,39 @@ This file contains the detailed execution logic for implementing new features, i
9
9
  ---
10
10
  ## 🚀 Feature Implementation Flow
11
11
 
12
- ### 1. Specification (auto-skip if User Story)
13
- - Extract requirements from User Story or Roadmap.
14
- - If interactive, ask clarification questions (Multiple Choice).
15
- - Save to `specs/ai-flow/work/[feature]/spec.md`.
12
+ ### 1. Context Analysis (auto-skip if User Story with detailed tasks)
13
+ - Extract requirements from User Story or Roadmap
14
+ - If User Story has detailed tasks: Skip to work.md generation
15
+ - If Roadmap or Manual: Analyze and refine
16
+ - Read relevant documentation (ai-instructions.md, architecture.md, etc.)
16
17
 
17
- ### 2. Technical Planning
18
- - Analyze codebase for patterns.
19
- - Generate `plan.md` with Fibonacci estimation.
20
- - Organize tasks into layers (Data, Logic, API, Test, Docs).
21
- - **User Confirmation Required.**
18
+ ### 2. work.md Generation
19
+ - Generate consolidated work.md (see Phase 2 in flow-work.md)
20
+ - Include: Context, Objective, Constraints, Approach, Tasks, Validation
21
+ - **User Confirmation Required**
22
22
 
23
23
  ### 3. Progressive Implementation
24
24
  Choose mode:
25
- - **Auto**: Complete all tasks without pausing.
26
- - **Phase-by-phase**: Pause and validate after each phase.
27
- - **Task-by-task**: Pause after each task.
25
+ - **Auto**: Complete all tasks without pausing
26
+ - **Phase-by-phase**: Pause and validate after each phase
27
+ - **Task-by-task**: Pause after each task
28
+
29
+ Follow tasks in `work.md`:
30
+ - Update checkboxes as completed
31
+ - Update `status.json` progress
32
+ - Follow patterns and constraints specified
28
33
 
29
34
  ### 4. Definition of Done (DoD)
30
- - If HU mode: Validate against Gherkin scenarios.
31
- - Run tests and linting.
32
- - Perform security check.
35
+ - If HU mode: Validate against Gherkin scenarios
36
+ - Run tests and linting
37
+ - Perform security check
38
+ - **Update completion status** in source documents (see Phase 4 Step 1 in flow-work.md)
33
39
 
34
40
  ---
35
41
  ## 🌿 Git Branching Strategy
36
- - Generate slug from name.
37
- - Execute `git checkout -b feature/[slug]`.
38
- - Maintain `status.json` with commit history.
42
+ - Generate slug from name
43
+ - Execute `git checkout -b feature/[slug]`
44
+ - Maintain `status.json` with commit history
39
45
 
40
46
  ---
41
47
  ## 📦 status.json Persistence
@@ -10,23 +10,26 @@ This file contains the detailed execution logic for bug fixes, imported by `@flo
10
10
  ## 🔧 Bug Fix Workflow
11
11
 
12
12
  ### 1. Classification
13
- - **QUICK**: 1 file, obvious cause (typo, null check).
14
- - **COMPLEX**: Multiple files, investigation needed.
13
+ - **QUICK**: 1 file, obvious cause (typo, null check)
14
+ - **COMPLEX**: Multiple files, investigation needed
15
15
 
16
- ### 2. Deep Analysis (Complex Fix)
17
- - Create work directory.
18
- - Document root cause in `analysis.md`.
19
- - Map side effects.
16
+ ### 2. Analysis & work.md Generation
17
+ - **QUICK**: Minimal work.md (objective + 1-2 tasks)
18
+ - **COMPLEX**: Full work.md with root cause analysis
19
+ - Document root cause in Objective section
20
+ - Map side effects in Approach section
21
+ - Generate detailed tasks
20
22
 
21
23
  ### 3. Implementation
22
- - **Test-First Approach**: Add a failing test case that reproduces the bug before fixing it.
23
- - Apply the fix.
24
- - Verify tests pass.
24
+ - **Test-First Approach**: Add failing test that reproduces bug
25
+ - Apply the fix following work.md tasks
26
+ - Verify tests pass
27
+ - **Update completion status** if fix was tracked in roadmap/user stories (see Phase 4 Step 1 in flow-work.md)
25
28
 
26
29
  ---
27
30
  ## 🌿 Git Branching Strategy
28
- - **QUICK**: Usually work on current branch.
29
- - **COMPLEX**: Execute `git checkout -b fix/[slug]`.
31
+ - **QUICK**: Usually work on current branch
32
+ - **COMPLEX**: Execute `git checkout -b fix/[slug]`
30
33
 
31
34
  ---
32
35
  ## 📦 status.json Persistence
@@ -9,23 +9,29 @@ This file contains the detailed execution logic for code refactoring, imported b
9
9
  ---
10
10
  ## 🔄 Refactoring Workflow
11
11
 
12
- ### 1. Scope Identification
13
- - Map affected files and dependencies.
14
- - Confirm no behavior change is expected.
15
- - Validate against architecture patterns.
16
-
17
- ### 2. Implementation Strategy
18
- - Use `plan.md` to map extraction/renaming/moving steps.
19
- - Set "No behavior change" as the primary constraint.
20
-
21
- ### 3. Execution & Safety
22
- - Update imports and references across the codebase.
23
- - **Critical**: Existing tests must pass without modification (unless test itself is refactored).
24
- - Run `/flow-check` to verify no regressions.
12
+ ### 1. Scope Identification & work.md Generation
13
+ - Map affected files and dependencies
14
+ - Confirm no behavior change expected
15
+ - Validate against architecture patterns
16
+ - Generate work.md with:
17
+ - Clear scope (what to extract/move/rename)
18
+ - Affected files list
19
+ - Step-by-step tasks
20
+ - "No behavior change" constraint
21
+
22
+ ### 2. Implementation
23
+ - Follow work.md tasks sequentially
24
+ - Update imports and references across codebase
25
+ - **Critical**: Existing tests must pass without modification (unless test itself is refactored)
26
+
27
+ ### 3. Validation
28
+ - Run `/flow-check` to verify no regressions
29
+ - Confirm all tests pass
30
+ - **Update completion status** if refactor was tracked in roadmap/user stories (see Phase 4 Step 1 in flow-work.md)
25
31
 
26
32
  ---
27
33
  ## 🌿 Git Branching Strategy
28
- - Execute `git checkout -b refactor/[slug]`.
34
+ - Execute `git checkout -b refactor/[slug]`
29
35
 
30
36
  ---
31
37
  ## 📦 status.json Persistence
@@ -10,22 +10,24 @@ This file contains the logic for detecting and resuming paused work items, impor
10
10
  ## ⏸️ Resume Workflow
11
11
 
12
12
  ### 1. Work Detection
13
- - Scan `specs/ai-flow/work/` for any directories.
14
- - Group by type and last updated timestamp.
13
+ - Scan `.ai-flow/work/` for any directories
14
+ - Group by type and last updated timestamp
15
15
 
16
16
  ### 2. Selection Menu
17
- - Show active tasks with percentage and current branch.
18
- - Identify current Git branch and match with work items (⭐⭐ marker).
17
+ - Show active tasks with percentage and current branch
18
+ - Identify current Git branch and match with work items (⭐⭐ marker)
19
19
 
20
20
  ### 3. Context Restoration
21
- - Load `spec.md`, `plan.md`, `task.md`, and `status.json`.
21
+ - Load `work.md` and `status.json`
22
22
  - Verify Git branch:
23
- - If mismatch: Prompt to switch to `git.branchName`.
24
- - Identify the first incomplete task in `task.md`.
23
+ - If mismatch: Prompt to switch to `git.branchName`
24
+ - Identify the first incomplete task in `work.md`
25
+ - Read Documentation Constraints section to refresh context
25
26
 
26
27
  ### 4. Implementation Continuation
27
- - Resume with the previously saved `implementationMode`.
28
- - Continue execution from where it was paused.
28
+ - Resume with the previously saved `implementationMode`
29
+ - Continue execution from where it was paused
30
+ - Follow remaining tasks in `work.md`
29
31
 
30
32
  ---
31
33
  ## 📦 status.json Persistence