rungate 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/package.json +14 -3
  2. package/.claude/agents/aditi.md +0 -47
  3. package/.claude/agents/marcus.md +0 -50
  4. package/.claude/agents/quinn.md +0 -58
  5. package/.claude/agents/rook.md +0 -47
  6. package/.claude/agents/serena.md +0 -46
  7. package/.claude/rungate.json +0 -11
  8. package/.fallowrc.json +0 -28
  9. package/.github/copilot-instructions.md +0 -20
  10. package/.rungate/conformity-findings.json +0 -648
  11. package/AGENTS.md +0 -106
  12. package/CODE-MAP.md +0 -50
  13. package/HARNESS.md +0 -88
  14. package/bun.lock +0 -26
  15. package/bunfig.toml +0 -2
  16. package/config/brief-policies.json +0 -28
  17. package/config/ceremony-profiles.json +0 -212
  18. package/config/consumer-cascade-map.json +0 -24
  19. package/config/doc-cascade-map.json +0 -24
  20. package/config/eval.json +0 -84
  21. package/config/profiles/account-plan.yaml +0 -36
  22. package/config/profiles/campaign.yaml +0 -94
  23. package/config/prove-evidence.schema.json +0 -65
  24. package/config/spec-policies.json +0 -36
  25. package/config/workflow-schema.json +0 -281
  26. package/gates/SCHEMA-GUIDE.md +0 -121
  27. package/gates/ac-quality.test.ts +0 -106
  28. package/gates/adversarial.test.ts +0 -274
  29. package/gates/brief-assembler.test.ts +0 -429
  30. package/gates/brief-assembler.ts +0 -334
  31. package/gates/bunfig.toml +0 -2
  32. package/gates/chain.test.ts +0 -91
  33. package/gates/e2e-smoke.test.ts +0 -234
  34. package/gates/error-classifier.test.ts +0 -249
  35. package/gates/error-classifier.ts +0 -89
  36. package/gates/orchestrator.test.ts +0 -950
  37. package/gates/orchestrator.ts +0 -569
  38. package/gates/preload.ts +0 -77
  39. package/gates/prompts/ac-adversary.md +0 -20
  40. package/gates/prompts/evidence-validator.md +0 -22
  41. package/gates/prompts/prove-reproducer.md +0 -53
  42. package/gates/prove.test.ts +0 -164
  43. package/gates/run-gate.ts +0 -936
  44. package/gates/schema-parity.test.ts +0 -197
  45. package/gates/schema.ts +0 -362
  46. package/gates/self-heal.test.ts +0 -511
  47. package/gates/self-heal.ts +0 -121
  48. package/gates/ship-orchestrator.test.ts +0 -379
  49. package/gates/ship-orchestrator.ts +0 -363
  50. package/gates/test-fixtures/broken-no-environments.json +0 -60
  51. package/gates/test-fixtures/valid-standard.json +0 -54
  52. package/gates/test-utils.ts +0 -43
  53. package/gates/witness.ts +0 -220
  54. package/gates/workflow.test.ts +0 -1053
  55. package/hooks/AgentBriefGuard.hook.ts +0 -586
  56. package/hooks/AgentVerdictCapture.hook.ts +0 -134
  57. package/hooks/AutoVerifyGate.hook.ts +0 -76
  58. package/hooks/GateEnforcement.hook.ts +0 -273
  59. package/hooks/IssueCloseGuard.hook.ts +0 -116
  60. package/hooks/MergeGuard.hook.ts +0 -55
  61. package/hooks/StaleTTLCleanup.hook.ts +0 -133
  62. package/hooks/VerifyPhaseLock.hook.ts +0 -81
  63. package/hooks/WorkflowStateGuard.hook.ts +0 -37
  64. package/hooks/lib/agentDetection.ts +0 -70
  65. package/hooks/lib/findWorkflow.ts +0 -101
  66. package/hooks/lib/parseStdin.ts +0 -37
  67. package/hooks/lib/paths.ts +0 -111
  68. package/hooks/lib/utils.ts +0 -81
  69. package/reference/migration-manifest.json +0 -554
  70. package/reference/prompts/agent-aditi.md +0 -38
  71. package/reference/prompts/agent-marcus.md +0 -38
  72. package/reference/prompts/agent-quinn.md +0 -38
  73. package/reference/prompts/agent-rook.md +0 -37
  74. package/reference/prompts/agent-serena.md +0 -37
  75. package/reference/prompts/council-skill.md +0 -170
  76. package/reference/prompts/goal-skill.md +0 -235
  77. package/reference/prompts/prove-skill.md +0 -283
  78. package/reference/prompts/quinn-standard.md +0 -246
  79. package/reference/prompts/ship-convergence.md +0 -65
  80. package/reference/prompts/ship-escalation.md +0 -43
  81. package/reference/prompts/ship-iteration.md +0 -382
  82. package/reference/prompts/ship-pending-patches.md +0 -246
  83. package/reference/prompts/ship-reference.md +0 -250
  84. package/reference/prompts/ship-skill.md +0 -347
  85. package/reference/prompts/ship-templates.md +0 -215
  86. package/reference/scripts/batch-status.sh +0 -68
  87. package/reference/scripts/chain-compat-check.sh +0 -67
  88. package/reference/scripts/context-audit.sh +0 -314
  89. package/reference/scripts/dead-export-check.sh +0 -61
  90. package/reference/scripts/generate-qc-tables.sh +0 -92
  91. package/reference/scripts/harness-init.sh +0 -111
  92. package/reference/scripts/pai-054-baseline-check.sh +0 -40
  93. package/reference/scripts/prove-smoke-test.sh +0 -112
  94. package/reference/scripts/setup-keychain-salt.sh +0 -12
  95. package/reference/scripts/skill-optimizer-friday.sh +0 -88
  96. package/reference/scripts/skill-qc-test.sh +0 -351
  97. package/reference/scripts/skill-synthesize-tonight.sh +0 -66
  98. package/reference/specs/HARNESS-EXTRACTION-SPEC.md +0 -263
  99. package/reference/specs/harness-v3-bash-deletion-plan.md +0 -65
  100. package/reference/specs/harness-v3-migration-plan.md +0 -188
  101. package/scripts/decision-reconcile.sh +0 -74
  102. package/scripts/decision-reconcile.ts +0 -152
  103. package/scripts/git-hooks/pre-commit +0 -76
  104. package/scripts/git-hooks/pre-push +0 -271
  105. package/scripts/harness-skill-check.sh +0 -52
  106. package/scripts/lib/gap-emit.sh +0 -65
  107. package/scripts/lib/jq-update.sh +0 -30
  108. package/scripts/lib/resolve-slug.sh +0 -30
  109. package/scripts/lib/verify-spec-compliance.sh +0 -102
  110. package/scripts/prove-backfill.sh +0 -87
  111. package/scripts/scaffold-rungate-config.ts +0 -91
  112. package/scripts/self-containment-check.sh +0 -109
  113. package/scripts/skill-qc-validator.sh +0 -402
  114. package/scripts/slug-resolver.sh +0 -14
  115. package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +0 -2493
  116. package/specs/BOOTSTRAP-TEST-PLAN.md +0 -571
  117. package/specs/HARNESS-GATES.md +0 -256
  118. package/specs/HARNESS-SKILL-CHAIN.md +0 -286
  119. package/specs/HARNESS-SKILL-CONTRACT.md +0 -93
  120. package/specs/HARNESS-STANDARD.md +0 -488
  121. package/specs/SPEC-TEMPLATE.md +0 -53
  122. package/specs/bootstrap-data-flow.png +0 -0
  123. package/specs/harness-automation-matrix.md +0 -314
  124. package/specs/harness-automation-matrix.rules.json +0 -64
  125. package/test/anti.test.ts +0 -80
  126. package/test/contract-negative.test.ts +0 -86
  127. package/test/contract.test.ts +0 -158
  128. package/test/external-deps.test.ts +0 -48
  129. package/test/fixtures/golden-project/.env.example +0 -3
  130. package/test/fixtures/golden-project/Makefile +0 -7
  131. package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +0 -23
  132. package/test/fixtures/golden-project/docs/setup-guide.md +0 -10
  133. package/test/fixtures/golden-project/package.json +0 -10
  134. package/test/fixtures/golden-project/specs/api-spec.md +0 -20
  135. package/test/fixtures/golden-project/src/auth.ts +0 -8
  136. package/test/fixtures/golden-project/src/db.ts +0 -11
  137. package/test/fixtures/golden-project/src/index.ts +0 -19
  138. package/test/fixtures/golden-project/src/utils/format.ts +0 -3
  139. package/test/fixtures/golden-project/test/auth.test.ts +0 -15
  140. package/test/fixtures/golden-project/tsconfig.json +0 -12
  141. package/test/meta-sc-coverage.test.ts +0 -159
  142. package/test/phase-0.test.ts +0 -846
  143. package/test/phase-1.test.ts +0 -617
  144. package/test/phase-2.test.ts +0 -620
  145. package/test/phase-3.test.ts +0 -99
  146. package/test/scaffold-conformity.test.ts +0 -8
  147. package/test/schema-canary.test.ts +0 -51
  148. package/test/spec-compliance-auto.test.ts +0 -64
  149. package/test/spec-compliance.test.ts +0 -295
  150. package/test/spec-discovery.test.ts +0 -68
  151. package/test/spec-drift.test.ts +0 -5
  152. package/test/structure.test.ts +0 -165
  153. package/test/unit/agent-brief-guard-ship.test.ts +0 -293
  154. package/test/unit/extract-constraints.test.ts +0 -145
  155. package/test/unit/issue-close-guard.test.ts +0 -204
  156. package/test/unit/scaffold-project.test.ts +0 -417
  157. package/test/unit/skill-cooccurrence.test.ts +0 -177
  158. package/test/unit/skill-sequence-logger.test.ts +0 -244
  159. package/test/unit/workflow-state-guard.test.ts +0 -95
  160. package/workflows/batch-ship.js +0 -295
  161. package/workflows/council.js +0 -481
  162. package/workflows/prove.js +0 -560
  163. package/workflows/ship.js +0 -789
  164. package/workflows/verify.js +0 -236
@@ -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,3 +0,0 @@
1
- API_PORT=3000
2
- DATABASE_URL=
3
- SECRET_KEY=
@@ -1,7 +0,0 @@
1
- .PHONY: dev test
2
-
3
- dev:
4
- bun run src/index.ts --port 3000
5
-
6
- test:
7
- bun test
@@ -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,10 +0,0 @@
1
- ---
2
- doc-type: guide
3
- status: active
4
- owner: jason
5
- updated: 2026-09-01
6
- ---
7
-
8
- # Setup Guide
9
-
10
- Install dependencies with `bun install`, then run `bun run src/index.ts`.
@@ -1,10 +0,0 @@
1
- {
2
- "name": "golden-project",
3
- "type": "module",
4
- "scripts": {
5
- "dev": "bun run src/index.ts"
6
- },
7
- "dependencies": {
8
- "hono": "^4.0.0"
9
- }
10
- }
@@ -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,8 +0,0 @@
1
- export function validateToken(token: string | undefined): boolean {
2
- if (!token) return false;
3
- return token.startsWith("Bearer ");
4
- }
5
-
6
- export function refreshToken(oldToken: string): string {
7
- return `Bearer refreshed-${Date.now()}`;
8
- }
@@ -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,3 +0,0 @@
1
- export function formatDate(date: Date): string {
2
- return date.toISOString().split("T")[0];
3
- }
@@ -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,12 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "strict": true,
4
- "target": "ESNext",
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "esModuleInterop": true,
8
- "outDir": "dist",
9
- "rootDir": "src"
10
- },
11
- "include": ["src"]
12
- }
@@ -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
- });