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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +791 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/fs-utils.d.ts +2 -0
  8. package/dist/fs-utils.d.ts.map +1 -0
  9. package/dist/fs-utils.js +46 -0
  10. package/dist/fs-utils.js.map +1 -0
  11. package/package.json +71 -0
  12. package/prompts/backend/flow-dev-feature.md +1318 -0
  13. package/prompts/backend/flow-dev-fix.md +903 -0
  14. package/prompts/backend/flow-dev-refactor.md +715 -0
  15. package/prompts/backend/flow-dev-review.md +401 -0
  16. package/prompts/backend/flow-dev-work.md +1129 -0
  17. package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
  18. package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
  19. package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
  20. package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
  21. package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
  22. package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
  23. package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
  24. package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
  25. package/prompts/backend/flow-docs-gen.md +820 -0
  26. package/prompts/backend/flow-docs-sync.md +526 -0
  27. package/prompts/backend/flow-project-init.md +248 -0
  28. package/prompts/backend/flow-project-roadmap.md +1159 -0
  29. package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
  30. package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
  31. package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
  32. package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
  33. package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
  34. package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
  35. package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
  36. package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
  37. package/prompts/frontend/flow-docs-gen.md +413 -0
  38. package/prompts/frontend/flow-docs-sync.md +561 -0
  39. package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
  40. package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
  41. package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
  42. package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
  43. package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
  44. package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
  45. package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
  46. package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
  47. package/prompts/mobile/flow-docs-gen.md +430 -0
  48. package/prompts/mobile/flow-docs-sync.md +634 -0
  49. package/templates/backend/.clauderules.template +111 -0
  50. package/templates/backend/.cursorrules.template +102 -0
  51. package/templates/backend/.env.example.template +122 -0
  52. package/templates/backend/README.template.md +200 -0
  53. package/templates/backend/ai-instructions.template.md +354 -0
  54. package/templates/backend/copilot-instructions.template.md +160 -0
  55. package/templates/backend/docs/api.template.md +251 -0
  56. package/templates/backend/docs/architecture.template.md +612 -0
  57. package/templates/backend/docs/business-flows.template.md +109 -0
  58. package/templates/backend/docs/code-standards.template.md +828 -0
  59. package/templates/backend/docs/contributing.template.md +163 -0
  60. package/templates/backend/docs/data-model.template.md +416 -0
  61. package/templates/backend/docs/operations.template.md +591 -0
  62. package/templates/backend/docs/testing.template.md +762 -0
  63. package/templates/backend/project-brief.template.md +176 -0
  64. package/templates/backend/specs/configuration.template.md +133 -0
  65. package/templates/backend/specs/security.template.md +422 -0
  66. package/templates/frontend/README.template.md +121 -0
  67. package/templates/frontend/ai-instructions.template.md +368 -0
  68. package/templates/frontend/docs/api-integration.template.md +390 -0
  69. package/templates/frontend/docs/components.template.md +567 -0
  70. package/templates/frontend/docs/error-handling.template.md +385 -0
  71. package/templates/frontend/docs/operations.template.md +123 -0
  72. package/templates/frontend/docs/performance.template.md +140 -0
  73. package/templates/frontend/docs/pwa.template.md +135 -0
  74. package/templates/frontend/docs/state-management.template.md +394 -0
  75. package/templates/frontend/docs/styling.template.md +779 -0
  76. package/templates/frontend/docs/testing.template.md +736 -0
  77. package/templates/frontend/project-brief.template.md +55 -0
  78. package/templates/frontend/specs/accessibility.template.md +111 -0
  79. package/templates/frontend/specs/configuration.template.md +520 -0
  80. package/templates/frontend/specs/security.template.md +197 -0
  81. package/templates/fullstack/README.template.md +282 -0
  82. package/templates/fullstack/ai-instructions.template.md +487 -0
  83. package/templates/fullstack/project-brief.template.md +197 -0
  84. package/templates/fullstack/specs/configuration.template.md +380 -0
  85. package/templates/mobile/AGENT.template.md +251 -0
  86. package/templates/mobile/README.template.md +195 -0
  87. package/templates/mobile/ai-instructions.template.md +221 -0
  88. package/templates/mobile/docs/app-store.template.md +163 -0
  89. package/templates/mobile/docs/architecture.template.md +100 -0
  90. package/templates/mobile/docs/native-features.template.md +137 -0
  91. package/templates/mobile/docs/navigation.template.md +81 -0
  92. package/templates/mobile/docs/offline-strategy.template.md +90 -0
  93. package/templates/mobile/docs/permissions.template.md +70 -0
  94. package/templates/mobile/docs/state-management.template.md +116 -0
  95. package/templates/mobile/docs/testing.template.md +146 -0
  96. package/templates/mobile/project-brief.template.md +97 -0
  97. package/templates/mobile/specs/build-configuration.template.md +116 -0
  98. package/templates/mobile/specs/deployment.template.md +114 -0
  99. package/templates/shared/AGENT.template.md +252 -0
@@ -0,0 +1,387 @@
1
+ # Phase 0: Context Discovery (Mobile)
2
+
3
+ **⚡ AUTOMATED ANALYSIS - Minimal User Input Required**
4
+
5
+ This phase automatically analyzes your existing mobile codebase to pre-populate answers for the bootstrap questionnaire.
6
+
7
+ ---
8
+
9
+ ## 🎯 Objective
10
+
11
+ Detect the current mobile stack, architecture patterns, and configuration from existing code to:
12
+
13
+ 1. **Skip redundant questions** - Don't ask what can be detected
14
+ 2. **Validate assumptions** - Confirm detected patterns with user
15
+ 3. **Save time** - Reduce questionnaire from ~100 min to ~50 min
16
+ 4. **Maintain accuracy** - User can override any detection
17
+
18
+ ---
19
+
20
+ ## 📋 Detection Layers (Progressive)
21
+
22
+ ### Layer 0: Cache Check (0-2 seconds)
23
+
24
+ Check if `.ai-flow/cache/mobile-context.json` exists and is fresh (<7 days old).
25
+
26
+ **If found:**
27
+ ```json
28
+ {
29
+ "platform": "iOS + Android",
30
+ "framework": "React Native",
31
+ "frameworkVersion": "0.72.0",
32
+ "typescript": true,
33
+ "navigation": "React Navigation",
34
+ "stateManagement": "Redux Toolkit",
35
+ "storage": "AsyncStorage",
36
+ "lastAnalyzed": "2025-01-20T10:30:00Z"
37
+ }
38
+ ```
39
+
40
+ **Action:** Ask user: "Found cached analysis from X days ago. Use it? (Y/n)"
41
+
42
+ **If yes:** Skip to validation step
43
+
44
+ **If no or cache doesn't exist:** Proceed to Layer 1
45
+
46
+ ---
47
+
48
+ ### Layer 1: Fast Metadata Scan (10-20 seconds)
49
+
50
+ **Purpose:** Detect framework, platform, build tool, TypeScript
51
+
52
+ #### Files to Check
53
+
54
+ 1. **package.json** (REQUIRED)
55
+ 2. **pubspec.yaml** (Flutter)
56
+ 3. **Podfile** (iOS - React Native)
57
+ 4. **build.gradle** (Android)
58
+ 5. **tsconfig.json** (TypeScript)
59
+ 6. **app.json / app.config.js** (React Native)
60
+
61
+ #### Detection Logic
62
+
63
+ ```typescript
64
+ // 1. Read package.json or pubspec.yaml
65
+ const pkg = await detectPackageFile();
66
+
67
+ // 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;
77
+
78
+ // 3. Detect Platform Support
79
+ const platforms = [];
80
+ if (await fs.exists('ios/')) platforms.push('iOS');
81
+ if (await fs.exists('android/')) platforms.push('Android');
82
+
83
+ // 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;
90
+
91
+ // 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;
100
+
101
+ // 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
+
112
+ // 7. Detect TypeScript/Dart
113
+ const typescript = await fs.exists('tsconfig.json');
114
+ const dart = await fs.exists('pubspec.yaml');
115
+
116
+ // 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;
128
+ ```
129
+
130
+ #### Layer 1 Output
131
+
132
+ ```
133
+ ✅ DETECTED:
134
+
135
+ Platform: iOS + Android
136
+ Framework: React Native 0.72.0
137
+ TypeScript: Yes
138
+ Navigation: React Navigation 6.0.0
139
+ State Management: Redux Toolkit 1.9.0
140
+ Storage: AsyncStorage 1.19.0
141
+ Testing: Jest + Detox
142
+
143
+ Continue to Layer 2 for structural analysis? (Y/n)
144
+ ```
145
+
146
+ ---
147
+
148
+ ### Layer 2: Structural Analysis (30-90 seconds)
149
+
150
+ **Purpose:** Analyze navigation structure, component organization, and architecture patterns
151
+
152
+ #### Files to Analyze
153
+
154
+ - **Navigation files:** `src/navigation/**`, `src/routes/**`, `lib/router/**`
155
+ - **Screen files:** `src/screens/**`, `src/pages/**`, `lib/presentation/pages/**`
156
+ - **Component files:** `src/components/**`, `lib/presentation/widgets/**`
157
+ - **Store files:** `src/store/**`, `lib/domain/**`
158
+
159
+ #### Detection Patterns
160
+
161
+ ```typescript
162
+ // 1. Navigation Pattern Detection
163
+ const navigationPattern = detectNavigationPattern(srcFiles);
164
+
165
+ 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
+
170
+ if (hasTab && hasStack) return 'Tab + Stack Navigation';
171
+ if (hasDrawer && hasStack) return 'Drawer + Stack Navigation';
172
+ if (hasStack) return 'Stack Navigation';
173
+ if (hasTab) return 'Tab Navigation';
174
+ return 'Unknown';
175
+ }
176
+
177
+ // 2. Architecture Pattern
178
+ const architecturePattern = detectArchitecture(srcFiles);
179
+
180
+ 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
+
186
+ if (hasClean) return 'Clean Architecture';
187
+ if (hasFeatures) return 'Feature-based';
188
+ if (hasDomains) return 'Domain-driven';
189
+ if (hasPresentation) return 'Layered (Presentation/Domain/Data)';
190
+ return 'Flat';
191
+ }
192
+
193
+ // 3. Component Organization
194
+ const componentPattern = detectComponentPattern(srcFiles);
195
+
196
+ function detectComponentPattern(files: string[]): string {
197
+ const hasAtomic = files.some(f =>
198
+ f.includes('/atoms/') || f.includes('/molecules/') || f.includes('/organisms/')
199
+ );
200
+ const hasScreens = files.some(f => f.includes('/screens/'));
201
+ const hasWidgets = files.some(f => f.includes('/widgets/'));
202
+
203
+ if (hasAtomic) return 'Atomic Design';
204
+ if (hasScreens && hasWidgets) return 'Screens + Widgets';
205
+ if (hasScreens) return 'Screens-based';
206
+ return 'Flat';
207
+ }
208
+ ```
209
+
210
+ #### Layer 2 Output
211
+
212
+ ```
213
+ ✅ ARCHITECTURE DETECTED:
214
+
215
+ Navigation Pattern: Tab + Stack Navigation
216
+ - Bottom tabs: 4 tabs
217
+ - Stack navigators: 8 screens
218
+
219
+ Architecture: Feature-based
220
+ - features/: 6 features
221
+ - Each feature: screens/, components/, hooks/, store/
222
+
223
+ Component Pattern: Screens + Components
224
+ - screens/: 12 screens
225
+ - components/: 45 components
226
+
227
+ Continue to Layer 3 for deep analysis? (Y/n)
228
+ ```
229
+
230
+ ---
231
+
232
+ ### Layer 3: Selective Deep Analysis (Optional, 60-120 seconds)
233
+
234
+ **Purpose:** Extract advanced patterns, permissions, and native integrations
235
+
236
+ **Only proceed if:**
237
+ - User confirms (not automatic)
238
+ - Project is large (>20 screens)
239
+ - Accuracy is critical
240
+
241
+ #### Advanced Detection
242
+
243
+ ```typescript
244
+ // 1. Permissions Detection
245
+ const permissions = detectPermissions(srcFiles, platformFiles);
246
+
247
+ function detectPermissions(srcFiles: string[], platformFiles: string[]): string[] {
248
+ const detected = [];
249
+
250
+ // Check Info.plist (iOS)
251
+ const infoPlist = platformFiles.find(f => f.includes('Info.plist'));
252
+ if (infoPlist) {
253
+ const content = fs.readFileSync(infoPlist, 'utf-8');
254
+ if (content.includes('NSCameraUsageDescription')) detected.push('Camera');
255
+ if (content.includes('NSLocationWhenInUseUsageDescription')) detected.push('Location');
256
+ if (content.includes('NSPhotoLibraryUsageDescription')) detected.push('Photo Library');
257
+ }
258
+
259
+ // Check AndroidManifest.xml (Android)
260
+ const manifest = platformFiles.find(f => f.includes('AndroidManifest.xml'));
261
+ if (manifest) {
262
+ const content = fs.readFileSync(manifest, 'utf-8');
263
+ if (content.includes('android.permission.CAMERA')) detected.push('Camera');
264
+ if (content.includes('android.permission.ACCESS_FINE_LOCATION')) detected.push('Location');
265
+ }
266
+
267
+ // Check code for permission requests
268
+ srcFiles.forEach(file => {
269
+ const content = fs.readFileSync(file, 'utf-8');
270
+ if (content.includes('requestPermission') || content.includes('Permissions.')) {
271
+ // Extract permission type from context
272
+ }
273
+ });
274
+
275
+ return detected;
276
+ }
277
+
278
+ // 2. Native Module Usage
279
+ const nativeModules = detectNativeModules(srcFiles);
280
+
281
+ function detectNativeModules(files: string[]): string[] {
282
+ const modules = [];
283
+
284
+ files.forEach(file => {
285
+ const content = fs.readFileSync(file, 'utf-8');
286
+ if (content.includes('react-native-camera')) modules.push('Camera');
287
+ if (content.includes('@react-native-async-storage')) modules.push('AsyncStorage');
288
+ if (content.includes('react-native-maps')) modules.push('Maps');
289
+ if (content.includes('@react-native-firebase')) modules.push('Firebase');
290
+ });
291
+
292
+ return modules;
293
+ }
294
+ ```
295
+
296
+ ---
297
+
298
+ ## ✅ Validation & Confirmation
299
+
300
+ ### Present Findings
301
+
302
+ After detection, show user a summary and ask for confirmation:
303
+
304
+ ```
305
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
306
+ 🔍 MOBILE STACK DETECTED
307
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
308
+
309
+ ✅ Platform: iOS + Android
310
+ ✅ Framework: React Native 0.72.0
311
+ ✅ TypeScript: Yes
312
+ ✅ Navigation: React Navigation 6.0.0 (Tab + Stack)
313
+ ✅ State Management: Redux Toolkit 1.9.0
314
+ ✅ Storage: AsyncStorage 1.19.0
315
+ ✅ Architecture: Feature-based
316
+ ✅ Testing: Jest + Detox
317
+
318
+ Is this correct? (Y/n)
319
+ ```
320
+
321
+ ### If User Says "Yes"
322
+
323
+ ```
324
+ ✅ Great! I'll use these detected values.
325
+
326
+ I'll still ask you questions for:
327
+ - Business requirements (Phase 1)
328
+ - Specific conventions and preferences
329
+ - Permissions and native features
330
+ - Store deployment strategy
331
+
332
+ This will reduce the questionnaire from ~100 min to ~50 min.
333
+
334
+ Proceed to Phase 1? (Y/n)
335
+ ```
336
+
337
+ ---
338
+
339
+ ## 💾 Cache Storage
340
+
341
+ Save detected context for future use:
342
+
343
+ ```json
344
+ {
345
+ "platform": "iOS + Android",
346
+ "framework": "React Native",
347
+ "frameworkVersion": "0.72.0",
348
+ "typescript": true,
349
+ "navigation": "React Navigation",
350
+ "navigationVersion": "6.0.0",
351
+ "navigationPattern": "Tab + Stack",
352
+ "stateManagement": "Redux Toolkit",
353
+ "storage": "AsyncStorage",
354
+ "architecture": "Feature-based",
355
+ "componentPattern": "Screens + Components",
356
+ "permissions": ["Camera", "Location"],
357
+ "nativeModules": ["Camera", "Maps", "Firebase"],
358
+ "unitTest": "Jest",
359
+ "e2eTest": "Detox",
360
+ "lastAnalyzed": "2025-01-20T10:30:00Z",
361
+ "projectPath": "/Users/username/my-mobile-app"
362
+ }
363
+ ```
364
+
365
+ **Cache invalidation:** 7 days or when package.json/pubspec.yaml is modified
366
+
367
+ ---
368
+
369
+ ## 🚀 Next Steps
370
+
371
+ After Phase 0 completes:
372
+
373
+ ```
374
+ ✅ Context analysis complete!
375
+
376
+ Next: Proceed to Phase 1 (Platform & Framework Selection)
377
+
378
+ Read: .ai-flow/prompts/mobile/flow-docs-gen-phase-1-platform.md
379
+ ```
380
+
381
+ ---
382
+
383
+ **Last Updated:** 2025-01-XX
384
+
385
+ **Version:** 1.4.0
386
+
387
+