qaa-agent 1.6.2 → 1.6.3

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 (73) hide show
  1. package/.claude/commands/create-test.md +164 -164
  2. package/.claude/commands/qa-audit.md +37 -37
  3. package/.claude/commands/qa-blueprint.md +54 -54
  4. package/.claude/commands/qa-fix.md +36 -36
  5. package/.claude/commands/qa-from-ticket.md +24 -24
  6. package/.claude/commands/qa-gap.md +20 -20
  7. package/.claude/commands/qa-map.md +47 -47
  8. package/.claude/commands/qa-pom.md +36 -36
  9. package/.claude/commands/qa-pr.md +23 -23
  10. package/.claude/commands/qa-pyramid.md +37 -37
  11. package/.claude/commands/qa-report.md +38 -38
  12. package/.claude/commands/qa-research.md +33 -33
  13. package/.claude/commands/qa-start.md +22 -22
  14. package/.claude/commands/qa-testid.md +19 -19
  15. package/.claude/commands/qa-validate.md +42 -42
  16. package/.claude/commands/update-test.md +58 -58
  17. package/.claude/settings.json +20 -20
  18. package/.claude/skills/qa-bug-detective/SKILL.md +122 -122
  19. package/.claude/skills/qa-learner/SKILL.md +150 -150
  20. package/.claude/skills/qa-repo-analyzer/SKILL.md +88 -88
  21. package/.claude/skills/qa-self-validator/SKILL.md +109 -109
  22. package/.claude/skills/qa-template-engine/SKILL.md +113 -113
  23. package/.claude/skills/qa-testid-injector/SKILL.md +93 -93
  24. package/.claude/skills/qa-workflow-documenter/SKILL.md +87 -87
  25. package/.mcp.json +8 -8
  26. package/CHANGELOG.md +71 -71
  27. package/CLAUDE.md +553 -553
  28. package/agents/qa-pipeline-orchestrator.md +1378 -1378
  29. package/agents/qaa-analyzer.md +524 -524
  30. package/agents/qaa-bug-detective.md +446 -446
  31. package/agents/qaa-codebase-mapper.md +935 -935
  32. package/agents/qaa-e2e-runner.md +415 -415
  33. package/agents/qaa-executor.md +651 -651
  34. package/agents/qaa-planner.md +390 -390
  35. package/agents/qaa-project-researcher.md +319 -319
  36. package/agents/qaa-scanner.md +424 -424
  37. package/agents/qaa-testid-injector.md +585 -585
  38. package/agents/qaa-validator.md +452 -452
  39. package/bin/install.cjs +198 -198
  40. package/bin/lib/commands.cjs +709 -709
  41. package/bin/lib/config.cjs +307 -307
  42. package/bin/lib/core.cjs +497 -497
  43. package/bin/lib/frontmatter.cjs +299 -299
  44. package/bin/lib/init.cjs +989 -989
  45. package/bin/lib/milestone.cjs +241 -241
  46. package/bin/lib/model-profiles.cjs +60 -60
  47. package/bin/lib/phase.cjs +911 -911
  48. package/bin/lib/roadmap.cjs +306 -306
  49. package/bin/lib/state.cjs +748 -748
  50. package/bin/lib/template.cjs +222 -222
  51. package/bin/lib/verify.cjs +842 -842
  52. package/bin/qaa-tools.cjs +607 -607
  53. package/docs/COMMANDS.md +341 -341
  54. package/docs/DEMO.md +182 -182
  55. package/docs/TESTING.md +156 -156
  56. package/package.json +41 -41
  57. package/templates/failure-classification.md +391 -391
  58. package/templates/gap-analysis.md +409 -409
  59. package/templates/pr-template.md +48 -48
  60. package/templates/qa-analysis.md +381 -381
  61. package/templates/qa-audit-report.md +465 -465
  62. package/templates/qa-repo-blueprint.md +636 -636
  63. package/templates/scan-manifest.md +312 -312
  64. package/templates/test-inventory.md +582 -582
  65. package/templates/testid-audit-report.md +354 -354
  66. package/templates/validation-report.md +243 -243
  67. package/workflows/qa-analyze.md +296 -296
  68. package/workflows/qa-from-ticket.md +536 -536
  69. package/workflows/qa-gap.md +303 -303
  70. package/workflows/qa-pr.md +389 -389
  71. package/workflows/qa-start.md +1168 -1168
  72. package/workflows/qa-testid.md +356 -356
  73. package/workflows/qa-validate.md +295 -295
@@ -1,295 +1,295 @@
1
- <purpose>
2
- Validate existing test files against CLAUDE.md QA standards using a 4-layer check (Syntax, Structure, Dependencies, Logic). Runs a fix loop (validate, fix, re-validate) up to 3 times. If failures remain after the fix loop, optionally spawns the bug-detective agent to classify failures. Produces VALIDATION_REPORT.md and optionally FAILURE_CLASSIFICATION_REPORT.md. Use this workflow to audit test quality in any test suite -- whether generated by the QA pipeline or hand-written.
3
- </purpose>
4
-
5
- <required_reading>
6
- - `CLAUDE.md` -- QA automation standards, quality gates, locator strategy, POM rules, assertion specificity rules
7
- - `agents/qaa-validator.md` -- Validator agent definition (4-layer validation, fix loop, confidence assessment)
8
- - `agents/qaa-bug-detective.md` -- Bug detective agent definition (failure classification, auto-fix for test errors)
9
- - `templates/validation-report.md` -- VALIDATION_REPORT.md format contract
10
- - `templates/failure-classification.md` -- FAILURE_CLASSIFICATION_REPORT.md format contract
11
- </required_reading>
12
-
13
- <process>
14
-
15
- <step name="parse_arguments">
16
- ## Step 1: Parse Arguments
17
-
18
- Parse `$ARGUMENTS` for the test directory path and optional flags.
19
-
20
- **Supported arguments:**
21
- - `<path>` -- Path to the test directory to validate (positional)
22
- - `--classify` -- If set, spawn bug-detective after validation to classify remaining failures
23
- - No arguments -- auto-detect test directories
24
-
25
- **Parsing logic:**
26
-
27
- ```bash
28
- TEST_DIR=""
29
- CLASSIFY_FAILURES=false
30
-
31
- # Parse positional path argument
32
- # Parse --classify flag
33
- ```
34
-
35
- **Validation:**
36
- - If a path is provided, verify it exists and is a directory. If not, print error: `"Error: Test directory does not exist: {path}"` and STOP.
37
- - If no path provided, proceed to auto-detection in the next step.
38
- </step>
39
-
40
- <step name="detect_test_directories">
41
- ## Step 2: Detect Test Directories
42
-
43
- If no test directory was specified, auto-detect by searching for common test directory patterns.
44
-
45
- **Detection order (check each, use the first match):**
46
-
47
- 1. `tests/` -- Standard test directory
48
- 2. `__tests__/` -- Jest convention
49
- 3. `cypress/` -- Cypress test directory
50
- 4. `e2e/` -- E2E test directory
51
- 5. `test/` -- Alternative singular form
52
- 6. `spec/` -- RSpec/generic spec directory
53
-
54
- **Detection logic:**
55
-
56
- ```bash
57
- if TEST_DIR is empty:
58
- for dir in tests __tests__ cypress e2e test spec:
59
- if directory exists at "${dir}":
60
- TEST_DIR="${dir}"
61
- break
62
- ```
63
-
64
- **If no test directory found:**
65
-
66
- Print error and STOP:
67
- ```
68
- Error: No test directory found.
69
- Searched for: tests/, __tests__/, cypress/, e2e/, test/, spec/
70
- Provide the test directory path as an argument: /qa-validate <path>
71
- ```
72
-
73
- **Count test files:**
74
-
75
- ```bash
76
- TEST_FILE_COUNT=$(find "${TEST_DIR}" -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "*.cy.*" -o -name "*.e2e.*" \) | wc -l)
77
- ```
78
-
79
- If `TEST_FILE_COUNT` is 0, print error: `"Error: No test files found in {TEST_DIR}. Expected files matching *.test.*, *.spec.*, *.cy.*, or *.e2e.*"` and STOP.
80
-
81
- **Print detection results:**
82
-
83
- ```
84
- Test directory: {TEST_DIR}
85
- Test files found: {TEST_FILE_COUNT}
86
- ```
87
- </step>
88
-
89
- <step name="build_file_list">
90
- ## Step 3: Build File List for Validation
91
-
92
- Enumerate all test files and supporting files (page objects, fixtures) to validate.
93
-
94
- **File discovery:**
95
-
96
- Glob for test-related files in the detected directory:
97
- - Test specs: `**/*.test.*`, `**/*.spec.*`, `**/*.cy.*`, `**/*.e2e.*`
98
- - Page objects: `**/pages/**/*`, `**/page-objects/**/*`, `**/support/page-objects/**/*`
99
- - Fixtures: `**/fixtures/**/*`
100
- - Config files: test framework configs at the project root
101
-
102
- **Build a generation-plan-equivalent file list:**
103
-
104
- The validator agent expects a file list (normally from the generation plan). For this workflow, construct a synthetic file list from the discovered files:
105
-
106
- ```markdown
107
- ## Files to Validate
108
-
109
- | File Path | Type |
110
- |-----------|------|
111
- | tests/unit/auth.unit.spec.ts | test_spec |
112
- | tests/api/users.api.spec.ts | test_spec |
113
- | pages/auth/LoginPage.ts | page_object |
114
- | fixtures/auth-data.ts | fixture |
115
- | ... | ... |
116
- ```
117
-
118
- **Set output directory:**
119
-
120
- ```bash
121
- OUTPUT_DIR=".qa-output"
122
- mkdir -p "${OUTPUT_DIR}"
123
- ```
124
- </step>
125
-
126
- <step name="run_validator">
127
- ## Step 4: Spawn Validator Agent
128
-
129
- Spawn the validator agent to perform 4-layer validation with fix loop.
130
-
131
- ```
132
- Task(
133
- prompt="
134
- <objective>Validate test files against CLAUDE.md standards across 4 layers (Syntax, Structure, Dependencies, Logic)</objective>
135
- <execution_context>@agents/qaa-validator.md</execution_context>
136
- <files_to_read>
137
- - CLAUDE.md
138
- - {synthetic file list or generation plan path}
139
- </files_to_read>
140
- <parameters>
141
- test_dir: {TEST_DIR}
142
- output_path: {OUTPUT_DIR}/VALIDATION_REPORT.md
143
- file_list: {list of test file paths}
144
- mode: validation
145
- </parameters>
146
- "
147
- )
148
- ```
149
-
150
- **Handle validator return:**
151
-
152
- Extract from the validator's return values:
153
- - `overall_status` -- PASS, PASS_WITH_WARNINGS, or FAIL
154
- - `confidence` -- HIGH, MEDIUM, or LOW
155
- - `layers_summary` -- per-layer PASS/FAIL status
156
- - `fix_loops_used` -- number of fix iterations (1-3)
157
- - `issues_found` -- total issues discovered
158
- - `issues_fixed` -- issues auto-fixed (HIGH confidence only)
159
- - `unresolved_count` -- issues remaining after fix loops
160
-
161
- **Verify VALIDATION_REPORT.md exists:**
162
-
163
- ```bash
164
- [ -f "${OUTPUT_DIR}/VALIDATION_REPORT.md" ] && echo "FOUND" || echo "MISSING"
165
- ```
166
-
167
- If missing, print error: `"Error: Validator did not produce VALIDATION_REPORT.md."` and STOP.
168
- </step>
169
-
170
- <step name="classify_failures">
171
- ## Step 5: Optionally Spawn Bug Detective
172
-
173
- If the `--classify` flag was set AND the validator reported failures (unresolved_count > 0), spawn the bug-detective agent to classify the remaining failures.
174
-
175
- **Gate check:**
176
-
177
- ```
178
- if CLASSIFY_FAILURES is false:
179
- Skip this step -- print note: "Skipping failure classification. Use --classify flag to enable."
180
-
181
- if unresolved_count is 0:
182
- Skip this step -- print note: "No unresolved failures to classify."
183
- ```
184
-
185
- **Spawn bug-detective agent:**
186
-
187
- ```
188
- Task(
189
- prompt="
190
- <objective>Run test suite and classify failures into APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, or INCONCLUSIVE</objective>
191
- <execution_context>@agents/qaa-bug-detective.md</execution_context>
192
- <files_to_read>
193
- - CLAUDE.md
194
- - {test file paths with failures}
195
- </files_to_read>
196
- <parameters>
197
- test_dir: {TEST_DIR}
198
- output_path: {OUTPUT_DIR}/FAILURE_CLASSIFICATION_REPORT.md
199
- </parameters>
200
- "
201
- )
202
- ```
203
-
204
- **Handle detective return:**
205
-
206
- Extract from the detective's return values:
207
- - `total_failures` -- number of failures analyzed
208
- - `classification_breakdown` -- counts per category (app_bug, test_error, env_issue, inconclusive)
209
- - `auto_fixes_applied` -- count of TEST CODE ERROR fixes at HIGH confidence
210
- - `auto_fixes_verified` -- count of fixes that passed re-verification
211
-
212
- **Verify FAILURE_CLASSIFICATION_REPORT.md exists (if detective was spawned):**
213
-
214
- ```bash
215
- [ -f "${OUTPUT_DIR}/FAILURE_CLASSIFICATION_REPORT.md" ] && echo "FOUND" || echo "MISSING"
216
- ```
217
- </step>
218
-
219
- <step name="print_summary">
220
- ## Step 6: Print Validation Summary
221
-
222
- Print a human-readable summary of the validation results.
223
-
224
- ```
225
- === Validation Complete ===
226
-
227
- Test Directory: {TEST_DIR}
228
- Files Validated: {file_count}
229
- Fix Loops Used: {fix_loops_used} of 3
230
-
231
- Layer Results:
232
- Syntax: {PASS|FAIL}
233
- Structure: {PASS|FAIL}
234
- Dependencies: {PASS|FAIL}
235
- Logic: {PASS|FAIL}
236
-
237
- Issues:
238
- Found: {issues_found}
239
- Auto-fixed: {issues_fixed}
240
- Unresolved: {unresolved_count}
241
-
242
- Overall Status: {PASS|PASS_WITH_WARNINGS|FAIL}
243
- Confidence: {HIGH|MEDIUM|LOW}
244
-
245
- Artifacts Produced:
246
- - {OUTPUT_DIR}/VALIDATION_REPORT.md
247
- - {OUTPUT_DIR}/FAILURE_CLASSIFICATION_REPORT.md (if --classify used)
248
- ```
249
-
250
- **If bug detective ran, add classification summary:**
251
-
252
- ```
253
- Failure Classification:
254
- APPLICATION BUG: {app_bug_count}
255
- TEST CODE ERROR: {test_error_count}
256
- ENVIRONMENT ISSUE: {env_issue_count}
257
- INCONCLUSIVE: {inconclusive_count}
258
- Auto-fixed: {auto_fixes_applied}
259
- ```
260
-
261
- ```
262
- ===========================
263
- ```
264
- </step>
265
-
266
- </process>
267
-
268
- <output>
269
- This workflow validates existing test files and produces quality reports.
270
-
271
- **Artifacts produced:**
272
-
273
- | Artifact | When Produced | Description |
274
- |----------|---------------|-------------|
275
- | VALIDATION_REPORT.md | Always | 4-layer validation results (Syntax, Structure, Dependencies, Logic) with fix loop history and confidence level |
276
- | FAILURE_CLASSIFICATION_REPORT.md | When --classify flag set AND failures exist | Per-failure classification (APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, INCONCLUSIVE) with evidence and auto-fix log |
277
-
278
- **Side effects:**
279
- - Test files may be modified in-place by HIGH-confidence auto-fixes from the validator
280
- - Test files may be modified by HIGH-confidence TEST CODE ERROR fixes from the bug detective
281
- - No git branches created (fixes applied to working tree)
282
- - No PRs created
283
- </output>
284
-
285
- <error_handling>
286
- | Error | Cause | Action |
287
- |-------|-------|--------|
288
- | Test directory does not exist | Invalid path argument | Print error with path, STOP |
289
- | No test directory found | No common test dirs in project | Print error listing searched dirs, suggest providing path, STOP |
290
- | No test files found in directory | Directory exists but contains no test files | Print error with expected patterns, STOP |
291
- | VALIDATION_REPORT.md missing | Validator failed silently | Print error, STOP |
292
- | Fix loop exhausted (3 loops) | Issues cannot be auto-resolved | Validator checkpoints with unresolved issue details |
293
- | Test runner not detected | No test framework config found | Bug detective checkpoints for user to specify runner |
294
- | Test runner fails to start | Missing dependencies or broken config | Bug detective classifies as ENVIRONMENT ISSUE |
295
- </error_handling>
1
+ <purpose>
2
+ Validate existing test files against CLAUDE.md QA standards using a 4-layer check (Syntax, Structure, Dependencies, Logic). Runs a fix loop (validate, fix, re-validate) up to 3 times. If failures remain after the fix loop, optionally spawns the bug-detective agent to classify failures. Produces VALIDATION_REPORT.md and optionally FAILURE_CLASSIFICATION_REPORT.md. Use this workflow to audit test quality in any test suite -- whether generated by the QA pipeline or hand-written.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ - `CLAUDE.md` -- QA automation standards, quality gates, locator strategy, POM rules, assertion specificity rules
7
+ - `agents/qaa-validator.md` -- Validator agent definition (4-layer validation, fix loop, confidence assessment)
8
+ - `agents/qaa-bug-detective.md` -- Bug detective agent definition (failure classification, auto-fix for test errors)
9
+ - `templates/validation-report.md` -- VALIDATION_REPORT.md format contract
10
+ - `templates/failure-classification.md` -- FAILURE_CLASSIFICATION_REPORT.md format contract
11
+ </required_reading>
12
+
13
+ <process>
14
+
15
+ <step name="parse_arguments">
16
+ ## Step 1: Parse Arguments
17
+
18
+ Parse `$ARGUMENTS` for the test directory path and optional flags.
19
+
20
+ **Supported arguments:**
21
+ - `<path>` -- Path to the test directory to validate (positional)
22
+ - `--classify` -- If set, spawn bug-detective after validation to classify remaining failures
23
+ - No arguments -- auto-detect test directories
24
+
25
+ **Parsing logic:**
26
+
27
+ ```bash
28
+ TEST_DIR=""
29
+ CLASSIFY_FAILURES=false
30
+
31
+ # Parse positional path argument
32
+ # Parse --classify flag
33
+ ```
34
+
35
+ **Validation:**
36
+ - If a path is provided, verify it exists and is a directory. If not, print error: `"Error: Test directory does not exist: {path}"` and STOP.
37
+ - If no path provided, proceed to auto-detection in the next step.
38
+ </step>
39
+
40
+ <step name="detect_test_directories">
41
+ ## Step 2: Detect Test Directories
42
+
43
+ If no test directory was specified, auto-detect by searching for common test directory patterns.
44
+
45
+ **Detection order (check each, use the first match):**
46
+
47
+ 1. `tests/` -- Standard test directory
48
+ 2. `__tests__/` -- Jest convention
49
+ 3. `cypress/` -- Cypress test directory
50
+ 4. `e2e/` -- E2E test directory
51
+ 5. `test/` -- Alternative singular form
52
+ 6. `spec/` -- RSpec/generic spec directory
53
+
54
+ **Detection logic:**
55
+
56
+ ```bash
57
+ if TEST_DIR is empty:
58
+ for dir in tests __tests__ cypress e2e test spec:
59
+ if directory exists at "${dir}":
60
+ TEST_DIR="${dir}"
61
+ break
62
+ ```
63
+
64
+ **If no test directory found:**
65
+
66
+ Print error and STOP:
67
+ ```
68
+ Error: No test directory found.
69
+ Searched for: tests/, __tests__/, cypress/, e2e/, test/, spec/
70
+ Provide the test directory path as an argument: /qa-validate <path>
71
+ ```
72
+
73
+ **Count test files:**
74
+
75
+ ```bash
76
+ TEST_FILE_COUNT=$(find "${TEST_DIR}" -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "*.cy.*" -o -name "*.e2e.*" \) | wc -l)
77
+ ```
78
+
79
+ If `TEST_FILE_COUNT` is 0, print error: `"Error: No test files found in {TEST_DIR}. Expected files matching *.test.*, *.spec.*, *.cy.*, or *.e2e.*"` and STOP.
80
+
81
+ **Print detection results:**
82
+
83
+ ```
84
+ Test directory: {TEST_DIR}
85
+ Test files found: {TEST_FILE_COUNT}
86
+ ```
87
+ </step>
88
+
89
+ <step name="build_file_list">
90
+ ## Step 3: Build File List for Validation
91
+
92
+ Enumerate all test files and supporting files (page objects, fixtures) to validate.
93
+
94
+ **File discovery:**
95
+
96
+ Glob for test-related files in the detected directory:
97
+ - Test specs: `**/*.test.*`, `**/*.spec.*`, `**/*.cy.*`, `**/*.e2e.*`
98
+ - Page objects: `**/pages/**/*`, `**/page-objects/**/*`, `**/support/page-objects/**/*`
99
+ - Fixtures: `**/fixtures/**/*`
100
+ - Config files: test framework configs at the project root
101
+
102
+ **Build a generation-plan-equivalent file list:**
103
+
104
+ The validator agent expects a file list (normally from the generation plan). For this workflow, construct a synthetic file list from the discovered files:
105
+
106
+ ```markdown
107
+ ## Files to Validate
108
+
109
+ | File Path | Type |
110
+ |-----------|------|
111
+ | tests/unit/auth.unit.spec.ts | test_spec |
112
+ | tests/api/users.api.spec.ts | test_spec |
113
+ | pages/auth/LoginPage.ts | page_object |
114
+ | fixtures/auth-data.ts | fixture |
115
+ | ... | ... |
116
+ ```
117
+
118
+ **Set output directory:**
119
+
120
+ ```bash
121
+ OUTPUT_DIR=".qa-output"
122
+ mkdir -p "${OUTPUT_DIR}"
123
+ ```
124
+ </step>
125
+
126
+ <step name="run_validator">
127
+ ## Step 4: Spawn Validator Agent
128
+
129
+ Spawn the validator agent to perform 4-layer validation with fix loop.
130
+
131
+ ```
132
+ Task(
133
+ prompt="
134
+ <objective>Validate test files against CLAUDE.md standards across 4 layers (Syntax, Structure, Dependencies, Logic)</objective>
135
+ <execution_context>@agents/qaa-validator.md</execution_context>
136
+ <files_to_read>
137
+ - CLAUDE.md
138
+ - {synthetic file list or generation plan path}
139
+ </files_to_read>
140
+ <parameters>
141
+ test_dir: {TEST_DIR}
142
+ output_path: {OUTPUT_DIR}/VALIDATION_REPORT.md
143
+ file_list: {list of test file paths}
144
+ mode: validation
145
+ </parameters>
146
+ "
147
+ )
148
+ ```
149
+
150
+ **Handle validator return:**
151
+
152
+ Extract from the validator's return values:
153
+ - `overall_status` -- PASS, PASS_WITH_WARNINGS, or FAIL
154
+ - `confidence` -- HIGH, MEDIUM, or LOW
155
+ - `layers_summary` -- per-layer PASS/FAIL status
156
+ - `fix_loops_used` -- number of fix iterations (1-3)
157
+ - `issues_found` -- total issues discovered
158
+ - `issues_fixed` -- issues auto-fixed (HIGH confidence only)
159
+ - `unresolved_count` -- issues remaining after fix loops
160
+
161
+ **Verify VALIDATION_REPORT.md exists:**
162
+
163
+ ```bash
164
+ [ -f "${OUTPUT_DIR}/VALIDATION_REPORT.md" ] && echo "FOUND" || echo "MISSING"
165
+ ```
166
+
167
+ If missing, print error: `"Error: Validator did not produce VALIDATION_REPORT.md."` and STOP.
168
+ </step>
169
+
170
+ <step name="classify_failures">
171
+ ## Step 5: Optionally Spawn Bug Detective
172
+
173
+ If the `--classify` flag was set AND the validator reported failures (unresolved_count > 0), spawn the bug-detective agent to classify the remaining failures.
174
+
175
+ **Gate check:**
176
+
177
+ ```
178
+ if CLASSIFY_FAILURES is false:
179
+ Skip this step -- print note: "Skipping failure classification. Use --classify flag to enable."
180
+
181
+ if unresolved_count is 0:
182
+ Skip this step -- print note: "No unresolved failures to classify."
183
+ ```
184
+
185
+ **Spawn bug-detective agent:**
186
+
187
+ ```
188
+ Task(
189
+ prompt="
190
+ <objective>Run test suite and classify failures into APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, or INCONCLUSIVE</objective>
191
+ <execution_context>@agents/qaa-bug-detective.md</execution_context>
192
+ <files_to_read>
193
+ - CLAUDE.md
194
+ - {test file paths with failures}
195
+ </files_to_read>
196
+ <parameters>
197
+ test_dir: {TEST_DIR}
198
+ output_path: {OUTPUT_DIR}/FAILURE_CLASSIFICATION_REPORT.md
199
+ </parameters>
200
+ "
201
+ )
202
+ ```
203
+
204
+ **Handle detective return:**
205
+
206
+ Extract from the detective's return values:
207
+ - `total_failures` -- number of failures analyzed
208
+ - `classification_breakdown` -- counts per category (app_bug, test_error, env_issue, inconclusive)
209
+ - `auto_fixes_applied` -- count of TEST CODE ERROR fixes at HIGH confidence
210
+ - `auto_fixes_verified` -- count of fixes that passed re-verification
211
+
212
+ **Verify FAILURE_CLASSIFICATION_REPORT.md exists (if detective was spawned):**
213
+
214
+ ```bash
215
+ [ -f "${OUTPUT_DIR}/FAILURE_CLASSIFICATION_REPORT.md" ] && echo "FOUND" || echo "MISSING"
216
+ ```
217
+ </step>
218
+
219
+ <step name="print_summary">
220
+ ## Step 6: Print Validation Summary
221
+
222
+ Print a human-readable summary of the validation results.
223
+
224
+ ```
225
+ === Validation Complete ===
226
+
227
+ Test Directory: {TEST_DIR}
228
+ Files Validated: {file_count}
229
+ Fix Loops Used: {fix_loops_used} of 3
230
+
231
+ Layer Results:
232
+ Syntax: {PASS|FAIL}
233
+ Structure: {PASS|FAIL}
234
+ Dependencies: {PASS|FAIL}
235
+ Logic: {PASS|FAIL}
236
+
237
+ Issues:
238
+ Found: {issues_found}
239
+ Auto-fixed: {issues_fixed}
240
+ Unresolved: {unresolved_count}
241
+
242
+ Overall Status: {PASS|PASS_WITH_WARNINGS|FAIL}
243
+ Confidence: {HIGH|MEDIUM|LOW}
244
+
245
+ Artifacts Produced:
246
+ - {OUTPUT_DIR}/VALIDATION_REPORT.md
247
+ - {OUTPUT_DIR}/FAILURE_CLASSIFICATION_REPORT.md (if --classify used)
248
+ ```
249
+
250
+ **If bug detective ran, add classification summary:**
251
+
252
+ ```
253
+ Failure Classification:
254
+ APPLICATION BUG: {app_bug_count}
255
+ TEST CODE ERROR: {test_error_count}
256
+ ENVIRONMENT ISSUE: {env_issue_count}
257
+ INCONCLUSIVE: {inconclusive_count}
258
+ Auto-fixed: {auto_fixes_applied}
259
+ ```
260
+
261
+ ```
262
+ ===========================
263
+ ```
264
+ </step>
265
+
266
+ </process>
267
+
268
+ <output>
269
+ This workflow validates existing test files and produces quality reports.
270
+
271
+ **Artifacts produced:**
272
+
273
+ | Artifact | When Produced | Description |
274
+ |----------|---------------|-------------|
275
+ | VALIDATION_REPORT.md | Always | 4-layer validation results (Syntax, Structure, Dependencies, Logic) with fix loop history and confidence level |
276
+ | FAILURE_CLASSIFICATION_REPORT.md | When --classify flag set AND failures exist | Per-failure classification (APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, INCONCLUSIVE) with evidence and auto-fix log |
277
+
278
+ **Side effects:**
279
+ - Test files may be modified in-place by HIGH-confidence auto-fixes from the validator
280
+ - Test files may be modified by HIGH-confidence TEST CODE ERROR fixes from the bug detective
281
+ - No git branches created (fixes applied to working tree)
282
+ - No PRs created
283
+ </output>
284
+
285
+ <error_handling>
286
+ | Error | Cause | Action |
287
+ |-------|-------|--------|
288
+ | Test directory does not exist | Invalid path argument | Print error with path, STOP |
289
+ | No test directory found | No common test dirs in project | Print error listing searched dirs, suggest providing path, STOP |
290
+ | No test files found in directory | Directory exists but contains no test files | Print error with expected patterns, STOP |
291
+ | VALIDATION_REPORT.md missing | Validator failed silently | Print error, STOP |
292
+ | Fix loop exhausted (3 loops) | Issues cannot be auto-resolved | Validator checkpoints with unresolved issue details |
293
+ | Test runner not detected | No test framework config found | Bug detective checkpoints for user to specify runner |
294
+ | Test runner fails to start | Missing dependencies or broken config | Bug detective classifies as ENVIRONMENT ISSUE |
295
+ </error_handling>