@runchr/gstack-antigravity 0.1.0 → 0.1.2
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.
- package/.agents/skills/gstack/.agents/skills/gstack/SKILL.md +651 -0
- package/.agents/skills/gstack/.agents/skills/gstack-autoplan/SKILL.md +678 -0
- package/.agents/skills/gstack/.agents/skills/gstack-benchmark/SKILL.md +482 -0
- package/.agents/skills/gstack/.agents/skills/gstack-browse/SKILL.md +511 -0
- package/.agents/skills/gstack/.agents/skills/gstack-canary/SKILL.md +486 -0
- package/.agents/skills/gstack/.agents/skills/gstack-careful/SKILL.md +50 -0
- package/.agents/skills/gstack/.agents/skills/gstack-cso/SKILL.md +607 -0
- package/.agents/skills/gstack/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
- package/.agents/skills/gstack/.agents/skills/gstack-design-review/SKILL.md +988 -0
- package/.agents/skills/gstack/.agents/skills/gstack-document-release/SKILL.md +604 -0
- package/.agents/skills/gstack/.agents/skills/gstack-freeze/SKILL.md +67 -0
- package/.agents/skills/gstack/.agents/skills/gstack-guard/SKILL.md +62 -0
- package/.agents/skills/gstack/.agents/skills/gstack-investigate/SKILL.md +415 -0
- package/.agents/skills/gstack/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
- package/.agents/skills/gstack/.agents/skills/gstack-office-hours/SKILL.md +986 -0
- package/.agents/skills/gstack/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
- package/.agents/skills/gstack/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
- package/.agents/skills/gstack/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
- package/.agents/skills/gstack/.agents/skills/gstack-qa/SKILL.md +1006 -0
- package/.agents/skills/gstack/.agents/skills/gstack-qa-only/SKILL.md +626 -0
- package/.agents/skills/gstack/.agents/skills/gstack-retro/SKILL.md +1065 -0
- package/.agents/skills/gstack/.agents/skills/gstack-review/SKILL.md +704 -0
- package/.agents/skills/gstack/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
- package/.agents/skills/gstack/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
- package/.agents/skills/gstack/.agents/skills/gstack-ship/SKILL.md +1312 -0
- package/.agents/skills/gstack/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
- package/.agents/skills/gstack/.agents/skills/gstack-upgrade/SKILL.md +220 -0
- package/.agents/skills/gstack/.env.example +5 -0
- package/.agents/skills/gstack/.github/workflows/skill-docs.yml +17 -0
- package/.agents/skills/gstack/AGENTS.md +49 -0
- package/.agents/skills/gstack/ARCHITECTURE.md +359 -0
- package/.agents/skills/gstack/BROWSER.md +271 -0
- package/.agents/skills/gstack/CHANGELOG.md +800 -0
- package/.agents/skills/gstack/CLAUDE.md +284 -0
- package/.agents/skills/gstack/CONTRIBUTING.md +370 -0
- package/.agents/skills/gstack/ETHOS.md +129 -0
- package/.agents/skills/gstack/LICENSE +21 -0
- package/.agents/skills/gstack/README.md +228 -0
- package/.agents/skills/gstack/SKILL.md +657 -0
- package/.agents/skills/gstack/SKILL.md.tmpl +281 -0
- package/.agents/skills/gstack/TODOS.md +564 -0
- package/.agents/skills/gstack/VERSION +1 -0
- package/.agents/skills/gstack/autoplan/SKILL.md +689 -0
- package/.agents/skills/gstack/autoplan/SKILL.md.tmpl +416 -0
- package/.agents/skills/gstack/benchmark/SKILL.md +489 -0
- package/.agents/skills/gstack/benchmark/SKILL.md.tmpl +233 -0
- package/.agents/skills/gstack/bin/dev-setup +68 -0
- package/.agents/skills/gstack/bin/dev-teardown +56 -0
- package/.agents/skills/gstack/bin/gstack-analytics +191 -0
- package/.agents/skills/gstack/bin/gstack-community-dashboard +113 -0
- package/.agents/skills/gstack/bin/gstack-config +38 -0
- package/.agents/skills/gstack/bin/gstack-diff-scope +71 -0
- package/.agents/skills/gstack/bin/gstack-global-discover.ts +591 -0
- package/.agents/skills/gstack/bin/gstack-repo-mode +93 -0
- package/.agents/skills/gstack/bin/gstack-review-log +9 -0
- package/.agents/skills/gstack/bin/gstack-review-read +12 -0
- package/.agents/skills/gstack/bin/gstack-slug +15 -0
- package/.agents/skills/gstack/bin/gstack-telemetry-log +158 -0
- package/.agents/skills/gstack/bin/gstack-telemetry-sync +127 -0
- package/.agents/skills/gstack/bin/gstack-update-check +196 -0
- package/.agents/skills/gstack/browse/SKILL.md +517 -0
- package/.agents/skills/gstack/browse/SKILL.md.tmpl +141 -0
- package/.agents/skills/gstack/browse/bin/find-browse +21 -0
- package/.agents/skills/gstack/browse/bin/remote-slug +14 -0
- package/.agents/skills/gstack/browse/scripts/build-node-server.sh +48 -0
- package/.agents/skills/gstack/browse/src/browser-manager.ts +634 -0
- package/.agents/skills/gstack/browse/src/buffers.ts +137 -0
- package/.agents/skills/gstack/browse/src/bun-polyfill.cjs +109 -0
- package/.agents/skills/gstack/browse/src/cli.ts +420 -0
- package/.agents/skills/gstack/browse/src/commands.ts +111 -0
- package/.agents/skills/gstack/browse/src/config.ts +150 -0
- package/.agents/skills/gstack/browse/src/cookie-import-browser.ts +417 -0
- package/.agents/skills/gstack/browse/src/cookie-picker-routes.ts +207 -0
- package/.agents/skills/gstack/browse/src/cookie-picker-ui.ts +541 -0
- package/.agents/skills/gstack/browse/src/find-browse.ts +61 -0
- package/.agents/skills/gstack/browse/src/meta-commands.ts +269 -0
- package/.agents/skills/gstack/browse/src/platform.ts +17 -0
- package/.agents/skills/gstack/browse/src/read-commands.ts +335 -0
- package/.agents/skills/gstack/browse/src/server.ts +369 -0
- package/.agents/skills/gstack/browse/src/snapshot.ts +398 -0
- package/.agents/skills/gstack/browse/src/url-validation.ts +91 -0
- package/.agents/skills/gstack/browse/src/write-commands.ts +352 -0
- package/.agents/skills/gstack/browse/test/bun-polyfill.test.ts +72 -0
- package/.agents/skills/gstack/browse/test/commands.test.ts +1836 -0
- package/.agents/skills/gstack/browse/test/config.test.ts +250 -0
- package/.agents/skills/gstack/browse/test/cookie-import-browser.test.ts +397 -0
- package/.agents/skills/gstack/browse/test/cookie-picker-routes.test.ts +205 -0
- package/.agents/skills/gstack/browse/test/find-browse.test.ts +50 -0
- package/.agents/skills/gstack/browse/test/fixtures/basic.html +33 -0
- package/.agents/skills/gstack/browse/test/fixtures/cursor-interactive.html +22 -0
- package/.agents/skills/gstack/browse/test/fixtures/dialog.html +15 -0
- package/.agents/skills/gstack/browse/test/fixtures/empty.html +2 -0
- package/.agents/skills/gstack/browse/test/fixtures/forms.html +55 -0
- package/.agents/skills/gstack/browse/test/fixtures/qa-eval-checkout.html +108 -0
- package/.agents/skills/gstack/browse/test/fixtures/qa-eval-spa.html +98 -0
- package/.agents/skills/gstack/browse/test/fixtures/qa-eval.html +51 -0
- package/.agents/skills/gstack/browse/test/fixtures/responsive.html +49 -0
- package/.agents/skills/gstack/browse/test/fixtures/snapshot.html +55 -0
- package/.agents/skills/gstack/browse/test/fixtures/spa.html +24 -0
- package/.agents/skills/gstack/browse/test/fixtures/states.html +17 -0
- package/.agents/skills/gstack/browse/test/fixtures/upload.html +25 -0
- package/.agents/skills/gstack/browse/test/gstack-config.test.ts +125 -0
- package/.agents/skills/gstack/browse/test/gstack-update-check.test.ts +467 -0
- package/.agents/skills/gstack/browse/test/handoff.test.ts +235 -0
- package/.agents/skills/gstack/browse/test/path-validation.test.ts +63 -0
- package/.agents/skills/gstack/browse/test/platform.test.ts +37 -0
- package/.agents/skills/gstack/browse/test/snapshot.test.ts +467 -0
- package/.agents/skills/gstack/browse/test/test-server.ts +57 -0
- package/.agents/skills/gstack/browse/test/url-validation.test.ts +72 -0
- package/.agents/skills/gstack/canary/SKILL.md +493 -0
- package/.agents/skills/gstack/canary/SKILL.md.tmpl +220 -0
- package/.agents/skills/gstack/careful/SKILL.md +59 -0
- package/.agents/skills/gstack/careful/SKILL.md.tmpl +57 -0
- package/.agents/skills/gstack/careful/bin/check-careful.sh +112 -0
- package/.agents/skills/gstack/codex/SKILL.md +677 -0
- package/.agents/skills/gstack/codex/SKILL.md.tmpl +356 -0
- package/.agents/skills/gstack/conductor.json +6 -0
- package/.agents/skills/gstack/cso/SKILL.md +615 -0
- package/.agents/skills/gstack/cso/SKILL.md.tmpl +376 -0
- package/.agents/skills/gstack/design-consultation/SKILL.md +625 -0
- package/.agents/skills/gstack/design-consultation/SKILL.md.tmpl +369 -0
- package/.agents/skills/gstack/design-review/SKILL.md +998 -0
- package/.agents/skills/gstack/design-review/SKILL.md.tmpl +262 -0
- package/.agents/skills/gstack/docs/images/github-2013.png +0 -0
- package/.agents/skills/gstack/docs/images/github-2026.png +0 -0
- package/.agents/skills/gstack/docs/skills.md +877 -0
- package/.agents/skills/gstack/document-release/SKILL.md +613 -0
- package/.agents/skills/gstack/document-release/SKILL.md.tmpl +357 -0
- package/.agents/skills/gstack/freeze/SKILL.md +82 -0
- package/.agents/skills/gstack/freeze/SKILL.md.tmpl +80 -0
- package/.agents/skills/gstack/freeze/bin/check-freeze.sh +68 -0
- package/.agents/skills/gstack/gstack-upgrade/SKILL.md +226 -0
- package/.agents/skills/gstack/gstack-upgrade/SKILL.md.tmpl +224 -0
- package/.agents/skills/gstack/guard/SKILL.md +82 -0
- package/.agents/skills/gstack/guard/SKILL.md.tmpl +80 -0
- package/.agents/skills/gstack/investigate/SKILL.md +435 -0
- package/.agents/skills/gstack/investigate/SKILL.md.tmpl +196 -0
- package/.agents/skills/gstack/land-and-deploy/SKILL.md +880 -0
- package/.agents/skills/gstack/land-and-deploy/SKILL.md.tmpl +575 -0
- package/.agents/skills/gstack/office-hours/SKILL.md +996 -0
- package/.agents/skills/gstack/office-hours/SKILL.md.tmpl +624 -0
- package/.agents/skills/gstack/package.json +55 -0
- package/.agents/skills/gstack/plan-ceo-review/SKILL.md +1277 -0
- package/.agents/skills/gstack/plan-ceo-review/SKILL.md.tmpl +838 -0
- package/.agents/skills/gstack/plan-design-review/SKILL.md +676 -0
- package/.agents/skills/gstack/plan-design-review/SKILL.md.tmpl +314 -0
- package/.agents/skills/gstack/plan-eng-review/SKILL.md +836 -0
- package/.agents/skills/gstack/plan-eng-review/SKILL.md.tmpl +279 -0
- package/.agents/skills/gstack/qa/SKILL.md +1016 -0
- package/.agents/skills/gstack/qa/SKILL.md.tmpl +316 -0
- package/.agents/skills/gstack/qa/references/issue-taxonomy.md +85 -0
- package/.agents/skills/gstack/qa/templates/qa-report-template.md +126 -0
- package/.agents/skills/gstack/qa-only/SKILL.md +633 -0
- package/.agents/skills/gstack/qa-only/SKILL.md.tmpl +101 -0
- package/.agents/skills/gstack/retro/SKILL.md +1072 -0
- package/.agents/skills/gstack/retro/SKILL.md.tmpl +833 -0
- package/.agents/skills/gstack/review/SKILL.md +849 -0
- package/.agents/skills/gstack/review/SKILL.md.tmpl +259 -0
- package/.agents/skills/gstack/review/TODOS-format.md +62 -0
- package/.agents/skills/gstack/review/checklist.md +190 -0
- package/.agents/skills/gstack/review/design-checklist.md +132 -0
- package/.agents/skills/gstack/review/greptile-triage.md +220 -0
- package/.agents/skills/gstack/scripts/analytics.ts +190 -0
- package/.agents/skills/gstack/scripts/dev-skill.ts +82 -0
- package/.agents/skills/gstack/scripts/eval-compare.ts +96 -0
- package/.agents/skills/gstack/scripts/eval-list.ts +116 -0
- package/.agents/skills/gstack/scripts/eval-select.ts +86 -0
- package/.agents/skills/gstack/scripts/eval-summary.ts +187 -0
- package/.agents/skills/gstack/scripts/eval-watch.ts +172 -0
- package/.agents/skills/gstack/scripts/gen-skill-docs.ts +2414 -0
- package/.agents/skills/gstack/scripts/skill-check.ts +167 -0
- package/.agents/skills/gstack/setup +269 -0
- package/.agents/skills/gstack/setup-browser-cookies/SKILL.md +330 -0
- package/.agents/skills/gstack/setup-browser-cookies/SKILL.md.tmpl +74 -0
- package/.agents/skills/gstack/setup-deploy/SKILL.md +459 -0
- package/.agents/skills/gstack/setup-deploy/SKILL.md.tmpl +220 -0
- package/.agents/skills/gstack/ship/SKILL.md +1457 -0
- package/.agents/skills/gstack/ship/SKILL.md.tmpl +528 -0
- package/.agents/skills/gstack/supabase/config.sh +10 -0
- package/.agents/skills/gstack/supabase/functions/community-pulse/index.ts +59 -0
- package/.agents/skills/gstack/supabase/functions/telemetry-ingest/index.ts +135 -0
- package/.agents/skills/gstack/supabase/functions/update-check/index.ts +37 -0
- package/.agents/skills/gstack/supabase/migrations/001_telemetry.sql +89 -0
- package/.agents/skills/gstack/test/analytics.test.ts +277 -0
- package/.agents/skills/gstack/test/codex-e2e.test.ts +197 -0
- package/.agents/skills/gstack/test/fixtures/coverage-audit-fixture.ts +76 -0
- package/.agents/skills/gstack/test/fixtures/eval-baselines.json +7 -0
- package/.agents/skills/gstack/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
- package/.agents/skills/gstack/test/fixtures/qa-eval-ground-truth.json +43 -0
- package/.agents/skills/gstack/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
- package/.agents/skills/gstack/test/fixtures/review-eval-design-slop.css +86 -0
- package/.agents/skills/gstack/test/fixtures/review-eval-design-slop.html +41 -0
- package/.agents/skills/gstack/test/fixtures/review-eval-enum-diff.rb +30 -0
- package/.agents/skills/gstack/test/fixtures/review-eval-enum.rb +27 -0
- package/.agents/skills/gstack/test/fixtures/review-eval-vuln.rb +14 -0
- package/.agents/skills/gstack/test/gemini-e2e.test.ts +173 -0
- package/.agents/skills/gstack/test/gen-skill-docs.test.ts +1049 -0
- package/.agents/skills/gstack/test/global-discover.test.ts +187 -0
- package/.agents/skills/gstack/test/helpers/codex-session-runner.ts +282 -0
- package/.agents/skills/gstack/test/helpers/e2e-helpers.ts +239 -0
- package/.agents/skills/gstack/test/helpers/eval-store.test.ts +548 -0
- package/.agents/skills/gstack/test/helpers/eval-store.ts +689 -0
- package/.agents/skills/gstack/test/helpers/gemini-session-runner.test.ts +104 -0
- package/.agents/skills/gstack/test/helpers/gemini-session-runner.ts +201 -0
- package/.agents/skills/gstack/test/helpers/llm-judge.ts +130 -0
- package/.agents/skills/gstack/test/helpers/observability.test.ts +283 -0
- package/.agents/skills/gstack/test/helpers/session-runner.test.ts +96 -0
- package/.agents/skills/gstack/test/helpers/session-runner.ts +357 -0
- package/.agents/skills/gstack/test/helpers/skill-parser.ts +206 -0
- package/.agents/skills/gstack/test/helpers/touchfiles.ts +260 -0
- package/.agents/skills/gstack/test/hook-scripts.test.ts +373 -0
- package/.agents/skills/gstack/test/skill-e2e-browse.test.ts +293 -0
- package/.agents/skills/gstack/test/skill-e2e-deploy.test.ts +279 -0
- package/.agents/skills/gstack/test/skill-e2e-design.test.ts +614 -0
- package/.agents/skills/gstack/test/skill-e2e-plan.test.ts +538 -0
- package/.agents/skills/gstack/test/skill-e2e-qa-bugs.test.ts +194 -0
- package/.agents/skills/gstack/test/skill-e2e-qa-workflow.test.ts +412 -0
- package/.agents/skills/gstack/test/skill-e2e-review.test.ts +535 -0
- package/.agents/skills/gstack/test/skill-e2e-workflow.test.ts +586 -0
- package/.agents/skills/gstack/test/skill-e2e.test.ts +3325 -0
- package/.agents/skills/gstack/test/skill-llm-eval.test.ts +787 -0
- package/.agents/skills/gstack/test/skill-parser.test.ts +179 -0
- package/.agents/skills/gstack/test/skill-routing-e2e.test.ts +605 -0
- package/.agents/skills/gstack/test/skill-validation.test.ts +1520 -0
- package/.agents/skills/gstack/test/telemetry.test.ts +278 -0
- package/.agents/skills/gstack/test/touchfiles.test.ts +262 -0
- package/.agents/skills/gstack/unfreeze/SKILL.md +40 -0
- package/.agents/skills/gstack/unfreeze/SKILL.md.tmpl +38 -0
- package/README.md +12 -7
- package/README_KO.md +12 -6
- package/package.json +3 -2
|
@@ -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
|
+
});
|