qaa-agent 1.0.0 → 1.2.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.
@@ -0,0 +1,303 @@
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>