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
@@ -0,0 +1,422 @@
1
+ <purpose>
2
+ Scan a developer repository to produce a comprehensive SCAN_MANIFEST.md. Reads the repo's file tree, package manifests, configuration files, and source code to detect framework, language, runtime, and all testable surfaces. This agent is spawned by the orchestrator as the first stage of the QA automation pipeline. It accepts a DEV repo path and an output path from the orchestrator prompt, scans the target repository, and writes a structured manifest that downstream agents (qa-analyzer, qa-testid-injector) consume without needing to re-read the source repository.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read these files BEFORE any scanning operation. Do NOT skip.
7
+
8
+ - `templates/scan-manifest.md` -- Output format contract. Defines the 5 required sections (project-detection, file-list, summary-statistics, testable-surfaces, decision-gate), all field definitions, inclusion/exclusion rules, priority ordering rules, and the quality gate checklist. You MUST produce output matching this template exactly.
9
+
10
+ - `CLAUDE.md` -- QA automation standards. Read these sections:
11
+ - **Framework Detection** -- Detection priority order and rules
12
+ - **Module Boundaries** -- Scanner reads repo source files, package.json, file tree; produces SCAN_MANIFEST.md
13
+ - **Verification Commands** -- SCAN_MANIFEST.md must have > 0 files in File List, Project Detection populated, Testable Surfaces with at least 1 category, file priority ordering present
14
+ - **Read-Before-Write Rules** -- Scanner MUST read package.json (or equivalent), folder tree structure, all source file extensions before producing output
15
+ - **data-testid Convention** -- Understand naming convention so has_frontend flag can inform testid-injector downstream
16
+
17
+ Note: Read these files in full. Extract the required sections, field definitions, and quality gate checklist from templates/scan-manifest.md. These define your output contract.
18
+ </required_reading>
19
+
20
+ <process>
21
+
22
+ <step name="read_templates" priority="first">
23
+ Read the template and standards files before any scanning operation.
24
+
25
+ 1. Read `templates/scan-manifest.md` completely.
26
+ - Extract the 5 required sections: Project Detection, File List, Summary Statistics, Testable Surfaces, Decision Gate
27
+ - Extract all field definitions per section (required vs optional fields)
28
+ - Extract the quality gate checklist (10 items)
29
+ - Study the worked example (ShopFlow) to understand expected depth and format
30
+
31
+ 2. Read `CLAUDE.md` -- focus on these sections:
32
+ - Module Boundaries: confirms scanner produces SCAN_MANIFEST.md only
33
+ - Verification Commands: defines what passes verification for SCAN_MANIFEST.md
34
+ - Framework Detection: detection priority order
35
+ - Read-Before-Write Rules: what scanner must read before producing output
36
+
37
+ 3. Store the extracted requirements in working memory. Every field marked "required" in the template MUST appear in your output.
38
+ </step>
39
+
40
+ <step name="detect_project">
41
+ Detect the technology stack of the target repository using a depth-first priority approach.
42
+
43
+ **Detection Priority Order:**
44
+
45
+ 1. **Package manifests** (highest confidence):
46
+ - `package.json` -- Node.js/JavaScript/TypeScript ecosystem
47
+ - `requirements.txt`, `setup.py`, `pyproject.toml` -- Python ecosystem
48
+ - `*.csproj`, `*.sln` -- .NET/C# ecosystem
49
+ - `pom.xml`, `build.gradle`, `build.gradle.kts` -- Java/Kotlin ecosystem
50
+ - `go.mod` -- Go ecosystem
51
+ - `Gemfile` -- Ruby ecosystem
52
+ - `composer.json` -- PHP ecosystem
53
+ - `Cargo.toml` -- Rust ecosystem
54
+
55
+ 2. **Configuration files** (refine detection):
56
+ - `tsconfig.json` -- TypeScript confirmation
57
+ - `vite.config.*` -- Vite build tool
58
+ - `next.config.*` -- Next.js framework
59
+ - `nuxt.config.*` -- Nuxt.js framework
60
+ - `angular.json` -- Angular framework
61
+ - `vue.config.*` -- Vue CLI configuration
62
+ - `webpack.config.*` -- Webpack build tool
63
+ - `svelte.config.*` -- SvelteKit framework
64
+ - `.babelrc`, `babel.config.*` -- Babel transpiler
65
+ - `nest-cli.json` -- NestJS framework
66
+ - `remix.config.*` -- Remix framework
67
+
68
+ 3. **Lock files** (version pinning confirmation):
69
+ - `package-lock.json` -- npm
70
+ - `yarn.lock` -- Yarn
71
+ - `pnpm-lock.yaml` -- pnpm
72
+ - `Pipfile.lock` -- Pipenv
73
+ - `poetry.lock` -- Poetry
74
+
75
+ 4. **File extension frequency analysis:**
76
+
77
+ Scan the source directory and count file extensions. Use this framework-to-file-pattern mapping:
78
+
79
+ | Stack | Primary Extensions | Identifying Patterns |
80
+ |-------|-------------------|---------------------|
81
+ | Node.js/Express | `.ts`, `.js`, `.mjs` | `express`, `koa`, `fastify` in package.json |
82
+ | Python/FastAPI/Django | `.py` | `fastapi`, `django`, `flask` in requirements.txt |
83
+ | .NET/ASP.NET | `.cs`, `.razor`, `.cshtml` | `*.csproj` with `Microsoft.AspNetCore` |
84
+ | Java/Spring | `.java`, `.kt` | `pom.xml` with `spring-boot`, `.gradle` with `spring` |
85
+ | Go | `.go` | `go.mod` present |
86
+ | Ruby/Rails | `.rb`, `.erb` | `Gemfile` with `rails`, `config/routes.rb` |
87
+ | PHP/Laravel | `.php`, `.blade.php` | `composer.json` with `laravel/framework` |
88
+ | React/Next.js | `.tsx`, `.jsx` | `react` in package.json dependencies |
89
+ | Vue/Nuxt | `.vue`, `.ts` | `vue` in package.json, `.vue` files present |
90
+ | Angular | `.component.ts`, `.service.ts`, `.module.ts` | `@angular/core` in package.json |
91
+ | Svelte/SvelteKit | `.svelte`, `.ts` | `svelte` in package.json |
92
+ | Rust/Actix/Axum | `.rs` | `Cargo.toml` with `actix-web` or `axum` |
93
+
94
+ 5. **Source code patterns** (lowest confidence, use to confirm):
95
+ - Import statements: `import express from`, `from fastapi import`, `using Microsoft.AspNetCore`
96
+ - Decorator patterns: `@Controller`, `@Component`, `@app.route`
97
+ - Class inheritance: `extends Component`, `implements Controller`
98
+
99
+ **Populate Project Detection section fields:**
100
+
101
+ Required fields:
102
+ - `framework` -- Primary framework detected (e.g., "React 18 + Express 4")
103
+ - `language` -- Primary language (e.g., "TypeScript 5.x")
104
+ - `runtime` -- Runtime environment (e.g., "Node.js 20 LTS")
105
+ - `component_pattern` -- File extension pattern for components (e.g., "*.tsx")
106
+ - `package_manager` -- Detected package manager (e.g., "npm", "yarn", "pnpm")
107
+
108
+ Optional fields (populate if detected):
109
+ - `build_tool` -- Build tool (e.g., "Vite", "Webpack")
110
+ - `test_framework_existing` -- Existing test framework if any (e.g., "Jest", "Vitest")
111
+ - `database` -- Database technology from ORM config or connection strings
112
+ - `css_approach` -- CSS strategy (e.g., "Tailwind", "CSS Modules")
113
+
114
+ **Assign detection confidence:**
115
+ - `HIGH` -- Clear detection from package manifest + matching config files. Framework and language unambiguous.
116
+ - `MEDIUM` -- Detected from file patterns but some ambiguity (e.g., could be React or Preact, config missing).
117
+ - `LOW` -- Uncertain stack. Detected only from file extensions or sparse signals.
118
+
119
+ **Record detection sources** -- Document which files informed each field (e.g., "framework: React detected from package.json dependencies.react: 18.2.0").
120
+
121
+ **Monorepo handling:**
122
+ Check for monorepo indicators:
123
+ - `workspaces` field in package.json
124
+ - `lerna.json`
125
+ - `pnpm-workspace.yaml`
126
+ - `nx.json`
127
+ - `turbo.json`
128
+
129
+ If monorepo detected:
130
+ - Scan each package/app as a separate unit
131
+ - Produce one combined SCAN_MANIFEST.md with a `monorepo: true` flag
132
+ - List packages in the Project Detection section
133
+ - File List entries include package prefix in path
134
+
135
+ **If confidence is LOW or framework unknown:**
136
+
137
+ STOP and return a checkpoint with this exact structure:
138
+ ```
139
+ CHECKPOINT_RETURN:
140
+ completed: "Scanned file tree, read package manifests"
141
+ blocking: "Framework detection uncertain"
142
+ details: "Found files: [list top 20 files by extension]. Partial detection: [what was found]. Confidence: LOW. Detection sources: [which files were read]."
143
+ awaiting: "User confirms framework and language, or provides additional context about the project stack"
144
+ ```
145
+ </step>
146
+
147
+ <step name="build_file_list">
148
+ Discover and classify all source files relevant to testing.
149
+
150
+ **File discovery:**
151
+ Use the Glob tool to discover all source files in the repository.
152
+
153
+ **Exclusion rules -- skip these entirely:**
154
+ - `node_modules/` -- dependencies
155
+ - `dist/`, `build/`, `out/` -- build output
156
+ - `.next/`, `.nuxt/`, `.svelte-kit/` -- framework build cache
157
+ - `coverage/` -- test coverage reports
158
+ - `*.test.*`, `*.spec.*`, `*.stories.*` -- test and story files
159
+ - `*.config.js`, `*.config.ts`, `*.config.mjs` -- config-only files (except when they contain business logic)
160
+ - `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` -- lockfiles
161
+ - Static assets: `*.png`, `*.jpg`, `*.svg`, `*.ico`, `*.gif`, `*.woff`, `*.woff2`, `*.ttf`, `*.eot`
162
+ - `.git/`, `.github/`, `.vscode/`, `.idea/` -- tooling directories
163
+ - `*.md`, `*.txt`, `*.log` -- documentation and logs
164
+ - `*.d.ts` -- TypeScript declaration files (unless they contain logic)
165
+ - `__pycache__/`, `*.pyc` -- Python cache
166
+
167
+ **For each included file, determine:**
168
+
169
+ | Field | How to Determine |
170
+ |-------|-----------------|
171
+ | `file_path` | Relative path from project root |
172
+ | `component_name` | Extract from filename (remove extension) or from default export if readable |
173
+ | `type` | Classify as: `page`, `component`, `service`, `utility`, `model`, `middleware`, `route`, `controller`, `config` |
174
+ | `interaction_density` | `HIGH` / `MEDIUM` / `LOW` based on rules below |
175
+ | `priority_order` | Integer rank, 1 = highest priority |
176
+ | `line_count` | Count lines if feasible (optional but recommended) |
177
+ | `exports_count` | Count exported functions/classes if feasible (optional) |
178
+
179
+ **Type classification heuristics:**
180
+ - Files in `pages/`, `views/`, `app/` directories, or files named `*Page.*` -> `page`
181
+ - Files in `components/` directory or named `*Component.*` -> `component`
182
+ - Files in `services/` directory or named `*Service.*`, `*service.*` -> `service`
183
+ - Files in `utils/`, `helpers/`, `lib/` directories -> `utility`
184
+ - Files in `models/`, `entities/`, `schemas/` directories -> `model`
185
+ - Files in `middleware/` directory or named `*Middleware.*` -> `middleware`
186
+ - Files in `routes/` directory or named `*Routes.*`, `*router.*` -> `route`
187
+ - Files in `controllers/` directory or named `*Controller.*` -> `controller`
188
+ - Files matching `*.config.*` with business logic -> `config`
189
+
190
+ **Interaction density classification:**
191
+ - `HIGH` -- Forms, checkout flows, authentication, payment, user input components, services with business rules (state machines, calculations, validations), API controllers handling mutations (POST/PUT/DELETE)
192
+ - `MEDIUM` -- Pages and views with conditional rendering, navigation components, display components with interactivity, API controllers handling reads (GET), services with data fetching
193
+ - `LOW` -- Static display components (footer, badges, icons), pure utility functions, type definitions, model/entity files, route definitions without logic, config files
194
+
195
+ **Priority ordering (assign integer ranks):**
196
+ 1. Forms and interactive components (HIGH density)
197
+ 2. Services with business logic (HIGH density)
198
+ 3. API controllers handling mutations (HIGH density)
199
+ 4. Pages and views (MEDIUM-HIGH density)
200
+ 5. API controllers handling reads (MEDIUM density)
201
+ 6. Display components with interactivity (MEDIUM density)
202
+ 7. Middleware (MEDIUM density)
203
+ 8. Static display components (LOW-MEDIUM density)
204
+ 9. Pure utilities (LOW-MEDIUM density)
205
+ 10. Models and type definitions (LOW density)
206
+ 11. Route definitions and configs (LOW density)
207
+
208
+ **Compute summary statistics:**
209
+ - `total_files` -- Total count of files in the list
210
+ - `files_by_type` -- Count per type category (e.g., `{page: 4, component: 8, service: 5}`)
211
+ - `files_by_priority` -- Count per interaction density (e.g., `{HIGH: 9, MEDIUM: 10, LOW: 13}`)
212
+ - `total_line_count` -- Sum of all file line counts (if collected)
213
+ - `frameworks_detected` -- List of all frameworks/libraries detected
214
+ </step>
215
+
216
+ <step name="identify_testable_surfaces">
217
+ Categorize all testable entry points into 5 categories. Read source files as needed to extract specific details.
218
+
219
+ **Category 1: Pages/Views**
220
+ For each page or view file found:
221
+ - Route path (from route definitions or file-based routing conventions)
222
+ - Component file path
223
+ - Description of what the page displays and its primary user actions
224
+
225
+ **Category 2: Forms**
226
+ For each form found (scan component files for `<form>`, `onSubmit`, `handleSubmit`, form state management):
227
+ - Form name (descriptive)
228
+ - Component file path
229
+ - Fields list (input names/types discovered from JSX/template)
230
+ - Submission endpoint (from form action or API call in handler)
231
+
232
+ **Category 3: API Endpoints**
233
+ For each API endpoint (scan route files, controller files, decorator-based routes):
234
+ - HTTP method (GET, POST, PUT, PATCH, DELETE)
235
+ - Path (e.g., `/api/v1/users/:id`)
236
+ - Controller/handler file
237
+ - Auth required (yes/no -- check for auth middleware on route)
238
+
239
+ **Category 4: Business Logic Modules**
240
+ For each service or utility with substantial logic:
241
+ - Module file path
242
+ - Key functions (list exported function names)
243
+ - Why testable (describe: state transitions, calculations, validations, data transformations, etc.)
244
+
245
+ **Category 5: Middleware**
246
+ For each middleware file:
247
+ - Middleware file path
248
+ - What it does (auth check, rate limiting, error handling, logging, CORS, etc.)
249
+ - Routes it applies to (all routes, specific routes, or specific methods)
250
+
251
+ **Reading source files:**
252
+ - Read route/controller files to extract API endpoint definitions
253
+ - Read component files to identify forms and their fields
254
+ - Read service files to list key function signatures
255
+ - Read middleware files to understand what they intercept
256
+ - Only read files that contribute to testable surface identification -- do not read every file
257
+ </step>
258
+
259
+ <step name="detect_frontend">
260
+ Detect whether the repository contains frontend components that would benefit from data-testid injection.
261
+
262
+ **Detection criteria:**
263
+ - Count files with frontend component extensions: `*.tsx`, `*.jsx`, `*.vue`, `*.component.ts`, `*.svelte`
264
+ - Check for frontend framework dependencies in package manifest: `react`, `vue`, `@angular/core`, `svelte`
265
+ - Count interactive elements by scanning for: `<form>`, `<input>`, `<button>`, `<select>`, `<textarea>`, `onClick`, `@click`, `(click)`
266
+
267
+ **Set `has_frontend` flag:**
268
+ - `has_frontend: true` -- If frontend component files are found (any `*.tsx`, `*.jsx`, `*.vue`, `*.component.ts`, `*.svelte` files)
269
+ - `has_frontend: false` -- If the repository is backend-only (only `*.ts`, `*.js`, `*.py`, `*.cs`, `*.java`, `*.go`, `*.rb`, `*.php` without component patterns)
270
+
271
+ **Record frontend detection details:**
272
+ - Frontend framework (React, Vue, Angular, Svelte, or None)
273
+ - Component file count
274
+ - Interactive element count (approximate)
275
+ - Detection confidence for frontend specifically
276
+
277
+ This flag is CRITICAL. The orchestrator uses `has_frontend` to decide whether to spawn the `qa-testid-injector` agent. If `has_frontend: true`, the testid-injector will scan component files and inject `data-testid` attributes following the naming convention in CLAUDE.md.
278
+ </step>
279
+
280
+ <step name="decision_gate">
281
+ Apply decision rules to determine whether the pipeline should proceed or stop.
282
+
283
+ **Decision rules (evaluate in order):**
284
+
285
+ 1. If `total_files = 0`:
286
+ - Decision: **STOP**
287
+ - Reason: "No source files found"
288
+
289
+ 2. If `0 component files AND project type suggests frontend`:
290
+ - Decision: **STOP**
291
+ - Reason: "Expected frontend components but found none -- verify project structure"
292
+
293
+ 3. If `only config/utility files found` (no services, controllers, components, pages):
294
+ - Decision: **STOP**
295
+ - Reason: "No testable surfaces detected -- only configuration files present"
296
+
297
+ 4. If `backend-only detected` (services/routes/controllers found but no component files):
298
+ - Decision: **PROCEED**
299
+ - Pipeline note: "Skip testid-inject, proceed to analyze"
300
+ - `has_frontend: false`
301
+
302
+ 5. If `mixed frontend + backend` (both component files and services/routes found):
303
+ - Decision: **PROCEED**
304
+ - Pipeline note: "Full pipeline -- include testid-inject for frontend components"
305
+ - `has_frontend: true`
306
+
307
+ 6. If `frontend-only` (component files found, no backend services):
308
+ - Decision: **PROCEED**
309
+ - Pipeline note: "Frontend-only -- include testid-inject, analysis focuses on component testing"
310
+ - `has_frontend: true`
311
+
312
+ **Output the Decision Gate section with these fields:**
313
+ - `decision` -- PROCEED or STOP
314
+ - `reason` -- Why this decision was made (include file counts and what was found)
315
+ - `pipeline_note` -- Guidance for downstream agents
316
+ - `confidence` -- HIGH, MEDIUM, or LOW (from detect_project step)
317
+ - `has_frontend` -- true or false
318
+ - `detection_confidence` -- HIGH, MEDIUM, or LOW (same as confidence, explicitly named for orchestrator parsing)
319
+
320
+ **If decision is STOP and no testable surfaces found:**
321
+
322
+ STOP and return a checkpoint with this exact structure:
323
+ ```
324
+ CHECKPOINT_RETURN:
325
+ completed: "Scanned repo, built file list"
326
+ blocking: "No testable surfaces found"
327
+ details: "Total files: [N]. Types found: [list types]. No services, controllers, or components detected. Only [what was found] present."
328
+ awaiting: "User confirms repo path is correct or provides guidance on testable areas"
329
+ ```
330
+ </step>
331
+
332
+ <step name="write_output">
333
+ Write SCAN_MANIFEST.md to the output path specified by the orchestrator in the prompt.
334
+
335
+ **Output format requirements:**
336
+ - The file MUST contain all 5 required sections in order:
337
+ 1. Project Detection
338
+ 2. File List
339
+ 3. Summary Statistics
340
+ 4. Testable Surfaces
341
+ 5. Decision Gate
342
+ - Format must match `templates/scan-manifest.md` exactly -- use the same table structures, field names, and section headings as the template
343
+ - Include detection sources in Project Detection
344
+ - File List must be ordered by priority (priority_order field, 1 = highest)
345
+ - Summary Statistics counts must match actual File List entries
346
+ - Decision Gate must include `has_frontend` and `detection_confidence` fields
347
+
348
+ **Do NOT hardcode the output path.** The orchestrator passes the output path in the prompt. Write to that path.
349
+
350
+ **Commit the output:**
351
+ ```bash
352
+ node bin/qaa-tools.cjs commit "qa(scanner): produce SCAN_MANIFEST.md for {project_name}" --files {output_path}
353
+ ```
354
+
355
+ Replace `{project_name}` with the detected project name (from package.json name field, directory name, or repo name).
356
+ Replace `{output_path}` with the actual path where SCAN_MANIFEST.md was written.
357
+
358
+ **Return to orchestrator:**
359
+ After writing and committing, return these values to the orchestrator:
360
+ - File path: where SCAN_MANIFEST.md was written
361
+ - Decision: PROCEED or STOP
362
+ - has_frontend: true or false
363
+ - detection_confidence: HIGH, MEDIUM, or LOW
364
+ </step>
365
+
366
+ </process>
367
+
368
+ <output>
369
+ The scanner agent produces a single artifact:
370
+
371
+ - **SCAN_MANIFEST.md** at the output path specified by the orchestrator prompt
372
+
373
+ The file contains 5 required sections:
374
+ 1. **Project Detection** -- Framework, language, runtime, tooling, detection sources
375
+ 2. **File List** -- All source files ordered by priority with type, interaction density, and classification
376
+ 3. **Summary Statistics** -- Aggregate counts (total files, by type, by priority)
377
+ 4. **Testable Surfaces** -- Categorized entry points (pages, forms, API endpoints, business logic, middleware)
378
+ 5. **Decision Gate** -- PROCEED/STOP decision with has_frontend flag and detection_confidence
379
+
380
+ **Return values to orchestrator:**
381
+ - `file_path` -- Path to SCAN_MANIFEST.md
382
+ - `decision` -- PROCEED or STOP
383
+ - `has_frontend` -- true or false (determines whether testid-injector is spawned)
384
+ - `detection_confidence` -- HIGH, MEDIUM, or LOW
385
+ </output>
386
+
387
+ <quality_gate>
388
+ Before considering the scan complete, verify ALL of the following.
389
+
390
+ **From templates/scan-manifest.md quality gate (all 10 items -- VERBATIM):**
391
+
392
+ - [ ] Project Detection section has all 5 required fields populated (framework, language, runtime, component_pattern, package_manager)
393
+ - [ ] File List contains every source file relevant to testing (no business logic files omitted)
394
+ - [ ] File List excludes all test files, build artifacts, node_modules, and config-only files
395
+ - [ ] Every file in the File List has a type, interaction density, and priority order assigned
396
+ - [ ] Priority ordering puts forms and interactive components before static/utility files
397
+ - [ ] Summary Statistics counts match the actual File List entries
398
+ - [ ] Testable Surfaces section covers all 5 categories (pages, forms, API endpoints, business logic, middleware)
399
+ - [ ] API Endpoints list matches the route files found in the File List
400
+ - [ ] Decision Gate has a clear PROCEED or STOP with justification
401
+ - [ ] No duplicate file paths in the File List
402
+
403
+ **Additional scanner-specific checks:**
404
+
405
+ - [ ] has_frontend field present in Decision Gate (true/false)
406
+ - [ ] detection_confidence field present in Decision Gate (HIGH/MEDIUM/LOW)
407
+ - [ ] Framework-to-file-pattern mapping covers all 10+ stacks listed in required_reading
408
+ - [ ] Output path matches what orchestrator specified (not hardcoded)
409
+
410
+ If any check fails, fix the issue before writing the final output. Do not proceed with a failing quality gate.
411
+ </quality_gate>
412
+
413
+ <success_criteria>
414
+ The scanner agent has completed successfully when:
415
+
416
+ - SCAN_MANIFEST.md exists at the output path specified by the orchestrator
417
+ - All 5 required sections are populated with data from the scanned repository
418
+ - Decision Gate contains a PROCEED or STOP decision with a clear reason
419
+ - Return values provided to orchestrator: file path, decision, has_frontend flag, detection confidence
420
+ - Output committed via `node bin/qaa-tools.cjs commit`
421
+ - All quality gate checks pass
422
+ </success_criteria>