qaa-agent 1.6.2 → 1.7.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 (78) hide show
  1. package/.mcp.json +8 -8
  2. package/CHANGELOG.md +93 -71
  3. package/CLAUDE.md +553 -553
  4. package/agents/qa-pipeline-orchestrator.md +1378 -1378
  5. package/agents/qaa-analyzer.md +539 -524
  6. package/agents/qaa-bug-detective.md +479 -446
  7. package/agents/qaa-codebase-mapper.md +935 -935
  8. package/agents/qaa-discovery.md +384 -0
  9. package/agents/qaa-e2e-runner.md +416 -415
  10. package/agents/qaa-executor.md +651 -651
  11. package/agents/qaa-planner.md +405 -390
  12. package/agents/qaa-project-researcher.md +319 -319
  13. package/agents/qaa-scanner.md +424 -424
  14. package/agents/qaa-testid-injector.md +643 -585
  15. package/agents/qaa-validator.md +490 -452
  16. package/bin/install.cjs +200 -198
  17. package/bin/lib/commands.cjs +709 -709
  18. package/bin/lib/config.cjs +307 -307
  19. package/bin/lib/core.cjs +497 -497
  20. package/bin/lib/frontmatter.cjs +299 -299
  21. package/bin/lib/init.cjs +989 -989
  22. package/bin/lib/milestone.cjs +241 -241
  23. package/bin/lib/model-profiles.cjs +60 -60
  24. package/bin/lib/phase.cjs +911 -911
  25. package/bin/lib/roadmap.cjs +306 -306
  26. package/bin/lib/state.cjs +748 -748
  27. package/bin/lib/template.cjs +222 -222
  28. package/bin/lib/verify.cjs +842 -842
  29. package/bin/qaa-tools.cjs +607 -607
  30. package/commands/qa-audit.md +119 -0
  31. package/commands/qa-create-test.md +288 -0
  32. package/commands/qa-fix.md +147 -0
  33. package/commands/qa-map.md +137 -0
  34. package/{.claude/commands → commands}/qa-pr.md +23 -23
  35. package/{.claude/commands → commands}/qa-start.md +22 -22
  36. package/{.claude/commands → commands}/qa-testid.md +19 -19
  37. package/docs/COMMANDS.md +341 -341
  38. package/docs/DEMO.md +182 -182
  39. package/docs/TESTING.md +156 -156
  40. package/package.json +6 -7
  41. package/{.claude/settings.json → settings.json} +1 -2
  42. package/templates/failure-classification.md +391 -391
  43. package/templates/gap-analysis.md +409 -409
  44. package/templates/pr-template.md +48 -48
  45. package/templates/qa-analysis.md +381 -381
  46. package/templates/qa-audit-report.md +465 -465
  47. package/templates/qa-repo-blueprint.md +636 -636
  48. package/templates/scan-manifest.md +312 -312
  49. package/templates/test-inventory.md +582 -582
  50. package/templates/testid-audit-report.md +354 -354
  51. package/templates/validation-report.md +243 -243
  52. package/workflows/qa-analyze.md +296 -296
  53. package/workflows/qa-from-ticket.md +536 -536
  54. package/workflows/qa-gap.md +309 -303
  55. package/workflows/qa-pr.md +389 -389
  56. package/workflows/qa-start.md +1192 -1168
  57. package/workflows/qa-testid.md +384 -356
  58. package/workflows/qa-validate.md +299 -295
  59. package/.claude/commands/create-test.md +0 -164
  60. package/.claude/commands/qa-audit.md +0 -37
  61. package/.claude/commands/qa-blueprint.md +0 -54
  62. package/.claude/commands/qa-fix.md +0 -36
  63. package/.claude/commands/qa-from-ticket.md +0 -24
  64. package/.claude/commands/qa-gap.md +0 -20
  65. package/.claude/commands/qa-map.md +0 -47
  66. package/.claude/commands/qa-pom.md +0 -36
  67. package/.claude/commands/qa-pyramid.md +0 -37
  68. package/.claude/commands/qa-report.md +0 -38
  69. package/.claude/commands/qa-research.md +0 -33
  70. package/.claude/commands/qa-validate.md +0 -42
  71. package/.claude/commands/update-test.md +0 -58
  72. package/.claude/skills/qa-learner/SKILL.md +0 -150
  73. /package/{.claude/skills → skills}/qa-bug-detective/SKILL.md +0 -0
  74. /package/{.claude/skills → skills}/qa-repo-analyzer/SKILL.md +0 -0
  75. /package/{.claude/skills → skills}/qa-self-validator/SKILL.md +0 -0
  76. /package/{.claude/skills → skills}/qa-template-engine/SKILL.md +0 -0
  77. /package/{.claude/skills → skills}/qa-testid-injector/SKILL.md +0 -0
  78. /package/{.claude/skills → skills}/qa-workflow-documenter/SKILL.md +0 -0
@@ -1,303 +1,309 @@
1
- <purpose>
2
- Compare a developer repository against a QA repository to identify coverage gaps, broken tests, quality issues, and missing test cases. Scans both repositories, performs gap analysis, and produces a comprehensive GAP_ANALYSIS.md with coverage maps, missing test inventories, broken test diagnostics, and quality assessments. Both --dev-repo and --qa-repo paths are required. Use this workflow when a QA repo already exists but may have incomplete coverage or quality issues.
3
- </purpose>
4
-
5
- <required_reading>
6
- - `CLAUDE.md` -- QA automation standards, pipeline stages, module boundaries, verification commands, quality gates
7
- - `agents/qaa-scanner.md` -- Scanner agent definition (scans both dev and QA repos)
8
- - `agents/qaa-analyzer.md` -- Analyzer agent definition (gap mode produces GAP_ANALYSIS.md)
9
- - `templates/scan-manifest.md` -- SCAN_MANIFEST.md format contract
10
- - `templates/gap-analysis.md` -- GAP_ANALYSIS.md format contract
11
- - `templates/qa-analysis.md` -- QA_ANALYSIS.md format contract
12
- - `templates/test-inventory.md` -- TEST_INVENTORY.md format contract
13
- </required_reading>
14
-
15
- <process>
16
-
17
- <step name="parse_arguments">
18
- ## Step 1: Parse Arguments
19
-
20
- Parse `$ARGUMENTS` for both repository paths. Both are required for gap analysis.
21
-
22
- **Supported arguments:**
23
- - `--dev-repo <path>` -- Path to the developer repository (required)
24
- - `--qa-repo <path>` -- Path to the existing QA test repository (required)
25
-
26
- **Parsing logic:**
27
-
28
- ```bash
29
- DEV_REPO=""
30
- QA_REPO=""
31
-
32
- # Parse --dev-repo and --qa-repo from $ARGUMENTS
33
- ```
34
-
35
- **Validation:**
36
-
37
- If `--dev-repo` is missing or empty:
38
- ```
39
- Error: --dev-repo is required for gap analysis.
40
- Usage: /qa-gap --dev-repo <path> --qa-repo <path>
41
- ```
42
- STOP.
43
-
44
- If `--qa-repo` is missing or empty:
45
- ```
46
- Error: --qa-repo is required for gap analysis.
47
- Usage: /qa-gap --dev-repo <path> --qa-repo <path>
48
-
49
- To analyze a dev repo without an existing QA repo, use /qa-analyze instead.
50
- ```
51
- STOP.
52
-
53
- If `--dev-repo` path does not exist:
54
- ```
55
- Error: Dev repo path does not exist: {path}
56
- ```
57
- STOP.
58
-
59
- If `--qa-repo` path does not exist:
60
- ```
61
- Error: QA repo path does not exist: {path}
62
- ```
63
- STOP.
64
- </step>
65
-
66
- <step name="setup_output">
67
- ## Step 2: Setup Output Directory
68
-
69
- Create the output directory and print the gap analysis banner.
70
-
71
- ```bash
72
- OUTPUT_DIR=".qa-output"
73
- mkdir -p "${OUTPUT_DIR}"
74
- ```
75
-
76
- **Print banner:**
77
-
78
- ```
79
- === QA Gap Analysis ===
80
- Dev Repo: {DEV_REPO}
81
- QA Repo: {QA_REPO}
82
- Output: {OUTPUT_DIR}
83
- ========================
84
- ```
85
- </step>
86
-
87
- <step name="scan_both_repos">
88
- ## Step 3: Spawn Scanner Agent on Both Repos
89
-
90
- Spawn the scanner agent to scan both the developer and QA repositories, producing a combined SCAN_MANIFEST.md.
91
-
92
- ```
93
- Task(
94
- prompt="
95
- <objective>Scan both developer and QA repositories and produce SCAN_MANIFEST.md with combined file trees</objective>
96
- <execution_context>@agents/qaa-scanner.md</execution_context>
97
- <files_to_read>
98
- - CLAUDE.md
99
- </files_to_read>
100
- <parameters>
101
- dev_repo_path: {DEV_REPO}
102
- qa_repo_path: {QA_REPO}
103
- output_path: {OUTPUT_DIR}/SCAN_MANIFEST.md
104
- </parameters>
105
- "
106
- )
107
- ```
108
-
109
- **Handle scanner return:**
110
-
111
- - If scanner returns `decision: STOP` -- print the stop reason and STOP.
112
- - If scanner returns `decision: PROCEED` -- continue.
113
- - Extract `has_frontend` for summary reporting.
114
-
115
- **Verify SCAN_MANIFEST.md exists:**
116
-
117
- ```bash
118
- [ -f "${OUTPUT_DIR}/SCAN_MANIFEST.md" ] && echo "FOUND" || echo "MISSING"
119
- ```
120
-
121
- If missing, print error and STOP.
122
- </step>
123
-
124
- <step name="run_gap_analysis">
125
- ## Step 4: Spawn Analyzer Agent in Gap Mode
126
-
127
- Spawn the analyzer agent in gap analysis mode to compare dev repo testable surfaces against QA repo test coverage.
128
-
129
- ```
130
- Task(
131
- prompt="
132
- <objective>Perform gap analysis comparing dev repo testable surfaces against QA repo test coverage. Produce QA_ANALYSIS.md, TEST_INVENTORY.md, and GAP_ANALYSIS.md.</objective>
133
- <execution_context>@agents/qaa-analyzer.md</execution_context>
134
- <files_to_read>
135
- - {OUTPUT_DIR}/SCAN_MANIFEST.md
136
- - CLAUDE.md
137
- </files_to_read>
138
- <parameters>
139
- workflow_option: 2
140
- qa_analysis_path: {OUTPUT_DIR}/QA_ANALYSIS.md
141
- test_inventory_path: {OUTPUT_DIR}/TEST_INVENTORY.md
142
- gap_analysis_path: {OUTPUT_DIR}/GAP_ANALYSIS.md
143
- dev_repo_path: {DEV_REPO}
144
- qa_repo_path: {QA_REPO}
145
- </parameters>
146
- "
147
- )
148
- ```
149
-
150
- **Handle analyzer return:**
151
-
152
- Extract from the analyzer's return values:
153
- - `total_test_count` -- total test cases in inventory
154
- - `pyramid_breakdown` -- unit/integration/api/e2e counts
155
- - `risk_count` -- high/medium/low risk counts
156
-
157
- **Verify artifacts exist:**
158
-
159
- ```bash
160
- [ -f "${OUTPUT_DIR}/QA_ANALYSIS.md" ] && echo "FOUND: QA_ANALYSIS.md" || echo "MISSING: QA_ANALYSIS.md"
161
- [ -f "${OUTPUT_DIR}/TEST_INVENTORY.md" ] && echo "FOUND: TEST_INVENTORY.md" || echo "MISSING: TEST_INVENTORY.md"
162
- [ -f "${OUTPUT_DIR}/GAP_ANALYSIS.md" ] && echo "FOUND: GAP_ANALYSIS.md" || echo "MISSING: GAP_ANALYSIS.md"
163
- ```
164
-
165
- If any artifact is missing, print error with the specific missing file and STOP.
166
- </step>
167
-
168
- <step name="extract_gap_metrics">
169
- ## Step 5: Extract Gap Metrics
170
-
171
- Read the GAP_ANALYSIS.md to extract metrics for the summary.
172
-
173
- **Metrics to extract:**
174
-
175
- 1. **Coverage map:**
176
- - Total modules in dev repo
177
- - Modules with test coverage in QA repo
178
- - Modules without any test coverage
179
- - Coverage percentage: `(covered_modules / total_modules) * 100`
180
-
181
- 2. **Missing tests:**
182
- - Count of missing test cases by priority (P0, P1, P2)
183
- - Count of missing test cases by pyramid level (unit, integration, API, E2E)
184
- - Each missing test has an ID following naming convention
185
-
186
- 3. **Broken tests:**
187
- - Count of existing tests that are broken (fail, import errors, outdated selectors)
188
- - Each broken test has a failure reason documented
189
-
190
- 4. **Quality assessment:**
191
- - Locator tier distribution (what percentage of locators are Tier 1, 2, 3, 4)
192
- - Assertion quality rating (concrete vs vague assertions)
193
- - POM compliance (does existing QA repo follow POM rules)
194
-
195
- 5. **Recommendations priority:**
196
- - Fix broken tests first (highest priority)
197
- - Add P0 missing tests
198
- - Add P1 missing tests
199
- - Standardize existing tests to CLAUDE.md standards
200
- - Add P2 missing tests (lowest priority)
201
- </step>
202
-
203
- <step name="print_summary">
204
- ## Step 6: Print Gap Analysis Summary
205
-
206
- Print a comprehensive human-readable summary.
207
-
208
- ```
209
- === Gap Analysis Complete ===
210
-
211
- Coverage Overview:
212
- Dev Repo Modules: {total_modules}
213
- Modules with Coverage: {covered_modules}
214
- Modules without Tests: {uncovered_modules}
215
- Coverage Rate: {coverage_percent}%
216
-
217
- Missing Tests:
218
- P0 (blocks release): {p0_missing}
219
- P1 (should fix): {p1_missing}
220
- P2 (nice to have): {p2_missing}
221
- --------------------------
222
- Total Missing: {total_missing}
223
-
224
- By Pyramid Level:
225
- Unit: {unit_missing}
226
- Integration: {integration_missing}
227
- API: {api_missing}
228
- E2E: {e2e_missing}
229
-
230
- Broken Tests:
231
- Total Broken: {broken_count}
232
-
233
- Quality Assessment:
234
- Locator Quality:
235
- Tier 1 (data-testid, ARIA): {tier1_percent}%
236
- Tier 2 (labels, text): {tier2_percent}%
237
- Tier 3 (alt, title): {tier3_percent}%
238
- Tier 4 (CSS, XPath): {tier4_percent}%
239
- Assertion Quality: {concrete_percent}% concrete assertions
240
- POM Compliance: {pom_compliant}/{pom_total} files compliant
241
-
242
- Recommended Action Order:
243
- 1. Fix {broken_count} broken tests
244
- 2. Add {p0_missing} P0 missing tests
245
- 3. Add {p1_missing} P1 missing tests
246
- 4. Standardize existing tests
247
- 5. Add {p2_missing} P2 missing tests
248
-
249
- Artifacts Produced:
250
- - {OUTPUT_DIR}/SCAN_MANIFEST.md
251
- - {OUTPUT_DIR}/QA_ANALYSIS.md
252
- - {OUTPUT_DIR}/TEST_INVENTORY.md
253
- - {OUTPUT_DIR}/GAP_ANALYSIS.md
254
-
255
- No test files generated. No git operations performed.
256
- To generate missing tests, run the full pipeline with:
257
- /qa-start --dev-repo {DEV_REPO} --qa-repo {QA_REPO}
258
- =============================
259
- ```
260
- </step>
261
-
262
- </process>
263
-
264
- <output>
265
- This workflow compares dev and QA repos to identify coverage gaps.
266
-
267
- **Artifacts produced:**
268
-
269
- | Artifact | When Produced | Description |
270
- |----------|---------------|-------------|
271
- | SCAN_MANIFEST.md | Always | Combined scan of both repos with file trees and framework detection |
272
- | QA_ANALYSIS.md | Always | Architecture overview, risks, test targets, testing pyramid for the dev repo |
273
- | TEST_INVENTORY.md | Always | Complete test case inventory for what SHOULD exist |
274
- | GAP_ANALYSIS.md | Always | Coverage map, missing tests, broken tests, quality assessment, recommendations |
275
-
276
- **GAP_ANALYSIS.md sections (per templates/gap-analysis.md):**
277
-
278
- 1. **Coverage Map** -- Every module from SCAN_MANIFEST.md with covered/uncovered status
279
- 2. **Missing Tests** -- Test cases that should exist but do not, with IDs and priorities
280
- 3. **Broken Tests** -- Existing tests that fail, with failure reasons and file paths
281
- 4. **Quality Assessment** -- Locator tier distribution, assertion quality rating, POM compliance
282
- 5. **Recommendations** -- Prioritized action list: fix broken first, then add P0, then P1
283
-
284
- **No side effects:**
285
- - No git branches created
286
- - No git commits made
287
- - No PRs created
288
- - No test files generated
289
- - No source files modified
290
- </output>
291
-
292
- <error_handling>
293
- | Error | Cause | Action |
294
- |-------|-------|--------|
295
- | --dev-repo missing | Required argument not provided | Print usage with suggestion to use /qa-analyze for dev-only, STOP |
296
- | --qa-repo missing | Required argument not provided | Print usage with suggestion to use /qa-analyze for dev-only, STOP |
297
- | Dev repo path does not exist | Invalid path | Print error with path, STOP |
298
- | QA repo path does not exist | Invalid path | Print error with path, STOP |
299
- | Scanner returns STOP | No testable surfaces | Print scanner's reason, STOP |
300
- | SCAN_MANIFEST.md missing | Scanner failed | Print error, STOP |
301
- | GAP_ANALYSIS.md missing | Analyzer failed | Print error, STOP |
302
- | Framework detection LOW confidence | Ambiguous stack | Scanner checkpoints for user confirmation |
303
- </error_handling>
1
+ <purpose>
2
+ Compare a developer repository against a QA repository to identify coverage gaps, broken tests, quality issues, and missing test cases. Scans both repositories, performs gap analysis, and produces a comprehensive GAP_ANALYSIS.md with coverage maps, missing test inventories, broken test diagnostics, and quality assessments. Both --dev-repo and --qa-repo paths are required. Use this workflow when a QA repo already exists but may have incomplete coverage or quality issues.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ - `CLAUDE.md` -- QA automation standards, pipeline stages, module boundaries, verification commands, quality gates
7
+ - `agents/qaa-scanner.md` -- Scanner agent definition (scans both dev and QA repos)
8
+ - `agents/qaa-analyzer.md` -- Analyzer agent definition (gap mode produces GAP_ANALYSIS.md)
9
+ - `templates/scan-manifest.md` -- SCAN_MANIFEST.md format contract
10
+ - `templates/gap-analysis.md` -- GAP_ANALYSIS.md format contract
11
+ - `templates/qa-analysis.md` -- QA_ANALYSIS.md format contract
12
+ - `templates/test-inventory.md` -- TEST_INVENTORY.md format contract
13
+ </required_reading>
14
+
15
+ <process>
16
+
17
+ <step name="parse_arguments">
18
+ ## Step 1: Parse Arguments
19
+
20
+ Parse `$ARGUMENTS` for both repository paths. Both are required for gap analysis.
21
+
22
+ **Supported arguments:**
23
+ - `--dev-repo <path>` -- Path to the developer repository (required)
24
+ - `--qa-repo <path>` -- Path to the existing QA test repository (required)
25
+
26
+ **Parsing logic:**
27
+
28
+ ```bash
29
+ DEV_REPO=""
30
+ QA_REPO=""
31
+
32
+ # Parse --dev-repo and --qa-repo from $ARGUMENTS
33
+ ```
34
+
35
+ **Validation:**
36
+
37
+ If `--dev-repo` is missing or empty:
38
+ ```
39
+ Error: --dev-repo is required for gap analysis.
40
+ Usage: /qa-gap --dev-repo <path> --qa-repo <path>
41
+ ```
42
+ STOP.
43
+
44
+ If `--qa-repo` is missing or empty:
45
+ ```
46
+ Error: --qa-repo is required for gap analysis.
47
+ Usage: /qa-gap --dev-repo <path> --qa-repo <path>
48
+
49
+ To analyze a dev repo without an existing QA repo, use /qa-analyze instead.
50
+ ```
51
+ STOP.
52
+
53
+ If `--dev-repo` path does not exist:
54
+ ```
55
+ Error: Dev repo path does not exist: {path}
56
+ ```
57
+ STOP.
58
+
59
+ If `--qa-repo` path does not exist:
60
+ ```
61
+ Error: QA repo path does not exist: {path}
62
+ ```
63
+ STOP.
64
+ </step>
65
+
66
+ <step name="setup_output">
67
+ ## Step 2: Setup Output Directory
68
+
69
+ Create the output directory and print the gap analysis banner.
70
+
71
+ ```bash
72
+ OUTPUT_DIR=".qa-output"
73
+ mkdir -p "${OUTPUT_DIR}"
74
+ ```
75
+
76
+ **Print banner:**
77
+
78
+ ```
79
+ === QA Gap Analysis ===
80
+ Dev Repo: {DEV_REPO}
81
+ QA Repo: {QA_REPO}
82
+ Output: {OUTPUT_DIR}
83
+ ========================
84
+ ```
85
+ </step>
86
+
87
+ <step name="scan_both_repos">
88
+ ## Step 3: Spawn Scanner Agent on Both Repos
89
+
90
+ Spawn the scanner agent to scan both the developer and QA repositories, producing a combined SCAN_MANIFEST.md.
91
+
92
+ ```
93
+ Task(
94
+ prompt="
95
+ <objective>Scan both developer and QA repositories and produce SCAN_MANIFEST.md with combined file trees</objective>
96
+ <execution_context>@agents/qaa-scanner.md</execution_context>
97
+ <files_to_read>
98
+ - CLAUDE.md
99
+ </files_to_read>
100
+ <parameters>
101
+ dev_repo_path: {DEV_REPO}
102
+ qa_repo_path: {QA_REPO}
103
+ output_path: {OUTPUT_DIR}/SCAN_MANIFEST.md
104
+ </parameters>
105
+ "
106
+ )
107
+ ```
108
+
109
+ **Handle scanner return:**
110
+
111
+ - If scanner returns `decision: STOP` -- print the stop reason and STOP.
112
+ - If scanner returns `decision: PROCEED` -- continue.
113
+ - Extract `has_frontend` for summary reporting.
114
+
115
+ **Verify SCAN_MANIFEST.md exists:**
116
+
117
+ ```bash
118
+ [ -f "${OUTPUT_DIR}/SCAN_MANIFEST.md" ] && echo "FOUND" || echo "MISSING"
119
+ ```
120
+
121
+ If missing, print error and STOP.
122
+ </step>
123
+
124
+ <step name="run_gap_analysis">
125
+ ## Step 4: Spawn Analyzer Agent in Gap Mode
126
+
127
+ Spawn the analyzer agent in gap analysis mode to compare dev repo testable surfaces against QA repo test coverage.
128
+
129
+ ```
130
+ Task(
131
+ prompt="
132
+ <objective>Perform gap analysis comparing dev repo testable surfaces against QA repo test coverage. Use codebase map for deep context and locator registry for frontend coverage assessment. Produce QA_ANALYSIS.md, TEST_INVENTORY.md, and GAP_ANALYSIS.md.</objective>
133
+ <execution_context>@agents/qaa-analyzer.md</execution_context>
134
+ <files_to_read>
135
+ - {OUTPUT_DIR}/SCAN_MANIFEST.md
136
+ - CLAUDE.md
137
+ - .qa-output/locators/LOCATOR_REGISTRY.md (if exists -- locator coverage for risk assessment)
138
+ - .qa-output/codebase/RISK_MAP.md (if exists -- business-critical paths for risk assessment)
139
+ - .qa-output/codebase/CRITICAL_PATHS.md (if exists -- user flows for E2E scope)
140
+ - .qa-output/codebase/TEST_ASSESSMENT.md (if exists -- existing test quality)
141
+ - .qa-output/codebase/COVERAGE_GAPS.md (if exists -- uncovered modules)
142
+ </files_to_read>
143
+ <parameters>
144
+ workflow_option: 2
145
+ qa_analysis_path: {OUTPUT_DIR}/QA_ANALYSIS.md
146
+ test_inventory_path: {OUTPUT_DIR}/TEST_INVENTORY.md
147
+ gap_analysis_path: {OUTPUT_DIR}/GAP_ANALYSIS.md
148
+ dev_repo_path: {DEV_REPO}
149
+ qa_repo_path: {QA_REPO}
150
+ codebase_map_dir: .qa-output/codebase
151
+ </parameters>
152
+ "
153
+ )
154
+ ```
155
+
156
+ **Handle analyzer return:**
157
+
158
+ Extract from the analyzer's return values:
159
+ - `total_test_count` -- total test cases in inventory
160
+ - `pyramid_breakdown` -- unit/integration/api/e2e counts
161
+ - `risk_count` -- high/medium/low risk counts
162
+
163
+ **Verify artifacts exist:**
164
+
165
+ ```bash
166
+ [ -f "${OUTPUT_DIR}/QA_ANALYSIS.md" ] && echo "FOUND: QA_ANALYSIS.md" || echo "MISSING: QA_ANALYSIS.md"
167
+ [ -f "${OUTPUT_DIR}/TEST_INVENTORY.md" ] && echo "FOUND: TEST_INVENTORY.md" || echo "MISSING: TEST_INVENTORY.md"
168
+ [ -f "${OUTPUT_DIR}/GAP_ANALYSIS.md" ] && echo "FOUND: GAP_ANALYSIS.md" || echo "MISSING: GAP_ANALYSIS.md"
169
+ ```
170
+
171
+ If any artifact is missing, print error with the specific missing file and STOP.
172
+ </step>
173
+
174
+ <step name="extract_gap_metrics">
175
+ ## Step 5: Extract Gap Metrics
176
+
177
+ Read the GAP_ANALYSIS.md to extract metrics for the summary.
178
+
179
+ **Metrics to extract:**
180
+
181
+ 1. **Coverage map:**
182
+ - Total modules in dev repo
183
+ - Modules with test coverage in QA repo
184
+ - Modules without any test coverage
185
+ - Coverage percentage: `(covered_modules / total_modules) * 100`
186
+
187
+ 2. **Missing tests:**
188
+ - Count of missing test cases by priority (P0, P1, P2)
189
+ - Count of missing test cases by pyramid level (unit, integration, API, E2E)
190
+ - Each missing test has an ID following naming convention
191
+
192
+ 3. **Broken tests:**
193
+ - Count of existing tests that are broken (fail, import errors, outdated selectors)
194
+ - Each broken test has a failure reason documented
195
+
196
+ 4. **Quality assessment:**
197
+ - Locator tier distribution (what percentage of locators are Tier 1, 2, 3, 4)
198
+ - Assertion quality rating (concrete vs vague assertions)
199
+ - POM compliance (does existing QA repo follow POM rules)
200
+
201
+ 5. **Recommendations priority:**
202
+ - Fix broken tests first (highest priority)
203
+ - Add P0 missing tests
204
+ - Add P1 missing tests
205
+ - Standardize existing tests to CLAUDE.md standards
206
+ - Add P2 missing tests (lowest priority)
207
+ </step>
208
+
209
+ <step name="print_summary">
210
+ ## Step 6: Print Gap Analysis Summary
211
+
212
+ Print a comprehensive human-readable summary.
213
+
214
+ ```
215
+ === Gap Analysis Complete ===
216
+
217
+ Coverage Overview:
218
+ Dev Repo Modules: {total_modules}
219
+ Modules with Coverage: {covered_modules}
220
+ Modules without Tests: {uncovered_modules}
221
+ Coverage Rate: {coverage_percent}%
222
+
223
+ Missing Tests:
224
+ P0 (blocks release): {p0_missing}
225
+ P1 (should fix): {p1_missing}
226
+ P2 (nice to have): {p2_missing}
227
+ --------------------------
228
+ Total Missing: {total_missing}
229
+
230
+ By Pyramid Level:
231
+ Unit: {unit_missing}
232
+ Integration: {integration_missing}
233
+ API: {api_missing}
234
+ E2E: {e2e_missing}
235
+
236
+ Broken Tests:
237
+ Total Broken: {broken_count}
238
+
239
+ Quality Assessment:
240
+ Locator Quality:
241
+ Tier 1 (data-testid, ARIA): {tier1_percent}%
242
+ Tier 2 (labels, text): {tier2_percent}%
243
+ Tier 3 (alt, title): {tier3_percent}%
244
+ Tier 4 (CSS, XPath): {tier4_percent}%
245
+ Assertion Quality: {concrete_percent}% concrete assertions
246
+ POM Compliance: {pom_compliant}/{pom_total} files compliant
247
+
248
+ Recommended Action Order:
249
+ 1. Fix {broken_count} broken tests
250
+ 2. Add {p0_missing} P0 missing tests
251
+ 3. Add {p1_missing} P1 missing tests
252
+ 4. Standardize existing tests
253
+ 5. Add {p2_missing} P2 missing tests
254
+
255
+ Artifacts Produced:
256
+ - {OUTPUT_DIR}/SCAN_MANIFEST.md
257
+ - {OUTPUT_DIR}/QA_ANALYSIS.md
258
+ - {OUTPUT_DIR}/TEST_INVENTORY.md
259
+ - {OUTPUT_DIR}/GAP_ANALYSIS.md
260
+
261
+ No test files generated. No git operations performed.
262
+ To generate missing tests, run the full pipeline with:
263
+ /qa-start --dev-repo {DEV_REPO} --qa-repo {QA_REPO}
264
+ =============================
265
+ ```
266
+ </step>
267
+
268
+ </process>
269
+
270
+ <output>
271
+ This workflow compares dev and QA repos to identify coverage gaps.
272
+
273
+ **Artifacts produced:**
274
+
275
+ | Artifact | When Produced | Description |
276
+ |----------|---------------|-------------|
277
+ | SCAN_MANIFEST.md | Always | Combined scan of both repos with file trees and framework detection |
278
+ | QA_ANALYSIS.md | Always | Architecture overview, risks, test targets, testing pyramid for the dev repo |
279
+ | TEST_INVENTORY.md | Always | Complete test case inventory for what SHOULD exist |
280
+ | GAP_ANALYSIS.md | Always | Coverage map, missing tests, broken tests, quality assessment, recommendations |
281
+
282
+ **GAP_ANALYSIS.md sections (per templates/gap-analysis.md):**
283
+
284
+ 1. **Coverage Map** -- Every module from SCAN_MANIFEST.md with covered/uncovered status
285
+ 2. **Missing Tests** -- Test cases that should exist but do not, with IDs and priorities
286
+ 3. **Broken Tests** -- Existing tests that fail, with failure reasons and file paths
287
+ 4. **Quality Assessment** -- Locator tier distribution, assertion quality rating, POM compliance
288
+ 5. **Recommendations** -- Prioritized action list: fix broken first, then add P0, then P1
289
+
290
+ **No side effects:**
291
+ - No git branches created
292
+ - No git commits made
293
+ - No PRs created
294
+ - No test files generated
295
+ - No source files modified
296
+ </output>
297
+
298
+ <error_handling>
299
+ | Error | Cause | Action |
300
+ |-------|-------|--------|
301
+ | --dev-repo missing | Required argument not provided | Print usage with suggestion to use /qa-analyze for dev-only, STOP |
302
+ | --qa-repo missing | Required argument not provided | Print usage with suggestion to use /qa-analyze for dev-only, STOP |
303
+ | Dev repo path does not exist | Invalid path | Print error with path, STOP |
304
+ | QA repo path does not exist | Invalid path | Print error with path, STOP |
305
+ | Scanner returns STOP | No testable surfaces | Print scanner's reason, STOP |
306
+ | SCAN_MANIFEST.md missing | Scanner failed | Print error, STOP |
307
+ | GAP_ANALYSIS.md missing | Analyzer failed | Print error, STOP |
308
+ | Framework detection LOW confidence | Ambiguous stack | Scanner checkpoints for user confirmation |
309
+ </error_handling>