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