ai-flow-dev 2.8.2 → 2.9.0

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.
@@ -3,16 +3,20 @@
3
3
  > **Order for this phase:** ALWAYS executed FIRST if an existing project is detected. Skip ONLY for new projects.
4
4
 
5
5
  > **📌 Scope-based behavior:**
6
+ >
6
7
  > - **Interactive Mode:** Ask user for permission to scan files layer by layer.
7
8
  > - **Autonomous Mode:** Scan all layers automatically and present the final report.
8
9
 
9
10
  ### Objective
11
+
10
12
  Efficiently analyze existing projects using a **layered, incremental approach**.
11
13
 
12
14
  ---
13
15
 
14
16
  ## 🚫 Critical Exclusion Rules
17
+
15
18
  To avoid false-positive detections, **IGNORE** the following folders and files during all detection steps:
19
+
16
20
  - `.ai-flow/work/` (contains active development tasks)
17
21
  - `.ai-flow/archive/` (contains completed tasks)
18
22
  - `.agent/` (contains AI workflows)
@@ -37,11 +41,13 @@ Proceed to Layer 1.
37
41
  ---
38
42
 
39
43
  // turbo
44
+
40
45
  ## ⚡ Layer 1: Fast Metadata Scan (10-20 seconds)
41
46
 
42
47
  **Purpose:** Detect framework, language, build tool, and existing AI configurations.
43
48
 
44
49
  ⭐ **Context Links:**
50
+
45
51
  - Node.js: [package.json](file:///package.json)
46
52
  - Python: [requirements.txt](file:///requirements.txt) | [pyproject.toml](file:///pyproject.toml)
47
53
  - PHP: [composer.json](file:///composer.json)
@@ -49,9 +55,11 @@ Proceed to Layer 1.
49
55
  - Java: [pom.xml](file:///pom.xml) | [build.gradle](file:///build.gradle)
50
56
 
51
57
  ### 0.1.1 Universal Tech Stack Detection
58
+
52
59
  **Action:** Use your internal knowledge to detect the language and framework by scanning the root configuration files (package.json, pyproject.toml, etc.).
53
60
 
54
61
  **Detect (but don't be limited to):**
62
+
55
63
  - **Node.js:** NestJS, Express, Fastify, etc.
56
64
  - **Python:** FastAPI, Django, Flask, etc.
57
65
  - **PHP:** Laravel, Symfony, etc.
@@ -60,10 +68,12 @@ Proceed to Layer 1.
60
68
  - **C#/.NET, Ruby, Rust, Elixir.**
61
69
 
62
70
  ### 0.1.2 Find AI & Documentation
71
+
63
72
  - Find existing AI configs (`AGENT.md`, `.cursorrules`, etc.)
64
73
  - Scan for `README.md` and existing `docs/`.
65
74
 
66
75
  ### Layer 1 Output
76
+
67
77
  Show a summary of detected Name, Language, Framework, ORM, and Documentation files.
68
78
 
69
79
  ---
@@ -73,11 +83,13 @@ Show a summary of detected Name, Language, Framework, ORM, and Documentation fil
73
83
  **Purpose:** Analyze directory organization and architecture patterns without reading code line-by-line.
74
84
 
75
85
  ### 0.2.1 Pattern Detection
86
+
76
87
  1. **Identify Pattern:** Feature-based, Layer-based, Modular Monolith, or Hybrid.
77
88
  2. **Entity Detection:** Scan for Schema/Entity files based on the detected ORM (Prisma, TypeORM, Django Models, etc.).
78
89
  3. **Maturity Check:** Assess documentation and test coverage ratio.
79
90
 
80
91
  ### Layer 2 Output
92
+
81
93
  Summary of Architecture Pattern, Code Structure counts (Controllers, Services, etc.), and Recommended Build Scope (MVP/Production/Enterprise).
82
94
 
83
95
  ---
@@ -87,11 +99,13 @@ Summary of Architecture Pattern, Code Structure counts (Controllers, Services, e
87
99
  **Purpose:** Read and parse representative code files for detailed insights into API endpoints, data relationships, and security patterns.
88
100
 
89
101
  ### 0.3.1 Areas of Analysis
102
+
90
103
  - **API Endpoints:** Parse routes/controllers.
91
104
  - **Data Model:** Map entity relationships.
92
105
  - **Security:** Detect auth patterns (JWT, OAuth), validation (Zod, Pydantic), and middleware.
93
106
 
94
107
  ### 0.3.2 Sampling Strategy
108
+
95
109
  Use stratified sampling to read only the most relevant files (e.g., core controllers and entities) to stay within context limits.
96
110
 
97
111
  ---
@@ -99,11 +113,13 @@ Use stratified sampling to read only the most relevant files (e.g., core control
99
113
  ## ✅ Validation & Synthesis
100
114
 
101
115
  ### Present Findings
116
+
102
117
  Show the final "🔍 BACKEND STACK DETECTED" report and ask for confirmation.
103
118
 
104
119
  ### 💾 Cache & Pre-populate
105
120
 
106
121
  **Create directory structure (if not exists):**
122
+
107
123
  ```bash
108
124
  mkdir -p .ai-flow/cache
109
125
  ```
@@ -136,22 +152,23 @@ B) No, skip audit (continue to Phase 1)
136
152
  ### 0.4.2 Parse Existing Documentation
137
153
 
138
154
  **Action:** Extract documented information from:
155
+
139
156
  - `docs/architecture.md` → Architecture patterns
140
157
  - `docs/data-model.md` → Entities and fields
141
158
  - `docs/api.md` → Endpoints and methods
142
159
  - `specs/requirements.md` → Business requirements
143
160
 
144
- **Save to:** `.ai-flow/cache/docs-snapshot.json`
145
-
146
161
  ### 0.4.3 Compare Code vs Documentation
147
162
 
148
163
  **Compare:**
164
+
149
165
  1. **Entities:** Schema files (Prisma, TypeORM, etc.) vs `docs/data-model.md`
150
166
  2. **Endpoints:** Controllers/Routes vs `docs/api.md`
151
167
  3. **Architecture:** Code structure vs `docs/architecture.md`
152
168
  4. **Tech Stack:** `package.json` vs documented stack
153
169
 
154
170
  **Detect:**
171
+
155
172
  - Items in code but not in docs (undocumented features)
156
173
  - Items in docs but not in code (missing implementations or obsolete docs)
157
174
  - Mismatches in fields, types, or patterns
@@ -161,14 +178,17 @@ B) No, skip audit (continue to Phase 1)
161
178
  **Severity Levels:**
162
179
 
163
180
  🔴 **CRITICAL** (Requires user decision):
181
+
164
182
  - Documented entity/endpoint not implemented
165
183
  - Major architectural mismatch
166
184
 
167
185
  🟡 **MEDIUM** (Auto-correctable with confirmation):
186
+
168
187
  - Implemented endpoint not documented
169
188
  - Missing fields in docs
170
189
 
171
190
  🟢 **LOW** (Auto-correctable):
191
+
172
192
  - Obsolete fields in docs
173
193
  - Outdated version numbers
174
194
 
@@ -216,10 +236,12 @@ C) Cancel /flow-build (fix manually first)
216
236
  ```
217
237
 
218
238
  **Option A (Recommended):** Continue to Phase 1
239
+
219
240
  - Save audit data for Phase 8
220
241
  - Phase 8 will offer to apply corrections
221
242
 
222
243
  **Option B:** Interactive review now
244
+
223
245
  ```
224
246
  🔴 Critical Issue 1/2: Entity 'Category'
225
247
  Documented in docs/data-model.md but NOT in schema
@@ -233,21 +255,24 @@ C) Cancel /flow-build (fix manually first)
233
255
  ```
234
256
 
235
257
  **Option C:** Cancel
258
+
236
259
  - User fixes issues manually
237
260
  - Re-run `/flow-build` later
238
261
 
239
262
  ### 0.4.7 Save Audit Data
240
263
 
241
264
  > **📌 IMPORTANT - Phases 9-10 for Existing Projects:**
242
- >
265
+ >
243
266
  > If the project has **substantial functional code already implemented** (detected in Layer 1-3):
267
+ >
244
268
  > - Set `phase9.recommendation = "SKIP"` with reason: "Project already implemented - roadmap not needed"
245
269
  > - Set `phase10.recommendation = "SKIP"` with reason: "Project already implemented - user stories not needed"
246
- >
270
+ >
247
271
  > **Phases 9-10 are only useful for:**
272
+ >
248
273
  > - New projects (no code yet)
249
274
  > - Projects in early development (< 30% features implemented)
250
- >
275
+ >
251
276
  > **For existing projects**, focus on Phases 1-8 (documentation sync) instead.
252
277
 
253
278
  **Save to:** `.ai-flow/cache/audit-data.json`
@@ -350,16 +375,19 @@ C) Cancel /flow-build (fix manually first)
350
375
  ```
351
376
 
352
377
  **Recommendation Logic:**
378
+
353
379
  - **SKIP** (≥95%): Phase can be skipped, use existing docs
354
380
  - **HYBRID** (80-94%): Ask only missing questions, merge with existing docs
355
381
  - **FULL** (<80% or file missing): Execute full phase with pre-filled answers
356
382
 
357
383
  This data will be used in Phases 1-7 to:
384
+
358
385
  1. Determine if phase can be skipped
359
386
  2. Identify specific gaps to ask about
360
387
  3. Merge new answers with existing documentation
361
388
 
362
389
  This data will be used in Phase 8 to:
390
+
363
391
  1. Generate detailed audit report
364
392
  2. Apply auto-corrections
365
393
  3. Update roadmap with "To Implement" items
@@ -371,6 +399,7 @@ This data will be used in Phase 8 to:
371
399
  ### Present Findings
372
400
 
373
401
  Show the final report including:
402
+
374
403
  1. **🔍 BACKEND STACK DETECTED** (from Layers 1-3)
375
404
  2. **📊 Documentation Audit Summary** (from Layer 4, if executed)
376
405
 
@@ -379,6 +408,7 @@ Ask for confirmation to proceed to Phase 1.
379
408
  ### 💾 Cache & Pre-populate
380
409
 
381
410
  **Create directory structure (if not exists):**
411
+
382
412
  ```bash
383
413
  mkdir -p .ai-flow/cache .ai-flow/work .ai-flow/archive
384
414
  ```
@@ -390,6 +420,7 @@ mkdir -p .ai-flow/cache .ai-flow/work .ai-flow/archive
390
420
  ### 🎯 Set Flags for Phase 8
391
421
 
392
422
  If documentation audit was performed:
423
+
393
424
  - Set flag: `auditPerformed: true`
394
425
  - Phase 8 will:
395
426
  - Generate detailed audit report (`docs/audit-report.md`)
@@ -403,6 +434,7 @@ If documentation audit was performed:
403
434
  ---
404
435
 
405
436
  ### Phase Summary
437
+
406
438
  - Pre-populated detected tech stack values.
407
439
  - Architectural patterns identified.
408
440
  - Context cached in `.ai-flow/cache/docs-analysis.json`.
@@ -414,6 +446,7 @@ If documentation audit was performed:
414
446
  **Next Phase:** Phase 1 - Discovery & Business Requirements
415
447
 
416
448
  **What happens next:**
449
+
417
450
  - Phase 1-7 will use pre-populated answers (40-60% filled)
418
451
  - You'll only answer questions that couldn't be auto-detected
419
452
  - Phase 8 will offer to resolve documentation inconsistencies
@@ -421,5 +454,6 @@ If documentation audit was performed:
421
454
  Read: `.ai-flow/prompts/backend/flow-build-phase-1.md`
422
455
 
423
456
  ---
457
+
424
458
  _Version: 4.3 (Antigravity Optimized - With Integrated Audit)_
425
459
  _Last Updated: 2025-12-22_
@@ -4,8 +4,8 @@
4
4
 
5
5
  **Duration:** 10-15 minutes
6
6
 
7
- **Goal:** Set up the project structure and create comprehensive documentation that consolidates all information from previous phases.
8
- ---
7
+ ## **Goal:** Set up the project structure and create comprehensive documentation that consolidates all information from previous phases.
8
+
9
9
  ## 📋 Phase 8 Overview
10
10
 
11
11
  This final phase will:
@@ -16,8 +16,11 @@ This final phase will:
16
16
  4. **Generate master index** (AGENT.md)
17
17
  5. **Generate README.md** (with intelligent merge if needed)
18
18
  6. **Create tool-specific configs** (based on AI tool selection)
19
+
19
20
  ---
21
+
20
22
  // turbo
23
+
21
24
  ## 8.1: Project State Detection
22
25
 
23
26
  ```
@@ -57,7 +60,9 @@ Found:
57
60
 
58
61
  Recommendation: [Next action based on state]
59
62
  ```
63
+
60
64
  ---
65
+
61
66
  ## 8.2: Framework Initialization (Optional)
62
67
 
63
68
  **Only if:** Project state = "New Project"
@@ -214,7 +219,9 @@ You can initialize manually later with:
214
219
 
215
220
  Proceeding to documentation generation...
216
221
  ```
222
+
217
223
  ---
224
+
218
225
  ## 8.3: Generate Final Documentation
219
226
 
220
227
  ```
@@ -296,20 +303,24 @@ Generating...
296
303
  ```
297
304
  ✅ Generated: docs/contributing.md
298
305
  ```
306
+
299
307
  ---
308
+
300
309
  ## 8.3.4: Generate .gitignore
301
310
 
302
311
  **IMPORTANT:** Generate a comprehensive `.gitignore` file based on the mobile framework selected in previous phases.
303
312
 
304
313
  ```
305
- 📝 Generating .gitignore for your mobile stack...
314
+ 📝 Configuring .gitignore for your mobile stack...
306
315
  ```
307
316
 
308
317
  **Strategy:**
309
318
 
310
- 1. **Detect framework from Phase 3** (React Native, Flutter, etc.)
311
- 2. **Detect package manager** (npm, yarn, pub)
312
- 3. **Combine relevant patterns**
319
+ 1. **Check if .gitignore exists**
320
+ 2. **Detect framework from Phase 3** (React Native, Flutter, etc.)
321
+ 3. **Detect package manager** (npm, yarn, pub)
322
+ 4. **Combine relevant patterns + AI Flow rules**
323
+ 5. **Merge intelligently** (append only missing rules)
313
324
 
314
325
  **React Native patterns:**
315
326
 
@@ -375,6 +386,18 @@ coverage/
375
386
  # Logs
376
387
  logs/
377
388
  *.log
389
+
390
+ # ============================================================
391
+ # AI Flow - Workspace Management
392
+ # ============================================================
393
+ # Ignore temporary cache (regenerable)
394
+ .ai-flow/cache/
395
+
396
+ # Ignore work-in-progress state (personal, deleted on completion)
397
+ .ai-flow/work/
398
+
399
+ # COMMIT .ai-flow/archive/ by default (contains team metrics)
400
+ # ============================================================
378
401
  ```
379
402
 
380
403
  **Flutter patterns:**
@@ -439,21 +462,94 @@ coverage/
439
462
  # OS
440
463
  .DS_Store
441
464
  Thumbs.db
465
+
466
+ # ============================================================
467
+ # AI Flow - Workspace Management
468
+ # ============================================================
469
+ # Ignore temporary cache (regenerable)
470
+ .ai-flow/cache/
471
+
472
+ # Ignore work-in-progress state (personal, deleted on completion)
473
+ .ai-flow/work/
474
+
475
+ # COMMIT .ai-flow/archive/ by default (contains team metrics)
476
+ # ============================================================
442
477
  ```
443
478
 
444
- **📝 Action:** Generate and write `.gitignore` to project root.
479
+ **📝 Action: Intelligent Merge Strategy**
480
+
481
+ **Step 1: Detect existing .gitignore**
482
+
483
+ ```bash
484
+ if [ -f ".gitignore" ]; then
485
+ echo "📋 Existing .gitignore detected"
486
+ GITIGNORE_EXISTS=true
487
+ else
488
+ echo "📄 Creating new .gitignore"
489
+ GITIGNORE_EXISTS=false
490
+ fi
491
+ ```
445
492
 
446
- **Selection logic:**
493
+ **Step 2: Select base patterns**
447
494
 
448
495
  - If React Native → Use React Native patterns
449
496
  - If Flutter → Use Flutter patterns
450
497
  - If Expo detected → Add Expo-specific patterns
498
+ - **Always include AI Flow rules** (.ai-flow/cache/, .ai-flow/work/)
499
+
500
+ **Step 3: Merge or Create**
501
+
502
+ **If .gitignore exists (Existing Project):**
503
+
504
+ ```bash
505
+ # Check if AI Flow rules already present
506
+ if grep -q ".ai-flow/cache/" .gitignore; then
507
+ echo "✅ AI Flow rules already configured"
508
+ else
509
+ echo "" >> .gitignore
510
+ echo "# ============================================================" >> .gitignore
511
+ echo "# AI Flow - Workspace Management" >> .gitignore
512
+ echo "# ============================================================" >> .gitignore
513
+ echo "# Ignore temporary cache (regenerable)" >> .gitignore
514
+ echo ".ai-flow/cache/" >> .gitignore
515
+ echo "" >> .gitignore
516
+ echo "# Ignore work-in-progress state (personal, deleted on completion)" >> .gitignore
517
+ echo ".ai-flow/work/" >> .gitignore
518
+ echo "" >> .gitignore
519
+ echo "# COMMIT .ai-flow/archive/ by default (contains team metrics)" >> .gitignore
520
+ echo "# ============================================================" >> .gitignore
521
+
522
+ echo "✅ Added AI Flow rules to existing .gitignore"
523
+ fi
524
+ ```
525
+
526
+ **If .gitignore does NOT exist (New Project):**
527
+
528
+ ```bash
529
+ # Create complete .gitignore with all patterns
530
+ cat > .gitignore << 'EOF'
531
+ [Insert complete template based on framework]
532
+ EOF
533
+
534
+ echo "✅ Created new .gitignore"
535
+ ```
536
+
537
+ **Output Summary:**
538
+
539
+ ```
540
+ ✅ .gitignore configured successfully!
541
+ Base patterns: [React Native | Flutter]
542
+ AI Flow rules: ✅ Added (.ai-flow/cache/, .ai-flow/work/)
543
+ Status: [Created new | Updated existing]
544
+ ```
451
545
 
452
546
  ```
453
547
  ✅ Generated: .gitignore
454
548
  Patterns included: [React Native | Flutter] + Platform-specific
455
549
  ```
550
+
456
551
  ---
552
+
457
553
  ## 8.4: Generate AGENT.md (Master Index)
458
554
 
459
555
  - **Template:** `.ai-flow/templates/AGENT.template.md`
@@ -538,7 +634,9 @@ Thumbs.db
538
634
  ```
539
635
  ✅ Generated: .ai-flow/AGENT.md (Master Index)
540
636
  ```
637
+
541
638
  ---
639
+
542
640
  ## 8.5: Generate README.md (Intelligent Merge)
543
641
 
544
642
  - **Template:** `.ai-flow/templates/README.template.md`
@@ -581,7 +679,9 @@ Thumbs.db
581
679
  ✅ Generated: .ai-flow/README.md
582
680
  [If merged] Merged with framework's setup instructions
583
681
  ```
682
+
584
683
  ---
684
+
585
685
  ## 8.6: Create Tool-Specific Configs
586
686
 
587
687
  **Based on AI tool selection from Phase 1:**
@@ -695,7 +795,9 @@ Master index: `.ai-flow/AGENT.md`
695
795
  ✅ Generated tool-specific configs:
696
796
  [List generated files based on selection]
697
797
  ```
798
+
698
799
  ---
800
+
699
801
  ## 8.7: Final Validation & Success Message
700
802
 
701
803
  ```
@@ -817,7 +919,9 @@ Your AI assistant (Claude, Cursor, Copilot) will now:
817
919
 
818
920
  Happy building! 🎉📱
819
921
  ```
922
+
820
923
  ---
924
+
821
925
  ## EXECUTION CHECKLIST FOR AI ASSISTANT
822
926
 
823
927
  When executing Phase 8:
@@ -872,8 +976,8 @@ When executing Phase 8:
872
976
  - [ ] Validate file references
873
977
  - [ ] Show success message
874
978
 
875
- **ESTIMATED TIME:** 10-15 minutes
876
- ---
979
+ ## **ESTIMATED TIME:** 10-15 minutes
980
+
877
981
  **Next Phase:** Phase 9 - Project Roadmap (Post-Documentation)
878
982
 
879
983
  Read: `.ai-flow/prompts/mobile/flow-build-phase-9.md`
@@ -882,7 +986,3 @@ Read: `.ai-flow/prompts/mobile/flow-build-phase-9.md`
882
986
 
883
987
  **Last Updated:** 2025-12-21
884
988
  **Version:** 2.1.9
885
-
886
-
887
-
888
-