ai-flow-dev 2.1.2 → 2.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.
Files changed (96) hide show
  1. package/README.md +28 -40
  2. package/dist/cli.js +69 -47
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +5 -5
  5. package/prompts/backend/flow-build-phase-0.md +96 -84
  6. package/prompts/backend/flow-build-phase-1.md +10 -18
  7. package/prompts/backend/flow-build-phase-10.md +199 -583
  8. package/prompts/backend/flow-build-phase-2.md +152 -86
  9. package/prompts/backend/flow-build-phase-3.md +108 -68
  10. package/prompts/backend/flow-build-phase-4.md +5 -8
  11. package/prompts/backend/flow-build-phase-5.md +39 -12
  12. package/prompts/backend/flow-build-phase-6.md +29 -8
  13. package/prompts/backend/flow-build-phase-7.md +121 -41
  14. package/prompts/backend/flow-build-phase-8.md +28 -65
  15. package/prompts/backend/flow-build-phase-9.md +267 -1298
  16. package/prompts/backend/flow-build.md +881 -957
  17. package/prompts/backend/flow-dev-commit.md +27 -50
  18. package/prompts/backend/flow-dev-feature.md +1929 -2017
  19. package/prompts/backend/flow-dev-fix.md +936 -964
  20. package/prompts/backend/flow-dev-refactor.md +672 -701
  21. package/prompts/backend/flow-dev-review.md +356 -389
  22. package/prompts/backend/flow-dev-work.md +1066 -1118
  23. package/prompts/backend/flow-docs-sync.md +31 -210
  24. package/prompts/frontend/flow-build-phase-0.md +503 -484
  25. package/prompts/frontend/flow-build-phase-1.md +445 -433
  26. package/prompts/frontend/flow-build-phase-2.md +910 -957
  27. package/prompts/frontend/flow-build-phase-3.md +692 -664
  28. package/prompts/frontend/flow-build-phase-4.md +478 -463
  29. package/prompts/frontend/flow-build-phase-5.md +488 -467
  30. package/prompts/frontend/flow-build-phase-6.md +571 -550
  31. package/prompts/frontend/flow-build-phase-7.md +560 -592
  32. package/prompts/frontend/flow-build-phase-8.md +17 -42
  33. package/prompts/frontend/flow-build.md +457 -503
  34. package/prompts/frontend/flow-docs-sync.md +24 -45
  35. package/prompts/mobile/flow-build-phase-0.md +104 -97
  36. package/prompts/mobile/flow-build-phase-1.md +137 -122
  37. package/prompts/mobile/flow-build-phase-2.md +123 -130
  38. package/prompts/mobile/flow-build-phase-3.md +144 -149
  39. package/prompts/mobile/flow-build-phase-4.md +140 -132
  40. package/prompts/mobile/flow-build-phase-5.md +70 -70
  41. package/prompts/mobile/flow-build-phase-6.md +136 -134
  42. package/prompts/mobile/flow-build-phase-7.md +24 -58
  43. package/prompts/mobile/flow-build-phase-8.md +17 -42
  44. package/prompts/mobile/flow-build.md +47 -97
  45. package/prompts/mobile/flow-docs-sync.md +23 -42
  46. package/prompts/shared/mermaid-guidelines.md +106 -0
  47. package/prompts/shared/scope-levels.md +126 -0
  48. package/prompts/shared/story-points.md +65 -0
  49. package/prompts/shared/task-format.md +86 -0
  50. package/templates/AGENT.template.md +194 -15
  51. package/templates/backend/README.template.md +2 -32
  52. package/templates/backend/ai-instructions.template.md +2 -32
  53. package/templates/backend/copilot-instructions.template.md +2 -22
  54. package/templates/backend/docs/api.template.md +89 -20
  55. package/templates/backend/docs/architecture.template.md +165 -53
  56. package/templates/backend/docs/business-flows.template.md +7 -14
  57. package/templates/backend/docs/code-standards.template.md +2 -38
  58. package/templates/backend/docs/contributing.template.md +2 -16
  59. package/templates/backend/docs/data-model.template.md +125 -21
  60. package/templates/backend/docs/operations.template.md +179 -50
  61. package/templates/backend/docs/testing.template.md +2 -42
  62. package/templates/backend/project-brief.template.md +2 -28
  63. package/templates/backend/specs/configuration.template.md +2 -14
  64. package/templates/backend/specs/security.template.md +2 -32
  65. package/templates/frontend/README.template.md +2 -18
  66. package/templates/frontend/ai-instructions.template.md +2 -20
  67. package/templates/frontend/docs/api-integration.template.md +12 -30
  68. package/templates/frontend/docs/components.template.md +2 -28
  69. package/templates/frontend/docs/error-handling.template.md +11 -27
  70. package/templates/frontend/docs/operations.template.md +8 -18
  71. package/templates/frontend/docs/performance.template.md +8 -18
  72. package/templates/frontend/docs/pwa.template.md +8 -18
  73. package/templates/frontend/docs/state-management.template.md +2 -28
  74. package/templates/frontend/docs/styling.template.md +2 -26
  75. package/templates/frontend/docs/testing.template.md +2 -28
  76. package/templates/frontend/project-brief.template.md +2 -16
  77. package/templates/frontend/specs/accessibility.template.md +8 -18
  78. package/templates/frontend/specs/configuration.template.md +2 -24
  79. package/templates/frontend/specs/security.template.md +10 -24
  80. package/templates/fullstack/README.template.md +17 -47
  81. package/templates/fullstack/ai-instructions.template.md +17 -45
  82. package/templates/fullstack/project-brief.template.md +16 -42
  83. package/templates/fullstack/specs/configuration.template.md +16 -42
  84. package/templates/mobile/README.template.md +11 -29
  85. package/templates/mobile/ai-instructions.template.md +11 -27
  86. package/templates/mobile/docs/app-store.template.md +11 -29
  87. package/templates/mobile/docs/architecture.template.md +14 -38
  88. package/templates/mobile/docs/native-features.template.md +16 -44
  89. package/templates/mobile/docs/navigation.template.md +9 -23
  90. package/templates/mobile/docs/offline-strategy.template.md +10 -26
  91. package/templates/mobile/docs/permissions.template.md +9 -23
  92. package/templates/mobile/docs/state-management.template.md +12 -32
  93. package/templates/mobile/docs/testing.template.md +14 -38
  94. package/templates/mobile/project-brief.template.md +12 -30
  95. package/templates/mobile/specs/build-configuration.template.md +10 -26
  96. package/templates/mobile/specs/deployment.template.md +9 -23
@@ -3,28 +3,24 @@
3
3
  **YOU ARE AN EXPERT TECHNICAL ARCHITECT AND DOCUMENTATION SPECIALIST.**
4
4
 
5
5
  Your mission is to detect changes in the codebase and update the project documentation automatically when the user executes `/flow-docs-sync`.
6
-
7
- ---
8
-
6
+ ---
9
7
  ## Command: `/flow-docs-sync`
10
8
 
11
9
  ### Objective
12
10
 
13
- Detect changes in the codebase compared to the last documented state (stored in `.ai-flow/analysis.json`) and update all affected documentation files automatically.
14
-
15
- ---
16
-
11
+ Detect changes in the codebase compared to the last documented state (stored in `.ai-flow/cache/docs-analysis.json`) and update all affected documentation files automatically.
12
+ ---
17
13
  ## Execution Flow
18
14
 
19
15
  ### Step 1: Check for Analysis File
20
16
 
21
17
  ```
22
- First, check if `.ai-flow/analysis.json` exists:
18
+ First, check if `.ai-flow/cache/docs-analysis.json` exists:
23
19
 
24
20
  - ✅ If exists → Proceed to Step 2 (Compare Changes)
25
21
  - ❌ If NOT exists → Execute full Phase 0 analysis first:
26
22
  - Run complete code analysis (as described in Phase 0)
27
- - Create `.ai-flow/analysis.json` with current state
23
+ - Create `.ai-flow/cache/docs-analysis.json` with current state
28
24
  - Then proceed to Step 2
29
25
  ```
30
26
 
@@ -33,7 +29,6 @@ First, check if `.ai-flow/analysis.json` exists:
33
29
  **Reuse Phase 0 Analysis Logic:**
34
30
 
35
31
  1. **Perform Current Code Analysis:**
36
-
37
32
  - Execute the same analysis as Phase 0 (section 0.1):
38
33
  - File structure analysis
39
34
  - AST-based code parsing (endpoints, entities, dependencies)
@@ -42,8 +37,7 @@ First, check if `.ai-flow/analysis.json` exists:
42
37
  - Generate current state snapshot
43
38
 
44
39
  2. **Compare with Previous State:**
45
-
46
- - Load `.ai-flow/analysis.json`
40
+ - Load `.ai-flow/cache/docs-analysis.json`
47
41
  - Compare current state vs previous state
48
42
  - Detect changes in:
49
43
  - **Endpoints:** New, modified, or deleted endpoints
@@ -84,185 +78,32 @@ First, check if `.ai-flow/analysis.json` exists:
84
78
 
85
79
  No se requiere ninguna actualización.
86
80
  ```
87
-
88
- ---
89
-
81
+ ---
90
82
  ## 📊 MERMAID DIAGRAM REGENERATION GUIDELINES
91
83
 
92
- When regenerating or updating diagrams in documentation files, follow these **critical** formatting rules:
84
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../shared/mermaid-guidelines.md) for all Mermaid diagram formatting rules (ER, Architecture, Flow).
93
85
 
94
86
  ### ER Diagrams (data-model.md)
95
87
 
96
- **Diagram Type:** `erDiagram`
97
-
98
- **Requirements:**
99
- 1. Show ALL entities and their relationships
100
- 2. Include field types and constraints (PK, FK, UK)
101
- 3. Add descriptions for complex or business-critical fields
102
- 4. Verify relationship cardinality matches actual database schema
103
- 5. Keep entity order logical (core entities first, then related)
104
-
105
- **Quality Checklist:**
106
- - [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
107
- - [ ] All entities from database are represented
108
- - [ ] All foreign key relationships are shown
109
- - [ ] Primary keys are marked with `PK`
110
- - [ ] Foreign keys are marked with `FK`
111
- - [ ] Many-to-many relationships use junction tables
112
- - [ ] Field types match database schema
113
- - [ ] Diagram renders without errors
114
-
115
- **Example:**
116
- ````markdown
117
- ```mermaid
118
- erDiagram
119
- USER ||--o{ ORDER : places
120
- PRODUCT ||--o{ ORDER_ITEM : contains
121
- ORDER ||--o{ ORDER_ITEM : includes
122
-
123
- USER {
124
- string id PK
125
- string email UK
126
- string name
127
- datetime createdAt
128
- }
129
-
130
- ORDER {
131
- string id PK
132
- string userId FK
133
- decimal total
134
- string status
135
- }
136
-
137
- PRODUCT {
138
- string id PK
139
- string name
140
- decimal price
141
- }
142
-
143
- ORDER_ITEM {
144
- string id PK
145
- string orderId FK
146
- string productId FK
147
- int quantity
148
- }
149
- ```
150
- ````
151
-
152
- ---
153
-
88
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../shared/mermaid-guidelines.md) for ER diagram syntax, relationship notation, and common mistakes.
89
+ ---
154
90
  ### Architecture Diagrams (architecture.md)
155
91
 
156
- **Diagram Type:** `graph TD` (or `graph LR`)
157
-
158
- **Requirements:**
159
- 1. Show ALL major system components (services, databases, caches, queues)
160
- 2. Label connections with protocols/methods (HTTPS, gRPC, REST, etc.)
161
- 3. Use consistent styling (databases as cylinders, services as boxes)
162
- 4. Include external integrations (Email, Payment, SMS services)
163
- 5. Show monitoring and logging components if present
164
- 6. Include deployment context (load balancers, CDN) if relevant
165
-
166
- **Quality Checklist:**
167
- - [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
168
- - [ ] All services/components from codebase are shown
169
- - [ ] Database connections are labeled
170
- - [ ] External APIs are included
171
- - [ ] Authentication/authorization flow is visible
172
- - [ ] Caching layer is shown (if exists)
173
- - [ ] Message queues are included (if exists)
174
- - [ ] Styling is applied for clarity
175
- - [ ] Diagram renders without errors
176
-
177
- **Example:**
178
- ````markdown
179
- ```mermaid
180
- graph TD
181
- Client[Client Application]
182
- API[API Gateway<br/>Express/NestJS]
183
- Auth[Auth Service<br/>JWT]
184
- DB[(PostgreSQL)]
185
- Cache[(Redis)]
186
- Queue[Message Queue<br/>RabbitMQ]
187
-
188
- Client -->|HTTPS| API
189
- API -->|Verify| Auth
190
- API -->|Query| DB
191
- API -->|Cache| Cache
192
- API -->|Enqueue| Queue
193
-
194
- style DB fill:#e1ffe1
195
- style Cache fill:#f0e1ff
196
- ```
197
- ````
198
-
199
- ---
200
-
92
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../shared/mermaid-guidelines.md) for architecture diagram syntax, node shapes, and styling.
93
+ ---
94
+ ---
201
95
  ### Business Flow Diagrams (project-brief.md)
202
96
 
203
- **Diagram Type:** `flowchart TD` (or `flowchart LR`)
204
-
205
- **Requirements:**
206
- 1. Start with `([Start Terminal])`
207
- 2. End with `([End Terminal])`
208
- 3. Use `{Diamond}` for ALL decision points
209
- 4. Label ALL decision branches clearly (`-->|Yes|`, `-->|No|`)
210
- 5. Show complete paths (including error/failure scenarios)
211
- 6. Keep flows readable (avoid crossing arrows when possible)
212
- 7. Use consistent styling for node types
213
-
214
- **Quality Checklist:**
215
- - [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
216
- - [ ] Flow starts with a terminal node
217
- - [ ] Flow ends with terminal node(s)
218
- - [ ] All decision points have labeled branches
219
- - [ ] All paths lead to an end state
220
- - [ ] Error/failure paths are included
221
- - [ ] Node labels are clear and concise
222
- - [ ] Line breaks (`<br/>`) used for readability
223
- - [ ] Styling applied for visual clarity
224
- - [ ] Diagram renders without errors
225
-
226
- **Example:**
227
- ````markdown
228
- ```mermaid
229
- flowchart TD
230
- Start([User Starts Process]) --> Action1[Perform Action]
231
- Action1 --> Decision{Success?}
232
-
233
- Decision -->|Yes| Success[Process Complete]
234
- Decision -->|No| Retry{Retry?}
235
-
236
- Retry -->|Yes| Action1
237
- Retry -->|No| Failed[Process Failed]
238
-
239
- Success --> End1([End: Success])
240
- Failed --> End2([End: Failed])
241
-
242
- style Start fill:#e1f5ff
243
- style End1 fill:#e1ffe1
244
- style End2 fill:#ffe1e1
245
- ```
246
- ````
247
-
248
- ---
249
-
97
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../shared/mermaid-guidelines.md) for business flow syntax, decision points, and styling.
98
+ ---
250
99
  ### Common Formatting Rules (ALL Diagrams)
251
100
 
252
- **CRITICAL - Code Fence Syntax:**
253
- ```
254
- ✅ CORRECT: ```mermaid
255
- ❌ WRONG: ```Mermaid (capital M)
256
- ❌ WRONG: ``` mermaid (extra space)
257
- ❌ WRONG: ``mermaid (missing backtick)
258
- ```
259
-
260
- **Indentation:**
261
- - Start Mermaid syntax at column 0 (no leading spaces/tabs)
262
- - Only indent within Mermaid syntax according to Mermaid rules
101
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../shared/mermaid-guidelines.md) for critical code fence syntax and indentation rules.
102
+ ---
263
103
  - Do NOT indent the entire code block
264
104
 
265
105
  **Validation Steps:**
106
+
266
107
  1. After generating/updating diagram, verify syntax at https://mermaid.live/
267
108
  2. Check that diagram renders in VS Code markdown preview
268
109
  3. Verify all nodes and relationships are present
@@ -270,15 +111,14 @@ flowchart TD
270
111
  5. Test that styling is applied correctly
271
112
 
272
113
  **When Updating Existing Diagrams:**
114
+
273
115
  1. Read the current diagram first
274
116
  2. Identify what needs to be added/removed/modified
275
117
  3. Maintain existing styling and layout patterns
276
118
  4. Add new elements in logical positions
277
119
  5. Preserve comments or notes if present
278
120
  6. Verify the entire diagram still renders after changes
279
-
280
- ---
281
-
121
+ ---
282
122
  ### Step 4: Update Documents (If User Confirms)
283
123
 
284
124
  **If user responds "Y", "Yes", "y", "yes", or similar:**
@@ -286,7 +126,6 @@ flowchart TD
286
126
  1. **For each document that needs updating:**
287
127
 
288
128
  **A) `docs/api.md`** (if endpoints changed):
289
-
290
129
  - Read current `docs/api.md`
291
130
  - Identify new/modified endpoints from analysis
292
131
  - Add new endpoints following existing API conventions
@@ -296,7 +135,6 @@ flowchart TD
296
135
  - Regenerate affected sections only
297
136
 
298
137
  **B) `docs/data-model.md`** (if entities changed):
299
-
300
138
  - Read current `docs/data-model.md`
301
139
  - Update entity definitions with new fields
302
140
  - Update relationships if changed
@@ -304,41 +142,35 @@ flowchart TD
304
142
  - Maintain all existing content that hasn't changed
305
143
 
306
144
  **C) `ai-instructions.md`** (if dependencies changed):
307
-
308
145
  - Read current `ai-instructions.md`
309
146
  - Add new dependencies to appropriate sections
310
147
  - Update version numbers if changed
311
148
  - Maintain all existing rules and patterns
312
149
 
313
150
  **D) `docs/architecture.md`** (if architecture changed):
314
-
315
151
  - Read current `docs/architecture.md`
316
152
  - Update architecture diagram (mermaid) if structure changed
317
153
  - Update module descriptions
318
154
  - Maintain all existing content
319
155
 
320
156
  **E) `specs/configuration.md`** (if env vars changed):
321
-
322
157
  - Read current `specs/configuration.md`
323
158
  - Add new environment variables
324
159
  - Update descriptions if changed
325
160
  - Maintain existing variables
326
161
 
327
162
  **F) `.env.example`** (if env vars changed):
328
-
329
163
  - Read current `.env.example`
330
164
  - Add new environment variables with example values
331
165
  - Maintain existing variables
332
166
 
333
167
  **G) `specs/security.md`** (if security patterns changed):
334
-
335
168
  - Read current `specs/security.md`
336
169
  - Update security policies if authentication/authorization changed
337
170
  - Maintain existing policies
338
171
 
339
- 2. **Update `analysis.json`:**
340
-
341
- - Save current state to `.ai-flow/analysis.json`
172
+ 2. **Update `docs-analysis.json`:**
173
+ - Save current state to `.ai-flow/cache/docs-analysis.json`
342
174
  - Update timestamp
343
175
  - Include all detected changes in metadata
344
176
 
@@ -359,7 +191,7 @@ flowchart TD
359
191
  - Agregada dependencia "@nestjs/swagger"
360
192
  - Actualizada sección de herramientas
361
193
 
362
- ✅ analysis.json actualizado con nuevo estado
194
+ docs-analysis.json actualizado con nuevo estado
363
195
  ```
364
196
 
365
197
  ### Step 5: Handle Cancellation
@@ -369,9 +201,7 @@ flowchart TD
369
201
  ```
370
202
  Actualización cancelada. Ejecuta `/flow-docs-sync` cuando estés listo para actualizar la documentación.
371
203
  ```
372
-
373
- ---
374
-
204
+ ---
375
205
  ## Change Detection Rules
376
206
 
377
207
  ### Endpoints Detection
@@ -450,42 +280,34 @@ Actualización cancelada. Ejecuta `/flow-docs-sync` cuando estés listo para act
450
280
  - Add new variables to configuration spec
451
281
  - Add examples to `.env.example`
452
282
  - Maintain existing variables
453
-
454
- ---
455
-
283
+ ---
456
284
  ## Important Rules
457
285
 
458
286
  1. **Incremental Updates Only:**
459
-
460
287
  - Only modify sections that changed
461
288
  - Preserve all existing content that hasn't changed
462
289
  - Maintain document structure and formatting
463
290
 
464
291
  2. **Follow Existing Patterns:**
465
-
466
292
  - Use same format as existing documentation
467
293
  - Follow conventions established in original build
468
294
  - Maintain consistency with existing docs
469
295
 
470
296
  3. **Update Analysis File:**
471
-
472
- - Always update `.ai-flow/analysis.json` after document updates
297
+ - Always update `.ai-flow/cache/docs-analysis.json` after document updates
473
298
  - Include timestamp and change summary
474
299
  - Save complete current state for next comparison
475
300
 
476
301
  4. **Mermaid Diagrams:**
477
-
478
302
  - Regenerate ER diagrams when entities change
479
303
  - Regenerate architecture diagrams when structure changes
480
304
  - Use mermaid format for all diagrams
481
305
 
482
306
  5. **Error Handling:**
483
307
  - If document doesn't exist, create it following template
484
- - If analysis.json is corrupted, regenerate it
308
+ - If docs-analysis.json is corrupted, regenerate it
485
309
  - If comparison fails, show error and suggest full Phase 0 re-run
486
-
487
- ---
488
-
310
+ ---
489
311
  ## Example Execution
490
312
 
491
313
  ```
@@ -515,13 +337,12 @@ AI:
515
337
  - Agregado campo "avatarUrl" (String, nullable) a entidad User
516
338
  - Actualizado diagrama ER (mermaid) con nuevo campo
517
339
 
518
- ✅ analysis.json actualizado con nuevo estado
340
+ docs-analysis.json actualizado con nuevo estado
519
341
 
520
342
  Documentación sincronizada exitosamente.
521
343
  ```
522
-
523
- ---
524
-
344
+ ---
525
345
  **BEGIN EXECUTION when user runs `/flow-docs-sync`**
526
346
 
527
347
 
348
+