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,634 @@
|
|
|
1
|
+
# AI Flow - Documentation Update Command (Mobile)
|
|
2
|
+
|
|
3
|
+
**YOU ARE AN EXPERT MOBILE ARCHITECT AND DOCUMENTATION SPECIALIST.**
|
|
4
|
+
|
|
5
|
+
Your mission is to detect changes in the mobile 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 mobile 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 mobile 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 (mobile/flow-docs-gen-phase-0-context.md):
|
|
38
|
+
- File structure analysis
|
|
39
|
+
- Screen and component detection
|
|
40
|
+
- Navigation pattern detection
|
|
41
|
+
- State management pattern detection
|
|
42
|
+
- Permission detection (iOS Info.plist, Android AndroidManifest.xml)
|
|
43
|
+
- Native module detection
|
|
44
|
+
- Build configuration analysis
|
|
45
|
+
- Dependency analysis
|
|
46
|
+
- Generate current state snapshot
|
|
47
|
+
|
|
48
|
+
2. **Compare with Previous State:**
|
|
49
|
+
|
|
50
|
+
- Load `.ai-flow/analysis.json`
|
|
51
|
+
- Compare current state vs previous state
|
|
52
|
+
- Detect changes in:
|
|
53
|
+
- **Screens:** New, modified, or deleted screens
|
|
54
|
+
- **Navigation:** New routes, navigation pattern changes
|
|
55
|
+
- **State Management:** New stores, hooks, or state patterns
|
|
56
|
+
- **Permissions:** New permissions requested
|
|
57
|
+
- **Native Features:** New native modules or integrations
|
|
58
|
+
- **Dependencies:** New libraries, updated versions
|
|
59
|
+
- **Architecture:** New modules, changed patterns
|
|
60
|
+
- **Build Configuration:** Changes in build.gradle, Podfile, app.json
|
|
61
|
+
- **Configuration:** New environment variables, external services
|
|
62
|
+
|
|
63
|
+
3. **Generate Change Report:**
|
|
64
|
+
- Categorize changes by type
|
|
65
|
+
- Map changes to affected documentation files
|
|
66
|
+
- Identify critical vs optional updates
|
|
67
|
+
|
|
68
|
+
### Step 3: Present Report and Confirm
|
|
69
|
+
|
|
70
|
+
**If changes detected:**
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
📊 CHANGES DETECTED:
|
|
74
|
+
|
|
75
|
+
🔴 Documents that require updating:
|
|
76
|
+
- docs/navigation.md (2 new screens: ProfileScreen, SettingsScreen)
|
|
77
|
+
- docs/permissions.md (new permission: Camera)
|
|
78
|
+
- docs/native-features.md (new native module: react-native-camera)
|
|
79
|
+
- docs/state-management.md (new Redux store: userSlice)
|
|
80
|
+
- ai-instructions.md (new dependency "react-native-camera")
|
|
81
|
+
|
|
82
|
+
⚠️ Moderate changes detected:
|
|
83
|
+
- docs/architecture.md (change in folder structure)
|
|
84
|
+
- specs/build-configuration.md (change in build.gradle)
|
|
85
|
+
|
|
86
|
+
✅ No changes: docs/testing.md, docs/offline-strategy.md
|
|
87
|
+
|
|
88
|
+
Update all detected documents? (Y/N)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**If NO changes detected:**
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
✅ No changes detected. Documentation is synchronized with current code.
|
|
95
|
+
|
|
96
|
+
No updates required.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Step 4: Update Documents (If User Confirms)
|
|
100
|
+
|
|
101
|
+
**If user responds "Y", "Yes", "y", "yes", or similar:**
|
|
102
|
+
|
|
103
|
+
1. **For each document that needs updating:**
|
|
104
|
+
|
|
105
|
+
**A) `docs/navigation.md`** (if screens/navigation changed):
|
|
106
|
+
|
|
107
|
+
- Read current `docs/navigation.md`
|
|
108
|
+
- Identify new/modified screens from analysis
|
|
109
|
+
- Add new screens following existing navigation conventions
|
|
110
|
+
- Update navigation structure if changed
|
|
111
|
+
- Remove deleted screens (if any)
|
|
112
|
+
- Maintain all existing content that hasn't changed
|
|
113
|
+
- Regenerate affected sections only
|
|
114
|
+
|
|
115
|
+
**B) `docs/permissions.md`** (if permissions changed):
|
|
116
|
+
|
|
117
|
+
- Read current `docs/permissions.md`
|
|
118
|
+
- Add new permissions detected in Info.plist or AndroidManifest.xml
|
|
119
|
+
- Update permission descriptions if changed
|
|
120
|
+
- Maintain all existing permissions
|
|
121
|
+
|
|
122
|
+
**C) `docs/native-features.md`** (if native modules changed):
|
|
123
|
+
|
|
124
|
+
- Read current `docs/native-features.md`
|
|
125
|
+
- Add new native modules detected in dependencies
|
|
126
|
+
- Update native feature integrations
|
|
127
|
+
- Maintain all existing native features
|
|
128
|
+
|
|
129
|
+
**D) `docs/state-management.md`** (if state management changed):
|
|
130
|
+
|
|
131
|
+
- Read current `docs/state-management.md`
|
|
132
|
+
- Update state management patterns with new stores/hooks
|
|
133
|
+
- Update state structure if changed
|
|
134
|
+
- Maintain all existing content that hasn't changed
|
|
135
|
+
|
|
136
|
+
**E) `docs/offline-strategy.md`** (if offline strategy changed):
|
|
137
|
+
|
|
138
|
+
- Read current `docs/offline-strategy.md`
|
|
139
|
+
- Update offline patterns if storage solution changed
|
|
140
|
+
- Update sync strategy if changed
|
|
141
|
+
- Maintain all existing content
|
|
142
|
+
|
|
143
|
+
**F) `ai-instructions.md`** (if dependencies changed):
|
|
144
|
+
|
|
145
|
+
- Read current `ai-instructions.md`
|
|
146
|
+
- Add new dependencies to appropriate sections
|
|
147
|
+
- Update version numbers if changed
|
|
148
|
+
- Maintain all existing rules and patterns
|
|
149
|
+
|
|
150
|
+
**G) `docs/architecture.md`** (if architecture changed):
|
|
151
|
+
|
|
152
|
+
- Read current `docs/architecture.md`
|
|
153
|
+
- Update architecture diagram (mermaid) if structure changed
|
|
154
|
+
- Update module descriptions
|
|
155
|
+
- Maintain all existing content
|
|
156
|
+
|
|
157
|
+
**H) `specs/build-configuration.md`** (if build config changed):
|
|
158
|
+
|
|
159
|
+
- Read current `specs/build-configuration.md`
|
|
160
|
+
- Update build configuration if build.gradle, Podfile, or app.json changed
|
|
161
|
+
- Update version information if changed
|
|
162
|
+
- Maintain existing configuration
|
|
163
|
+
|
|
164
|
+
**I) `specs/deployment.md`** (if deployment changed):
|
|
165
|
+
|
|
166
|
+
- Read current `specs/deployment.md`
|
|
167
|
+
- Update deployment procedures if changed
|
|
168
|
+
- Maintain existing procedures
|
|
169
|
+
|
|
170
|
+
**J) `docs/app-store.md`** (if app store config changed):
|
|
171
|
+
|
|
172
|
+
- Read current `docs/app-store.md`
|
|
173
|
+
- Update app store configuration if app.json or build config changed
|
|
174
|
+
- Maintain existing configuration
|
|
175
|
+
|
|
176
|
+
2. **Update `analysis.json`:**
|
|
177
|
+
|
|
178
|
+
- Save current state to `.ai-flow/analysis.json`
|
|
179
|
+
- Update timestamp
|
|
180
|
+
- Include all detected changes in metadata
|
|
181
|
+
|
|
182
|
+
3. **Present Summary:**
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
✅ DOCUMENTATION UPDATED:
|
|
186
|
+
|
|
187
|
+
📝 docs/navigation.md
|
|
188
|
+
- Added 2 new screens (ProfileScreen, SettingsScreen)
|
|
189
|
+
- Updated navigation structure
|
|
190
|
+
- Maintained all existing navigation documentation
|
|
191
|
+
|
|
192
|
+
📝 docs/permissions.md
|
|
193
|
+
- Added new permission (Camera)
|
|
194
|
+
- Updated permission handling section
|
|
195
|
+
|
|
196
|
+
📝 docs/native-features.md
|
|
197
|
+
- Added new native module (react-native-camera)
|
|
198
|
+
- Updated native features integration section
|
|
199
|
+
|
|
200
|
+
📝 docs/state-management.md
|
|
201
|
+
- Added new Redux store (userSlice)
|
|
202
|
+
- Updated state management patterns
|
|
203
|
+
|
|
204
|
+
📝 ai-instructions.md
|
|
205
|
+
- Added dependency "react-native-camera"
|
|
206
|
+
- Updated tools section
|
|
207
|
+
|
|
208
|
+
📝 specs/build-configuration.md
|
|
209
|
+
- Updated build.gradle configuration
|
|
210
|
+
|
|
211
|
+
✅ analysis.json updated with new state
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Step 5: Handle Cancellation
|
|
215
|
+
|
|
216
|
+
**If user responds "N", "No", "n", "no", or similar:**
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
Update cancelled. Run `/flow-docs-sync` when you're ready to update the documentation.
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Change Detection Rules
|
|
225
|
+
|
|
226
|
+
### Screens Detection
|
|
227
|
+
|
|
228
|
+
**What triggers `docs/navigation.md` update:**
|
|
229
|
+
|
|
230
|
+
- New screen files (`.tsx`, `.jsx`, `.dart`, `.swift`, `.kt`)
|
|
231
|
+
- New screen directories (`screens/`, `pages/`)
|
|
232
|
+
- Modified navigation structure
|
|
233
|
+
- Deleted screens
|
|
234
|
+
|
|
235
|
+
**How to update:**
|
|
236
|
+
|
|
237
|
+
- Add new screens following existing navigation conventions from Phase 2
|
|
238
|
+
- Use same format, navigation patterns as existing screens
|
|
239
|
+
- Maintain all existing screens unchanged
|
|
240
|
+
|
|
241
|
+
### Permissions Detection
|
|
242
|
+
|
|
243
|
+
**What triggers `docs/permissions.md` update:**
|
|
244
|
+
|
|
245
|
+
- New permissions in `Info.plist` (iOS)
|
|
246
|
+
- New permissions in `AndroidManifest.xml` (Android)
|
|
247
|
+
- Modified permission descriptions
|
|
248
|
+
- Deleted permissions
|
|
249
|
+
|
|
250
|
+
**How to update:**
|
|
251
|
+
|
|
252
|
+
- Add new permissions to permissions documentation
|
|
253
|
+
- Update permission descriptions if changed
|
|
254
|
+
- Maintain all existing permissions
|
|
255
|
+
|
|
256
|
+
### Native Features Detection
|
|
257
|
+
|
|
258
|
+
**What triggers `docs/native-features.md` update:**
|
|
259
|
+
|
|
260
|
+
- New native modules in `package.json` (React Native)
|
|
261
|
+
- New native modules in `pubspec.yaml` (Flutter)
|
|
262
|
+
- New native code files (`.swift`, `.kt`, `.m`, `.java`)
|
|
263
|
+
- Modified native integrations
|
|
264
|
+
|
|
265
|
+
**How to update:**
|
|
266
|
+
|
|
267
|
+
- Add new native modules to native features documentation
|
|
268
|
+
- Update integration patterns if changed
|
|
269
|
+
- Maintain all existing native features
|
|
270
|
+
|
|
271
|
+
### State Management Detection
|
|
272
|
+
|
|
273
|
+
**What triggers `docs/state-management.md` update:**
|
|
274
|
+
|
|
275
|
+
- New store files (Redux, Zustand, MobX, Provider, Bloc, etc.)
|
|
276
|
+
- New custom hooks (`use*` files)
|
|
277
|
+
- New state management patterns
|
|
278
|
+
- Modified state structure
|
|
279
|
+
- Deleted stores or hooks
|
|
280
|
+
|
|
281
|
+
**How to update:**
|
|
282
|
+
|
|
283
|
+
- Add new stores/hooks to state management documentation
|
|
284
|
+
- Update state patterns if changed
|
|
285
|
+
- Maintain all existing state management documentation
|
|
286
|
+
|
|
287
|
+
### Build Configuration Detection
|
|
288
|
+
|
|
289
|
+
**What triggers `specs/build-configuration.md` update:**
|
|
290
|
+
|
|
291
|
+
- Changes in `build.gradle` (Android)
|
|
292
|
+
- Changes in `Podfile` (iOS)
|
|
293
|
+
- Changes in `app.json` or `app.config.js` (React Native)
|
|
294
|
+
- Changes in `pubspec.yaml` (Flutter)
|
|
295
|
+
- Version number changes
|
|
296
|
+
|
|
297
|
+
**How to update:**
|
|
298
|
+
|
|
299
|
+
- Update build configuration documentation
|
|
300
|
+
- Update version information
|
|
301
|
+
- Maintain existing configuration
|
|
302
|
+
|
|
303
|
+
### Dependencies Detection
|
|
304
|
+
|
|
305
|
+
**What triggers `ai-instructions.md` update:**
|
|
306
|
+
|
|
307
|
+
- New entries in `package.json` or `pubspec.yaml`
|
|
308
|
+
- Updated version numbers
|
|
309
|
+
- New framework or library
|
|
310
|
+
|
|
311
|
+
**How to update:**
|
|
312
|
+
|
|
313
|
+
- Add to dependencies section
|
|
314
|
+
- Update version information
|
|
315
|
+
- Add to tools/libraries list if significant
|
|
316
|
+
- Maintain all existing dependencies
|
|
317
|
+
|
|
318
|
+
### Architecture Detection
|
|
319
|
+
|
|
320
|
+
**What triggers `docs/architecture.md` update:**
|
|
321
|
+
|
|
322
|
+
- New modules or directories
|
|
323
|
+
- Changed directory structure
|
|
324
|
+
- New architectural patterns detected
|
|
325
|
+
|
|
326
|
+
**How to update:**
|
|
327
|
+
|
|
328
|
+
- Update architecture diagram (mermaid)
|
|
329
|
+
- Add new modules to description
|
|
330
|
+
- Maintain existing architecture description
|
|
331
|
+
|
|
332
|
+
### Configuration Detection
|
|
333
|
+
|
|
334
|
+
**What triggers `specs/configuration.md` update:**
|
|
335
|
+
|
|
336
|
+
- New environment variables in code
|
|
337
|
+
- New external service integrations
|
|
338
|
+
- Changed configuration patterns
|
|
339
|
+
|
|
340
|
+
**How to update:**
|
|
341
|
+
|
|
342
|
+
- Add new variables to configuration spec
|
|
343
|
+
- Maintain existing variables
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Important Rules
|
|
348
|
+
|
|
349
|
+
1. **Incremental Updates Only:**
|
|
350
|
+
|
|
351
|
+
- Only modify sections that changed
|
|
352
|
+
- Preserve all existing content that hasn't changed
|
|
353
|
+
- Maintain document structure and formatting
|
|
354
|
+
|
|
355
|
+
2. **Follow Existing Patterns:**
|
|
356
|
+
|
|
357
|
+
- Use same format as existing documentation
|
|
358
|
+
- Follow conventions established in original bootstrap
|
|
359
|
+
- Maintain consistency with existing docs
|
|
360
|
+
|
|
361
|
+
3. **Update Analysis File:**
|
|
362
|
+
|
|
363
|
+
- Always update `.ai-flow/analysis.json` after document updates
|
|
364
|
+
- Include timestamp and change summary
|
|
365
|
+
- Save complete current state for next comparison
|
|
366
|
+
|
|
367
|
+
4. **Mermaid Diagrams:**
|
|
368
|
+
|
|
369
|
+
- Regenerate navigation diagrams when screens change
|
|
370
|
+
- Regenerate architecture diagrams when structure changes
|
|
371
|
+
- Use mermaid format for all diagrams
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## 📊 MOBILE DIAGRAM REGENERATION GUIDELINES
|
|
376
|
+
|
|
377
|
+
When regenerating mobile diagrams, follow these **critical** formatting rules:
|
|
378
|
+
|
|
379
|
+
### Navigation Diagrams (navigation.md)
|
|
380
|
+
|
|
381
|
+
**Diagram Types:** `graph TD`, `graph LR`
|
|
382
|
+
|
|
383
|
+
**Requirements:**
|
|
384
|
+
1. Show navigation hierarchy (Root → Tab → Stack → Screens)
|
|
385
|
+
2. Use subgraphs to group navigators and screens
|
|
386
|
+
3. Color code by level (Root=light blue, Tabs=blue, Stacks=orange)
|
|
387
|
+
4. Show authentication flows with decision diamonds
|
|
388
|
+
5. Include deep linking routes with ⚠️ for protected routes
|
|
389
|
+
6. Include actual screen names from the codebase
|
|
390
|
+
|
|
391
|
+
**Quality Checklist:**
|
|
392
|
+
- [ ] Code fence is exactly ` ```mermaid ` (lowercase, no spaces)
|
|
393
|
+
- [ ] All major screens from src/screens/ are represented
|
|
394
|
+
- [ ] Navigation hierarchy is clear (Tab + Stack pattern)
|
|
395
|
+
- [ ] Colors are consistent (Root=#e3f2fd, Tabs=#e1f5ff, Stacks=#fff4e6)
|
|
396
|
+
- [ ] Diagram renders without errors
|
|
397
|
+
- [ ] Screen names match actual file names
|
|
398
|
+
- [ ] Authentication flow shows protected routes
|
|
399
|
+
|
|
400
|
+
**Example (Tab + Stack Navigation):**
|
|
401
|
+
````markdown
|
|
402
|
+
```mermaid
|
|
403
|
+
graph TD
|
|
404
|
+
subgraph "App Navigation"
|
|
405
|
+
ROOT[Root Navigator]
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
subgraph "Tab Navigator"
|
|
409
|
+
TAB1[Home Tab]
|
|
410
|
+
TAB2[Profile Tab]
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
subgraph "Stack Navigators"
|
|
414
|
+
subgraph "Home Stack"
|
|
415
|
+
H1[Home Screen]
|
|
416
|
+
H2[Product Detail]
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
subgraph "Profile Stack"
|
|
420
|
+
P1[Profile Screen]
|
|
421
|
+
P2[Edit Profile]
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
ROOT --> TAB1
|
|
426
|
+
ROOT --> TAB2
|
|
427
|
+
|
|
428
|
+
TAB1 --> H1
|
|
429
|
+
H1 --> H2
|
|
430
|
+
|
|
431
|
+
TAB2 --> P1
|
|
432
|
+
P1 --> P2
|
|
433
|
+
|
|
434
|
+
style ROOT fill:#e3f2fd
|
|
435
|
+
style TAB1 fill:#e1f5ff
|
|
436
|
+
style H1 fill:#fff4e6
|
|
437
|
+
style P1 fill:#fff4e6
|
|
438
|
+
```
|
|
439
|
+
````
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
### State Management Diagrams (state-management.md)
|
|
444
|
+
|
|
445
|
+
**Diagram Types:** `graph LR`, `sequenceDiagram`, `graph TD`
|
|
446
|
+
|
|
447
|
+
**Requirements:**
|
|
448
|
+
1. Show all state types (Server, Client, Local Storage, Cache)
|
|
449
|
+
2. Label with actual tools used (Redux, TanStack Query, AsyncStorage, etc.)
|
|
450
|
+
3. For sequence diagrams: show complete offline/online flow
|
|
451
|
+
4. For decision trees: show clear Yes/No branches
|
|
452
|
+
5. Include mobile-specific concerns (offline-first, slow networks)
|
|
453
|
+
6. Show cache layers (AsyncStorage, MMKV, WatermelonDB, Realm)
|
|
454
|
+
|
|
455
|
+
**Quality Checklist:**
|
|
456
|
+
- [ ] Code fence is exactly ` ```mermaid `
|
|
457
|
+
- [ ] All state management tools are documented
|
|
458
|
+
- [ ] Offline/online paths are clearly distinguished
|
|
459
|
+
- [ ] State types are color coded consistently
|
|
460
|
+
- [ ] Sequence diagrams show timing and sync operations
|
|
461
|
+
- [ ] Cache layers are explicitly shown
|
|
462
|
+
- [ ] Decision trees have all paths covered
|
|
463
|
+
|
|
464
|
+
**Example (Mobile State with Offline):**
|
|
465
|
+
````markdown
|
|
466
|
+
```mermaid
|
|
467
|
+
sequenceDiagram
|
|
468
|
+
participant U as User
|
|
469
|
+
participant UI as Screen
|
|
470
|
+
participant Store as State Manager
|
|
471
|
+
participant Cache as Local Cache
|
|
472
|
+
participant API as API Service
|
|
473
|
+
participant BE as Backend
|
|
474
|
+
|
|
475
|
+
U->>UI: Open Product List
|
|
476
|
+
UI->>Store: Request products
|
|
477
|
+
Store->>Cache: Check local cache
|
|
478
|
+
|
|
479
|
+
alt Cache Hit (Offline Mode)
|
|
480
|
+
Cache-->>Store: Return cached data
|
|
481
|
+
Store-->>UI: Display cached products
|
|
482
|
+
UI-->>U: Show products (stale)
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
alt Online Mode
|
|
486
|
+
Store->>API: Fetch fresh products
|
|
487
|
+
API->>BE: GET /api/products
|
|
488
|
+
BE-->>API: 200 OK + data
|
|
489
|
+
API-->>Store: Return products
|
|
490
|
+
Store->>Cache: Update cache
|
|
491
|
+
Store-->>UI: Display fresh products
|
|
492
|
+
UI-->>U: Show products (fresh)
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
Note over Cache: Cache valid for 5min
|
|
496
|
+
```
|
|
497
|
+
````
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
### Testing Diagrams (testing.md)
|
|
502
|
+
|
|
503
|
+
**Diagram Type:** `graph TB`
|
|
504
|
+
|
|
505
|
+
**Requirements:**
|
|
506
|
+
1. Show testing pyramid (70/20/10 distribution)
|
|
507
|
+
2. Distinguish between device and emulator tests
|
|
508
|
+
3. Include platform-specific tests (iOS/Android)
|
|
509
|
+
4. Show speed/cost trade-offs
|
|
510
|
+
5. Include all test types (Unit, Integration, E2E, Static)
|
|
511
|
+
|
|
512
|
+
**Quality Checklist:**
|
|
513
|
+
- [ ] Code fence is exactly ` ```mermaid `
|
|
514
|
+
- [ ] Testing pyramid shows correct percentages
|
|
515
|
+
- [ ] Mobile-specific concerns are highlighted (devices, emulators)
|
|
516
|
+
- [ ] Platform-specific tests are distinguished (iOS vs Android)
|
|
517
|
+
- [ ] Speed/cost annotations are included
|
|
518
|
+
- [ ] Cross-platform testing strategy is clear
|
|
519
|
+
|
|
520
|
+
**Example (Mobile Testing Pyramid):**
|
|
521
|
+
````markdown
|
|
522
|
+
```mermaid
|
|
523
|
+
graph TB
|
|
524
|
+
subgraph "Mobile Testing Pyramid"
|
|
525
|
+
E2E["📱 E2E Tests (10%)<br/>Detox/Appium<br/>Slow, Expensive<br/>Full user flows on device"]
|
|
526
|
+
INT["🔗 Integration Tests (20%)<br/>Component + API<br/>Medium Speed<br/>Screen rendering + navigation"]
|
|
527
|
+
UNIT["⚡ Unit Tests (70%)<br/>Jest/XCTest<br/>Fast, Cheap<br/>Business logic, hooks, utilities"]
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
E2E --> INT
|
|
531
|
+
INT --> UNIT
|
|
532
|
+
|
|
533
|
+
style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
|
|
534
|
+
style INT fill:#fff4e6,stroke:#f57c00,stroke-width:2px
|
|
535
|
+
style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:3px
|
|
536
|
+
```
|
|
537
|
+
````
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
### Common Formatting Rules (ALL Mobile Diagrams)
|
|
542
|
+
|
|
543
|
+
**CRITICAL - Code Fence Syntax:**
|
|
544
|
+
```
|
|
545
|
+
✅ CORRECT: ```mermaid
|
|
546
|
+
❌ WRONG: ```Mermaid (capital M)
|
|
547
|
+
❌ WRONG: ``` mermaid (extra space)
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**Color Coding Standards (Mobile):**
|
|
551
|
+
- Root Navigator: `#e3f2fd` (very light blue)
|
|
552
|
+
- Tab Navigator: `#e1f5ff` (light blue)
|
|
553
|
+
- Stack Navigator: `#fff4e6` (light orange)
|
|
554
|
+
- Screens: default or specific colors
|
|
555
|
+
- Protected Routes: `#fce4ec` (light pink)
|
|
556
|
+
- Server State: `#e1f5ff` (light blue)
|
|
557
|
+
- Client State: `#fff4e6` (light orange)
|
|
558
|
+
- Local Storage: `#e8f5e9` (light green)
|
|
559
|
+
- Cache: `#f3e5f5` (light purple)
|
|
560
|
+
- E2E Tests: `#fce4ec` (light pink)
|
|
561
|
+
- Integration Tests: `#fff4e6` (light orange)
|
|
562
|
+
- Unit Tests: `#e8f5e9` (light green)
|
|
563
|
+
|
|
564
|
+
**Validation Steps:**
|
|
565
|
+
1. Test diagram at https://mermaid.live/ before saving
|
|
566
|
+
2. Verify all screen/component names match actual codebase
|
|
567
|
+
3. Check that arrows flow in logical direction (top-down, left-right)
|
|
568
|
+
4. Confirm colors are applied consistently
|
|
569
|
+
5. Ensure diagram is readable (not too crowded)
|
|
570
|
+
6. Verify platform-specific considerations are included
|
|
571
|
+
|
|
572
|
+
**When Updating Existing Diagrams:**
|
|
573
|
+
1. Read current diagram first
|
|
574
|
+
2. Identify added/removed/modified screens or components
|
|
575
|
+
3. Maintain existing styling and layout patterns
|
|
576
|
+
4. Update relationships based on code changes
|
|
577
|
+
5. Verify entire diagram still renders after changes
|
|
578
|
+
|
|
579
|
+
**Mobile-Specific Considerations:**
|
|
580
|
+
- Always show offline/online paths for state diagrams
|
|
581
|
+
- Include cache layers (AsyncStorage, MMKV, WatermelonDB, Realm)
|
|
582
|
+
- Distinguish between iOS and Android when platform-specific
|
|
583
|
+
- Show device vs emulator distinction in testing diagrams
|
|
584
|
+
- Include deep linking routes in navigation diagrams
|
|
585
|
+
- Highlight authentication flows and protected routes
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
5. **Error Handling:**
|
|
590
|
+
- If document doesn't exist, create it following template
|
|
591
|
+
- If analysis.json is corrupted, regenerate it
|
|
592
|
+
- If comparison fails, show error and suggest full Phase 0 re-run
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
## Example Execution
|
|
597
|
+
|
|
598
|
+
```
|
|
599
|
+
User: /flow-docs-sync
|
|
600
|
+
|
|
601
|
+
AI:
|
|
602
|
+
📊 CHANGES DETECTED:
|
|
603
|
+
|
|
604
|
+
🔴 Documents that require updating:
|
|
605
|
+
- docs/navigation.md (1 new screen: ProfileScreen)
|
|
606
|
+
- docs/permissions.md (new permission: Location)
|
|
607
|
+
|
|
608
|
+
✅ No changes: docs/state-management.md, docs/testing.md, ai-instructions.md
|
|
609
|
+
|
|
610
|
+
Update all detected documents? (Y/N)
|
|
611
|
+
|
|
612
|
+
User: Y
|
|
613
|
+
|
|
614
|
+
AI:
|
|
615
|
+
✅ DOCUMENTATION UPDATED:
|
|
616
|
+
|
|
617
|
+
📝 docs/navigation.md
|
|
618
|
+
- Added 1 new screen (ProfileScreen)
|
|
619
|
+
- Maintained all existing navigation documentation
|
|
620
|
+
|
|
621
|
+
📝 docs/permissions.md
|
|
622
|
+
- Added new permission (Location)
|
|
623
|
+
- Updated permission handling section
|
|
624
|
+
|
|
625
|
+
✅ analysis.json updated with new state
|
|
626
|
+
|
|
627
|
+
Documentation synchronized successfully.
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
**BEGIN EXECUTION when user runs `/flow-docs-sync`**
|
|
633
|
+
|
|
634
|
+
|