@runchr/gstack-antigravity 0.1.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.

Potentially problematic release.


This version of @runchr/gstack-antigravity might be problematic. Click here for more details.

Files changed (297) hide show
  1. package/.agents/rules/ETHOS.md +129 -0
  2. package/.agents/rules/global-gstack.md +117 -0
  3. package/.agents/rules/persona-gstack-autoplan.md +14 -0
  4. package/.agents/rules/persona-gstack-benchmark.md +14 -0
  5. package/.agents/rules/persona-gstack-browse.md +14 -0
  6. package/.agents/rules/persona-gstack-canary.md +14 -0
  7. package/.agents/rules/persona-gstack-careful.md +14 -0
  8. package/.agents/rules/persona-gstack-codex.md +14 -0
  9. package/.agents/rules/persona-gstack-cso.md +14 -0
  10. package/.agents/rules/persona-gstack-design-consultation.md +14 -0
  11. package/.agents/rules/persona-gstack-design-review.md +14 -0
  12. package/.agents/rules/persona-gstack-document-release.md +14 -0
  13. package/.agents/rules/persona-gstack-freeze.md +14 -0
  14. package/.agents/rules/persona-gstack-gstack-upgrade.md +14 -0
  15. package/.agents/rules/persona-gstack-guard.md +14 -0
  16. package/.agents/rules/persona-gstack-investigate.md +14 -0
  17. package/.agents/rules/persona-gstack-land-and-deploy.md +14 -0
  18. package/.agents/rules/persona-gstack-office-hours.md +14 -0
  19. package/.agents/rules/persona-gstack-plan-ceo-review.md +14 -0
  20. package/.agents/rules/persona-gstack-plan-design-review.md +14 -0
  21. package/.agents/rules/persona-gstack-plan-eng-review.md +14 -0
  22. package/.agents/rules/persona-gstack-qa-only.md +14 -0
  23. package/.agents/rules/persona-gstack-qa.md +14 -0
  24. package/.agents/rules/persona-gstack-retro.md +14 -0
  25. package/.agents/rules/persona-gstack-review.md +14 -0
  26. package/.agents/rules/persona-gstack-setup-browser-cookies.md +14 -0
  27. package/.agents/rules/persona-gstack-setup-deploy.md +14 -0
  28. package/.agents/rules/persona-gstack-ship.md +14 -0
  29. package/.agents/rules/persona-gstack-unfreeze.md +14 -0
  30. package/.agents/rules/persona-gstack.md +40 -0
  31. package/.agents/rules/recursive-identities.md +22 -0
  32. package/.agents/workflows/autoplan.md +30 -0
  33. package/.agents/workflows/benchmark.md +31 -0
  34. package/.agents/workflows/browse.md +26 -0
  35. package/.agents/workflows/canary.md +33 -0
  36. package/.agents/workflows/careful.md +22 -0
  37. package/.agents/workflows/codex.md +36 -0
  38. package/.agents/workflows/cso.md +29 -0
  39. package/.agents/workflows/design-consultation.md +28 -0
  40. package/.agents/workflows/design-review.md +28 -0
  41. package/.agents/workflows/document-release.md +32 -0
  42. package/.agents/workflows/freeze.md +17 -0
  43. package/.agents/workflows/gstack-upgrade.md +54 -0
  44. package/.agents/workflows/gstack.md +56 -0
  45. package/.agents/workflows/guard.md +18 -0
  46. package/.agents/workflows/investigate.md +37 -0
  47. package/.agents/workflows/land-and-deploy.md +35 -0
  48. package/.agents/workflows/office-hours.md +27 -0
  49. package/.agents/workflows/plan-ceo-review.md +34 -0
  50. package/.agents/workflows/plan-design-review.md +31 -0
  51. package/.agents/workflows/plan-eng-review.md +28 -0
  52. package/.agents/workflows/qa-only.md +28 -0
  53. package/.agents/workflows/qa.md +73 -0
  54. package/.agents/workflows/retro.md +34 -0
  55. package/.agents/workflows/review.md +30 -0
  56. package/.agents/workflows/setup-browser-cookies.md +15 -0
  57. package/.agents/workflows/setup-cookies.md +8 -0
  58. package/.agents/workflows/setup-deploy.md +21 -0
  59. package/.agents/workflows/ship.md +93 -0
  60. package/.agents/workflows/unfreeze.md +12 -0
  61. package/LICENSE +22 -0
  62. package/README.md +189 -0
  63. package/README_KO.md +191 -0
  64. package/bin/install.js +105 -0
  65. package/gstack-origin/.agents/skills/gstack/SKILL.md +651 -0
  66. package/gstack-origin/.agents/skills/gstack-autoplan/SKILL.md +678 -0
  67. package/gstack-origin/.agents/skills/gstack-benchmark/SKILL.md +482 -0
  68. package/gstack-origin/.agents/skills/gstack-browse/SKILL.md +511 -0
  69. package/gstack-origin/.agents/skills/gstack-canary/SKILL.md +486 -0
  70. package/gstack-origin/.agents/skills/gstack-careful/SKILL.md +50 -0
  71. package/gstack-origin/.agents/skills/gstack-cso/SKILL.md +607 -0
  72. package/gstack-origin/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
  73. package/gstack-origin/.agents/skills/gstack-design-review/SKILL.md +988 -0
  74. package/gstack-origin/.agents/skills/gstack-document-release/SKILL.md +604 -0
  75. package/gstack-origin/.agents/skills/gstack-freeze/SKILL.md +67 -0
  76. package/gstack-origin/.agents/skills/gstack-guard/SKILL.md +62 -0
  77. package/gstack-origin/.agents/skills/gstack-investigate/SKILL.md +415 -0
  78. package/gstack-origin/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
  79. package/gstack-origin/.agents/skills/gstack-office-hours/SKILL.md +986 -0
  80. package/gstack-origin/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
  81. package/gstack-origin/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
  82. package/gstack-origin/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
  83. package/gstack-origin/.agents/skills/gstack-qa/SKILL.md +1006 -0
  84. package/gstack-origin/.agents/skills/gstack-qa-only/SKILL.md +626 -0
  85. package/gstack-origin/.agents/skills/gstack-retro/SKILL.md +1065 -0
  86. package/gstack-origin/.agents/skills/gstack-review/SKILL.md +704 -0
  87. package/gstack-origin/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
  88. package/gstack-origin/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
  89. package/gstack-origin/.agents/skills/gstack-ship/SKILL.md +1312 -0
  90. package/gstack-origin/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
  91. package/gstack-origin/.agents/skills/gstack-upgrade/SKILL.md +220 -0
  92. package/gstack-origin/.env.example +5 -0
  93. package/gstack-origin/.github/workflows/skill-docs.yml +17 -0
  94. package/gstack-origin/AGENTS.md +49 -0
  95. package/gstack-origin/ARCHITECTURE.md +359 -0
  96. package/gstack-origin/BROWSER.md +271 -0
  97. package/gstack-origin/CHANGELOG.md +800 -0
  98. package/gstack-origin/CLAUDE.md +284 -0
  99. package/gstack-origin/CONTRIBUTING.md +370 -0
  100. package/gstack-origin/ETHOS.md +129 -0
  101. package/gstack-origin/LICENSE +21 -0
  102. package/gstack-origin/README.md +228 -0
  103. package/gstack-origin/SKILL.md +657 -0
  104. package/gstack-origin/SKILL.md.tmpl +281 -0
  105. package/gstack-origin/TODOS.md +564 -0
  106. package/gstack-origin/VERSION +1 -0
  107. package/gstack-origin/autoplan/SKILL.md +689 -0
  108. package/gstack-origin/autoplan/SKILL.md.tmpl +416 -0
  109. package/gstack-origin/benchmark/SKILL.md +489 -0
  110. package/gstack-origin/benchmark/SKILL.md.tmpl +233 -0
  111. package/gstack-origin/bin/dev-setup +68 -0
  112. package/gstack-origin/bin/dev-teardown +56 -0
  113. package/gstack-origin/bin/gstack-analytics +191 -0
  114. package/gstack-origin/bin/gstack-community-dashboard +113 -0
  115. package/gstack-origin/bin/gstack-config +38 -0
  116. package/gstack-origin/bin/gstack-diff-scope +71 -0
  117. package/gstack-origin/bin/gstack-global-discover.ts +591 -0
  118. package/gstack-origin/bin/gstack-repo-mode +93 -0
  119. package/gstack-origin/bin/gstack-review-log +9 -0
  120. package/gstack-origin/bin/gstack-review-read +12 -0
  121. package/gstack-origin/bin/gstack-slug +15 -0
  122. package/gstack-origin/bin/gstack-telemetry-log +158 -0
  123. package/gstack-origin/bin/gstack-telemetry-sync +127 -0
  124. package/gstack-origin/bin/gstack-update-check +196 -0
  125. package/gstack-origin/browse/SKILL.md +517 -0
  126. package/gstack-origin/browse/SKILL.md.tmpl +141 -0
  127. package/gstack-origin/browse/bin/find-browse +21 -0
  128. package/gstack-origin/browse/bin/remote-slug +14 -0
  129. package/gstack-origin/browse/scripts/build-node-server.sh +48 -0
  130. package/gstack-origin/browse/src/browser-manager.ts +634 -0
  131. package/gstack-origin/browse/src/buffers.ts +137 -0
  132. package/gstack-origin/browse/src/bun-polyfill.cjs +109 -0
  133. package/gstack-origin/browse/src/cli.ts +420 -0
  134. package/gstack-origin/browse/src/commands.ts +111 -0
  135. package/gstack-origin/browse/src/config.ts +150 -0
  136. package/gstack-origin/browse/src/cookie-import-browser.ts +417 -0
  137. package/gstack-origin/browse/src/cookie-picker-routes.ts +207 -0
  138. package/gstack-origin/browse/src/cookie-picker-ui.ts +541 -0
  139. package/gstack-origin/browse/src/find-browse.ts +61 -0
  140. package/gstack-origin/browse/src/meta-commands.ts +269 -0
  141. package/gstack-origin/browse/src/platform.ts +17 -0
  142. package/gstack-origin/browse/src/read-commands.ts +335 -0
  143. package/gstack-origin/browse/src/server.ts +369 -0
  144. package/gstack-origin/browse/src/snapshot.ts +398 -0
  145. package/gstack-origin/browse/src/url-validation.ts +91 -0
  146. package/gstack-origin/browse/src/write-commands.ts +352 -0
  147. package/gstack-origin/browse/test/bun-polyfill.test.ts +72 -0
  148. package/gstack-origin/browse/test/commands.test.ts +1836 -0
  149. package/gstack-origin/browse/test/config.test.ts +250 -0
  150. package/gstack-origin/browse/test/cookie-import-browser.test.ts +397 -0
  151. package/gstack-origin/browse/test/cookie-picker-routes.test.ts +205 -0
  152. package/gstack-origin/browse/test/find-browse.test.ts +50 -0
  153. package/gstack-origin/browse/test/fixtures/basic.html +33 -0
  154. package/gstack-origin/browse/test/fixtures/cursor-interactive.html +22 -0
  155. package/gstack-origin/browse/test/fixtures/dialog.html +15 -0
  156. package/gstack-origin/browse/test/fixtures/empty.html +2 -0
  157. package/gstack-origin/browse/test/fixtures/forms.html +55 -0
  158. package/gstack-origin/browse/test/fixtures/qa-eval-checkout.html +108 -0
  159. package/gstack-origin/browse/test/fixtures/qa-eval-spa.html +98 -0
  160. package/gstack-origin/browse/test/fixtures/qa-eval.html +51 -0
  161. package/gstack-origin/browse/test/fixtures/responsive.html +49 -0
  162. package/gstack-origin/browse/test/fixtures/snapshot.html +55 -0
  163. package/gstack-origin/browse/test/fixtures/spa.html +24 -0
  164. package/gstack-origin/browse/test/fixtures/states.html +17 -0
  165. package/gstack-origin/browse/test/fixtures/upload.html +25 -0
  166. package/gstack-origin/browse/test/gstack-config.test.ts +125 -0
  167. package/gstack-origin/browse/test/gstack-update-check.test.ts +467 -0
  168. package/gstack-origin/browse/test/handoff.test.ts +235 -0
  169. package/gstack-origin/browse/test/path-validation.test.ts +63 -0
  170. package/gstack-origin/browse/test/platform.test.ts +37 -0
  171. package/gstack-origin/browse/test/snapshot.test.ts +467 -0
  172. package/gstack-origin/browse/test/test-server.ts +57 -0
  173. package/gstack-origin/browse/test/url-validation.test.ts +72 -0
  174. package/gstack-origin/canary/SKILL.md +493 -0
  175. package/gstack-origin/canary/SKILL.md.tmpl +220 -0
  176. package/gstack-origin/careful/SKILL.md +59 -0
  177. package/gstack-origin/careful/SKILL.md.tmpl +57 -0
  178. package/gstack-origin/careful/bin/check-careful.sh +112 -0
  179. package/gstack-origin/codex/SKILL.md +677 -0
  180. package/gstack-origin/codex/SKILL.md.tmpl +356 -0
  181. package/gstack-origin/conductor.json +6 -0
  182. package/gstack-origin/cso/SKILL.md +615 -0
  183. package/gstack-origin/cso/SKILL.md.tmpl +376 -0
  184. package/gstack-origin/design-consultation/SKILL.md +625 -0
  185. package/gstack-origin/design-consultation/SKILL.md.tmpl +369 -0
  186. package/gstack-origin/design-review/SKILL.md +998 -0
  187. package/gstack-origin/design-review/SKILL.md.tmpl +262 -0
  188. package/gstack-origin/docs/images/github-2013.png +0 -0
  189. package/gstack-origin/docs/images/github-2026.png +0 -0
  190. package/gstack-origin/docs/skills.md +877 -0
  191. package/gstack-origin/document-release/SKILL.md +613 -0
  192. package/gstack-origin/document-release/SKILL.md.tmpl +357 -0
  193. package/gstack-origin/freeze/SKILL.md +82 -0
  194. package/gstack-origin/freeze/SKILL.md.tmpl +80 -0
  195. package/gstack-origin/freeze/bin/check-freeze.sh +68 -0
  196. package/gstack-origin/gstack-upgrade/SKILL.md +226 -0
  197. package/gstack-origin/gstack-upgrade/SKILL.md.tmpl +224 -0
  198. package/gstack-origin/guard/SKILL.md +82 -0
  199. package/gstack-origin/guard/SKILL.md.tmpl +80 -0
  200. package/gstack-origin/investigate/SKILL.md +435 -0
  201. package/gstack-origin/investigate/SKILL.md.tmpl +196 -0
  202. package/gstack-origin/land-and-deploy/SKILL.md +880 -0
  203. package/gstack-origin/land-and-deploy/SKILL.md.tmpl +575 -0
  204. package/gstack-origin/office-hours/SKILL.md +996 -0
  205. package/gstack-origin/office-hours/SKILL.md.tmpl +624 -0
  206. package/gstack-origin/package.json +55 -0
  207. package/gstack-origin/plan-ceo-review/SKILL.md +1277 -0
  208. package/gstack-origin/plan-ceo-review/SKILL.md.tmpl +838 -0
  209. package/gstack-origin/plan-design-review/SKILL.md +676 -0
  210. package/gstack-origin/plan-design-review/SKILL.md.tmpl +314 -0
  211. package/gstack-origin/plan-eng-review/SKILL.md +836 -0
  212. package/gstack-origin/plan-eng-review/SKILL.md.tmpl +279 -0
  213. package/gstack-origin/qa/SKILL.md +1016 -0
  214. package/gstack-origin/qa/SKILL.md.tmpl +316 -0
  215. package/gstack-origin/qa/references/issue-taxonomy.md +85 -0
  216. package/gstack-origin/qa/templates/qa-report-template.md +126 -0
  217. package/gstack-origin/qa-only/SKILL.md +633 -0
  218. package/gstack-origin/qa-only/SKILL.md.tmpl +101 -0
  219. package/gstack-origin/retro/SKILL.md +1072 -0
  220. package/gstack-origin/retro/SKILL.md.tmpl +833 -0
  221. package/gstack-origin/review/SKILL.md +849 -0
  222. package/gstack-origin/review/SKILL.md.tmpl +259 -0
  223. package/gstack-origin/review/TODOS-format.md +62 -0
  224. package/gstack-origin/review/checklist.md +190 -0
  225. package/gstack-origin/review/design-checklist.md +132 -0
  226. package/gstack-origin/review/greptile-triage.md +220 -0
  227. package/gstack-origin/scripts/analytics.ts +190 -0
  228. package/gstack-origin/scripts/dev-skill.ts +82 -0
  229. package/gstack-origin/scripts/eval-compare.ts +96 -0
  230. package/gstack-origin/scripts/eval-list.ts +116 -0
  231. package/gstack-origin/scripts/eval-select.ts +86 -0
  232. package/gstack-origin/scripts/eval-summary.ts +187 -0
  233. package/gstack-origin/scripts/eval-watch.ts +172 -0
  234. package/gstack-origin/scripts/gen-skill-docs.ts +2414 -0
  235. package/gstack-origin/scripts/skill-check.ts +167 -0
  236. package/gstack-origin/setup +269 -0
  237. package/gstack-origin/setup-browser-cookies/SKILL.md +330 -0
  238. package/gstack-origin/setup-browser-cookies/SKILL.md.tmpl +74 -0
  239. package/gstack-origin/setup-deploy/SKILL.md +459 -0
  240. package/gstack-origin/setup-deploy/SKILL.md.tmpl +220 -0
  241. package/gstack-origin/ship/SKILL.md +1457 -0
  242. package/gstack-origin/ship/SKILL.md.tmpl +528 -0
  243. package/gstack-origin/supabase/config.sh +10 -0
  244. package/gstack-origin/supabase/functions/community-pulse/index.ts +59 -0
  245. package/gstack-origin/supabase/functions/telemetry-ingest/index.ts +135 -0
  246. package/gstack-origin/supabase/functions/update-check/index.ts +37 -0
  247. package/gstack-origin/supabase/migrations/001_telemetry.sql +89 -0
  248. package/gstack-origin/test/analytics.test.ts +277 -0
  249. package/gstack-origin/test/codex-e2e.test.ts +197 -0
  250. package/gstack-origin/test/fixtures/coverage-audit-fixture.ts +76 -0
  251. package/gstack-origin/test/fixtures/eval-baselines.json +7 -0
  252. package/gstack-origin/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
  253. package/gstack-origin/test/fixtures/qa-eval-ground-truth.json +43 -0
  254. package/gstack-origin/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
  255. package/gstack-origin/test/fixtures/review-eval-design-slop.css +86 -0
  256. package/gstack-origin/test/fixtures/review-eval-design-slop.html +41 -0
  257. package/gstack-origin/test/fixtures/review-eval-enum-diff.rb +30 -0
  258. package/gstack-origin/test/fixtures/review-eval-enum.rb +27 -0
  259. package/gstack-origin/test/fixtures/review-eval-vuln.rb +14 -0
  260. package/gstack-origin/test/gemini-e2e.test.ts +173 -0
  261. package/gstack-origin/test/gen-skill-docs.test.ts +1049 -0
  262. package/gstack-origin/test/global-discover.test.ts +187 -0
  263. package/gstack-origin/test/helpers/codex-session-runner.ts +282 -0
  264. package/gstack-origin/test/helpers/e2e-helpers.ts +239 -0
  265. package/gstack-origin/test/helpers/eval-store.test.ts +548 -0
  266. package/gstack-origin/test/helpers/eval-store.ts +689 -0
  267. package/gstack-origin/test/helpers/gemini-session-runner.test.ts +104 -0
  268. package/gstack-origin/test/helpers/gemini-session-runner.ts +201 -0
  269. package/gstack-origin/test/helpers/llm-judge.ts +130 -0
  270. package/gstack-origin/test/helpers/observability.test.ts +283 -0
  271. package/gstack-origin/test/helpers/session-runner.test.ts +96 -0
  272. package/gstack-origin/test/helpers/session-runner.ts +357 -0
  273. package/gstack-origin/test/helpers/skill-parser.ts +206 -0
  274. package/gstack-origin/test/helpers/touchfiles.ts +260 -0
  275. package/gstack-origin/test/hook-scripts.test.ts +373 -0
  276. package/gstack-origin/test/skill-e2e-browse.test.ts +293 -0
  277. package/gstack-origin/test/skill-e2e-deploy.test.ts +279 -0
  278. package/gstack-origin/test/skill-e2e-design.test.ts +614 -0
  279. package/gstack-origin/test/skill-e2e-plan.test.ts +538 -0
  280. package/gstack-origin/test/skill-e2e-qa-bugs.test.ts +194 -0
  281. package/gstack-origin/test/skill-e2e-qa-workflow.test.ts +412 -0
  282. package/gstack-origin/test/skill-e2e-review.test.ts +535 -0
  283. package/gstack-origin/test/skill-e2e-workflow.test.ts +586 -0
  284. package/gstack-origin/test/skill-e2e.test.ts +3325 -0
  285. package/gstack-origin/test/skill-llm-eval.test.ts +787 -0
  286. package/gstack-origin/test/skill-parser.test.ts +179 -0
  287. package/gstack-origin/test/skill-routing-e2e.test.ts +605 -0
  288. package/gstack-origin/test/skill-validation.test.ts +1520 -0
  289. package/gstack-origin/test/telemetry.test.ts +278 -0
  290. package/gstack-origin/test/touchfiles.test.ts +262 -0
  291. package/gstack-origin/unfreeze/SKILL.md +40 -0
  292. package/gstack-origin/unfreeze/SKILL.md.tmpl +38 -0
  293. package/package.json +38 -0
  294. package/scripts/install-antigravity-skill.ps1 +33 -0
  295. package/scripts/install-antigravity-skill.sh +41 -0
  296. package/scripts/sync-gstack-origin.ps1 +37 -0
  297. package/scripts/sync-gstack-origin.sh +35 -0
@@ -0,0 +1,194 @@
1
+ import { describe, test, expect, beforeAll, afterAll } from 'bun:test';
2
+ import { runSkillTest } from './helpers/session-runner';
3
+ import { outcomeJudge } from './helpers/llm-judge';
4
+ import { judgePassed } from './helpers/eval-store';
5
+ import {
6
+ ROOT, browseBin, runId, evalsEnabled, selectedTests, hasApiKey,
7
+ describeIfSelected, describeE2E,
8
+ copyDirSync, setupBrowseShims, logCost, recordE2E, dumpOutcomeDiagnostic,
9
+ createEvalCollector, finalizeEvalCollector,
10
+ } from './helpers/e2e-helpers';
11
+ import { startTestServer } from '../browse/test/test-server';
12
+ import { spawnSync } from 'child_process';
13
+ import * as fs from 'fs';
14
+ import * as path from 'path';
15
+ import * as os from 'os';
16
+
17
+ const evalCollector = createEvalCollector('e2e-qa-bugs');
18
+
19
+ // --- B6/B7/B8: Planted-bug outcome evals ---
20
+
21
+ // Outcome evals also need ANTHROPIC_API_KEY for the LLM judge
22
+ const describeOutcome = (evalsEnabled && hasApiKey) ? describe : describe.skip;
23
+
24
+ // Wrap describeOutcome with selection — skip if no planted-bug tests are selected
25
+ const outcomeTestNames = ['qa-b6-static', 'qa-b7-spa', 'qa-b8-checkout'];
26
+ const anyOutcomeSelected = selectedTests === null || outcomeTestNames.some(t => selectedTests!.includes(t));
27
+
28
+ let testServer: ReturnType<typeof startTestServer>;
29
+
30
+ (anyOutcomeSelected ? describeOutcome : describe.skip)('Planted-bug outcome evals', () => {
31
+ let outcomeDir: string;
32
+
33
+ beforeAll(() => {
34
+ testServer = startTestServer();
35
+ outcomeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-outcome-'));
36
+ setupBrowseShims(outcomeDir);
37
+
38
+ // Copy qa skill files
39
+ copyDirSync(path.join(ROOT, 'qa'), path.join(outcomeDir, 'qa'));
40
+ });
41
+
42
+ afterAll(() => {
43
+ testServer?.server?.stop();
44
+ try { fs.rmSync(outcomeDir, { recursive: true, force: true }); } catch {}
45
+ });
46
+
47
+ /**
48
+ * Shared planted-bug eval runner.
49
+ * Gives the agent concise bug-finding instructions (not the full QA workflow),
50
+ * then scores the report with an LLM outcome judge.
51
+ */
52
+ async function runPlantedBugEval(fixture: string, groundTruthFile: string, label: string) {
53
+ // Each test gets its own isolated working directory to prevent cross-contamination
54
+ // (agents reading previous tests' reports and hallucinating those bugs)
55
+ const testWorkDir = fs.mkdtempSync(path.join(os.tmpdir(), `skill-e2e-${label}-`));
56
+ setupBrowseShims(testWorkDir);
57
+ const reportDir = path.join(testWorkDir, 'reports');
58
+ fs.mkdirSync(path.join(reportDir, 'screenshots'), { recursive: true });
59
+ const reportPath = path.join(reportDir, 'qa-report.md');
60
+
61
+ // Direct bug-finding with browse. Keep prompt concise — no reading long SKILL.md docs.
62
+ // "Write early, update later" pattern ensures report exists even if agent hits max turns.
63
+ const targetUrl = `${testServer.url}/${fixture}`;
64
+ const result = await runSkillTest({
65
+ prompt: `Find bugs on this page: ${targetUrl}
66
+
67
+ Browser binary: B="${browseBin}"
68
+
69
+ PHASE 1 — Quick scan (5 commands max):
70
+ $B goto ${targetUrl}
71
+ $B console --errors
72
+ $B snapshot -i
73
+ $B snapshot -c
74
+ $B accessibility
75
+
76
+ PHASE 2 — Write initial report to ${reportPath}:
77
+ Write every bug you found so far. Format each as:
78
+ - Category: functional / visual / accessibility / console
79
+ - Severity: high / medium / low
80
+ - Evidence: what you observed
81
+
82
+ PHASE 3 — Interactive testing (targeted — max 15 commands):
83
+ - Test email: type "user@" (no domain) and blur — does it validate?
84
+ - Test quantity: clear the field entirely — check the total display
85
+ - Test credit card: type a 25-character string — check for overflow
86
+ - Submit the form with zip code empty — does it require zip?
87
+ - Submit a valid form and run $B console --errors
88
+ - After finding more bugs, UPDATE ${reportPath} with new findings
89
+
90
+ PHASE 4 — Finalize report:
91
+ - UPDATE ${reportPath} with ALL bugs found across all phases
92
+ - Include console errors, form validation issues, visual overflow, missing attributes
93
+
94
+ CRITICAL RULES:
95
+ - ONLY test the page at ${targetUrl} — do not navigate to other sites
96
+ - Write the report file in PHASE 2 before doing interactive testing
97
+ - The report MUST exist at ${reportPath} when you finish`,
98
+ workingDirectory: testWorkDir,
99
+ maxTurns: 50,
100
+ timeout: 300_000,
101
+ testName: `qa-${label}`,
102
+ runId,
103
+ model: 'claude-opus-4-6',
104
+ });
105
+
106
+ logCost(`/qa ${label}`, result);
107
+
108
+ // Phase 1: browse mechanics. Accept error_max_turns — agent may have written
109
+ // a partial report before running out of turns. What matters is detection rate.
110
+ if (result.browseErrors.length > 0) {
111
+ console.warn(`${label} browse errors:`, result.browseErrors);
112
+ }
113
+ if (result.exitReason !== 'success' && result.exitReason !== 'error_max_turns') {
114
+ throw new Error(`${label}: unexpected exit reason: ${result.exitReason}`);
115
+ }
116
+
117
+ // Phase 2: Outcome evaluation via LLM judge
118
+ const groundTruth = JSON.parse(
119
+ fs.readFileSync(path.join(ROOT, 'test', 'fixtures', groundTruthFile), 'utf-8'),
120
+ );
121
+
122
+ // Read the generated report (try expected path, then glob for any .md in reportDir or workDir)
123
+ let report: string | null = null;
124
+ if (fs.existsSync(reportPath)) {
125
+ report = fs.readFileSync(reportPath, 'utf-8');
126
+ } else {
127
+ // Agent may have named it differently — find any .md in reportDir or testWorkDir
128
+ for (const searchDir of [reportDir, testWorkDir]) {
129
+ try {
130
+ const mdFiles = fs.readdirSync(searchDir).filter(f => f.endsWith('.md'));
131
+ if (mdFiles.length > 0) {
132
+ report = fs.readFileSync(path.join(searchDir, mdFiles[0]), 'utf-8');
133
+ break;
134
+ }
135
+ } catch { /* dir may not exist if agent hit max_turns early */ }
136
+ }
137
+
138
+ // Also check the agent's final output for inline report content
139
+ if (!report && result.output && result.output.length > 100) {
140
+ report = result.output;
141
+ }
142
+ }
143
+
144
+ if (!report) {
145
+ dumpOutcomeDiagnostic(testWorkDir, label, '(no report file found)', { error: 'missing report' });
146
+ recordE2E(evalCollector, `/qa ${label}`, 'Planted-bug outcome evals', result, { error: 'no report generated' } as any);
147
+ throw new Error(`No report file found in ${reportDir}`);
148
+ }
149
+
150
+ const judgeResult = await outcomeJudge(groundTruth, report);
151
+ console.log(`${label} outcome:`, JSON.stringify(judgeResult, null, 2));
152
+
153
+ // Record to eval collector with outcome judge results
154
+ recordE2E(evalCollector, `/qa ${label}`, 'Planted-bug outcome evals', result, {
155
+ passed: judgePassed(judgeResult, groundTruth),
156
+ detection_rate: judgeResult.detection_rate,
157
+ false_positives: judgeResult.false_positives,
158
+ evidence_quality: judgeResult.evidence_quality,
159
+ detected_bugs: judgeResult.detected,
160
+ missed_bugs: judgeResult.missed,
161
+ } as any);
162
+
163
+ // Diagnostic dump on failure (decision 1C)
164
+ if (judgeResult.detection_rate < groundTruth.minimum_detection || judgeResult.false_positives > groundTruth.max_false_positives) {
165
+ dumpOutcomeDiagnostic(testWorkDir, label, report, judgeResult);
166
+ }
167
+
168
+ // Phase 2 assertions
169
+ expect(judgeResult.detection_rate).toBeGreaterThanOrEqual(groundTruth.minimum_detection);
170
+ expect(judgeResult.false_positives).toBeLessThanOrEqual(groundTruth.max_false_positives);
171
+ expect(judgeResult.evidence_quality).toBeGreaterThanOrEqual(2);
172
+ }
173
+
174
+ // B6: Static dashboard — broken link, disabled submit, overflow, missing alt, console error
175
+ test('/qa finds >= 2 of 5 planted bugs (static)', async () => {
176
+ await runPlantedBugEval('qa-eval.html', 'qa-eval-ground-truth.json', 'b6-static');
177
+ }, 360_000);
178
+
179
+ // B7: SPA — broken route, stale state, async race, missing aria, console warning
180
+ test('/qa finds >= 2 of 5 planted SPA bugs', async () => {
181
+ await runPlantedBugEval('qa-eval-spa.html', 'qa-eval-spa-ground-truth.json', 'b7-spa');
182
+ }, 360_000);
183
+
184
+ // B8: Checkout — email regex, NaN total, CC overflow, missing required, stripe error
185
+ test('/qa finds >= 2 of 5 planted checkout bugs', async () => {
186
+ await runPlantedBugEval('qa-eval-checkout.html', 'qa-eval-checkout-ground-truth.json', 'b8-checkout');
187
+ }, 360_000);
188
+
189
+ });
190
+
191
+ // Module-level afterAll — finalize eval collector after all tests complete
192
+ afterAll(async () => {
193
+ await finalizeEvalCollector(evalCollector);
194
+ });
@@ -0,0 +1,412 @@
1
+ import { describe, test, expect, beforeAll, afterAll } from 'bun:test';
2
+ import { runSkillTest } from './helpers/session-runner';
3
+ import {
4
+ ROOT, browseBin, runId, evalsEnabled,
5
+ describeIfSelected, testConcurrentIfSelected,
6
+ copyDirSync, setupBrowseShims, logCost, recordE2E,
7
+ createEvalCollector, finalizeEvalCollector,
8
+ } from './helpers/e2e-helpers';
9
+ import { startTestServer } from '../browse/test/test-server';
10
+ import { spawnSync } from 'child_process';
11
+ import * as fs from 'fs';
12
+ import * as path from 'path';
13
+ import * as os from 'os';
14
+
15
+ const evalCollector = createEvalCollector('e2e-qa-workflow');
16
+
17
+ // --- B4: QA skill E2E ---
18
+
19
+ describeIfSelected('QA skill E2E', ['qa-quick'], () => {
20
+ let qaDir: string;
21
+ let testServer: ReturnType<typeof startTestServer>;
22
+
23
+ beforeAll(() => {
24
+ testServer = startTestServer();
25
+ qaDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-qa-'));
26
+ setupBrowseShims(qaDir);
27
+
28
+ // Copy qa skill files into tmpDir
29
+ copyDirSync(path.join(ROOT, 'qa'), path.join(qaDir, 'qa'));
30
+
31
+ // Create report directory
32
+ fs.mkdirSync(path.join(qaDir, 'qa-reports'), { recursive: true });
33
+ });
34
+
35
+ afterAll(() => {
36
+ testServer?.server?.stop();
37
+ try { fs.rmSync(qaDir, { recursive: true, force: true }); } catch {}
38
+ });
39
+
40
+ test('/qa quick completes without browse errors', async () => {
41
+ const result = await runSkillTest({
42
+ prompt: `B="${browseBin}"
43
+
44
+ The test server is already running at: ${testServer.url}
45
+ Target page: ${testServer.url}/basic.html
46
+
47
+ Read the file qa/SKILL.md for the QA workflow instructions.
48
+ Skip the preamble bash block, lake intro, telemetry, and contributor mode sections — go straight to the QA workflow.
49
+
50
+ Run a Quick-depth QA test on ${testServer.url}/basic.html
51
+ Do NOT use AskUserQuestion — run Quick tier directly.
52
+ Do NOT try to start a server or discover ports — the URL above is ready.
53
+ Write your report to ${qaDir}/qa-reports/qa-report.md`,
54
+ workingDirectory: qaDir,
55
+ maxTurns: 35,
56
+ timeout: 240_000,
57
+ testName: 'qa-quick',
58
+ runId,
59
+ });
60
+
61
+ logCost('/qa quick', result);
62
+ recordE2E(evalCollector, '/qa quick', 'QA skill E2E', result, {
63
+ passed: ['success', 'error_max_turns'].includes(result.exitReason),
64
+ });
65
+ // browseErrors can include false positives from hallucinated paths
66
+ if (result.browseErrors.length > 0) {
67
+ console.warn('/qa quick browse errors (non-fatal):', result.browseErrors);
68
+ }
69
+ // Accept error_max_turns — the agent doing thorough QA work is not a failure
70
+ expect(['success', 'error_max_turns']).toContain(result.exitReason);
71
+ }, 300_000);
72
+ });
73
+
74
+ // --- QA-Only E2E (report-only, no fixes) ---
75
+
76
+ describeIfSelected('QA-Only skill E2E', ['qa-only-no-fix'], () => {
77
+ let qaOnlyDir: string;
78
+ let testServer: ReturnType<typeof startTestServer>;
79
+
80
+ beforeAll(() => {
81
+ testServer = startTestServer();
82
+ qaOnlyDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-qa-only-'));
83
+ setupBrowseShims(qaOnlyDir);
84
+
85
+ // Copy qa-only skill files
86
+ copyDirSync(path.join(ROOT, 'qa-only'), path.join(qaOnlyDir, 'qa-only'));
87
+
88
+ // Copy qa templates (qa-only references qa/templates/qa-report-template.md)
89
+ fs.mkdirSync(path.join(qaOnlyDir, 'qa', 'templates'), { recursive: true });
90
+ fs.copyFileSync(
91
+ path.join(ROOT, 'qa', 'templates', 'qa-report-template.md'),
92
+ path.join(qaOnlyDir, 'qa', 'templates', 'qa-report-template.md'),
93
+ );
94
+
95
+ // Init git repo (qa-only checks for feature branch in diff-aware mode)
96
+ const run = (cmd: string, args: string[]) =>
97
+ spawnSync(cmd, args, { cwd: qaOnlyDir, stdio: 'pipe', timeout: 5000 });
98
+
99
+ run('git', ['init', '-b', 'main']);
100
+ run('git', ['config', 'user.email', 'test@test.com']);
101
+ run('git', ['config', 'user.name', 'Test']);
102
+ fs.writeFileSync(path.join(qaOnlyDir, 'index.html'), '<h1>Test</h1>\n');
103
+ run('git', ['add', '.']);
104
+ run('git', ['commit', '-m', 'initial']);
105
+ });
106
+
107
+ afterAll(() => {
108
+ try { fs.rmSync(qaOnlyDir, { recursive: true, force: true }); } catch {}
109
+ });
110
+
111
+ test('/qa-only produces report without using Edit tool', async () => {
112
+ const result = await runSkillTest({
113
+ prompt: `IMPORTANT: The browse binary is already assigned below as B. Do NOT search for it or run the SKILL.md setup block — just use $B directly.
114
+
115
+ B="${browseBin}"
116
+
117
+ Read the file qa-only/SKILL.md for the QA-only workflow instructions.
118
+ Skip the preamble bash block, lake intro, telemetry, and contributor mode sections — go straight to the QA workflow.
119
+
120
+ Run a Quick QA test on ${testServer.url}/qa-eval.html
121
+ Do NOT use AskUserQuestion — run Quick tier directly.
122
+ Write your report to ${qaOnlyDir}/qa-reports/qa-only-report.md`,
123
+ workingDirectory: qaOnlyDir,
124
+ maxTurns: 40,
125
+ allowedTools: ['Bash', 'Read', 'Write', 'Glob'], // NO Edit — the critical guardrail
126
+ timeout: 180_000,
127
+ testName: 'qa-only-no-fix',
128
+ runId,
129
+ });
130
+
131
+ logCost('/qa-only', result);
132
+
133
+ // Verify Edit was not used — the critical guardrail for report-only mode.
134
+ // Glob is read-only and may be used for file discovery (e.g. finding SKILL.md).
135
+ const editCalls = result.toolCalls.filter(tc => tc.tool === 'Edit');
136
+ if (editCalls.length > 0) {
137
+ console.warn('qa-only used Edit tool:', editCalls.length, 'times');
138
+ }
139
+
140
+ const exitOk = ['success', 'error_max_turns'].includes(result.exitReason);
141
+ recordE2E(evalCollector, '/qa-only no-fix', 'QA-Only skill E2E', result, {
142
+ passed: exitOk && editCalls.length === 0,
143
+ });
144
+
145
+ expect(editCalls).toHaveLength(0);
146
+
147
+ // Accept error_max_turns — the agent doing thorough QA is not a failure
148
+ expect(['success', 'error_max_turns']).toContain(result.exitReason);
149
+
150
+ // Verify git working tree is still clean (no source modifications)
151
+ const gitStatus = spawnSync('git', ['status', '--porcelain'], {
152
+ cwd: qaOnlyDir, stdio: 'pipe',
153
+ });
154
+ const statusLines = gitStatus.stdout.toString().trim().split('\n').filter(
155
+ (l: string) => l.trim() && !l.includes('.prompt-tmp') && !l.includes('.gstack/') && !l.includes('qa-reports/'),
156
+ );
157
+ expect(statusLines.filter((l: string) => l.startsWith(' M') || l.startsWith('M '))).toHaveLength(0);
158
+ }, 240_000);
159
+ });
160
+
161
+ // --- QA Fix Loop E2E ---
162
+
163
+ describeIfSelected('QA Fix Loop E2E', ['qa-fix-loop'], () => {
164
+ let qaFixDir: string;
165
+ let qaFixServer: ReturnType<typeof Bun.serve> | null = null;
166
+
167
+ beforeAll(() => {
168
+ qaFixDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-qa-fix-'));
169
+ setupBrowseShims(qaFixDir);
170
+
171
+ // Copy qa skill files
172
+ copyDirSync(path.join(ROOT, 'qa'), path.join(qaFixDir, 'qa'));
173
+
174
+ // Create a simple HTML page with obvious fixable bugs
175
+ fs.writeFileSync(path.join(qaFixDir, 'index.html'), `<!DOCTYPE html>
176
+ <html lang="en">
177
+ <head><meta charset="utf-8"><title>Test App</title></head>
178
+ <body>
179
+ <h1>Welcome to Test App</h1>
180
+ <nav>
181
+ <a href="/about">About</a>
182
+ <a href="/nonexistent-broken-page">Help</a> <!-- BUG: broken link -->
183
+ </nav>
184
+ <form id="contact">
185
+ <input type="text" name="name" placeholder="Name">
186
+ <input type="email" name="email" placeholder="Email">
187
+ <button type="submit" disabled>Send</button> <!-- BUG: permanently disabled -->
188
+ </form>
189
+ <img src="/missing-logo.png"> <!-- BUG: missing alt text -->
190
+ <script>console.error("TypeError: Cannot read property 'map' of undefined");</script> <!-- BUG: console error -->
191
+ </body>
192
+ </html>
193
+ `);
194
+
195
+ // Init git repo with clean working tree
196
+ const run = (cmd: string, args: string[]) =>
197
+ spawnSync(cmd, args, { cwd: qaFixDir, stdio: 'pipe', timeout: 5000 });
198
+
199
+ run('git', ['init', '-b', 'main']);
200
+ run('git', ['config', 'user.email', 'test@test.com']);
201
+ run('git', ['config', 'user.name', 'Test']);
202
+ run('git', ['add', '.']);
203
+ run('git', ['commit', '-m', 'initial commit']);
204
+
205
+ // Start a local server serving from the working directory so fixes are reflected on refresh
206
+ qaFixServer = Bun.serve({
207
+ port: 0,
208
+ hostname: '127.0.0.1',
209
+ fetch(req) {
210
+ const url = new URL(req.url);
211
+ let filePath = url.pathname === '/' ? '/index.html' : url.pathname;
212
+ filePath = filePath.replace(/^\//, '');
213
+ const fullPath = path.join(qaFixDir, filePath);
214
+ if (!fs.existsSync(fullPath)) {
215
+ return new Response('Not Found', { status: 404 });
216
+ }
217
+ const content = fs.readFileSync(fullPath, 'utf-8');
218
+ return new Response(content, {
219
+ headers: { 'Content-Type': 'text/html' },
220
+ });
221
+ },
222
+ });
223
+ });
224
+
225
+ afterAll(() => {
226
+ qaFixServer?.stop();
227
+ try { fs.rmSync(qaFixDir, { recursive: true, force: true }); } catch {}
228
+ });
229
+
230
+ test('/qa fix loop finds bugs and commits fixes', async () => {
231
+ const qaFixUrl = `http://127.0.0.1:${qaFixServer!.port}`;
232
+
233
+ const result = await runSkillTest({
234
+ prompt: `You have a browse binary at ${browseBin}. Assign it to B variable like: B="${browseBin}"
235
+
236
+ Read the file qa/SKILL.md for the QA workflow instructions.
237
+ Skip the preamble bash block, lake intro, telemetry, and contributor mode sections — go straight to the QA workflow.
238
+
239
+ Run a Quick-tier QA test on ${qaFixUrl}
240
+ The source code for this page is at ${qaFixDir}/index.html — you can fix bugs there.
241
+ Do NOT use AskUserQuestion — run Quick tier directly.
242
+ Write your report to ${qaFixDir}/qa-reports/qa-report.md
243
+
244
+ This is a test+fix loop: find bugs, fix them in the source code, commit each fix, and re-verify.`,
245
+ workingDirectory: qaFixDir,
246
+ maxTurns: 40,
247
+ allowedTools: ['Bash', 'Read', 'Write', 'Edit', 'Glob', 'Grep'],
248
+ timeout: 420_000,
249
+ testName: 'qa-fix-loop',
250
+ runId,
251
+ });
252
+
253
+ logCost('/qa fix loop', result);
254
+ recordE2E(evalCollector, '/qa fix loop', 'QA Fix Loop E2E', result, {
255
+ passed: ['success', 'error_max_turns'].includes(result.exitReason),
256
+ });
257
+
258
+ // Accept error_max_turns — fix loop may use many turns
259
+ expect(['success', 'error_max_turns']).toContain(result.exitReason);
260
+
261
+ // Verify at least one fix commit was made beyond the initial commit
262
+ const gitLog = spawnSync('git', ['log', '--oneline'], {
263
+ cwd: qaFixDir, stdio: 'pipe',
264
+ });
265
+ const commits = gitLog.stdout.toString().trim().split('\n');
266
+ console.log(`/qa fix loop: ${commits.length} commits total (1 initial + ${commits.length - 1} fixes)`);
267
+ expect(commits.length).toBeGreaterThan(1);
268
+
269
+ // Verify Edit tool was used (agent actually modified source code)
270
+ const editCalls = result.toolCalls.filter(tc => tc.tool === 'Edit');
271
+ expect(editCalls.length).toBeGreaterThan(0);
272
+ }, 480_000);
273
+ });
274
+
275
+ // --- Test Bootstrap E2E ---
276
+
277
+ describeIfSelected('Test Bootstrap E2E', ['qa-bootstrap'], () => {
278
+ let bootstrapDir: string;
279
+ let bootstrapServer: ReturnType<typeof Bun.serve>;
280
+
281
+ beforeAll(() => {
282
+ bootstrapDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-bootstrap-'));
283
+ setupBrowseShims(bootstrapDir);
284
+
285
+ // Copy qa skill files
286
+ copyDirSync(path.join(ROOT, 'qa'), path.join(bootstrapDir, 'qa'));
287
+
288
+ // Create a minimal Node.js project with NO test framework
289
+ fs.writeFileSync(path.join(bootstrapDir, 'package.json'), JSON.stringify({
290
+ name: 'test-bootstrap-app',
291
+ version: '1.0.0',
292
+ type: 'module',
293
+ }, null, 2));
294
+
295
+ // Create a simple app file with a bug
296
+ fs.writeFileSync(path.join(bootstrapDir, 'app.js'), `
297
+ export function add(a, b) { return a + b; }
298
+ export function subtract(a, b) { return a - b; }
299
+ export function divide(a, b) { return a / b; } // BUG: no zero check
300
+ `);
301
+
302
+ // Create a simple HTML page with a bug
303
+ fs.writeFileSync(path.join(bootstrapDir, 'index.html'), `<!DOCTYPE html>
304
+ <html lang="en">
305
+ <head><meta charset="utf-8"><title>Bootstrap Test</title></head>
306
+ <body>
307
+ <h1>Test App</h1>
308
+ <a href="/nonexistent-page">Broken Link</a>
309
+ <script>console.error("ReferenceError: undefinedVar is not defined");</script>
310
+ </body>
311
+ </html>
312
+ `);
313
+
314
+ // Init git repo
315
+ const run = (cmd: string, args: string[]) =>
316
+ spawnSync(cmd, args, { cwd: bootstrapDir, stdio: 'pipe', timeout: 5000 });
317
+ run('git', ['init', '-b', 'main']);
318
+ run('git', ['config', 'user.email', 'test@test.com']);
319
+ run('git', ['config', 'user.name', 'Test']);
320
+ run('git', ['add', '.']);
321
+ run('git', ['commit', '-m', 'initial commit']);
322
+
323
+ // Serve from working directory
324
+ bootstrapServer = Bun.serve({
325
+ port: 0,
326
+ hostname: '127.0.0.1',
327
+ fetch(req) {
328
+ const url = new URL(req.url);
329
+ let filePath = url.pathname === '/' ? '/index.html' : url.pathname;
330
+ filePath = filePath.replace(/^\//, '');
331
+ const fullPath = path.join(bootstrapDir, filePath);
332
+ if (!fs.existsSync(fullPath)) {
333
+ return new Response('Not Found', { status: 404 });
334
+ }
335
+ const content = fs.readFileSync(fullPath, 'utf-8');
336
+ return new Response(content, {
337
+ headers: { 'Content-Type': 'text/html' },
338
+ });
339
+ },
340
+ });
341
+ });
342
+
343
+ afterAll(() => {
344
+ bootstrapServer?.stop();
345
+ try { fs.rmSync(bootstrapDir, { recursive: true, force: true }); } catch {}
346
+ });
347
+
348
+ testConcurrentIfSelected('qa-bootstrap', async () => {
349
+ // Test ONLY the bootstrap phase — install vitest, create config, write one test
350
+ const bsDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-bs-'));
351
+
352
+ // Minimal Node.js project with no test framework
353
+ fs.writeFileSync(path.join(bsDir, 'package.json'), JSON.stringify({
354
+ name: 'bootstrap-test-app', version: '1.0.0', type: 'module',
355
+ }, null, 2));
356
+ fs.writeFileSync(path.join(bsDir, 'app.js'), `
357
+ export function add(a, b) { return a + b; }
358
+ export function subtract(a, b) { return a - b; }
359
+ export function divide(a, b) { return a / b; }
360
+ `);
361
+
362
+ // Init git repo
363
+ const run = (cmd: string, args: string[]) =>
364
+ spawnSync(cmd, args, { cwd: bsDir, stdio: 'pipe', timeout: 5000 });
365
+ run('git', ['init', '-b', 'main']);
366
+ run('git', ['config', 'user.email', 'test@test.com']);
367
+ run('git', ['config', 'user.name', 'Test']);
368
+ run('git', ['add', '.']);
369
+ run('git', ['commit', '-m', 'initial']);
370
+
371
+ const result = await runSkillTest({
372
+ prompt: `This is a Node.js project with no test framework. It has a package.json and app.js with simple functions (add, subtract, divide).
373
+
374
+ Set up a test framework:
375
+ 1. Install vitest: bun add -d vitest
376
+ 2. Create vitest.config.ts with a minimal config
377
+ 3. Write one test file (app.test.js) that tests the add() function
378
+ 4. Run the test to verify it passes
379
+ 5. Create TESTING.md explaining how to run tests
380
+
381
+ Do NOT fix any bugs. Do NOT use AskUserQuestion — just pick vitest.`,
382
+ workingDirectory: bsDir,
383
+ maxTurns: 12,
384
+ allowedTools: ['Bash', 'Read', 'Write', 'Edit', 'Glob'],
385
+ timeout: 90_000,
386
+ testName: 'qa-bootstrap',
387
+ runId,
388
+ });
389
+
390
+ logCost('/qa bootstrap', result);
391
+
392
+ const hasTestConfig = fs.existsSync(path.join(bsDir, 'vitest.config.ts'))
393
+ || fs.existsSync(path.join(bsDir, 'vitest.config.js'));
394
+ const hasTestFile = fs.readdirSync(bsDir).some(f => f.includes('.test.'));
395
+ const hasTestingMd = fs.existsSync(path.join(bsDir, 'TESTING.md'));
396
+
397
+ recordE2E(evalCollector, '/qa bootstrap', 'Test Bootstrap E2E', result, {
398
+ passed: hasTestConfig && ['success', 'error_max_turns'].includes(result.exitReason),
399
+ });
400
+
401
+ expect(['success', 'error_max_turns']).toContain(result.exitReason);
402
+ expect(hasTestConfig).toBe(true);
403
+ console.log(`Test config: ${hasTestConfig}, Test file: ${hasTestFile}, TESTING.md: ${hasTestingMd}`);
404
+
405
+ try { fs.rmSync(bsDir, { recursive: true, force: true }); } catch {}
406
+ }, 120_000);
407
+ });
408
+
409
+ // Module-level afterAll — finalize eval collector after all tests complete
410
+ afterAll(async () => {
411
+ await finalizeEvalCollector(evalCollector);
412
+ });