@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.
- package/.agents/rules/ETHOS.md +129 -0
- package/.agents/rules/global-gstack.md +117 -0
- package/.agents/rules/persona-gstack-autoplan.md +14 -0
- package/.agents/rules/persona-gstack-benchmark.md +14 -0
- package/.agents/rules/persona-gstack-browse.md +14 -0
- package/.agents/rules/persona-gstack-canary.md +14 -0
- package/.agents/rules/persona-gstack-careful.md +14 -0
- package/.agents/rules/persona-gstack-codex.md +14 -0
- package/.agents/rules/persona-gstack-cso.md +14 -0
- package/.agents/rules/persona-gstack-design-consultation.md +14 -0
- package/.agents/rules/persona-gstack-design-review.md +14 -0
- package/.agents/rules/persona-gstack-document-release.md +14 -0
- package/.agents/rules/persona-gstack-freeze.md +14 -0
- package/.agents/rules/persona-gstack-gstack-upgrade.md +14 -0
- package/.agents/rules/persona-gstack-guard.md +14 -0
- package/.agents/rules/persona-gstack-investigate.md +14 -0
- package/.agents/rules/persona-gstack-land-and-deploy.md +14 -0
- package/.agents/rules/persona-gstack-office-hours.md +14 -0
- package/.agents/rules/persona-gstack-plan-ceo-review.md +14 -0
- package/.agents/rules/persona-gstack-plan-design-review.md +14 -0
- package/.agents/rules/persona-gstack-plan-eng-review.md +14 -0
- package/.agents/rules/persona-gstack-qa-only.md +14 -0
- package/.agents/rules/persona-gstack-qa.md +14 -0
- package/.agents/rules/persona-gstack-retro.md +14 -0
- package/.agents/rules/persona-gstack-review.md +14 -0
- package/.agents/rules/persona-gstack-setup-browser-cookies.md +14 -0
- package/.agents/rules/persona-gstack-setup-deploy.md +14 -0
- package/.agents/rules/persona-gstack-ship.md +14 -0
- package/.agents/rules/persona-gstack-unfreeze.md +14 -0
- package/.agents/rules/persona-gstack.md +40 -0
- package/.agents/rules/recursive-identities.md +22 -0
- package/.agents/workflows/autoplan.md +30 -0
- package/.agents/workflows/benchmark.md +31 -0
- package/.agents/workflows/browse.md +26 -0
- package/.agents/workflows/canary.md +33 -0
- package/.agents/workflows/careful.md +22 -0
- package/.agents/workflows/codex.md +36 -0
- package/.agents/workflows/cso.md +29 -0
- package/.agents/workflows/design-consultation.md +28 -0
- package/.agents/workflows/design-review.md +28 -0
- package/.agents/workflows/document-release.md +32 -0
- package/.agents/workflows/freeze.md +17 -0
- package/.agents/workflows/gstack-upgrade.md +54 -0
- package/.agents/workflows/gstack.md +56 -0
- package/.agents/workflows/guard.md +18 -0
- package/.agents/workflows/investigate.md +37 -0
- package/.agents/workflows/land-and-deploy.md +35 -0
- package/.agents/workflows/office-hours.md +27 -0
- package/.agents/workflows/plan-ceo-review.md +34 -0
- package/.agents/workflows/plan-design-review.md +31 -0
- package/.agents/workflows/plan-eng-review.md +28 -0
- package/.agents/workflows/qa-only.md +28 -0
- package/.agents/workflows/qa.md +73 -0
- package/.agents/workflows/retro.md +34 -0
- package/.agents/workflows/review.md +30 -0
- package/.agents/workflows/setup-browser-cookies.md +15 -0
- package/.agents/workflows/setup-cookies.md +8 -0
- package/.agents/workflows/setup-deploy.md +21 -0
- package/.agents/workflows/ship.md +93 -0
- package/.agents/workflows/unfreeze.md +12 -0
- package/LICENSE +22 -0
- package/README.md +189 -0
- package/README_KO.md +191 -0
- package/bin/install.js +105 -0
- package/gstack-origin/.agents/skills/gstack/SKILL.md +651 -0
- package/gstack-origin/.agents/skills/gstack-autoplan/SKILL.md +678 -0
- package/gstack-origin/.agents/skills/gstack-benchmark/SKILL.md +482 -0
- package/gstack-origin/.agents/skills/gstack-browse/SKILL.md +511 -0
- package/gstack-origin/.agents/skills/gstack-canary/SKILL.md +486 -0
- package/gstack-origin/.agents/skills/gstack-careful/SKILL.md +50 -0
- package/gstack-origin/.agents/skills/gstack-cso/SKILL.md +607 -0
- package/gstack-origin/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
- package/gstack-origin/.agents/skills/gstack-design-review/SKILL.md +988 -0
- package/gstack-origin/.agents/skills/gstack-document-release/SKILL.md +604 -0
- package/gstack-origin/.agents/skills/gstack-freeze/SKILL.md +67 -0
- package/gstack-origin/.agents/skills/gstack-guard/SKILL.md +62 -0
- package/gstack-origin/.agents/skills/gstack-investigate/SKILL.md +415 -0
- package/gstack-origin/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
- package/gstack-origin/.agents/skills/gstack-office-hours/SKILL.md +986 -0
- package/gstack-origin/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
- package/gstack-origin/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
- package/gstack-origin/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
- package/gstack-origin/.agents/skills/gstack-qa/SKILL.md +1006 -0
- package/gstack-origin/.agents/skills/gstack-qa-only/SKILL.md +626 -0
- package/gstack-origin/.agents/skills/gstack-retro/SKILL.md +1065 -0
- package/gstack-origin/.agents/skills/gstack-review/SKILL.md +704 -0
- package/gstack-origin/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
- package/gstack-origin/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
- package/gstack-origin/.agents/skills/gstack-ship/SKILL.md +1312 -0
- package/gstack-origin/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
- package/gstack-origin/.agents/skills/gstack-upgrade/SKILL.md +220 -0
- package/gstack-origin/.env.example +5 -0
- package/gstack-origin/.github/workflows/skill-docs.yml +17 -0
- package/gstack-origin/AGENTS.md +49 -0
- package/gstack-origin/ARCHITECTURE.md +359 -0
- package/gstack-origin/BROWSER.md +271 -0
- package/gstack-origin/CHANGELOG.md +800 -0
- package/gstack-origin/CLAUDE.md +284 -0
- package/gstack-origin/CONTRIBUTING.md +370 -0
- package/gstack-origin/ETHOS.md +129 -0
- package/gstack-origin/LICENSE +21 -0
- package/gstack-origin/README.md +228 -0
- package/gstack-origin/SKILL.md +657 -0
- package/gstack-origin/SKILL.md.tmpl +281 -0
- package/gstack-origin/TODOS.md +564 -0
- package/gstack-origin/VERSION +1 -0
- package/gstack-origin/autoplan/SKILL.md +689 -0
- package/gstack-origin/autoplan/SKILL.md.tmpl +416 -0
- package/gstack-origin/benchmark/SKILL.md +489 -0
- package/gstack-origin/benchmark/SKILL.md.tmpl +233 -0
- package/gstack-origin/bin/dev-setup +68 -0
- package/gstack-origin/bin/dev-teardown +56 -0
- package/gstack-origin/bin/gstack-analytics +191 -0
- package/gstack-origin/bin/gstack-community-dashboard +113 -0
- package/gstack-origin/bin/gstack-config +38 -0
- package/gstack-origin/bin/gstack-diff-scope +71 -0
- package/gstack-origin/bin/gstack-global-discover.ts +591 -0
- package/gstack-origin/bin/gstack-repo-mode +93 -0
- package/gstack-origin/bin/gstack-review-log +9 -0
- package/gstack-origin/bin/gstack-review-read +12 -0
- package/gstack-origin/bin/gstack-slug +15 -0
- package/gstack-origin/bin/gstack-telemetry-log +158 -0
- package/gstack-origin/bin/gstack-telemetry-sync +127 -0
- package/gstack-origin/bin/gstack-update-check +196 -0
- package/gstack-origin/browse/SKILL.md +517 -0
- package/gstack-origin/browse/SKILL.md.tmpl +141 -0
- package/gstack-origin/browse/bin/find-browse +21 -0
- package/gstack-origin/browse/bin/remote-slug +14 -0
- package/gstack-origin/browse/scripts/build-node-server.sh +48 -0
- package/gstack-origin/browse/src/browser-manager.ts +634 -0
- package/gstack-origin/browse/src/buffers.ts +137 -0
- package/gstack-origin/browse/src/bun-polyfill.cjs +109 -0
- package/gstack-origin/browse/src/cli.ts +420 -0
- package/gstack-origin/browse/src/commands.ts +111 -0
- package/gstack-origin/browse/src/config.ts +150 -0
- package/gstack-origin/browse/src/cookie-import-browser.ts +417 -0
- package/gstack-origin/browse/src/cookie-picker-routes.ts +207 -0
- package/gstack-origin/browse/src/cookie-picker-ui.ts +541 -0
- package/gstack-origin/browse/src/find-browse.ts +61 -0
- package/gstack-origin/browse/src/meta-commands.ts +269 -0
- package/gstack-origin/browse/src/platform.ts +17 -0
- package/gstack-origin/browse/src/read-commands.ts +335 -0
- package/gstack-origin/browse/src/server.ts +369 -0
- package/gstack-origin/browse/src/snapshot.ts +398 -0
- package/gstack-origin/browse/src/url-validation.ts +91 -0
- package/gstack-origin/browse/src/write-commands.ts +352 -0
- package/gstack-origin/browse/test/bun-polyfill.test.ts +72 -0
- package/gstack-origin/browse/test/commands.test.ts +1836 -0
- package/gstack-origin/browse/test/config.test.ts +250 -0
- package/gstack-origin/browse/test/cookie-import-browser.test.ts +397 -0
- package/gstack-origin/browse/test/cookie-picker-routes.test.ts +205 -0
- package/gstack-origin/browse/test/find-browse.test.ts +50 -0
- package/gstack-origin/browse/test/fixtures/basic.html +33 -0
- package/gstack-origin/browse/test/fixtures/cursor-interactive.html +22 -0
- package/gstack-origin/browse/test/fixtures/dialog.html +15 -0
- package/gstack-origin/browse/test/fixtures/empty.html +2 -0
- package/gstack-origin/browse/test/fixtures/forms.html +55 -0
- package/gstack-origin/browse/test/fixtures/qa-eval-checkout.html +108 -0
- package/gstack-origin/browse/test/fixtures/qa-eval-spa.html +98 -0
- package/gstack-origin/browse/test/fixtures/qa-eval.html +51 -0
- package/gstack-origin/browse/test/fixtures/responsive.html +49 -0
- package/gstack-origin/browse/test/fixtures/snapshot.html +55 -0
- package/gstack-origin/browse/test/fixtures/spa.html +24 -0
- package/gstack-origin/browse/test/fixtures/states.html +17 -0
- package/gstack-origin/browse/test/fixtures/upload.html +25 -0
- package/gstack-origin/browse/test/gstack-config.test.ts +125 -0
- package/gstack-origin/browse/test/gstack-update-check.test.ts +467 -0
- package/gstack-origin/browse/test/handoff.test.ts +235 -0
- package/gstack-origin/browse/test/path-validation.test.ts +63 -0
- package/gstack-origin/browse/test/platform.test.ts +37 -0
- package/gstack-origin/browse/test/snapshot.test.ts +467 -0
- package/gstack-origin/browse/test/test-server.ts +57 -0
- package/gstack-origin/browse/test/url-validation.test.ts +72 -0
- package/gstack-origin/canary/SKILL.md +493 -0
- package/gstack-origin/canary/SKILL.md.tmpl +220 -0
- package/gstack-origin/careful/SKILL.md +59 -0
- package/gstack-origin/careful/SKILL.md.tmpl +57 -0
- package/gstack-origin/careful/bin/check-careful.sh +112 -0
- package/gstack-origin/codex/SKILL.md +677 -0
- package/gstack-origin/codex/SKILL.md.tmpl +356 -0
- package/gstack-origin/conductor.json +6 -0
- package/gstack-origin/cso/SKILL.md +615 -0
- package/gstack-origin/cso/SKILL.md.tmpl +376 -0
- package/gstack-origin/design-consultation/SKILL.md +625 -0
- package/gstack-origin/design-consultation/SKILL.md.tmpl +369 -0
- package/gstack-origin/design-review/SKILL.md +998 -0
- package/gstack-origin/design-review/SKILL.md.tmpl +262 -0
- package/gstack-origin/docs/images/github-2013.png +0 -0
- package/gstack-origin/docs/images/github-2026.png +0 -0
- package/gstack-origin/docs/skills.md +877 -0
- package/gstack-origin/document-release/SKILL.md +613 -0
- package/gstack-origin/document-release/SKILL.md.tmpl +357 -0
- package/gstack-origin/freeze/SKILL.md +82 -0
- package/gstack-origin/freeze/SKILL.md.tmpl +80 -0
- package/gstack-origin/freeze/bin/check-freeze.sh +68 -0
- package/gstack-origin/gstack-upgrade/SKILL.md +226 -0
- package/gstack-origin/gstack-upgrade/SKILL.md.tmpl +224 -0
- package/gstack-origin/guard/SKILL.md +82 -0
- package/gstack-origin/guard/SKILL.md.tmpl +80 -0
- package/gstack-origin/investigate/SKILL.md +435 -0
- package/gstack-origin/investigate/SKILL.md.tmpl +196 -0
- package/gstack-origin/land-and-deploy/SKILL.md +880 -0
- package/gstack-origin/land-and-deploy/SKILL.md.tmpl +575 -0
- package/gstack-origin/office-hours/SKILL.md +996 -0
- package/gstack-origin/office-hours/SKILL.md.tmpl +624 -0
- package/gstack-origin/package.json +55 -0
- package/gstack-origin/plan-ceo-review/SKILL.md +1277 -0
- package/gstack-origin/plan-ceo-review/SKILL.md.tmpl +838 -0
- package/gstack-origin/plan-design-review/SKILL.md +676 -0
- package/gstack-origin/plan-design-review/SKILL.md.tmpl +314 -0
- package/gstack-origin/plan-eng-review/SKILL.md +836 -0
- package/gstack-origin/plan-eng-review/SKILL.md.tmpl +279 -0
- package/gstack-origin/qa/SKILL.md +1016 -0
- package/gstack-origin/qa/SKILL.md.tmpl +316 -0
- package/gstack-origin/qa/references/issue-taxonomy.md +85 -0
- package/gstack-origin/qa/templates/qa-report-template.md +126 -0
- package/gstack-origin/qa-only/SKILL.md +633 -0
- package/gstack-origin/qa-only/SKILL.md.tmpl +101 -0
- package/gstack-origin/retro/SKILL.md +1072 -0
- package/gstack-origin/retro/SKILL.md.tmpl +833 -0
- package/gstack-origin/review/SKILL.md +849 -0
- package/gstack-origin/review/SKILL.md.tmpl +259 -0
- package/gstack-origin/review/TODOS-format.md +62 -0
- package/gstack-origin/review/checklist.md +190 -0
- package/gstack-origin/review/design-checklist.md +132 -0
- package/gstack-origin/review/greptile-triage.md +220 -0
- package/gstack-origin/scripts/analytics.ts +190 -0
- package/gstack-origin/scripts/dev-skill.ts +82 -0
- package/gstack-origin/scripts/eval-compare.ts +96 -0
- package/gstack-origin/scripts/eval-list.ts +116 -0
- package/gstack-origin/scripts/eval-select.ts +86 -0
- package/gstack-origin/scripts/eval-summary.ts +187 -0
- package/gstack-origin/scripts/eval-watch.ts +172 -0
- package/gstack-origin/scripts/gen-skill-docs.ts +2414 -0
- package/gstack-origin/scripts/skill-check.ts +167 -0
- package/gstack-origin/setup +269 -0
- package/gstack-origin/setup-browser-cookies/SKILL.md +330 -0
- package/gstack-origin/setup-browser-cookies/SKILL.md.tmpl +74 -0
- package/gstack-origin/setup-deploy/SKILL.md +459 -0
- package/gstack-origin/setup-deploy/SKILL.md.tmpl +220 -0
- package/gstack-origin/ship/SKILL.md +1457 -0
- package/gstack-origin/ship/SKILL.md.tmpl +528 -0
- package/gstack-origin/supabase/config.sh +10 -0
- package/gstack-origin/supabase/functions/community-pulse/index.ts +59 -0
- package/gstack-origin/supabase/functions/telemetry-ingest/index.ts +135 -0
- package/gstack-origin/supabase/functions/update-check/index.ts +37 -0
- package/gstack-origin/supabase/migrations/001_telemetry.sql +89 -0
- package/gstack-origin/test/analytics.test.ts +277 -0
- package/gstack-origin/test/codex-e2e.test.ts +197 -0
- package/gstack-origin/test/fixtures/coverage-audit-fixture.ts +76 -0
- package/gstack-origin/test/fixtures/eval-baselines.json +7 -0
- package/gstack-origin/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/qa-eval-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/review-eval-design-slop.css +86 -0
- package/gstack-origin/test/fixtures/review-eval-design-slop.html +41 -0
- package/gstack-origin/test/fixtures/review-eval-enum-diff.rb +30 -0
- package/gstack-origin/test/fixtures/review-eval-enum.rb +27 -0
- package/gstack-origin/test/fixtures/review-eval-vuln.rb +14 -0
- package/gstack-origin/test/gemini-e2e.test.ts +173 -0
- package/gstack-origin/test/gen-skill-docs.test.ts +1049 -0
- package/gstack-origin/test/global-discover.test.ts +187 -0
- package/gstack-origin/test/helpers/codex-session-runner.ts +282 -0
- package/gstack-origin/test/helpers/e2e-helpers.ts +239 -0
- package/gstack-origin/test/helpers/eval-store.test.ts +548 -0
- package/gstack-origin/test/helpers/eval-store.ts +689 -0
- package/gstack-origin/test/helpers/gemini-session-runner.test.ts +104 -0
- package/gstack-origin/test/helpers/gemini-session-runner.ts +201 -0
- package/gstack-origin/test/helpers/llm-judge.ts +130 -0
- package/gstack-origin/test/helpers/observability.test.ts +283 -0
- package/gstack-origin/test/helpers/session-runner.test.ts +96 -0
- package/gstack-origin/test/helpers/session-runner.ts +357 -0
- package/gstack-origin/test/helpers/skill-parser.ts +206 -0
- package/gstack-origin/test/helpers/touchfiles.ts +260 -0
- package/gstack-origin/test/hook-scripts.test.ts +373 -0
- package/gstack-origin/test/skill-e2e-browse.test.ts +293 -0
- package/gstack-origin/test/skill-e2e-deploy.test.ts +279 -0
- package/gstack-origin/test/skill-e2e-design.test.ts +614 -0
- package/gstack-origin/test/skill-e2e-plan.test.ts +538 -0
- package/gstack-origin/test/skill-e2e-qa-bugs.test.ts +194 -0
- package/gstack-origin/test/skill-e2e-qa-workflow.test.ts +412 -0
- package/gstack-origin/test/skill-e2e-review.test.ts +535 -0
- package/gstack-origin/test/skill-e2e-workflow.test.ts +586 -0
- package/gstack-origin/test/skill-e2e.test.ts +3325 -0
- package/gstack-origin/test/skill-llm-eval.test.ts +787 -0
- package/gstack-origin/test/skill-parser.test.ts +179 -0
- package/gstack-origin/test/skill-routing-e2e.test.ts +605 -0
- package/gstack-origin/test/skill-validation.test.ts +1520 -0
- package/gstack-origin/test/telemetry.test.ts +278 -0
- package/gstack-origin/test/touchfiles.test.ts +262 -0
- package/gstack-origin/unfreeze/SKILL.md +40 -0
- package/gstack-origin/unfreeze/SKILL.md.tmpl +38 -0
- package/package.json +38 -0
- package/scripts/install-antigravity-skill.ps1 +33 -0
- package/scripts/install-antigravity-skill.sh +41 -0
- package/scripts/sync-gstack-origin.ps1 +37 -0
- package/scripts/sync-gstack-origin.sh +35 -0
|
@@ -0,0 +1,1520 @@
|
|
|
1
|
+
import { describe, test, expect } from 'bun:test';
|
|
2
|
+
import { validateSkill, extractRemoteSlugPatterns, extractWeightsFromTable } from './helpers/skill-parser';
|
|
3
|
+
import { ALL_COMMANDS, COMMAND_DESCRIPTIONS, READ_COMMANDS, WRITE_COMMANDS, META_COMMANDS } from '../browse/src/commands';
|
|
4
|
+
import { SNAPSHOT_FLAGS } from '../browse/src/snapshot';
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
|
|
8
|
+
const ROOT = path.resolve(import.meta.dir, '..');
|
|
9
|
+
|
|
10
|
+
describe('SKILL.md command validation', () => {
|
|
11
|
+
test('all $B commands in SKILL.md are valid browse commands', () => {
|
|
12
|
+
const result = validateSkill(path.join(ROOT, 'SKILL.md'));
|
|
13
|
+
expect(result.invalid).toHaveLength(0);
|
|
14
|
+
expect(result.valid.length).toBeGreaterThan(0);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('all snapshot flags in SKILL.md are valid', () => {
|
|
18
|
+
const result = validateSkill(path.join(ROOT, 'SKILL.md'));
|
|
19
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('all $B commands in browse/SKILL.md are valid browse commands', () => {
|
|
23
|
+
const result = validateSkill(path.join(ROOT, 'browse', 'SKILL.md'));
|
|
24
|
+
expect(result.invalid).toHaveLength(0);
|
|
25
|
+
expect(result.valid.length).toBeGreaterThan(0);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('all snapshot flags in browse/SKILL.md are valid', () => {
|
|
29
|
+
const result = validateSkill(path.join(ROOT, 'browse', 'SKILL.md'));
|
|
30
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('all $B commands in qa/SKILL.md are valid browse commands', () => {
|
|
34
|
+
const qaSkill = path.join(ROOT, 'qa', 'SKILL.md');
|
|
35
|
+
if (!fs.existsSync(qaSkill)) return; // skip if missing
|
|
36
|
+
const result = validateSkill(qaSkill);
|
|
37
|
+
expect(result.invalid).toHaveLength(0);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('all snapshot flags in qa/SKILL.md are valid', () => {
|
|
41
|
+
const qaSkill = path.join(ROOT, 'qa', 'SKILL.md');
|
|
42
|
+
if (!fs.existsSync(qaSkill)) return;
|
|
43
|
+
const result = validateSkill(qaSkill);
|
|
44
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('all $B commands in qa-only/SKILL.md are valid browse commands', () => {
|
|
48
|
+
const qaOnlySkill = path.join(ROOT, 'qa-only', 'SKILL.md');
|
|
49
|
+
if (!fs.existsSync(qaOnlySkill)) return;
|
|
50
|
+
const result = validateSkill(qaOnlySkill);
|
|
51
|
+
expect(result.invalid).toHaveLength(0);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('all snapshot flags in qa-only/SKILL.md are valid', () => {
|
|
55
|
+
const qaOnlySkill = path.join(ROOT, 'qa-only', 'SKILL.md');
|
|
56
|
+
if (!fs.existsSync(qaOnlySkill)) return;
|
|
57
|
+
const result = validateSkill(qaOnlySkill);
|
|
58
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('all $B commands in plan-design-review/SKILL.md are valid browse commands', () => {
|
|
62
|
+
const skill = path.join(ROOT, 'plan-design-review', 'SKILL.md');
|
|
63
|
+
if (!fs.existsSync(skill)) return;
|
|
64
|
+
const result = validateSkill(skill);
|
|
65
|
+
expect(result.invalid).toHaveLength(0);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('all snapshot flags in plan-design-review/SKILL.md are valid', () => {
|
|
69
|
+
const skill = path.join(ROOT, 'plan-design-review', 'SKILL.md');
|
|
70
|
+
if (!fs.existsSync(skill)) return;
|
|
71
|
+
const result = validateSkill(skill);
|
|
72
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('all $B commands in design-review/SKILL.md are valid browse commands', () => {
|
|
76
|
+
const skill = path.join(ROOT, 'design-review', 'SKILL.md');
|
|
77
|
+
if (!fs.existsSync(skill)) return;
|
|
78
|
+
const result = validateSkill(skill);
|
|
79
|
+
expect(result.invalid).toHaveLength(0);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('all snapshot flags in design-review/SKILL.md are valid', () => {
|
|
83
|
+
const skill = path.join(ROOT, 'design-review', 'SKILL.md');
|
|
84
|
+
if (!fs.existsSync(skill)) return;
|
|
85
|
+
const result = validateSkill(skill);
|
|
86
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('all $B commands in design-consultation/SKILL.md are valid browse commands', () => {
|
|
90
|
+
const skill = path.join(ROOT, 'design-consultation', 'SKILL.md');
|
|
91
|
+
if (!fs.existsSync(skill)) return;
|
|
92
|
+
const result = validateSkill(skill);
|
|
93
|
+
expect(result.invalid).toHaveLength(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('all snapshot flags in design-consultation/SKILL.md are valid', () => {
|
|
97
|
+
const skill = path.join(ROOT, 'design-consultation', 'SKILL.md');
|
|
98
|
+
if (!fs.existsSync(skill)) return;
|
|
99
|
+
const result = validateSkill(skill);
|
|
100
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('all $B commands in autoplan/SKILL.md are valid browse commands', () => {
|
|
104
|
+
const skill = path.join(ROOT, 'autoplan', 'SKILL.md');
|
|
105
|
+
if (!fs.existsSync(skill)) return;
|
|
106
|
+
const result = validateSkill(skill);
|
|
107
|
+
expect(result.invalid).toHaveLength(0);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('all snapshot flags in autoplan/SKILL.md are valid', () => {
|
|
111
|
+
const skill = path.join(ROOT, 'autoplan', 'SKILL.md');
|
|
112
|
+
if (!fs.existsSync(skill)) return;
|
|
113
|
+
const result = validateSkill(skill);
|
|
114
|
+
expect(result.snapshotFlagErrors).toHaveLength(0);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('Command registry consistency', () => {
|
|
119
|
+
test('COMMAND_DESCRIPTIONS covers all commands in sets', () => {
|
|
120
|
+
const allCmds = new Set([...READ_COMMANDS, ...WRITE_COMMANDS, ...META_COMMANDS]);
|
|
121
|
+
const descKeys = new Set(Object.keys(COMMAND_DESCRIPTIONS));
|
|
122
|
+
for (const cmd of allCmds) {
|
|
123
|
+
expect(descKeys.has(cmd)).toBe(true);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('COMMAND_DESCRIPTIONS has no extra commands not in sets', () => {
|
|
128
|
+
const allCmds = new Set([...READ_COMMANDS, ...WRITE_COMMANDS, ...META_COMMANDS]);
|
|
129
|
+
for (const key of Object.keys(COMMAND_DESCRIPTIONS)) {
|
|
130
|
+
expect(allCmds.has(key)).toBe(true);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('ALL_COMMANDS matches union of all sets', () => {
|
|
135
|
+
const union = new Set([...READ_COMMANDS, ...WRITE_COMMANDS, ...META_COMMANDS]);
|
|
136
|
+
expect(ALL_COMMANDS.size).toBe(union.size);
|
|
137
|
+
for (const cmd of union) {
|
|
138
|
+
expect(ALL_COMMANDS.has(cmd)).toBe(true);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('SNAPSHOT_FLAGS option keys are valid SnapshotOptions fields', () => {
|
|
143
|
+
const validKeys = new Set([
|
|
144
|
+
'interactive', 'compact', 'depth', 'selector',
|
|
145
|
+
'diff', 'annotate', 'outputPath', 'cursorInteractive',
|
|
146
|
+
]);
|
|
147
|
+
for (const flag of SNAPSHOT_FLAGS) {
|
|
148
|
+
expect(validKeys.has(flag.optionKey)).toBe(true);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe('Usage string consistency', () => {
|
|
154
|
+
// Normalize a usage string to its structural skeleton for comparison.
|
|
155
|
+
// Replaces <param-names> with <>, [optional] with [], strips parenthetical hints.
|
|
156
|
+
// This catches format mismatches (e.g., <name>:<value> vs <name> <value>)
|
|
157
|
+
// without tripping on abbreviation differences (e.g., <sel> vs <selector>).
|
|
158
|
+
function skeleton(usage: string): string {
|
|
159
|
+
return usage
|
|
160
|
+
.replace(/\(.*?\)/g, '') // strip parenthetical hints like (e.g., Enter, Tab)
|
|
161
|
+
.replace(/<[^>]*>/g, '<>') // normalize <param-name> → <>
|
|
162
|
+
.replace(/\[[^\]]*\]/g, '[]') // normalize [optional] → []
|
|
163
|
+
.replace(/\s+/g, ' ') // collapse whitespace
|
|
164
|
+
.trim();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Cross-check Usage: patterns in implementation against COMMAND_DESCRIPTIONS
|
|
168
|
+
test('implementation Usage: structural format matches COMMAND_DESCRIPTIONS', () => {
|
|
169
|
+
const implFiles = [
|
|
170
|
+
path.join(ROOT, 'browse', 'src', 'write-commands.ts'),
|
|
171
|
+
path.join(ROOT, 'browse', 'src', 'read-commands.ts'),
|
|
172
|
+
path.join(ROOT, 'browse', 'src', 'meta-commands.ts'),
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
// Extract "Usage: browse <pattern>" from throw new Error(...) calls
|
|
176
|
+
const usagePattern = /throw new Error\(['"`]Usage:\s*browse\s+(.+?)['"`]\)/g;
|
|
177
|
+
const implUsages = new Map<string, string>();
|
|
178
|
+
|
|
179
|
+
for (const file of implFiles) {
|
|
180
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
181
|
+
let match;
|
|
182
|
+
while ((match = usagePattern.exec(content)) !== null) {
|
|
183
|
+
const usage = match[1].split('\\n')[0].trim();
|
|
184
|
+
const cmd = usage.split(/\s/)[0];
|
|
185
|
+
implUsages.set(cmd, usage);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Compare structural skeletons
|
|
190
|
+
const mismatches: string[] = [];
|
|
191
|
+
for (const [cmd, implUsage] of implUsages) {
|
|
192
|
+
const desc = COMMAND_DESCRIPTIONS[cmd];
|
|
193
|
+
if (!desc) continue;
|
|
194
|
+
if (!desc.usage) continue;
|
|
195
|
+
const descSkel = skeleton(desc.usage);
|
|
196
|
+
const implSkel = skeleton(implUsage);
|
|
197
|
+
if (descSkel !== implSkel) {
|
|
198
|
+
mismatches.push(`${cmd}: docs "${desc.usage}" (${descSkel}) vs impl "${implUsage}" (${implSkel})`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
expect(mismatches).toEqual([]);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe('Generated SKILL.md freshness', () => {
|
|
207
|
+
test('no unresolved {{placeholders}} in generated SKILL.md', () => {
|
|
208
|
+
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
|
209
|
+
const unresolved = content.match(/\{\{\w+\}\}/g);
|
|
210
|
+
expect(unresolved).toBeNull();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('no unresolved {{placeholders}} in generated browse/SKILL.md', () => {
|
|
214
|
+
const content = fs.readFileSync(path.join(ROOT, 'browse', 'SKILL.md'), 'utf-8');
|
|
215
|
+
const unresolved = content.match(/\{\{\w+\}\}/g);
|
|
216
|
+
expect(unresolved).toBeNull();
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test('generated SKILL.md has AUTO-GENERATED header', () => {
|
|
220
|
+
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
|
221
|
+
expect(content).toContain('AUTO-GENERATED');
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// --- Update check preamble validation ---
|
|
226
|
+
|
|
227
|
+
describe('Update check preamble', () => {
|
|
228
|
+
const skillsWithUpdateCheck = [
|
|
229
|
+
'SKILL.md', 'browse/SKILL.md', 'qa/SKILL.md',
|
|
230
|
+
'qa-only/SKILL.md',
|
|
231
|
+
'setup-browser-cookies/SKILL.md',
|
|
232
|
+
'ship/SKILL.md', 'review/SKILL.md',
|
|
233
|
+
'plan-ceo-review/SKILL.md', 'plan-eng-review/SKILL.md',
|
|
234
|
+
'retro/SKILL.md',
|
|
235
|
+
'office-hours/SKILL.md', 'investigate/SKILL.md',
|
|
236
|
+
'plan-design-review/SKILL.md',
|
|
237
|
+
'design-review/SKILL.md',
|
|
238
|
+
'design-consultation/SKILL.md',
|
|
239
|
+
'document-release/SKILL.md',
|
|
240
|
+
'canary/SKILL.md',
|
|
241
|
+
'benchmark/SKILL.md',
|
|
242
|
+
'land-and-deploy/SKILL.md',
|
|
243
|
+
'setup-deploy/SKILL.md',
|
|
244
|
+
'cso/SKILL.md',
|
|
245
|
+
];
|
|
246
|
+
|
|
247
|
+
for (const skill of skillsWithUpdateCheck) {
|
|
248
|
+
test(`${skill} update check line ends with || true`, () => {
|
|
249
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
250
|
+
// The second line of the bash block must end with || true
|
|
251
|
+
// to avoid exit code 1 when _UPD is empty (up to date)
|
|
252
|
+
const match = content.match(/\[ -n "\$_UPD" \].*$/m);
|
|
253
|
+
expect(match).not.toBeNull();
|
|
254
|
+
expect(match![0]).toContain('|| true');
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
test('all skills with update check are generated from .tmpl', () => {
|
|
259
|
+
for (const skill of skillsWithUpdateCheck) {
|
|
260
|
+
const tmplPath = path.join(ROOT, skill + '.tmpl');
|
|
261
|
+
expect(fs.existsSync(tmplPath)).toBe(true);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
test('update check bash block exits 0 when up to date', () => {
|
|
266
|
+
// Simulate the exact preamble command from SKILL.md
|
|
267
|
+
const result = Bun.spawnSync(['bash', '-c',
|
|
268
|
+
'_UPD=$(echo "" || true); [ -n "$_UPD" ] && echo "$_UPD" || true'
|
|
269
|
+
], { stdout: 'pipe', stderr: 'pipe' });
|
|
270
|
+
expect(result.exitCode).toBe(0);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test('update check bash block exits 0 when upgrade available', () => {
|
|
274
|
+
const result = Bun.spawnSync(['bash', '-c',
|
|
275
|
+
'_UPD=$(echo "UPGRADE_AVAILABLE 0.3.3 0.4.0" || true); [ -n "$_UPD" ] && echo "$_UPD" || true'
|
|
276
|
+
], { stdout: 'pipe', stderr: 'pipe' });
|
|
277
|
+
expect(result.exitCode).toBe(0);
|
|
278
|
+
expect(result.stdout.toString().trim()).toBe('UPGRADE_AVAILABLE 0.3.3 0.4.0');
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// --- Part 7: Cross-skill path consistency (A1) ---
|
|
283
|
+
|
|
284
|
+
describe('Cross-skill path consistency', () => {
|
|
285
|
+
test('REMOTE_SLUG derivation pattern is identical across files that use it', () => {
|
|
286
|
+
const patterns = extractRemoteSlugPatterns(ROOT, ['qa', 'review']);
|
|
287
|
+
const allPatterns: string[] = [];
|
|
288
|
+
|
|
289
|
+
for (const [, filePatterns] of patterns) {
|
|
290
|
+
allPatterns.push(...filePatterns);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Should find at least 2 occurrences (qa/SKILL.md + review/greptile-triage.md)
|
|
294
|
+
expect(allPatterns.length).toBeGreaterThanOrEqual(2);
|
|
295
|
+
|
|
296
|
+
// All occurrences must be character-for-character identical
|
|
297
|
+
const unique = new Set(allPatterns);
|
|
298
|
+
if (unique.size > 1) {
|
|
299
|
+
const variants = Array.from(unique);
|
|
300
|
+
throw new Error(
|
|
301
|
+
`REMOTE_SLUG pattern differs across files:\n` +
|
|
302
|
+
variants.map((v, i) => ` ${i + 1}: ${v}`).join('\n')
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
test('all greptile-history write references specify both per-project and global paths', () => {
|
|
308
|
+
const filesToCheck = [
|
|
309
|
+
'review/SKILL.md',
|
|
310
|
+
'ship/SKILL.md',
|
|
311
|
+
'review/greptile-triage.md',
|
|
312
|
+
];
|
|
313
|
+
|
|
314
|
+
for (const file of filesToCheck) {
|
|
315
|
+
const filePath = path.join(ROOT, file);
|
|
316
|
+
if (!fs.existsSync(filePath)) continue;
|
|
317
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
318
|
+
|
|
319
|
+
const hasBoth = (content.includes('per-project') && content.includes('global')) ||
|
|
320
|
+
(content.includes('$REMOTE_SLUG/greptile-history') && content.includes('~/.gstack/greptile-history'));
|
|
321
|
+
|
|
322
|
+
expect(hasBoth).toBe(true);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test('greptile-triage.md contains both project and global history paths', () => {
|
|
327
|
+
const content = fs.readFileSync(path.join(ROOT, 'review', 'greptile-triage.md'), 'utf-8');
|
|
328
|
+
expect(content).toContain('$REMOTE_SLUG/greptile-history.md');
|
|
329
|
+
expect(content).toContain('~/.gstack/greptile-history.md');
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
test('retro/SKILL.md reads global greptile-history (not per-project)', () => {
|
|
333
|
+
const content = fs.readFileSync(path.join(ROOT, 'retro', 'SKILL.md'), 'utf-8');
|
|
334
|
+
expect(content).toContain('~/.gstack/greptile-history.md');
|
|
335
|
+
// Should NOT reference per-project path for reads
|
|
336
|
+
expect(content).not.toContain('$REMOTE_SLUG/greptile-history.md');
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// --- Part 7: QA skill structure validation (A2) ---
|
|
341
|
+
|
|
342
|
+
describe('QA skill structure validation', () => {
|
|
343
|
+
const qaContent = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
344
|
+
|
|
345
|
+
test('qa/SKILL.md has all 11 phases', () => {
|
|
346
|
+
const phases = [
|
|
347
|
+
'Phase 1', 'Initialize',
|
|
348
|
+
'Phase 2', 'Authenticate',
|
|
349
|
+
'Phase 3', 'Orient',
|
|
350
|
+
'Phase 4', 'Explore',
|
|
351
|
+
'Phase 5', 'Document',
|
|
352
|
+
'Phase 6', 'Wrap Up',
|
|
353
|
+
'Phase 7', 'Triage',
|
|
354
|
+
'Phase 8', 'Fix Loop',
|
|
355
|
+
'Phase 9', 'Final QA',
|
|
356
|
+
'Phase 10', 'Report',
|
|
357
|
+
'Phase 11', 'TODOS',
|
|
358
|
+
];
|
|
359
|
+
for (const phase of phases) {
|
|
360
|
+
expect(qaContent).toContain(phase);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
test('has all four QA modes defined', () => {
|
|
365
|
+
const modes = [
|
|
366
|
+
'Diff-aware',
|
|
367
|
+
'Full',
|
|
368
|
+
'Quick',
|
|
369
|
+
'Regression',
|
|
370
|
+
];
|
|
371
|
+
for (const mode of modes) {
|
|
372
|
+
expect(qaContent).toContain(mode);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Mode triggers/flags
|
|
376
|
+
expect(qaContent).toContain('--quick');
|
|
377
|
+
expect(qaContent).toContain('--regression');
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
test('has all three tiers defined', () => {
|
|
381
|
+
const tiers = ['Quick', 'Standard', 'Exhaustive'];
|
|
382
|
+
for (const tier of tiers) {
|
|
383
|
+
expect(qaContent).toContain(tier);
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
test('health score weights sum to 100%', () => {
|
|
388
|
+
const weights = extractWeightsFromTable(qaContent);
|
|
389
|
+
expect(weights.size).toBeGreaterThan(0);
|
|
390
|
+
|
|
391
|
+
let sum = 0;
|
|
392
|
+
for (const pct of weights.values()) {
|
|
393
|
+
sum += pct;
|
|
394
|
+
}
|
|
395
|
+
expect(sum).toBe(100);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
test('health score has all 8 categories', () => {
|
|
399
|
+
const weights = extractWeightsFromTable(qaContent);
|
|
400
|
+
const expectedCategories = [
|
|
401
|
+
'Console', 'Links', 'Visual', 'Functional',
|
|
402
|
+
'UX', 'Performance', 'Content', 'Accessibility',
|
|
403
|
+
];
|
|
404
|
+
for (const cat of expectedCategories) {
|
|
405
|
+
expect(weights.has(cat)).toBe(true);
|
|
406
|
+
}
|
|
407
|
+
expect(weights.size).toBe(8);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test('has four mode definitions (Diff-aware/Full/Quick/Regression)', () => {
|
|
411
|
+
expect(qaContent).toContain('### Diff-aware');
|
|
412
|
+
expect(qaContent).toContain('### Full');
|
|
413
|
+
expect(qaContent).toContain('### Quick');
|
|
414
|
+
expect(qaContent).toContain('### Regression');
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test('output structure references report directory layout', () => {
|
|
418
|
+
expect(qaContent).toContain('qa-report-');
|
|
419
|
+
expect(qaContent).toContain('baseline.json');
|
|
420
|
+
expect(qaContent).toContain('screenshots/');
|
|
421
|
+
expect(qaContent).toContain('.gstack/qa-reports/');
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
// --- Part 7: Greptile history format consistency (A3) ---
|
|
426
|
+
|
|
427
|
+
describe('Greptile history format consistency', () => {
|
|
428
|
+
test('greptile-triage.md defines the canonical history format', () => {
|
|
429
|
+
const content = fs.readFileSync(path.join(ROOT, 'review', 'greptile-triage.md'), 'utf-8');
|
|
430
|
+
expect(content).toContain('<YYYY-MM-DD>');
|
|
431
|
+
expect(content).toContain('<owner/repo>');
|
|
432
|
+
expect(content).toContain('<type');
|
|
433
|
+
expect(content).toContain('<file-pattern>');
|
|
434
|
+
expect(content).toContain('<category>');
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
test('review/SKILL.md and ship/SKILL.md both reference greptile-triage.md for write details', () => {
|
|
438
|
+
const reviewContent = fs.readFileSync(path.join(ROOT, 'review', 'SKILL.md'), 'utf-8');
|
|
439
|
+
const shipContent = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
440
|
+
|
|
441
|
+
expect(reviewContent.toLowerCase()).toContain('greptile-triage.md');
|
|
442
|
+
expect(shipContent.toLowerCase()).toContain('greptile-triage.md');
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
test('greptile-triage.md defines all 9 valid categories', () => {
|
|
446
|
+
const content = fs.readFileSync(path.join(ROOT, 'review', 'greptile-triage.md'), 'utf-8');
|
|
447
|
+
const categories = [
|
|
448
|
+
'race-condition', 'null-check', 'error-handling', 'style',
|
|
449
|
+
'type-safety', 'security', 'performance', 'correctness', 'other',
|
|
450
|
+
];
|
|
451
|
+
for (const cat of categories) {
|
|
452
|
+
expect(content).toContain(cat);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
// --- Hardcoded branch name detection in templates ---
|
|
458
|
+
|
|
459
|
+
describe('No hardcoded branch names in SKILL templates', () => {
|
|
460
|
+
const tmplFiles = [
|
|
461
|
+
'ship/SKILL.md.tmpl',
|
|
462
|
+
'review/SKILL.md.tmpl',
|
|
463
|
+
'qa/SKILL.md.tmpl',
|
|
464
|
+
'plan-ceo-review/SKILL.md.tmpl',
|
|
465
|
+
'retro/SKILL.md.tmpl',
|
|
466
|
+
'document-release/SKILL.md.tmpl',
|
|
467
|
+
'plan-eng-review/SKILL.md.tmpl',
|
|
468
|
+
'plan-design-review/SKILL.md.tmpl',
|
|
469
|
+
'codex/SKILL.md.tmpl',
|
|
470
|
+
];
|
|
471
|
+
|
|
472
|
+
// Patterns that indicate hardcoded 'main' in git commands
|
|
473
|
+
const gitMainPatterns = [
|
|
474
|
+
/\bgit\s+diff\s+(?:origin\/)?main\b/,
|
|
475
|
+
/\bgit\s+log\s+(?:origin\/)?main\b/,
|
|
476
|
+
/\bgit\s+fetch\s+origin\s+main\b/,
|
|
477
|
+
/\bgit\s+merge\s+origin\/main\b/,
|
|
478
|
+
/\borigin\/main\b/,
|
|
479
|
+
];
|
|
480
|
+
|
|
481
|
+
// Lines that are allowed to mention 'main' (fallback logic, prose)
|
|
482
|
+
const allowlist = [
|
|
483
|
+
/fall\s*back\s+to\s+`main`/i,
|
|
484
|
+
/fall\s*back\s+to\s+`?main`?/i,
|
|
485
|
+
/typically\s+`?main`?/i,
|
|
486
|
+
/If\s+on\s+`main`/i, // old pattern — should not exist
|
|
487
|
+
];
|
|
488
|
+
|
|
489
|
+
for (const tmplFile of tmplFiles) {
|
|
490
|
+
test(`${tmplFile} has no hardcoded 'main' in git commands`, () => {
|
|
491
|
+
const filePath = path.join(ROOT, tmplFile);
|
|
492
|
+
if (!fs.existsSync(filePath)) return;
|
|
493
|
+
const lines = fs.readFileSync(filePath, 'utf-8').split('\n');
|
|
494
|
+
const violations: string[] = [];
|
|
495
|
+
|
|
496
|
+
for (let i = 0; i < lines.length; i++) {
|
|
497
|
+
const line = lines[i];
|
|
498
|
+
const isAllowlisted = allowlist.some(p => p.test(line));
|
|
499
|
+
if (isAllowlisted) continue;
|
|
500
|
+
|
|
501
|
+
for (const pattern of gitMainPatterns) {
|
|
502
|
+
if (pattern.test(line)) {
|
|
503
|
+
violations.push(`Line ${i + 1}: ${line.trim()}`);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (violations.length > 0) {
|
|
510
|
+
throw new Error(
|
|
511
|
+
`${tmplFile} has hardcoded 'main' in git commands:\n` +
|
|
512
|
+
violations.map(v => ` ${v}`).join('\n')
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// --- Part 7b: TODOS-format.md reference consistency ---
|
|
520
|
+
|
|
521
|
+
describe('TODOS-format.md reference consistency', () => {
|
|
522
|
+
test('review/TODOS-format.md exists and defines canonical format', () => {
|
|
523
|
+
const content = fs.readFileSync(path.join(ROOT, 'review', 'TODOS-format.md'), 'utf-8');
|
|
524
|
+
expect(content).toContain('**What:**');
|
|
525
|
+
expect(content).toContain('**Why:**');
|
|
526
|
+
expect(content).toContain('**Priority:**');
|
|
527
|
+
expect(content).toContain('**Effort:**');
|
|
528
|
+
expect(content).toContain('## Completed');
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
test('skills that write TODOs reference TODOS-format.md', () => {
|
|
532
|
+
const shipContent = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
533
|
+
const ceoPlanContent = fs.readFileSync(path.join(ROOT, 'plan-ceo-review', 'SKILL.md'), 'utf-8');
|
|
534
|
+
const engPlanContent = fs.readFileSync(path.join(ROOT, 'plan-eng-review', 'SKILL.md'), 'utf-8');
|
|
535
|
+
|
|
536
|
+
expect(shipContent).toContain('TODOS-format.md');
|
|
537
|
+
expect(ceoPlanContent).toContain('TODOS-format.md');
|
|
538
|
+
expect(engPlanContent).toContain('TODOS-format.md');
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// --- v0.4.1 feature coverage: RECOMMENDATION format, session awareness, enum completeness ---
|
|
543
|
+
|
|
544
|
+
describe('v0.4.1 preamble features', () => {
|
|
545
|
+
const skillsWithPreamble = [
|
|
546
|
+
'SKILL.md', 'browse/SKILL.md', 'qa/SKILL.md',
|
|
547
|
+
'qa-only/SKILL.md',
|
|
548
|
+
'setup-browser-cookies/SKILL.md',
|
|
549
|
+
'ship/SKILL.md', 'review/SKILL.md',
|
|
550
|
+
'plan-ceo-review/SKILL.md', 'plan-eng-review/SKILL.md',
|
|
551
|
+
'retro/SKILL.md',
|
|
552
|
+
'office-hours/SKILL.md', 'investigate/SKILL.md',
|
|
553
|
+
'plan-design-review/SKILL.md',
|
|
554
|
+
'design-review/SKILL.md',
|
|
555
|
+
'design-consultation/SKILL.md',
|
|
556
|
+
'document-release/SKILL.md',
|
|
557
|
+
'canary/SKILL.md',
|
|
558
|
+
'benchmark/SKILL.md',
|
|
559
|
+
'land-and-deploy/SKILL.md',
|
|
560
|
+
'setup-deploy/SKILL.md',
|
|
561
|
+
'cso/SKILL.md',
|
|
562
|
+
];
|
|
563
|
+
|
|
564
|
+
for (const skill of skillsWithPreamble) {
|
|
565
|
+
test(`${skill} contains RECOMMENDATION format`, () => {
|
|
566
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
567
|
+
expect(content).toContain('RECOMMENDATION: Choose');
|
|
568
|
+
expect(content).toContain('AskUserQuestion');
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
test(`${skill} contains session awareness`, () => {
|
|
572
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
573
|
+
expect(content).toContain('_SESSIONS');
|
|
574
|
+
expect(content).toContain('RECOMMENDATION');
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
for (const skill of skillsWithPreamble) {
|
|
579
|
+
test(`${skill} contains escalation protocol`, () => {
|
|
580
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
581
|
+
expect(content).toContain('DONE_WITH_CONCERNS');
|
|
582
|
+
expect(content).toContain('BLOCKED');
|
|
583
|
+
expect(content).toContain('NEEDS_CONTEXT');
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// --- Structural tests for new skills ---
|
|
589
|
+
|
|
590
|
+
describe('office-hours skill structure', () => {
|
|
591
|
+
const content = fs.readFileSync(path.join(ROOT, 'office-hours', 'SKILL.md'), 'utf-8');
|
|
592
|
+
|
|
593
|
+
// Original structural assertions
|
|
594
|
+
for (const section of ['Phase 1', 'Phase 2', 'Phase 3', 'Phase 4', 'Phase 5', 'Phase 6',
|
|
595
|
+
'Design Doc', 'Supersedes', 'APPROVED', 'Premise Challenge',
|
|
596
|
+
'Alternatives', 'Smart-skip']) {
|
|
597
|
+
test(`contains ${section}`, () => expect(content).toContain(section));
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// Dual-mode structure
|
|
601
|
+
for (const section of ['Startup mode', 'Builder mode']) {
|
|
602
|
+
test(`contains ${section}`, () => expect(content).toContain(section));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// Mode detection question
|
|
606
|
+
test('contains explicit mode detection question', () => {
|
|
607
|
+
expect(content).toContain("what's your goal");
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// Six forcing questions (startup mode)
|
|
611
|
+
for (const question of ['Demand Reality', 'Status Quo', 'Desperate Specificity',
|
|
612
|
+
'Narrowest Wedge', 'Observation & Surprise', 'Future-Fit']) {
|
|
613
|
+
test(`contains forcing question: ${question}`, () => expect(content).toContain(question));
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// Builder mode questions
|
|
617
|
+
test('contains builder brainstorming questions', () => {
|
|
618
|
+
expect(content).toContain('coolest version');
|
|
619
|
+
expect(content).toContain('delightful');
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
// Intrapreneurship adaptation
|
|
623
|
+
test('contains intrapreneurship adaptation', () => {
|
|
624
|
+
expect(content).toContain('Intrapreneurship');
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
// YC founder discovery engine
|
|
628
|
+
test('contains YC apply CTA with ref tracking', () => {
|
|
629
|
+
expect(content).toContain('ycombinator.com/apply?ref=gstack');
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
test('contains "What I noticed" design doc section', () => {
|
|
633
|
+
expect(content).toContain('What I noticed about how you think');
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
test('contains golden age framing', () => {
|
|
637
|
+
expect(content).toContain('golden age');
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
test('contains Garry Tan personal plea', () => {
|
|
641
|
+
expect(content).toContain('Garry Tan, the creator of GStack');
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
test('contains founder signal synthesis phase', () => {
|
|
645
|
+
expect(content).toContain('Founder Signal Synthesis');
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
test('contains three-tier decision rubric', () => {
|
|
649
|
+
expect(content).toContain('Top tier');
|
|
650
|
+
expect(content).toContain('Middle tier');
|
|
651
|
+
expect(content).toContain('Base tier');
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
test('contains anti-slop examples', () => {
|
|
655
|
+
expect(content).toContain('GOOD:');
|
|
656
|
+
expect(content).toContain('BAD:');
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
test('contains "One more thing" transition beat', () => {
|
|
660
|
+
expect(content).toContain('One more thing');
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
// Operating principles per mode
|
|
664
|
+
test('contains startup operating principles', () => {
|
|
665
|
+
expect(content).toContain('Specificity is the only currency');
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
test('contains builder operating principles', () => {
|
|
669
|
+
expect(content).toContain('Delight is the currency');
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// Spec Review Loop (Phase 5.5)
|
|
673
|
+
test('contains spec review loop', () => {
|
|
674
|
+
expect(content).toContain('Spec Review Loop');
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
test('contains adversarial review dimensions', () => {
|
|
678
|
+
for (const dim of ['Completeness', 'Consistency', 'Clarity', 'Scope', 'Feasibility']) {
|
|
679
|
+
expect(content).toContain(dim);
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
test('contains subagent dispatch instruction', () => {
|
|
684
|
+
expect(content).toMatch(/Agent.*tool|subagent/i);
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
test('contains max 3 iterations', () => {
|
|
688
|
+
expect(content).toMatch(/3.*iteration|maximum.*3/i);
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
test('contains quality score', () => {
|
|
692
|
+
expect(content).toContain('quality score');
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
test('contains spec review metrics path', () => {
|
|
696
|
+
expect(content).toContain('spec-review.jsonl');
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
test('contains convergence guard', () => {
|
|
700
|
+
expect(content).toMatch(/convergence/i);
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
// Visual Sketch (Phase 4.5)
|
|
704
|
+
test('contains visual sketch section', () => {
|
|
705
|
+
expect(content).toContain('Visual Sketch');
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
test('contains wireframe generation', () => {
|
|
709
|
+
expect(content).toMatch(/wireframe|sketch/i);
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
test('contains DESIGN.md awareness', () => {
|
|
713
|
+
expect(content).toContain('DESIGN.md');
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
test('contains browse rendering', () => {
|
|
717
|
+
expect(content).toContain('$B goto');
|
|
718
|
+
expect(content).toContain('$B screenshot');
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
test('contains rough aesthetic instruction', () => {
|
|
722
|
+
expect(content).toMatch(/rough|hand-drawn/i);
|
|
723
|
+
});
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
describe('investigate skill structure', () => {
|
|
727
|
+
const content = fs.readFileSync(path.join(ROOT, 'investigate', 'SKILL.md'), 'utf-8');
|
|
728
|
+
for (const section of ['Iron Law', 'Root Cause', 'Pattern Analysis', 'Hypothesis',
|
|
729
|
+
'DEBUG REPORT', '3-strike', 'BLOCKED']) {
|
|
730
|
+
test(`contains ${section}`, () => expect(content).toContain(section));
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// --- Contributor mode preamble structure validation ---
|
|
735
|
+
|
|
736
|
+
describe('Contributor mode preamble structure', () => {
|
|
737
|
+
const skillsWithPreamble = [
|
|
738
|
+
'SKILL.md', 'browse/SKILL.md', 'qa/SKILL.md',
|
|
739
|
+
'qa-only/SKILL.md',
|
|
740
|
+
'setup-browser-cookies/SKILL.md',
|
|
741
|
+
'ship/SKILL.md', 'review/SKILL.md',
|
|
742
|
+
'plan-ceo-review/SKILL.md', 'plan-eng-review/SKILL.md',
|
|
743
|
+
'retro/SKILL.md',
|
|
744
|
+
'plan-design-review/SKILL.md',
|
|
745
|
+
'design-review/SKILL.md',
|
|
746
|
+
'design-consultation/SKILL.md',
|
|
747
|
+
'document-release/SKILL.md',
|
|
748
|
+
'canary/SKILL.md',
|
|
749
|
+
'benchmark/SKILL.md',
|
|
750
|
+
'land-and-deploy/SKILL.md',
|
|
751
|
+
'setup-deploy/SKILL.md',
|
|
752
|
+
];
|
|
753
|
+
|
|
754
|
+
for (const skill of skillsWithPreamble) {
|
|
755
|
+
test(`${skill} has 0-10 rating in contributor mode`, () => {
|
|
756
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
757
|
+
expect(content).toContain('0 to 10');
|
|
758
|
+
expect(content).toContain('My rating');
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
test(`${skill} has calibration example`, () => {
|
|
762
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
763
|
+
expect(content).toContain('Calibration');
|
|
764
|
+
expect(content).toContain('the bar');
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
test(`${skill} has "what would make this a 10" field`, () => {
|
|
768
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
769
|
+
expect(content).toContain('What would make this a 10');
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
test(`${skill} uses periodic reflection (not per-command)`, () => {
|
|
773
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
774
|
+
expect(content).toContain('workflow step');
|
|
775
|
+
expect(content).not.toContain('After you use gstack-provided CLIs');
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
describe('Enum & Value Completeness in review checklist', () => {
|
|
781
|
+
const checklist = fs.readFileSync(path.join(ROOT, 'review', 'checklist.md'), 'utf-8');
|
|
782
|
+
|
|
783
|
+
test('checklist has Enum & Value Completeness section', () => {
|
|
784
|
+
expect(checklist).toContain('Enum & Value Completeness');
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
test('Enum & Value Completeness is classified as CRITICAL', () => {
|
|
788
|
+
// It should appear under Pass 1 — CRITICAL, not Pass 2
|
|
789
|
+
const pass1Start = checklist.indexOf('### Pass 1');
|
|
790
|
+
const pass2Start = checklist.indexOf('### Pass 2');
|
|
791
|
+
const enumStart = checklist.indexOf('Enum & Value Completeness');
|
|
792
|
+
expect(enumStart).toBeGreaterThan(pass1Start);
|
|
793
|
+
expect(enumStart).toBeLessThan(pass2Start);
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
test('Enum & Value Completeness mentions tracing through consumers', () => {
|
|
797
|
+
expect(checklist).toContain('Trace it through every consumer');
|
|
798
|
+
expect(checklist).toContain('case');
|
|
799
|
+
expect(checklist).toContain('allowlist');
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
test('Enum & Value Completeness is in the severity classification as CRITICAL', () => {
|
|
803
|
+
const gateSection = checklist.slice(checklist.indexOf('## Severity Classification'));
|
|
804
|
+
// The ASCII art has CRITICAL on the left and INFORMATIONAL on the right
|
|
805
|
+
// Enum & Value Completeness should appear on a line with the CRITICAL tree (├─ or └─)
|
|
806
|
+
const enumLine = gateSection.split('\n').find(l => l.includes('Enum & Value Completeness'));
|
|
807
|
+
expect(enumLine).toBeDefined();
|
|
808
|
+
// It's on the left (CRITICAL) side — starts with ├─ or └─
|
|
809
|
+
expect(enumLine!.trimStart().startsWith('├─') || enumLine!.trimStart().startsWith('└─')).toBe(true);
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
test('Fix-First Heuristic exists in checklist and is referenced by review + ship', () => {
|
|
813
|
+
expect(checklist).toContain('## Fix-First Heuristic');
|
|
814
|
+
expect(checklist).toContain('AUTO-FIX');
|
|
815
|
+
expect(checklist).toContain('ASK');
|
|
816
|
+
|
|
817
|
+
const reviewSkill = fs.readFileSync(path.join(ROOT, 'review/SKILL.md'), 'utf-8');
|
|
818
|
+
const shipSkill = fs.readFileSync(path.join(ROOT, 'ship/SKILL.md'), 'utf-8');
|
|
819
|
+
expect(reviewSkill).toContain('AUTO-FIX');
|
|
820
|
+
expect(reviewSkill).toContain('[AUTO-FIXED]');
|
|
821
|
+
expect(shipSkill).toContain('AUTO-FIX');
|
|
822
|
+
expect(shipSkill).toContain('[AUTO-FIXED]');
|
|
823
|
+
});
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
// --- Completeness Principle spot-check ---
|
|
827
|
+
|
|
828
|
+
describe('Completeness Principle in generated SKILL.md files', () => {
|
|
829
|
+
const skillsWithPreamble = [
|
|
830
|
+
'SKILL.md', 'browse/SKILL.md', 'qa/SKILL.md',
|
|
831
|
+
'qa-only/SKILL.md',
|
|
832
|
+
'setup-browser-cookies/SKILL.md',
|
|
833
|
+
'ship/SKILL.md', 'review/SKILL.md',
|
|
834
|
+
'plan-ceo-review/SKILL.md', 'plan-eng-review/SKILL.md',
|
|
835
|
+
'retro/SKILL.md',
|
|
836
|
+
'plan-design-review/SKILL.md',
|
|
837
|
+
'design-review/SKILL.md',
|
|
838
|
+
'design-consultation/SKILL.md',
|
|
839
|
+
'document-release/SKILL.md',
|
|
840
|
+
'cso/SKILL.md', ];
|
|
841
|
+
|
|
842
|
+
for (const skill of skillsWithPreamble) {
|
|
843
|
+
test(`${skill} contains Completeness Principle section`, () => {
|
|
844
|
+
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
|
845
|
+
expect(content).toContain('Completeness Principle');
|
|
846
|
+
expect(content).toContain('Boil the Lake');
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
test('Completeness Principle includes compression table', () => {
|
|
851
|
+
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
|
852
|
+
expect(content).toContain('CC+gstack');
|
|
853
|
+
expect(content).toContain('Compression');
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
test('Completeness Principle includes anti-patterns', () => {
|
|
857
|
+
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
|
858
|
+
expect(content).toContain('BAD:');
|
|
859
|
+
expect(content).toContain('Anti-patterns');
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// --- Part 7: Planted-bug fixture validation (A4) ---
|
|
864
|
+
|
|
865
|
+
describe('Planted-bug fixture validation', () => {
|
|
866
|
+
test('qa-eval ground truth has exactly 5 planted bugs', () => {
|
|
867
|
+
const groundTruth = JSON.parse(
|
|
868
|
+
fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'qa-eval-ground-truth.json'), 'utf-8')
|
|
869
|
+
);
|
|
870
|
+
expect(groundTruth.bugs).toHaveLength(5);
|
|
871
|
+
expect(groundTruth.total_bugs).toBe(5);
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
test('qa-eval-spa ground truth has exactly 5 planted bugs', () => {
|
|
875
|
+
const groundTruth = JSON.parse(
|
|
876
|
+
fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'qa-eval-spa-ground-truth.json'), 'utf-8')
|
|
877
|
+
);
|
|
878
|
+
expect(groundTruth.bugs).toHaveLength(5);
|
|
879
|
+
expect(groundTruth.total_bugs).toBe(5);
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
test('qa-eval-checkout ground truth has exactly 5 planted bugs', () => {
|
|
883
|
+
const groundTruth = JSON.parse(
|
|
884
|
+
fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'qa-eval-checkout-ground-truth.json'), 'utf-8')
|
|
885
|
+
);
|
|
886
|
+
expect(groundTruth.bugs).toHaveLength(5);
|
|
887
|
+
expect(groundTruth.total_bugs).toBe(5);
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
test('qa-eval.html contains the planted bugs', () => {
|
|
891
|
+
const html = fs.readFileSync(path.join(ROOT, 'browse', 'test', 'fixtures', 'qa-eval.html'), 'utf-8');
|
|
892
|
+
// BUG 1: broken link
|
|
893
|
+
expect(html).toContain('/nonexistent-404-page');
|
|
894
|
+
// BUG 2: disabled submit
|
|
895
|
+
expect(html).toContain('disabled');
|
|
896
|
+
// BUG 3: overflow
|
|
897
|
+
expect(html).toContain('overflow: hidden');
|
|
898
|
+
// BUG 4: missing alt
|
|
899
|
+
expect(html).toMatch(/<img[^>]*src="\/logo\.png"[^>]*>/);
|
|
900
|
+
expect(html).not.toMatch(/<img[^>]*src="\/logo\.png"[^>]*alt=/);
|
|
901
|
+
// BUG 5: console error
|
|
902
|
+
expect(html).toContain("Cannot read properties of undefined");
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
test('review-eval-vuln.rb contains expected vulnerability patterns', () => {
|
|
906
|
+
const content = fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'review-eval-vuln.rb'), 'utf-8');
|
|
907
|
+
expect(content).toContain('params[:id]');
|
|
908
|
+
expect(content).toContain('update_column');
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
// --- CEO review mode validation ---
|
|
913
|
+
|
|
914
|
+
describe('CEO review mode validation', () => {
|
|
915
|
+
const content = fs.readFileSync(path.join(ROOT, 'plan-ceo-review', 'SKILL.md'), 'utf-8');
|
|
916
|
+
|
|
917
|
+
test('has all four CEO review modes defined', () => {
|
|
918
|
+
const modes = ['SCOPE EXPANSION', 'SELECTIVE EXPANSION', 'HOLD SCOPE', 'SCOPE REDUCTION'];
|
|
919
|
+
for (const mode of modes) {
|
|
920
|
+
expect(content).toContain(mode);
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
test('has CEO plan persistence step', () => {
|
|
925
|
+
expect(content).toContain('ceo-plans');
|
|
926
|
+
expect(content).toContain('status: ACTIVE');
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
test('has docs/designs promotion section', () => {
|
|
930
|
+
expect(content).toContain('docs/designs');
|
|
931
|
+
expect(content).toContain('PROMOTED');
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
test('mode quick reference has four columns', () => {
|
|
935
|
+
expect(content).toContain('EXPANSION');
|
|
936
|
+
expect(content).toContain('SELECTIVE');
|
|
937
|
+
expect(content).toContain('HOLD SCOPE');
|
|
938
|
+
expect(content).toContain('REDUCTION');
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
// Skill chaining (benefits-from)
|
|
942
|
+
test('contains prerequisite skill offer for office-hours', () => {
|
|
943
|
+
expect(content).toContain('Prerequisite Skill Offer');
|
|
944
|
+
expect(content).toContain('/office-hours');
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
test('contains mid-session detection', () => {
|
|
948
|
+
expect(content).toContain('Mid-session detection');
|
|
949
|
+
expect(content).toMatch(/still figuring out|seems lost/i);
|
|
950
|
+
});
|
|
951
|
+
|
|
952
|
+
// Spec review on CEO plans
|
|
953
|
+
test('contains spec review loop for CEO plan documents', () => {
|
|
954
|
+
expect(content).toContain('Spec Review Loop');
|
|
955
|
+
});
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
// --- gstack-slug helper ---
|
|
959
|
+
|
|
960
|
+
describe('gstack-slug', () => {
|
|
961
|
+
const SLUG_BIN = path.join(ROOT, 'bin', 'gstack-slug');
|
|
962
|
+
|
|
963
|
+
test('binary exists and is executable', () => {
|
|
964
|
+
expect(fs.existsSync(SLUG_BIN)).toBe(true);
|
|
965
|
+
const stat = fs.statSync(SLUG_BIN);
|
|
966
|
+
expect(stat.mode & 0o111).toBeGreaterThan(0);
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
test('outputs SLUG and BRANCH lines in a git repo', () => {
|
|
970
|
+
const result = Bun.spawnSync([SLUG_BIN], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
|
971
|
+
expect(result.exitCode).toBe(0);
|
|
972
|
+
const output = result.stdout.toString();
|
|
973
|
+
expect(output).toContain('SLUG=');
|
|
974
|
+
expect(output).toContain('BRANCH=');
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
test('SLUG does not contain forward slashes', () => {
|
|
978
|
+
const result = Bun.spawnSync([SLUG_BIN], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
|
979
|
+
const slug = result.stdout.toString().match(/SLUG=(.*)/)?.[1] ?? '';
|
|
980
|
+
expect(slug).not.toContain('/');
|
|
981
|
+
expect(slug.length).toBeGreaterThan(0);
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
test('BRANCH does not contain forward slashes', () => {
|
|
985
|
+
const result = Bun.spawnSync([SLUG_BIN], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
|
986
|
+
const branch = result.stdout.toString().match(/BRANCH=(.*)/)?.[1] ?? '';
|
|
987
|
+
expect(branch).not.toContain('/');
|
|
988
|
+
expect(branch.length).toBeGreaterThan(0);
|
|
989
|
+
});
|
|
990
|
+
|
|
991
|
+
test('output is eval-compatible (KEY=VALUE format)', () => {
|
|
992
|
+
const result = Bun.spawnSync([SLUG_BIN], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
|
993
|
+
const lines = result.stdout.toString().trim().split('\n');
|
|
994
|
+
expect(lines.length).toBe(2);
|
|
995
|
+
expect(lines[0]).toMatch(/^SLUG=.+/);
|
|
996
|
+
expect(lines[1]).toMatch(/^BRANCH=.+/);
|
|
997
|
+
});
|
|
998
|
+
|
|
999
|
+
test('output values contain only safe characters (no shell metacharacters)', () => {
|
|
1000
|
+
const result = Bun.spawnSync([SLUG_BIN], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' });
|
|
1001
|
+
const slug = result.stdout.toString().match(/SLUG=(.*)/)?.[1] ?? '';
|
|
1002
|
+
const branch = result.stdout.toString().match(/BRANCH=(.*)/)?.[1] ?? '';
|
|
1003
|
+
// Only alphanumeric, dot, dash, underscore are allowed (#133)
|
|
1004
|
+
expect(slug).toMatch(/^[a-zA-Z0-9._-]+$/);
|
|
1005
|
+
expect(branch).toMatch(/^[a-zA-Z0-9._-]+$/);
|
|
1006
|
+
});
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
// --- Test Bootstrap validation ---
|
|
1010
|
+
|
|
1011
|
+
describe('Test Bootstrap ({{TEST_BOOTSTRAP}}) integration', () => {
|
|
1012
|
+
test('TEST_BOOTSTRAP resolver produces valid content', () => {
|
|
1013
|
+
const qaContent = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1014
|
+
expect(qaContent).toContain('Test Framework Bootstrap');
|
|
1015
|
+
expect(qaContent).toContain('RUNTIME:ruby');
|
|
1016
|
+
expect(qaContent).toContain('RUNTIME:node');
|
|
1017
|
+
expect(qaContent).toContain('RUNTIME:python');
|
|
1018
|
+
expect(qaContent).toContain('no-test-bootstrap');
|
|
1019
|
+
expect(qaContent).toContain('BOOTSTRAP_DECLINED');
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
test('TEST_BOOTSTRAP appears in qa/SKILL.md', () => {
|
|
1023
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1024
|
+
expect(content).toContain('Test Framework Bootstrap');
|
|
1025
|
+
expect(content).toContain('TESTING.md');
|
|
1026
|
+
expect(content).toContain('CLAUDE.md');
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
test('TEST_BOOTSTRAP appears in ship/SKILL.md', () => {
|
|
1030
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1031
|
+
expect(content).toContain('Test Framework Bootstrap');
|
|
1032
|
+
expect(content).toContain('Step 2.5');
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
test('TEST_BOOTSTRAP appears in design-review/SKILL.md', () => {
|
|
1036
|
+
const content = fs.readFileSync(path.join(ROOT, 'design-review', 'SKILL.md'), 'utf-8');
|
|
1037
|
+
expect(content).toContain('Test Framework Bootstrap');
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
test('TEST_BOOTSTRAP does NOT appear in qa-only/SKILL.md', () => {
|
|
1041
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa-only', 'SKILL.md'), 'utf-8');
|
|
1042
|
+
expect(content).not.toContain('Test Framework Bootstrap');
|
|
1043
|
+
// But should have the recommendation note
|
|
1044
|
+
expect(content).toContain('No test framework detected');
|
|
1045
|
+
expect(content).toContain('Run `/qa` to bootstrap');
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
test('bootstrap includes framework knowledge table', () => {
|
|
1049
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1050
|
+
expect(content).toContain('vitest');
|
|
1051
|
+
expect(content).toContain('minitest');
|
|
1052
|
+
expect(content).toContain('pytest');
|
|
1053
|
+
expect(content).toContain('cargo test');
|
|
1054
|
+
expect(content).toContain('phpunit');
|
|
1055
|
+
expect(content).toContain('ExUnit');
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
test('bootstrap includes CI/CD pipeline generation', () => {
|
|
1059
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1060
|
+
expect(content).toContain('.github/workflows/test.yml');
|
|
1061
|
+
expect(content).toContain('GitHub Actions');
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
test('bootstrap includes first real tests step', () => {
|
|
1065
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1066
|
+
expect(content).toContain('First real tests');
|
|
1067
|
+
expect(content).toContain('git log --since=30.days');
|
|
1068
|
+
expect(content).toContain('Prioritize by risk');
|
|
1069
|
+
});
|
|
1070
|
+
|
|
1071
|
+
test('bootstrap includes vibe coding philosophy', () => {
|
|
1072
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1073
|
+
expect(content).toContain('vibe coding');
|
|
1074
|
+
expect(content).toContain('100% test coverage');
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
test('WebSearch is in allowed-tools for qa, ship, design-review', () => {
|
|
1078
|
+
const qa = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1079
|
+
const ship = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1080
|
+
const qaDesign = fs.readFileSync(path.join(ROOT, 'design-review', 'SKILL.md'), 'utf-8');
|
|
1081
|
+
expect(qa).toContain('WebSearch');
|
|
1082
|
+
expect(ship).toContain('WebSearch');
|
|
1083
|
+
expect(qaDesign).toContain('WebSearch');
|
|
1084
|
+
});
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
// --- Phase 8e.5 regression test validation ---
|
|
1088
|
+
|
|
1089
|
+
describe('Phase 8e.5 regression test generation', () => {
|
|
1090
|
+
test('qa/SKILL.md contains Phase 8e.5', () => {
|
|
1091
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1092
|
+
expect(content).toContain('8e.5. Regression Test');
|
|
1093
|
+
expect(content).toContain('test(qa): regression test');
|
|
1094
|
+
expect(content).toContain('WTF-likelihood exclusion');
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
test('qa/SKILL.md Rule 13 is amended for regression tests', () => {
|
|
1098
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1099
|
+
expect(content).toContain('Only modify tests when generating regression tests in Phase 8e.5');
|
|
1100
|
+
expect(content).not.toContain('Never modify tests or CI configuration');
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
test('design-review has CSS-aware Phase 8e.5 variant', () => {
|
|
1104
|
+
const content = fs.readFileSync(path.join(ROOT, 'design-review', 'SKILL.md'), 'utf-8');
|
|
1105
|
+
expect(content).toContain('8e.5. Regression Test (design-review variant)');
|
|
1106
|
+
expect(content).toContain('CSS-only');
|
|
1107
|
+
expect(content).toContain('test(design): regression test');
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
test('regression test includes full attribution comment format', () => {
|
|
1111
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1112
|
+
expect(content).toContain('// Regression: ISSUE-NNN');
|
|
1113
|
+
expect(content).toContain('// Found by /qa on');
|
|
1114
|
+
expect(content).toContain('// Report: .gstack/qa-reports/');
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
test('regression test uses auto-incrementing names', () => {
|
|
1118
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'SKILL.md'), 'utf-8');
|
|
1119
|
+
expect(content).toContain('auto-incrementing');
|
|
1120
|
+
expect(content).toContain('max number + 1');
|
|
1121
|
+
});
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
// --- Step 3.4 coverage audit validation ---
|
|
1125
|
+
|
|
1126
|
+
describe('Step 3.4 test coverage audit', () => {
|
|
1127
|
+
test('ship/SKILL.md contains Step 3.4', () => {
|
|
1128
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1129
|
+
expect(content).toContain('Step 3.4: Test Coverage Audit');
|
|
1130
|
+
expect(content).toContain('CODE PATH COVERAGE');
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
test('Step 3.4 includes quality scoring rubric', () => {
|
|
1134
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1135
|
+
expect(content).toContain('★★★');
|
|
1136
|
+
expect(content).toContain('★★');
|
|
1137
|
+
expect(content).toContain('edge cases AND error paths');
|
|
1138
|
+
expect(content).toContain('happy path only');
|
|
1139
|
+
});
|
|
1140
|
+
|
|
1141
|
+
test('Step 3.4 includes before/after test count', () => {
|
|
1142
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1143
|
+
expect(content).toContain('Count test files before');
|
|
1144
|
+
expect(content).toContain('Count test files after');
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
test('ship PR body includes Test Coverage section', () => {
|
|
1148
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1149
|
+
expect(content).toContain('## Test Coverage');
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
test('ship rules include test generation rule', () => {
|
|
1153
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1154
|
+
expect(content).toContain('Step 3.4 generates coverage tests');
|
|
1155
|
+
expect(content).toContain('Never commit failing tests');
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
test('Step 3.4 includes vibe coding philosophy', () => {
|
|
1159
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1160
|
+
expect(content).toContain('vibe coding becomes yolo coding');
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
test('Step 3.4 traces actual codepaths, not just syntax', () => {
|
|
1164
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1165
|
+
expect(content).toContain('Trace every codepath');
|
|
1166
|
+
expect(content).toContain('Trace data flow');
|
|
1167
|
+
expect(content).toContain('Diagram the execution');
|
|
1168
|
+
});
|
|
1169
|
+
|
|
1170
|
+
test('Step 3.4 maps user flows and interaction edge cases', () => {
|
|
1171
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1172
|
+
expect(content).toContain('Map user flows');
|
|
1173
|
+
expect(content).toContain('Interaction edge cases');
|
|
1174
|
+
expect(content).toContain('Double-click');
|
|
1175
|
+
expect(content).toContain('Navigate away');
|
|
1176
|
+
expect(content).toContain('Error states the user can see');
|
|
1177
|
+
expect(content).toContain('Empty/zero/boundary states');
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
test('Step 3.4 diagram includes USER FLOW COVERAGE section', () => {
|
|
1181
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1182
|
+
expect(content).toContain('USER FLOW COVERAGE');
|
|
1183
|
+
expect(content).toContain('Code paths:');
|
|
1184
|
+
expect(content).toContain('User flows:');
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
|
|
1188
|
+
// --- Retro test health validation ---
|
|
1189
|
+
|
|
1190
|
+
describe('Retro test health tracking', () => {
|
|
1191
|
+
test('retro/SKILL.md has test health data gathering commands', () => {
|
|
1192
|
+
const content = fs.readFileSync(path.join(ROOT, 'retro', 'SKILL.md'), 'utf-8');
|
|
1193
|
+
expect(content).toContain('# 10. Test file count');
|
|
1194
|
+
expect(content).toContain('# 11. Regression test commits');
|
|
1195
|
+
expect(content).toContain('# 12. Test files changed');
|
|
1196
|
+
});
|
|
1197
|
+
|
|
1198
|
+
test('retro/SKILL.md has Test Health metrics row', () => {
|
|
1199
|
+
const content = fs.readFileSync(path.join(ROOT, 'retro', 'SKILL.md'), 'utf-8');
|
|
1200
|
+
expect(content).toContain('Test Health');
|
|
1201
|
+
expect(content).toContain('regression tests');
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
test('retro/SKILL.md has Test Health narrative section', () => {
|
|
1205
|
+
const content = fs.readFileSync(path.join(ROOT, 'retro', 'SKILL.md'), 'utf-8');
|
|
1206
|
+
expect(content).toContain('### Test Health');
|
|
1207
|
+
expect(content).toContain('Total test files');
|
|
1208
|
+
expect(content).toContain('vibe coding safe');
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
test('retro JSON schema includes test_health field', () => {
|
|
1212
|
+
const content = fs.readFileSync(path.join(ROOT, 'retro', 'SKILL.md'), 'utf-8');
|
|
1213
|
+
expect(content).toContain('test_health');
|
|
1214
|
+
expect(content).toContain('total_test_files');
|
|
1215
|
+
expect(content).toContain('regression_test_commits');
|
|
1216
|
+
});
|
|
1217
|
+
});
|
|
1218
|
+
|
|
1219
|
+
// --- QA report template regression tests section ---
|
|
1220
|
+
|
|
1221
|
+
describe('QA report template', () => {
|
|
1222
|
+
test('qa-report-template.md has Regression Tests section', () => {
|
|
1223
|
+
const content = fs.readFileSync(path.join(ROOT, 'qa', 'templates', 'qa-report-template.md'), 'utf-8');
|
|
1224
|
+
expect(content).toContain('## Regression Tests');
|
|
1225
|
+
expect(content).toContain('committed / deferred / skipped');
|
|
1226
|
+
expect(content).toContain('### Deferred Tests');
|
|
1227
|
+
expect(content).toContain('**Precondition:**');
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1231
|
+
// --- Codex skill validation ---
|
|
1232
|
+
|
|
1233
|
+
describe('Codex skill', () => {
|
|
1234
|
+
test('codex/SKILL.md exists and has correct frontmatter', () => {
|
|
1235
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1236
|
+
expect(content).toContain('name: codex');
|
|
1237
|
+
expect(content).toContain('version: 1.0.0');
|
|
1238
|
+
expect(content).toContain('allowed-tools:');
|
|
1239
|
+
});
|
|
1240
|
+
|
|
1241
|
+
test('codex/SKILL.md contains all three modes', () => {
|
|
1242
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1243
|
+
expect(content).toContain('Step 2A: Review Mode');
|
|
1244
|
+
expect(content).toContain('Step 2B: Challenge');
|
|
1245
|
+
expect(content).toContain('Step 2C: Consult Mode');
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1248
|
+
test('codex/SKILL.md contains gate verdict logic', () => {
|
|
1249
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1250
|
+
expect(content).toContain('[P1]');
|
|
1251
|
+
expect(content).toContain('GATE: PASS');
|
|
1252
|
+
expect(content).toContain('GATE: FAIL');
|
|
1253
|
+
});
|
|
1254
|
+
|
|
1255
|
+
test('codex/SKILL.md contains session continuity', () => {
|
|
1256
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1257
|
+
expect(content).toContain('codex-session-id');
|
|
1258
|
+
expect(content).toContain('codex exec resume');
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1261
|
+
test('codex/SKILL.md contains cost tracking', () => {
|
|
1262
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1263
|
+
expect(content).toContain('tokens used');
|
|
1264
|
+
expect(content).toContain('Est. cost');
|
|
1265
|
+
});
|
|
1266
|
+
|
|
1267
|
+
test('codex/SKILL.md contains cross-model comparison', () => {
|
|
1268
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1269
|
+
expect(content).toContain('CROSS-MODEL ANALYSIS');
|
|
1270
|
+
expect(content).toContain('Agreement rate');
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
test('codex/SKILL.md contains review log persistence', () => {
|
|
1274
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1275
|
+
expect(content).toContain('codex-review');
|
|
1276
|
+
expect(content).toContain('gstack-review-log');
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
test('codex/SKILL.md uses which for binary discovery, not hardcoded path', () => {
|
|
1280
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1281
|
+
expect(content).toContain('which codex');
|
|
1282
|
+
expect(content).not.toContain('/opt/homebrew/bin/codex');
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
test('codex/SKILL.md contains error handling for missing binary and auth', () => {
|
|
1286
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1287
|
+
expect(content).toContain('NOT_FOUND');
|
|
1288
|
+
expect(content).toContain('codex login');
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
test('codex/SKILL.md uses mktemp for temp files', () => {
|
|
1292
|
+
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
|
|
1293
|
+
expect(content).toContain('mktemp');
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
test('adversarial review in /review auto-scales by diff size', () => {
|
|
1297
|
+
const content = fs.readFileSync(path.join(ROOT, 'review', 'SKILL.md'), 'utf-8');
|
|
1298
|
+
expect(content).toContain('Adversarial review (auto-scaled)');
|
|
1299
|
+
// Diff size thresholds
|
|
1300
|
+
expect(content).toContain('< 50');
|
|
1301
|
+
expect(content).toContain('50–199');
|
|
1302
|
+
expect(content).toContain('200+');
|
|
1303
|
+
// All three tiers present
|
|
1304
|
+
expect(content).toContain('Small');
|
|
1305
|
+
expect(content).toContain('Medium tier');
|
|
1306
|
+
expect(content).toContain('Large tier');
|
|
1307
|
+
// Claude adversarial subagent dispatch
|
|
1308
|
+
expect(content).toContain('Agent tool');
|
|
1309
|
+
expect(content).toContain('FIXABLE');
|
|
1310
|
+
expect(content).toContain('INVESTIGATE');
|
|
1311
|
+
// Codex fallback logic
|
|
1312
|
+
expect(content).toContain('CODEX_NOT_AVAILABLE');
|
|
1313
|
+
expect(content).toContain('fall back to the Claude adversarial subagent');
|
|
1314
|
+
// Review log uses new skill name
|
|
1315
|
+
expect(content).toContain('adversarial-review');
|
|
1316
|
+
expect(content).toContain('xhigh');
|
|
1317
|
+
expect(content).toContain('ADVERSARIAL REVIEW SYNTHESIS');
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
test('adversarial review in /ship auto-scales by diff size', () => {
|
|
1321
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1322
|
+
expect(content).toContain('Adversarial review (auto-scaled)');
|
|
1323
|
+
expect(content).toContain('< 50');
|
|
1324
|
+
expect(content).toContain('200+');
|
|
1325
|
+
expect(content).toContain('adversarial-review');
|
|
1326
|
+
expect(content).toContain('xhigh');
|
|
1327
|
+
expect(content).toContain('Investigate and fix');
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
test('codex-host ship/review do NOT contain adversarial review step', () => {
|
|
1331
|
+
const shipContent = fs.readFileSync(path.join(ROOT, '.agents', 'skills', 'gstack-ship', 'SKILL.md'), 'utf-8');
|
|
1332
|
+
expect(shipContent).not.toContain('codex review --base');
|
|
1333
|
+
expect(shipContent).not.toContain('CODEX_REVIEWS');
|
|
1334
|
+
|
|
1335
|
+
const reviewContent = fs.readFileSync(path.join(ROOT, '.agents', 'skills', 'gstack-review', 'SKILL.md'), 'utf-8');
|
|
1336
|
+
expect(reviewContent).not.toContain('codex review --base');
|
|
1337
|
+
expect(reviewContent).not.toContain('codex_reviews');
|
|
1338
|
+
expect(reviewContent).not.toContain('CODEX_REVIEWS');
|
|
1339
|
+
expect(reviewContent).not.toContain('adversarial-review');
|
|
1340
|
+
expect(reviewContent).not.toContain('Investigate and fix');
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
test('codex integration in /plan-eng-review offers plan critique', () => {
|
|
1344
|
+
const content = fs.readFileSync(path.join(ROOT, 'plan-eng-review', 'SKILL.md'), 'utf-8');
|
|
1345
|
+
expect(content).toContain('Codex');
|
|
1346
|
+
expect(content).toContain('codex exec');
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
test('Review Readiness Dashboard includes Adversarial Review row', () => {
|
|
1350
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1351
|
+
expect(content).toContain('Adversarial');
|
|
1352
|
+
expect(content).toContain('codex-review');
|
|
1353
|
+
});
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1356
|
+
// --- Trigger phrase validation ---
|
|
1357
|
+
|
|
1358
|
+
describe('Skill trigger phrases', () => {
|
|
1359
|
+
// Skills that must have "Use when" trigger phrases in their description.
|
|
1360
|
+
// Excluded: root gstack (browser tool), gstack-upgrade (gstack-specific),
|
|
1361
|
+
// humanizer (text tool)
|
|
1362
|
+
const SKILLS_REQUIRING_TRIGGERS = [
|
|
1363
|
+
'qa', 'qa-only', 'ship', 'review', 'investigate', 'office-hours',
|
|
1364
|
+
'plan-ceo-review', 'plan-eng-review', 'plan-design-review',
|
|
1365
|
+
'design-review', 'design-consultation', 'retro', 'document-release',
|
|
1366
|
+
'codex', 'browse', 'setup-browser-cookies',
|
|
1367
|
+
];
|
|
1368
|
+
|
|
1369
|
+
for (const skill of SKILLS_REQUIRING_TRIGGERS) {
|
|
1370
|
+
test(`${skill}/SKILL.md has "Use when" trigger phrases`, () => {
|
|
1371
|
+
const skillPath = path.join(ROOT, skill, 'SKILL.md');
|
|
1372
|
+
if (!fs.existsSync(skillPath)) return;
|
|
1373
|
+
const content = fs.readFileSync(skillPath, 'utf-8');
|
|
1374
|
+
// Extract description from frontmatter
|
|
1375
|
+
const frontmatterEnd = content.indexOf('---', 4);
|
|
1376
|
+
const frontmatter = content.slice(0, frontmatterEnd);
|
|
1377
|
+
expect(frontmatter).toMatch(/Use when/i);
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
// Skills with proactive triggers should have "Proactively suggest" in description
|
|
1382
|
+
const SKILLS_REQUIRING_PROACTIVE = [
|
|
1383
|
+
'qa', 'qa-only', 'ship', 'review', 'investigate', 'office-hours',
|
|
1384
|
+
'plan-ceo-review', 'plan-eng-review', 'plan-design-review',
|
|
1385
|
+
'design-review', 'design-consultation', 'retro', 'document-release',
|
|
1386
|
+
];
|
|
1387
|
+
|
|
1388
|
+
for (const skill of SKILLS_REQUIRING_PROACTIVE) {
|
|
1389
|
+
test(`${skill}/SKILL.md has "Proactively suggest" phrase`, () => {
|
|
1390
|
+
const skillPath = path.join(ROOT, skill, 'SKILL.md');
|
|
1391
|
+
if (!fs.existsSync(skillPath)) return;
|
|
1392
|
+
const content = fs.readFileSync(skillPath, 'utf-8');
|
|
1393
|
+
const frontmatterEnd = content.indexOf('---', 4);
|
|
1394
|
+
const frontmatter = content.slice(0, frontmatterEnd);
|
|
1395
|
+
expect(frontmatter).toMatch(/Proactively suggest/i);
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
// ─── Codex Skill Validation ──────────────────────────────────
|
|
1401
|
+
|
|
1402
|
+
describe('Codex skill validation', () => {
|
|
1403
|
+
const AGENTS_DIR = path.join(ROOT, '.agents', 'skills');
|
|
1404
|
+
|
|
1405
|
+
// Discover all Claude skills with templates (except /codex which is Claude-only)
|
|
1406
|
+
const CLAUDE_SKILLS_WITH_TEMPLATES = (() => {
|
|
1407
|
+
const skills: string[] = [];
|
|
1408
|
+
for (const entry of fs.readdirSync(ROOT, { withFileTypes: true })) {
|
|
1409
|
+
if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === 'node_modules') continue;
|
|
1410
|
+
if (entry.name === 'codex') continue; // Claude-only skill
|
|
1411
|
+
if (fs.existsSync(path.join(ROOT, entry.name, 'SKILL.md.tmpl'))) {
|
|
1412
|
+
skills.push(entry.name);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return skills;
|
|
1416
|
+
})();
|
|
1417
|
+
|
|
1418
|
+
test('all skills (except /codex) have both Claude and Codex variants', () => {
|
|
1419
|
+
for (const skillDir of CLAUDE_SKILLS_WITH_TEMPLATES) {
|
|
1420
|
+
// Claude variant
|
|
1421
|
+
const claudeMd = path.join(ROOT, skillDir, 'SKILL.md');
|
|
1422
|
+
expect(fs.existsSync(claudeMd)).toBe(true);
|
|
1423
|
+
|
|
1424
|
+
// Codex variant
|
|
1425
|
+
const codexName = skillDir.startsWith('gstack-') ? skillDir : `gstack-${skillDir}`;
|
|
1426
|
+
const codexMd = path.join(AGENTS_DIR, codexName, 'SKILL.md');
|
|
1427
|
+
expect(fs.existsSync(codexMd)).toBe(true);
|
|
1428
|
+
}
|
|
1429
|
+
// Root template has both too
|
|
1430
|
+
expect(fs.existsSync(path.join(ROOT, 'SKILL.md'))).toBe(true);
|
|
1431
|
+
expect(fs.existsSync(path.join(AGENTS_DIR, 'gstack', 'SKILL.md'))).toBe(true);
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1434
|
+
test('/codex skill is Claude-only — no Codex variant', () => {
|
|
1435
|
+
// Claude variant should exist
|
|
1436
|
+
expect(fs.existsSync(path.join(ROOT, 'codex', 'SKILL.md'))).toBe(true);
|
|
1437
|
+
// Codex variant must NOT exist
|
|
1438
|
+
expect(fs.existsSync(path.join(AGENTS_DIR, 'gstack-codex', 'SKILL.md'))).toBe(false);
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
test('Codex skill names follow gstack-{name} convention', () => {
|
|
1442
|
+
const codexDirs = fs.readdirSync(AGENTS_DIR);
|
|
1443
|
+
for (const dir of codexDirs) {
|
|
1444
|
+
// Every directory should start with gstack
|
|
1445
|
+
expect(dir.startsWith('gstack')).toBe(true);
|
|
1446
|
+
// Root is just 'gstack', others are 'gstack-{name}'
|
|
1447
|
+
if (dir !== 'gstack') {
|
|
1448
|
+
expect(dir.startsWith('gstack-')).toBe(true);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
|
|
1453
|
+
test('$B commands in Codex SKILL.md files are valid browse commands', () => {
|
|
1454
|
+
const codexDirs = fs.readdirSync(AGENTS_DIR);
|
|
1455
|
+
for (const dir of codexDirs) {
|
|
1456
|
+
const skillMd = path.join(AGENTS_DIR, dir, 'SKILL.md');
|
|
1457
|
+
if (!fs.existsSync(skillMd)) continue;
|
|
1458
|
+
const content = fs.readFileSync(skillMd, 'utf-8');
|
|
1459
|
+
// Only validate if the skill contains $B commands
|
|
1460
|
+
if (!content.includes('$B ')) continue;
|
|
1461
|
+
const result = validateSkill(skillMd);
|
|
1462
|
+
expect(result.invalid).toHaveLength(0);
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
// --- Repo mode and test failure triage validation ---
|
|
1468
|
+
|
|
1469
|
+
describe('Repo mode preamble validation', () => {
|
|
1470
|
+
test('generated SKILL.md preamble contains REPO_MODE output', () => {
|
|
1471
|
+
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
|
1472
|
+
expect(content).toContain('REPO_MODE:');
|
|
1473
|
+
expect(content).toContain('gstack-repo-mode');
|
|
1474
|
+
});
|
|
1475
|
+
|
|
1476
|
+
test('generated SKILL.md contains See Something Say Something section', () => {
|
|
1477
|
+
const content = fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8');
|
|
1478
|
+
expect(content).toContain('See Something, Say Something');
|
|
1479
|
+
expect(content).toContain('REPO_MODE');
|
|
1480
|
+
expect(content).toContain('solo');
|
|
1481
|
+
expect(content).toContain('collaborative');
|
|
1482
|
+
});
|
|
1483
|
+
});
|
|
1484
|
+
|
|
1485
|
+
describe('Test failure triage in ship skill', () => {
|
|
1486
|
+
test('ship/SKILL.md contains Test Failure Ownership Triage', () => {
|
|
1487
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1488
|
+
expect(content).toContain('Test Failure Ownership Triage');
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
test('ship/SKILL.md triage uses git diff for classification', () => {
|
|
1492
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1493
|
+
expect(content).toContain('git diff origin/<base>...HEAD --name-only');
|
|
1494
|
+
});
|
|
1495
|
+
|
|
1496
|
+
test('ship/SKILL.md triage has solo and collaborative paths', () => {
|
|
1497
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1498
|
+
expect(content).toContain('REPO_MODE');
|
|
1499
|
+
expect(content).toContain('solo');
|
|
1500
|
+
expect(content).toContain('collaborative');
|
|
1501
|
+
expect(content).toContain('Investigate and fix now');
|
|
1502
|
+
expect(content).toContain('Add as P0 TODO');
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
test('ship/SKILL.md triage has GitHub issue assignment for collaborative mode', () => {
|
|
1506
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1507
|
+
expect(content).toContain('gh issue create');
|
|
1508
|
+
expect(content).toContain('--assignee');
|
|
1509
|
+
});
|
|
1510
|
+
|
|
1511
|
+
test('{{TEST_FAILURE_TRIAGE}} placeholder is fully resolved in ship/SKILL.md', () => {
|
|
1512
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1513
|
+
expect(content).not.toContain('{{TEST_FAILURE_TRIAGE}}');
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
test('ship/SKILL.md uses in-branch language for stop condition', () => {
|
|
1517
|
+
const content = fs.readFileSync(path.join(ROOT, 'ship', 'SKILL.md'), 'utf-8');
|
|
1518
|
+
expect(content).toContain('In-branch test failures');
|
|
1519
|
+
});
|
|
1520
|
+
});
|