qaa-agent 1.0.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 (56) hide show
  1. package/.claude/commands/create-test.md +40 -0
  2. package/.claude/commands/qa-analyze.md +60 -0
  3. package/.claude/commands/qa-audit.md +37 -0
  4. package/.claude/commands/qa-blueprint.md +54 -0
  5. package/.claude/commands/qa-fix.md +36 -0
  6. package/.claude/commands/qa-from-ticket.md +88 -0
  7. package/.claude/commands/qa-gap.md +54 -0
  8. package/.claude/commands/qa-pom.md +36 -0
  9. package/.claude/commands/qa-pyramid.md +37 -0
  10. package/.claude/commands/qa-report.md +38 -0
  11. package/.claude/commands/qa-start.md +33 -0
  12. package/.claude/commands/qa-testid.md +54 -0
  13. package/.claude/commands/qa-validate.md +54 -0
  14. package/.claude/commands/update-test.md +58 -0
  15. package/.claude/settings.json +19 -0
  16. package/.claude/skills/qa-bug-detective/SKILL.md +122 -0
  17. package/.claude/skills/qa-repo-analyzer/SKILL.md +88 -0
  18. package/.claude/skills/qa-self-validator/SKILL.md +109 -0
  19. package/.claude/skills/qa-template-engine/SKILL.md +113 -0
  20. package/.claude/skills/qa-testid-injector/SKILL.md +93 -0
  21. package/.claude/skills/qa-workflow-documenter/SKILL.md +87 -0
  22. package/CLAUDE.md +543 -0
  23. package/README.md +418 -0
  24. package/agents/qa-pipeline-orchestrator.md +1217 -0
  25. package/agents/qaa-analyzer.md +508 -0
  26. package/agents/qaa-bug-detective.md +444 -0
  27. package/agents/qaa-executor.md +618 -0
  28. package/agents/qaa-planner.md +374 -0
  29. package/agents/qaa-scanner.md +422 -0
  30. package/agents/qaa-testid-injector.md +583 -0
  31. package/agents/qaa-validator.md +450 -0
  32. package/bin/install.cjs +176 -0
  33. package/bin/lib/commands.cjs +709 -0
  34. package/bin/lib/config.cjs +307 -0
  35. package/bin/lib/core.cjs +497 -0
  36. package/bin/lib/frontmatter.cjs +299 -0
  37. package/bin/lib/init.cjs +989 -0
  38. package/bin/lib/milestone.cjs +241 -0
  39. package/bin/lib/model-profiles.cjs +60 -0
  40. package/bin/lib/phase.cjs +911 -0
  41. package/bin/lib/roadmap.cjs +306 -0
  42. package/bin/lib/state.cjs +748 -0
  43. package/bin/lib/template.cjs +222 -0
  44. package/bin/lib/verify.cjs +842 -0
  45. package/bin/qaa-tools.cjs +607 -0
  46. package/package.json +34 -0
  47. package/templates/failure-classification.md +391 -0
  48. package/templates/gap-analysis.md +409 -0
  49. package/templates/pr-template.md +48 -0
  50. package/templates/qa-analysis.md +381 -0
  51. package/templates/qa-audit-report.md +465 -0
  52. package/templates/qa-repo-blueprint.md +636 -0
  53. package/templates/scan-manifest.md +312 -0
  54. package/templates/test-inventory.md +582 -0
  55. package/templates/testid-audit-report.md +354 -0
  56. package/templates/validation-report.md +243 -0
package/README.md ADDED
@@ -0,0 +1,418 @@
1
+ # QAA -- QA Automation Agent
2
+
3
+ Multi-agent QA automation system for Claude Code. Point it at any repository -- it analyzes the codebase, generates a standards-compliant test suite, validates everything, and delivers the result as a draft PR. Runs locally via Claude Code.
4
+
5
+ No manual test writing. No guessing what to cover. One command, full pipeline.
6
+
7
+ ## Quick Start
8
+
9
+ Prerequisites: Node.js 18+, Claude Code (Pro or Max plan), gh CLI (authenticated), Git.
10
+
11
+ ```bash
12
+ # 1. Clone this repo alongside your project
13
+ git clone <this-repo-url> qa-agent
14
+
15
+ # 2. Open Claude Code in the qa-agent directory
16
+
17
+ # 3. Run the full pipeline against your dev repo
18
+ /qa-start --dev-repo /path/to/your-project
19
+
20
+ # 4. Wait for the pipeline to complete, then review the draft PR
21
+ ```
22
+
23
+ For an existing QA repository:
24
+
25
+ ```bash
26
+ /qa-start --dev-repo /path/to/dev-repo --qa-repo /path/to/qa-repo
27
+ ```
28
+
29
+ For fully unattended execution (auto-approve safe checkpoints):
30
+
31
+ ```bash
32
+ /qa-start --dev-repo /path/to/your-project --auto
33
+ ```
34
+
35
+ ## Prerequisites
36
+
37
+ Every tool below must be installed and working before running the pipeline.
38
+
39
+ - **Node.js 18+** -- Runtime for CLI tooling. The pipeline uses Node for configuration management and artifact validation.
40
+ - **Claude Code** (Anthropic) -- The AI coding assistant that executes the agents. You must have a **Pro or Max plan** for access to the Opus model, which all agents require.
41
+ - **gh CLI** -- GitHub's official command-line tool for creating pull requests. Install from https://cli.github.com and authenticate before first use.
42
+ - **Git** -- Version control. The target repository must have a remote origin configured for PR delivery.
43
+
44
+ ### Verifying Prerequisites
45
+
46
+ Run each command and confirm the expected output:
47
+
48
+ ```bash
49
+ node --version # Must show v18.x.x or higher
50
+ claude --version # Must show Claude Code version
51
+ gh auth status # Must show "Logged in to github.com"
52
+ git --version # Must show git version 2.x+
53
+ ```
54
+
55
+ If any command fails, install the missing tool before proceeding.
56
+
57
+ ## Installation
58
+
59
+ 1. Clone or copy this repository into a local directory:
60
+ ```bash
61
+ git clone <this-repo-url> qa-agent
62
+ cd qa-agent
63
+ ```
64
+
65
+ 2. Verify the setup is healthy:
66
+ ```bash
67
+ node bin/qaa-tools.cjs validate health
68
+ ```
69
+
70
+ 3. Open Claude Code in this directory. The `.claude/commands/` directory provides all 13 slash commands automatically -- no additional setup needed.
71
+
72
+ ## Configuration
73
+
74
+ The pipeline behavior is controlled by `.planning/config.json`. Default values work for most projects.
75
+
76
+ | Setting | Options | Default | Description |
77
+ |---------|---------|---------|-------------|
78
+ | `mode` | `quality`, `balanced`, `budget` | `quality` | Controls which AI models agents use |
79
+ | `granularity` | `coarse`, `standard`, `fine` | `standard` | Detail level of analysis and generation |
80
+ | `parallelization` | `true`, `false` | `true` | Enable wave-based parallel agent execution |
81
+ | `workflow.auto_advance` | `true`, `false` | `false` | Auto-approve safe checkpoints without pausing |
82
+
83
+ Set values via CLI:
84
+
85
+ ```bash
86
+ node bin/qaa-tools.cjs config set mode balanced
87
+ node bin/qaa-tools.cjs config set workflow.auto_advance true
88
+ ```
89
+
90
+ Or edit `.planning/config.json` directly.
91
+
92
+ ## Commands
93
+
94
+ All commands are available as slash commands in Claude Code. They are organized into three tiers by frequency of use.
95
+
96
+ ### /qa-start -- Full Pipeline (Tier 1: Daily Use)
97
+
98
+ The primary command. Runs the entire QA automation pipeline from scan to PR delivery.
99
+
100
+ ```
101
+ /qa-start [--dev-repo <path>] [--qa-repo <path>] [--auto]
102
+ ```
103
+
104
+ **Arguments:**
105
+ - No arguments: uses current directory as the dev repo (Option 1: dev-only)
106
+ - `--dev-repo`: explicit path to the developer repository
107
+ - `--qa-repo`: path to an existing QA repository (triggers Option 2 or 3 based on maturity score)
108
+ - `--auto`: enable auto-advance mode (skips safe checkpoint pauses)
109
+
110
+ **What happens:**
111
+ 1. Scans the repository -- detects framework, language, testable surfaces
112
+ 2. Analyzes architecture -- produces risk assessment, test inventory, blueprint
113
+ 3. Injects test IDs (if frontend components detected)
114
+ 4. Plans test generation -- groups test cases by feature domain
115
+ 5. Generates test files -- unit, API, integration, E2E with Page Object Models
116
+ 6. Validates generated tests -- 4-layer validation with auto-fix (up to 3 loops)
117
+ 7. Classifies any remaining failures (if present)
118
+ 8. Delivers everything as a draft PR on a `qa/auto-{project}-{date}` branch
119
+
120
+ **What it produces:**
121
+ - SCAN_MANIFEST.md, QA_ANALYSIS.md, TEST_INVENTORY.md, QA_REPO_BLUEPRINT.md
122
+ - Generated test files, POMs, fixtures, and config files
123
+ - VALIDATION_REPORT.md with confidence level (HIGH/MEDIUM/LOW)
124
+ - A draft pull request with full analysis summary
125
+
126
+ ### Analysis Commands (Tier 2: Common Use)
127
+
128
+ #### /qa-analyze -- Repository Analysis
129
+
130
+ Scan and analyze a repository without generating tests. Produces assessment documents only.
131
+
132
+ ```
133
+ /qa-analyze [--dev-repo <path>] [--qa-repo <path>]
134
+ ```
135
+
136
+ Produces: SCAN_MANIFEST.md, QA_ANALYSIS.md, TEST_INVENTORY.md, and either QA_REPO_BLUEPRINT.md (no QA repo) or GAP_ANALYSIS.md (QA repo provided).
137
+
138
+ #### /qa-validate -- Test Validation
139
+
140
+ Validate existing test files against QA standards. Runs 4-layer checks (syntax, structure, dependencies, logic) and classifies failures.
141
+
142
+ ```
143
+ /qa-validate <path-to-tests> [--framework <name>]
144
+ ```
145
+
146
+ Produces: VALIDATION_REPORT.md. If failures are found, also produces FAILURE_CLASSIFICATION_REPORT.md.
147
+
148
+ #### /qa-testid -- Test ID Injection
149
+
150
+ Scan frontend source code, audit missing `data-testid` attributes, and inject them using the project naming convention. Creates a separate branch for changes.
151
+
152
+ ```
153
+ /qa-testid <path-to-frontend-source>
154
+ ```
155
+
156
+ Produces: TESTID_AUDIT_REPORT.md and modified source files with `data-testid` attributes.
157
+
158
+ ### Specialized Commands (Tier 3)
159
+
160
+ | Command | Purpose | Usage |
161
+ |---------|---------|-------|
162
+ | `/qa-fix` | Diagnose and fix broken test files | `/qa-fix <path-to-tests> [error output]` |
163
+ | `/qa-pom` | Generate Page Object Model files | `/qa-pom <path-to-pages> [--framework <name>]` |
164
+ | `/qa-audit` | Full 6-dimension quality audit of a test suite | `/qa-audit <path-to-tests> [--dev-repo <path>]` |
165
+ | `/qa-gap` | Gap analysis between dev and QA repos | `/qa-gap --dev-repo <path> --qa-repo <path>` |
166
+ | `/qa-blueprint` | Generate QA repository structure blueprint | `/qa-blueprint [--dev-repo <path>]` |
167
+ | `/qa-report` | Generate QA status report (team/management/client) | `/qa-report <path-to-tests> [--audience <level>]` |
168
+ | `/qa-pyramid` | Analyze test distribution vs. ideal pyramid | `/qa-pyramid <path-to-tests> [--dev-repo <path>]` |
169
+ | `/create-test` | Generate tests for a specific feature | `/create-test <feature-name> [--dev-repo <path>]` |
170
+ | `/update-test` | Improve existing tests without rewriting them | `/update-test <path-to-tests> [--scope <type>]` |
171
+
172
+ ## Workflow Options
173
+
174
+ The pipeline automatically selects the right workflow based on the repositories you provide.
175
+
176
+ ### Option 1: Dev-Only Repository
177
+
178
+ **When to use:** The project has no existing QA repository. You are starting QA from scratch.
179
+
180
+ **Trigger:** Run `/qa-start --dev-repo <path>` with no `--qa-repo` argument.
181
+
182
+ **What happens:** Full pipeline -- scan, analyze, plan, generate, validate, deliver. Produces a complete test suite with POMs, fixtures, config files, and a QA repository blueprint. The draft PR contains everything needed to bootstrap a QA repo.
183
+
184
+ ### Option 2: Dev + Immature QA Repository
185
+
186
+ **When to use:** A QA repo exists but has low coverage, inconsistent patterns, or broken tests. Maturity score below 70%.
187
+
188
+ **Trigger:** Run `/qa-start --dev-repo <path> --qa-repo <path>` where the QA repo scores below the maturity threshold.
189
+
190
+ **What happens:** Scans both repos, runs gap analysis, fixes broken tests, adds missing coverage, standardizes existing tests to match CLAUDE.md conventions. Produces a PR that improves the existing test suite rather than replacing it.
191
+
192
+ ### Option 3: Dev + Mature QA Repository
193
+
194
+ **When to use:** A solid QA repo already exists with good coverage and patterns. Maturity score 70% or above.
195
+
196
+ **Trigger:** Run `/qa-start --dev-repo <path> --qa-repo <path>` where the QA repo scores at or above the maturity threshold.
197
+
198
+ **What happens:** Scans both repos, identifies only thin coverage areas, adds surgical test additions without touching existing working tests. Produces a minimal PR with targeted additions.
199
+
200
+ ## Example Output
201
+
202
+ The following shows a typical `/qa-start` run against a Next.js e-commerce project:
203
+
204
+ ```
205
+ > /qa-start --dev-repo ./shopflow --auto
206
+
207
+ +------------------------------------------+
208
+ | QA Automation Pipeline |
209
+ | Option: 1 (Dev-only) |
210
+ | Target: shopflow |
211
+ +------------------------------------------+
212
+
213
+ +------------------------------------------+
214
+ | STAGE 1: Scan |
215
+ | Status: Running... |
216
+ +------------------------------------------+
217
+ Scanner complete. 847 files scanned, 32 testable surfaces identified.
218
+ Output: .qa-output/SCAN_MANIFEST.md
219
+
220
+ +------------------------------------------+
221
+ | STAGE 2: Analyze |
222
+ | Status: Running... |
223
+ +------------------------------------------+
224
+ Architecture: Next.js 14, TypeScript, Prisma ORM, REST API
225
+ Risk areas: authentication (HIGH), payment processing (HIGH), cart logic (MEDIUM)
226
+ Output: .qa-output/QA_ANALYSIS.md, .qa-output/TEST_INVENTORY.md, .qa-output/QA_REPO_BLUEPRINT.md
227
+
228
+ +------------------------------------------+
229
+ | STAGE 3: Test ID Injection |
230
+ | Status: Running... |
231
+ +------------------------------------------+
232
+ Frontend detected. Auditing data-testid coverage...
233
+ Coverage: 12% (18 of 147 interactive elements have data-testid)
234
+ Injected 94 data-testid attributes across 23 components.
235
+ Output: .qa-output/TESTID_AUDIT_REPORT.md
236
+
237
+ +------------------------------------------+
238
+ | STAGE 4: Plan |
239
+ | Status: Running... |
240
+ +------------------------------------------+
241
+ Grouped 42 test cases into 6 feature domains: auth, products, cart, checkout, orders, admin.
242
+
243
+ +------------------------------------------+
244
+ | STAGE 5: Generate |
245
+ | Status: Running... |
246
+ +------------------------------------------+
247
+ Generated 38 test files: 24 unit, 8 API, 4 integration, 2 E2E
248
+ Created 6 Page Object Models, 4 fixture files, 2 config files.
249
+
250
+ +------------------------------------------+
251
+ | STAGE 6: Validate |
252
+ | Status: Running... |
253
+ +------------------------------------------+
254
+ Validation loop 1: 3 issues found, 3 auto-fixed.
255
+ Validation loop 2: all files PASS.
256
+ Confidence: HIGH
257
+
258
+ +------------------------------------------+
259
+ | STAGE 7: Deliver |
260
+ | Status: Running... |
261
+ +------------------------------------------+
262
+ Branch created: qa/auto-shopflow-2026-03-19
263
+ PR created: https://github.com/client/shopflow/pull/42
264
+
265
+ +------------------------------------------+
266
+ | PIPELINE COMPLETE |
267
+ | Tests: 24 unit, 8 API, 4 integration, |
268
+ | 2 E2E (38 total) |
269
+ | Validation: PASS (HIGH confidence) |
270
+ | PR: https://github.com/client/shopflow |
271
+ | /pull/42 |
272
+ +------------------------------------------+
273
+ ```
274
+
275
+ ## Troubleshooting
276
+
277
+ ### "gh: not authenticated"
278
+
279
+ The gh CLI needs to be authenticated before the pipeline can create PRs. Run:
280
+
281
+ ```bash
282
+ gh auth login
283
+ ```
284
+
285
+ Select GitHub.com, HTTPS protocol, and authenticate via browser. After login, verify with `gh auth status`.
286
+
287
+ ### "No git remote found"
288
+
289
+ The target repository must have a remote origin configured for the deliver stage to push and create a PR. Add one:
290
+
291
+ ```bash
292
+ cd /path/to/target-repo
293
+ git remote add origin https://github.com/org/repo.git
294
+ ```
295
+
296
+ If you only want local output without a PR, the pipeline will fall back gracefully -- all artifacts are still written to `.qa-output/`.
297
+
298
+ ### "A branch named 'qa/auto-...' already exists"
299
+
300
+ A pipeline was previously run on the same day against the same project. The system automatically appends a numeric suffix (`-2`, `-3`, etc.) to avoid collisions. If you want to clean up old branches:
301
+
302
+ ```bash
303
+ git branch -D qa/auto-shopflow-2026-03-19
304
+ ```
305
+
306
+ ### Pipeline stalls at a checkpoint
307
+
308
+ Some pipeline stages have verification checkpoints that pause for your input. Type your response in the Claude Code terminal to continue. To skip safe checkpoints automatically, use the `--auto` flag:
309
+
310
+ ```
311
+ /qa-start --dev-repo <path> --auto
312
+ ```
313
+
314
+ Or enable auto-advance globally:
315
+
316
+ ```bash
317
+ node bin/qaa-tools.cjs config set workflow.auto_advance true
318
+ ```
319
+
320
+ ### Tests fail validation after 3 fix loops
321
+
322
+ The validator attempted 3 automatic fix cycles but could not resolve all issues. Review the details in `.qa-output/VALIDATION_REPORT.md` to understand what failed and why. Fix the remaining issues manually, then re-validate:
323
+
324
+ ```
325
+ /qa-validate <path-to-test-files>
326
+ ```
327
+
328
+ ### Claude Code says "model not available"
329
+
330
+ You need a Pro or Max plan for Opus model access. Check your plan at https://console.anthropic.com. The pipeline requires Opus for all agent operations.
331
+
332
+ ## Project Structure
333
+
334
+ ```
335
+ qa-agent-gsd/
336
+ agents/ -- Agent workflow definitions
337
+ qa-pipeline-orchestrator.md -- Main pipeline controller (3 options)
338
+ qaa-scanner.md -- Repository scanner agent
339
+ qaa-analyzer.md -- Architecture analyzer agent
340
+ qaa-planner.md -- Test generation planner agent
341
+ qaa-executor.md -- Test file generator agent
342
+ qaa-validator.md -- Test validation agent
343
+ qaa-testid-injector.md -- Test ID injection agent
344
+ qaa-bug-detective.md -- Failure classification agent
345
+ bin/ -- CLI tooling
346
+ qaa-tools.cjs -- Main CLI entry point
347
+ lib/ -- CLI module library
348
+ templates/ -- Output artifact templates (9 templates + PR template)
349
+ scan-manifest.md -- Scan output template
350
+ qa-analysis.md -- Analysis output template
351
+ test-inventory.md -- Test inventory template
352
+ qa-repo-blueprint.md -- Repository blueprint template
353
+ gap-analysis.md -- Gap analysis template
354
+ validation-report.md -- Validation report template
355
+ failure-classification.md -- Failure classification template
356
+ testid-audit-report.md -- Test ID audit template
357
+ qa-audit-report.md -- Quality audit template
358
+ pr-template.md -- Pull request body template
359
+ .claude/commands/ -- Slash commands (13 commands, auto-detected by Claude Code)
360
+ qa-start.md -- Tier 1: full pipeline
361
+ qa-analyze.md -- Tier 2: analysis only
362
+ qa-validate.md -- Tier 2: test validation
363
+ qa-testid.md -- Tier 2: test ID injection
364
+ qa-fix.md -- Tier 3: fix broken tests
365
+ qa-pom.md -- Tier 3: generate POMs
366
+ qa-audit.md -- Tier 3: quality audit
367
+ qa-gap.md -- Tier 3: gap analysis
368
+ qa-blueprint.md -- Tier 3: repo blueprint
369
+ qa-report.md -- Tier 3: status report
370
+ qa-pyramid.md -- Tier 3: pyramid analysis
371
+ create-test.md -- Tier 3: create tests for a feature
372
+ update-test.md -- Tier 3: improve existing tests
373
+ CLAUDE.md -- QA standards, agent coordination, quality gates
374
+ .planning/ -- Planning artifacts and project state
375
+ config.json -- Pipeline configuration
376
+ .qa-output/ -- Generated artifacts (created during pipeline run)
377
+ ```
378
+
379
+ ## Pipeline Stages
380
+
381
+ The full pipeline follows this sequence:
382
+
383
+ ```
384
+ scan -> analyze -> [testid-inject if frontend] -> plan -> generate -> validate -> [bug-detective if failures] -> deliver
385
+ ```
386
+
387
+ | Stage | Agent | Input | Output |
388
+ |-------|-------|-------|--------|
389
+ | Scan | qa-scanner | Repository source files | SCAN_MANIFEST.md |
390
+ | Analyze | qa-analyzer | SCAN_MANIFEST.md | QA_ANALYSIS.md, TEST_INVENTORY.md, blueprint or gap analysis |
391
+ | Test ID Inject | qa-testid-injector | Frontend source files | TESTID_AUDIT_REPORT.md, modified source files |
392
+ | Plan | qa-planner | TEST_INVENTORY.md, QA_ANALYSIS.md | Generation plan (internal) |
393
+ | Generate | qa-executor | Generation plan, TEST_INVENTORY.md | Test files, POMs, fixtures, configs |
394
+ | Validate | qa-validator | Generated test files | VALIDATION_REPORT.md |
395
+ | Bug Detective | qa-bug-detective | Test execution results | FAILURE_CLASSIFICATION_REPORT.md |
396
+ | Deliver | orchestrator | All artifacts | Git branch + draft PR |
397
+
398
+ Each stage produces artifacts consumed by the next. The pipeline will not advance to the next stage until the current stage's artifacts pass verification.
399
+
400
+ ## Output Artifacts
401
+
402
+ All artifacts are written to the `.qa-output/` directory during a pipeline run:
403
+
404
+ | Artifact | Description |
405
+ |----------|-------------|
406
+ | SCAN_MANIFEST.md | File tree, framework detection, testable surfaces, file priority |
407
+ | QA_ANALYSIS.md | Architecture overview, risk assessment, top 10 unit targets, testing pyramid |
408
+ | TEST_INVENTORY.md | Every test case with ID, target, inputs, expected outcome, priority |
409
+ | QA_REPO_BLUEPRINT.md | Recommended QA repo structure, configs, CI/CD, definition of done |
410
+ | GAP_ANALYSIS.md | Coverage gaps between dev and QA repos (Option 2/3 only) |
411
+ | VALIDATION_REPORT.md | 4-layer validation results per file, confidence level, fix loop log |
412
+ | FAILURE_CLASSIFICATION_REPORT.md | Failure classification: APP BUG, TEST ERROR, ENV ISSUE, INCONCLUSIVE |
413
+ | TESTID_AUDIT_REPORT.md | data-testid coverage score, proposed values, decision gate |
414
+ | QA_AUDIT_REPORT.md | 6-dimension quality score with weighted calculation |
415
+
416
+ ---
417
+
418
+ Powered by Claude Code.