ai-flow-dev 2.7.0 → 2.8.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 (171) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -570
  3. package/package.json +74 -74
  4. package/prompts/backend/flow-build-phase-0.md +535 -535
  5. package/prompts/backend/flow-build-phase-1.md +626 -626
  6. package/prompts/backend/flow-build-phase-10.md +340 -340
  7. package/prompts/backend/flow-build-phase-2.md +573 -573
  8. package/prompts/backend/flow-build-phase-3.md +834 -834
  9. package/prompts/backend/flow-build-phase-4.md +554 -554
  10. package/prompts/backend/flow-build-phase-5.md +703 -703
  11. package/prompts/backend/flow-build-phase-6.md +524 -524
  12. package/prompts/backend/flow-build-phase-7.md +1001 -1001
  13. package/prompts/backend/flow-build-phase-8.md +1407 -1407
  14. package/prompts/backend/flow-build-phase-9.md +477 -477
  15. package/prompts/backend/flow-build.md +137 -137
  16. package/prompts/backend/flow-check-review.md +656 -20
  17. package/prompts/backend/flow-check-test.md +526 -14
  18. package/prompts/backend/flow-check.md +717 -67
  19. package/prompts/backend/flow-commit.md +88 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-finish.md +919 -0
  22. package/prompts/backend/flow-release.md +949 -0
  23. package/prompts/backend/flow-work-feature.md +61 -61
  24. package/prompts/backend/flow-work-fix.md +46 -46
  25. package/prompts/backend/flow-work-refactor.md +48 -48
  26. package/prompts/backend/flow-work-resume.md +34 -34
  27. package/prompts/backend/flow-work.md +1098 -1286
  28. package/prompts/desktop/flow-build-phase-0.md +359 -359
  29. package/prompts/desktop/flow-build-phase-1.md +295 -295
  30. package/prompts/desktop/flow-build-phase-10.md +357 -357
  31. package/prompts/desktop/flow-build-phase-2.md +282 -282
  32. package/prompts/desktop/flow-build-phase-3.md +291 -291
  33. package/prompts/desktop/flow-build-phase-4.md +308 -308
  34. package/prompts/desktop/flow-build-phase-5.md +269 -269
  35. package/prompts/desktop/flow-build-phase-6.md +350 -350
  36. package/prompts/desktop/flow-build-phase-7.md +297 -297
  37. package/prompts/desktop/flow-build-phase-8.md +541 -541
  38. package/prompts/desktop/flow-build-phase-9.md +439 -439
  39. package/prompts/desktop/flow-build.md +156 -156
  40. package/prompts/desktop/flow-check-review.md +656 -20
  41. package/prompts/desktop/flow-check-test.md +526 -14
  42. package/prompts/desktop/flow-check.md +717 -67
  43. package/prompts/desktop/flow-commit.md +88 -119
  44. package/prompts/desktop/flow-docs-sync.md +354 -354
  45. package/prompts/desktop/flow-finish.md +919 -0
  46. package/prompts/desktop/flow-release.md +662 -0
  47. package/prompts/desktop/flow-work-feature.md +61 -61
  48. package/prompts/desktop/flow-work-fix.md +46 -46
  49. package/prompts/desktop/flow-work-refactor.md +48 -48
  50. package/prompts/desktop/flow-work-resume.md +34 -34
  51. package/prompts/desktop/flow-work.md +1202 -1390
  52. package/prompts/frontend/flow-build-phase-0.md +425 -425
  53. package/prompts/frontend/flow-build-phase-1.md +626 -626
  54. package/prompts/frontend/flow-build-phase-10.md +33 -33
  55. package/prompts/frontend/flow-build-phase-2.md +573 -573
  56. package/prompts/frontend/flow-build-phase-3.md +782 -782
  57. package/prompts/frontend/flow-build-phase-4.md +554 -554
  58. package/prompts/frontend/flow-build-phase-5.md +703 -703
  59. package/prompts/frontend/flow-build-phase-6.md +524 -524
  60. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  61. package/prompts/frontend/flow-build-phase-8.md +872 -872
  62. package/prompts/frontend/flow-build-phase-9.md +94 -94
  63. package/prompts/frontend/flow-build.md +137 -137
  64. package/prompts/frontend/flow-check-review.md +656 -20
  65. package/prompts/frontend/flow-check-test.md +526 -14
  66. package/prompts/frontend/flow-check.md +717 -67
  67. package/prompts/frontend/flow-commit.md +88 -119
  68. package/prompts/frontend/flow-docs-sync.md +550 -550
  69. package/prompts/frontend/flow-finish.md +919 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1547 -0
  72. package/prompts/frontend/flow-work-feature.md +61 -61
  73. package/prompts/frontend/flow-work-fix.md +38 -38
  74. package/prompts/frontend/flow-work-refactor.md +48 -48
  75. package/prompts/frontend/flow-work-resume.md +34 -34
  76. package/prompts/frontend/flow-work.md +1595 -1320
  77. package/prompts/mobile/flow-build-phase-0.md +425 -425
  78. package/prompts/mobile/flow-build-phase-1.md +626 -626
  79. package/prompts/mobile/flow-build-phase-10.md +32 -32
  80. package/prompts/mobile/flow-build-phase-2.md +573 -573
  81. package/prompts/mobile/flow-build-phase-3.md +782 -782
  82. package/prompts/mobile/flow-build-phase-4.md +554 -554
  83. package/prompts/mobile/flow-build-phase-5.md +703 -703
  84. package/prompts/mobile/flow-build-phase-6.md +524 -524
  85. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  86. package/prompts/mobile/flow-build-phase-8.md +888 -888
  87. package/prompts/mobile/flow-build-phase-9.md +90 -90
  88. package/prompts/mobile/flow-build.md +135 -135
  89. package/prompts/mobile/flow-check-review.md +656 -20
  90. package/prompts/mobile/flow-check-test.md +526 -14
  91. package/prompts/mobile/flow-check.md +717 -67
  92. package/prompts/mobile/flow-commit.md +88 -119
  93. package/prompts/mobile/flow-docs-sync.md +620 -620
  94. package/prompts/mobile/flow-finish.md +919 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1500 -0
  97. package/prompts/mobile/flow-work-feature.md +61 -61
  98. package/prompts/mobile/flow-work-fix.md +46 -46
  99. package/prompts/mobile/flow-work-refactor.md +48 -48
  100. package/prompts/mobile/flow-work-resume.md +34 -34
  101. package/prompts/mobile/flow-work.md +1605 -1329
  102. package/prompts/shared/mermaid-guidelines.md +102 -102
  103. package/prompts/shared/scope-levels.md +114 -114
  104. package/prompts/shared/smart-skip-preflight.md +214 -214
  105. package/prompts/shared/story-points.md +55 -55
  106. package/prompts/shared/task-format.md +74 -74
  107. package/prompts/shared/task-summary-template.md +277 -277
  108. package/templates/AGENT.template.md +443 -443
  109. package/templates/backend/.clauderules.template +112 -112
  110. package/templates/backend/.cursorrules.template +102 -102
  111. package/templates/backend/README.template.md +2 -2
  112. package/templates/backend/ai-instructions.template.md +2 -2
  113. package/templates/backend/copilot-instructions.template.md +2 -2
  114. package/templates/backend/docs/api.template.md +320 -320
  115. package/templates/backend/docs/business-flows.template.md +97 -97
  116. package/templates/backend/docs/code-standards.template.md +2 -2
  117. package/templates/backend/docs/contributing.template.md +3 -3
  118. package/templates/backend/docs/data-model.template.md +520 -520
  119. package/templates/backend/docs/testing.template.md +2 -2
  120. package/templates/backend/project-brief.template.md +2 -2
  121. package/templates/backend/specs/configuration.template.md +2 -2
  122. package/templates/backend/specs/security.template.md +2 -2
  123. package/templates/desktop/.clauderules.template +112 -112
  124. package/templates/desktop/.cursorrules.template +102 -102
  125. package/templates/desktop/README.template.md +170 -170
  126. package/templates/desktop/ai-instructions.template.md +366 -366
  127. package/templates/desktop/copilot-instructions.template.md +140 -140
  128. package/templates/desktop/docs/docs/api.template.md +320 -320
  129. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  130. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  131. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  132. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  133. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  134. package/templates/desktop/docs/docs/operations.template.md +720 -720
  135. package/templates/desktop/docs/docs/testing.template.md +722 -722
  136. package/templates/desktop/project-brief.template.md +150 -150
  137. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  138. package/templates/desktop/specs/specs/security.template.md +392 -392
  139. package/templates/frontend/README.template.md +2 -2
  140. package/templates/frontend/ai-instructions.template.md +2 -2
  141. package/templates/frontend/docs/api-integration.template.md +362 -362
  142. package/templates/frontend/docs/components.template.md +2 -2
  143. package/templates/frontend/docs/error-handling.template.md +360 -360
  144. package/templates/frontend/docs/operations.template.md +107 -107
  145. package/templates/frontend/docs/performance.template.md +124 -124
  146. package/templates/frontend/docs/pwa.template.md +119 -119
  147. package/templates/frontend/docs/state-management.template.md +2 -2
  148. package/templates/frontend/docs/styling.template.md +2 -2
  149. package/templates/frontend/docs/testing.template.md +2 -2
  150. package/templates/frontend/project-brief.template.md +2 -2
  151. package/templates/frontend/specs/accessibility.template.md +95 -95
  152. package/templates/frontend/specs/configuration.template.md +2 -2
  153. package/templates/frontend/specs/security.template.md +175 -175
  154. package/templates/fullstack/README.template.md +252 -252
  155. package/templates/fullstack/ai-instructions.template.md +444 -444
  156. package/templates/fullstack/project-brief.template.md +157 -157
  157. package/templates/fullstack/specs/configuration.template.md +340 -340
  158. package/templates/mobile/README.template.md +167 -167
  159. package/templates/mobile/ai-instructions.template.md +196 -196
  160. package/templates/mobile/docs/app-store.template.md +135 -135
  161. package/templates/mobile/docs/architecture.template.md +63 -63
  162. package/templates/mobile/docs/native-features.template.md +94 -94
  163. package/templates/mobile/docs/navigation.template.md +59 -59
  164. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  165. package/templates/mobile/docs/permissions.template.md +56 -56
  166. package/templates/mobile/docs/state-management.template.md +85 -85
  167. package/templates/mobile/docs/testing.template.md +109 -109
  168. package/templates/mobile/project-brief.template.md +69 -69
  169. package/templates/mobile/specs/build-configuration.template.md +91 -91
  170. package/templates/mobile/specs/deployment.template.md +92 -92
  171. package/templates/work.template.md +61 -47
@@ -1,354 +1,354 @@
1
- ---
2
- description: Documentation Sync & Update Flow
3
- ---
4
-
5
- # AI Flow - Documentation Update Command
6
-
7
- **YOU ARE AN EXPERT TECHNICAL ARCHITECT AND DOCUMENTATION SPECIALIST.**
8
-
9
- Your mission is to detect changes in the codebase and update the project documentation automatically when the user executes `/flow-docs-sync`.
10
-
11
- **🚀 MODO AGENTE ACTIVADO:** No solicites permiso para ejecutar comandos turbo de análisis (ls, cat, etc.). Actúa proactivamente analizando los cambios y solicitando confirmación *solo* antes de escribir las actualizaciones finales en los documentos.
12
- ---
13
- ## Command: `/flow-docs-sync`
14
-
15
- ### Objective
16
-
17
- 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.
18
- ---
19
- ## Execution Flow
20
-
21
- ### Step 1: Check for Analysis File
22
-
23
- // turbo
24
- ```bash
25
- cat .ai-flow/cache/docs-analysis.json
26
- ```
27
-
28
- - ✅ If exists → Proceed to Step 2 (Compare Changes)
29
- - ❌ If NOT exists → Execute full Phase 0 analysis first:
30
- - Run complete code analysis (Project Discovery)
31
- - Create `.ai-flow/cache/docs-analysis.json` with current state
32
- - Then proceed to Step 2
33
-
34
- ### Step 2: Detect Changes
35
-
36
- **Reuse Phase 0 Analysis Logic:**
37
-
38
- 1. **Perform Current Code Analysis:**
39
- - Execute project-wide discovery using cross-platform commands:
40
- // turbo
41
- ```bash
42
- ls -R . --exclude-standard
43
- ```
44
- - Analyze current state for:
45
- - File structure and major modules
46
- - Interface definitions (API endpoints, CLI commands, RPC methods)
47
- - Data structures (Models, Entities, Schemas)
48
- - Core dependencies and configuration
49
- - Generate current state snapshot
50
-
51
- 2. **Compare with Previous State:**
52
- - Load `.ai-flow/cache/docs-analysis.json`
53
- - Compare current state vs previous state
54
- - Detect changes in:
55
- - **Interfaces:** New, modified, or deleted "entry points" (API, CLI, etc.)
56
- - **Data Forms:** New, modified, or deleted core data structures/entities
57
- - **Dependencies:** Manifest changes (version bumps, new packages)
58
- - **Architecture:** Structural changes (new modules, moved folders)
59
- - **Configuration:** New environment keys or external integrations
60
-
61
- 3. **Generate Change Report:**
62
- - Categorize changes by type
63
- - Map changes to affected documentation files
64
- - Identify critical vs optional updates
65
-
66
- ### Step 3: Present Report and Confirm
67
-
68
- **If changes detected:**
69
-
70
- ```
71
- 📊 CAMBIOS DETECTADOS:
72
-
73
- 🔴 Documentos que requieren actualización:
74
- - docs/api.md (3 nuevas rutas en AuthModule)
75
- - docs/data-model.md (campo "active" agregado a User)
76
- - ai-instructions.md (nueva dependencia "zod")
77
-
78
- ⚠️ Cambios moderados detectados:
79
- - docs/architecture.md (cambio en estructura de carpetas)
80
-
81
- ✅ Sin cambios: docs/testing.md, specs/security.md
82
-
83
- ¿Actualizar todos los documentos detectados? (Y/N)
84
- ```
85
-
86
- **If NO changes detected:**
87
-
88
- ```
89
- ✅ No se detectaron cambios. La documentación está sincronizada con el código actual.
90
-
91
- No se requiere ninguna actualización.
92
- ```
93
- ---
94
- ## 📊 MERMAID DIAGRAM REGENERATION GUIDELINES
95
-
96
- > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for all Mermaid diagram formatting rules (ER, Architecture, Flow).
97
-
98
- ### ER Diagrams (data-model.md)
99
-
100
- > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for ER diagram syntax, relationship notation, and common mistakes.
101
- ---
102
- ### Architecture Diagrams (architecture.md)
103
-
104
- > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for architecture diagram syntax, node shapes, and styling.
105
- ---
106
- ---
107
- ### Business Flow Diagrams (project-brief.md)
108
-
109
- > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for business flow syntax, decision points, and styling.
110
- ---
111
- ### Common Formatting Rules (ALL Diagrams)
112
-
113
- > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for critical code fence syntax and indentation rules.
114
- ---
115
- - Do NOT indent the entire code block
116
-
117
- **Validation Steps:**
118
-
119
- 1. After generating/updating diagram, verify syntax at https://mermaid.live/
120
- 2. Check that diagram renders in VS Code markdown preview
121
- 3. Verify all nodes and relationships are present
122
- 4. Confirm labels are clear and readable
123
- 5. Test that styling is applied correctly
124
-
125
- **When Updating Existing Diagrams:**
126
-
127
- 1. Read the current diagram first
128
- 2. Identify what needs to be added/removed/modified
129
- 3. Maintain existing styling and layout patterns
130
- 4. Add new elements in logical positions
131
- 5. Preserve comments or notes if present
132
- 6. Verify the entire diagram still renders after changes
133
- ---
134
- ### Step 4: Update Documents (If User Confirms)
135
-
136
- **If user responds "Y", "Yes", "y", "yes", or similar:**
137
-
138
- 1. **For each document that needs updating:**
139
-
140
- **A) `docs/api.md`** (if endpoints changed):
141
- - Read current `docs/api.md`
142
- - Identify new/modified endpoints from analysis
143
- - Add new endpoints following existing API conventions
144
- - Update modified endpoints
145
- - Remove deleted endpoints (if any)
146
- - Maintain all existing content that hasn't changed
147
- - Regenerate affected sections only
148
-
149
- **B) `docs/data-model.md`** (if entities changed):
150
- - Read current `docs/data-model.md`
151
- - Update entity definitions with new fields
152
- - Update relationships if changed
153
- - Regenerate ER diagram (mermaid) with new relationships
154
- - Maintain all existing content that hasn't changed
155
-
156
- **C) `ai-instructions.md`** (if dependencies changed):
157
- - Read current `ai-instructions.md`
158
- - Add new dependencies to appropriate sections
159
- - Update version numbers if changed
160
- - Maintain all existing rules and patterns
161
-
162
- **D) `docs/architecture.md`** (if architecture changed):
163
- - Read current `docs/architecture.md`
164
- - Update architecture diagram (mermaid) if structure changed
165
- - Update module descriptions
166
- - Maintain all existing content
167
-
168
- **E) `specs/configuration.md`** (if env vars changed):
169
- - Read current `specs/configuration.md`
170
- - Add new environment variables
171
- - Update descriptions if changed
172
- - Maintain existing variables
173
-
174
- **F) `.env.example`** (if env vars changed):
175
- - Read current `.env.example`
176
- - Add new environment variables with example values
177
- - Maintain existing variables
178
-
179
- **G) `specs/security.md`** (if security patterns changed):
180
- - Read current `specs/security.md`
181
- - Update security policies if authentication/authorization changed
182
- - Maintain existing policies
183
-
184
- 2. **Update `docs-analysis.json`:**
185
- - Save current state to `.ai-flow/cache/docs-analysis.json`
186
- - Update timestamp
187
- - Include all detected changes in metadata
188
-
189
- 3. **Present Summary:**
190
-
191
- ```
192
- ✅ DOCUMENTACIÓN ACTUALIZADA:
193
-
194
- 📝 docs/api.md
195
- - Agregados 3 nuevos puntos de entrada (AuthModule)
196
- - Actualizada sección de seguridad
197
-
198
- 📝 docs/data-model.md
199
- - Agregado campo "active" a estructura User
200
- - Actualizado diagrama ER (mermaid)
201
-
202
- 📝 ai-instructions.md
203
- - Agregada dependencia "zod"
204
- - Actualizada sección de herramientas
205
-
206
- ✅ docs-analysis.json actualizado con nuevo estado
207
- ```
208
-
209
- ### Step 5: Handle Cancellation
210
-
211
- **If user responds "N", "No", "n", "no", or similar:**
212
-
213
- ```
214
- Actualización cancelada. Ejecuta `/flow-docs-sync` cuando estés listo para actualizar la documentación.
215
- ```
216
- ---
217
- ## Change Detection Rules
218
-
219
- ### Interface Detection (Agnostic)
220
-
221
- **What triggers document update (e.g., `docs/api.md`, `README.md`):**
222
-
223
- - New interface markers (e.g., Decorators like `@Get`, Route definitions like `app.get`, or exported public functions)
224
- - Modified interface paths, methods, or naming
225
- - Deleted interfaces
226
-
227
- **How to update:**
228
-
229
- - Add new interfaces following the established patterns in the project
230
- - Use consistent formatting for parameters, responses, and security
231
- - Maintain existing documentation for unchanged segments
232
-
233
- ### Data Structure Detection (Agnostic)
234
-
235
- **What triggers document update (e.g., `docs/data-model.md`):**
236
-
237
- - New schema definitions (e.g., `class User`, `struct User`, `type User`)
238
- - New ORM/ODM mappings (e.g., Prisma models, SQL tables, NoSQL schemas)
239
- - Field changes (additions, deletions, type modifications)
240
- - Relationship changes (Associations, Foreign Keys, Embedded docs)
241
-
242
- **How to update:**
243
-
244
- - Update data structure catalog with new definitions
245
- - Refresh ER diagrams (Mermaid) to reflect new relationships
246
- - Preserve documentation for unchanged structures
247
-
248
- ### Dependencies Detection (Agnostic)
249
-
250
- **What triggers update (e.g., `ai-instructions.md`, `package.json`):**
251
-
252
- - Changes in dependency manifests (package.json, requirements.txt, go.mod, pom.xml, etc.)
253
- - Significant version updates (+Major or +Minor depending on project)
254
- - Changes in build systems or package managers
255
-
256
- **How to update:**
257
-
258
- - Update the tech stack or libraries section
259
- - Link to new requirements if necessary
260
- - Maintain information about stable core dependencies
261
-
262
- ### Architecture Detection
263
-
264
- **What triggers `docs/architecture.md` update:**
265
-
266
- - New modules or directories
267
- - Changed directory structure
268
- - New architectural patterns detected
269
-
270
- **How to update:**
271
-
272
- - Update architecture diagram (mermaid)
273
- - Add new modules to description
274
- - Maintain existing architecture description
275
-
276
- ### Configuration Detection
277
-
278
- **What triggers `specs/configuration.md` and `.env.example` update:**
279
-
280
- - New environment variables in code
281
- - New external service integrations
282
- - Changed configuration patterns
283
-
284
- **How to update:**
285
-
286
- - Add new variables to configuration spec
287
- - Add examples to `.env.example`
288
- - Maintain existing variables
289
- ---
290
- ## Important Rules
291
-
292
- 1. **Incremental Updates Only:**
293
- - Only modify sections that changed
294
- - Preserve all existing content that hasn't changed
295
- - Maintain document structure and formatting
296
-
297
- 2. **Follow Existing Patterns:**
298
- - Use same format as existing documentation
299
- - Follow conventions established in original build
300
- - Maintain consistency with existing docs
301
-
302
- 3. **Update Analysis File:**
303
- - Always update `.ai-flow/cache/docs-analysis.json` after document updates
304
- - Include timestamp and change summary
305
- - Save complete current state for next comparison
306
-
307
- 4. **Mermaid Diagrams:**
308
- - Regenerate ER diagrams when entities change
309
- - Regenerate architecture diagrams when structure changes
310
- - Use mermaid format for all diagrams
311
-
312
- 5. **Error Handling:**
313
- - If document doesn't exist, create it following template
314
- - If docs-analysis.json is corrupted, regenerate it
315
- - If comparison fails, show error and suggest full Phase 0 re-run
316
- ---
317
- ## Example Execution
318
-
319
- ```
320
- User: /flow-docs-sync
321
-
322
- AI:
323
- 📊 CAMBIOS DETECTADOS:
324
-
325
- 🔴 Documentos que requieren actualización:
326
- - docs/api.md (2 nuevos endpoints: POST /users/:id/avatar, DELETE /users/:id/avatar)
327
- - docs/data-model.md (nuevo campo "avatarUrl" en User)
328
-
329
- ✅ Sin cambios: docs/testing.md, specs/security.md, ai-instructions.md
330
-
331
- ¿Actualizar todos los documentos detectados? (Y/N)
332
-
333
- User: Y
334
-
335
- AI:
336
- ✅ DOCUMENTACIÓN ACTUALIZADA:
337
-
338
- 📝 docs/api.md
339
- - Agregados 2 nuevos puntos de entrada (Update/Delete Profile)
340
- - Mantenida toda la documentación existente
341
-
342
- 📝 docs/data-model.md
343
- - Agregado campo "display_name" (String, nullable) a estructura User
344
- - Actualizado diagrama ER (mermaid) con nuevo campo
345
-
346
- ✅ docs-analysis.json actualizado con nuevo estado
347
-
348
- Documentación sincronizada exitosamente.
349
- ```
350
- ---
351
- **BEGIN EXECUTION when user runs `/flow-docs-sync`**
352
-
353
-
354
-
1
+ ---
2
+ description: Documentation Sync & Update Flow
3
+ ---
4
+
5
+ # AI Flow - Documentation Update Command
6
+
7
+ **YOU ARE AN EXPERT TECHNICAL ARCHITECT AND DOCUMENTATION SPECIALIST.**
8
+
9
+ Your mission is to detect changes in the codebase and update the project documentation automatically when the user executes `/flow-docs-sync`.
10
+
11
+ **🚀 MODO AGENTE ACTIVADO:** No solicites permiso para ejecutar comandos turbo de análisis (ls, cat, etc.). Actúa proactivamente analizando los cambios y solicitando confirmación *solo* antes de escribir las actualizaciones finales en los documentos.
12
+ ---
13
+ ## Command: `/flow-docs-sync`
14
+
15
+ ### Objective
16
+
17
+ 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.
18
+ ---
19
+ ## Execution Flow
20
+
21
+ ### Step 1: Check for Analysis File
22
+
23
+ // turbo
24
+ ```bash
25
+ cat .ai-flow/cache/docs-analysis.json
26
+ ```
27
+
28
+ - ✅ If exists → Proceed to Step 2 (Compare Changes)
29
+ - ❌ If NOT exists → Execute full Phase 0 analysis first:
30
+ - Run complete code analysis (Project Discovery)
31
+ - Create `.ai-flow/cache/docs-analysis.json` with current state
32
+ - Then proceed to Step 2
33
+
34
+ ### Step 2: Detect Changes
35
+
36
+ **Reuse Phase 0 Analysis Logic:**
37
+
38
+ 1. **Perform Current Code Analysis:**
39
+ - Execute project-wide discovery using cross-platform commands:
40
+ // turbo
41
+ ```bash
42
+ ls -R . --exclude-standard
43
+ ```
44
+ - Analyze current state for:
45
+ - File structure and major modules
46
+ - Interface definitions (API endpoints, CLI commands, RPC methods)
47
+ - Data structures (Models, Entities, Schemas)
48
+ - Core dependencies and configuration
49
+ - Generate current state snapshot
50
+
51
+ 2. **Compare with Previous State:**
52
+ - Load `.ai-flow/cache/docs-analysis.json`
53
+ - Compare current state vs previous state
54
+ - Detect changes in:
55
+ - **Interfaces:** New, modified, or deleted "entry points" (API, CLI, etc.)
56
+ - **Data Forms:** New, modified, or deleted core data structures/entities
57
+ - **Dependencies:** Manifest changes (version bumps, new packages)
58
+ - **Architecture:** Structural changes (new modules, moved folders)
59
+ - **Configuration:** New environment keys or external integrations
60
+
61
+ 3. **Generate Change Report:**
62
+ - Categorize changes by type
63
+ - Map changes to affected documentation files
64
+ - Identify critical vs optional updates
65
+
66
+ ### Step 3: Present Report and Confirm
67
+
68
+ **If changes detected:**
69
+
70
+ ```
71
+ 📊 CAMBIOS DETECTADOS:
72
+
73
+ 🔴 Documentos que requieren actualización:
74
+ - docs/api.md (3 nuevas rutas en AuthModule)
75
+ - docs/data-model.md (campo "active" agregado a User)
76
+ - ai-instructions.md (nueva dependencia "zod")
77
+
78
+ ⚠️ Cambios moderados detectados:
79
+ - docs/architecture.md (cambio en estructura de carpetas)
80
+
81
+ ✅ Sin cambios: docs/testing.md, specs/security.md
82
+
83
+ ¿Actualizar todos los documentos detectados? (Y/N)
84
+ ```
85
+
86
+ **If NO changes detected:**
87
+
88
+ ```
89
+ ✅ No se detectaron cambios. La documentación está sincronizada con el código actual.
90
+
91
+ No se requiere ninguna actualización.
92
+ ```
93
+ ---
94
+ ## 📊 MERMAID DIAGRAM REGENERATION GUIDELINES
95
+
96
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for all Mermaid diagram formatting rules (ER, Architecture, Flow).
97
+
98
+ ### ER Diagrams (data-model.md)
99
+
100
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for ER diagram syntax, relationship notation, and common mistakes.
101
+ ---
102
+ ### Architecture Diagrams (architecture.md)
103
+
104
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for architecture diagram syntax, node shapes, and styling.
105
+ ---
106
+ ---
107
+ ### Business Flow Diagrams (project-brief.md)
108
+
109
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for business flow syntax, decision points, and styling.
110
+ ---
111
+ ### Common Formatting Rules (ALL Diagrams)
112
+
113
+ > 📎 **Reference:** See [prompts/shared/mermaid-guidelines.md](../../.ai-flow/prompts/shared/mermaid-guidelines.md) for critical code fence syntax and indentation rules.
114
+ ---
115
+ - Do NOT indent the entire code block
116
+
117
+ **Validation Steps:**
118
+
119
+ 1. After generating/updating diagram, verify syntax at https://mermaid.live/
120
+ 2. Check that diagram renders in VS Code markdown preview
121
+ 3. Verify all nodes and relationships are present
122
+ 4. Confirm labels are clear and readable
123
+ 5. Test that styling is applied correctly
124
+
125
+ **When Updating Existing Diagrams:**
126
+
127
+ 1. Read the current diagram first
128
+ 2. Identify what needs to be added/removed/modified
129
+ 3. Maintain existing styling and layout patterns
130
+ 4. Add new elements in logical positions
131
+ 5. Preserve comments or notes if present
132
+ 6. Verify the entire diagram still renders after changes
133
+ ---
134
+ ### Step 4: Update Documents (If User Confirms)
135
+
136
+ **If user responds "Y", "Yes", "y", "yes", or similar:**
137
+
138
+ 1. **For each document that needs updating:**
139
+
140
+ **A) `docs/api.md`** (if endpoints changed):
141
+ - Read current `docs/api.md`
142
+ - Identify new/modified endpoints from analysis
143
+ - Add new endpoints following existing API conventions
144
+ - Update modified endpoints
145
+ - Remove deleted endpoints (if any)
146
+ - Maintain all existing content that hasn't changed
147
+ - Regenerate affected sections only
148
+
149
+ **B) `docs/data-model.md`** (if entities changed):
150
+ - Read current `docs/data-model.md`
151
+ - Update entity definitions with new fields
152
+ - Update relationships if changed
153
+ - Regenerate ER diagram (mermaid) with new relationships
154
+ - Maintain all existing content that hasn't changed
155
+
156
+ **C) `ai-instructions.md`** (if dependencies changed):
157
+ - Read current `ai-instructions.md`
158
+ - Add new dependencies to appropriate sections
159
+ - Update version numbers if changed
160
+ - Maintain all existing rules and patterns
161
+
162
+ **D) `docs/architecture.md`** (if architecture changed):
163
+ - Read current `docs/architecture.md`
164
+ - Update architecture diagram (mermaid) if structure changed
165
+ - Update module descriptions
166
+ - Maintain all existing content
167
+
168
+ **E) `specs/configuration.md`** (if env vars changed):
169
+ - Read current `specs/configuration.md`
170
+ - Add new environment variables
171
+ - Update descriptions if changed
172
+ - Maintain existing variables
173
+
174
+ **F) `.env.example`** (if env vars changed):
175
+ - Read current `.env.example`
176
+ - Add new environment variables with example values
177
+ - Maintain existing variables
178
+
179
+ **G) `specs/security.md`** (if security patterns changed):
180
+ - Read current `specs/security.md`
181
+ - Update security policies if authentication/authorization changed
182
+ - Maintain existing policies
183
+
184
+ 2. **Update `docs-analysis.json`:**
185
+ - Save current state to `.ai-flow/cache/docs-analysis.json`
186
+ - Update timestamp
187
+ - Include all detected changes in metadata
188
+
189
+ 3. **Present Summary:**
190
+
191
+ ```
192
+ ✅ DOCUMENTACIÓN ACTUALIZADA:
193
+
194
+ 📝 docs/api.md
195
+ - Agregados 3 nuevos puntos de entrada (AuthModule)
196
+ - Actualizada sección de seguridad
197
+
198
+ 📝 docs/data-model.md
199
+ - Agregado campo "active" a estructura User
200
+ - Actualizado diagrama ER (mermaid)
201
+
202
+ 📝 ai-instructions.md
203
+ - Agregada dependencia "zod"
204
+ - Actualizada sección de herramientas
205
+
206
+ ✅ docs-analysis.json actualizado con nuevo estado
207
+ ```
208
+
209
+ ### Step 5: Handle Cancellation
210
+
211
+ **If user responds "N", "No", "n", "no", or similar:**
212
+
213
+ ```
214
+ Actualización cancelada. Ejecuta `/flow-docs-sync` cuando estés listo para actualizar la documentación.
215
+ ```
216
+ ---
217
+ ## Change Detection Rules
218
+
219
+ ### Interface Detection (Agnostic)
220
+
221
+ **What triggers document update (e.g., `docs/api.md`, `README.md`):**
222
+
223
+ - New interface markers (e.g., Decorators like `@Get`, Route definitions like `app.get`, or exported public functions)
224
+ - Modified interface paths, methods, or naming
225
+ - Deleted interfaces
226
+
227
+ **How to update:**
228
+
229
+ - Add new interfaces following the established patterns in the project
230
+ - Use consistent formatting for parameters, responses, and security
231
+ - Maintain existing documentation for unchanged segments
232
+
233
+ ### Data Structure Detection (Agnostic)
234
+
235
+ **What triggers document update (e.g., `docs/data-model.md`):**
236
+
237
+ - New schema definitions (e.g., `class User`, `struct User`, `type User`)
238
+ - New ORM/ODM mappings (e.g., Prisma models, SQL tables, NoSQL schemas)
239
+ - Field changes (additions, deletions, type modifications)
240
+ - Relationship changes (Associations, Foreign Keys, Embedded docs)
241
+
242
+ **How to update:**
243
+
244
+ - Update data structure catalog with new definitions
245
+ - Refresh ER diagrams (Mermaid) to reflect new relationships
246
+ - Preserve documentation for unchanged structures
247
+
248
+ ### Dependencies Detection (Agnostic)
249
+
250
+ **What triggers update (e.g., `ai-instructions.md`, `package.json`):**
251
+
252
+ - Changes in dependency manifests (package.json, requirements.txt, go.mod, pom.xml, etc.)
253
+ - Significant version updates (+Major or +Minor depending on project)
254
+ - Changes in build systems or package managers
255
+
256
+ **How to update:**
257
+
258
+ - Update the tech stack or libraries section
259
+ - Link to new requirements if necessary
260
+ - Maintain information about stable core dependencies
261
+
262
+ ### Architecture Detection
263
+
264
+ **What triggers `docs/architecture.md` update:**
265
+
266
+ - New modules or directories
267
+ - Changed directory structure
268
+ - New architectural patterns detected
269
+
270
+ **How to update:**
271
+
272
+ - Update architecture diagram (mermaid)
273
+ - Add new modules to description
274
+ - Maintain existing architecture description
275
+
276
+ ### Configuration Detection
277
+
278
+ **What triggers `specs/configuration.md` and `.env.example` update:**
279
+
280
+ - New environment variables in code
281
+ - New external service integrations
282
+ - Changed configuration patterns
283
+
284
+ **How to update:**
285
+
286
+ - Add new variables to configuration spec
287
+ - Add examples to `.env.example`
288
+ - Maintain existing variables
289
+ ---
290
+ ## Important Rules
291
+
292
+ 1. **Incremental Updates Only:**
293
+ - Only modify sections that changed
294
+ - Preserve all existing content that hasn't changed
295
+ - Maintain document structure and formatting
296
+
297
+ 2. **Follow Existing Patterns:**
298
+ - Use same format as existing documentation
299
+ - Follow conventions established in original build
300
+ - Maintain consistency with existing docs
301
+
302
+ 3. **Update Analysis File:**
303
+ - Always update `.ai-flow/cache/docs-analysis.json` after document updates
304
+ - Include timestamp and change summary
305
+ - Save complete current state for next comparison
306
+
307
+ 4. **Mermaid Diagrams:**
308
+ - Regenerate ER diagrams when entities change
309
+ - Regenerate architecture diagrams when structure changes
310
+ - Use mermaid format for all diagrams
311
+
312
+ 5. **Error Handling:**
313
+ - If document doesn't exist, create it following template
314
+ - If docs-analysis.json is corrupted, regenerate it
315
+ - If comparison fails, show error and suggest full Phase 0 re-run
316
+ ---
317
+ ## Example Execution
318
+
319
+ ```
320
+ User: /flow-docs-sync
321
+
322
+ AI:
323
+ 📊 CAMBIOS DETECTADOS:
324
+
325
+ 🔴 Documentos que requieren actualización:
326
+ - docs/api.md (2 nuevos endpoints: POST /users/:id/avatar, DELETE /users/:id/avatar)
327
+ - docs/data-model.md (nuevo campo "avatarUrl" en User)
328
+
329
+ ✅ Sin cambios: docs/testing.md, specs/security.md, ai-instructions.md
330
+
331
+ ¿Actualizar todos los documentos detectados? (Y/N)
332
+
333
+ User: Y
334
+
335
+ AI:
336
+ ✅ DOCUMENTACIÓN ACTUALIZADA:
337
+
338
+ 📝 docs/api.md
339
+ - Agregados 2 nuevos puntos de entrada (Update/Delete Profile)
340
+ - Mantenida toda la documentación existente
341
+
342
+ 📝 docs/data-model.md
343
+ - Agregado campo "display_name" (String, nullable) a estructura User
344
+ - Actualizado diagrama ER (mermaid) con nuevo campo
345
+
346
+ ✅ docs-analysis.json actualizado con nuevo estado
347
+
348
+ Documentación sincronizada exitosamente.
349
+ ```
350
+ ---
351
+ **BEGIN EXECUTION when user runs `/flow-docs-sync`**
352
+
353
+
354
+