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,67 +1,725 @@
1
- ---
2
- description: Combined Validation workflow for Tests and Code Review
3
- ---
4
-
5
- # AI Flow - Unified Check Workflow
6
-
7
- **YOU ARE AN EXPERT QUALITY ASSURANCE AND CODE REVIEW SPECIALIST.**
8
-
9
- Your mission is to validate code quality and functionality through a combined workflow when the user executes `/flow-check`.
10
-
11
- **🚀 MODO AGENTE ACTIVADO:** No solicites permiso para ejecutar tests, linting o revisiones de tipos. Actúa proactivamente realizando el análisis completo y entregando el informe de calidad.
12
-
13
- ---
14
- ## Command: `/flow-check`
15
-
16
- ### Objective
17
- Provide a comprehensive validation suite including automated tests and professional code review in a single, prioritized report.
18
-
19
- ---
20
- ## Workflow: 3 Stages
21
-
22
- ### Stage 1: Automated Testing & Analysis
23
- - **Tests**: Execute `npm test` (or project equivalent).
24
- - **Lint**: Execute linting rules.
25
- - **Types**: Execute type checking (`tsc`).
26
- - **Update `status.json`**: Record results in `validation` section.
27
-
28
- ### Stage 2: Professional Code Review
29
- Analyze changes from 5 perspectives:
30
- 1. **🔒 Security**: SQLi, XSS, Secrets, Auth patterns.
31
- 2. **⚡ Performance**: N+1 queries, memory leaks, blocking ops.
32
- 3. **🧪 Testing**: Coverage, edge cases, test quality.
33
- 4. **📐 Architecture**: SOLID, DRY, Coupling.
34
- 5. **🎨 Code Quality**: Naming, complexity, consistency.
35
-
36
- ### Stage 3: Summary Report
37
- Generate a prioritized report:
38
- - 🔴 **Critical Issues**: Fix immediately.
39
- - 🟡 **Warnings**: Fix before merge.
40
- - 🟢 **Suggestions**: Improvement opportunities.
41
-
42
- ---
43
- ## Integration with `status.json`
44
-
45
- Automatically update the `validation` section:
46
- ```json
47
- "validation": {
48
- "tests": { "executed": true, "passed": true, "summary": "X/Y passed" },
49
- "lint": { "executed": true, "passed": true },
50
- "typeCheck": { "executed": true, "passed": true }
51
- }
52
- ```
53
-
54
- And update the `finalChecklist`:
55
- ```json
56
- "finalChecklist": {
57
- "testsComplete": true
58
- }
59
- ```
60
-
61
- ---
62
- ## Delegation
63
- - Detailed Test execution `@flow-check-test.md`
64
- - Detailed Review logic → `@flow-check-review.md`
65
-
66
- ---
67
- **BEGIN EXECUTION when user runs `/flow-check`**
1
+ ---
2
+ description: Combined Validation workflow for Tests and Code Review
3
+ ---
4
+
5
+ # AI Flow - Unified Check Workflow
6
+
7
+ **YOU ARE AN EXPERT QUALITY ASSURANCE AND CODE REVIEW SPECIALIST.**
8
+
9
+ Your mission is to validate code quality and functionality through a comprehensive workflow when the user executes `/flow-check`.
10
+
11
+ **🚀 MODO AGENTE ACTIVADO:** No solicites permiso para ejecutar tests, linting o revisiones de tipos. Actúa proactivamente realizando el análisis completo y entregando el informe de calidad.
12
+
13
+ **⚠️ IMPORTANTE:** Este workflow NO realiza commits. Solo valida y genera reportes.
14
+
15
+ ---
16
+
17
+ ## Command: `/flow-check`
18
+
19
+ ### Objective
20
+
21
+ Provide a comprehensive validation suite including automated tests and professional code review in a single, prioritized report.
22
+
23
+ ---
24
+
25
+ ## Prerequisites Verification
26
+
27
+ Before starting, verify the project setup:
28
+
29
+ 1. **Check `.ai-flow/work/status.json` exists**
30
+ - If missing: Create basic structure with empty validation section
31
+ - Location: `.ai-flow/work/status.json`
32
+
33
+ 2. **Detect Test Runner**
34
+ - Check project configuration files:
35
+ - Node.js: `package.json` → scripts: `test`, `test:unit`, `test:integration`
36
+ - Python: `pytest.ini`, `pyproject.toml`, `tox.ini`
37
+ - Java: `pom.xml` (Maven), `build.gradle` (Gradle), `build.xml` (Ant)
38
+ - Ruby: `Rakefile`, `.rspec`
39
+ - Go: `*_test.go` files
40
+ - PHP: `phpunit.xml`, `composer.json`
41
+ - Rust: `Cargo.toml`
42
+ - C#/.NET: `*.csproj`, `.sln`
43
+ - Common runners: `npm test`, `pytest`, `jest`, `vitest`, `mvn test`, `gradle test`, `cargo test`, `dotnet test`, `go test`, `rspec`, `phpunit`
44
+ - If missing: Skip test execution, note in report
45
+
46
+ 3. **Detect Linter**
47
+ - Check for configuration files:
48
+ - JavaScript/TypeScript: `eslint`, `.eslintrc.*`, `biome.json`
49
+ - Python: `ruff`, `pylint`, `flake8`, `.pylintrc`, `pyproject.toml`
50
+ - Go: `golangci-lint`, `.golangci.yml`
51
+ - Java: `checkstyle.xml`, `pmd.xml`, `spotbugs.xml`
52
+ - Ruby: `.rubocop.yml`, `rubocop`
53
+ - PHP: `phpcs.xml`, `phpstan.neon`, `psalm.xml`
54
+ - Rust: `clippy` (built-in)
55
+ - C#: `.editorconfig`, `StyleCop`, `Roslyn analyzers`
56
+ - Commands: `npm run lint`, `ruff check`, `golangci-lint run`, `rubocop`, `phpcs`, `cargo clippy`, `dotnet format --verify-no-changes`
57
+ - If missing: Skip linting, note in report
58
+
59
+ 4. **Detect Type Checker**
60
+ - JavaScript/TypeScript: Check `tsconfig.json`, run `tsc --noEmit`
61
+ - Python: Check `mypy`, `pyright`, `pytype`, `pyre`
62
+ - Go: Built-in type system (`go build`)
63
+ - Java: Built-in type system (`javac`, Maven/Gradle compile)
64
+ - Ruby: `sorbet`, `rbs`, `steep`
65
+ - PHP: `psalm`, `phpstan`
66
+ - Rust: Built-in type system (`cargo check`)
67
+ - C#: Built-in type system (`dotnet build`)
68
+ - If missing: Skip type check, note in report
69
+
70
+ ---
71
+
72
+ ## Scope Detection
73
+
74
+ Determine what files to analyze:
75
+
76
+ ### Option A: Git Repository (PREFERRED)
77
+
78
+ ```bash
79
+ # Check if git repository
80
+ if [ -d ".git" ]; then
81
+ # Get changed files since last commit or main branch
82
+ git diff --name-only HEAD
83
+ # OR compare with main branch
84
+ git diff --name-only main...HEAD
85
+ fi
86
+ ```
87
+
88
+ ### Option B: No Git
89
+
90
+ - Analyze all source files in common directories:
91
+ - General: `src/`, `lib/`, `app/`, `backend/`, `api/`, `internal/`, `pkg/`
92
+ - Java: `src/main/java/`, `src/test/java/`
93
+ - Python: `src/`, `lib/`, package directories
94
+ - Ruby: `lib/`, `app/`
95
+ - PHP: `src/`, `app/`, `lib/`
96
+ - Go: `cmd/`, `pkg/`, `internal/`
97
+ - Rust: `src/`, `tests/`
98
+ - C#: project directories with `.cs` files
99
+ - Exclude: `node_modules/`, `dist/`, `build/`, `__pycache__/`, `.ai-flow/`, `target/`, `vendor/`, `bin/`, `obj/`, `out/`
100
+
101
+ ### Store Scope
102
+
103
+ ```json
104
+ "validation": {
105
+ "scope": {
106
+ "files": ["src/api/users.java", "src/models/user.java"],
107
+ "totalFiles": 2,
108
+ "detectionMethod": "git-diff"
109
+ }
110
+ }
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Workflow: 4 Stages
116
+
117
+ ### Stage 0: Initialization
118
+
119
+ 1. **Read current status**
120
+
121
+ ```bash
122
+ cat .ai-flow/work/status.json
123
+ ```
124
+
125
+ 2. **Create report metadata**
126
+
127
+ ```json
128
+ {
129
+ "reportId": "check-20260307-103045",
130
+ "timestamp": "2026-03-07T10:30:45Z",
131
+ "scope": {...}
132
+ }
133
+ ```
134
+
135
+ 3. **Announce start**
136
+ ```
137
+ 🔍 Starting comprehensive validation...
138
+ 📂 Scope: 12 files detected
139
+ ```
140
+
141
+ ---
142
+
143
+ ### Stage 1: Automated Testing & Analysis
144
+
145
+ #### Step 1.1: Execute Tests
146
+
147
+ **Detect and run test command:**
148
+
149
+ ```bash
150
+ # Node.js/JavaScript
151
+ npm test -- --coverage --json > .ai-flow/cache/test-results.json 2>&1
152
+
153
+ # Python
154
+ pytest --cov --json-report --json-report-file=.ai-flow/cache/test-results.json
155
+
156
+ # Go
157
+ go test -v -coverprofile=.ai-flow/cache/coverage.out ./... 2>&1 | tee .ai-flow/cache/test-results.txt
158
+
159
+ # Java (Maven)
160
+ mvn test -q > .ai-flow/cache/test-results.txt 2>&1
161
+
162
+ # Java (Gradle)
163
+ gradle test --quiet > .ai-flow/cache/test-results.txt 2>&1
164
+
165
+ # Ruby (RSpec)
166
+ rspec --format json --out .ai-flow/cache/test-results.json
167
+
168
+ # PHP (PHPUnit)
169
+ phpunit --log-junit .ai-flow/cache/test-results.xml
170
+
171
+ # Rust (Cargo)
172
+ cargo test --quiet > .ai-flow/cache/test-results.txt 2>&1
173
+
174
+ # C# (.NET)
175
+ dotnet test --logger "trx;LogFileName=test-results.trx" --results-directory .ai-flow/cache/
176
+ ```
177
+
178
+ **Parse results:**
179
+
180
+ - Total tests executed
181
+ - Tests passed / failed
182
+ - Test coverage percentage
183
+ - Failed test details (name, error, file)
184
+
185
+ **Handle failures:**
186
+
187
+ - If tests fail: Continue workflow, mark as ⛔ BLOCKED
188
+ - If command not found: Skip, note as "Not configured"
189
+ - Timeout after 5 minutes
190
+
191
+ **Update status.json:**
192
+
193
+ ```json
194
+ "validation": {
195
+ "tests": {
196
+ "executed": true,
197
+ "passed": 15,
198
+ "failed": 2,
199
+ "skipped": 0,
200
+ "total": 17,
201
+ "coverage": 78.5,
202
+ "duration": "12.3s",
203
+ "summary": "15/17 passed (88%)",
204
+ "status": "failed",
205
+ "failedTests": [
206
+ {"name": "User.create should validate email", "file": "tests/user_test.java"}
207
+ ]
208
+ }
209
+ }
210
+ ```
211
+
212
+ #### Step 1.2: Execute Linting
213
+
214
+ **Run linter:**
215
+
216
+ ```bash
217
+ # JavaScript/TypeScript (ESLint)
218
+ npm run lint -- --format json > .ai-flow/cache/lint-results.json 2>&1
219
+
220
+ # Python (Ruff)
221
+ ruff check --output-format json > .ai-flow/cache/lint-results.json
222
+
223
+ # Go (golangci-lint)
224
+ golangci-lint run --out-format json > .ai-flow/cache/lint-results.json
225
+
226
+ # Java (Checkstyle)
227
+ checkstyle -f json -c checkstyle.xml src/ > .ai-flow/cache/lint-results.json
228
+
229
+ # Ruby (RuboCop)
230
+ rubocop --format json --out .ai-flow/cache/lint-results.json
231
+
232
+ # PHP (PHP_CodeSniffer)
233
+ phpcs --report=json --report-file=.ai-flow/cache/lint-results.json
234
+
235
+ # Rust (Clippy)
236
+ cargo clippy --message-format=json > .ai-flow/cache/lint-results.json 2>&1
237
+
238
+ # C# (.NET)
239
+ dotnet format --verify-no-changes --report .ai-flow/cache/lint-results.json
240
+ ```
241
+
242
+ **Parse results:**
243
+
244
+ - Total errors
245
+ - Total warnings
246
+ - Group by rule/category
247
+ - Top 5 most frequent issues
248
+
249
+ **Update status.json:**
250
+
251
+ ```json
252
+ "validation": {
253
+ "lint": {
254
+ "executed": true,
255
+ "passed": false,
256
+ "errors": 3,
257
+ "warnings": 12,
258
+ "fixable": 8,
259
+ "summary": "3 errors, 12 warnings",
260
+ "topIssues": [
261
+ {"rule": "no-unused-vars", "count": 5},
262
+ {"rule": "prefer-const", "count": 3}
263
+ ]
264
+ }
265
+ }
266
+ ```
267
+
268
+ #### Step 1.3: Execute Type Checking
269
+
270
+ **Run type checker:**
271
+
272
+ ```bash
273
+ # JavaScript/TypeScript
274
+ tsc --noEmit --pretty false > .ai-flow/cache/type-results.txt 2>&1
275
+
276
+ # Python (mypy)
277
+ mypy src/ --json-report .ai-flow/cache/
278
+
279
+ # Go (built-in)
280
+ go build -o /dev/null ./... 2>&1
281
+
282
+ # Java (javac - usually via build tool)
283
+ mvn compile -q > .ai-flow/cache/type-results.txt 2>&1
284
+
285
+ # Ruby (Sorbet)
286
+ srb tc --lsp-disable-diagnostics > .ai-flow/cache/type-results.txt 2>&1
287
+
288
+ # PHP (Psalm)
289
+ psalm --output-format=json > .ai-flow/cache/type-results.json
290
+
291
+ # Rust (cargo check)
292
+ cargo check --message-format=json > .ai-flow/cache/type-results.json 2>&1
293
+
294
+ # C# (dotnet build)
295
+ dotnet build --no-incremental > .ai-flow/cache/type-results.txt 2>&1
296
+ ```
297
+
298
+ **Parse results:**
299
+
300
+ - Type errors count
301
+ - Error locations
302
+ - Error categories
303
+
304
+ **Update status.json:**
305
+
306
+ ```json
307
+ "validation": {
308
+ "typeCheck": {
309
+ "executed": true,
310
+ "passed": true,
311
+ "errors": 0,
312
+ "summary": "No type errors"
313
+ }
314
+ }
315
+ ```
316
+
317
+ ---
318
+
319
+ ### Stage 2: Professional Code Review
320
+
321
+ Analyze code from **5 critical perspectives**. For detailed methodology, see `@flow-check-review.md`.
322
+
323
+ #### Perspective 1: 🔒 Security Analysis
324
+
325
+ **Check for:**
326
+
327
+ - SQL Injection vulnerabilities (raw queries, string concatenation)
328
+ - XSS vectors (unescaped user input, innerHTML usage)
329
+ - Secrets in code (API keys, passwords, tokens)
330
+ - Authentication bypass (missing auth checks, weak session handling)
331
+ - CSRF vulnerabilities (missing CSRF tokens)
332
+ - Insecure dependencies (known CVEs)
333
+
334
+ **Example findings:**
335
+
336
+ ```markdown
337
+ 🔴 **CRITICAL - SQL Injection**
338
+ File: `src/api/UserController.java:45`
339
+ Raw query with user input: `executeQuery("SELECT * FROM users WHERE id = " + userId)`
340
+ **Fix:** Use parameterized queries or prepared statements
341
+
342
+ ⚠️ **WARNING - Hardcoded Secret**
343
+ File: `src/config/DatabaseConfig.java:12`
344
+ Found potential API key: `String API_KEY = "sk_live_..."`
345
+ **Fix:** Move to environment variables
346
+ ```
347
+
348
+ #### Perspective 2: ⚡ Performance Analysis
349
+
350
+ **Check for:**
351
+
352
+ - N+1 query problems (loops with DB queries)
353
+ - Memory leaks (unclosed connections, event listeners)
354
+ - Blocking operations (synchronous I/O, CPU-heavy tasks in main thread)
355
+ - Inefficient algorithms (O(n²) where O(n) possible)
356
+ - Missing indexes (frequent queries on unindexed columns)
357
+ - Large payload transfers (missing pagination)
358
+
359
+ **Example findings:**
360
+
361
+ ```markdown
362
+ 🔴 **CRITICAL - N+1 Query**
363
+ File: `src/api/PostController.java:23-28`
364
+ Loop executes query per item (100 queries for 100 items)
365
+ **Fix:** Use batch query with JOIN, IN clause, or eager loading
366
+
367
+ 🟡 **WARNING - Blocking Operation**
368
+ File: `src/utils/FileParser.java:56`
369
+ Synchronous I/O operation in request handler
370
+ **Fix:** Use async I/O, streaming, or move to background thread
371
+ ```
372
+
373
+ #### Perspective 3: 🧪 Testing Quality
374
+
375
+ **Check for:**
376
+
377
+ - Edge cases coverage (null, empty, boundary values)
378
+ - Test organization (clear describe/it structure)
379
+ - Test independence (no shared state)
380
+ - Assertion quality (specific expectations, not just truthy)
381
+ - Mock usage (proper isolation)
382
+ - Integration test coverage (critical paths)
383
+
384
+ **Example findings:**
385
+
386
+ ```markdown
387
+ 🟡 **WARNING - Missing Edge Cases**
388
+ File: `tests/ValidatorTest.java`
389
+ Email validator tests only happy path, missing:
390
+
391
+ - Empty string
392
+ - Null values
393
+ - Invalid formats
394
+ - Very long emails (>254 chars)
395
+ - Special characters
396
+
397
+ 🟢 **SUGGESTION - Improve Assertions**
398
+ File: `tests/ApiTest.java:34`
399
+ Weak assertion: `assertTrue(response != null)`
400
+ **Better:** `assertEquals(200, response.getStatusCode())`
401
+ ```
402
+
403
+ #### Perspective 4: 📐 Architecture Analysis
404
+
405
+ **Check for:**
406
+
407
+ - SOLID violations (SRP, OCP, LSP, ISP, DIP)
408
+ - DRY violations (duplicated logic)
409
+ - High coupling (too many dependencies)
410
+ - Low cohesion (unrelated responsibilities)
411
+ - Missing abstractions (direct implementation details)
412
+ - Circular dependencies
413
+
414
+ **Example findings:**
415
+
416
+ ```markdown
417
+ 🟡 **WARNING - SRP Violation**
418
+ File: `src/services/UserService.java`
419
+ Class handles user CRUD + email sending + notifications + logging
420
+ **Fix:** Extract EmailService, NotificationService
421
+
422
+ 🟢 **SUGGESTION - DRY Violation**
423
+ Files: `src/api/UserController.java:23`, `src/api/PostController.java:45`
424
+ Authentication check duplicated in 8 endpoints
425
+ **Fix:** Create authentication interceptor/middleware/filter
426
+ ```
427
+
428
+ #### Perspective 5: 🎨 Code Quality
429
+
430
+ **Check for:**
431
+
432
+ - Naming clarity (descriptive, consistent)
433
+ - Function complexity (cyclomatic complexity < 10)
434
+ - File size (< 300 lines)
435
+ - Comment quality (why not what)
436
+ - Consistent style (formatting, conventions)
437
+ - Magic numbers/strings
438
+
439
+ **Example findings:**
440
+
441
+ ```markdown
442
+ 🟡 **WARNING - High Complexity**
443
+ File: `src/utils/DataProcessor.java:processData()`
444
+ Cyclomatic complexity: 15 (threshold: 10)
445
+ **Fix:** Extract smaller methods, apply Extract Method refactoring
446
+
447
+ 🟢 **SUGGESTION - Magic Number**
448
+ File: `src/config/ApplicationLimits.java:8`
449
+ Hardcoded: `if (count > 100)`
450
+ **Fix:** Extract to named constant: `MAX_ITEMS_PER_PAGE`
451
+ ```
452
+
453
+ ---
454
+
455
+ ### Stage 3: Summary Report Generation
456
+
457
+ #### Aggregate All Findings
458
+
459
+ **Categorize by priority:**
460
+
461
+ - 🔴 **Critical Issues**: Security vulnerabilities, major bugs, broken tests
462
+ - 🟡 **Warnings**: Performance issues, bad practices, architecture violations
463
+ - 🟢 **Suggestions**: Code style, minor improvements, refactoring opportunities
464
+
465
+ **Calculate metrics:**
466
+
467
+ ```json
468
+ {
469
+ "summary": {
470
+ "overallStatus": "FAIL", // PASS | WARNINGS | FAIL
471
+ "criticalIssues": 2,
472
+ "warnings": 8,
473
+ "suggestions": 15,
474
+ "totalIssues": 25,
475
+ "testsPassed": false,
476
+ "lintPassed": false,
477
+ "typeCheckPassed": true
478
+ }
479
+ }
480
+ ```
481
+
482
+ #### Generate Report Document
483
+
484
+ **Report structure:**
485
+
486
+ ````markdown
487
+ # Quality Check Report
488
+
489
+ **Date:** 2026-03-07 10:30:45
490
+ **Status:** 🔴 FAIL
491
+ **Scope:** 12 files analyzed
492
+
493
+ ---
494
+
495
+ ## 📊 Summary
496
+
497
+ - ⛔ Tests: 15/17 passed (88%)
498
+ - ⚠️ Linting: 3 errors, 12 warnings
499
+ - ✅ Type Check: Passed
500
+ - 🔴 Critical Issues: 2
501
+ - 🟡 Warnings: 8
502
+ - 🟢 Suggestions: 15
503
+
504
+ ---
505
+
506
+ ## 🚨 Critical Issues (Must Fix)
507
+
508
+ ### 1. SQL Injection Vulnerability
509
+
510
+ **File:** [src/api/UserController.java](src/api/UserController.java#L45)
511
+ **Category:** Security
512
+ **Description:** Raw SQL query with user input
513
+ **Impact:** High - Database compromise possible
514
+ **Fix:**
515
+
516
+ ```java
517
+ // Before
518
+ String query = "SELECT * FROM users WHERE id = " + userId;
519
+ statement.executeQuery(query);
520
+
521
+ // After
522
+ PreparedStatement stmt = conn.prepareStatement("SELECT * FROM users WHERE id = ?");
523
+ stmt.setInt(1, userId);
524
+ stmt.executeQuery();
525
+ ```
526
+ ````
527
+
528
+ [Continue for all critical issues...]
529
+
530
+ ---
531
+
532
+ ## ⚠️ Warnings (Fix Before Merge)
533
+
534
+ [List all warnings with similar structure...]
535
+
536
+ ---
537
+
538
+ ## 💡 Suggestions (Improvement Opportunities)
539
+
540
+ [List all suggestions...]
541
+
542
+ ---
543
+
544
+ ## 🧪 Test Results Details
545
+
546
+ **Coverage:** 78.5%
547
+ **Failed Tests:**
548
+
549
+ 1. User creation should validate email format
550
+ - File: tests/UserTest.java:23
551
+ - Error: Expected email validation to reject invalid format
552
+
553
+ ---
554
+
555
+ ## 📋 Linting Details
556
+
557
+ **Top Issues:**
558
+
559
+ 1. no-unused-vars: 5 occurrences
560
+ 2. prefer-const: 3 occurrences
561
+
562
+ ---
563
+
564
+ ## 🎯 Next Steps
565
+
566
+ 1. Fix 2 critical security issues immediately
567
+ 2. Address failing tests (2 tests)
568
+ 3. Fix linting errors (3 errors)
569
+ 4. Review and address 8 warnings
570
+ 5. Consider 15 suggestions for code improvement
571
+
572
+ **Estimated effort:** ~4 hours
573
+
574
+ ````
575
+
576
+ **Save report:**
577
+ - Location: `.ai-flow/reviews/check-{timestamp}.md`
578
+ - Example: `.ai-flow/reviews/check-20260307-103045.md`
579
+
580
+ ---
581
+ ### Stage 4: Status Update
582
+
583
+ #### Update `status.json`
584
+
585
+ **Complete validation section:**
586
+ ```json
587
+ {
588
+ "validation": {
589
+ "lastCheck": "2026-03-07T10:30:45Z",
590
+ "reportPath": ".ai-flow/reviews/check-20260307-103045.md",
591
+ "overallStatus": "FAIL",
592
+ "scope": {
593
+ "files": ["src/api/UserController.java", "src/models/User.java"],
594
+ "totalFiles": 12,
595
+ "detectionMethod": "git-diff"
596
+ },
597
+ "tests": {
598
+ "executed": true,
599
+ "passed": 15,
600
+ "failed": 2,
601
+ "total": 17,
602
+ "coverage": 78.5,
603
+ "summary": "15/17 passed (88%)",
604
+ "status": "failed"
605
+ },
606
+ "lint": {
607
+ "executed": true,
608
+ "passed": false,
609
+ "errors": 3,
610
+ "warnings": 12,
611
+ "fixable": 8
612
+ },
613
+ "typeCheck": {
614
+ "executed": true,
615
+ "passed": true,
616
+ "errors": 0
617
+ },
618
+ "review": {
619
+ "criticalIssues": 2,
620
+ "warnings": 8,
621
+ "suggestions": 15,
622
+ "totalIssues": 25,
623
+ "perspectives": {
624
+ "security": {"critical": 2, "warnings": 1},
625
+ "performance": {"critical": 0, "warnings": 3},
626
+ "testing": {"critical": 0, "warnings": 2},
627
+ "architecture": {"critical": 0, "warnings": 1},
628
+ "quality": {"critical": 0, "warnings": 1}
629
+ }
630
+ }
631
+ },
632
+ "finalChecklist": {
633
+ "testsComplete": false,
634
+ "qualityCheckPassed": false,
635
+ "readyForMerge": false
636
+ }
637
+ }
638
+ ````
639
+
640
+ #### Present Report to User
641
+
642
+ **Console output:**
643
+
644
+ ```
645
+ ✅ Quality check complete!
646
+
647
+ 📊 Summary:
648
+ ---
649
+ ⛔ Tests: 15/17 passed (88%)
650
+ ⚠️ Linting: 3 errors, 12 warnings
651
+ ✅ Type Check: Passed
652
+ 🔴 Critical: 2 issues
653
+ 🟡 Warnings: 8 issues
654
+ 🟢 Suggestions: 15 items
655
+
656
+ 📄 Full report saved to:
657
+ .ai-flow/reviews/check-20260307-103045.md
658
+
659
+ 🚨 Action required: Fix 2 critical issues before proceeding.
660
+ ```
661
+
662
+ ---
663
+
664
+ ## Error Handling Strategy
665
+
666
+ ### Test Execution Errors
667
+
668
+ - **Command not found**: Skip tests, note in report as "Not configured"
669
+ - **Tests fail**: Continue workflow, include failures in report
670
+ - **Timeout**: Stop after 5 minutes, report partial results
671
+ - **Parse error**: Show raw output, continue workflow
672
+
673
+ ### Linting Errors
674
+
675
+ - **Command not found**: Skip linting, note in report
676
+ - **Configuration error**: Show error, continue workflow
677
+ - **Parse error**: Show raw output, continue
678
+
679
+ ### Type Check Errors
680
+
681
+ - **Command not found**: Skip, note in report
682
+ - **Configuration error**: Show error, continue
683
+
684
+ ### File System Errors
685
+
686
+ - **Cannot create report directory**: Use temp directory
687
+ - **Cannot read status.json**: Create new one
688
+ - **Cannot write status.json**: Show error, continue
689
+
690
+ **General rule:** Always complete full workflow. Partial results better than no results.
691
+
692
+ ---
693
+
694
+ ## Technical References
695
+
696
+ For deeper implementation details:
697
+
698
+ - **Testing methodology**: See `@flow-check-test.md`
699
+ - **Review criteria**: See `@flow-check-review.md`
700
+
701
+ ---
702
+
703
+ ## Execution Flow Summary
704
+
705
+ ```
706
+ /flow-check executed
707
+
708
+ [Prerequisites] → Verify tools (test runner, linter, type checker)
709
+
710
+ [Scope Detection] → Determine files to analyze (git diff or all src/)
711
+
712
+ [Stage 1] → Run automated tests + linting + type checking
713
+
714
+ [Stage 2] → Perform 5-perspective code review
715
+
716
+ [Stage 3] → Generate prioritized report
717
+
718
+ [Stage 4] → Update status.json + present results
719
+
720
+ DONE (No commits, only validation)
721
+ ```
722
+
723
+ ---
724
+
725
+ **BEGIN EXECUTION when user runs `/flow-check`**