@agents-forge/aiqa 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 (43) hide show
  1. package/CLAUDE.md +112 -0
  2. package/README.md +281 -0
  3. package/dist/agent.d.ts +41 -0
  4. package/dist/agent.d.ts.map +1 -0
  5. package/dist/agent.js +485 -0
  6. package/dist/agent.js.map +1 -0
  7. package/dist/cli.d.ts +13 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +195 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/config.d.ts +59 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +53 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +15 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/session.d.ts +50 -0
  20. package/dist/session.d.ts.map +1 -0
  21. package/dist/session.js +99 -0
  22. package/dist/session.js.map +1 -0
  23. package/dist/subagents/analyst.d.ts +3 -0
  24. package/dist/subagents/analyst.d.ts.map +1 -0
  25. package/dist/subagents/analyst.js +96 -0
  26. package/dist/subagents/analyst.js.map +1 -0
  27. package/dist/subagents/qa-engineer.d.ts +4 -0
  28. package/dist/subagents/qa-engineer.d.ts.map +1 -0
  29. package/dist/subagents/qa-engineer.js +139 -0
  30. package/dist/subagents/qa-engineer.js.map +1 -0
  31. package/dist/subagents/qa-planner.d.ts +3 -0
  32. package/dist/subagents/qa-planner.d.ts.map +1 -0
  33. package/dist/subagents/qa-planner.js +69 -0
  34. package/dist/subagents/qa-planner.js.map +1 -0
  35. package/dist/subagents/qa-reporter.d.ts +4 -0
  36. package/dist/subagents/qa-reporter.d.ts.map +1 -0
  37. package/dist/subagents/qa-reporter.js +94 -0
  38. package/dist/subagents/qa-reporter.js.map +1 -0
  39. package/dist/subagents/qa-reviewer.d.ts +3 -0
  40. package/dist/subagents/qa-reviewer.d.ts.map +1 -0
  41. package/dist/subagents/qa-reviewer.js +97 -0
  42. package/dist/subagents/qa-reviewer.js.map +1 -0
  43. package/package.json +65 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,112 @@
1
+ # AIQA — Claude Code Instructions
2
+
3
+ Single unified AI Quality Engineering Pipeline.
4
+ One command. One Claude session. Full QA suite.
5
+
6
+ ## Install
7
+ ```bash
8
+ npm install @agents-forge/aiqa
9
+ npm install --save-dev @playwright/test
10
+ npm install -g @playwright/cli@latest
11
+ playwright-cli install --skills
12
+ npx playwright install chromium
13
+ ```
14
+
15
+ ## Authentication (auto-detected)
16
+ 1. `ANTHROPIC_API_KEY` in `.env`
17
+ 2. `claude login`
18
+ 3. `gh auth login`
19
+
20
+ ## CLI Usage
21
+ ```bash
22
+ # Full pipeline
23
+ npx @agents-forge/aiqa https://www.saucedemo.com
24
+
25
+ # Smoke tests only
26
+ npx @agents-forge/aiqa https://my-app.com --grep @smoke
27
+
28
+ # Skip review gate
29
+ npx @agents-forge/aiqa https://my-app.com --skip qa-reviewer
30
+
31
+ # Resume after crash
32
+ npx @agents-forge/aiqa https://my-app.com --resume
33
+
34
+ # Custom output dir
35
+ npx @agents-forge/aiqa https://my-app.com --dir ./aiqa-output
36
+
37
+ # Interactive — prompts for the URL + an optional existing requirements doc
38
+ npx @agents-forge/aiqa
39
+
40
+ # Bring your own requirements: drop a .md in .aiqa/requirements/ first, then run.
41
+ # The analyst still explores AND merges your doc with the discovered requirements.
42
+ npx @agents-forge/aiqa https://my-app.com
43
+ ```
44
+
45
+ ## Programmatic Usage
46
+ ```typescript
47
+ import { runAIQA } from "@agents-forge/aiqa";
48
+
49
+ await runAIQA({
50
+ target: "https://my-app.com",
51
+ grep: "@smoke",
52
+ skip: ["qa-reviewer"],
53
+ cwd: process.cwd(),
54
+ verbose: false,
55
+ resume: false,
56
+ existingRequirements: ".aiqa/requirements/my-existing-reqs.md", // optional — analyst merges it in
57
+ });
58
+ ```
59
+
60
+ ## Configuration — aiqa.config.ts
61
+ Drop an `aiqa.config.ts` (or .mjs/.js/.json) in the project root for defaults. CLI flags
62
+ override it. Loaded via jiti (no build step).
63
+ ```typescript
64
+ import { defineConfig } from "@agents-forge/aiqa";
65
+ export default defineConfig({
66
+ url: "https://my-app.com",
67
+ model: "claude-sonnet-4-6",
68
+ skip: ["qa-reviewer"],
69
+ paths: { base: ".aiqa", reports: "reports", testScripts: "test-scripts" },
70
+ });
71
+ ```
72
+
73
+ ## How it works
74
+ One Claude session runs all 5 specialist roles:
75
+ 1. **analyst** — playwright-cli explores site, captures .aiqa/snapshots/*.yml → requirements.md (if an existing requirements .md is provided, it explores AND merges it in: Part A existing + Part B discovered)
76
+ 2. **qa-planner** — reads requirements + snapshots → test_plan.md (risk-aware)
77
+ 3. **qa-engineer** — snapshot-aware test generation → test-cases/*.md + tests/*.spec.ts
78
+ 4. **qa-reviewer** — validates selectors against snapshots → review_report.md
79
+ 5. **qa-reporter** — runs tests, captures failure snapshots → summary_report.md
80
+
81
+ ## Output files
82
+ All artifacts live under `.aiqa/`; only `playwright.config.ts` is written to the repo root.
83
+ ```
84
+ .aiqa/
85
+ ├── session.json ← pipeline state (enables --resume)
86
+ ├── auth-state.json ← saved login session (if any)
87
+ ├── snapshots/
88
+ │ ├── home.yml ← playwright-cli accessibility trees
89
+ │ └── ...
90
+ ├── requirements/
91
+ │ └── requirements.md
92
+ ├── test-plan/
93
+ │ └── test_plan.md
94
+ ├── test-cases/
95
+ │ ├── login.md
96
+ │ └── checkout.md
97
+ ├── test-scripts/
98
+ │ ├── login.spec.ts
99
+ │ └── checkout.spec.ts
100
+ └── reports/
101
+ ├── review_report.md
102
+ ├── summary_report.md
103
+ ├── test-results/ ← results.json, results.xml, traces, screenshots
104
+ └── playwright-report/ ← HTML report
105
+ playwright.config.ts ← at repo root (so `npx playwright test` finds it)
106
+ ```
107
+
108
+ ## Troubleshooting
109
+ - `playwright-cli not found` → `npm install -g @playwright/cli@latest`
110
+ - Pipeline crashed → `npx @agents-forge/aiqa <url> --resume`
111
+ - Auth failed → set `ANTHROPIC_API_KEY` or `claude login`
112
+ - Browser not installed → `npx playwright install chromium`
package/README.md ADDED
@@ -0,0 +1,281 @@
1
+ # 🤖 AIQA — AI Assisted Quality Engineering
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@agents-forge/aiqa.svg)](https://www.npmjs.com/package/@agents-forge/aiqa)
4
+
5
+
6
+
7
+ One command. One Claude session. Full AI-assisted QA suite — requirements, test plan, test cases, Playwright scripts, a selector-validated review, and an execution report.
8
+
9
+ ```bash
10
+ npx @agents-forge/aiqa https://www.yourwebsite.com
11
+ ```
12
+
13
+ ---
14
+
15
+ ## What makes this different
16
+
17
+ AIQA is a **Super Agent** — a single Claude session that orchestrates five specialist **subagents**, not a chain of disconnected tools. The Super Agent holds the whole pipeline in one context, so insights and snapshots flow in memory from one subagent to the next:
18
+
19
+ ```
20
+ ┌──────────────────────────────────────────────┐
21
+ │ AIQA — Super Agent │
22
+ │ (one Claude session, shared memory) │
23
+ └──────────────────────────────────────────────┘
24
+
25
+ analyst → qa-planner → qa-engineer → qa-reviewer → qa-reporter
26
+ └──────────────────── subagents ───────────────────────────┘
27
+ ```
28
+
29
+ ### The subagents
30
+
31
+ | Subagent | Role | Output |
32
+ |---|---|---|
33
+ | **analyst** | Explores the site with playwright-cli, captures accessibility snapshots of every page | `requirements.md` |
34
+ | **qa-planner** | Uses snapshots to assess real UI complexity and assign risk-based priorities | `test_plan.md` |
35
+ | **qa-engineer** | Generates test cases + Playwright scripts using actual element refs — no guessing | `test-cases/`, `test-scripts/` |
36
+ | **qa-reviewer** | Validates every selector in the specs against the captured snapshots | `review_report.md` |
37
+ | **qa-reporter** | Runs the suite, captures failure snapshots, writes the stakeholder report | `summary_report.md` |
38
+
39
+ Every subagent works against the same **playwright-cli accessibility snapshots** the analyst captured — so the test scripts reference real DOM elements, and the reviewer can flag any selector that doesn't exist in the ground-truth snapshots.
40
+
41
+ > 📐 For a deep dive into how the Super Agent orchestrates the subagents, the runtime flow, and the key design decisions, see **[docs/architecture.md](docs/architecture.md)**.
42
+
43
+ ---
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ npm install @agents-forge/aiqa
49
+ npm install --save-dev @playwright/test
50
+ npm install -g @playwright/cli@latest
51
+ playwright-cli install --skills
52
+ npx playwright install chromium
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Authentication
58
+
59
+ Auto-detected — no config needed:
60
+
61
+ | Method | Setup |
62
+ |---|---|
63
+ | Anthropic API key | `ANTHROPIC_API_KEY=sk-ant-...` in `.env` |
64
+ | Claude subscription | `npm install -g @anthropic-ai/claude-code` → `claude login` |
65
+ | GitHub Copilot | `gh auth login` |
66
+
67
+ ---
68
+
69
+ ## Usage
70
+
71
+ ```bash
72
+ # Full pipeline — all five subagents
73
+ npx @agents-forge/aiqa https://my-app.com
74
+
75
+ # Smoke tests only
76
+ npx @agents-forge/aiqa https://my-app.com --grep @smoke
77
+
78
+ # Regression suite to custom dir
79
+ npx @agents-forge/aiqa https://my-app.com --grep @regression --dir ./aiqa-output
80
+
81
+ # Skip the review subagent
82
+ npx @agents-forge/aiqa https://my-app.com --skip qa-reviewer
83
+
84
+ # Resume after a crash
85
+ npx @agents-forge/aiqa https://my-app.com --resume
86
+
87
+ # Interactive — prompts for the URL and an optional existing requirements doc
88
+ npx @agents-forge/aiqa
89
+
90
+ # Unattended / CI — don't prompt before overwriting playwright.config.ts
91
+ npx @agents-forge/aiqa https://my-app.com --force
92
+
93
+ # Inside VS Code — open the generated docs in Markdown preview when done
94
+ npx @agents-forge/aiqa https://my-app.com --open
95
+
96
+ # Verbose mode
97
+ npx @agents-forge/aiqa https://my-app.com --verbose
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Bring your own requirements (optional)
103
+
104
+ You can seed the pipeline with an existing requirements document — the analyst still
105
+ explores the site and then **merges** the two, rather than skipping exploration:
106
+
107
+ 1. Drop your requirements **`.md`** file into **`.aiqa/requirements/`** (the folder is
108
+ created for you on first run).
109
+ 2. Run AIQA normally (or just `npx @agents-forge/aiqa` and answer the prompts).
110
+ 3. The analyst explores the URL, then writes `.aiqa/requirements/requirements.md` with two
111
+ clearly-labelled parts:
112
+ - **Part A — Existing Requirements** (carried over from your doc, tagged `[existing]`)
113
+ - **Part B — Newly Discovered Requirements** (the addon found by exploring, tagged `[discovered]`)
114
+
115
+ Nothing from your document is dropped, and the merge happens automatically — no mid-run prompt.
116
+
117
+ > **Naming:** your doc can have any name. If you happen to name it `requirements.md` (the
118
+ > same as the generated output), AIQA preserves your copy as `existing-requirements.md`
119
+ > first, then writes the merged result to `requirements.md` — so your original is never lost.
120
+
121
+ ---
122
+
123
+ ## ⚠️ Installed into an existing project?
124
+
125
+ AIQA writes everything it generates under `.aiqa/`. The only file placed at your repo
126
+ root is `playwright.config.ts` (so `npx playwright test` can auto-discover it). Since
127
+ it's typically run **inside an existing project**, the Super Agent guards that one file:
128
+
129
+ - If a `playwright.config.ts` **already exists**, AIQA asks **once, before the run**,
130
+ whether it may overwrite it.
131
+ - Decline, and your existing config is left untouched — the pipeline runs against it as-is.
132
+ - In a non-interactive shell (CI, piped) it **never silently overwrites** — pass
133
+ `--force` (or `force: true`) to opt in.
134
+ - Use `--dir <path>` to run the whole pipeline (and its `.aiqa/` folder) in a different directory.
135
+
136
+ ---
137
+
138
+ ## What it produces
139
+
140
+ Everything lands under `.aiqa/` so your repo root stays clean — only
141
+ `playwright.config.ts` is written to the root (so `npx playwright test` finds it):
142
+
143
+ ```
144
+ .aiqa/
145
+ ├── session.json ← pipeline state (resumable)
146
+ ├── auth-state.json ← saved login session (if any)
147
+ ├── snapshots/
148
+ │ ├── home.yml ← accessibility trees (ground truth)
149
+ │ ├── login.yml
150
+ │ └── failure-<test>.yml ← captured on test failure
151
+ ├── requirements/
152
+ │ └── requirements.md ← analyst subagent: business analysis
153
+ ├── test-plan/
154
+ │ └── test_plan.md ← qa-planner subagent: strategy + risk analysis
155
+ ├── test-cases/
156
+ │ ├── login.md ← qa-engineer subagent: plain-English test cases
157
+ │ └── checkout.md
158
+ ├── test-scripts/
159
+ │ ├── login.spec.ts ← qa-engineer subagent: Playwright scripts (snapshot-accurate)
160
+ │ └── checkout.spec.ts
161
+ └── reports/
162
+ ├── review_report.md ← qa-reviewer subagent: selector validation + quality review
163
+ ├── summary_report.md ← qa-reporter subagent: stakeholder report
164
+ ├── test-results/ ← results.json, results.xml, traces, failure screenshots
165
+ └── playwright-report/ ← Playwright HTML report (npx playwright show-report .aiqa/reports/playwright-report)
166
+
167
+ playwright.config.ts ← multi-browser config at repo root (overwrite-guarded)
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Programmatic Usage
173
+
174
+ ```typescript
175
+ import { runAIQA } from "@agents-forge/aiqa";
176
+
177
+ const result = await runAIQA({
178
+ target: "https://my-app.com",
179
+ grep: "@smoke",
180
+ skip: ["qa-reviewer"], // skip any subagent by name
181
+ cwd: "./aiqa-output",
182
+ resume: false,
183
+ force: false, // true = skip the playwright.config.ts overwrite prompt
184
+ open: false, // true = open the docs in VS Code Markdown preview
185
+ existingRequirements: ".aiqa/requirements/my-reqs.md", // optional — analyst merges it in
186
+ model: "claude-sonnet-4-6", // optional — Claude model id
187
+ paths: { reports: "reports" }, // optional — override .aiqa folder names
188
+ verbose: false,
189
+ });
190
+
191
+ console.log(`Passed: ${result.passed}`);
192
+ console.log(`Session: ${result.sessionFile}`);
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Configuration — `aiqa.config.ts`
198
+
199
+ Drop an `aiqa.config.ts` (or `.mjs` / `.js` / `.json`) in your project root to set
200
+ defaults. **CLI flags override the config file, which overrides the built-in defaults.**
201
+ Loaded at runtime via [jiti](https://github.com/unjs/jiti) — no build step.
202
+
203
+ ```typescript
204
+ import { defineConfig } from "@agents-forge/aiqa";
205
+
206
+ export default defineConfig({
207
+ // Run defaults (any of these is overridden by the matching CLI flag)
208
+ url: "https://my-app.com",
209
+ grep: "@smoke",
210
+ skip: ["qa-reviewer"],
211
+ open: true,
212
+ force: false,
213
+
214
+ // Model
215
+ model: "claude-sonnet-4-6",
216
+
217
+ // Rename the .aiqa base + subfolders to taste
218
+ paths: {
219
+ base: ".aiqa",
220
+ requirements: "requirements",
221
+ plan: "test-plan",
222
+ testCases: "test-cases",
223
+ testScripts: "test-scripts",
224
+ reports: "reports",
225
+ },
226
+ });
227
+ ```
228
+
229
+ `defineConfig()` is optional but gives you typed autocomplete. Folder renames flow
230
+ everywhere automatically — including the generated `playwright.config.ts` paths.
231
+
232
+ ---
233
+
234
+ ## Skipping subagents
235
+
236
+ Each stage is a subagent you can skip by name (`analyst`, `qa-planner`, `qa-engineer`, `qa-reviewer`, `qa-reporter`):
237
+
238
+ ```bash
239
+ # Analysis + planning only (no tests)
240
+ npx @agents-forge/aiqa https://my-app.com --skip qa-engineer,qa-reviewer,qa-reporter
241
+
242
+ # Skip the review subagent
243
+ npx @agents-forge/aiqa https://my-app.com --skip qa-reviewer
244
+
245
+ # Write tests but don't run them (skip the reporter subagent)
246
+ npx @agents-forge/aiqa https://my-app.com --skip qa-reporter
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Resumable pipeline
252
+
253
+ If the Super Agent crashes mid-run:
254
+
255
+ ```bash
256
+ npx @agents-forge/aiqa https://my-app.com --resume
257
+ ```
258
+
259
+ The session file at `.aiqa/session.json` tracks which subagents completed. On
260
+ `--resume`, any subagent whose output already exists on disk is marked done and
261
+ skipped, so the pipeline picks up where it left off.
262
+
263
+ ---
264
+
265
+ ## Troubleshooting
266
+
267
+ | Error | Fix |
268
+ |---|---|
269
+ | `playwright-cli not found` | `npm install -g @playwright/cli@latest` |
270
+ | `Browser not installed` | `npx playwright install chromium` |
271
+ | `Authentication failed` | Set `ANTHROPIC_API_KEY` or run `claude login` |
272
+ | Pipeline crashed | Re-run with `--resume` |
273
+ | Won't overwrite my config in CI | Pass `--force` (non-interactive runs never overwrite `playwright.config.ts` silently) |
274
+ | Want to preview docs in VS Code | Run inside VS Code with `--open` (opens requirements / test plan / summary in Markdown preview) |
275
+ | Want to run tests interactively | `npx playwright test --ui` |
276
+
277
+ ---
278
+
279
+ ## License
280
+
281
+ MIT
@@ -0,0 +1,41 @@
1
+ import { type AIQAPaths } from "./config.js";
2
+ export interface AIQAInput {
3
+ target: string;
4
+ grep?: string;
5
+ skip?: Array<"analyst" | "qa-planner" | "qa-engineer" | "qa-reviewer" | "qa-reporter">;
6
+ cwd?: string;
7
+ verbose?: boolean;
8
+ resume?: boolean;
9
+ /**
10
+ * Skip the interactive confirmation before overwriting an existing
11
+ * playwright.config.ts in the consumer's project. Useful for CI / fully
12
+ * unattended runs. Defaults to false (prompt before overwriting).
13
+ */
14
+ force?: boolean;
15
+ /**
16
+ * Path to an existing requirements .md document (e.g. dropped into
17
+ * .aiqa/requirements/). When set, the analyst still explores the site and
18
+ * then MERGES this document with the newly discovered requirements.
19
+ */
20
+ existingRequirements?: string;
21
+ /**
22
+ * When true (and running inside VS Code with the `code` CLI on PATH), open the
23
+ * generated markdown deliverables in VS Code's Markdown preview after the run.
24
+ * Adds a '*.md → preview' association to the project's .vscode/settings.json.
25
+ */
26
+ open?: boolean;
27
+ /** Claude model id (e.g. "claude-sonnet-4-6"). From aiqa.config.ts. */
28
+ model?: string;
29
+ /** Override .aiqa base + subfolder names. From aiqa.config.ts. */
30
+ paths?: AIQAPaths;
31
+ }
32
+ export interface AIQAResult {
33
+ sessionFile: string;
34
+ outputs: Record<string, string>;
35
+ passed: boolean;
36
+ totalDuration: number;
37
+ }
38
+ export type Provider = "anthropic" | "copilot";
39
+ export declare function detectProvider(): Provider;
40
+ export declare function runAIQA(input: AIQAInput): Promise<AIQAResult>;
41
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAS3D,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,YAAY,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC,CAAC;IACvF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAI/C,wBAAgB,cAAc,IAAI,QAAQ,CAQzC;AAgSD,wBAAsB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAkMnE"}