ai-flow-dev 2.7.0 → 2.8.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.
Files changed (171) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -570
  3. package/package.json +74 -74
  4. package/prompts/backend/flow-build-phase-0.md +535 -535
  5. package/prompts/backend/flow-build-phase-1.md +626 -626
  6. package/prompts/backend/flow-build-phase-10.md +340 -340
  7. package/prompts/backend/flow-build-phase-2.md +573 -573
  8. package/prompts/backend/flow-build-phase-3.md +834 -834
  9. package/prompts/backend/flow-build-phase-4.md +554 -554
  10. package/prompts/backend/flow-build-phase-5.md +703 -703
  11. package/prompts/backend/flow-build-phase-6.md +524 -524
  12. package/prompts/backend/flow-build-phase-7.md +1001 -1001
  13. package/prompts/backend/flow-build-phase-8.md +1407 -1407
  14. package/prompts/backend/flow-build-phase-9.md +477 -477
  15. package/prompts/backend/flow-build.md +137 -137
  16. package/prompts/backend/flow-check-review.md +656 -20
  17. package/prompts/backend/flow-check-test.md +526 -14
  18. package/prompts/backend/flow-check.md +725 -67
  19. package/prompts/backend/flow-commit.md +88 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-finish.md +919 -0
  22. package/prompts/backend/flow-release.md +949 -0
  23. package/prompts/backend/flow-work-feature.md +61 -61
  24. package/prompts/backend/flow-work-fix.md +46 -46
  25. package/prompts/backend/flow-work-refactor.md +48 -48
  26. package/prompts/backend/flow-work-resume.md +34 -34
  27. package/prompts/backend/flow-work.md +1098 -1286
  28. package/prompts/desktop/flow-build-phase-0.md +359 -359
  29. package/prompts/desktop/flow-build-phase-1.md +295 -295
  30. package/prompts/desktop/flow-build-phase-10.md +357 -357
  31. package/prompts/desktop/flow-build-phase-2.md +282 -282
  32. package/prompts/desktop/flow-build-phase-3.md +291 -291
  33. package/prompts/desktop/flow-build-phase-4.md +308 -308
  34. package/prompts/desktop/flow-build-phase-5.md +269 -269
  35. package/prompts/desktop/flow-build-phase-6.md +350 -350
  36. package/prompts/desktop/flow-build-phase-7.md +297 -297
  37. package/prompts/desktop/flow-build-phase-8.md +541 -541
  38. package/prompts/desktop/flow-build-phase-9.md +439 -439
  39. package/prompts/desktop/flow-build.md +156 -156
  40. package/prompts/desktop/flow-check-review.md +656 -20
  41. package/prompts/desktop/flow-check-test.md +526 -14
  42. package/prompts/desktop/flow-check.md +725 -67
  43. package/prompts/desktop/flow-commit.md +88 -119
  44. package/prompts/desktop/flow-docs-sync.md +354 -354
  45. package/prompts/desktop/flow-finish.md +910 -0
  46. package/prompts/desktop/flow-release.md +662 -0
  47. package/prompts/desktop/flow-work-feature.md +61 -61
  48. package/prompts/desktop/flow-work-fix.md +46 -46
  49. package/prompts/desktop/flow-work-refactor.md +48 -48
  50. package/prompts/desktop/flow-work-resume.md +34 -34
  51. package/prompts/desktop/flow-work.md +1202 -1390
  52. package/prompts/frontend/flow-build-phase-0.md +425 -425
  53. package/prompts/frontend/flow-build-phase-1.md +626 -626
  54. package/prompts/frontend/flow-build-phase-10.md +33 -33
  55. package/prompts/frontend/flow-build-phase-2.md +573 -573
  56. package/prompts/frontend/flow-build-phase-3.md +782 -782
  57. package/prompts/frontend/flow-build-phase-4.md +554 -554
  58. package/prompts/frontend/flow-build-phase-5.md +703 -703
  59. package/prompts/frontend/flow-build-phase-6.md +524 -524
  60. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  61. package/prompts/frontend/flow-build-phase-8.md +872 -872
  62. package/prompts/frontend/flow-build-phase-9.md +94 -94
  63. package/prompts/frontend/flow-build.md +137 -137
  64. package/prompts/frontend/flow-check-review.md +656 -20
  65. package/prompts/frontend/flow-check-test.md +526 -14
  66. package/prompts/frontend/flow-check.md +725 -67
  67. package/prompts/frontend/flow-commit.md +88 -119
  68. package/prompts/frontend/flow-docs-sync.md +550 -550
  69. package/prompts/frontend/flow-finish.md +910 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1540 -0
  72. package/prompts/frontend/flow-work-feature.md +61 -61
  73. package/prompts/frontend/flow-work-fix.md +38 -38
  74. package/prompts/frontend/flow-work-refactor.md +48 -48
  75. package/prompts/frontend/flow-work-resume.md +34 -34
  76. package/prompts/frontend/flow-work.md +1583 -1320
  77. package/prompts/mobile/flow-build-phase-0.md +425 -425
  78. package/prompts/mobile/flow-build-phase-1.md +626 -626
  79. package/prompts/mobile/flow-build-phase-10.md +32 -32
  80. package/prompts/mobile/flow-build-phase-2.md +573 -573
  81. package/prompts/mobile/flow-build-phase-3.md +782 -782
  82. package/prompts/mobile/flow-build-phase-4.md +554 -554
  83. package/prompts/mobile/flow-build-phase-5.md +703 -703
  84. package/prompts/mobile/flow-build-phase-6.md +524 -524
  85. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  86. package/prompts/mobile/flow-build-phase-8.md +888 -888
  87. package/prompts/mobile/flow-build-phase-9.md +90 -90
  88. package/prompts/mobile/flow-build.md +135 -135
  89. package/prompts/mobile/flow-check-review.md +656 -20
  90. package/prompts/mobile/flow-check-test.md +526 -14
  91. package/prompts/mobile/flow-check.md +725 -67
  92. package/prompts/mobile/flow-commit.md +88 -119
  93. package/prompts/mobile/flow-docs-sync.md +620 -620
  94. package/prompts/mobile/flow-finish.md +910 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1493 -0
  97. package/prompts/mobile/flow-work-feature.md +61 -61
  98. package/prompts/mobile/flow-work-fix.md +46 -46
  99. package/prompts/mobile/flow-work-refactor.md +48 -48
  100. package/prompts/mobile/flow-work-resume.md +34 -34
  101. package/prompts/mobile/flow-work.md +1593 -1329
  102. package/prompts/shared/mermaid-guidelines.md +102 -102
  103. package/prompts/shared/scope-levels.md +114 -114
  104. package/prompts/shared/smart-skip-preflight.md +214 -214
  105. package/prompts/shared/story-points.md +55 -55
  106. package/prompts/shared/task-format.md +74 -74
  107. package/prompts/shared/task-summary-template.md +277 -277
  108. package/templates/AGENT.template.md +443 -443
  109. package/templates/backend/.clauderules.template +112 -112
  110. package/templates/backend/.cursorrules.template +102 -102
  111. package/templates/backend/README.template.md +2 -2
  112. package/templates/backend/ai-instructions.template.md +2 -2
  113. package/templates/backend/copilot-instructions.template.md +2 -2
  114. package/templates/backend/docs/api.template.md +320 -320
  115. package/templates/backend/docs/business-flows.template.md +97 -97
  116. package/templates/backend/docs/code-standards.template.md +2 -2
  117. package/templates/backend/docs/contributing.template.md +3 -3
  118. package/templates/backend/docs/data-model.template.md +520 -520
  119. package/templates/backend/docs/testing.template.md +2 -2
  120. package/templates/backend/project-brief.template.md +2 -2
  121. package/templates/backend/specs/configuration.template.md +2 -2
  122. package/templates/backend/specs/security.template.md +2 -2
  123. package/templates/desktop/.clauderules.template +112 -112
  124. package/templates/desktop/.cursorrules.template +102 -102
  125. package/templates/desktop/README.template.md +170 -170
  126. package/templates/desktop/ai-instructions.template.md +366 -366
  127. package/templates/desktop/copilot-instructions.template.md +140 -140
  128. package/templates/desktop/docs/docs/api.template.md +320 -320
  129. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  130. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  131. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  132. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  133. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  134. package/templates/desktop/docs/docs/operations.template.md +720 -720
  135. package/templates/desktop/docs/docs/testing.template.md +722 -722
  136. package/templates/desktop/project-brief.template.md +150 -150
  137. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  138. package/templates/desktop/specs/specs/security.template.md +392 -392
  139. package/templates/frontend/README.template.md +2 -2
  140. package/templates/frontend/ai-instructions.template.md +2 -2
  141. package/templates/frontend/docs/api-integration.template.md +362 -362
  142. package/templates/frontend/docs/components.template.md +2 -2
  143. package/templates/frontend/docs/error-handling.template.md +360 -360
  144. package/templates/frontend/docs/operations.template.md +107 -107
  145. package/templates/frontend/docs/performance.template.md +124 -124
  146. package/templates/frontend/docs/pwa.template.md +119 -119
  147. package/templates/frontend/docs/state-management.template.md +2 -2
  148. package/templates/frontend/docs/styling.template.md +2 -2
  149. package/templates/frontend/docs/testing.template.md +2 -2
  150. package/templates/frontend/project-brief.template.md +2 -2
  151. package/templates/frontend/specs/accessibility.template.md +95 -95
  152. package/templates/frontend/specs/configuration.template.md +2 -2
  153. package/templates/frontend/specs/security.template.md +175 -175
  154. package/templates/fullstack/README.template.md +252 -252
  155. package/templates/fullstack/ai-instructions.template.md +444 -444
  156. package/templates/fullstack/project-brief.template.md +157 -157
  157. package/templates/fullstack/specs/configuration.template.md +340 -340
  158. package/templates/mobile/README.template.md +167 -167
  159. package/templates/mobile/ai-instructions.template.md +196 -196
  160. package/templates/mobile/docs/app-store.template.md +135 -135
  161. package/templates/mobile/docs/architecture.template.md +63 -63
  162. package/templates/mobile/docs/native-features.template.md +94 -94
  163. package/templates/mobile/docs/navigation.template.md +59 -59
  164. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  165. package/templates/mobile/docs/permissions.template.md +56 -56
  166. package/templates/mobile/docs/state-management.template.md +85 -85
  167. package/templates/mobile/docs/testing.template.md +109 -109
  168. package/templates/mobile/project-brief.template.md +69 -69
  169. package/templates/mobile/specs/build-configuration.template.md +91 -91
  170. package/templates/mobile/specs/deployment.template.md +92 -92
  171. package/templates/work.template.md +47 -47
@@ -1,535 +1,535 @@
1
- ## PHASE 0: Context Discovery (2-5 min)
2
-
3
- > **Order for this phase:** ALWAYS executed FIRST if an existing project is detected. Skip ONLY for new projects.
4
-
5
- > **📌 Scope-based behavior:**
6
- >
7
- > - **Interactive Mode:** Ask user for permission to scan files layer by layer.
8
- > - **Autonomous Mode:** Scan all layers automatically and present the final report.
9
-
10
- ### Objective
11
-
12
- Efficiently analyze existing projects using a **layered, incremental approach**.
13
-
14
- ---
15
-
16
- ## 🚫 Critical Exclusion Rules
17
-
18
- To avoid false-positive detections, **IGNORE** the following folders and files during all detection steps:
19
-
20
- - `.ai-flow/work/` (contains active development tasks)
21
- - `.ai-flow/archive/` (contains completed tasks)
22
- - `.agent/` (contains AI workflows)
23
- - `docs/` and `specs/` (if they contain AI Flow generated documentation)
24
- - `planning/` (if it contains AI Flow generated roadmap and user stories)
25
- - `project-brief.md`, `ai-instructions.md`, `AGENT.md`
26
-
27
- **A project is considered "Existing" only if it contains functional source code or framework configuration files OUTSIDE these excluded paths.**
28
-
29
- ---
30
-
31
- ## 0.0 Check for Existing Analysis (Layer 0)
32
-
33
- Check if `.ai-flow/cache/docs-analysis.json` exists and is fresh.
34
-
35
- **If found:**
36
- Ask user to use cached analysis or re-analyze.
37
-
38
- **If not found:**
39
- Proceed to Layer 1.
40
-
41
- ---
42
-
43
- // turbo
44
-
45
- ## ⚡ Layer 1: Fast Metadata Scan (10-20 seconds)
46
-
47
- **Purpose:** Detect framework, language, build tool, and existing AI configurations.
48
-
49
- ⭐ **Context Links:**
50
-
51
- - Node.js: [package.json](file:///package.json)
52
- - Python: [requirements.txt](file:///requirements.txt) | [pyproject.toml](file:///pyproject.toml)
53
- - PHP: [composer.json](file:///composer.json)
54
- - Go: [go.mod](file:///go.mod)
55
- - Java: [pom.xml](file:///pom.xml) | [build.gradle](file:///build.gradle) | [build.xml](file:///build.xml)
56
- - NetBeans: [nbproject/project.xml](file:///nbproject/project.xml)
57
- - Eclipse: [.project](file:///.project) | [.classpath](file:///.classpath)
58
-
59
- ### 0.1.1 Universal Tech Stack Detection
60
-
61
- **Action:** Use your internal knowledge to detect the language and framework by scanning the root configuration files (package.json, pyproject.toml, etc.).
62
-
63
- **Detect (but don't be limited to):**
64
-
65
- - **Node.js:** NestJS, Express, Fastify, etc.
66
- - **Python:** FastAPI, Django, Flask, etc.
67
- - **PHP:** Laravel, Symfony, etc.
68
- - **Java/Kotlin:** Spring Boot, Micronaut, Ktor, NetBeans (Ant), Eclipse (Maven/Gradle), etc.
69
- - **Go:** Gin, Echo, Fiber, etc.
70
- - **C#/.NET, Ruby, Rust, Elixir.**
71
-
72
- **NetBeans Project Detection (Java):**
73
-
74
- Check for NetBeans-specific markers:
75
-
76
- - `nbproject/project.xml` - NetBeans project descriptor
77
- - `build.xml` - Ant build configuration
78
- - `manifest.mf` - JAR manifest file
79
- - `src/` with Java source files
80
- - `lib/` for dependencies (optional)
81
-
82
- **Eclipse Project Detection (Java):**
83
-
84
- Check for Eclipse-specific markers:
85
-
86
- - `.project` - Eclipse project descriptor
87
- - `.classpath` - Classpath configuration
88
- - `.settings/` - IDE settings directory
89
- - `pom.xml` (Maven) or `build.gradle` (Gradle)
90
- - `src/main/java/` or `src/` for source code
91
-
92
- **Project Type Classification:**
93
-
94
- 1. **NetBeans Web Application:**
95
- - Has `web/` or `WebContent/` directory
96
- - Contains `web.xml` in `web/WEB-INF/`
97
- - Servlets/JSP files present
98
- - Build.xml with web-related targets
99
-
100
- 2. **NetBeans Desktop Application:**
101
- - Has Swing `.form` files in `src/`
102
- - JavaFX `.fxml` files
103
- - Main class with GUI initialization (JFrame/Application)
104
- - No web/ directory
105
-
106
- 3. **Eclipse Desktop Application (Swing/JavaFX):**
107
- - Has `.project` file
108
- - Maven/Gradle with JavaFX or Swing dependencies
109
- - Main class with GUI initialization
110
- - No web facets
111
-
112
- 4. **Eclipse Desktop Application (SWT):**
113
- - Has `.project` file
114
- - Dependencies: `org.eclipse.swt.*`, `org.eclipse.jface.*`
115
- - Main class extends `ApplicationWorkbenchAdvisor` or uses `Display`
116
- - May have `.product` file (RCP)
117
-
118
- 5. **Enterprise Application (NetBeans/Eclipse):**
119
- - EJB configurations
120
- - persistence.xml (JPA)
121
- - ejb-jar.xml
122
- - Enterprise modules
123
-
124
- **Build System Detection:**
125
-
126
- NetBeans:
127
-
128
- - Default: Apache Ant (build.xml)
129
- - Modern: Maven (pom.xml) or Gradle (build.gradle)
130
- - Hybrid: Ant + Ivy
131
-
132
- Eclipse:
133
-
134
- - Default: Maven (pom.xml) or Gradle (build.gradle)
135
- - Legacy: Ant with Eclipse compiler
136
- - PDE: Eclipse Plugin Development
137
-
138
- **Version Detection:**
139
-
140
- - NetBeans: Check `nbproject/project.properties` for version
141
- - Eclipse: Check `.project` XML for `<buildSpec>` and `<nature>` tags
142
- - Java version: Check build config (Maven/Gradle) or project properties
143
-
144
- ### 0.1.2 Find AI & Documentation
145
-
146
- - Find existing AI configs (`AGENT.md`, `.cursorrules`, etc.)
147
- - Scan for `README.md` and existing `docs/`.
148
-
149
- ### Layer 1 Output
150
-
151
- Show a summary of detected Name, Language, Framework, ORM, and Documentation files.
152
-
153
- ---
154
-
155
- ## 0.2 Layer 2: Structural Analysis (30-90 seconds)
156
-
157
- **Purpose:** Analyze directory organization and architecture patterns without reading code line-by-line.
158
-
159
- ### 0.2.1 Pattern Detection
160
-
161
- 1. **Identify Pattern:** Feature-based, Layer-based, Modular Monolith, or Hybrid.
162
- 2. **Entity Detection:** Scan for Schema/Entity files based on the detected ORM (Prisma, TypeORM, Django Models, etc.).
163
- 3. **Maturity Check:** Assess documentation and test coverage ratio.
164
-
165
- ### Layer 2 Output
166
-
167
- Summary of Architecture Pattern, Code Structure counts (Controllers, Services, etc.), and Recommended Build Scope (MVP/Production/Enterprise).
168
-
169
- ---
170
-
171
- ## 0.3 Layer 3: Selective Deep Analysis (1-5 minutes, OPTIONAL)
172
-
173
- **Purpose:** Read and parse representative code files for detailed insights into API endpoints, data relationships, and security patterns.
174
-
175
- ### 0.3.1 Areas of Analysis
176
-
177
- - **API Endpoints:** Parse routes/controllers.
178
- - **Data Model:** Map entity relationships.
179
- - **Security:** Detect auth patterns (JWT, OAuth), validation (Zod, Pydantic), and middleware.
180
-
181
- ### 0.3.2 Sampling Strategy
182
-
183
- Use stratified sampling to read only the most relevant files (e.g., core controllers and entities) to stay within context limits.
184
-
185
- ---
186
-
187
- ## ✅ Validation & Synthesis
188
-
189
- ### Present Findings
190
-
191
- Show the final "🔍 BACKEND STACK DETECTED" report and ask for confirmation.
192
-
193
- ### 💾 Cache & Pre-populate
194
-
195
- **Create directory structure (if not exists):**
196
-
197
- ```bash
198
- mkdir -p .ai-flow/cache
199
- ```
200
-
201
- 1. **Export:** Save results to `.ai-flow/cache/docs-analysis.json`.
202
- 2. **Pre-populate:** Fill answers for Phases 1-7 based on detected data.
203
-
204
- ---
205
-
206
- ## 0.4 Layer 4: Documentation Audit (30-90s, CONDITIONAL)
207
-
208
- **Trigger:** Only if `docs/` or `specs/` directories exist with content.
209
-
210
- **Purpose:** Validate existing documentation against implemented code to detect inconsistencies.
211
-
212
- ### 0.4.1 Ask User Permission
213
-
214
- ```
215
- 📚 Existing documentation detected (12 files in docs/, 3 in specs/)
216
-
217
- Would you like to audit documentation vs code?
218
- A) Yes, audit and show inconsistencies (recommended) ⭐
219
- B) No, skip audit (continue to Phase 1)
220
-
221
- > _
222
- ```
223
-
224
- **If user selects B:** Skip to section 0.5 (Validation & Synthesis).
225
-
226
- ### 0.4.2 Parse Existing Documentation
227
-
228
- **Action:** Extract documented information from:
229
-
230
- - `docs/architecture.md` → Architecture patterns
231
- - `docs/data-model.md` → Entities and fields
232
- - `docs/api.md` → Endpoints and methods
233
- - `specs/requirements.md` → Business requirements
234
-
235
- **Save to:** `.ai-flow/cache/docs-snapshot.json`
236
-
237
- ### 0.4.3 Compare Code vs Documentation
238
-
239
- **Compare:**
240
-
241
- 1. **Entities:** Schema files (Prisma, TypeORM, etc.) vs `docs/data-model.md`
242
- 2. **Endpoints:** Controllers/Routes vs `docs/api.md`
243
- 3. **Architecture:** Code structure vs `docs/architecture.md`
244
- 4. **Tech Stack:** `package.json` vs documented stack
245
-
246
- **Detect:**
247
-
248
- - Items in code but not in docs (undocumented features)
249
- - Items in docs but not in code (missing implementations or obsolete docs)
250
- - Mismatches in fields, types, or patterns
251
-
252
- ### 0.4.4 Classify Inconsistencies
253
-
254
- **Severity Levels:**
255
-
256
- 🔴 **CRITICAL** (Requires user decision):
257
-
258
- - Documented entity/endpoint not implemented
259
- - Major architectural mismatch
260
-
261
- 🟡 **MEDIUM** (Auto-correctable with confirmation):
262
-
263
- - Implemented endpoint not documented
264
- - Missing fields in docs
265
-
266
- 🟢 **LOW** (Auto-correctable):
267
-
268
- - Obsolete fields in docs
269
- - Outdated version numbers
270
-
271
- ### 0.4.5 Generate Audit Summary
272
-
273
- **Output:** Concise summary (full report saved for later).
274
-
275
- ```
276
- ---
277
- 📊 Documentation Audit Summary
278
-
279
- Consistency Score: 72%
280
-
281
- 🔴 Critical: 2 issues
282
- - Entity 'Category' documented but not in schema
283
- - Endpoint POST /api/auth/register documented but missing
284
-
285
- 🟡 Medium: 5 issues
286
- - 3 endpoints implemented but not documented
287
- - 2 entity fields missing in docs
288
-
289
- 🟢 Minor: 3 issues
290
- - 3 obsolete fields in documentation
291
-
292
- 💡 Recommendation:
293
- - Review critical issues before continuing
294
- - Full audit report will be generated in Phase 8
295
- - Auto-corrections can be applied after Phase 8
296
- ---
297
- ```
298
-
299
- ### 0.4.6 Handle Critical Issues (If Any)
300
-
301
- **If critical issues found:**
302
-
303
- ```
304
- ⚠️ Critical inconsistencies detected!
305
-
306
- How would you like to proceed?
307
- A) Continue to Phase 1 (address issues later in Phase 8) ⭐
308
- B) Review critical issues now (interactive)
309
- C) Cancel /flow-build (fix manually first)
310
-
311
- > _
312
- ```
313
-
314
- **Option A (Recommended):** Continue to Phase 1
315
-
316
- - Save audit data for Phase 8
317
- - Phase 8 will offer to apply corrections
318
-
319
- **Option B:** Interactive review now
320
-
321
- ```
322
- 🔴 Critical Issue 1/2: Entity 'Category'
323
- Documented in docs/data-model.md but NOT in schema
324
-
325
- What should we do?
326
- A) Mark as "To Implement" (add to roadmap)
327
- B) Mark as "Obsolete" (remove from docs in Phase 8)
328
- C) Skip for now
329
-
330
- > _
331
- ```
332
-
333
- **Option C:** Cancel
334
-
335
- - User fixes issues manually
336
- - Re-run `/flow-build` later
337
-
338
- ### 0.4.7 Save Audit Data
339
-
340
- > **📌 IMPORTANT - Phases 9-10 for Existing Projects:**
341
- >
342
- > If the project has **substantial functional code already implemented** (detected in Layer 1-3):
343
- >
344
- > - Set `phase9.recommendation = "SKIP"` with reason: "Project already implemented - roadmap not needed"
345
- > - Set `phase10.recommendation = "SKIP"` with reason: "Project already implemented - user stories not needed"
346
- >
347
- > **Phases 9-10 are only useful for:**
348
- >
349
- > - New projects (no code yet)
350
- > - Projects in early development (< 30% features implemented)
351
- >
352
- > **For existing projects**, focus on Phases 1-8 (documentation sync) instead.
353
-
354
- **Save to:** `.ai-flow/cache/audit-data.json`
355
-
356
- ```json
357
- {
358
- "auditPerformed": true,
359
- "timestamp": "2025-12-22T16:43:00Z",
360
- "consistencyScore": 72,
361
- "critical": 2,
362
- "medium": 5,
363
- "minor": 3,
364
- "userDecisions": {
365
- "Category": "obsolete",
366
- "POST /api/auth/register": "to_implement"
367
- },
368
- "phases": {
369
- "phase1": {
370
- "file": "project-brief.md",
371
- "exists": true,
372
- "consistencyScore": 100,
373
- "recommendation": "SKIP",
374
- "gaps": [],
375
- "reason": "Complete business context documented"
376
- },
377
- "phase2": {
378
- "file": "docs/data-model.md",
379
- "exists": true,
380
- "consistencyScore": 98,
381
- "recommendation": "SKIP",
382
- "gaps": [],
383
- "reason": "All entities documented and match schema"
384
- },
385
- "phase3": {
386
- "file": "docs/architecture.md",
387
- "exists": true,
388
- "consistencyScore": 87,
389
- "recommendation": "HYBRID",
390
- "gaps": ["api_versioning", "rate_limiting"],
391
- "reason": "Architecture documented but missing 2 details"
392
- },
393
- "phase4": {
394
- "file": "specs/security.md",
395
- "exists": true,
396
- "consistencyScore": 95,
397
- "recommendation": "SKIP",
398
- "gaps": [],
399
- "reason": "Security patterns match implementation"
400
- },
401
- "phase5": {
402
- "file": "docs/code-standards.md",
403
- "exists": true,
404
- "consistencyScore": 92,
405
- "recommendation": "SKIP",
406
- "gaps": [],
407
- "reason": "Standards documented and enforced"
408
- },
409
- "phase6": {
410
- "file": "docs/testing.md",
411
- "exists": true,
412
- "consistencyScore": 90,
413
- "recommendation": "SKIP",
414
- "gaps": [],
415
- "reason": "Testing strategy documented"
416
- },
417
- "phase7": {
418
- "file": "docs/deployment.md",
419
- "exists": true,
420
- "consistencyScore": 82,
421
- "recommendation": "HYBRID",
422
- "gaps": ["monitoring_strategy", "incident_runbooks"],
423
- "reason": "Deployment documented but missing operational details"
424
- },
425
- "phase8": {
426
- "file": "AGENT.md",
427
- "exists": true,
428
- "consistencyScore": 95,
429
- "recommendation": "SKIP",
430
- "gaps": [],
431
- "reason": "Final documentation complete and up-to-date"
432
- },
433
- "phase9": {
434
- "file": "planning/roadmap.md",
435
- "exists": false,
436
- "consistencyScore": 0,
437
- "recommendation": "SKIP",
438
- "gaps": [],
439
- "reason": "Project already implemented - roadmap not needed for existing code"
440
- },
441
- "phase10": {
442
- "file": "planning/user-stories/",
443
- "exists": false,
444
- "consistencyScore": 0,
445
- "recommendation": "SKIP",
446
- "gaps": [],
447
- "reason": "Project already implemented - user stories not needed for existing features"
448
- }
449
- }
450
- }
451
- ```
452
-
453
- **Recommendation Logic:**
454
-
455
- - **SKIP** (≥95%): Phase can be skipped, use existing docs
456
- - **HYBRID** (80-94%): Ask only missing questions, merge with existing docs
457
- - **FULL** (<80% or file missing): Execute full phase with pre-filled answers
458
-
459
- This data will be used in Phases 1-7 to:
460
-
461
- 1. Determine if phase can be skipped
462
- 2. Identify specific gaps to ask about
463
- 3. Merge new answers with existing documentation
464
-
465
- This data will be used in Phase 8 to:
466
-
467
- 1. Generate detailed audit report
468
- 2. Apply auto-corrections
469
- 3. Update roadmap with "To Implement" items
470
-
471
- ---
472
-
473
- ## 0.5 Validation & Synthesis
474
-
475
- ### Present Findings
476
-
477
- Show the final report including:
478
-
479
- 1. **🔍 BACKEND STACK DETECTED** (from Layers 1-3)
480
- 2. **📊 Documentation Audit Summary** (from Layer 4, if executed)
481
-
482
- Ask for confirmation to proceed to Phase 1.
483
-
484
- ### 💾 Cache & Pre-populate
485
-
486
- **Create directory structure (if not exists):**
487
-
488
- ```bash
489
- mkdir -p .ai-flow/cache .ai-flow/work .ai-flow/archive
490
- ```
491
-
492
- 1. **Export code analysis:** `.ai-flow/cache/docs-analysis.json`
493
- 2. **Export audit data:** `.ai-flow/cache/audit-data.json` (if Layer 4 executed)
494
- 3. **Pre-populate:** Fill answers for Phases 1-7 based on detected data
495
-
496
- ### 🎯 Set Flags for Phase 8
497
-
498
- If documentation audit was performed:
499
-
500
- - Set flag: `auditPerformed: true`
501
- - Phase 8 will:
502
- - Generate detailed audit report (`docs/audit-report.md`)
503
- - Offer to apply auto-corrections (🟡 Medium + 🟢 Low)
504
- - Update roadmap with "To Implement" items (🔴 Critical marked as such)
505
-
506
- ---
507
-
508
- ✅ **Phase 0 Complete: Context Analysis Finalized**
509
-
510
- ---
511
-
512
- ### Phase Summary
513
-
514
- - Pre-populated detected tech stack values.
515
- - Architectural patterns identified.
516
- - Context cached in `.ai-flow/cache/docs-analysis.json`.
517
- - **Documentation audit completed** (if existing docs found).
518
- - **Inconsistencies flagged** for Phase 8 resolution.
519
-
520
- ---
521
-
522
- **Next Phase:** Phase 1 - Discovery & Business Requirements
523
-
524
- **What happens next:**
525
-
526
- - Phase 1-7 will use pre-populated answers (40-60% filled)
527
- - You'll only answer questions that couldn't be auto-detected
528
- - Phase 8 will offer to resolve documentation inconsistencies
529
-
530
- Read: `.ai-flow/prompts/backend/flow-build-phase-1.md`
531
-
532
- ---
533
-
534
- _Version: 4.3 (Antigravity Optimized - With Integrated Audit)_
535
- _Last Updated: 2025-12-22_
1
+ ## PHASE 0: Context Discovery (2-5 min)
2
+
3
+ > **Order for this phase:** ALWAYS executed FIRST if an existing project is detected. Skip ONLY for new projects.
4
+
5
+ > **📌 Scope-based behavior:**
6
+ >
7
+ > - **Interactive Mode:** Ask user for permission to scan files layer by layer.
8
+ > - **Autonomous Mode:** Scan all layers automatically and present the final report.
9
+
10
+ ### Objective
11
+
12
+ Efficiently analyze existing projects using a **layered, incremental approach**.
13
+
14
+ ---
15
+
16
+ ## 🚫 Critical Exclusion Rules
17
+
18
+ To avoid false-positive detections, **IGNORE** the following folders and files during all detection steps:
19
+
20
+ - `.ai-flow/work/` (contains active development tasks)
21
+ - `.ai-flow/archive/` (contains completed tasks)
22
+ - `.agent/` (contains AI workflows)
23
+ - `docs/` and `specs/` (if they contain AI Flow generated documentation)
24
+ - `planning/` (if it contains AI Flow generated roadmap and user stories)
25
+ - `project-brief.md`, `ai-instructions.md`, `AGENT.md`
26
+
27
+ **A project is considered "Existing" only if it contains functional source code or framework configuration files OUTSIDE these excluded paths.**
28
+
29
+ ---
30
+
31
+ ## 0.0 Check for Existing Analysis (Layer 0)
32
+
33
+ Check if `.ai-flow/cache/docs-analysis.json` exists and is fresh.
34
+
35
+ **If found:**
36
+ Ask user to use cached analysis or re-analyze.
37
+
38
+ **If not found:**
39
+ Proceed to Layer 1.
40
+
41
+ ---
42
+
43
+ // turbo
44
+
45
+ ## ⚡ Layer 1: Fast Metadata Scan (10-20 seconds)
46
+
47
+ **Purpose:** Detect framework, language, build tool, and existing AI configurations.
48
+
49
+ ⭐ **Context Links:**
50
+
51
+ - Node.js: [package.json](file:///package.json)
52
+ - Python: [requirements.txt](file:///requirements.txt) | [pyproject.toml](file:///pyproject.toml)
53
+ - PHP: [composer.json](file:///composer.json)
54
+ - Go: [go.mod](file:///go.mod)
55
+ - Java: [pom.xml](file:///pom.xml) | [build.gradle](file:///build.gradle) | [build.xml](file:///build.xml)
56
+ - NetBeans: [nbproject/project.xml](file:///nbproject/project.xml)
57
+ - Eclipse: [.project](file:///.project) | [.classpath](file:///.classpath)
58
+
59
+ ### 0.1.1 Universal Tech Stack Detection
60
+
61
+ **Action:** Use your internal knowledge to detect the language and framework by scanning the root configuration files (package.json, pyproject.toml, etc.).
62
+
63
+ **Detect (but don't be limited to):**
64
+
65
+ - **Node.js:** NestJS, Express, Fastify, etc.
66
+ - **Python:** FastAPI, Django, Flask, etc.
67
+ - **PHP:** Laravel, Symfony, etc.
68
+ - **Java/Kotlin:** Spring Boot, Micronaut, Ktor, NetBeans (Ant), Eclipse (Maven/Gradle), etc.
69
+ - **Go:** Gin, Echo, Fiber, etc.
70
+ - **C#/.NET, Ruby, Rust, Elixir.**
71
+
72
+ **NetBeans Project Detection (Java):**
73
+
74
+ Check for NetBeans-specific markers:
75
+
76
+ - `nbproject/project.xml` - NetBeans project descriptor
77
+ - `build.xml` - Ant build configuration
78
+ - `manifest.mf` - JAR manifest file
79
+ - `src/` with Java source files
80
+ - `lib/` for dependencies (optional)
81
+
82
+ **Eclipse Project Detection (Java):**
83
+
84
+ Check for Eclipse-specific markers:
85
+
86
+ - `.project` - Eclipse project descriptor
87
+ - `.classpath` - Classpath configuration
88
+ - `.settings/` - IDE settings directory
89
+ - `pom.xml` (Maven) or `build.gradle` (Gradle)
90
+ - `src/main/java/` or `src/` for source code
91
+
92
+ **Project Type Classification:**
93
+
94
+ 1. **NetBeans Web Application:**
95
+ - Has `web/` or `WebContent/` directory
96
+ - Contains `web.xml` in `web/WEB-INF/`
97
+ - Servlets/JSP files present
98
+ - Build.xml with web-related targets
99
+
100
+ 2. **NetBeans Desktop Application:**
101
+ - Has Swing `.form` files in `src/`
102
+ - JavaFX `.fxml` files
103
+ - Main class with GUI initialization (JFrame/Application)
104
+ - No web/ directory
105
+
106
+ 3. **Eclipse Desktop Application (Swing/JavaFX):**
107
+ - Has `.project` file
108
+ - Maven/Gradle with JavaFX or Swing dependencies
109
+ - Main class with GUI initialization
110
+ - No web facets
111
+
112
+ 4. **Eclipse Desktop Application (SWT):**
113
+ - Has `.project` file
114
+ - Dependencies: `org.eclipse.swt.*`, `org.eclipse.jface.*`
115
+ - Main class extends `ApplicationWorkbenchAdvisor` or uses `Display`
116
+ - May have `.product` file (RCP)
117
+
118
+ 5. **Enterprise Application (NetBeans/Eclipse):**
119
+ - EJB configurations
120
+ - persistence.xml (JPA)
121
+ - ejb-jar.xml
122
+ - Enterprise modules
123
+
124
+ **Build System Detection:**
125
+
126
+ NetBeans:
127
+
128
+ - Default: Apache Ant (build.xml)
129
+ - Modern: Maven (pom.xml) or Gradle (build.gradle)
130
+ - Hybrid: Ant + Ivy
131
+
132
+ Eclipse:
133
+
134
+ - Default: Maven (pom.xml) or Gradle (build.gradle)
135
+ - Legacy: Ant with Eclipse compiler
136
+ - PDE: Eclipse Plugin Development
137
+
138
+ **Version Detection:**
139
+
140
+ - NetBeans: Check `nbproject/project.properties` for version
141
+ - Eclipse: Check `.project` XML for `<buildSpec>` and `<nature>` tags
142
+ - Java version: Check build config (Maven/Gradle) or project properties
143
+
144
+ ### 0.1.2 Find AI & Documentation
145
+
146
+ - Find existing AI configs (`AGENT.md`, `.cursorrules`, etc.)
147
+ - Scan for `README.md` and existing `docs/`.
148
+
149
+ ### Layer 1 Output
150
+
151
+ Show a summary of detected Name, Language, Framework, ORM, and Documentation files.
152
+
153
+ ---
154
+
155
+ ## 0.2 Layer 2: Structural Analysis (30-90 seconds)
156
+
157
+ **Purpose:** Analyze directory organization and architecture patterns without reading code line-by-line.
158
+
159
+ ### 0.2.1 Pattern Detection
160
+
161
+ 1. **Identify Pattern:** Feature-based, Layer-based, Modular Monolith, or Hybrid.
162
+ 2. **Entity Detection:** Scan for Schema/Entity files based on the detected ORM (Prisma, TypeORM, Django Models, etc.).
163
+ 3. **Maturity Check:** Assess documentation and test coverage ratio.
164
+
165
+ ### Layer 2 Output
166
+
167
+ Summary of Architecture Pattern, Code Structure counts (Controllers, Services, etc.), and Recommended Build Scope (MVP/Production/Enterprise).
168
+
169
+ ---
170
+
171
+ ## 0.3 Layer 3: Selective Deep Analysis (1-5 minutes, OPTIONAL)
172
+
173
+ **Purpose:** Read and parse representative code files for detailed insights into API endpoints, data relationships, and security patterns.
174
+
175
+ ### 0.3.1 Areas of Analysis
176
+
177
+ - **API Endpoints:** Parse routes/controllers.
178
+ - **Data Model:** Map entity relationships.
179
+ - **Security:** Detect auth patterns (JWT, OAuth), validation (Zod, Pydantic), and middleware.
180
+
181
+ ### 0.3.2 Sampling Strategy
182
+
183
+ Use stratified sampling to read only the most relevant files (e.g., core controllers and entities) to stay within context limits.
184
+
185
+ ---
186
+
187
+ ## ✅ Validation & Synthesis
188
+
189
+ ### Present Findings
190
+
191
+ Show the final "🔍 BACKEND STACK DETECTED" report and ask for confirmation.
192
+
193
+ ### 💾 Cache & Pre-populate
194
+
195
+ **Create directory structure (if not exists):**
196
+
197
+ ```bash
198
+ mkdir -p .ai-flow/cache
199
+ ```
200
+
201
+ 1. **Export:** Save results to `.ai-flow/cache/docs-analysis.json`.
202
+ 2. **Pre-populate:** Fill answers for Phases 1-7 based on detected data.
203
+
204
+ ---
205
+
206
+ ## 0.4 Layer 4: Documentation Audit (30-90s, CONDITIONAL)
207
+
208
+ **Trigger:** Only if `docs/` or `specs/` directories exist with content.
209
+
210
+ **Purpose:** Validate existing documentation against implemented code to detect inconsistencies.
211
+
212
+ ### 0.4.1 Ask User Permission
213
+
214
+ ```
215
+ 📚 Existing documentation detected (12 files in docs/, 3 in specs/)
216
+
217
+ Would you like to audit documentation vs code?
218
+ A) Yes, audit and show inconsistencies (recommended) ⭐
219
+ B) No, skip audit (continue to Phase 1)
220
+
221
+ > _
222
+ ```
223
+
224
+ **If user selects B:** Skip to section 0.5 (Validation & Synthesis).
225
+
226
+ ### 0.4.2 Parse Existing Documentation
227
+
228
+ **Action:** Extract documented information from:
229
+
230
+ - `docs/architecture.md` → Architecture patterns
231
+ - `docs/data-model.md` → Entities and fields
232
+ - `docs/api.md` → Endpoints and methods
233
+ - `specs/requirements.md` → Business requirements
234
+
235
+ **Save to:** `.ai-flow/cache/docs-snapshot.json`
236
+
237
+ ### 0.4.3 Compare Code vs Documentation
238
+
239
+ **Compare:**
240
+
241
+ 1. **Entities:** Schema files (Prisma, TypeORM, etc.) vs `docs/data-model.md`
242
+ 2. **Endpoints:** Controllers/Routes vs `docs/api.md`
243
+ 3. **Architecture:** Code structure vs `docs/architecture.md`
244
+ 4. **Tech Stack:** `package.json` vs documented stack
245
+
246
+ **Detect:**
247
+
248
+ - Items in code but not in docs (undocumented features)
249
+ - Items in docs but not in code (missing implementations or obsolete docs)
250
+ - Mismatches in fields, types, or patterns
251
+
252
+ ### 0.4.4 Classify Inconsistencies
253
+
254
+ **Severity Levels:**
255
+
256
+ 🔴 **CRITICAL** (Requires user decision):
257
+
258
+ - Documented entity/endpoint not implemented
259
+ - Major architectural mismatch
260
+
261
+ 🟡 **MEDIUM** (Auto-correctable with confirmation):
262
+
263
+ - Implemented endpoint not documented
264
+ - Missing fields in docs
265
+
266
+ 🟢 **LOW** (Auto-correctable):
267
+
268
+ - Obsolete fields in docs
269
+ - Outdated version numbers
270
+
271
+ ### 0.4.5 Generate Audit Summary
272
+
273
+ **Output:** Concise summary (full report saved for later).
274
+
275
+ ```
276
+ ---
277
+ 📊 Documentation Audit Summary
278
+
279
+ Consistency Score: 72%
280
+
281
+ 🔴 Critical: 2 issues
282
+ - Entity 'Category' documented but not in schema
283
+ - Endpoint POST /api/auth/register documented but missing
284
+
285
+ 🟡 Medium: 5 issues
286
+ - 3 endpoints implemented but not documented
287
+ - 2 entity fields missing in docs
288
+
289
+ 🟢 Minor: 3 issues
290
+ - 3 obsolete fields in documentation
291
+
292
+ 💡 Recommendation:
293
+ - Review critical issues before continuing
294
+ - Full audit report will be generated in Phase 8
295
+ - Auto-corrections can be applied after Phase 8
296
+ ---
297
+ ```
298
+
299
+ ### 0.4.6 Handle Critical Issues (If Any)
300
+
301
+ **If critical issues found:**
302
+
303
+ ```
304
+ ⚠️ Critical inconsistencies detected!
305
+
306
+ How would you like to proceed?
307
+ A) Continue to Phase 1 (address issues later in Phase 8) ⭐
308
+ B) Review critical issues now (interactive)
309
+ C) Cancel /flow-build (fix manually first)
310
+
311
+ > _
312
+ ```
313
+
314
+ **Option A (Recommended):** Continue to Phase 1
315
+
316
+ - Save audit data for Phase 8
317
+ - Phase 8 will offer to apply corrections
318
+
319
+ **Option B:** Interactive review now
320
+
321
+ ```
322
+ 🔴 Critical Issue 1/2: Entity 'Category'
323
+ Documented in docs/data-model.md but NOT in schema
324
+
325
+ What should we do?
326
+ A) Mark as "To Implement" (add to roadmap)
327
+ B) Mark as "Obsolete" (remove from docs in Phase 8)
328
+ C) Skip for now
329
+
330
+ > _
331
+ ```
332
+
333
+ **Option C:** Cancel
334
+
335
+ - User fixes issues manually
336
+ - Re-run `/flow-build` later
337
+
338
+ ### 0.4.7 Save Audit Data
339
+
340
+ > **📌 IMPORTANT - Phases 9-10 for Existing Projects:**
341
+ >
342
+ > If the project has **substantial functional code already implemented** (detected in Layer 1-3):
343
+ >
344
+ > - Set `phase9.recommendation = "SKIP"` with reason: "Project already implemented - roadmap not needed"
345
+ > - Set `phase10.recommendation = "SKIP"` with reason: "Project already implemented - user stories not needed"
346
+ >
347
+ > **Phases 9-10 are only useful for:**
348
+ >
349
+ > - New projects (no code yet)
350
+ > - Projects in early development (< 30% features implemented)
351
+ >
352
+ > **For existing projects**, focus on Phases 1-8 (documentation sync) instead.
353
+
354
+ **Save to:** `.ai-flow/cache/audit-data.json`
355
+
356
+ ```json
357
+ {
358
+ "auditPerformed": true,
359
+ "timestamp": "2025-12-22T16:43:00Z",
360
+ "consistencyScore": 72,
361
+ "critical": 2,
362
+ "medium": 5,
363
+ "minor": 3,
364
+ "userDecisions": {
365
+ "Category": "obsolete",
366
+ "POST /api/auth/register": "to_implement"
367
+ },
368
+ "phases": {
369
+ "phase1": {
370
+ "file": "project-brief.md",
371
+ "exists": true,
372
+ "consistencyScore": 100,
373
+ "recommendation": "SKIP",
374
+ "gaps": [],
375
+ "reason": "Complete business context documented"
376
+ },
377
+ "phase2": {
378
+ "file": "docs/data-model.md",
379
+ "exists": true,
380
+ "consistencyScore": 98,
381
+ "recommendation": "SKIP",
382
+ "gaps": [],
383
+ "reason": "All entities documented and match schema"
384
+ },
385
+ "phase3": {
386
+ "file": "docs/architecture.md",
387
+ "exists": true,
388
+ "consistencyScore": 87,
389
+ "recommendation": "HYBRID",
390
+ "gaps": ["api_versioning", "rate_limiting"],
391
+ "reason": "Architecture documented but missing 2 details"
392
+ },
393
+ "phase4": {
394
+ "file": "specs/security.md",
395
+ "exists": true,
396
+ "consistencyScore": 95,
397
+ "recommendation": "SKIP",
398
+ "gaps": [],
399
+ "reason": "Security patterns match implementation"
400
+ },
401
+ "phase5": {
402
+ "file": "docs/code-standards.md",
403
+ "exists": true,
404
+ "consistencyScore": 92,
405
+ "recommendation": "SKIP",
406
+ "gaps": [],
407
+ "reason": "Standards documented and enforced"
408
+ },
409
+ "phase6": {
410
+ "file": "docs/testing.md",
411
+ "exists": true,
412
+ "consistencyScore": 90,
413
+ "recommendation": "SKIP",
414
+ "gaps": [],
415
+ "reason": "Testing strategy documented"
416
+ },
417
+ "phase7": {
418
+ "file": "docs/deployment.md",
419
+ "exists": true,
420
+ "consistencyScore": 82,
421
+ "recommendation": "HYBRID",
422
+ "gaps": ["monitoring_strategy", "incident_runbooks"],
423
+ "reason": "Deployment documented but missing operational details"
424
+ },
425
+ "phase8": {
426
+ "file": "AGENT.md",
427
+ "exists": true,
428
+ "consistencyScore": 95,
429
+ "recommendation": "SKIP",
430
+ "gaps": [],
431
+ "reason": "Final documentation complete and up-to-date"
432
+ },
433
+ "phase9": {
434
+ "file": "planning/roadmap.md",
435
+ "exists": false,
436
+ "consistencyScore": 0,
437
+ "recommendation": "SKIP",
438
+ "gaps": [],
439
+ "reason": "Project already implemented - roadmap not needed for existing code"
440
+ },
441
+ "phase10": {
442
+ "file": "planning/user-stories/",
443
+ "exists": false,
444
+ "consistencyScore": 0,
445
+ "recommendation": "SKIP",
446
+ "gaps": [],
447
+ "reason": "Project already implemented - user stories not needed for existing features"
448
+ }
449
+ }
450
+ }
451
+ ```
452
+
453
+ **Recommendation Logic:**
454
+
455
+ - **SKIP** (≥95%): Phase can be skipped, use existing docs
456
+ - **HYBRID** (80-94%): Ask only missing questions, merge with existing docs
457
+ - **FULL** (<80% or file missing): Execute full phase with pre-filled answers
458
+
459
+ This data will be used in Phases 1-7 to:
460
+
461
+ 1. Determine if phase can be skipped
462
+ 2. Identify specific gaps to ask about
463
+ 3. Merge new answers with existing documentation
464
+
465
+ This data will be used in Phase 8 to:
466
+
467
+ 1. Generate detailed audit report
468
+ 2. Apply auto-corrections
469
+ 3. Update roadmap with "To Implement" items
470
+
471
+ ---
472
+
473
+ ## 0.5 Validation & Synthesis
474
+
475
+ ### Present Findings
476
+
477
+ Show the final report including:
478
+
479
+ 1. **🔍 BACKEND STACK DETECTED** (from Layers 1-3)
480
+ 2. **📊 Documentation Audit Summary** (from Layer 4, if executed)
481
+
482
+ Ask for confirmation to proceed to Phase 1.
483
+
484
+ ### 💾 Cache & Pre-populate
485
+
486
+ **Create directory structure (if not exists):**
487
+
488
+ ```bash
489
+ mkdir -p .ai-flow/cache .ai-flow/work .ai-flow/archive
490
+ ```
491
+
492
+ 1. **Export code analysis:** `.ai-flow/cache/docs-analysis.json`
493
+ 2. **Export audit data:** `.ai-flow/cache/audit-data.json` (if Layer 4 executed)
494
+ 3. **Pre-populate:** Fill answers for Phases 1-7 based on detected data
495
+
496
+ ### 🎯 Set Flags for Phase 8
497
+
498
+ If documentation audit was performed:
499
+
500
+ - Set flag: `auditPerformed: true`
501
+ - Phase 8 will:
502
+ - Generate detailed audit report (`docs/audit-report.md`)
503
+ - Offer to apply auto-corrections (🟡 Medium + 🟢 Low)
504
+ - Update roadmap with "To Implement" items (🔴 Critical marked as such)
505
+
506
+ ---
507
+
508
+ ✅ **Phase 0 Complete: Context Analysis Finalized**
509
+
510
+ ---
511
+
512
+ ### Phase Summary
513
+
514
+ - Pre-populated detected tech stack values.
515
+ - Architectural patterns identified.
516
+ - Context cached in `.ai-flow/cache/docs-analysis.json`.
517
+ - **Documentation audit completed** (if existing docs found).
518
+ - **Inconsistencies flagged** for Phase 8 resolution.
519
+
520
+ ---
521
+
522
+ **Next Phase:** Phase 1 - Discovery & Business Requirements
523
+
524
+ **What happens next:**
525
+
526
+ - Phase 1-7 will use pre-populated answers (40-60% filled)
527
+ - You'll only answer questions that couldn't be auto-detected
528
+ - Phase 8 will offer to resolve documentation inconsistencies
529
+
530
+ Read: `.ai-flow/prompts/backend/flow-build-phase-1.md`
531
+
532
+ ---
533
+
534
+ _Version: 4.3 (Antigravity Optimized - With Integrated Audit)_
535
+ _Last Updated: 2025-12-22_