ai-flow-dev 2.6.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.
- package/README.md +24 -21
- package/package.json +6 -6
- package/prompts/backend/flow-check-review.md +648 -12
- package/prompts/backend/flow-check-test.md +520 -8
- package/prompts/backend/flow-check.md +687 -29
- package/prompts/backend/flow-commit.md +18 -49
- package/prompts/backend/flow-finish.md +919 -0
- package/prompts/backend/flow-release.md +949 -0
- package/prompts/backend/flow-work.md +296 -221
- package/prompts/desktop/flow-check-review.md +648 -12
- package/prompts/desktop/flow-check-test.md +520 -8
- package/prompts/desktop/flow-check.md +687 -29
- package/prompts/desktop/flow-commit.md +18 -49
- package/prompts/desktop/flow-finish.md +910 -0
- package/prompts/desktop/flow-release.md +662 -0
- package/prompts/desktop/flow-work.md +398 -219
- package/prompts/frontend/flow-check-review.md +648 -12
- package/prompts/frontend/flow-check-test.md +520 -8
- package/prompts/frontend/flow-check.md +687 -29
- package/prompts/frontend/flow-commit.md +18 -49
- package/prompts/frontend/flow-finish.md +910 -0
- package/prompts/frontend/flow-release.md +519 -0
- package/prompts/frontend/flow-work-api.md +1540 -0
- package/prompts/frontend/flow-work.md +774 -218
- package/prompts/mobile/flow-check-review.md +648 -12
- package/prompts/mobile/flow-check-test.md +520 -8
- package/prompts/mobile/flow-check.md +687 -29
- package/prompts/mobile/flow-commit.md +18 -49
- package/prompts/mobile/flow-finish.md +910 -0
- package/prompts/mobile/flow-release.md +751 -0
- package/prompts/mobile/flow-work-api.md +1493 -0
- package/prompts/mobile/flow-work.md +792 -222
- package/templates/AGENT.template.md +1 -1
|
@@ -6,62 +6,720 @@ description: Combined Validation workflow for Tests and Code Review
|
|
|
6
6
|
|
|
7
7
|
**YOU ARE AN EXPERT QUALITY ASSURANCE AND CODE REVIEW SPECIALIST.**
|
|
8
8
|
|
|
9
|
-
Your mission is to validate code quality and functionality through a
|
|
9
|
+
Your mission is to validate code quality and functionality through a comprehensive workflow when the user executes `/flow-check`.
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
+
**β οΈ IMPORTANTE:** Este workflow NO realiza commits. Solo valida y genera reportes.
|
|
14
|
+
|
|
13
15
|
---
|
|
16
|
+
|
|
14
17
|
## Command: `/flow-check`
|
|
15
18
|
|
|
16
19
|
### Objective
|
|
20
|
+
|
|
17
21
|
Provide a comprehensive validation suite including automated tests and professional code review in a single, prioritized report.
|
|
18
22
|
|
|
19
23
|
---
|
|
20
|
-
|
|
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
|
+
---
|
|
21
142
|
|
|
22
143
|
### Stage 1: Automated Testing & Analysis
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
---
|
|
27
318
|
|
|
28
319
|
### 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
320
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
```
|
|
41
452
|
|
|
42
453
|
---
|
|
43
|
-
## Integration with `status.json`
|
|
44
454
|
|
|
45
|
-
|
|
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
|
+
|
|
46
467
|
```json
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
}
|
|
51
479
|
}
|
|
52
480
|
```
|
|
53
481
|
|
|
54
|
-
|
|
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:**
|
|
55
586
|
```json
|
|
56
|
-
|
|
57
|
-
"
|
|
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
|
+
}
|
|
58
637
|
}
|
|
638
|
+
````
|
|
639
|
+
|
|
640
|
+
#### Present Report to User
|
|
641
|
+
|
|
642
|
+
**Console output:**
|
|
643
|
+
|
|
59
644
|
```
|
|
645
|
+
β
Quality check complete!
|
|
60
646
|
|
|
647
|
+
π Summary:
|
|
61
648
|
---
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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.
|
|
65
691
|
|
|
66
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
|
+
|
|
67
725
|
**BEGIN EXECUTION when user runs `/flow-check`**
|