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,561 @@
|
|
|
1
|
+
# AI Flow - Documentation Update Command (Frontend)
|
|
2
|
+
|
|
3
|
+
**YOU ARE AN EXPERT FRONTEND ARCHITECT AND DOCUMENTATION SPECIALIST.**
|
|
4
|
+
|
|
5
|
+
Your mission is to detect changes in the frontend 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 frontend 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 frontend 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 (frontend/flow-docs-gen-phase-0-context.md):
|
|
38
|
+
- File structure analysis
|
|
39
|
+
- Component detection and analysis
|
|
40
|
+
- State management pattern detection
|
|
41
|
+
- Styling approach detection
|
|
42
|
+
- Routing pattern detection
|
|
43
|
+
- Dependency analysis
|
|
44
|
+
- Generate current state snapshot
|
|
45
|
+
|
|
46
|
+
2. **Compare with Previous State:**
|
|
47
|
+
|
|
48
|
+
- Load `.ai-flow/analysis.json`
|
|
49
|
+
- Compare current state vs previous state
|
|
50
|
+
- Detect changes in:
|
|
51
|
+
- **Components:** New, modified, or deleted components
|
|
52
|
+
- **State Management:** New stores, hooks, or state patterns
|
|
53
|
+
- **Styling:** New stylesheets, design tokens, or styling approach changes
|
|
54
|
+
- **Dependencies:** New libraries, updated versions
|
|
55
|
+
- **Architecture:** New modules, changed patterns, routing changes
|
|
56
|
+
- **Configuration:** New environment variables, external services
|
|
57
|
+
|
|
58
|
+
3. **Generate Change Report:**
|
|
59
|
+
- Categorize changes by type
|
|
60
|
+
- Map changes to affected documentation files
|
|
61
|
+
- Identify critical vs optional updates
|
|
62
|
+
|
|
63
|
+
### Step 3: Present Report and Confirm
|
|
64
|
+
|
|
65
|
+
**If changes detected:**
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
📊 CHANGES DETECTED:
|
|
69
|
+
|
|
70
|
+
🔴 Documents that require updating:
|
|
71
|
+
- docs/components.md (3 new components: UserCard, ProductGrid, SearchBar)
|
|
72
|
+
- docs/state-management.md (new Zustand store: useAuthStore)
|
|
73
|
+
- docs/styling.md (new design tokens added)
|
|
74
|
+
- ai-instructions.md (new dependency "@tanstack/react-query")
|
|
75
|
+
|
|
76
|
+
⚠️ Moderate changes detected:
|
|
77
|
+
- docs/architecture.md (change in folder structure)
|
|
78
|
+
|
|
79
|
+
✅ No changes: docs/testing.md, specs/configuration.md
|
|
80
|
+
|
|
81
|
+
Update all detected documents? (Y/N)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**If NO changes detected:**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
✅ No changes detected. Documentation is synchronized with current code.
|
|
88
|
+
|
|
89
|
+
No updates required.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Step 4: Update Documents (If User Confirms)
|
|
93
|
+
|
|
94
|
+
**If user responds "Y", "Yes", "y", "yes", or similar:**
|
|
95
|
+
|
|
96
|
+
1. **For each document that needs updating:**
|
|
97
|
+
|
|
98
|
+
**A) `docs/components.md`** (if components changed):
|
|
99
|
+
|
|
100
|
+
- Read current `docs/components.md`
|
|
101
|
+
- Identify new/modified components from analysis
|
|
102
|
+
- Add new components following existing component conventions
|
|
103
|
+
- Update modified components
|
|
104
|
+
- Remove deleted components (if any)
|
|
105
|
+
- Maintain all existing content that hasn't changed
|
|
106
|
+
- Regenerate affected sections only
|
|
107
|
+
|
|
108
|
+
**B) `docs/state-management.md`** (if state management changed):
|
|
109
|
+
|
|
110
|
+
- Read current `docs/state-management.md`
|
|
111
|
+
- Update state management patterns with new stores/hooks
|
|
112
|
+
- Update state structure if changed
|
|
113
|
+
- Maintain all existing content that hasn't changed
|
|
114
|
+
|
|
115
|
+
**C) `docs/styling.md`** (if styling changed):
|
|
116
|
+
|
|
117
|
+
- Read current `docs/styling.md`
|
|
118
|
+
- Update design tokens if changed
|
|
119
|
+
- Add new styling patterns
|
|
120
|
+
- Update styling approach if changed
|
|
121
|
+
- Maintain all existing content that hasn't changed
|
|
122
|
+
|
|
123
|
+
**D) `ai-instructions.md`** (if dependencies changed):
|
|
124
|
+
|
|
125
|
+
- Read current `ai-instructions.md`
|
|
126
|
+
- Add new dependencies to appropriate sections
|
|
127
|
+
- Update version numbers if changed
|
|
128
|
+
- Maintain all existing rules and patterns
|
|
129
|
+
|
|
130
|
+
**E) `docs/architecture.md`** (if architecture changed):
|
|
131
|
+
|
|
132
|
+
- Read current `docs/architecture.md`
|
|
133
|
+
- Update architecture diagram (mermaid) if structure changed
|
|
134
|
+
- Update module descriptions
|
|
135
|
+
- Update routing patterns if changed
|
|
136
|
+
- Maintain all existing content
|
|
137
|
+
|
|
138
|
+
**F) `specs/configuration.md`** (if env vars changed):
|
|
139
|
+
|
|
140
|
+
- Read current `specs/configuration.md`
|
|
141
|
+
- Add new environment variables
|
|
142
|
+
- Update descriptions if changed
|
|
143
|
+
- Maintain existing variables
|
|
144
|
+
|
|
145
|
+
**G) `docs/testing.md`** (if testing changed):
|
|
146
|
+
|
|
147
|
+
- Read current `docs/testing.md`
|
|
148
|
+
- Update testing patterns if changed
|
|
149
|
+
- Add new test examples if patterns changed
|
|
150
|
+
- Maintain existing testing strategy
|
|
151
|
+
|
|
152
|
+
2. **Update `analysis.json`:**
|
|
153
|
+
|
|
154
|
+
- Save current state to `.ai-flow/analysis.json`
|
|
155
|
+
- Update timestamp
|
|
156
|
+
- Include all detected changes in metadata
|
|
157
|
+
|
|
158
|
+
3. **Present Summary:**
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
✅ DOCUMENTATION UPDATED:
|
|
162
|
+
|
|
163
|
+
📝 docs/components.md
|
|
164
|
+
- Added 3 new components (UserCard, ProductGrid, SearchBar)
|
|
165
|
+
- Maintained all existing component documentation
|
|
166
|
+
|
|
167
|
+
📝 docs/state-management.md
|
|
168
|
+
- Added new Zustand store (useAuthStore)
|
|
169
|
+
- Updated state management patterns section
|
|
170
|
+
|
|
171
|
+
📝 docs/styling.md
|
|
172
|
+
- Added new design tokens
|
|
173
|
+
- Updated styling guidelines
|
|
174
|
+
|
|
175
|
+
📝 ai-instructions.md
|
|
176
|
+
- Added dependency "@tanstack/react-query"
|
|
177
|
+
- Updated tools section
|
|
178
|
+
|
|
179
|
+
✅ analysis.json updated with new state
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Step 5: Handle Cancellation
|
|
183
|
+
|
|
184
|
+
**If user responds "N", "No", "n", "no", or similar:**
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Update cancelled. Run `/flow-docs-sync` when you're ready to update the documentation.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Change Detection Rules
|
|
193
|
+
|
|
194
|
+
### Components Detection
|
|
195
|
+
|
|
196
|
+
**What triggers `docs/components.md` update:**
|
|
197
|
+
|
|
198
|
+
- New component files (`.tsx`, `.jsx`, `.vue`, `.svelte`)
|
|
199
|
+
- New component directories or structure changes
|
|
200
|
+
- Modified component exports or patterns
|
|
201
|
+
- Deleted components
|
|
202
|
+
|
|
203
|
+
**How to update:**
|
|
204
|
+
|
|
205
|
+
- Add new components following existing component conventions from Phase 2
|
|
206
|
+
- Use same format, naming conventions, and patterns as existing components
|
|
207
|
+
- Maintain all existing components unchanged
|
|
208
|
+
|
|
209
|
+
### State Management Detection
|
|
210
|
+
|
|
211
|
+
**What triggers `docs/state-management.md` update:**
|
|
212
|
+
|
|
213
|
+
- New store files (Zustand, Redux, Pinia, etc.)
|
|
214
|
+
- New custom hooks (`use*` files)
|
|
215
|
+
- New state management patterns
|
|
216
|
+
- Modified state structure
|
|
217
|
+
- Deleted stores or hooks
|
|
218
|
+
|
|
219
|
+
**How to update:**
|
|
220
|
+
|
|
221
|
+
- Add new stores/hooks to state management documentation
|
|
222
|
+
- Update state patterns if changed
|
|
223
|
+
- Maintain all existing state management documentation
|
|
224
|
+
|
|
225
|
+
### Styling Detection
|
|
226
|
+
|
|
227
|
+
**What triggers `docs/styling.md` update:**
|
|
228
|
+
|
|
229
|
+
- New stylesheet files (`.css`, `.scss`, `.module.css`)
|
|
230
|
+
- New design token files
|
|
231
|
+
- Changes in `tailwind.config.*`, `postcss.config.*`
|
|
232
|
+
- Modified styling approach
|
|
233
|
+
|
|
234
|
+
**How to update:**
|
|
235
|
+
|
|
236
|
+
- Add new design tokens or styling patterns
|
|
237
|
+
- Update styling guidelines if approach changed
|
|
238
|
+
- Maintain all existing styling documentation
|
|
239
|
+
|
|
240
|
+
### Dependencies Detection
|
|
241
|
+
|
|
242
|
+
**What triggers `ai-instructions.md` update:**
|
|
243
|
+
|
|
244
|
+
- New entries in `package.json`
|
|
245
|
+
- Updated version numbers
|
|
246
|
+
- New framework or library
|
|
247
|
+
|
|
248
|
+
**How to update:**
|
|
249
|
+
|
|
250
|
+
- Add to dependencies section
|
|
251
|
+
- Update version information
|
|
252
|
+
- Add to tools/libraries list if significant
|
|
253
|
+
- Maintain all existing dependencies
|
|
254
|
+
|
|
255
|
+
### Architecture Detection
|
|
256
|
+
|
|
257
|
+
**What triggers `docs/architecture.md` update:**
|
|
258
|
+
|
|
259
|
+
- New modules or directories
|
|
260
|
+
- Changed directory structure
|
|
261
|
+
- New architectural patterns detected
|
|
262
|
+
- Routing changes (new routes, route structure changes)
|
|
263
|
+
|
|
264
|
+
**How to update:**
|
|
265
|
+
|
|
266
|
+
- Update architecture diagram (mermaid)
|
|
267
|
+
- Add new modules to description
|
|
268
|
+
- Update routing patterns if changed
|
|
269
|
+
- Maintain existing architecture description
|
|
270
|
+
|
|
271
|
+
### Configuration Detection
|
|
272
|
+
|
|
273
|
+
**What triggers `specs/configuration.md` update:**
|
|
274
|
+
|
|
275
|
+
- New environment variables in code
|
|
276
|
+
- New external service integrations
|
|
277
|
+
- Changed configuration patterns
|
|
278
|
+
|
|
279
|
+
**How to update:**
|
|
280
|
+
|
|
281
|
+
- Add new variables to configuration spec
|
|
282
|
+
- Maintain existing variables
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Important Rules
|
|
287
|
+
|
|
288
|
+
1. **Incremental Updates Only:**
|
|
289
|
+
|
|
290
|
+
- Only modify sections that changed
|
|
291
|
+
- Preserve all existing content that hasn't changed
|
|
292
|
+
- Maintain document structure and formatting
|
|
293
|
+
|
|
294
|
+
2. **Follow Existing Patterns:**
|
|
295
|
+
|
|
296
|
+
- Use same format as existing documentation
|
|
297
|
+
- Follow conventions established in original bootstrap
|
|
298
|
+
- Maintain consistency with existing docs
|
|
299
|
+
|
|
300
|
+
3. **Update Analysis File:**
|
|
301
|
+
|
|
302
|
+
- Always update `.ai-flow/analysis.json` after document updates
|
|
303
|
+
- Include timestamp and change summary
|
|
304
|
+
- Save complete current state for next comparison
|
|
305
|
+
|
|
306
|
+
4. **Mermaid Diagrams:**
|
|
307
|
+
|
|
308
|
+
- Regenerate component architecture diagrams when structure changes
|
|
309
|
+
- Regenerate architecture diagrams when structure changes
|
|
310
|
+
- Use mermaid format for all diagrams
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## 📊 FRONTEND DIAGRAM REGENERATION GUIDELINES
|
|
315
|
+
|
|
316
|
+
When regenerating frontend diagrams, follow these **critical** formatting rules:
|
|
317
|
+
|
|
318
|
+
### Component Hierarchy Diagrams (components.md)
|
|
319
|
+
|
|
320
|
+
**Diagram Type:** `graph TD` or `graph LR`
|
|
321
|
+
|
|
322
|
+
**Requirements:**
|
|
323
|
+
1. Show component organization by abstraction level (Pages → Organisms → Molecules → Atoms)
|
|
324
|
+
2. Use subgraphs to group components by level
|
|
325
|
+
3. Color code by level (consistent colors)
|
|
326
|
+
4. Show composition relationships with solid arrows
|
|
327
|
+
5. Include actual component names from the codebase
|
|
328
|
+
|
|
329
|
+
**Quality Checklist:**
|
|
330
|
+
- [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
|
|
331
|
+
- [ ] All major components from src/components/ are represented
|
|
332
|
+
- [ ] Atomic Design levels are clearly separated
|
|
333
|
+
- [ ] Colors are consistent (pages=blue, organisms=orange, molecules=green, atoms=pink)
|
|
334
|
+
- [ ] Diagram renders without errors
|
|
335
|
+
- [ ] Component names match actual file names
|
|
336
|
+
|
|
337
|
+
**Example:**
|
|
338
|
+
````markdown
|
|
339
|
+
```mermaid
|
|
340
|
+
graph TD
|
|
341
|
+
subgraph "Pages"
|
|
342
|
+
Home[HomePage]
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
subgraph "Organisms"
|
|
346
|
+
Header[Header]
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
subgraph "Molecules"
|
|
350
|
+
Nav[NavBar]
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
subgraph "Atoms"
|
|
354
|
+
Btn[Button]
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
Home --> Header
|
|
358
|
+
Header --> Nav
|
|
359
|
+
Nav --> Btn
|
|
360
|
+
|
|
361
|
+
style Home fill:#e1f5ff
|
|
362
|
+
style Header fill:#fff4e6
|
|
363
|
+
style Nav fill:#e8f5e9
|
|
364
|
+
style Btn fill:#fce4ec
|
|
365
|
+
```
|
|
366
|
+
````
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
### State Management Diagrams (state-management.md)
|
|
371
|
+
|
|
372
|
+
**Diagram Types:** `graph LR`, `sequenceDiagram`, `graph TD`
|
|
373
|
+
|
|
374
|
+
**Requirements:**
|
|
375
|
+
1. Show all state types used (Server, Client, URL, Form, Local)
|
|
376
|
+
2. Label with actual tools used (TanStack Query, Zustand, etc.)
|
|
377
|
+
3. For sequence diagrams: show complete request/response cycle
|
|
378
|
+
4. For decision trees: show clear Yes/No branches
|
|
379
|
+
5. Include cache behavior if using TanStack Query
|
|
380
|
+
|
|
381
|
+
**Quality Checklist:**
|
|
382
|
+
- [ ] Code fence is exactly ` ```mermaid `
|
|
383
|
+
- [ ] All state management tools are documented
|
|
384
|
+
- [ ] Data flow direction is clear (arrows labeled)
|
|
385
|
+
- [ ] State types are color coded consistently
|
|
386
|
+
- [ ] Sequence diagrams show timing and async operations
|
|
387
|
+
- [ ] Decision trees have all paths covered
|
|
388
|
+
|
|
389
|
+
**Example (State Categories):**
|
|
390
|
+
````markdown
|
|
391
|
+
```mermaid
|
|
392
|
+
graph LR
|
|
393
|
+
SS[Server State<br/>TanStack Query] -.-> C1[Component A]
|
|
394
|
+
CS[Client State<br/>Zustand] -.-> C2[Component B]
|
|
395
|
+
|
|
396
|
+
style SS fill:#e1f5ff
|
|
397
|
+
style CS fill:#fff4e6
|
|
398
|
+
```
|
|
399
|
+
````
|
|
400
|
+
|
|
401
|
+
**Example (Data Flow):**
|
|
402
|
+
````markdown
|
|
403
|
+
```mermaid
|
|
404
|
+
sequenceDiagram
|
|
405
|
+
User->>Component: Click Button
|
|
406
|
+
Component->>Store: Update State
|
|
407
|
+
Store->>API: Fetch Data
|
|
408
|
+
API-->>Store: Return Data
|
|
409
|
+
Store-->>Component: State Changed
|
|
410
|
+
Component-->>User: UI Updated
|
|
411
|
+
```
|
|
412
|
+
````
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### Routing Diagrams (architecture.md or routing.md)
|
|
417
|
+
|
|
418
|
+
**Diagram Type:** `graph TD`
|
|
419
|
+
|
|
420
|
+
**Requirements:**
|
|
421
|
+
1. Show complete route tree starting from root
|
|
422
|
+
2. Separate public and protected routes
|
|
423
|
+
3. Show nested routes with proper indentation
|
|
424
|
+
4. Include route parameters (`:id`, `:slug`)
|
|
425
|
+
5. Group related routes in subgraphs
|
|
426
|
+
|
|
427
|
+
**Quality Checklist:**
|
|
428
|
+
- [ ] Code fence is exactly ` ```mermaid `
|
|
429
|
+
- [ ] All routes from router config are included
|
|
430
|
+
- [ ] Protected routes are clearly distinguished
|
|
431
|
+
- [ ] Nested routes show parent-child relationships
|
|
432
|
+
- [ ] Route parameters are documented
|
|
433
|
+
- [ ] Diagram matches actual router configuration
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
### Application Architecture Diagram (architecture.md)
|
|
438
|
+
|
|
439
|
+
**Diagram Type:** `graph TB`
|
|
440
|
+
|
|
441
|
+
**Requirements:**
|
|
442
|
+
1. Show frontend layers (UI, State, API)
|
|
443
|
+
2. Include external services (Backend, Auth, CDN)
|
|
444
|
+
3. Show data flow between layers
|
|
445
|
+
4. Document integration points
|
|
446
|
+
|
|
447
|
+
**Example:**
|
|
448
|
+
````markdown
|
|
449
|
+
```mermaid
|
|
450
|
+
graph TB
|
|
451
|
+
subgraph "Frontend Application"
|
|
452
|
+
UI[UI Layer<br/>React Components]
|
|
453
|
+
STATE[State Layer<br/>TanStack Query + Zustand]
|
|
454
|
+
API[API Layer<br/>Axios/Fetch Services]
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
subgraph "External Services"
|
|
458
|
+
BACKEND[Backend API<br/>REST/GraphQL]
|
|
459
|
+
AUTH[Auth Service<br/>Auth0/Clerk]
|
|
460
|
+
CDN[CDN<br/>Images/Assets]
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
UI --> STATE
|
|
464
|
+
STATE --> API
|
|
465
|
+
API --> BACKEND
|
|
466
|
+
API --> AUTH
|
|
467
|
+
UI --> CDN
|
|
468
|
+
|
|
469
|
+
style UI fill:#e1f5ff
|
|
470
|
+
style STATE fill:#fff4e6
|
|
471
|
+
style API fill:#e8f5e9
|
|
472
|
+
style BACKEND fill:#fce4ec
|
|
473
|
+
```
|
|
474
|
+
````
|
|
475
|
+
|
|
476
|
+
**Use for:** System architecture overview, integration documentation, onboarding
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
### Common Formatting Rules (ALL Frontend Diagrams)
|
|
481
|
+
|
|
482
|
+
**CRITICAL - Code Fence Syntax:**
|
|
483
|
+
```
|
|
484
|
+
✅ CORRECT: ```mermaid
|
|
485
|
+
❌ WRONG: ```Mermaid (capital M)
|
|
486
|
+
❌ WRONG: ``` mermaid (extra space)
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Color Coding Standards (Frontend):**
|
|
490
|
+
- Pages/Routes: `#e1f5ff` (light blue)
|
|
491
|
+
- Organisms: `#fff4e6` (light orange)
|
|
492
|
+
- Molecules: `#e8f5e9` (light green)
|
|
493
|
+
- Atoms: `#fce4ec` (light pink)
|
|
494
|
+
- Server State: `#e1f5ff` (light blue)
|
|
495
|
+
- Client State: `#fff4e6` (light orange)
|
|
496
|
+
- URL State: `#e8f5e9` (light green)
|
|
497
|
+
- Form State: `#fce4ec` (light pink)
|
|
498
|
+
- Local State: `#f3e5f5` (light purple)
|
|
499
|
+
|
|
500
|
+
**Validation Steps:**
|
|
501
|
+
1. Test diagram at https://mermaid.live/ before saving
|
|
502
|
+
2. Verify all component/file names match actual codebase
|
|
503
|
+
3. Check that arrows flow in logical direction (top-down, left-right)
|
|
504
|
+
4. Confirm colors are applied consistently
|
|
505
|
+
5. Ensure diagram is readable (not too crowded)
|
|
506
|
+
|
|
507
|
+
**When Updating Existing Diagrams:**
|
|
508
|
+
1. Read current diagram first
|
|
509
|
+
2. Identify added/removed/modified components or routes
|
|
510
|
+
3. Maintain existing styling and layout patterns
|
|
511
|
+
4. Update relationships based on code changes
|
|
512
|
+
5. Verify entire diagram still renders after changes
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
5. **Error Handling:**
|
|
517
|
+
- If document doesn't exist, create it following template
|
|
518
|
+
- If analysis.json is corrupted, regenerate it
|
|
519
|
+
- If comparison fails, show error and suggest full Phase 0 re-run
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Example Execution
|
|
524
|
+
|
|
525
|
+
```
|
|
526
|
+
User: /flow-docs-sync
|
|
527
|
+
|
|
528
|
+
AI:
|
|
529
|
+
📊 CHANGES DETECTED:
|
|
530
|
+
|
|
531
|
+
🔴 Documents that require updating:
|
|
532
|
+
- docs/components.md (2 new components: Button, Modal)
|
|
533
|
+
- docs/state-management.md (new Zustand store: useCartStore)
|
|
534
|
+
|
|
535
|
+
✅ No changes: docs/styling.md, docs/testing.md, ai-instructions.md
|
|
536
|
+
|
|
537
|
+
Update all detected documents? (Y/N)
|
|
538
|
+
|
|
539
|
+
User: Y
|
|
540
|
+
|
|
541
|
+
AI:
|
|
542
|
+
✅ DOCUMENTATION UPDATED:
|
|
543
|
+
|
|
544
|
+
📝 docs/components.md
|
|
545
|
+
- Added 2 new components (Button, Modal)
|
|
546
|
+
- Maintained all existing component documentation
|
|
547
|
+
|
|
548
|
+
📝 docs/state-management.md
|
|
549
|
+
- Added new Zustand store (useCartStore)
|
|
550
|
+
- Updated state management patterns section
|
|
551
|
+
|
|
552
|
+
✅ analysis.json updated with new state
|
|
553
|
+
|
|
554
|
+
Documentation synchronized successfully.
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
**BEGIN EXECUTION when user runs `/flow-docs-sync`**
|
|
560
|
+
|
|
561
|
+
|