rungate 0.2.0 → 0.3.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/bin/rungate.ts +70 -0
- package/lib/aes-calculator.ts +66 -0
- package/lib/agent-audit.ts +139 -0
- package/lib/agent-brief-validation.ts +359 -0
- package/lib/agents-md-refs.ts +90 -0
- package/lib/bash-file-read.ts +197 -0
- package/lib/behavioral-cache.ts +78 -0
- package/lib/branch-cleanup.ts +234 -0
- package/lib/brief-context-parser.ts +35 -0
- package/lib/canary.ts +117 -0
- package/lib/check-registry.ts +226 -0
- package/lib/ci-checkout.ts +400 -0
- package/lib/cli-commands.ts +137 -0
- package/lib/compliance-backfill.ts +220 -0
- package/lib/compliance-report.ts +504 -0
- package/lib/compliance.ts +361 -0
- package/lib/config-loader.ts +255 -0
- package/lib/conformity.ts +1818 -131
- package/lib/container-provenance.ts +230 -0
- package/lib/create-brief.ts +150 -0
- package/lib/create-sc.ts +272 -0
- package/lib/deep-merge.ts +69 -0
- package/lib/dev-liveness.ts +214 -0
- package/lib/directive-extractor.ts +210 -0
- package/lib/distribution-standing.ts +113 -0
- package/lib/doc-hygiene.ts +238 -0
- package/lib/eval-criteria.ts +6 -0
- package/lib/evidence-portability.ts +123 -0
- package/lib/evidence-prevalidator.ts +390 -0
- package/lib/evidence-required.ts +150 -0
- package/lib/evidence-satisfiability.ts +288 -0
- package/lib/frontmatter.ts +163 -0
- package/lib/gap-scanner.ts +348 -0
- package/lib/gate-enforcement.ts +366 -0
- package/lib/generators/agent-briefs.ts +136 -0
- package/lib/generators/agents-md.ts +506 -0
- package/lib/generators/code-map.ts +60 -0
- package/lib/generators/types.ts +184 -0
- package/lib/git-ref-normalizer.ts +107 -0
- package/lib/github.ts +539 -0
- package/lib/harness-identity.ts +63 -0
- package/lib/hill-climb.ts +164 -0
- package/lib/instruction-effectiveness.ts +131 -0
- package/lib/issue-closure-audit.ts +225 -0
- package/lib/issue-create-override.ts +343 -0
- package/lib/js-top-level-code.ts +250 -0
- package/lib/liveness-contradiction.ts +149 -0
- package/lib/organize.ts +505 -0
- package/lib/paths.ts +197 -6
- package/lib/post-fix-verify.ts +157 -0
- package/lib/prior-branch.ts +489 -0
- package/lib/project-state-shape.ts +166 -0
- package/lib/promote-outputs.ts +156 -0
- package/lib/prove-label-gate.ts +35 -0
- package/lib/reachability.ts +302 -0
- package/lib/release-preflight.ts +186 -0
- package/lib/rule-health-pipeline.ts +264 -0
- package/lib/rule-health-trend.ts +161 -0
- package/lib/rule-provenance.ts +149 -0
- package/lib/rule-registry.ts +128 -0
- package/lib/rungate-schema.ts +114 -4
- package/lib/sc-claim-forms.ts +179 -0
- package/lib/sc-cover.ts +150 -0
- package/lib/sc-guard.ts +157 -0
- package/lib/sc-ids.ts +344 -0
- package/lib/scaffold/defaults.ts +165 -0
- package/lib/scaffold/managed-workflow.ts +370 -0
- package/lib/scaffold/owned-files.ts +265 -0
- package/lib/scaffold/steps.ts +2680 -0
- package/lib/scanner.ts +701 -0
- package/lib/screenshot-upload.ts +73 -0
- package/lib/secret-patterns.ts +112 -0
- package/lib/security-verdict.ts +616 -0
- package/lib/signal-phrases.ts +1 -0
- package/lib/spec-change-conformity.ts +80 -0
- package/lib/spec-files.ts +62 -0
- package/lib/spec-registry.ts +133 -0
- package/lib/spec-updater.ts +96 -0
- package/lib/stale-cleanup.ts +224 -0
- package/lib/stale-issue-scanner.ts +36 -0
- package/lib/strip-js-comments.ts +269 -0
- package/lib/suite-measurement.ts +228 -0
- package/lib/task-completion-checks.ts +177 -0
- package/lib/test-suite-lock.ts +1136 -0
- package/lib/transcript-checker.ts +1140 -0
- package/lib/validators/spec-validators.ts +171 -0
- package/lib/verdict-capture.ts +73 -0
- package/lib/verified-push.ts +358 -0
- package/lib/workflow-security.ts +174 -0
- package/lib/worktree-cleanup.ts +250 -0
- package/lib/worktree-collect.ts +283 -0
- package/lib/worktree-isolation.ts +82 -0
- package/package.json +36 -3
- package/prompts/ac-adversary.md +14 -2
- package/prompts/aditi.md +5 -0
- package/prompts/blast-radius.md +5 -0
- package/prompts/container-verify.md +5 -0
- package/prompts/discovery.md +4 -0
- package/prompts/environment.md +5 -0
- package/prompts/evidence-hierarchy.md +5 -0
- package/prompts/evidence-validator.md +11 -0
- package/prompts/marcus.md +5 -0
- package/prompts/prevention.md +5 -0
- package/prompts/prove-reproducer.md +12 -0
- package/prompts/quinn-decision-tree.md +5 -0
- package/prompts/quinn-ui-brief.md +5 -0
- package/prompts/quinn.md +5 -0
- package/prompts/rca.md +5 -0
- package/prompts/read-before-write.md +4 -0
- package/prompts/regression.md +5 -0
- package/prompts/serena.md +5 -0
- package/scripts/audit-specs.ts +464 -0
- package/scripts/convert-spec.ts +293 -0
- package/scripts/create-sc.ts +92 -0
- package/scripts/create-spec.ts +166 -0
- package/scripts/extract-constraints.ts +4 -3
- package/scripts/generate-code-map.ts +1 -1
- package/scripts/scaffold-project.ts +138 -1426
- package/scripts/sync-spec-tests.ts +211 -126
- package/.claude/agents/aditi.md +0 -47
- package/.claude/agents/marcus.md +0 -50
- package/.claude/agents/quinn.md +0 -58
- package/.claude/agents/rook.md +0 -47
- package/.claude/agents/serena.md +0 -46
- package/.claude/rungate.json +0 -11
- package/.fallowrc.json +0 -28
- package/.github/copilot-instructions.md +0 -20
- package/.rungate/conformity-findings.json +0 -648
- package/AGENTS.md +0 -106
- package/CODE-MAP.md +0 -50
- package/HARNESS.md +0 -88
- package/bun.lock +0 -26
- package/bunfig.toml +0 -2
- package/config/brief-policies.json +0 -28
- package/config/ceremony-profiles.json +0 -212
- package/config/consumer-cascade-map.json +0 -24
- package/config/doc-cascade-map.json +0 -24
- package/config/eval.json +0 -84
- package/config/profiles/account-plan.yaml +0 -36
- package/config/profiles/campaign.yaml +0 -94
- package/config/prove-evidence.schema.json +0 -65
- package/config/spec-policies.json +0 -36
- package/config/workflow-schema.json +0 -281
- package/gates/SCHEMA-GUIDE.md +0 -121
- package/gates/ac-quality.test.ts +0 -106
- package/gates/adversarial.test.ts +0 -274
- package/gates/brief-assembler.test.ts +0 -429
- package/gates/brief-assembler.ts +0 -334
- package/gates/bunfig.toml +0 -2
- package/gates/chain.test.ts +0 -91
- package/gates/e2e-smoke.test.ts +0 -234
- package/gates/error-classifier.test.ts +0 -249
- package/gates/error-classifier.ts +0 -89
- package/gates/orchestrator.test.ts +0 -950
- package/gates/orchestrator.ts +0 -569
- package/gates/preload.ts +0 -77
- package/gates/prompts/ac-adversary.md +0 -20
- package/gates/prompts/evidence-validator.md +0 -22
- package/gates/prompts/prove-reproducer.md +0 -53
- package/gates/prove.test.ts +0 -164
- package/gates/run-gate.ts +0 -936
- package/gates/schema-parity.test.ts +0 -197
- package/gates/schema.ts +0 -362
- package/gates/self-heal.test.ts +0 -511
- package/gates/self-heal.ts +0 -121
- package/gates/ship-orchestrator.test.ts +0 -379
- package/gates/ship-orchestrator.ts +0 -363
- package/gates/test-fixtures/broken-no-environments.json +0 -60
- package/gates/test-fixtures/valid-standard.json +0 -54
- package/gates/test-utils.ts +0 -43
- package/gates/witness.ts +0 -220
- package/gates/workflow.test.ts +0 -1053
- package/hooks/AgentBriefGuard.hook.ts +0 -586
- package/hooks/AgentVerdictCapture.hook.ts +0 -134
- package/hooks/AutoVerifyGate.hook.ts +0 -76
- package/hooks/GateEnforcement.hook.ts +0 -273
- package/hooks/IssueCloseGuard.hook.ts +0 -116
- package/hooks/MergeGuard.hook.ts +0 -55
- package/hooks/StaleTTLCleanup.hook.ts +0 -133
- package/hooks/VerifyPhaseLock.hook.ts +0 -81
- package/hooks/WorkflowStateGuard.hook.ts +0 -37
- package/hooks/lib/agentDetection.ts +0 -70
- package/hooks/lib/findWorkflow.ts +0 -101
- package/hooks/lib/parseStdin.ts +0 -37
- package/hooks/lib/paths.ts +0 -111
- package/hooks/lib/utils.ts +0 -81
- package/reference/migration-manifest.json +0 -554
- package/reference/prompts/agent-aditi.md +0 -38
- package/reference/prompts/agent-marcus.md +0 -38
- package/reference/prompts/agent-quinn.md +0 -38
- package/reference/prompts/agent-rook.md +0 -37
- package/reference/prompts/agent-serena.md +0 -37
- package/reference/prompts/council-skill.md +0 -170
- package/reference/prompts/goal-skill.md +0 -235
- package/reference/prompts/prove-skill.md +0 -283
- package/reference/prompts/quinn-standard.md +0 -246
- package/reference/prompts/ship-convergence.md +0 -65
- package/reference/prompts/ship-escalation.md +0 -43
- package/reference/prompts/ship-iteration.md +0 -382
- package/reference/prompts/ship-pending-patches.md +0 -246
- package/reference/prompts/ship-reference.md +0 -250
- package/reference/prompts/ship-skill.md +0 -347
- package/reference/prompts/ship-templates.md +0 -215
- package/reference/scripts/batch-status.sh +0 -68
- package/reference/scripts/chain-compat-check.sh +0 -67
- package/reference/scripts/context-audit.sh +0 -314
- package/reference/scripts/dead-export-check.sh +0 -61
- package/reference/scripts/generate-qc-tables.sh +0 -92
- package/reference/scripts/harness-init.sh +0 -111
- package/reference/scripts/pai-054-baseline-check.sh +0 -40
- package/reference/scripts/prove-smoke-test.sh +0 -112
- package/reference/scripts/setup-keychain-salt.sh +0 -12
- package/reference/scripts/skill-optimizer-friday.sh +0 -88
- package/reference/scripts/skill-qc-test.sh +0 -351
- package/reference/scripts/skill-synthesize-tonight.sh +0 -66
- package/reference/specs/HARNESS-EXTRACTION-SPEC.md +0 -263
- package/reference/specs/harness-v3-bash-deletion-plan.md +0 -65
- package/reference/specs/harness-v3-migration-plan.md +0 -188
- package/scripts/decision-reconcile.sh +0 -74
- package/scripts/decision-reconcile.ts +0 -152
- package/scripts/git-hooks/pre-commit +0 -76
- package/scripts/git-hooks/pre-push +0 -271
- package/scripts/harness-skill-check.sh +0 -52
- package/scripts/lib/gap-emit.sh +0 -65
- package/scripts/lib/jq-update.sh +0 -30
- package/scripts/lib/resolve-slug.sh +0 -30
- package/scripts/lib/verify-spec-compliance.sh +0 -102
- package/scripts/prove-backfill.sh +0 -87
- package/scripts/scaffold-rungate-config.ts +0 -91
- package/scripts/self-containment-check.sh +0 -109
- package/scripts/skill-qc-validator.sh +0 -402
- package/scripts/slug-resolver.sh +0 -14
- package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +0 -2493
- package/specs/BOOTSTRAP-TEST-PLAN.md +0 -571
- package/specs/HARNESS-GATES.md +0 -256
- package/specs/HARNESS-SKILL-CHAIN.md +0 -286
- package/specs/HARNESS-SKILL-CONTRACT.md +0 -93
- package/specs/HARNESS-STANDARD.md +0 -488
- package/specs/SPEC-TEMPLATE.md +0 -53
- package/specs/bootstrap-data-flow.png +0 -0
- package/specs/harness-automation-matrix.md +0 -314
- package/specs/harness-automation-matrix.rules.json +0 -64
- package/test/anti.test.ts +0 -80
- package/test/contract-negative.test.ts +0 -86
- package/test/contract.test.ts +0 -158
- package/test/external-deps.test.ts +0 -48
- package/test/fixtures/golden-project/.env.example +0 -3
- package/test/fixtures/golden-project/Makefile +0 -7
- package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +0 -23
- package/test/fixtures/golden-project/docs/setup-guide.md +0 -10
- package/test/fixtures/golden-project/package.json +0 -10
- package/test/fixtures/golden-project/specs/api-spec.md +0 -20
- package/test/fixtures/golden-project/src/auth.ts +0 -8
- package/test/fixtures/golden-project/src/db.ts +0 -11
- package/test/fixtures/golden-project/src/index.ts +0 -19
- package/test/fixtures/golden-project/src/utils/format.ts +0 -3
- package/test/fixtures/golden-project/test/auth.test.ts +0 -15
- package/test/fixtures/golden-project/tsconfig.json +0 -12
- package/test/meta-sc-coverage.test.ts +0 -159
- package/test/phase-0.test.ts +0 -846
- package/test/phase-1.test.ts +0 -617
- package/test/phase-2.test.ts +0 -620
- package/test/phase-3.test.ts +0 -99
- package/test/scaffold-conformity.test.ts +0 -8
- package/test/schema-canary.test.ts +0 -51
- package/test/spec-compliance-auto.test.ts +0 -64
- package/test/spec-compliance.test.ts +0 -295
- package/test/spec-discovery.test.ts +0 -68
- package/test/spec-drift.test.ts +0 -5
- package/test/structure.test.ts +0 -165
- package/test/unit/agent-brief-guard-ship.test.ts +0 -293
- package/test/unit/extract-constraints.test.ts +0 -145
- package/test/unit/issue-close-guard.test.ts +0 -204
- package/test/unit/scaffold-project.test.ts +0 -417
- package/test/unit/skill-cooccurrence.test.ts +0 -177
- package/test/unit/skill-sequence-logger.test.ts +0 -244
- package/test/unit/workflow-state-guard.test.ts +0 -95
- package/workflows/batch-ship.js +0 -295
- package/workflows/council.js +0 -481
- package/workflows/prove.js +0 -560
- package/workflows/ship.js +0 -789
- package/workflows/verify.js +0 -236
package/test/contract.test.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { test, expect, describe, beforeAll } from "bun:test";
|
|
2
|
-
import { mkdirSync, writeFileSync } from "fs";
|
|
3
|
-
import { join } from "path";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
|
|
6
|
-
const TEST_BASE = "/tmp/harness-contract-tests";
|
|
7
|
-
const GATES_DIR = join(import.meta.dir, "..", "gates");
|
|
8
|
-
|
|
9
|
-
function runGate(gate: string, slug: string): { pass: number; fail: number; output: string } {
|
|
10
|
-
const gateRunner = join(GATES_DIR, "run-gate.ts");
|
|
11
|
-
const cmd = `RUNGATE_WORK_DIR=${TEST_BASE} RUNGATE_SKIP_AGENTS=1 bun run ${gateRunner} --gate ${gate} --slug ${slug} --issue 9999 2>&1`;
|
|
12
|
-
try {
|
|
13
|
-
const output = execSync(cmd, { encoding: "utf-8", timeout: 30000 });
|
|
14
|
-
const passMatch = output.match(/(\d+) pass/);
|
|
15
|
-
const failMatch = output.match(/(\d+) fail/);
|
|
16
|
-
return { pass: passMatch ? parseInt(passMatch[1]) : 0, fail: failMatch ? parseInt(failMatch[1]) : 0, output };
|
|
17
|
-
} catch (e: any) {
|
|
18
|
-
const out = (e.stdout || "") + (e.stderr || "");
|
|
19
|
-
const passMatch = out.match(/(\d+) pass/);
|
|
20
|
-
const failMatch = out.match(/(\d+) fail/);
|
|
21
|
-
return { pass: passMatch ? parseInt(passMatch[1]) : 0, fail: failMatch ? parseInt(failMatch[1]) : 0, output: out };
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
describe("contract: LIGHT tier", () => {
|
|
26
|
-
beforeAll(() => {
|
|
27
|
-
const dir = join(TEST_BASE, "light");
|
|
28
|
-
mkdirSync(dir, { recursive: true });
|
|
29
|
-
writeFileSync(join(dir, "workflow-state.json"), JSON.stringify({
|
|
30
|
-
schemaVersion: 2, issue: 9999, repo: "test/repo", issueRepo: "test/repo",
|
|
31
|
-
projectRoot: "/tmp/test", slug: "light", phase: "DONE",
|
|
32
|
-
issueGoal: "Test canary", sizing: { predicted: "XS", ceremonyTier: "LIGHT" },
|
|
33
|
-
acs: [{ id: "AC-1", type: "CODE", statement: "Unit tests pass including canary test suite",
|
|
34
|
-
threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "BUN_TEST", command: "bun test" },
|
|
35
|
-
evidence: { type: "command-output", content: "24 pass" }, verdict: "PASS" }],
|
|
36
|
-
gates: { scope: { result: "PASS", attempt: 1, failures: [] } },
|
|
37
|
-
environments: { local: { api: "PASS", ui: "PASS", tests: "PASS" } },
|
|
38
|
-
agents: { marcus: { spawned: true, verdict: "PASS" } },
|
|
39
|
-
buildCommit: "abc1234", changelog: [], bootstrappedFrom: "ship-workflow"
|
|
40
|
-
}, null, 2));
|
|
41
|
-
writeFileSync(join(dir, "marcus-brief.md"), "# Marcus Brief\n\nCovers: AC-1\n\n## AC-1\nUnit tests pass\n");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("scope passes", () => {
|
|
45
|
-
const r = runGate("scope", "light");
|
|
46
|
-
expect(r.fail).toBe(0);
|
|
47
|
-
expect(r.pass).toBeGreaterThan(0);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test("ship passes", () => {
|
|
51
|
-
const r = runGate("ship", "light");
|
|
52
|
-
expect(r.pass).toBeGreaterThan(0);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe("contract: STANDARD tier", () => {
|
|
57
|
-
beforeAll(() => {
|
|
58
|
-
const dir = join(TEST_BASE, "standard");
|
|
59
|
-
mkdirSync(dir, { recursive: true });
|
|
60
|
-
writeFileSync(join(dir, "workflow-state.json"), JSON.stringify({
|
|
61
|
-
schemaVersion: 2, issue: 9998, repo: "test/repo", issueRepo: "test/repo",
|
|
62
|
-
projectRoot: "/tmp/test", slug: "standard", phase: "DONE",
|
|
63
|
-
issueGoal: "Test canary standard", sizing: { predicted: "S", ceremonyTier: "STANDARD" },
|
|
64
|
-
acs: [
|
|
65
|
-
{ id: "AC-1", type: "CODE", statement: "Fix applied to target module correctly", threshold: { op: "contains", value: "fix" }, evidenceMethod: { type: "grep", command: "grep fix src/test.ts" }, evidence: { type: "command-output", content: "fix" }, verdict: "PASS" },
|
|
66
|
-
{ id: "AC-2", type: "CODE", statement: "All unit tests pass without regression", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "BUN_TEST", command: "bun test" }, evidence: { type: "command-output", content: "24 pass" }, verdict: "PASS" },
|
|
67
|
-
],
|
|
68
|
-
sourceSpecs: [{ path: join(process.env.HOME || "", "Projects/rungate/specs/BOOTSTRAP-DATA-FLOW-SPEC.md"), citedInDiscovery: true }],
|
|
69
|
-
gates: { scope: { result: "PASS", attempt: 1, failures: [] }, verify: { result: "PASS", attempt: 1, failures: [] } },
|
|
70
|
-
environments: { local: { api: "PASS", ui: "PASS", tests: "PASS" }, prod: { rebuild: "SKIP", smoke: "SKIP", quinn: "SKIP" } },
|
|
71
|
-
agents: { marcus: { spawned: true, verdict: "PASS" }, quinn: { spawned: true, verdict: "PASS" } },
|
|
72
|
-
buildCommit: "abc1234", changelog: [], bootstrappedFrom: "ship-workflow"
|
|
73
|
-
}, null, 2));
|
|
74
|
-
writeFileSync(join(dir, "marcus-brief.md"), "# Marcus Brief\n\nCovers: AC-1, AC-2\n\n## AC-1\nFix applied\n\n## AC-2\nAll unit tests pass\n");
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test("scope passes", () => {
|
|
78
|
-
const r = runGate("scope", "standard");
|
|
79
|
-
expect(r.fail).toBe(0);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("verify passes", () => {
|
|
83
|
-
const r = runGate("verify", "standard");
|
|
84
|
-
expect(r.fail).toBe(0);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test("ship passes", () => {
|
|
88
|
-
const r = runGate("ship", "standard");
|
|
89
|
-
expect(r.fail).toBe(0);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe("contract: negative cases", () => {
|
|
94
|
-
test("missing environments fails ship", () => {
|
|
95
|
-
const dir = join(TEST_BASE, "broken-env");
|
|
96
|
-
mkdirSync(dir, { recursive: true });
|
|
97
|
-
writeFileSync(join(dir, "workflow-state.json"), JSON.stringify({
|
|
98
|
-
schemaVersion: 2, issue: 9997, repo: "test/repo", issueRepo: "test/repo",
|
|
99
|
-
projectRoot: "/tmp/test", slug: "broken-env", phase: "DONE",
|
|
100
|
-
issueGoal: "Broken env test", sizing: { predicted: "S", ceremonyTier: "STANDARD" },
|
|
101
|
-
acs: [{ id: "AC-1", type: "CODE", statement: "Fix applied correctly to module", threshold: { op: "contains", value: "fix" }, evidenceMethod: { type: "BUN_TEST", command: "bun test" }, evidence: { type: "command-output", content: "24 pass" }, verdict: "PASS" }],
|
|
102
|
-
sourceSpecs: [{ path: join(process.env.HOME || "", "Projects/rungate/specs/BOOTSTRAP-DATA-FLOW-SPEC.md"), citedInDiscovery: true }],
|
|
103
|
-
gates: { scope: { result: "PASS", attempt: 1, failures: [] }, verify: { result: "PASS", attempt: 1, failures: [] } },
|
|
104
|
-
environments: {},
|
|
105
|
-
agents: { marcus: { spawned: true, verdict: "PASS" } },
|
|
106
|
-
buildCommit: "abc1234", changelog: [], bootstrappedFrom: "ship-workflow"
|
|
107
|
-
}, null, 2));
|
|
108
|
-
writeFileSync(join(dir, "marcus-brief.md"), "# Marcus Brief\n\nCovers: AC-1\n\n## AC-1\nFix applied\n");
|
|
109
|
-
const r = runGate("ship", "broken-env");
|
|
110
|
-
expect(r.fail).toBeGreaterThan(0);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test("all-grep evidence fails ratio check", () => {
|
|
114
|
-
const dir = join(TEST_BASE, "broken-grep");
|
|
115
|
-
mkdirSync(dir, { recursive: true });
|
|
116
|
-
writeFileSync(join(dir, "workflow-state.json"), JSON.stringify({
|
|
117
|
-
schemaVersion: 2, issue: 9996, repo: "test/repo", issueRepo: "test/repo",
|
|
118
|
-
projectRoot: "/tmp/test", slug: "broken-grep", phase: "DONE",
|
|
119
|
-
issueGoal: "Broken grep test", sizing: { predicted: "S", ceremonyTier: "STANDARD" },
|
|
120
|
-
acs: [
|
|
121
|
-
{ id: "AC-1", type: "CODE", statement: "First check passes via grep only", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "grep", command: "grep x y" }, evidence: { type: "command-output", content: "10" }, verdict: "PASS" },
|
|
122
|
-
{ id: "AC-2", type: "CODE", statement: "Second check passes via grep only", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "grep", command: "grep x y" }, evidence: { type: "command-output", content: "10" }, verdict: "PASS" },
|
|
123
|
-
{ id: "AC-3", type: "CODE", statement: "Third check passes via grep only", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "grep", command: "grep x y" }, evidence: { type: "command-output", content: "10" }, verdict: "PASS" },
|
|
124
|
-
{ id: "AC-4", type: "CODE", statement: "Fourth check passes via grep only", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "grep", command: "grep x y" }, evidence: { type: "command-output", content: "10" }, verdict: "PASS" },
|
|
125
|
-
],
|
|
126
|
-
sourceSpecs: [{ path: join(process.env.HOME || "", "Projects/rungate/specs/BOOTSTRAP-DATA-FLOW-SPEC.md"), citedInDiscovery: true }],
|
|
127
|
-
gates: { scope: { result: "PASS", attempt: 1, failures: [] }, verify: { result: "PASS", attempt: 1, failures: [] } },
|
|
128
|
-
environments: { local: { api: "PASS", ui: "PASS", tests: "PASS" } },
|
|
129
|
-
agents: { marcus: { spawned: true, verdict: "PASS" } },
|
|
130
|
-
buildCommit: "abc1234", changelog: [], bootstrappedFrom: "ship-workflow"
|
|
131
|
-
}, null, 2));
|
|
132
|
-
writeFileSync(join(dir, "marcus-brief.md"), "# Marcus Brief\n\nCovers: AC-1, AC-2, AC-3, AC-4\n\n## AC-1\nFirst check\n\n## AC-2\nSecond check\n\n## AC-3\nThird check\n\n## AC-4\nFourth check\n");
|
|
133
|
-
const r = runGate("ship", "broken-grep");
|
|
134
|
-
expect(r.output).toContain("evidence-type-ratio");
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
test("missing AC evidence fails at ship", () => {
|
|
138
|
-
const dir = join(TEST_BASE, "broken-evidence");
|
|
139
|
-
mkdirSync(dir, { recursive: true });
|
|
140
|
-
writeFileSync(join(dir, "workflow-state.json"), JSON.stringify({
|
|
141
|
-
schemaVersion: 2, issue: 9995, repo: "test/repo", issueRepo: "test/repo",
|
|
142
|
-
projectRoot: "/tmp/test", slug: "broken-evidence", phase: "DONE",
|
|
143
|
-
issueGoal: "Broken evidence test", sizing: { predicted: "S", ceremonyTier: "STANDARD" },
|
|
144
|
-
acs: [
|
|
145
|
-
{ id: "AC-1", type: "CODE", statement: "Has evidence from test run output", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "BUN_TEST", command: "bun test" }, evidence: { type: "command-output", content: "24 pass" }, verdict: "PASS" },
|
|
146
|
-
{ id: "AC-2", type: "CODE", statement: "Missing evidence for grep verification", threshold: { op: ">=", value: 10 }, evidenceMethod: { type: "grep", command: "grep x y" }, verdict: "PENDING" },
|
|
147
|
-
],
|
|
148
|
-
sourceSpecs: [{ path: join(process.env.HOME || "", "Projects/rungate/specs/BOOTSTRAP-DATA-FLOW-SPEC.md"), citedInDiscovery: true }],
|
|
149
|
-
gates: { scope: { result: "PASS", attempt: 1, failures: [] }, verify: { result: "PASS", attempt: 1, failures: [] } },
|
|
150
|
-
environments: { local: { api: "PASS", ui: "PASS", tests: "PASS" } },
|
|
151
|
-
agents: { marcus: { spawned: true, verdict: "PASS" } },
|
|
152
|
-
buildCommit: "abc1234", changelog: [], bootstrappedFrom: "ship-workflow"
|
|
153
|
-
}, null, 2));
|
|
154
|
-
writeFileSync(join(dir, "marcus-brief.md"), "# Marcus Brief\n\nCovers: AC-1, AC-2\n\n## AC-1\nHas evidence\n\n## AC-2\nMissing evidence\n");
|
|
155
|
-
const r = runGate("ship", "broken-evidence");
|
|
156
|
-
expect(r.output).toContain("all-acs-have-evidence");
|
|
157
|
-
});
|
|
158
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "bun:test";
|
|
2
|
-
import { readFileSync, existsSync } from "fs";
|
|
3
|
-
import { join, resolve } from "path";
|
|
4
|
-
|
|
5
|
-
const HARNESS_ROOT = resolve(import.meta.dir, "..");
|
|
6
|
-
const HOME = process.env.HOME || "";
|
|
7
|
-
const CLAUDE_MD = join(HOME, ".claude", "CLAUDE.md");
|
|
8
|
-
const HARNESS_MD = join(HARNESS_ROOT, "HARNESS.md");
|
|
9
|
-
|
|
10
|
-
function extractExternalDeps(harnessContent: string): string[] {
|
|
11
|
-
const section = harnessContent.split("## External Dependencies")[1];
|
|
12
|
-
if (!section) return [];
|
|
13
|
-
const nextSection = section.indexOf("\n## ");
|
|
14
|
-
const block = nextSection > -1 ? section.slice(0, nextSection) : section;
|
|
15
|
-
const deps: string[] = [];
|
|
16
|
-
for (const line of block.split("\n")) {
|
|
17
|
-
const match = line.match(/^- `([^`]+)`/);
|
|
18
|
-
if (match) deps.push(match[1]);
|
|
19
|
-
}
|
|
20
|
-
return deps;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe("ED-1: HARNESS.md has External Dependencies section", () => {
|
|
24
|
-
test("section exists", () => {
|
|
25
|
-
const content = readFileSync(HARNESS_MD, "utf8");
|
|
26
|
-
expect(content).toContain("## External Dependencies");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe("ED-2: Each external dependency exists in CLAUDE.md", () => {
|
|
31
|
-
const harness = readFileSync(HARNESS_MD, "utf8");
|
|
32
|
-
const deps = extractExternalDeps(harness);
|
|
33
|
-
const claudeContent = existsSync(CLAUDE_MD) ? readFileSync(CLAUDE_MD, "utf8") : "";
|
|
34
|
-
|
|
35
|
-
for (const dep of deps) {
|
|
36
|
-
test(`rule "${dep}" exists in CLAUDE.md`, () => {
|
|
37
|
-
expect(claudeContent).toContain(dep);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe("ED-3: At least 5 external dependencies listed", () => {
|
|
43
|
-
test("minimum dependency count", () => {
|
|
44
|
-
const content = readFileSync(HARNESS_MD, "utf8");
|
|
45
|
-
const deps = extractExternalDeps(content);
|
|
46
|
-
expect(deps.length).toBeGreaterThanOrEqual(5);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
doc-type: adr
|
|
3
|
-
status: accepted
|
|
4
|
-
created: 2026-08-15
|
|
5
|
-
owner: jason
|
|
6
|
-
updated: 2026-09-18
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# ADR-001: Use Hono as HTTP framework
|
|
10
|
-
|
|
11
|
-
## Context
|
|
12
|
-
|
|
13
|
-
Need a lightweight, fast HTTP framework for Bun runtime.
|
|
14
|
-
|
|
15
|
-
## Decision
|
|
16
|
-
|
|
17
|
-
Use Hono — native Bun support, minimal overhead, TypeScript-first.
|
|
18
|
-
|
|
19
|
-
## Consequences
|
|
20
|
-
|
|
21
|
-
- Fast cold starts
|
|
22
|
-
- Smaller dependency tree than Express
|
|
23
|
-
- Less middleware ecosystem than Express
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
doc-type: spec
|
|
3
|
-
status: draft
|
|
4
|
-
owner: test
|
|
5
|
-
created: 2026-09-01
|
|
6
|
-
updated: 2026-09-01
|
|
7
|
-
governs: API routes — health check and data endpoint behavior
|
|
8
|
-
testable: true
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# API Spec
|
|
12
|
-
|
|
13
|
-
## Problem Statement
|
|
14
|
-
|
|
15
|
-
API routes need documented behavior for agents to implement against.
|
|
16
|
-
|
|
17
|
-
## Success Criteria
|
|
18
|
-
|
|
19
|
-
- [ ] SC-1: GET /api/health returns `{"status":"ok"}` with 200
|
|
20
|
-
- [ ] SC-2: POST /api/data without Authorization header returns 401
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export async function query(sql: string): Promise<unknown[]> {
|
|
2
|
-
return [];
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export async function insert(table: string, data: Record<string, unknown>): Promise<{ id: number }> {
|
|
6
|
-
return { id: 1 };
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function migrate(): Promise<void> {
|
|
10
|
-
// run migrations
|
|
11
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import { validateToken } from "./auth";
|
|
3
|
-
|
|
4
|
-
const app = new Hono();
|
|
5
|
-
|
|
6
|
-
app.get("/", (c) => c.text("Golden Project"));
|
|
7
|
-
|
|
8
|
-
app.get("/api/health", (c) => c.json({ status: "ok" }));
|
|
9
|
-
|
|
10
|
-
app.post("/api/data", async (c) => {
|
|
11
|
-
const token = c.req.header("Authorization");
|
|
12
|
-
if (!validateToken(token)) {
|
|
13
|
-
return c.json({ error: "unauthorized" }, 401);
|
|
14
|
-
}
|
|
15
|
-
const body = await c.req.json();
|
|
16
|
-
return c.json({ received: body });
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export default app;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { test, expect } from "bun:test";
|
|
2
|
-
import { validateToken, refreshToken } from "../src/auth";
|
|
3
|
-
|
|
4
|
-
test("validateToken rejects undefined", () => {
|
|
5
|
-
expect(validateToken(undefined)).toBe(false);
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
test("validateToken accepts Bearer token", () => {
|
|
9
|
-
expect(validateToken("Bearer abc123")).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("refreshToken returns new Bearer token", () => {
|
|
13
|
-
const token = refreshToken("old");
|
|
14
|
-
expect(token).toStartWith("Bearer refreshed-");
|
|
15
|
-
});
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { test, expect, describe } from "bun:test";
|
|
2
|
-
import { readFileSync, existsSync } from "fs";
|
|
3
|
-
import { join } from "path";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
|
|
6
|
-
const SPEC_PATH = join(import.meta.dir, "..", "specs", "BOOTSTRAP-DATA-FLOW-SPEC.md");
|
|
7
|
-
const TEST_PLAN_PATH = join(import.meta.dir, "..", "specs", "BOOTSTRAP-TEST-PLAN.md");
|
|
8
|
-
|
|
9
|
-
// Phase header → test file mapping
|
|
10
|
-
const PHASE_MAP: Record<string, string> = {
|
|
11
|
-
"Phase 0": "phase-0",
|
|
12
|
-
"Phase 1": "phase-1",
|
|
13
|
-
"Phase 2": "phase-2",
|
|
14
|
-
"Phase 3": "phase-3",
|
|
15
|
-
"Anti-Criteria": "anti",
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// Parse SC-to-phase routing from ### subheaders in the Success Criteria section
|
|
19
|
-
function parseRouting(spec: string): Map<string, string> {
|
|
20
|
-
const routing = new Map<string, string>();
|
|
21
|
-
let currentPhase: string | null = null;
|
|
22
|
-
|
|
23
|
-
for (const line of spec.split("\n")) {
|
|
24
|
-
// Match phase subheaders: ### Phase 0 — Scaffold Output
|
|
25
|
-
const headerMatch = line.match(/^### (Phase \d+|Anti-Criteria)/);
|
|
26
|
-
if (headerMatch) {
|
|
27
|
-
const key = headerMatch[1];
|
|
28
|
-
currentPhase = PHASE_MAP[key] || null;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!currentPhase) continue;
|
|
33
|
-
|
|
34
|
-
// Match SC lines under current phase header
|
|
35
|
-
const scMatch = line.match(/^- \[ \] (SC-(?:\d+|A\d+)):/);
|
|
36
|
-
if (scMatch) {
|
|
37
|
-
routing.set(scMatch[1], currentPhase);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return routing;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
describe("meta: SC coverage — every SC in the spec has a test", () => {
|
|
45
|
-
test("all SCs from bootstrap spec appear in at least one test file", () => {
|
|
46
|
-
const spec = readFileSync(SPEC_PATH, "utf-8");
|
|
47
|
-
const routing = parseRouting(spec);
|
|
48
|
-
|
|
49
|
-
// Extract all SC IDs
|
|
50
|
-
const scMatches = [...spec.matchAll(/^- \[ \] (SC-(?:\d+|A\d+)):/gm)];
|
|
51
|
-
const allSCs = [...new Set(scMatches.map(m => m[1]))];
|
|
52
|
-
|
|
53
|
-
// Read all phase test files
|
|
54
|
-
const testFiles = ["phase-0.test.ts", "phase-1.test.ts", "phase-2.test.ts", "phase-3.test.ts", "anti.test.ts"]
|
|
55
|
-
.map(f => join(import.meta.dir, f))
|
|
56
|
-
.filter(f => existsSync(f));
|
|
57
|
-
|
|
58
|
-
const testContent = testFiles.map(f => readFileSync(f, "utf-8")).join("\n");
|
|
59
|
-
|
|
60
|
-
// Find SCs that appear in no test file
|
|
61
|
-
const untested = allSCs.filter(sc => !testContent.includes(sc));
|
|
62
|
-
|
|
63
|
-
// Find SCs not under any phase header (spec structure error)
|
|
64
|
-
const unrouted = allSCs.filter(sc => !routing.has(sc));
|
|
65
|
-
|
|
66
|
-
if (untested.length > 0) {
|
|
67
|
-
console.log(`\n── SC COVERAGE GAP ──────────────────────────`);
|
|
68
|
-
console.log(` ${allSCs.length} SCs in spec, ${allSCs.length - untested.length} tested, ${untested.length} UNTESTED`);
|
|
69
|
-
console.log(` Routed by ### Phase headers in Success Criteria section.\n`);
|
|
70
|
-
|
|
71
|
-
// Group by phase from section headers
|
|
72
|
-
const byPhase = new Map<string, string[]>();
|
|
73
|
-
for (const sc of untested) {
|
|
74
|
-
const phase = routing.get(sc) || "UNROUTED";
|
|
75
|
-
if (!byPhase.has(phase)) byPhase.set(phase, []);
|
|
76
|
-
byPhase.get(phase)!.push(sc);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
for (const [phase, scs] of [...byPhase.entries()].sort()) {
|
|
80
|
-
const file = phase === "UNROUTED" ? "— move SC under a ### Phase header" : `test/${phase}.test.ts`;
|
|
81
|
-
console.log(` ${phase} → ${file} (${scs.length} untested)`);
|
|
82
|
-
for (const sc of scs) {
|
|
83
|
-
const line = scMatches.find(m => m[1] === sc);
|
|
84
|
-
const scText = line ? line[0].substring(6, 90) : sc;
|
|
85
|
-
console.log(` ✗ ${scText}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
console.log(`──────────────────────────────────────────────\n`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (unrouted.length > 0) {
|
|
92
|
-
console.log(`\n── UNROUTED SCs (not under a ### Phase header) ──`);
|
|
93
|
-
console.log(` These SCs exist in the spec but are outside the phase-grouped section.`);
|
|
94
|
-
console.log(` Move them under the correct ### Phase header in ## Success Criteria.\n`);
|
|
95
|
-
for (const sc of unrouted) {
|
|
96
|
-
console.log(` ✗ ${sc}`);
|
|
97
|
-
}
|
|
98
|
-
console.log(`──────────────────────────────────────────────\n`);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const coverage = ((allSCs.length - untested.length) / allSCs.length * 100).toFixed(1);
|
|
102
|
-
console.log(`SC coverage: ${allSCs.length - untested.length}/${allSCs.length} (${coverage}%)`);
|
|
103
|
-
|
|
104
|
-
expect(untested).toEqual([]);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test("all SCs are under a phase header (no orphans)", () => {
|
|
108
|
-
const spec = readFileSync(SPEC_PATH, "utf-8");
|
|
109
|
-
const routing = parseRouting(spec);
|
|
110
|
-
|
|
111
|
-
const scMatches = [...spec.matchAll(/^- \[ \] (SC-(?:\d+|A\d+)):/gm)];
|
|
112
|
-
const allSCs = [...new Set(scMatches.map(m => m[1]))];
|
|
113
|
-
const unrouted = allSCs.filter(sc => !routing.has(sc));
|
|
114
|
-
|
|
115
|
-
if (unrouted.length > 0) {
|
|
116
|
-
console.log(`UNROUTED: ${unrouted.join(", ")}`);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
expect(unrouted).toEqual([]);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test("all TPs from test plan spec appear in at least one test file", () => {
|
|
123
|
-
if (!existsSync(TEST_PLAN_PATH)) return;
|
|
124
|
-
const testPlan = readFileSync(TEST_PLAN_PATH, "utf-8");
|
|
125
|
-
|
|
126
|
-
const tpMatches = [...testPlan.matchAll(/^- \[ \] (TP-\d+):/gm)];
|
|
127
|
-
const allTPs = [...new Set(tpMatches.map(m => m[1]))];
|
|
128
|
-
|
|
129
|
-
const testFiles = ["phase-0.test.ts", "phase-1.test.ts", "phase-2.test.ts", "phase-3.test.ts", "meta-sc-coverage.test.ts"]
|
|
130
|
-
.map(f => join(import.meta.dir, f))
|
|
131
|
-
.filter(f => existsSync(f));
|
|
132
|
-
|
|
133
|
-
const testContent = testFiles.map(f => readFileSync(f, "utf-8")).join("\n");
|
|
134
|
-
|
|
135
|
-
const untested = allTPs.filter(tp => !testContent.includes(tp));
|
|
136
|
-
|
|
137
|
-
if (untested.length > 0) {
|
|
138
|
-
console.log(`\n── TP COVERAGE GAP ──────────────────────────`);
|
|
139
|
-
console.log(` ${allTPs.length} TPs in test plan, ${untested.length} UNTESTED:`);
|
|
140
|
-
for (const tp of untested) {
|
|
141
|
-
console.log(` ✗ ${tp}`);
|
|
142
|
-
}
|
|
143
|
-
console.log(`──────────────────────────────────────────────\n`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
expect(untested).toEqual([]);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// TP-9: Meta-test validates SC coverage
|
|
150
|
-
test("TP-9: this meta-test exists and runs", () => {
|
|
151
|
-
expect(true).toBe(true);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// TP-3: Every SC appears in at least one phase test file
|
|
155
|
-
test("TP-3: phase test files exist", () => {
|
|
156
|
-
expect(existsSync(join(import.meta.dir, "phase-0.test.ts"))).toBe(true);
|
|
157
|
-
expect(existsSync(join(import.meta.dir, "phase-1.test.ts"))).toBe(true);
|
|
158
|
-
});
|
|
159
|
-
});
|