@virtocommerce/test-automation-framework 0.0.0-stage → 0.1.0-alpha.1

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 (233) hide show
  1. package/.biome/formatter.json +11 -0
  2. package/.biome/imports.json +52 -0
  3. package/.biome/preset.json +4 -0
  4. package/.biome/rules.json +45 -0
  5. package/.claude/agents/qa-automation-expert.md +119 -0
  6. package/.claude/agents/qa-coverage.md +96 -0
  7. package/.claude/agents/qa-explorer.md +112 -0
  8. package/.claude/agents/qa-healer.md +88 -0
  9. package/.claude/agents/qa-judge.md +102 -0
  10. package/.claude/agents/qa-planner.md +104 -0
  11. package/.claude/agents/qa-reviewer.md +121 -0
  12. package/.claude/checks/browser-secrets.mts +107 -0
  13. package/.claude/checks/contract.mts +469 -0
  14. package/.claude/checks/expectation-guard.mts +665 -0
  15. package/.claude/checks/explore-extractors.mts +4 -0
  16. package/.claude/checks/judge-verdict.mts +165 -0
  17. package/.claude/checks/project-facts.mts +491 -0
  18. package/.claude/checks/prove-fails.mts +770 -0
  19. package/.claude/checks/rank-gaps.mts +177 -0
  20. package/.claude/checks/readonly-shell.mts +740 -0
  21. package/.claude/checks/reconcile-run.mts +270 -0
  22. package/.claude/checks/scan-prompts.mts +351 -0
  23. package/.claude/checks/stand.mts +45 -0
  24. package/.claude/checks/test-duration.mts +134 -0
  25. package/.claude/checks/test-shape.mts +224 -0
  26. package/.claude/checks/ticket-card.mts +195 -0
  27. package/.claude/commands/qa-coverage.md +13 -0
  28. package/.claude/commands/qa-explore.md +17 -0
  29. package/.claude/commands/qa-heal.md +44 -0
  30. package/.claude/commands/qa-implement.md +60 -0
  31. package/.claude/commands/qa-plan.md +55 -0
  32. package/.claude/commands/qa-review.md +90 -0
  33. package/.claude/commands/qa.md +156 -0
  34. package/.claude/hooks/readonly-shell.mts +65 -0
  35. package/.claude/settings.json +15 -0
  36. package/.claude/skills/coverage-analysis/SKILL.md +107 -0
  37. package/.claude/skills/create-graphql-layer/SKILL.md +159 -0
  38. package/.claude/skills/create-ui-layer/SKILL.md +189 -0
  39. package/.claude/skills/explore-api/SKILL.md +74 -0
  40. package/.claude/skills/explore-frontend/SKILL.md +85 -0
  41. package/.claude/skills/framework-rules/SKILL.md +189 -0
  42. package/.claude/skills/heal-tests/SKILL.md +197 -0
  43. package/.claude/skills/heal-tests/guard-recipe.md +53 -0
  44. package/.claude/skills/judge-criteria/SKILL.md +40 -0
  45. package/.claude/skills/judge-criteria/coverage.md +9 -0
  46. package/.claude/skills/judge-criteria/expert.md +23 -0
  47. package/.claude/skills/judge-criteria/explorer.md +9 -0
  48. package/.claude/skills/judge-criteria/healer.md +13 -0
  49. package/.claude/skills/judge-criteria/planner.md +12 -0
  50. package/.claude/skills/plan-implementation/SKILL.md +82 -0
  51. package/.claude/skills/plan-implementation/contract-template.md +72 -0
  52. package/.claude/skills/plan-test-strategy/SKILL.md +100 -0
  53. package/.claude/skills/project-facts/SKILL.md +130 -0
  54. package/.claude/skills/read-change/SKILL.md +64 -0
  55. package/.claude/skills/read-ticket/SKILL.md +63 -0
  56. package/.claude/skills/read-ticket/providers.md +58 -0
  57. package/.claude/skills/review-pr/SKILL.md +152 -0
  58. package/.claude/skills/review-test-code/SKILL.md +208 -0
  59. package/.claude/skills/write-e2e-test/SKILL.md +175 -0
  60. package/.claude/skills/write-graphql-test/SKILL.md +158 -0
  61. package/.claude/skills/write-rest-api-test/SKILL.md +182 -0
  62. package/.claude/skills/write-security-test/SKILL.md +253 -0
  63. package/.qa/project.example.json +71 -0
  64. package/CHANGELOG.md +1 -0
  65. package/LICENSE +12 -0
  66. package/README.md +53 -2
  67. package/bin/install-qa-agents.mjs +94 -0
  68. package/dist/auth/credentials.d.ts +10 -0
  69. package/dist/auth/credentials.js +2 -0
  70. package/dist/auth/credentials.js.map +1 -0
  71. package/dist/auth/frontend-browser-sessions.d.ts +71 -0
  72. package/dist/auth/frontend-browser-sessions.js +130 -0
  73. package/dist/auth/frontend-browser-sessions.js.map +1 -0
  74. package/dist/auth/index.d.ts +9 -0
  75. package/dist/auth/index.js +5 -0
  76. package/dist/auth/index.js.map +1 -0
  77. package/dist/auth/platform-browser-sessions.d.ts +47 -0
  78. package/dist/auth/platform-browser-sessions.js +92 -0
  79. package/dist/auth/platform-browser-sessions.js.map +1 -0
  80. package/dist/auth/sign-in-lock.d.ts +14 -0
  81. package/dist/auth/sign-in-lock.js +70 -0
  82. package/dist/auth/sign-in-lock.js.map +1 -0
  83. package/dist/auth/storage-state.d.ts +3 -0
  84. package/dist/auth/storage-state.js +2 -0
  85. package/dist/auth/storage-state.js.map +1 -0
  86. package/dist/auth/token-client.d.ts +82 -0
  87. package/dist/auth/token-client.js +111 -0
  88. package/dist/auth/token-client.js.map +1 -0
  89. package/dist/auth/token-manager.d.ts +67 -0
  90. package/dist/auth/token-manager.js +138 -0
  91. package/dist/auth/token-manager.js.map +1 -0
  92. package/dist/core/default-reporters.d.ts +31 -0
  93. package/dist/core/default-reporters.js +36 -0
  94. package/dist/core/default-reporters.js.map +1 -0
  95. package/dist/core/default-use.d.ts +28 -0
  96. package/dist/core/default-use.js +25 -0
  97. package/dist/core/default-use.js.map +1 -0
  98. package/dist/core/env.d.ts +24 -0
  99. package/dist/core/env.js +33 -0
  100. package/dist/core/env.js.map +1 -0
  101. package/dist/core/error-message.d.ts +10 -0
  102. package/dist/core/error-message.js +13 -0
  103. package/dist/core/error-message.js.map +1 -0
  104. package/dist/core/index.d.ts +16 -0
  105. package/dist/core/index.js +11 -0
  106. package/dist/core/index.js.map +1 -0
  107. package/dist/core/is-ci.d.ts +14 -0
  108. package/dist/core/is-ci.js +18 -0
  109. package/dist/core/is-ci.js.map +1 -0
  110. package/dist/core/parse-env.d.ts +13 -0
  111. package/dist/core/parse-env.js +21 -0
  112. package/dist/core/parse-env.js.map +1 -0
  113. package/dist/core/projects.d.ts +24 -0
  114. package/dist/core/projects.js +33 -0
  115. package/dist/core/projects.js.map +1 -0
  116. package/dist/core/run-options.d.ts +31 -0
  117. package/dist/core/run-options.js +43 -0
  118. package/dist/core/run-options.js.map +1 -0
  119. package/dist/core/secret.d.ts +105 -0
  120. package/dist/core/secret.js +167 -0
  121. package/dist/core/secret.js.map +1 -0
  122. package/dist/core/string-schemas.d.ts +39 -0
  123. package/dist/core/string-schemas.js +56 -0
  124. package/dist/core/string-schemas.js.map +1 -0
  125. package/dist/core/url-path.d.ts +7 -0
  126. package/dist/core/url-path.js +2 -0
  127. package/dist/core/url-path.js.map +1 -0
  128. package/dist/dataset/collection.d.ts +44 -0
  129. package/dist/dataset/collection.js +76 -0
  130. package/dist/dataset/collection.js.map +1 -0
  131. package/dist/dataset/index.d.ts +11 -0
  132. package/dist/dataset/index.js +6 -0
  133. package/dist/dataset/index.js.map +1 -0
  134. package/dist/dataset/load-dataset.d.ts +39 -0
  135. package/dist/dataset/load-dataset.js +62 -0
  136. package/dist/dataset/load-dataset.js.map +1 -0
  137. package/dist/dataset/manifest.d.ts +77 -0
  138. package/dist/dataset/manifest.js +10 -0
  139. package/dist/dataset/manifest.js.map +1 -0
  140. package/dist/dataset/placeholders.d.ts +66 -0
  141. package/dist/dataset/placeholders.js +87 -0
  142. package/dist/dataset/placeholders.js.map +1 -0
  143. package/dist/dataset/seed-collection.d.ts +53 -0
  144. package/dist/dataset/seed-collection.js +115 -0
  145. package/dist/dataset/seed-collection.js.map +1 -0
  146. package/dist/dataset/seed-dataset.d.ts +70 -0
  147. package/dist/dataset/seed-dataset.js +138 -0
  148. package/dist/dataset/seed-dataset.js.map +1 -0
  149. package/dist/dataset/seed-events.d.ts +81 -0
  150. package/dist/dataset/seed-events.js +2 -0
  151. package/dist/dataset/seed-events.js.map +1 -0
  152. package/dist/dataset/seed-requests.d.ts +102 -0
  153. package/dist/dataset/seed-requests.js +160 -0
  154. package/dist/dataset/seed-requests.js.map +1 -0
  155. package/dist/dataset/seed-scope.d.ts +39 -0
  156. package/dist/dataset/seed-scope.js +67 -0
  157. package/dist/dataset/seed-scope.js.map +1 -0
  158. package/dist/fixtures/default-fixtures.d.ts +93 -0
  159. package/dist/fixtures/default-fixtures.js +105 -0
  160. package/dist/fixtures/default-fixtures.js.map +1 -0
  161. package/dist/fixtures/index.d.ts +2 -0
  162. package/dist/fixtures/index.js +2 -0
  163. package/dist/fixtures/index.js.map +1 -0
  164. package/dist/graphql/graphql-client.d.ts +78 -0
  165. package/dist/graphql/graphql-client.js +83 -0
  166. package/dist/graphql/graphql-client.js.map +1 -0
  167. package/dist/graphql/graphql-codegen.d.ts +56 -0
  168. package/dist/graphql/graphql-codegen.js +42 -0
  169. package/dist/graphql/graphql-codegen.js.map +1 -0
  170. package/dist/graphql/graphql-error.d.ts +54 -0
  171. package/dist/graphql/graphql-error.js +74 -0
  172. package/dist/graphql/graphql-error.js.map +1 -0
  173. package/dist/graphql/index.d.ts +6 -0
  174. package/dist/graphql/index.js +4 -0
  175. package/dist/graphql/index.js.map +1 -0
  176. package/dist/http/authentication.d.ts +16 -0
  177. package/dist/http/authentication.js +2 -0
  178. package/dist/http/authentication.js.map +1 -0
  179. package/dist/http/http-client.d.ts +110 -0
  180. package/dist/http/http-client.js +237 -0
  181. package/dist/http/http-client.js.map +1 -0
  182. package/dist/http/http-error.d.ts +26 -0
  183. package/dist/http/http-error.js +34 -0
  184. package/dist/http/http-error.js.map +1 -0
  185. package/dist/http/http-method.d.ts +2 -0
  186. package/dist/http/http-method.js +2 -0
  187. package/dist/http/http-method.js.map +1 -0
  188. package/dist/http/http-response.d.ts +137 -0
  189. package/dist/http/http-response.js +166 -0
  190. package/dist/http/http-response.js.map +1 -0
  191. package/dist/http/index.d.ts +7 -0
  192. package/dist/http/index.js +4 -0
  193. package/dist/http/index.js.map +1 -0
  194. package/dist/http/request-options.d.ts +62 -0
  195. package/dist/http/request-options.js +2 -0
  196. package/dist/http/request-options.js.map +1 -0
  197. package/dist/modules/index.d.ts +2 -0
  198. package/dist/modules/index.js +2 -0
  199. package/dist/modules/index.js.map +1 -0
  200. package/dist/modules/installed-modules.d.ts +86 -0
  201. package/dist/modules/installed-modules.js +135 -0
  202. package/dist/modules/installed-modules.js.map +1 -0
  203. package/docs/README.md +43 -0
  204. package/docs/concepts/areas.md +38 -0
  205. package/docs/concepts/auth.md +92 -0
  206. package/docs/concepts/config.md +102 -0
  207. package/docs/concepts/dataset.md +183 -0
  208. package/docs/concepts/environment.md +54 -0
  209. package/docs/concepts/fixtures.md +109 -0
  210. package/docs/concepts/graphql.md +76 -0
  211. package/docs/concepts/http.md +88 -0
  212. package/docs/concepts/modules.md +63 -0
  213. package/docs/concepts/secrets.md +50 -0
  214. package/docs/contributing/architecture.md +67 -0
  215. package/docs/contributing/conventions.md +39 -0
  216. package/docs/contributing/documentation.md +37 -0
  217. package/docs/contributing/releasing.md +76 -0
  218. package/docs/examples/auth.ts +20 -0
  219. package/docs/examples/config.ts +36 -0
  220. package/docs/examples/dataset.ts +70 -0
  221. package/docs/examples/environment.ts +8 -0
  222. package/docs/examples/fixtures.ts +41 -0
  223. package/docs/examples/getting-started.ts +22 -0
  224. package/docs/examples/graphql-codegen.ts +9 -0
  225. package/docs/examples/graphql.ts +32 -0
  226. package/docs/examples/http.ts +18 -0
  227. package/docs/examples/modules.ts +19 -0
  228. package/docs/examples/secrets.ts +11 -0
  229. package/docs/examples/tsconfig.json +10 -0
  230. package/docs/getting-started.md +106 -0
  231. package/docs/guides/generating-types.md +75 -0
  232. package/docs/guides/qa-agents.md +66 -0
  233. package/package.json +156 -4
@@ -0,0 +1,60 @@
1
+ # QA Implement
2
+
3
+ **Stage 2 of 3** in the QA workflow: Plan → Implement → Review
4
+
5
+ You are orchestrating the implementation stage. Spawn the `qa-automation-expert` agent to implement one approved
6
+ contract. The agent receives the contract path and nothing else.
7
+
8
+ ## Input
9
+
10
+ `$ARGUMENTS` is the path of a contract: `.qa/contracts/<ticket-key-or-slug>.md`, written by `/qa-plan`.
11
+
12
+ - No path: ask the person for it, or tell them to run `/qa-plan` first. Do not look for a plan in the conversation
13
+ and do not take a task description in place of a contract.
14
+ - A path that is not a file: say so and stop.
15
+
16
+ ## Steps
17
+
18
+ ### 1. Check the Contract
19
+
20
+ Run `node .claude/checks/contract.mts check --approved <path>`. It prints `ok <path>` or one line per problem; with
21
+ `--approved` it also requires the contract's `## Approval` line.
22
+
23
+ When it does not print `ok`, show its lines, say the contract is not ready, and stop. Do not repair the contract
24
+ and do not start the expert on it; the planner fixes it, or a person approves an amendment.
25
+
26
+ Confirm with the person that this contract is the approved one. Never approve it for them.
27
+
28
+ ### 2. Implement
29
+
30
+ First move an earlier run's judge verdict out of the way, so it cannot steer this run:
31
+ `mv -f .qa/judge/<contract-name>/judge-expert.json .qa/judge/<contract-name>/judge-expert.previous.json` when the
32
+ first file exists (`<contract-name>` and the other hand-off paths: the skill `project-facts`, "Hand-off Paths").
33
+
34
+ Spawn the `qa-automation-expert` agent with the contract path only: no plan, no summary of the conversation, no
35
+ extra instructions. It reads `framework-rules` and `project-facts`, implements the cases, runs the definition of done
36
+ and leaves its run record under `.qa/runs/<contract-name>/` (`report.<project>.json` and `list.<project>.json` for
37
+ each project).
38
+
39
+ If it stops with an amendment request, show the amendment to the person. Only the person writes its `Approved:`
40
+ line, or you write `Approved: <who>, <date> (relayed: "<their reply, word for word>")` quoting them (several lines
41
+ joined with " / "); never without their words. After it is written, run the check again and, when it prints `ok`,
42
+ spawn the expert again with the same path.
43
+
44
+ ### 3. Output
45
+
46
+ Present the expert's report:
47
+ - Files created or modified
48
+ - Tests added (titles)
49
+ - Run record path and the passed, skipped and failed counts per project, with every skip's reason and every
50
+ failure of a case under `## Platform defects`, with its case and tracker link
51
+ - Amendments awaiting approval, and findings
52
+
53
+ When the stand was not reachable, say that the run was not done.
54
+
55
+ When an amendment awaits approval, end by naming it and say that implementation is paused. When the run was not
56
+ done, end by saying so. Only when nothing awaits approval and the run was done, end with the contract's own path in
57
+ place of `<contract path>`:
58
+ ```
59
+ Implementation complete. Run /qa-review <contract path> to review the code.
60
+ ```
@@ -0,0 +1,55 @@
1
+ # QA Plan
2
+
3
+ **Stage 1 of 3** in the QA workflow: Plan → Implement → Review
4
+
5
+ You are orchestrating the planning stage. Spawn the `qa-planner` agent to turn the request into a contract.
6
+
7
+ ## Input
8
+
9
+ `$ARGUMENTS` is one of:
10
+ - a ticket key (checked against `tracker.keyPattern` in the project facts)
11
+ - a specification or documentation link
12
+ - an area of existing functionality ("cover the cart") or a gap id from the coverage report
13
+ - a plain-text requirement
14
+
15
+ An area or a gap needs the explorer's report and the coverage report first; when they do not exist, say so and offer
16
+ `/qa-explore` and `/qa-coverage` before planning.
17
+
18
+ ## Steps
19
+
20
+ ### 1. Plan
21
+
22
+ Spawn the `qa-planner` agent with the request. It reads `framework-rules` and `project-facts`, reads the source (a
23
+ ticket through `read-ticket`), designs the case matrix with `/plan-test-strategy`, asks the scope questions the
24
+ matrix leaves open, and writes `.qa/contracts/<ticket-key-or-slug>.md` with `/plan-implementation`.
25
+
26
+ Relay its scope questions to the person and pass the answers back.
27
+
28
+ ### 2. Check
29
+
30
+ First, when the planner replies `needs observation`, spawn `qa-explorer` (read-only) with `observe <contract path>`,
31
+ then the planner with `observed <contract path> <report path>`. Cases the report lists as `not reached: needs
32
+ <role>` (the explorer observes only as the session the browser holds), and cases the planner lists as `api-only` (no
33
+ page sends their request; an API-only area cannot be observed, because the observe probe does not exist yet), go to
34
+ the person at once as a scope question: (a) observe at the expert's first run (it pins the value it sees and asks
35
+ for it in an amendment the person approves); (b) name another oracle source; (c) drop the case. Pass the answers to
36
+ the planner with `observed <contract path> <report path>`.
37
+
38
+ Otherwise run `node .claude/checks/contract.mts check .qa/contracts/<file>.md`. On a problem, send the line back to
39
+ the planner; do not edit the contract yourself. Lines `at first run awaits the person's approval` do not stop the
40
+ approval question; they clear once the approval line is written.
41
+
42
+ ### 3. Approval
43
+
44
+ Show the contract's cases, each `observed:` oracle with its recorded value and report, its `## Observed only`
45
+ section, and every case or `observed:` part moved out as not reached, with the reason; ask one question: approve
46
+ this contract. A person's
47
+ approval is the only thing that lets `/qa-implement` start; never approve for them. Record it: unless the person
48
+ wrote it, add `## Approval` with the one line `Approved: <who>, <date> (relayed: "<their reply, word for word>")`
49
+ (several lines joined with " / "), the only edit you make to the contract, then run the check again.
50
+
51
+ End with:
52
+ ```
53
+ Contract: .qa/contracts/<file>.md
54
+ Approved? Run /qa-implement .qa/contracts/<file>.md to build it.
55
+ ```
@@ -0,0 +1,90 @@
1
+ # QA Review
2
+
3
+ **Stage 3 of 3** in the QA workflow: Plan → Implement → Review
4
+
5
+ You are orchestrating the review stage. Spawn the `qa-reviewer` agent to review the code produced in the previous
6
+ `/qa-implement` stage, or review any specified files or PR.
7
+
8
+ Dispatch the reviewer fresh with the diff (or the git range) and the contract path when there is one, never the
9
+ author's summary. When there is none, say "no contract" in the dispatch: the reviewer then reviews against the
10
+ framework rules and style only and skips the contract-based checks.
11
+ After a heal, pass the `healer:` argument on as one fixed line of the dispatch,
12
+ `healer: <baseline tree id> <new tree id>`, exactly as given and only when both are git tree ids (7 to 64 hexadecimal
13
+ characters); otherwise stop and say so.
14
+ The reviewer spares only the hunks of `git diff <baseline tree id> <new tree id>` under the healer paths from its
15
+ scope rule.
16
+ The reviewer's shell is read-only (a hook enforces it): it cannot run typecheck, lint or `gh`. Run
17
+ `commands.typecheck` and `commands.lint` from `node .claude/checks/project-facts.mts` yourself and report the result
18
+ with the review; for a PR, fetch the diff and metadata with `gh` and pass them in. A failing typecheck or lint means
19
+ the work is not done, whatever the reviewer's verdict: do not end with "ready to commit" until both are clean.
20
+
21
+ ## Input
22
+
23
+ One of:
24
+ - A contract path (`.qa/contracts/<contract-name>.md`, as `/qa-implement` names it) — review the implementation of
25
+ that contract
26
+ - No arguments — review the files changed on the current branch
27
+ - A file path or glob pattern — review specific files
28
+ - A PR number or URL — review a pull request
29
+
30
+ Optionally followed by `healer: <baseline tree id> <new tree id>`, which `/qa-heal` names after a clean guard.
31
+
32
+ `$ARGUMENTS` specifies the target, then the optional `healer:` part; take that part off before reading the target.
33
+ If the target is empty, detect it from git.
34
+
35
+ ## Steps
36
+
37
+ ### 1. Determine Review Scope
38
+
39
+ If `$ARGUMENTS` is a contract path (a `.md` file under `.qa/contracts/`):
40
+ - Run `node .claude/checks/contract.mts check --approved --implemented <contract path>`; when it does not print `ok`,
41
+ show its lines and stop
42
+ - Collect the changed files as for no arguments, new untracked files included (`git status --porcelain`)
43
+ - Spawn the `qa-reviewer` agent with `/review-test-code` on those files and the contract path. It runs the
44
+ definition of done on the run record `.qa/runs/<contract-name>/` (the skill `project-facts`, "Hand-off Paths"),
45
+ the scope check and the shape and duration gates
46
+
47
+ If `$ARGUMENTS` is a PR number or URL:
48
+ - Spawn the `qa-reviewer` agent with the `/review-pr` skill, and "no contract"
49
+
50
+ If `$ARGUMENTS` is any other file path or pattern:
51
+ - Spawn the `qa-reviewer` agent with the `/review-test-code` skill, and "no contract"
52
+
53
+ If no arguments (then also "no contract"):
54
+ - Collect changed files: `git diff --name-only dev...HEAD` plus uncommitted changes (`git status --short`)
55
+ - Keep the TypeScript and GraphQL files of the suite (`virtocommerce/`, skipping `virtocommerce/graphql/generated/`
56
+ and `virtocommerce/rest/generated/`) and of the framework (`src/`, `tests/unit/`), plus the JSON records under
57
+ `virtocommerce/dataset/data/`
58
+ - Spawn the `qa-reviewer` agent with `/review-test-code` on those files
59
+
60
+ ### 2. Review
61
+
62
+ The agent reviews against the skill `framework-rules` and the repository's own style:
63
+ - Framework rules (`arrange:`/`act:`/`assert:` steps, no conditionals/casts/helpers/raw selectors, layer rules,
64
+ waits, platform defects left failing with their `issue` annotation)
65
+ - Style (the repository's `CLAUDE.md`, linter configuration and neighbouring files)
66
+ - The stand (data from `arrange`, `...Later` removal right after the act, only `owned` data changed, platform-wide
67
+ changes only in the isolated project)
68
+ - With a contract, the definition of done (`node .claude/checks/reconcile-run.mts` on its own `--list` output and
69
+ the run record under `.qa/runs/<contract-name>/`; exit 1 means not done, unless every failure is a test of a case
70
+ under `## Platform defects`)
71
+ - Coverage gaps and cross-file duplication
72
+
73
+ Whether a test checks its case and fails when the behaviour breaks is the judge's, not the reviewer's.
74
+
75
+ ### 3. Output
76
+
77
+ Present the review results:
78
+ - Per-file review with Critical / Warning / Suggestion items
79
+ - Overall verdict: APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION
80
+ - Coverage gap summary
81
+
82
+ If issues are found, end with:
83
+ ```
84
+ Review complete. Fix the issues above, then run /qa-review again.
85
+ ```
86
+
87
+ If approved, end with:
88
+ ```
89
+ Review complete. Code looks good — ready to commit.
90
+ ```
@@ -0,0 +1,156 @@
1
+ # QA
2
+
3
+ One entry for the whole QA workflow: `/qa <task>` picks a flow and runs it from this session. You are the
4
+ orchestrator. You dispatch each role as a fresh subagent with file paths only, never a summary of the conversation,
5
+ and you never do a role's work yourself.
6
+
7
+ `$ARGUMENTS` is the task in plain words: a ticket key, a specification or documentation link, an area ("cover the
8
+ cart"), a failing test, "review this branch", "what is not covered". Empty: ask what to do.
9
+
10
+ ## Pick the Flow
11
+
12
+ | Request | Flow |
13
+ |---|---|
14
+ | A ticket, spec or feature | planner -> approval -> expert -> judge -> reviewer |
15
+ | Existing functionality with no ticket: a module, page or API area, or a gap from coverage | explorer, coverage, then planner -> approval -> expert -> judge -> reviewer |
16
+ | "Explore ...", or the plan needs selectors or endpoints nobody has mapped | explorer, then back to the flow that asked |
17
+ | A failing or flaky test | healer -> guard, then reviewer when it changed code |
18
+ | "Review this branch" | reviewer |
19
+ | "What is not covered / what next" | coverage; its gaps can be handed to the planner |
20
+ | "Do it end to end" | planner -> explorer (observe) if an `observed:` oracle is pending -> approval -> explorer if needed -> expert -> healer if red -> guard -> judge -> reviewer |
21
+
22
+ When the request fits two rows, say which flow you chose in one line and start it. When it fits none, ask. In every
23
+ flow, a contract with a pending `observed:` oracle is observed before its approval (Plan).
24
+
25
+ ## Dispatch Rules
26
+
27
+ - Each role is a fresh subagent: `qa-planner`, `qa-explorer`, `qa-coverage`, `qa-automation-expert`, `qa-judge`,
28
+ `qa-healer`, `qa-reviewer`. Give it the request and the paths it needs (the contract, a report, a diff range,
29
+ spec files). Never paste the previous agent's reasoning or summary.
30
+ - Send an agent only paths, the person's own words and the fixed words this command names (`judge re-dispatch`,
31
+ "no contract", `healer: <baseline tree id> <new tree id>`, `observe <contract path>`, `observed <contract path>
32
+ <report path>`). Relay its questions to the person and pass the answers back.
33
+ - Stages run in order; one stage's output file is the next stage's input. Do not run two writers on the same files
34
+ at once.
35
+ - A stand that is not reachable is reported as "not done", never as a pass.
36
+
37
+ ## Stages
38
+
39
+ ### Explore and coverage
40
+
41
+ Dispatch `qa-explorer` with the area. Dispatch `qa-coverage` for what is already tested. Both leave a report under
42
+ `.qa/reports/`; keep the paths and pass them to the planner. In an explore-only flow, show the report and stop.
43
+
44
+ ### Plan
45
+
46
+ Dispatch `qa-planner` with the request (and the report paths for an area or a gap). It writes
47
+ `.qa/contracts/<ticket-key-or-slug>.md`. Relay its scope questions.
48
+
49
+ First, when the planner replies `needs observation` (its only check lines are `no recorded value`), observe before
50
+ the approval: dispatch `qa-explorer` with `observe <contract path>`. It is read-only and records every `observed:`
51
+ case in `.qa/reports/explore-<slug>-observed.md`. Then dispatch the planner with `observed <contract path> <report
52
+ path>` to copy the values in. Cases the report lists as `not reached: needs <role>` (the explorer observes only as
53
+ the session the browser holds), and cases the planner lists as `api-only` (no page sends their request; an API-only
54
+ area cannot be observed, because the observe probe does not exist yet), go to the person at once as a scope
55
+ question: (a) observe at the expert's first run (it pins the value it sees and asks for it in an amendment the
56
+ person approves); (b) name another oracle source; (c) drop the case. Pass the answers to the planner with
57
+ `observed <contract path> <report path>`.
58
+
59
+ Otherwise run `node .claude/checks/contract.mts check .qa/contracts/<file>.md`. When it does not print `ok`, send its
60
+ lines back to the planner; never edit the contract yourself. Never ask for approval of a contract the check refuses,
61
+ except for lines `at first run awaits the person's approval`: they clear once the approval line is written.
62
+
63
+ ### Approval
64
+
65
+ Show the contract's cases, each `observed:` oracle with its recorded value and report, its `## Observed only`
66
+ section, and every case or `observed:` part moved out as not reached, with the reason; ask one question: approve
67
+ this contract. A person's approval is the only thing that lets the expert start. Never approve for them. Record it:
68
+ unless the person wrote it, add `## Approval` with the one line `Approved: <who>, <date> (relayed: "<their reply,
69
+ word for word>")`, a reply of several lines joined with " / ". That line, and the same line on an amendment the
70
+ person approved, are the only edits you make to a contract, and only with the person's words to quote. Then run the
71
+ contract check again.
72
+
73
+ ### Implement
74
+
75
+ The hand-off paths (`<contract-name>`, the run record, the verdict) and the stable-series commands are in the skill
76
+ `project-facts`, "Hand-off Paths".
77
+
78
+ Before the first expert dispatch of a run, move an earlier run's verdict out of the way, so it cannot steer this run:
79
+ `mv -f .qa/judge/<contract-name>/judge-expert.json .qa/judge/<contract-name>/judge-expert.previous.json` when the
80
+ first file exists. Run `node .claude/checks/contract.mts check --approved <contract path>`; when it does not print
81
+ `ok`, the contract is not approved: stop. Dispatch `qa-automation-expert` with the contract path only. It leaves
82
+ its run record under `.qa/runs/<contract-name>/`: `report.<project>.json` and `list.<project>.json` for each
83
+ project, named with the project even when there is one. When it stops with an amendment request, show it to the
84
+ person; after the amendment's `Approved:` line is written (by the person, or by you quoting them as in Approval), run
85
+ the contract check again and dispatch the expert again with the same path (not a judge re-dispatch).
86
+
87
+ In the end-to-end flow, tell an unreachable stand apart from a red run first. When the expert reported the stand as
88
+ not reachable, or a project of the contract's case rows has no `report.<project>.json`, the run is "not done, stand
89
+ unreachable": stop, tell the person, and go to neither Heal nor Judge. Otherwise reconcile each project's record with
90
+ the third command of "Hand-off Paths". Exit 1 with a verdict whose `failures` list only tests of cases under the
91
+ contract's `## Platform defects`, each failed in every repetition: the run is done with known platform defects, so
92
+ go to Judge and name them in the Output. Exit 1 with a verdict whose `failures` list any other test (failed, flaky,
93
+ skipped without a reason, missing from the report): the run is red, so go to Heal with the run record path, then to
94
+ Judge. Exit 1 with no verdict (a file it cannot read or parse): "not done"; show its line to the person and stop.
95
+ All exit 0: go to Judge.
96
+
97
+ ### Heal
98
+
99
+ Before dispatching `qa-healer`, record a baseline and a fingerprint:
100
+ `node .claude/checks/expectation-guard.mts --snapshot` prints a git tree id of the working tree, untracked files
101
+ included; `node .claude/checks/expectation-guard.mts --repo-fingerprint` prints one sha of `.git/config`,
102
+ `.git/info/`, `.git/hooks/`, the directory `core.hooksPath` names and `.qa/project.json` (it only reads; it is
103
+ yours, the healer may not run it). When `--repo-fingerprint` exits non-zero or prints anything but 64 lowercase
104
+ hexadecimal characters (a configuration file under a healer path, for one), show the person "fingerprint could not
105
+ be computed:" followed by its stderr line, and do not dispatch the healer. Then store the guard recipe as the baseline
106
+ holds it:
107
+ `GIT_NO_LAZY_FETCH=1 git --no-replace-objects -c core.fsmonitor=false cat-file blob <baseline tree id>:.claude/skills/heal-tests/guard-recipe.md`
108
+ prints it; keep that text, and when it prints nothing, do not dispatch the healer. Dispatch the healer with the
109
+ failing spec files or the run record path and that baseline id. A run whose only failures are platform-defect
110
+ tests is not healed.
111
+ When it is done, run the recipe you stored word for word: its shell block with that baseline id and fingerprint,
112
+ what each outcome means, and its "After a Clean Guard" re-run. Never read
113
+ `.claude/skills/heal-tests/guard-recipe.md` from the working tree after the heal: the healer runs test code, which
114
+ can rewrite any file, the recipe included. A guard that is not clean, or a re-run that exits 1 on a project, stops
115
+ the flow before the judge and the reviewer. A product defect the healer reports is shown to the person, not
116
+ patched: its test stays failing until the platform is fixed, and the person files the ticket.
117
+
118
+ In the end-to-end flow this stage runs only when the expert's run is red, and before the judge.
119
+
120
+ ### Judge
121
+
122
+ After the expert (and, in the end-to-end flow, after a clean heal), once per contract, dispatch `qa-judge` with the
123
+ role `expert`, the contract path and the expert's spec files: it judges only the expert's tests, never the healer's
124
+ page-object or data changes, which the guard checks. The verdict is `.qa/judge/<contract-name>/judge-expert.json`.
125
+ Check it:
126
+
127
+ `node .claude/checks/judge-verdict.mts check .qa/judge/<contract-name>/judge-expert.json expert`
128
+
129
+ - Not `ok`: send the judge the lines and have it fix its file once; never edit the verdict yourself. A second
130
+ malformed verdict stops the flow: show the check's output to the person and wait.
131
+ - `pass`: go on to the reviewer.
132
+ - `fail`: dispatch `qa-automation-expert` again, once, with the contract path and the words `judge re-dispatch`; it
133
+ reads the failing verdict at that fixed path itself and fixes only what it names. Then judge again. A second
134
+ `fail` stops the flow: show both verdicts to the person and wait. Never loop further.
135
+
136
+ No other role is judged in a flow.
137
+
138
+ ### Review
139
+
140
+ Dispatch `qa-reviewer` with the diff (or the git range) and the contract path when there is one, never the author's
141
+ summary. For "review this branch" with no contract, say so in the dispatch: the reviewer then reviews against the
142
+ framework rules and style only. After a heal whose guard ran clean, add the line
143
+ `healer: <baseline tree id> <new tree id>` (the `healed tree` the guard recipe printed). The reviewer spares only the
144
+ hunks of `git diff <baseline tree id> <new tree id>` under the healer paths from the scope rule, so an expert's own
145
+ change in a healed file stays in scope. Without a clean guard, send no such line. Its shell is read-only, so run
146
+ `commands.typecheck` and `commands.lint` from `node .claude/checks/project-facts.mts` yourself and report the result
147
+ with the review. A failing typecheck or lint means the work is not done, whatever the verdict.
148
+ For a pull request, fetch the diff and metadata with `gh` and pass them as files.
149
+
150
+ ## Output
151
+
152
+ End with what ran and what is left: the flow, the contract path, the run record counts per project with every
153
+ skip's reason and every platform-defect failure with its case, the judge verdict, the review verdict, and anything
154
+ awaiting a person (an approval, an amendment, a second judge failure, a guard finding). Say "not done" for any stage
155
+ that did not run. Say "ready to commit" only when the contract is approved, the run was done, the judge passed, the
156
+ review approved and typecheck and lint are clean.
@@ -0,0 +1,65 @@
1
+ import type { hookBlockReason } from "../checks/readonly-shell.mts";
2
+
3
+ import { readFileSync } from "node:fs";
4
+ import { basename } from "node:path";
5
+
6
+ type HookBlockReason = typeof hookBlockReason;
7
+
8
+ const CLI_FILE_NAME = "readonly-shell.mts";
9
+ const MODULE = "../checks/readonly-shell.mts";
10
+ const GUARDED_AGENTS = ["qa-reviewer", "qa-explorer", "qa-coverage", "qa-judge", "qa-healer"];
11
+ const STDIN = 0;
12
+ const BLOCK_EXIT_CODE = 2;
13
+
14
+ function readStdin(): string {
15
+ try {
16
+ return readFileSync(STDIN, "utf8");
17
+ } catch {
18
+ return "";
19
+ }
20
+ }
21
+
22
+ function parse(text: string): unknown {
23
+ try {
24
+ return JSON.parse(text);
25
+ } catch {
26
+ return undefined;
27
+ }
28
+ }
29
+
30
+ function guardedAgentOf(input: unknown): string | undefined {
31
+ if (typeof input !== "object" || input === null || !("agent_type" in input)) {
32
+ return undefined;
33
+ }
34
+ const agent = input.agent_type;
35
+ if (typeof agent !== "string") {
36
+ return undefined;
37
+ }
38
+ return GUARDED_AGENTS.includes(agent.split(":").pop() ?? "") ? agent : undefined;
39
+ }
40
+
41
+ function block(reason: string): void {
42
+ process.stderr.write(`${reason}\n`);
43
+ process.exitCode = BLOCK_EXIT_CODE;
44
+ }
45
+
46
+ async function main(): Promise<void> {
47
+ const input = parse(readStdin());
48
+ const agent = guardedAgentOf(input);
49
+ if (agent === undefined) {
50
+ return;
51
+ }
52
+ try {
53
+ const shell: { hookBlockReason: HookBlockReason } = await import(MODULE);
54
+ const reason = shell.hookBlockReason(input, process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
55
+ if (reason !== undefined) {
56
+ block(reason);
57
+ }
58
+ } catch {
59
+ block(`${agent} is restricted and its check could not run; blocked`);
60
+ }
61
+ }
62
+
63
+ if (basename(process.argv[1] ?? "") === CLI_FILE_NAME) {
64
+ await main();
65
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash|Write|Edit|MultiEdit|NotebookEdit|PowerShell|mcp__playwright__.*",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/readonly-shell.mts\" || exit 2"
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: coverage-analysis
3
+ description: "Analyse the coverage of a stand: what it offers (installed modules, API operations, frontend pages), what the tests cover and skip, the gaps ranked by script, and the test-count metrics. Read-only; writes only the report under .qa/reports/"
4
+ argument-hint: "[module | page | api-area]"
5
+ ---
6
+
7
+ ## Coverage Analysis
8
+
9
+ Used by `qa-coverage`. The result is `.qa/reports/coverage-<yyyy-mm-dd>[-<slug>].md` with four sections. It writes no
10
+ test, no page object and no seeder; a gap is text for `qa-planner`. Read first: the skill `framework-rules`, then
11
+ `project-facts` (`node .claude/checks/project-facts.mts`). The argument limits every step to one module, page or API
12
+ area.
13
+
14
+ ## Step 1: Inventory (What the Stand Offers)
15
+
16
+ - **Installed modules:** a file in the repository or in the run's output that lists them, where the configuration
17
+ or the fixtures name one. None: write "installed modules not available" and treat every module as enabled; never
18
+ run a setup project to get one.
19
+ - **Feature flags:** from the repository's environment schema or configuration code, names and defaults only. A flag
20
+ that switches an area off, or off its default way, is written next to the area it controls.
21
+ - **API operations:** from the generated schemas the repository holds (a GraphQL schema file, an OpenAPI document or
22
+ the generated REST types). One row per query, mutation or endpoint: the area it belongs to and its name. No
23
+ schema in the repository: write "not available" and go on.
24
+ - **Frontend pages:** from the page objects, the frontend's routes where the project facts or the README say where its
25
+ source lives, or a sitemap or menu seen with the browser on the frontend origin `node .claude/checks/stand.mts`
26
+ prints: first anonymously, then signed in as `roleFor.customer` when it prints `sign-in: ready`. Each page says
27
+ which look reached it. Nothing exposes them: "not available".
28
+
29
+ Each list is a short table; count and group by area when it is long.
30
+
31
+ ## Step 2: Coverage (What the Tests Cover)
32
+
33
+ - Per Playwright project (Grep `name:` in the suite's config, `<suiteDir>/playwright.config.ts`) and area, run one
34
+ command at a time, with `<path>` repository-relative:
35
+
36
+ ```shell
37
+ npx --no playwright test --config=<suiteDir> --list --reporter=list --project=<project> <path>
38
+ ```
39
+
40
+ Its `Total: N tests in M files` line is the count. Use `--reporter=json` only for one project and one path, when
41
+ skip annotations are needed: the full JSON of a large suite fills your context. Setup projects are not counted. A
42
+ project the configuration hides behind a flag does not list: write "not listed: needs a flag", never set the flag.
43
+ - Map an operation or page to its tests by Grep of its name in the specs, `arrange` methods, documents and page
44
+ objects, not in generated code. An operation called by no test is uncovered.
45
+ - **Skipped and failing-by-design tests:** Grep the specs for the `modules` option (skipped where the module is
46
+ missing or older), for `test.skip` and `test.fixme`, and for `PLATFORM_DEFECT_TAG` (known platform defects: the
47
+ test runs, marked `test.fail`, until the platform is fixed). One row each: test, project, reason, issue link or `none`.
48
+ A `test.skip` or `test.fixme`, a `test.fail` without the tag, or a skip without a reason, breaks the framework rules: list it as a
49
+ finding.
50
+
51
+ ## Step 3: Gaps
52
+
53
+ A gap is one thing no test covers: an operation, an endpoint or a page flow. Write each as an entry of
54
+ `{ "gaps": [...] }` in the gaps file the agent names, fields exactly:
55
+
56
+ | Field | Value |
57
+ |---|---|
58
+ | `area` | the module or area, as step 1 names it |
59
+ | `surface` | `graphql`, `rest` or `frontend` |
60
+ | `name` | the operation, endpoint or flow |
61
+ | `critical` | true when the flow is in the facts' `critical` list |
62
+ | `enabledOnStand` | false when the module is not installed or a flag switches the area off, else true |
63
+ | `uiWithoutApi` | true when an e2e test exercises the operation's area and no API test calls the operation |
64
+ | `factors` | optional `risk`, `callFrequency`, `runFrequency`, `stability`, `cost`, each 0 to 1, only from named evidence |
65
+
66
+ Factor evidence: `callFrequency` from endpoint telemetry where the project has it; `runFrequency` from git history
67
+ of the area; `stability` from the platform defects the area's tests carry as `issue` annotations (more defects,
68
+ higher); `cost` from the building blocks the planner would still have to create (a missing document, page object,
69
+ `arrange` method or data role: higher). No evidence: leave the key out.
70
+
71
+ Run `node .claude/checks/rank-gaps.mts <gaps file>`. It marks a gap critical when its name or area matches a critical
72
+ flow, scores each gap by the project's weights, and prints them in a strict order: gaps enabled on the stand first, then
73
+ critical flows before the others (a critical gap outranks a non-critical one whatever the scores), then by score,
74
+ highest first, then by name. A gap not enabled on the stand ranks below every enabled one, critical or not. Give the
75
+ gaps ids `G1`, `G2`, ... in the printed order. In the report each is one row: id, area, surface, name, score, and one
76
+ sentence a planner can take as a task ("Cover `<name>`: the behaviour no test checks; roles `<roles>`"), plus why it is
77
+ not enabled when it is not.
78
+
79
+ ## Step 4: Metrics
80
+
81
+ Counts from Step 2, not from memory:
82
+
83
+ | Project | Spec files | Tests | Platform defects | Skipped | Active rate |
84
+ |---|---|---|---|---|---|
85
+
86
+ - Spec files: count the `*.spec.ts` files under each project's test directory (Glob). Unit tests are on their own
87
+ lines, counted by file (Glob of `*.test.ts`): the framework's under `tests/unit/` and the suite's under
88
+ `<suiteDir>/tests/unit/`.
89
+ - A project that needs a flag the read-only shell never sets (in this repository `isolated`, whose tests are left
90
+ out unless `RUN_DESTRUCTIVE_TESTS` is on) does not list: leave it out of every total and say so in one line under
91
+ the table.
92
+ - **Platform-defect tests:** a test with an `issue` annotation runs and fails until the platform is fixed. A table
93
+ row may carry the annotation as a field, so count rows, not only call sites. List each: project, file, test,
94
+ issue link.
95
+ - Skipped: tests the `modules` option skips on this stand, when a run's report shows them; otherwise 0, and say so.
96
+ - Active tests = total tests minus skipped; active rate = active / total x 100.
97
+ - Distribution: each project's share of the total, with one line on the balance between API and UI tests.
98
+ - Compared with the newest earlier report `.qa/reports/coverage-*.md`, excluding `*-gaps.md`, when one exists: change
99
+ and percent change per project; none: say so.
100
+
101
+ Each run writes the report and one gaps working file (`<report name>-gaps.md`); the working file is never a report to
102
+ compare against.
103
+
104
+ ## Done
105
+
106
+ All four sections are in the report, each with its rows or `none observed`; the Gaps section keeps the script's
107
+ order; every row says where it was seen. Nothing outside `.qa/reports/` changed (`git status`).