ai-flow-dev 1.0.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.
- package/LICENSE +21 -0
- package/README.md +408 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +791 -0
- package/dist/cli.js.map +1 -0
- package/dist/fs-utils.d.ts +2 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/fs-utils.js +46 -0
- package/dist/fs-utils.js.map +1 -0
- package/package.json +71 -0
- package/prompts/backend/flow-dev-feature.md +1318 -0
- package/prompts/backend/flow-dev-fix.md +903 -0
- package/prompts/backend/flow-dev-refactor.md +715 -0
- package/prompts/backend/flow-dev-review.md +401 -0
- package/prompts/backend/flow-dev-work.md +1129 -0
- package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
- package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
- package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
- package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
- package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
- package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
- package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
- package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
- package/prompts/backend/flow-docs-gen.md +820 -0
- package/prompts/backend/flow-docs-sync.md +526 -0
- package/prompts/backend/flow-project-init.md +248 -0
- package/prompts/backend/flow-project-roadmap.md +1159 -0
- package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
- package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
- package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
- package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
- package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
- package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
- package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
- package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
- package/prompts/frontend/flow-docs-gen.md +413 -0
- package/prompts/frontend/flow-docs-sync.md +561 -0
- package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
- package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
- package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
- package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
- package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
- package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
- package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
- package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
- package/prompts/mobile/flow-docs-gen.md +430 -0
- package/prompts/mobile/flow-docs-sync.md +634 -0
- package/templates/backend/.clauderules.template +111 -0
- package/templates/backend/.cursorrules.template +102 -0
- package/templates/backend/.env.example.template +122 -0
- package/templates/backend/README.template.md +200 -0
- package/templates/backend/ai-instructions.template.md +354 -0
- package/templates/backend/copilot-instructions.template.md +160 -0
- package/templates/backend/docs/api.template.md +251 -0
- package/templates/backend/docs/architecture.template.md +612 -0
- package/templates/backend/docs/business-flows.template.md +109 -0
- package/templates/backend/docs/code-standards.template.md +828 -0
- package/templates/backend/docs/contributing.template.md +163 -0
- package/templates/backend/docs/data-model.template.md +416 -0
- package/templates/backend/docs/operations.template.md +591 -0
- package/templates/backend/docs/testing.template.md +762 -0
- package/templates/backend/project-brief.template.md +176 -0
- package/templates/backend/specs/configuration.template.md +133 -0
- package/templates/backend/specs/security.template.md +422 -0
- package/templates/frontend/README.template.md +121 -0
- package/templates/frontend/ai-instructions.template.md +368 -0
- package/templates/frontend/docs/api-integration.template.md +390 -0
- package/templates/frontend/docs/components.template.md +567 -0
- package/templates/frontend/docs/error-handling.template.md +385 -0
- package/templates/frontend/docs/operations.template.md +123 -0
- package/templates/frontend/docs/performance.template.md +140 -0
- package/templates/frontend/docs/pwa.template.md +135 -0
- package/templates/frontend/docs/state-management.template.md +394 -0
- package/templates/frontend/docs/styling.template.md +779 -0
- package/templates/frontend/docs/testing.template.md +736 -0
- package/templates/frontend/project-brief.template.md +55 -0
- package/templates/frontend/specs/accessibility.template.md +111 -0
- package/templates/frontend/specs/configuration.template.md +520 -0
- package/templates/frontend/specs/security.template.md +197 -0
- package/templates/fullstack/README.template.md +282 -0
- package/templates/fullstack/ai-instructions.template.md +487 -0
- package/templates/fullstack/project-brief.template.md +197 -0
- package/templates/fullstack/specs/configuration.template.md +380 -0
- package/templates/mobile/AGENT.template.md +251 -0
- package/templates/mobile/README.template.md +195 -0
- package/templates/mobile/ai-instructions.template.md +221 -0
- package/templates/mobile/docs/app-store.template.md +163 -0
- package/templates/mobile/docs/architecture.template.md +100 -0
- package/templates/mobile/docs/native-features.template.md +137 -0
- package/templates/mobile/docs/navigation.template.md +81 -0
- package/templates/mobile/docs/offline-strategy.template.md +90 -0
- package/templates/mobile/docs/permissions.template.md +70 -0
- package/templates/mobile/docs/state-management.template.md +116 -0
- package/templates/mobile/docs/testing.template.md +146 -0
- package/templates/mobile/project-brief.template.md +97 -0
- package/templates/mobile/specs/build-configuration.template.md +116 -0
- package/templates/mobile/specs/deployment.template.md +114 -0
- package/templates/shared/AGENT.template.md +252 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
# AI Flow - Documentation Update Command
|
|
2
|
+
|
|
3
|
+
**YOU ARE AN EXPERT TECHNICAL ARCHITECT AND DOCUMENTATION SPECIALIST.**
|
|
4
|
+
|
|
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
|
+
|
|
9
|
+
## Command: `/flow-docs-sync`
|
|
10
|
+
|
|
11
|
+
### Objective
|
|
12
|
+
|
|
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
|
+
|
|
17
|
+
## Execution Flow
|
|
18
|
+
|
|
19
|
+
### Step 1: Check for Analysis File
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
First, check if `.ai-flow/analysis.json` exists:
|
|
23
|
+
|
|
24
|
+
- ✅ If exists → Proceed to Step 2 (Compare Changes)
|
|
25
|
+
- ❌ If NOT exists → Execute full Phase 0 analysis first:
|
|
26
|
+
- Run complete code analysis (as described in Phase 0)
|
|
27
|
+
- Create `.ai-flow/analysis.json` with current state
|
|
28
|
+
- Then proceed to Step 2
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Step 2: Detect Changes
|
|
32
|
+
|
|
33
|
+
**Reuse Phase 0 Analysis Logic:**
|
|
34
|
+
|
|
35
|
+
1. **Perform Current Code Analysis:**
|
|
36
|
+
|
|
37
|
+
- Execute the same analysis as Phase 0 (section 0.1):
|
|
38
|
+
- File structure analysis
|
|
39
|
+
- AST-based code parsing (endpoints, entities, dependencies)
|
|
40
|
+
- Database schema analysis
|
|
41
|
+
- Pattern detection
|
|
42
|
+
- Generate current state snapshot
|
|
43
|
+
|
|
44
|
+
2. **Compare with Previous State:**
|
|
45
|
+
|
|
46
|
+
- Load `.ai-flow/analysis.json`
|
|
47
|
+
- Compare current state vs previous state
|
|
48
|
+
- Detect changes in:
|
|
49
|
+
- **Endpoints:** New, modified, or deleted endpoints
|
|
50
|
+
- **Entities:** New fields, relationships, or deleted entities
|
|
51
|
+
- **Dependencies:** New libraries, updated versions
|
|
52
|
+
- **Architecture:** New modules, changed patterns
|
|
53
|
+
- **Configuration:** New environment variables, external services
|
|
54
|
+
|
|
55
|
+
3. **Generate Change Report:**
|
|
56
|
+
- Categorize changes by type
|
|
57
|
+
- Map changes to affected documentation files
|
|
58
|
+
- Identify critical vs optional updates
|
|
59
|
+
|
|
60
|
+
### Step 3: Present Report and Confirm
|
|
61
|
+
|
|
62
|
+
**If changes detected:**
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
📊 CAMBIOS DETECTADOS:
|
|
66
|
+
|
|
67
|
+
🔴 Documentos que requieren actualización:
|
|
68
|
+
- docs/api.md (3 nuevos endpoints en UsersController)
|
|
69
|
+
- docs/data-model.md (campo "email" agregado a User)
|
|
70
|
+
- ai-instructions.md (nueva dependencia "@nestjs/swagger")
|
|
71
|
+
|
|
72
|
+
⚠️ Cambios moderados detectados:
|
|
73
|
+
- docs/architecture.md (cambio en estructura de carpetas)
|
|
74
|
+
|
|
75
|
+
✅ Sin cambios: docs/testing.md, specs/security.md
|
|
76
|
+
|
|
77
|
+
¿Actualizar todos los documentos detectados? (Y/N)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**If NO changes detected:**
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
✅ No se detectaron cambios. La documentación está sincronizada con el código actual.
|
|
84
|
+
|
|
85
|
+
No se requiere ninguna actualización.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📊 MERMAID DIAGRAM REGENERATION GUIDELINES
|
|
91
|
+
|
|
92
|
+
When regenerating or updating diagrams in documentation files, follow these **critical** formatting rules:
|
|
93
|
+
|
|
94
|
+
### ER Diagrams (data-model.md)
|
|
95
|
+
|
|
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
|
+
|
|
154
|
+
### Architecture Diagrams (architecture.md)
|
|
155
|
+
|
|
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
|
+
|
|
201
|
+
### Business Flow Diagrams (project-brief.md)
|
|
202
|
+
|
|
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
|
+
|
|
250
|
+
### Common Formatting Rules (ALL Diagrams)
|
|
251
|
+
|
|
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
|
|
263
|
+
- Do NOT indent the entire code block
|
|
264
|
+
|
|
265
|
+
**Validation Steps:**
|
|
266
|
+
1. After generating/updating diagram, verify syntax at https://mermaid.live/
|
|
267
|
+
2. Check that diagram renders in VS Code markdown preview
|
|
268
|
+
3. Verify all nodes and relationships are present
|
|
269
|
+
4. Confirm labels are clear and readable
|
|
270
|
+
5. Test that styling is applied correctly
|
|
271
|
+
|
|
272
|
+
**When Updating Existing Diagrams:**
|
|
273
|
+
1. Read the current diagram first
|
|
274
|
+
2. Identify what needs to be added/removed/modified
|
|
275
|
+
3. Maintain existing styling and layout patterns
|
|
276
|
+
4. Add new elements in logical positions
|
|
277
|
+
5. Preserve comments or notes if present
|
|
278
|
+
6. Verify the entire diagram still renders after changes
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### Step 4: Update Documents (If User Confirms)
|
|
283
|
+
|
|
284
|
+
**If user responds "Y", "Yes", "y", "yes", or similar:**
|
|
285
|
+
|
|
286
|
+
1. **For each document that needs updating:**
|
|
287
|
+
|
|
288
|
+
**A) `docs/api.md`** (if endpoints changed):
|
|
289
|
+
|
|
290
|
+
- Read current `docs/api.md`
|
|
291
|
+
- Identify new/modified endpoints from analysis
|
|
292
|
+
- Add new endpoints following existing API conventions
|
|
293
|
+
- Update modified endpoints
|
|
294
|
+
- Remove deleted endpoints (if any)
|
|
295
|
+
- Maintain all existing content that hasn't changed
|
|
296
|
+
- Regenerate affected sections only
|
|
297
|
+
|
|
298
|
+
**B) `docs/data-model.md`** (if entities changed):
|
|
299
|
+
|
|
300
|
+
- Read current `docs/data-model.md`
|
|
301
|
+
- Update entity definitions with new fields
|
|
302
|
+
- Update relationships if changed
|
|
303
|
+
- Regenerate ER diagram (mermaid) with new relationships
|
|
304
|
+
- Maintain all existing content that hasn't changed
|
|
305
|
+
|
|
306
|
+
**C) `ai-instructions.md`** (if dependencies changed):
|
|
307
|
+
|
|
308
|
+
- Read current `ai-instructions.md`
|
|
309
|
+
- Add new dependencies to appropriate sections
|
|
310
|
+
- Update version numbers if changed
|
|
311
|
+
- Maintain all existing rules and patterns
|
|
312
|
+
|
|
313
|
+
**D) `docs/architecture.md`** (if architecture changed):
|
|
314
|
+
|
|
315
|
+
- Read current `docs/architecture.md`
|
|
316
|
+
- Update architecture diagram (mermaid) if structure changed
|
|
317
|
+
- Update module descriptions
|
|
318
|
+
- Maintain all existing content
|
|
319
|
+
|
|
320
|
+
**E) `specs/configuration.md`** (if env vars changed):
|
|
321
|
+
|
|
322
|
+
- Read current `specs/configuration.md`
|
|
323
|
+
- Add new environment variables
|
|
324
|
+
- Update descriptions if changed
|
|
325
|
+
- Maintain existing variables
|
|
326
|
+
|
|
327
|
+
**F) `.env.example`** (if env vars changed):
|
|
328
|
+
|
|
329
|
+
- Read current `.env.example`
|
|
330
|
+
- Add new environment variables with example values
|
|
331
|
+
- Maintain existing variables
|
|
332
|
+
|
|
333
|
+
**G) `specs/security.md`** (if security patterns changed):
|
|
334
|
+
|
|
335
|
+
- Read current `specs/security.md`
|
|
336
|
+
- Update security policies if authentication/authorization changed
|
|
337
|
+
- Maintain existing policies
|
|
338
|
+
|
|
339
|
+
2. **Update `analysis.json`:**
|
|
340
|
+
|
|
341
|
+
- Save current state to `.ai-flow/analysis.json`
|
|
342
|
+
- Update timestamp
|
|
343
|
+
- Include all detected changes in metadata
|
|
344
|
+
|
|
345
|
+
3. **Present Summary:**
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
✅ DOCUMENTACIÓN ACTUALIZADA:
|
|
349
|
+
|
|
350
|
+
📝 docs/api.md
|
|
351
|
+
- Agregados 3 nuevos endpoints de UsersController
|
|
352
|
+
- Actualizada sección de autenticación
|
|
353
|
+
|
|
354
|
+
📝 docs/data-model.md
|
|
355
|
+
- Agregado campo "email" a entidad User
|
|
356
|
+
- Actualizado diagrama ER (mermaid)
|
|
357
|
+
|
|
358
|
+
📝 ai-instructions.md
|
|
359
|
+
- Agregada dependencia "@nestjs/swagger"
|
|
360
|
+
- Actualizada sección de herramientas
|
|
361
|
+
|
|
362
|
+
✅ analysis.json actualizado con nuevo estado
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Step 5: Handle Cancellation
|
|
366
|
+
|
|
367
|
+
**If user responds "N", "No", "n", "no", or similar:**
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
Actualización cancelada. Ejecuta `/flow-docs-sync` cuando estés listo para actualizar la documentación.
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Change Detection Rules
|
|
376
|
+
|
|
377
|
+
### Endpoints Detection
|
|
378
|
+
|
|
379
|
+
**What triggers `docs/api.md` update:**
|
|
380
|
+
|
|
381
|
+
- New `@Controller()`, `@Get()`, `@Post()`, `@Put()`, `@Delete()`, `@Patch()` decorators
|
|
382
|
+
- New `app.get()`, `app.post()`, `router.get()`, etc. (Express)
|
|
383
|
+
- New `@app.get()`, `@app.post()`, `@router.get()` (FastAPI)
|
|
384
|
+
- Modified route paths or methods
|
|
385
|
+
- Deleted endpoints
|
|
386
|
+
|
|
387
|
+
**How to update:**
|
|
388
|
+
|
|
389
|
+
- Add new endpoints following existing API conventions from Phase 3
|
|
390
|
+
- Use same format, authentication, pagination rules as existing endpoints
|
|
391
|
+
- Maintain all existing endpoints unchanged
|
|
392
|
+
|
|
393
|
+
### Entities Detection
|
|
394
|
+
|
|
395
|
+
**What triggers `docs/data-model.md` update:**
|
|
396
|
+
|
|
397
|
+
- New `@Entity()` classes (TypeORM)
|
|
398
|
+
- New `model` definitions (Prisma)
|
|
399
|
+
- New `@Column()` fields
|
|
400
|
+
- New relationships (`@OneToMany`, `@ManyToOne`, etc.)
|
|
401
|
+
- Modified field types or constraints
|
|
402
|
+
- Deleted entities or fields
|
|
403
|
+
|
|
404
|
+
**How to update:**
|
|
405
|
+
|
|
406
|
+
- Add new entities to entity catalog
|
|
407
|
+
- Update entity definitions with new fields
|
|
408
|
+
- Update ER diagram (mermaid) to include new relationships
|
|
409
|
+
- Maintain all existing entities unchanged
|
|
410
|
+
|
|
411
|
+
### Dependencies Detection
|
|
412
|
+
|
|
413
|
+
**What triggers `ai-instructions.md` update:**
|
|
414
|
+
|
|
415
|
+
- New entries in `package.json` / `requirements.txt` / `pom.xml` / etc.
|
|
416
|
+
- Updated version numbers
|
|
417
|
+
- New framework or ORM
|
|
418
|
+
|
|
419
|
+
**How to update:**
|
|
420
|
+
|
|
421
|
+
- Add to dependencies section
|
|
422
|
+
- Update version information
|
|
423
|
+
- Add to tools/libraries list if significant
|
|
424
|
+
- Maintain all existing dependencies
|
|
425
|
+
|
|
426
|
+
### Architecture Detection
|
|
427
|
+
|
|
428
|
+
**What triggers `docs/architecture.md` update:**
|
|
429
|
+
|
|
430
|
+
- New modules or directories
|
|
431
|
+
- Changed directory structure
|
|
432
|
+
- New architectural patterns detected
|
|
433
|
+
|
|
434
|
+
**How to update:**
|
|
435
|
+
|
|
436
|
+
- Update architecture diagram (mermaid)
|
|
437
|
+
- Add new modules to description
|
|
438
|
+
- Maintain existing architecture description
|
|
439
|
+
|
|
440
|
+
### Configuration Detection
|
|
441
|
+
|
|
442
|
+
**What triggers `specs/configuration.md` and `.env.example` update:**
|
|
443
|
+
|
|
444
|
+
- New environment variables in code
|
|
445
|
+
- New external service integrations
|
|
446
|
+
- Changed configuration patterns
|
|
447
|
+
|
|
448
|
+
**How to update:**
|
|
449
|
+
|
|
450
|
+
- Add new variables to configuration spec
|
|
451
|
+
- Add examples to `.env.example`
|
|
452
|
+
- Maintain existing variables
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## Important Rules
|
|
457
|
+
|
|
458
|
+
1. **Incremental Updates Only:**
|
|
459
|
+
|
|
460
|
+
- Only modify sections that changed
|
|
461
|
+
- Preserve all existing content that hasn't changed
|
|
462
|
+
- Maintain document structure and formatting
|
|
463
|
+
|
|
464
|
+
2. **Follow Existing Patterns:**
|
|
465
|
+
|
|
466
|
+
- Use same format as existing documentation
|
|
467
|
+
- Follow conventions established in original bootstrap
|
|
468
|
+
- Maintain consistency with existing docs
|
|
469
|
+
|
|
470
|
+
3. **Update Analysis File:**
|
|
471
|
+
|
|
472
|
+
- Always update `.ai-flow/analysis.json` after document updates
|
|
473
|
+
- Include timestamp and change summary
|
|
474
|
+
- Save complete current state for next comparison
|
|
475
|
+
|
|
476
|
+
4. **Mermaid Diagrams:**
|
|
477
|
+
|
|
478
|
+
- Regenerate ER diagrams when entities change
|
|
479
|
+
- Regenerate architecture diagrams when structure changes
|
|
480
|
+
- Use mermaid format for all diagrams
|
|
481
|
+
|
|
482
|
+
5. **Error Handling:**
|
|
483
|
+
- If document doesn't exist, create it following template
|
|
484
|
+
- If analysis.json is corrupted, regenerate it
|
|
485
|
+
- If comparison fails, show error and suggest full Phase 0 re-run
|
|
486
|
+
|
|
487
|
+
---
|
|
488
|
+
|
|
489
|
+
## Example Execution
|
|
490
|
+
|
|
491
|
+
```
|
|
492
|
+
User: /flow-docs-sync
|
|
493
|
+
|
|
494
|
+
AI:
|
|
495
|
+
📊 CAMBIOS DETECTADOS:
|
|
496
|
+
|
|
497
|
+
🔴 Documentos que requieren actualización:
|
|
498
|
+
- docs/api.md (2 nuevos endpoints: POST /users/:id/avatar, DELETE /users/:id/avatar)
|
|
499
|
+
- docs/data-model.md (nuevo campo "avatarUrl" en User)
|
|
500
|
+
|
|
501
|
+
✅ Sin cambios: docs/testing.md, specs/security.md, ai-instructions.md
|
|
502
|
+
|
|
503
|
+
¿Actualizar todos los documentos detectados? (Y/N)
|
|
504
|
+
|
|
505
|
+
User: Y
|
|
506
|
+
|
|
507
|
+
AI:
|
|
508
|
+
✅ DOCUMENTACIÓN ACTUALIZADA:
|
|
509
|
+
|
|
510
|
+
📝 docs/api.md
|
|
511
|
+
- Agregados 2 nuevos endpoints de UsersController (POST/DELETE /users/:id/avatar)
|
|
512
|
+
- Mantenida toda la documentación existente
|
|
513
|
+
|
|
514
|
+
📝 docs/data-model.md
|
|
515
|
+
- Agregado campo "avatarUrl" (String, nullable) a entidad User
|
|
516
|
+
- Actualizado diagrama ER (mermaid) con nuevo campo
|
|
517
|
+
|
|
518
|
+
✅ analysis.json actualizado con nuevo estado
|
|
519
|
+
|
|
520
|
+
Documentación sincronizada exitosamente.
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
**BEGIN EXECUTION when user runs `/flow-docs-sync`**
|
|
526
|
+
|