ai-flow-dev 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +28 -40
  2. package/dist/cli.js +69 -47
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +5 -5
  5. package/prompts/backend/flow-build-phase-0.md +96 -84
  6. package/prompts/backend/flow-build-phase-1.md +10 -18
  7. package/prompts/backend/flow-build-phase-10.md +199 -583
  8. package/prompts/backend/flow-build-phase-2.md +152 -86
  9. package/prompts/backend/flow-build-phase-3.md +108 -68
  10. package/prompts/backend/flow-build-phase-4.md +5 -8
  11. package/prompts/backend/flow-build-phase-5.md +39 -12
  12. package/prompts/backend/flow-build-phase-6.md +29 -8
  13. package/prompts/backend/flow-build-phase-7.md +121 -41
  14. package/prompts/backend/flow-build-phase-8.md +28 -65
  15. package/prompts/backend/flow-build-phase-9.md +267 -1298
  16. package/prompts/backend/flow-build.md +881 -957
  17. package/prompts/backend/flow-dev-commit.md +27 -50
  18. package/prompts/backend/flow-dev-feature.md +1929 -2017
  19. package/prompts/backend/flow-dev-fix.md +936 -964
  20. package/prompts/backend/flow-dev-refactor.md +672 -701
  21. package/prompts/backend/flow-dev-review.md +356 -389
  22. package/prompts/backend/flow-dev-work.md +1066 -1118
  23. package/prompts/backend/flow-docs-sync.md +31 -210
  24. package/prompts/frontend/flow-build-phase-0.md +503 -484
  25. package/prompts/frontend/flow-build-phase-1.md +445 -433
  26. package/prompts/frontend/flow-build-phase-2.md +910 -957
  27. package/prompts/frontend/flow-build-phase-3.md +692 -664
  28. package/prompts/frontend/flow-build-phase-4.md +478 -463
  29. package/prompts/frontend/flow-build-phase-5.md +488 -467
  30. package/prompts/frontend/flow-build-phase-6.md +571 -550
  31. package/prompts/frontend/flow-build-phase-7.md +560 -592
  32. package/prompts/frontend/flow-build-phase-8.md +17 -42
  33. package/prompts/frontend/flow-build.md +457 -503
  34. package/prompts/frontend/flow-docs-sync.md +24 -45
  35. package/prompts/mobile/flow-build-phase-0.md +104 -97
  36. package/prompts/mobile/flow-build-phase-1.md +137 -122
  37. package/prompts/mobile/flow-build-phase-2.md +123 -130
  38. package/prompts/mobile/flow-build-phase-3.md +144 -149
  39. package/prompts/mobile/flow-build-phase-4.md +140 -132
  40. package/prompts/mobile/flow-build-phase-5.md +70 -70
  41. package/prompts/mobile/flow-build-phase-6.md +136 -134
  42. package/prompts/mobile/flow-build-phase-7.md +24 -58
  43. package/prompts/mobile/flow-build-phase-8.md +17 -42
  44. package/prompts/mobile/flow-build.md +47 -97
  45. package/prompts/mobile/flow-docs-sync.md +23 -42
  46. package/prompts/shared/mermaid-guidelines.md +106 -0
  47. package/prompts/shared/scope-levels.md +126 -0
  48. package/prompts/shared/story-points.md +65 -0
  49. package/prompts/shared/task-format.md +86 -0
  50. package/templates/AGENT.template.md +194 -15
  51. package/templates/backend/README.template.md +2 -32
  52. package/templates/backend/ai-instructions.template.md +2 -32
  53. package/templates/backend/copilot-instructions.template.md +2 -22
  54. package/templates/backend/docs/api.template.md +89 -20
  55. package/templates/backend/docs/architecture.template.md +165 -53
  56. package/templates/backend/docs/business-flows.template.md +7 -14
  57. package/templates/backend/docs/code-standards.template.md +2 -38
  58. package/templates/backend/docs/contributing.template.md +2 -16
  59. package/templates/backend/docs/data-model.template.md +125 -21
  60. package/templates/backend/docs/operations.template.md +179 -50
  61. package/templates/backend/docs/testing.template.md +2 -42
  62. package/templates/backend/project-brief.template.md +2 -28
  63. package/templates/backend/specs/configuration.template.md +2 -14
  64. package/templates/backend/specs/security.template.md +2 -32
  65. package/templates/frontend/README.template.md +2 -18
  66. package/templates/frontend/ai-instructions.template.md +2 -20
  67. package/templates/frontend/docs/api-integration.template.md +12 -30
  68. package/templates/frontend/docs/components.template.md +2 -28
  69. package/templates/frontend/docs/error-handling.template.md +11 -27
  70. package/templates/frontend/docs/operations.template.md +8 -18
  71. package/templates/frontend/docs/performance.template.md +8 -18
  72. package/templates/frontend/docs/pwa.template.md +8 -18
  73. package/templates/frontend/docs/state-management.template.md +2 -28
  74. package/templates/frontend/docs/styling.template.md +2 -26
  75. package/templates/frontend/docs/testing.template.md +2 -28
  76. package/templates/frontend/project-brief.template.md +2 -16
  77. package/templates/frontend/specs/accessibility.template.md +8 -18
  78. package/templates/frontend/specs/configuration.template.md +2 -24
  79. package/templates/frontend/specs/security.template.md +10 -24
  80. package/templates/fullstack/README.template.md +17 -47
  81. package/templates/fullstack/ai-instructions.template.md +17 -45
  82. package/templates/fullstack/project-brief.template.md +16 -42
  83. package/templates/fullstack/specs/configuration.template.md +16 -42
  84. package/templates/mobile/README.template.md +11 -29
  85. package/templates/mobile/ai-instructions.template.md +11 -27
  86. package/templates/mobile/docs/app-store.template.md +11 -29
  87. package/templates/mobile/docs/architecture.template.md +14 -38
  88. package/templates/mobile/docs/native-features.template.md +16 -44
  89. package/templates/mobile/docs/navigation.template.md +9 -23
  90. package/templates/mobile/docs/offline-strategy.template.md +10 -26
  91. package/templates/mobile/docs/permissions.template.md +9 -23
  92. package/templates/mobile/docs/state-management.template.md +12 -32
  93. package/templates/mobile/docs/testing.template.md +14 -38
  94. package/templates/mobile/project-brief.template.md +12 -30
  95. package/templates/mobile/specs/build-configuration.template.md +10 -26
  96. package/templates/mobile/specs/deployment.template.md +9 -23
@@ -3,28 +3,24 @@
3
3
  **YOU ARE AN EXPERT FRONTEND ARCHITECT AND DOCUMENTATION SPECIALIST.**
4
4
 
5
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
-
6
+ ---
9
7
  ## Command: `/flow-docs-sync`
10
8
 
11
9
  ### Objective
12
10
 
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
-
11
+ Detect changes in the frontend codebase compared to the last documented state (stored in `.ai-flow/cache/docs-analysis.json`) and update all affected documentation files automatically.
12
+ ---
17
13
  ## Execution Flow
18
14
 
19
15
  ### Step 1: Check for Analysis File
20
16
 
21
17
  ```
22
- First, check if `.ai-flow/analysis.json` exists:
18
+ First, check if `.ai-flow/cache/docs-analysis.json` exists:
23
19
 
24
20
  - ✅ If exists → Proceed to Step 2 (Compare Changes)
25
21
  - ❌ If NOT exists → Execute full Phase 0 analysis first:
26
22
  - Run complete frontend code analysis (as described in Phase 0)
27
- - Create `.ai-flow/analysis.json` with current state
23
+ - Create `.ai-flow/cache/docs-analysis.json` with current state
28
24
  - Then proceed to Step 2
29
25
  ```
30
26
 
@@ -45,7 +41,7 @@ First, check if `.ai-flow/analysis.json` exists:
45
41
 
46
42
  2. **Compare with Previous State:**
47
43
 
48
- - Load `.ai-flow/analysis.json`
44
+ - Load `.ai-flow/cache/docs-analysis.json`
49
45
  - Compare current state vs previous state
50
46
  - Detect changes in:
51
47
  - **Components:** New, modified, or deleted components
@@ -149,9 +145,9 @@ No updates required.
149
145
  - Add new test examples if patterns changed
150
146
  - Maintain existing testing strategy
151
147
 
152
- 2. **Update `analysis.json`:**
148
+ 2. **Update `docs-analysis.json`:**
153
149
 
154
- - Save current state to `.ai-flow/analysis.json`
150
+ - Save current state to `.ai-flow/cache/docs-analysis.json`
155
151
  - Update timestamp
156
152
  - Include all detected changes in metadata
157
153
 
@@ -176,7 +172,7 @@ No updates required.
176
172
  - Added dependency "@tanstack/react-query"
177
173
  - Updated tools section
178
174
 
179
- ✅ analysis.json updated with new state
175
+ docs-analysis.json updated with new state
180
176
  ```
181
177
 
182
178
  ### Step 5: Handle Cancellation
@@ -186,9 +182,7 @@ No updates required.
186
182
  ```
187
183
  Update cancelled. Run `/flow-docs-sync` when you're ready to update the documentation.
188
184
  ```
189
-
190
- ---
191
-
185
+ ---
192
186
  ## Change Detection Rules
193
187
 
194
188
  ### Components Detection
@@ -280,9 +274,7 @@ Update cancelled. Run `/flow-docs-sync` when you're ready to update the document
280
274
 
281
275
  - Add new variables to configuration spec
282
276
  - Maintain existing variables
283
-
284
- ---
285
-
277
+ ---
286
278
  ## Important Rules
287
279
 
288
280
  1. **Incremental Updates Only:**
@@ -299,7 +291,7 @@ Update cancelled. Run `/flow-docs-sync` when you're ready to update the document
299
291
 
300
292
  3. **Update Analysis File:**
301
293
 
302
- - Always update `.ai-flow/analysis.json` after document updates
294
+ - Always update `.ai-flow/cache/docs-analysis.json` after document updates
303
295
  - Include timestamp and change summary
304
296
  - Save complete current state for next comparison
305
297
 
@@ -308,9 +300,7 @@ Update cancelled. Run `/flow-docs-sync` when you're ready to update the document
308
300
  - Regenerate component architecture diagrams when structure changes
309
301
  - Regenerate architecture diagrams when structure changes
310
302
  - Use mermaid format for all diagrams
311
-
312
- ---
313
-
303
+ ---
314
304
  ## 📊 FRONTEND DIAGRAM REGENERATION GUIDELINES
315
305
 
316
306
  When regenerating frontend diagrams, follow these **critical** formatting rules:
@@ -364,9 +354,7 @@ graph TD
364
354
  style Btn fill:#fce4ec
365
355
  ```
366
356
  ````
367
-
368
- ---
369
-
357
+ ---
370
358
  ### State Management Diagrams (state-management.md)
371
359
 
372
360
  **Diagram Types:** `graph LR`, `sequenceDiagram`, `graph TD`
@@ -410,9 +398,7 @@ sequenceDiagram
410
398
  Component-->>User: UI Updated
411
399
  ```
412
400
  ````
413
-
414
- ---
415
-
401
+ ---
416
402
  ### Routing Diagrams (architecture.md or routing.md)
417
403
 
418
404
  **Diagram Type:** `graph TD`
@@ -431,9 +417,7 @@ sequenceDiagram
431
417
  - [ ] Nested routes show parent-child relationships
432
418
  - [ ] Route parameters are documented
433
419
  - [ ] Diagram matches actual router configuration
434
-
435
- ---
436
-
420
+ ---
437
421
  ### Application Architecture Diagram (architecture.md)
438
422
 
439
423
  **Diagram Type:** `graph TB`
@@ -474,9 +458,7 @@ graph TB
474
458
  ````
475
459
 
476
460
  **Use for:** System architecture overview, integration documentation, onboarding
477
-
478
- ---
479
-
461
+ ---
480
462
  ### Common Formatting Rules (ALL Frontend Diagrams)
481
463
 
482
464
  **CRITICAL - Code Fence Syntax:**
@@ -510,16 +492,12 @@ graph TB
510
492
  3. Maintain existing styling and layout patterns
511
493
  4. Update relationships based on code changes
512
494
  5. Verify entire diagram still renders after changes
513
-
514
- ---
515
-
495
+ ---
516
496
  5. **Error Handling:**
517
497
  - If document doesn't exist, create it following template
518
- - If analysis.json is corrupted, regenerate it
498
+ - If docs-analysis.json is corrupted, regenerate it
519
499
  - If comparison fails, show error and suggest full Phase 0 re-run
520
-
521
- ---
522
-
500
+ ---
523
501
  ## Example Execution
524
502
 
525
503
  ```
@@ -549,14 +527,15 @@ AI:
549
527
  - Added new Zustand store (useCartStore)
550
528
  - Updated state management patterns section
551
529
 
552
- ✅ analysis.json updated with new state
530
+ docs-analysis.json updated with new state
553
531
 
554
532
  Documentation synchronized successfully.
555
533
  ```
534
+ ---
535
+ **BEGIN EXECUTION when user runs `/flow-docs-sync`**
536
+
556
537
 
557
- ---
558
538
 
559
- **BEGIN EXECUTION when user runs `/flow-docs-sync`**
560
539
 
561
540
 
562
541
 
@@ -3,9 +3,7 @@
3
3
  **⚡ AUTOMATED ANALYSIS - Minimal User Input Required**
4
4
 
5
5
  This phase automatically analyzes your existing mobile codebase to pre-populate answers for the build questionnaire.
6
-
7
- ---
8
-
6
+ ---
9
7
  ## 🎯 Objective
10
8
 
11
9
  Detect the current mobile stack, architecture patterns, and configuration from existing code to:
@@ -14,9 +12,7 @@ Detect the current mobile stack, architecture patterns, and configuration from e
14
12
  2. **Validate assumptions** - Confirm detected patterns with user
15
13
  3. **Save time** - Reduce questionnaire from ~100 min to ~50 min
16
14
  4. **Maintain accuracy** - User can override any detection
17
-
18
- ---
19
-
15
+ ---
20
16
  ## 📋 Detection Layers (Progressive)
21
17
 
22
18
  ### Layer 0: Cache Check (0-2 seconds)
@@ -24,6 +20,7 @@ Detect the current mobile stack, architecture patterns, and configuration from e
24
20
  Check if `.ai-flow/cache/mobile-context.json` exists and is fresh (<7 days old).
25
21
 
26
22
  **If found:**
23
+
27
24
  ```json
28
25
  {
29
26
  "platform": "iOS + Android",
@@ -42,9 +39,7 @@ Check if `.ai-flow/cache/mobile-context.json` exists and is fresh (<7 days old).
42
39
  **If yes:** Skip to validation step
43
40
 
44
41
  **If no or cache doesn't exist:** Proceed to Layer 1
45
-
46
- ---
47
-
42
+ ---
48
43
  ### Layer 1: Fast Metadata Scan (10-20 seconds)
49
44
 
50
45
  **Purpose:** Detect framework, platform, build tool, TypeScript
@@ -65,15 +60,21 @@ Check if `.ai-flow/cache/mobile-context.json` exists and is fresh (<7 days old).
65
60
  const pkg = await detectPackageFile();
66
61
 
67
62
  // 2. Detect Mobile Framework
68
- const framework =
69
- pkg.dependencies?.['react-native'] ? 'React Native' :
70
- await fs.exists('pubspec.yaml') ? 'Flutter' :
71
- await fs.exists('ios/') && await fs.exists('android/') ? 'Native (iOS + Android)' :
72
- await fs.exists('ios/') ? 'Native iOS (Swift)' :
73
- await fs.exists('android/') ? 'Native Android (Kotlin)' :
74
- pkg.dependencies?.['@ionic/core'] ? 'Ionic' :
75
- pkg.dependencies?.['@capacitor/core'] ? 'Capacitor' :
76
- null;
63
+ const framework = pkg.dependencies?.['react-native']
64
+ ? 'React Native'
65
+ : (await fs.exists('pubspec.yaml'))
66
+ ? 'Flutter'
67
+ : (await fs.exists('ios/')) && (await fs.exists('android/'))
68
+ ? 'Native (iOS + Android)'
69
+ : (await fs.exists('ios/'))
70
+ ? 'Native iOS (Swift)'
71
+ : (await fs.exists('android/'))
72
+ ? 'Native Android (Kotlin)'
73
+ : pkg.dependencies?.['@ionic/core']
74
+ ? 'Ionic'
75
+ : pkg.dependencies?.['@capacitor/core']
76
+ ? 'Capacitor'
77
+ : null;
77
78
 
78
79
  // 3. Detect Platform Support
79
80
  const platforms = [];
@@ -81,50 +82,68 @@ if (await fs.exists('ios/')) platforms.push('iOS');
81
82
  if (await fs.exists('android/')) platforms.push('Android');
82
83
 
83
84
  // 4. Detect Navigation Library
84
- const navigation =
85
- pkg.dependencies?.['@react-navigation/native'] ? 'React Navigation' :
86
- pkg.dependencies?.['react-native-navigation'] ? 'React Native Navigation' :
87
- pkg.dependencies?.['go_router'] ? 'GoRouter' :
88
- pkg.dependencies?.['auto_route'] ? 'AutoRoute' :
89
- null;
85
+ const navigation = pkg.dependencies?.['@react-navigation/native']
86
+ ? 'React Navigation'
87
+ : pkg.dependencies?.['react-native-navigation']
88
+ ? 'React Native Navigation'
89
+ : pkg.dependencies?.['go_router']
90
+ ? 'GoRouter'
91
+ : pkg.dependencies?.['auto_route']
92
+ ? 'AutoRoute'
93
+ : null;
90
94
 
91
95
  // 5. Detect State Management
92
- const stateManagement =
93
- pkg.dependencies?.['@reduxjs/toolkit'] ? 'Redux Toolkit' :
94
- pkg.dependencies?.zustand ? 'Zustand' :
95
- pkg.dependencies?.mobx ? 'MobX' :
96
- pkg.dependencies?.provider ? 'Provider' :
97
- pkg.dependencies?.['flutter_riverpod'] ? 'Riverpod' :
98
- pkg.dependencies?.['flutter_bloc'] ? 'Bloc' :
99
- null;
96
+ const stateManagement = pkg.dependencies?.['@reduxjs/toolkit']
97
+ ? 'Redux Toolkit'
98
+ : pkg.dependencies?.zustand
99
+ ? 'Zustand'
100
+ : pkg.dependencies?.mobx
101
+ ? 'MobX'
102
+ : pkg.dependencies?.provider
103
+ ? 'Provider'
104
+ : pkg.dependencies?.['flutter_riverpod']
105
+ ? 'Riverpod'
106
+ : pkg.dependencies?.['flutter_bloc']
107
+ ? 'Bloc'
108
+ : null;
100
109
 
101
110
  // 6. Detect Storage Solution
102
- const storage =
103
- pkg.dependencies?.['@react-native-async-storage/async-storage'] ? 'AsyncStorage' :
104
- pkg.dependencies?.['react-native-mmkv'] ? 'MMKV' :
105
- pkg.dependencies?.['@nozbe/watermelondb'] ? 'WatermelonDB' :
106
- pkg.dependencies?.realm ? 'Realm' :
107
- pkg.dependencies?.hive ? 'Hive' :
108
- await fs.exists('ios/DataModel.xcdatamodeld') ? 'Core Data' :
109
- await fs.exists('android/app/src/main/java/**/RoomDatabase.kt') ? 'Room' :
110
- null;
111
+ const storage = pkg.dependencies?.['@react-native-async-storage/async-storage']
112
+ ? 'AsyncStorage'
113
+ : pkg.dependencies?.['react-native-mmkv']
114
+ ? 'MMKV'
115
+ : pkg.dependencies?.['@nozbe/watermelondb']
116
+ ? 'WatermelonDB'
117
+ : pkg.dependencies?.realm
118
+ ? 'Realm'
119
+ : pkg.dependencies?.hive
120
+ ? 'Hive'
121
+ : (await fs.exists('ios/DataModel.xcdatamodeld'))
122
+ ? 'Core Data'
123
+ : (await fs.exists('android/app/src/main/java/**/RoomDatabase.kt'))
124
+ ? 'Room'
125
+ : null;
111
126
 
112
127
  // 7. Detect TypeScript/Dart
113
128
  const typescript = await fs.exists('tsconfig.json');
114
129
  const dart = await fs.exists('pubspec.yaml');
115
130
 
116
131
  // 8. Detect Testing Framework
117
- const unitTest =
118
- pkg.devDependencies?.jest ? 'Jest' :
119
- pkg.devDependencies?.vitest ? 'Vitest' :
120
- await fs.exists('test/') && dart ? 'Flutter Test' :
121
- null;
122
-
123
- const e2eTest =
124
- pkg.devDependencies?.['detox'] ? 'Detox' :
125
- pkg.devDependencies?.['@maestrohq/cli'] ? 'Maestro' :
126
- pkg.devDependencies?.appium ? 'Appium' :
127
- null;
132
+ const unitTest = pkg.devDependencies?.jest
133
+ ? 'Jest'
134
+ : pkg.devDependencies?.vitest
135
+ ? 'Vitest'
136
+ : (await fs.exists('test/')) && dart
137
+ ? 'Flutter Test'
138
+ : null;
139
+
140
+ const e2eTest = pkg.devDependencies?.['detox']
141
+ ? 'Detox'
142
+ : pkg.devDependencies?.['@maestrohq/cli']
143
+ ? 'Maestro'
144
+ : pkg.devDependencies?.appium
145
+ ? 'Appium'
146
+ : null;
128
147
  ```
129
148
 
130
149
  #### Layer 1 Output
@@ -142,9 +161,7 @@ Testing: Jest + Detox
142
161
 
143
162
  Continue to Layer 2 for structural analysis? (Y/n)
144
163
  ```
145
-
146
- ---
147
-
164
+ ---
148
165
  ### Layer 2: Structural Analysis (30-90 seconds)
149
166
 
150
167
  **Purpose:** Analyze navigation structure, component organization, and architecture patterns
@@ -163,10 +180,10 @@ Continue to Layer 2 for structural analysis? (Y/n)
163
180
  const navigationPattern = detectNavigationPattern(srcFiles);
164
181
 
165
182
  function detectNavigationPattern(files: string[]): string {
166
- const hasStack = files.some(f => f.includes('Stack') || f.includes('createStackNavigator'));
167
- const hasTab = files.some(f => f.includes('Tab') || f.includes('createBottomTabNavigator'));
168
- const hasDrawer = files.some(f => f.includes('Drawer') || f.includes('createDrawerNavigator'));
169
-
183
+ const hasStack = files.some((f) => f.includes('Stack') || f.includes('createStackNavigator'));
184
+ const hasTab = files.some((f) => f.includes('Tab') || f.includes('createBottomTabNavigator'));
185
+ const hasDrawer = files.some((f) => f.includes('Drawer') || f.includes('createDrawerNavigator'));
186
+
170
187
  if (hasTab && hasStack) return 'Tab + Stack Navigation';
171
188
  if (hasDrawer && hasStack) return 'Drawer + Stack Navigation';
172
189
  if (hasStack) return 'Stack Navigation';
@@ -178,11 +195,11 @@ function detectNavigationPattern(files: string[]): string {
178
195
  const architecturePattern = detectArchitecture(srcFiles);
179
196
 
180
197
  function detectArchitecture(files: string[]): string {
181
- const hasFeatures = files.some(f => f.includes('/features/'));
182
- const hasDomains = files.some(f => f.includes('/domain/'));
183
- const hasPresentation = files.some(f => f.includes('/presentation/'));
184
- const hasClean = files.some(f => f.includes('/data/') && f.includes('/domain/'));
185
-
198
+ const hasFeatures = files.some((f) => f.includes('/features/'));
199
+ const hasDomains = files.some((f) => f.includes('/domain/'));
200
+ const hasPresentation = files.some((f) => f.includes('/presentation/'));
201
+ const hasClean = files.some((f) => f.includes('/data/') && f.includes('/domain/'));
202
+
186
203
  if (hasClean) return 'Clean Architecture';
187
204
  if (hasFeatures) return 'Feature-based';
188
205
  if (hasDomains) return 'Domain-driven';
@@ -194,12 +211,12 @@ function detectArchitecture(files: string[]): string {
194
211
  const componentPattern = detectComponentPattern(srcFiles);
195
212
 
196
213
  function detectComponentPattern(files: string[]): string {
197
- const hasAtomic = files.some(f =>
198
- f.includes('/atoms/') || f.includes('/molecules/') || f.includes('/organisms/')
214
+ const hasAtomic = files.some(
215
+ (f) => f.includes('/atoms/') || f.includes('/molecules/') || f.includes('/organisms/')
199
216
  );
200
- const hasScreens = files.some(f => f.includes('/screens/'));
201
- const hasWidgets = files.some(f => f.includes('/widgets/'));
202
-
217
+ const hasScreens = files.some((f) => f.includes('/screens/'));
218
+ const hasWidgets = files.some((f) => f.includes('/widgets/'));
219
+
203
220
  if (hasAtomic) return 'Atomic Design';
204
221
  if (hasScreens && hasWidgets) return 'Screens + Widgets';
205
222
  if (hasScreens) return 'Screens-based';
@@ -226,14 +243,13 @@ Component Pattern: Screens + Components
226
243
 
227
244
  Continue to Layer 3 for deep analysis? (Y/n)
228
245
  ```
229
-
230
- ---
231
-
246
+ ---
232
247
  ### Layer 3: Selective Deep Analysis (Optional, 60-120 seconds)
233
248
 
234
249
  **Purpose:** Extract advanced patterns, permissions, and native integrations
235
250
 
236
251
  **Only proceed if:**
252
+
237
253
  - User confirms (not automatic)
238
254
  - Project is large (>20 screens)
239
255
  - Accuracy is critical
@@ -246,32 +262,32 @@ const permissions = detectPermissions(srcFiles, platformFiles);
246
262
 
247
263
  function detectPermissions(srcFiles: string[], platformFiles: string[]): string[] {
248
264
  const detected = [];
249
-
265
+
250
266
  // Check Info.plist (iOS)
251
- const infoPlist = platformFiles.find(f => f.includes('Info.plist'));
267
+ const infoPlist = platformFiles.find((f) => f.includes('Info.plist'));
252
268
  if (infoPlist) {
253
269
  const content = fs.readFileSync(infoPlist, 'utf-8');
254
270
  if (content.includes('NSCameraUsageDescription')) detected.push('Camera');
255
271
  if (content.includes('NSLocationWhenInUseUsageDescription')) detected.push('Location');
256
272
  if (content.includes('NSPhotoLibraryUsageDescription')) detected.push('Photo Library');
257
273
  }
258
-
274
+
259
275
  // Check AndroidManifest.xml (Android)
260
- const manifest = platformFiles.find(f => f.includes('AndroidManifest.xml'));
276
+ const manifest = platformFiles.find((f) => f.includes('AndroidManifest.xml'));
261
277
  if (manifest) {
262
278
  const content = fs.readFileSync(manifest, 'utf-8');
263
279
  if (content.includes('android.permission.CAMERA')) detected.push('Camera');
264
280
  if (content.includes('android.permission.ACCESS_FINE_LOCATION')) detected.push('Location');
265
281
  }
266
-
282
+
267
283
  // Check code for permission requests
268
- srcFiles.forEach(file => {
284
+ srcFiles.forEach((file) => {
269
285
  const content = fs.readFileSync(file, 'utf-8');
270
286
  if (content.includes('requestPermission') || content.includes('Permissions.')) {
271
287
  // Extract permission type from context
272
288
  }
273
289
  });
274
-
290
+
275
291
  return detected;
276
292
  }
277
293
 
@@ -280,21 +296,19 @@ const nativeModules = detectNativeModules(srcFiles);
280
296
 
281
297
  function detectNativeModules(files: string[]): string[] {
282
298
  const modules = [];
283
-
284
- files.forEach(file => {
299
+
300
+ files.forEach((file) => {
285
301
  const content = fs.readFileSync(file, 'utf-8');
286
302
  if (content.includes('react-native-camera')) modules.push('Camera');
287
303
  if (content.includes('@react-native-async-storage')) modules.push('AsyncStorage');
288
304
  if (content.includes('react-native-maps')) modules.push('Maps');
289
305
  if (content.includes('@react-native-firebase')) modules.push('Firebase');
290
306
  });
291
-
307
+
292
308
  return modules;
293
309
  }
294
310
  ```
295
-
296
- ---
297
-
311
+ ---
298
312
  ## ✅ Validation & Confirmation
299
313
 
300
314
  ### Present Findings
@@ -302,10 +316,9 @@ function detectNativeModules(files: string[]): string[] {
302
316
  After detection, show user a summary and ask for confirmation:
303
317
 
304
318
  ```
305
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
319
+ ---
306
320
  🔍 MOBILE STACK DETECTED
307
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
308
-
321
+ ---
309
322
  ✅ Platform: iOS + Android
310
323
  ✅ Framework: React Native 0.72.0
311
324
  ✅ TypeScript: Yes
@@ -333,9 +346,7 @@ This will reduce the questionnaire from ~100 min to ~50 min.
333
346
 
334
347
  Proceed to Phase 1? (Y/n)
335
348
  ```
336
-
337
- ---
338
-
349
+ ---
339
350
  ## 💾 Cache Storage
340
351
 
341
352
  Save detected context for future use:
@@ -363,9 +374,7 @@ Save detected context for future use:
363
374
  ```
364
375
 
365
376
  **Cache invalidation:** 7 days or when package.json/pubspec.yaml is modified
366
-
367
- ---
368
-
377
+ ---
369
378
  ## 🚀 Next Steps
370
379
 
371
380
  After Phase 0 completes:
@@ -377,9 +386,7 @@ Next: Proceed to Phase 1 (Platform & Framework Selection)
377
386
 
378
387
  Read: .ai-flow/prompts/mobile/flow-build-phase-1-platform.md
379
388
  ```
380
-
381
- ---
382
-
389
+ ---
383
390
  **Last Updated:** 2025-01-XX
384
391
 
385
392
  **Version:** 1.4.0