@gate-forge/cli 0.7.1 → 0.9.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.
Files changed (296) hide show
  1. package/README.md +91 -704
  2. package/dist/adapter-audit.d.ts +208 -0
  3. package/dist/adapter-audit.d.ts.map +1 -0
  4. package/dist/adapter-audit.js +579 -0
  5. package/dist/adapter-audit.js.map +1 -0
  6. package/dist/adapter-scaffold.d.ts +91 -0
  7. package/dist/adapter-scaffold.d.ts.map +1 -0
  8. package/dist/adapter-scaffold.js +474 -0
  9. package/dist/adapter-scaffold.js.map +1 -0
  10. package/dist/adopted-baseline.d.ts +10 -0
  11. package/dist/adopted-baseline.d.ts.map +1 -1
  12. package/dist/adopted-baseline.js +18 -1
  13. package/dist/adopted-baseline.js.map +1 -1
  14. package/dist/args.d.ts +15 -0
  15. package/dist/args.d.ts.map +1 -1
  16. package/dist/args.js +61 -2
  17. package/dist/args.js.map +1 -1
  18. package/dist/behavior-setup.d.ts +239 -0
  19. package/dist/behavior-setup.d.ts.map +1 -0
  20. package/dist/behavior-setup.js +751 -0
  21. package/dist/behavior-setup.js.map +1 -0
  22. package/dist/broker.d.ts.map +1 -1
  23. package/dist/broker.js +28 -2
  24. package/dist/broker.js.map +1 -1
  25. package/dist/cache-exclusions.d.ts +45 -0
  26. package/dist/cache-exclusions.d.ts.map +1 -0
  27. package/dist/cache-exclusions.js +205 -0
  28. package/dist/cache-exclusions.js.map +1 -0
  29. package/dist/candidate-tree.d.ts +86 -14
  30. package/dist/candidate-tree.d.ts.map +1 -1
  31. package/dist/candidate-tree.js +236 -62
  32. package/dist/candidate-tree.js.map +1 -1
  33. package/dist/ci-witnessed-template.d.ts +43 -0
  34. package/dist/ci-witnessed-template.d.ts.map +1 -0
  35. package/dist/ci-witnessed-template.js +283 -0
  36. package/dist/ci-witnessed-template.js.map +1 -0
  37. package/dist/cli.d.ts +1 -1
  38. package/dist/cli.d.ts.map +1 -1
  39. package/dist/cli.js +31 -4
  40. package/dist/cli.js.map +1 -1
  41. package/dist/commands/adapters.d.ts +15 -0
  42. package/dist/commands/adapters.d.ts.map +1 -0
  43. package/dist/commands/adapters.js +355 -0
  44. package/dist/commands/adapters.js.map +1 -0
  45. package/dist/commands/adopt.d.ts +7 -0
  46. package/dist/commands/adopt.d.ts.map +1 -1
  47. package/dist/commands/adopt.js +44 -2
  48. package/dist/commands/adopt.js.map +1 -1
  49. package/dist/commands/baseline.d.ts.map +1 -1
  50. package/dist/commands/baseline.js +42 -1
  51. package/dist/commands/baseline.js.map +1 -1
  52. package/dist/commands/blocking.d.ts +105 -2
  53. package/dist/commands/blocking.d.ts.map +1 -1
  54. package/dist/commands/blocking.js +395 -53
  55. package/dist/commands/blocking.js.map +1 -1
  56. package/dist/commands/check.d.ts +36 -0
  57. package/dist/commands/check.d.ts.map +1 -1
  58. package/dist/commands/check.js +1068 -64
  59. package/dist/commands/check.js.map +1 -1
  60. package/dist/commands/classify.d.ts +2 -1
  61. package/dist/commands/classify.d.ts.map +1 -1
  62. package/dist/commands/classify.js +188 -5
  63. package/dist/commands/classify.js.map +1 -1
  64. package/dist/commands/enforce.d.ts +4 -4
  65. package/dist/commands/enforce.d.ts.map +1 -1
  66. package/dist/commands/enforce.js +41 -9
  67. package/dist/commands/enforce.js.map +1 -1
  68. package/dist/commands/enforcement.d.ts +13 -1
  69. package/dist/commands/enforcement.d.ts.map +1 -1
  70. package/dist/commands/enforcement.js +880 -33
  71. package/dist/commands/enforcement.js.map +1 -1
  72. package/dist/commands/explain.d.ts +1 -1
  73. package/dist/commands/explain.d.ts.map +1 -1
  74. package/dist/commands/explain.js +162 -3
  75. package/dist/commands/explain.js.map +1 -1
  76. package/dist/commands/history.d.ts +12 -0
  77. package/dist/commands/history.d.ts.map +1 -0
  78. package/dist/commands/history.js +45 -0
  79. package/dist/commands/history.js.map +1 -0
  80. package/dist/commands/init-presets.d.ts +155 -0
  81. package/dist/commands/init-presets.d.ts.map +1 -0
  82. package/dist/commands/init-presets.js +203 -0
  83. package/dist/commands/init-presets.js.map +1 -0
  84. package/dist/commands/init.d.ts +7 -12
  85. package/dist/commands/init.d.ts.map +1 -1
  86. package/dist/commands/init.js +987 -99
  87. package/dist/commands/init.js.map +1 -1
  88. package/dist/commands/keys.d.ts.map +1 -1
  89. package/dist/commands/keys.js +29 -13
  90. package/dist/commands/keys.js.map +1 -1
  91. package/dist/commands/next.d.ts.map +1 -1
  92. package/dist/commands/next.js +846 -19
  93. package/dist/commands/next.js.map +1 -1
  94. package/dist/commands/pre-commit.d.ts +25 -0
  95. package/dist/commands/pre-commit.d.ts.map +1 -1
  96. package/dist/commands/pre-commit.js +91 -6
  97. package/dist/commands/pre-commit.js.map +1 -1
  98. package/dist/commands/quarantine.d.ts +16 -0
  99. package/dist/commands/quarantine.d.ts.map +1 -0
  100. package/dist/commands/quarantine.js +213 -0
  101. package/dist/commands/quarantine.js.map +1 -0
  102. package/dist/commands/run.d.ts +39 -0
  103. package/dist/commands/run.d.ts.map +1 -0
  104. package/dist/commands/run.js +196 -0
  105. package/dist/commands/run.js.map +1 -0
  106. package/dist/commands/test-gates.d.ts +284 -2
  107. package/dist/commands/test-gates.d.ts.map +1 -1
  108. package/dist/commands/test-gates.js +3620 -187
  109. package/dist/commands/test-gates.js.map +1 -1
  110. package/dist/commands/tests.d.ts +1 -1
  111. package/dist/commands/tests.d.ts.map +1 -1
  112. package/dist/commands/tests.js +264 -29
  113. package/dist/commands/tests.js.map +1 -1
  114. package/dist/docs-exclusions.d.ts.map +1 -1
  115. package/dist/docs-exclusions.js +18 -3
  116. package/dist/docs-exclusions.js.map +1 -1
  117. package/dist/endpoint-compiler.d.ts.map +1 -1
  118. package/dist/endpoint-compiler.js +78 -9
  119. package/dist/endpoint-compiler.js.map +1 -1
  120. package/dist/engine-browser.d.ts +183 -0
  121. package/dist/engine-browser.d.ts.map +1 -0
  122. package/dist/engine-browser.js +381 -0
  123. package/dist/engine-browser.js.map +1 -0
  124. package/dist/engine-identity.d.ts +100 -0
  125. package/dist/engine-identity.d.ts.map +1 -0
  126. package/dist/engine-identity.js +182 -0
  127. package/dist/engine-identity.js.map +1 -0
  128. package/dist/evaluate.d.ts +105 -1
  129. package/dist/evaluate.d.ts.map +1 -1
  130. package/dist/evaluate.js +149 -18
  131. package/dist/evaluate.js.map +1 -1
  132. package/dist/execution.d.ts +253 -9
  133. package/dist/execution.d.ts.map +1 -1
  134. package/dist/execution.js +309 -12
  135. package/dist/execution.js.map +1 -1
  136. package/dist/gateforge-owned.d.ts +78 -0
  137. package/dist/gateforge-owned.d.ts.map +1 -0
  138. package/dist/gateforge-owned.js +254 -0
  139. package/dist/gateforge-owned.js.map +1 -0
  140. package/dist/git-hooks.d.ts +35 -0
  141. package/dist/git-hooks.d.ts.map +1 -1
  142. package/dist/git-hooks.js +140 -1
  143. package/dist/git-hooks.js.map +1 -1
  144. package/dist/git-ignored.d.ts +27 -0
  145. package/dist/git-ignored.d.ts.map +1 -0
  146. package/dist/git-ignored.js +102 -0
  147. package/dist/git-ignored.js.map +1 -0
  148. package/dist/git-objects.d.ts +60 -0
  149. package/dist/git-objects.d.ts.map +1 -0
  150. package/dist/git-objects.js +152 -0
  151. package/dist/git-objects.js.map +1 -0
  152. package/dist/glob.d.ts +33 -14
  153. package/dist/glob.d.ts.map +1 -1
  154. package/dist/glob.js +96 -5
  155. package/dist/glob.js.map +1 -1
  156. package/dist/history.d.ts +52 -0
  157. package/dist/history.d.ts.map +1 -0
  158. package/dist/history.js +116 -0
  159. package/dist/history.js.map +1 -0
  160. package/dist/host-load.d.ts +49 -0
  161. package/dist/host-load.d.ts.map +1 -0
  162. package/dist/host-load.js +78 -0
  163. package/dist/host-load.js.map +1 -0
  164. package/dist/index.d.ts +4 -1
  165. package/dist/index.d.ts.map +1 -1
  166. package/dist/index.js +2 -1
  167. package/dist/index.js.map +1 -1
  168. package/dist/input-snapshot.d.ts +63 -9
  169. package/dist/input-snapshot.d.ts.map +1 -1
  170. package/dist/input-snapshot.js +195 -17
  171. package/dist/input-snapshot.js.map +1 -1
  172. package/dist/io.d.ts +49 -0
  173. package/dist/io.d.ts.map +1 -1
  174. package/dist/io.js +22 -0
  175. package/dist/io.js.map +1 -1
  176. package/dist/mapping.d.ts +84 -1
  177. package/dist/mapping.d.ts.map +1 -1
  178. package/dist/mapping.js +276 -5
  179. package/dist/mapping.js.map +1 -1
  180. package/dist/native-freeze.d.ts +217 -0
  181. package/dist/native-freeze.d.ts.map +1 -0
  182. package/dist/native-freeze.js +332 -0
  183. package/dist/native-freeze.js.map +1 -0
  184. package/dist/pipeline.d.ts +67 -1
  185. package/dist/pipeline.d.ts.map +1 -1
  186. package/dist/pipeline.js +164 -6
  187. package/dist/pipeline.js.map +1 -1
  188. package/dist/planes-inference.d.ts +12 -5
  189. package/dist/planes-inference.d.ts.map +1 -1
  190. package/dist/planes-inference.js +13 -15
  191. package/dist/planes-inference.js.map +1 -1
  192. package/dist/playwright-browsers.d.ts +210 -0
  193. package/dist/playwright-browsers.d.ts.map +1 -0
  194. package/dist/playwright-browsers.js +364 -0
  195. package/dist/playwright-browsers.js.map +1 -0
  196. package/dist/plugins.d.ts +15 -5
  197. package/dist/plugins.d.ts.map +1 -1
  198. package/dist/plugins.js +59 -9
  199. package/dist/plugins.js.map +1 -1
  200. package/dist/progress.d.ts +148 -0
  201. package/dist/progress.d.ts.map +1 -0
  202. package/dist/progress.js +263 -0
  203. package/dist/progress.js.map +1 -0
  204. package/dist/providers.d.ts +26 -1
  205. package/dist/providers.d.ts.map +1 -1
  206. package/dist/providers.js +39 -0
  207. package/dist/providers.js.map +1 -1
  208. package/dist/receipts.d.ts +1 -0
  209. package/dist/receipts.d.ts.map +1 -1
  210. package/dist/receipts.js +35 -7
  211. package/dist/receipts.js.map +1 -1
  212. package/dist/repo-scan.d.ts +15 -1
  213. package/dist/repo-scan.d.ts.map +1 -1
  214. package/dist/repo-scan.js +329 -34
  215. package/dist/repo-scan.js.map +1 -1
  216. package/dist/reseal-chain.d.ts +184 -0
  217. package/dist/reseal-chain.d.ts.map +1 -0
  218. package/dist/reseal-chain.js +735 -0
  219. package/dist/reseal-chain.js.map +1 -0
  220. package/dist/reseal-evidence.d.ts +241 -0
  221. package/dist/reseal-evidence.d.ts.map +1 -0
  222. package/dist/reseal-evidence.js +319 -0
  223. package/dist/reseal-evidence.js.map +1 -0
  224. package/dist/reseal.d.ts +181 -0
  225. package/dist/reseal.d.ts.map +1 -0
  226. package/dist/reseal.js +1620 -0
  227. package/dist/reseal.js.map +1 -0
  228. package/dist/response-field-guidance.d.ts +82 -0
  229. package/dist/response-field-guidance.d.ts.map +1 -0
  230. package/dist/response-field-guidance.js +184 -0
  231. package/dist/response-field-guidance.js.map +1 -0
  232. package/dist/route-plane-proposals.d.ts +100 -0
  233. package/dist/route-plane-proposals.d.ts.map +1 -0
  234. package/dist/route-plane-proposals.js +213 -0
  235. package/dist/route-plane-proposals.js.map +1 -0
  236. package/dist/run-cache.d.ts +260 -0
  237. package/dist/run-cache.d.ts.map +1 -0
  238. package/dist/run-cache.js +771 -0
  239. package/dist/run-cache.js.map +1 -0
  240. package/dist/run-preflight.d.ts +77 -0
  241. package/dist/run-preflight.d.ts.map +1 -0
  242. package/dist/run-preflight.js +774 -0
  243. package/dist/run-preflight.js.map +1 -0
  244. package/dist/run-recipe.d.ts +107 -0
  245. package/dist/run-recipe.d.ts.map +1 -0
  246. package/dist/run-recipe.js +295 -0
  247. package/dist/run-recipe.js.map +1 -0
  248. package/dist/run-reliability.d.ts +126 -0
  249. package/dist/run-reliability.d.ts.map +1 -0
  250. package/dist/run-reliability.js +221 -0
  251. package/dist/run-reliability.js.map +1 -0
  252. package/dist/runtime.d.ts +15 -0
  253. package/dist/runtime.d.ts.map +1 -1
  254. package/dist/runtime.js +11 -1
  255. package/dist/runtime.js.map +1 -1
  256. package/dist/scope.d.ts +20 -0
  257. package/dist/scope.d.ts.map +1 -1
  258. package/dist/scope.js +26 -5
  259. package/dist/scope.js.map +1 -1
  260. package/dist/secret-guard.d.ts +36 -0
  261. package/dist/secret-guard.d.ts.map +1 -0
  262. package/dist/secret-guard.js +63 -0
  263. package/dist/secret-guard.js.map +1 -0
  264. package/dist/singleton-guidance.d.ts +82 -0
  265. package/dist/singleton-guidance.d.ts.map +1 -0
  266. package/dist/singleton-guidance.js +138 -0
  267. package/dist/singleton-guidance.js.map +1 -0
  268. package/dist/staged-candidate.d.ts +17 -0
  269. package/dist/staged-candidate.d.ts.map +1 -1
  270. package/dist/staged-candidate.js +50 -0
  271. package/dist/staged-candidate.js.map +1 -1
  272. package/dist/state-artifacts.d.ts +70 -0
  273. package/dist/state-artifacts.d.ts.map +1 -0
  274. package/dist/state-artifacts.js +215 -0
  275. package/dist/state-artifacts.js.map +1 -0
  276. package/dist/state.d.ts +170 -2
  277. package/dist/state.d.ts.map +1 -1
  278. package/dist/state.js +248 -8
  279. package/dist/state.js.map +1 -1
  280. package/dist/unmatched-routes.d.ts +60 -0
  281. package/dist/unmatched-routes.d.ts.map +1 -0
  282. package/dist/unmatched-routes.js +131 -0
  283. package/dist/unmatched-routes.js.map +1 -0
  284. package/dist/verifier-keys.d.ts +33 -2
  285. package/dist/verifier-keys.d.ts.map +1 -1
  286. package/dist/verifier-keys.js +95 -9
  287. package/dist/verifier-keys.js.map +1 -1
  288. package/guides/CONNECT-YOUR-PROJECT.md +425 -0
  289. package/guides/QUICKSTART.md +306 -26
  290. package/guides/REFERENCE.md +1710 -0
  291. package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
  292. package/guides/TEST-ENVIRONMENT.md +1044 -6
  293. package/guides/UPGRADE-0.6-to-0.7.md +3 -3
  294. package/guides/UPGRADE-0.7-to-0.8.md +114 -0
  295. package/guides/UPGRADE-0.8-to-0.9.md +104 -0
  296. package/package.json +10 -9
@@ -0,0 +1,196 @@
1
+ /**
2
+ * `gateforge run` (managed-run plan, Part B, feedback E56).
3
+ *
4
+ * One command that performs a whole local witnessed proof, in the
5
+ * order a careful engineer would:
6
+ *
7
+ * 1. doctor preflight (STRICT — the first failing precondition ends
8
+ * the run before a minute is spent);
9
+ * 2. the app recipe: `prepare` → `reset` → `seed` → `services_up` →
10
+ * `healthcheck`;
11
+ * 3. `gateforge test-gates` (supervised; the user's own flags are
12
+ * passed through unchanged);
13
+ * 4. `gateforge check --require-e2e` (the strict receipt check; a
14
+ * scoped run, `--scope changed`, is checked at that changed scope
15
+ * with `check --changed --require-e2e`);
16
+ * 5. the recipe's `services_down`, ALWAYS — after success, after a
17
+ * failing gate, and after a failing recipe step.
18
+ *
19
+ * It adds NO authority. Every step is an existing command with its
20
+ * existing verdict: the recipe is the app's own shell, and the only
21
+ * things this module contributes are ORDER, one plain line per step
22
+ * with its duration, and an exit code that is the first failing step's
23
+ * own code. Recipe output goes to a log file under the run-state
24
+ * directory (it may contain secrets) and never to the console.
25
+ *
26
+ * Exit codes (the first failing step wins):
27
+ *
28
+ * | step | code |
29
+ * |-------------------------|--------------------------------------------------------------------------|
30
+ * | usage / config / recipe | 2 |
31
+ * | preflight FAIL | 1 |
32
+ * | recipe step | the command's own code; 124 on timeout, 127 when it could not start |
33
+ * | `test-gates` | its own code (1 unresolved obligations or a failed suite, 2 config) |
34
+ * | `check --require-e2e` | its own code (1 no verifying receipt, 2 config) |
35
+ * | success | 0 |
36
+ */
37
+ import { parseArgs } from '../args.js';
38
+ import { UsageError } from '../errors.js';
39
+ import { writeLine } from '../io.js';
40
+ import { loadConfigAt, rejectUnknownFlags } from './common.js';
41
+ import { checkCommand } from './check.js';
42
+ import { testGatesCommand } from './test-gates.js';
43
+ import { loadRunRecipe, recipeSetupSteps, runRecipeStep } from '../run-recipe.js';
44
+ import { buildRunPreflight, firstFailingCheck } from '../run-preflight.js';
45
+ export const RUN_USAGE = 'usage: gateforge run [--] [test-gates flags]';
46
+ /**
47
+ * The strict check that closes a run, at the scope the run sealed.
48
+ *
49
+ * A `--scope changed` receipt covers only the changed slice, so the
50
+ * matching strict check is diff-scoped (`--changed`); every other run
51
+ * sealed a whole receipt and is checked whole, exactly as before.
52
+ *
53
+ * Args:
54
+ * passthrough: the flags `run` passed to `test-gates`.
55
+ *
56
+ * Returns:
57
+ * string[]: the `check` arguments.
58
+ */
59
+ export function strictCheckArgs(passthrough) {
60
+ const scope = parseArgs(passthrough).options['scope'];
61
+ return scope === 'changed' ? ['--changed', '--require-e2e'] : ['--require-e2e'];
62
+ }
63
+ /**
64
+ * Runs the whole managed local proof.
65
+ *
66
+ * Args:
67
+ * io: process context.
68
+ * argv: `run`'s own flags plus the flags to pass to `test-gates`.
69
+ *
70
+ * Returns:
71
+ * Promise<number>: the first failing step's code (0 on success).
72
+ * @throws UsageError on a usage error (exit 2).
73
+ */
74
+ export async function runCommand(io, argv) {
75
+ const separator = argv.indexOf('--');
76
+ const own = separator === -1 ? argv : argv.slice(0, separator);
77
+ const passthrough = separator === -1 ? [] : argv.slice(separator + 1);
78
+ const { options, positionals } = parseArgs(own);
79
+ if (options['help'] === true) {
80
+ writeLine(io.stdout, RUN_USAGE);
81
+ return 0;
82
+ }
83
+ if (positionals.length > 0) {
84
+ throw new UsageError(`unexpected argument '${positionals[0] ?? ''}' (${RUN_USAGE})`);
85
+ }
86
+ // Every flag this command does not declare belongs to the supervised
87
+ // run: `gateforge run -- --changed` is the honest spelling, and an
88
+ // undeclared flag here is a typo worth naming rather than forwarding.
89
+ rejectUnknownFlags(options, ['help'], RUN_USAGE);
90
+ const config = loadConfigAt(io.cwd);
91
+ const recipe = loadRunRecipe(io.cwd, config);
92
+ const started = Date.now();
93
+ const report = (name, durationMs) => {
94
+ writeLine(io.stdout, ` [step] ${name}: ${formatDuration(durationMs)}`);
95
+ };
96
+ const preflightStarted = Date.now();
97
+ // An external witness's proxy fronts the target: probing it before the
98
+ // run binds would count as an observed exchange and break the run.
99
+ const externalWitness = passthrough.some((arg) => arg === '--witness-url' || arg.startsWith('--witness-url='));
100
+ const preflight = await buildRunPreflight(io, { externalWitness });
101
+ report('preflight', Date.now() - preflightStarted);
102
+ for (const check of preflight.checks) {
103
+ writeLine(io.stdout, ` [${check.status.toUpperCase()}] ${check.id}: ${check.detail}`);
104
+ }
105
+ const failure = firstFailingCheck(preflight);
106
+ if (failure !== null) {
107
+ writeLine(io.stderr, `run: preflight failed — [${failure.id}] ${failure.detail}`);
108
+ return 1;
109
+ }
110
+ const failed = await runRecipeSetup(io, recipe, report);
111
+ let code = 0;
112
+ if (failed === null) {
113
+ const gatesStarted = Date.now();
114
+ code = await testGatesCommand(io, passthrough);
115
+ report('test-gates', Date.now() - gatesStarted);
116
+ if (code === 0) {
117
+ const checkStarted = Date.now();
118
+ const checkArgs = strictCheckArgs(passthrough);
119
+ code = await checkCommand(io, checkArgs);
120
+ report(`check ${checkArgs.join(' ')}`, Date.now() - checkStarted);
121
+ }
122
+ }
123
+ else {
124
+ code = failed.code;
125
+ }
126
+ await runRecipeTeardown(io, recipe, report);
127
+ writeLine(io.stdout, `gateforge run: ${code === 0 ? 'complete' : 'FAILED'} in ${formatDuration(Date.now() - started)} (exit ${String(code)})`);
128
+ return code;
129
+ }
130
+ /**
131
+ * Runs the recipe's setup steps in lifecycle order and stops at the
132
+ * first failure, reporting each step with its duration.
133
+ *
134
+ * Args:
135
+ * io: process context.
136
+ * recipe: the loaded recipe, or null when the app declares none.
137
+ * report: prints one plain line per step with its duration.
138
+ *
139
+ * Returns:
140
+ * Promise<FailedStep | null>: the first failure, or null.
141
+ */
142
+ async function runRecipeSetup(io, recipe, report) {
143
+ for (const step of recipeSetupSteps(recipe)) {
144
+ const outcome = await runRecipeStep(step, io.cwd, io.env, {
145
+ envFiles: recipe?.envFiles ?? [],
146
+ logName: step.name,
147
+ });
148
+ report(step.name, outcome.durationMs);
149
+ if (outcome.code !== 0) {
150
+ writeLine(io.stderr, `run: recipe step '${step.name}' failed with exit ${String(outcome.code)} — output: ${outcome.logPath}`);
151
+ return { step, code: outcome.code };
152
+ }
153
+ }
154
+ return null;
155
+ }
156
+ /**
157
+ * Runs the recipe's `services_down` step, always: after success, after
158
+ * a failing gate, and after a failing setup step. A failing teardown is
159
+ * reported, never silently swallowed.
160
+ *
161
+ * Args:
162
+ * io: process context.
163
+ * recipe: the loaded recipe, or null when the app declares none.
164
+ * report: prints one plain line per step with its duration.
165
+ */
166
+ async function runRecipeTeardown(io, recipe, report) {
167
+ const teardown = recipe === null ? null : recipe.services_down;
168
+ if (teardown === null)
169
+ return;
170
+ const outcome = await runRecipeStep(teardown, io.cwd, io.env, {
171
+ envFiles: recipe === null ? [] : recipe.envFiles,
172
+ logName: 'services_down',
173
+ });
174
+ report('services_down', outcome.durationMs);
175
+ if (outcome.code !== 0) {
176
+ writeLine(io.stderr, `run: recipe step 'services_down' failed with exit ${String(outcome.code)} — output: ${outcome.logPath}`);
177
+ }
178
+ }
179
+ /**
180
+ * Formats a duration as a short human line.
181
+ *
182
+ * Args:
183
+ * durationMs: milliseconds.
184
+ *
185
+ * Returns:
186
+ * string: e.g. `820ms`, `1.2s` or `2m 03s`.
187
+ */
188
+ export function formatDuration(durationMs) {
189
+ if (durationMs < 1_000)
190
+ return `${String(durationMs)}ms`;
191
+ const seconds = durationMs / 1_000;
192
+ if (seconds < 60)
193
+ return `${seconds.toFixed(1)}s`;
194
+ return `${String(Math.floor(seconds / 60))}m ${String(Math.floor(seconds % 60)).padStart(2, '0')}s`;
195
+ }
196
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAA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,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE;QAC5D,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ;QAChD,OAAO,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,qDAAqD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACjI,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,IAAI,UAAU,GAAG,KAAK;QAAE,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;IACzD,MAAM,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC;IACnC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAClD,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;AACtG,CAAC"}
@@ -1,5 +1,7 @@
1
- import { type BehaviorCatalog, type ObligationVerdict } from '@gate-forge/core';
1
+ import { type BehaviorCatalog, type BlockingEntry, type ExecutionResult, type GateforgeConfig, type GateReceipt, type ObligationVerdict, type RunRecord, type LoadedQuarantine, type Obligation, type TestCatalog, type TwinLink } from '@gate-forge/core';
2
2
  import type { Io } from '../io.js';
3
+ import { type ResealChangeClassification } from '../reseal.js';
4
+ import { type PreparedCandidateIdentity } from '../native-freeze.js';
3
5
  import type { RuntimeReuseMount } from '../runtime-reuse.js';
4
6
  import { type VerifierKeyring } from '../verifier-keys.js';
5
7
  export declare const TEST_GATES_USAGE: string;
@@ -46,6 +48,12 @@ export interface SupervisedOptions {
46
48
  runToken: string | undefined;
47
49
  /** Whole-run wall-clock bound ms (undefined = 30-minute default). */
48
50
  runTimeoutMs: number | undefined;
51
+ /**
52
+ * `--progress` target (additive): `stderr`, `file:<path>`, `off`, or
53
+ * undefined for the `run.progress` config key and then the CI-aware
54
+ * `auto` default (stderr under CI, off locally).
55
+ */
56
+ progress?: string;
49
57
  /**
50
58
  * Evaluation scope (Goal 2): `full` (default, unchanged behavior) runs
51
59
  * the whole relevant suite and seals a whole-repo receipt; `changed`
@@ -54,6 +62,21 @@ export interface SupervisedOptions {
54
62
  scope: 'full' | 'changed';
55
63
  /** Report the selected slice without writing or clearing a gate receipt. */
56
64
  resultOnly?: boolean;
65
+ /**
66
+ * Hand-picked test selectors (`--test`), resolved against the planned
67
+ * rows. Only ever combined with `resultOnly`: a named run reports, it
68
+ * never seals.
69
+ */
70
+ testSelectors?: readonly string[];
71
+ /**
72
+ * The resolved timing-chaos plan (`--chaos <seed>` with the
73
+ * `run.chaos` bounds). Present only for an explicit chaos run, and
74
+ * only ever together with `resultOnly`: a chaos run reports, it
75
+ * never seals.
76
+ */
77
+ chaos?: {
78
+ seed: number;
79
+ } | null;
57
80
  /** Trusted key ring resolved before candidate materialization, when provided. */
58
81
  verifierKeyring?: VerifierKeyring | null;
59
82
  /** Trusted staged-candidate changed paths supplied by the pre-commit orchestrator. */
@@ -68,7 +91,253 @@ export interface SupervisedOptions {
68
91
  runtimeReuseMounts?: readonly RuntimeReuseMount[];
69
92
  /** Recomputes the external reuse digest at the end of a staged run. */
70
93
  runtimeReuseCheck?: () => string | null;
94
+ /**
95
+ * Receives the PREPARED candidate identity the moment the global native
96
+ * preparation freeze accepts it.
97
+ *
98
+ * It exists because that identity must never leave this process as a
99
+ * state document: the staged pre-commit orchestrator needs the exact
100
+ * tree the supervised run actually tested in order to hand the same
101
+ * identity to the strict check that follows inside the isolated
102
+ * checkout. A callback keeps it a typed in-memory value instead of a
103
+ * file a later run could have rewritten. A run that never freezes
104
+ * anything simply never calls it.
105
+ */
106
+ onPreparedCandidate?: (identity: PreparedCandidateIdentity) => void;
107
+ }
108
+ /** One recorded chaos release decision, exactly as the witness reports it. */
109
+ export interface ChaosScheduleResponse {
110
+ /** Supervisor-issued test id the plan released under (never a secret). */
111
+ session: string;
112
+ /** `METHOD /pathname` (query stripped) — never a secret. */
113
+ routeKey: string;
114
+ /** 1-based index of the request under its route key. */
115
+ k: number;
116
+ /** The planned release offset: a pure function of seed/session/route/k. */
117
+ plannedDelayMs: number;
118
+ /** Milliseconds the response was actually held back. */
119
+ delayMs: number;
120
+ /** True when the plan released this response before the previous one. */
121
+ releasedBefore: boolean;
122
+ }
123
+ /** The timing-chaos plan one `--chaos <seed>` run executes under (E63). */
124
+ export interface ChaosRun {
125
+ /** The seed the owner typed; the whole schedule is a function of it. */
126
+ seed: number;
127
+ /** Upper bound of every applied delay, in whole milliseconds. */
128
+ maxDelayMs: number;
129
+ /** Whether a later response may be released before an earlier one. */
130
+ reorder: boolean;
131
+ }
132
+ /** The run options this CLI hands a witness with the run context. */
133
+ export interface WitnessRunOptions {
134
+ chaos?: ChaosRun;
135
+ twinShapes?: {
136
+ queryKeys: readonly string[];
137
+ inventory: readonly string[];
138
+ };
139
+ }
140
+ /** The run options a witness confirmed it is applying. */
141
+ export interface AppliedWitnessOptions {
142
+ chaos: ChaosRun | null;
143
+ twinShapes: {
144
+ queryKeys: readonly string[];
145
+ inventory?: readonly string[];
146
+ } | null;
147
+ }
148
+ /**
149
+ * The plain line for a linked twin pair that ran but could not be
150
+ * compared, because a side sent no request through the witness.
151
+ *
152
+ * Args:
153
+ * link: the linked pair.
154
+ * witnessedObserved: whether the witnessed test's requests were seen.
155
+ * rawObserved: whether the raw test's requests were seen.
156
+ *
157
+ * Returns:
158
+ * string: the stderr line naming the unobserved side and the fix.
159
+ */
160
+ export declare function twinPairNotComparedLine(link: TwinLink, witnessedObserved: boolean, rawObserved: boolean): string;
161
+ /** One resolved `--test` selector and the planned logical keys it named. */
162
+ export interface NamedTestSelection {
163
+ /** The selector exactly as the operator typed it. */
164
+ selector: string;
165
+ /** The planned logical keys it resolved to (sorted, never empty). */
166
+ logicalKeys: string[];
71
167
  }
168
+ /**
169
+ * Resolves hand-picked `--test` selectors against the PLANNED rows (the
170
+ * expected set fixed before the run), never against raw runner output:
171
+ * a selector can only ever name a test the gate already planned.
172
+ *
173
+ * A selector matches an exact logical key first, then a
174
+ * case-insensitive substring of one. Zero matches and ambiguous
175
+ * substrings both fail closed (exit 2) with the candidate keys listed.
176
+ *
177
+ * Args:
178
+ * selectors: the selectors as typed, in argv order.
179
+ * rows: the planned rows (only their logical keys are read).
180
+ *
181
+ * Returns:
182
+ * NamedTestSelection[]: one entry per selector, in argv order.
183
+ * @throws UsageError (exit 2) when a selector matches nothing or more
184
+ * than one planned test.
185
+ */
186
+ export declare function resolveTestSelectors(selectors: readonly string[], rows: readonly {
187
+ logicalKey: string;
188
+ }[]): NamedTestSelection[];
189
+ /** The sealed parent a re-seal carries from, and what it proved. */
190
+ export interface ResealParent {
191
+ /** Which kind of document the parent is: a gate receipt or a run record. */
192
+ kind: 'receipt' | 'run-record';
193
+ /** Canonical digest of the parent document (the receipt/record's own hash). */
194
+ digest: string;
195
+ /** The parent receipt, or null for a run-record parent. */
196
+ receipt: GateReceipt | null;
197
+ /** The parent run record, or null for a receipt parent. */
198
+ record: RunRecord | null;
199
+ /** The parent document's sealed candidate tree. */
200
+ treeId: string;
201
+ /** The commit the parent run/receipt sealed. */
202
+ sha: string;
203
+ /** The parent's own execution result (its attested outcomes). */
204
+ execution: ExecutionResult;
205
+ }
206
+ /** The repository coordinates BOTH parent verifiers are held to. */
207
+ export interface ResealParentCoordinates {
208
+ /** Process context (cwd, env). */
209
+ io: Io;
210
+ /** Loaded configuration (the receipt stage binding). */
211
+ config: GateforgeConfig;
212
+ /** Absolute run-state directory holding the parent documents. */
213
+ stateDir: string;
214
+ /** The consumer's own trusted key ring. */
215
+ verifierKeyring: VerifierKeyring | null;
216
+ /** Verified merge-base commit the parent must have sealed. */
217
+ baseSha: string;
218
+ /**
219
+ * `own-ancestor-commit` binds the parent to the commit the parent
220
+ * DOCUMENT names; absent keeps the exact merge-base rule.
221
+ */
222
+ parentCommitBinding?: 'own-ancestor-commit';
223
+ /**
224
+ * Every obligation fingerprint this repository declares; a re-seal
225
+ * parent must have covered exactly this set.
226
+ */
227
+ repositoryFingerprints?: readonly string[];
228
+ /** Trusted policy/config revision digest of this run. */
229
+ trustedPolicyDigest: string;
230
+ /** Owner-approved policy revision digest of this run. */
231
+ approvedPolicyDigest: string;
232
+ /** Execution-boundary digest of this run. */
233
+ executionBoundaryDigest: string;
234
+ /** Authority object store (the parent tree is diffed inside it). */
235
+ gitDir: string | null;
236
+ /** Owner-approved exclusions that are never inside a candidate tree. */
237
+ docsExclusions: readonly string[];
238
+ /** Owner-approved cache exclusions. */
239
+ cacheExclusions: readonly string[];
240
+ }
241
+ /** The sealed parent a re-seal carries from, plus what it proved. */
242
+ export interface ResealPlan {
243
+ /** How Gateforge itself classified the sealed change set. */
244
+ classification: ResealChangeClassification;
245
+ /** Which kind of document the parent is (a receipt or a run record). */
246
+ parentKind: 'receipt' | 'run-record';
247
+ /** Digest of the verified parent document this run re-seals from. */
248
+ parentDigest: string;
249
+ /** The parent document's sealed candidate tree. */
250
+ parentTreeId: string;
251
+ /** The commit the parent run/receipt sealed. */
252
+ parentSha: string;
253
+ /** Test files whose tests this run re-runs. */
254
+ affectedFiles: string[];
255
+ /** How many parent outcomes this run carries unchanged. */
256
+ carriedTests: number;
257
+ }
258
+ /**
259
+ * Decides the test-only re-seal: may this `--scope changed` run re-run
260
+ * exactly the tests the sealed change set can affect and re-seal from
261
+ * the verified parent?
262
+ *
263
+ * The parent is EITHER a verified gate receipt (the run was clean) or a
264
+ * verified run record (the run failed a test and therefore sealed no
265
+ * receipt — the consumer's 563/562 case). A run record is a weaker
266
+ * proof in exactly one way that matters: it may hold a failure. So the
267
+ * rule that makes it usable is that every test which did NOT pass in
268
+ * it must be INSIDE the affected set — the change must have touched it
269
+ * — and must pass in this re-run. Anything else is a full run.
270
+ *
271
+ * Every other rule is checked by Gateforge itself, never by the
272
+ * candidate: the change set is diffed from the two sealed trees, the
273
+ * paths are classified from the runner's own catalog, the parent's
274
+ * outcomes must be clean for every test outside the affected set, and a
275
+ * vanished test must be explained by a changed file. Any doubt returns
276
+ * one plain reason line, and the caller then runs exactly as it did
277
+ * before.
278
+ *
279
+ * Args:
280
+ * input: the sealed parent, the frozen tree, the catalog, the current
281
+ * obligations, and the repository coordinates.
282
+ *
283
+ * Returns:
284
+ * the re-seal plan, or the single reason it is refused (both null
285
+ * when no parent exists at all, which keeps a run without a parent
286
+ * byte-identical to before).
287
+ */
288
+ export declare function decideTestOnlyReseal(input: {
289
+ io: Io;
290
+ gitDir: string;
291
+ parent: ResealParent | null;
292
+ currentTreeId: string;
293
+ catalog: TestCatalog;
294
+ obligations: readonly Obligation[];
295
+ enabled: boolean;
296
+ /**
297
+ * The owner-declared runtime files (`enforcement.resealRuntimeFiles`).
298
+ * Absent or empty changes nothing: the classifier disregards nothing
299
+ * and the decision is the one it always was.
300
+ */
301
+ runtimeFileGlobs?: readonly string[];
302
+ /**
303
+ * The tree of the commit this run froze (`<baseSha>^{tree}`). Both
304
+ * commit trees — this one and the parent's — say which paths are
305
+ * tracked source, which is what an owner declaration may never hide
306
+ * and what a declared browser state must be to count as generated
307
+ * output; without them the classifier disregards nothing and treats
308
+ * no state as generated (fail closed).
309
+ */
310
+ currentCommitTreeId?: string;
311
+ /**
312
+ * Repo-relative paths this run's input snapshot binds. A declared
313
+ * browser state inside it is authority, not output, so it is never
314
+ * carried as a generated-state change. Absent when the caller holds no
315
+ * inventory: input membership is not inferable from the sealed trees;
316
+ * without an inventory this classifier applies only the other
317
+ * generated-state eligibility rules.
318
+ */
319
+ inputFiles?: ReadonlySet<string>;
320
+ /**
321
+ * How many parent outcomes the WHOLE retained chain carries, read
322
+ * from the run state. A parent that is itself a re-seal planned
323
+ * only the tests it re-ran, so its own plan cannot count the rest;
324
+ * absent, the parent's plan is counted exactly as before.
325
+ */
326
+ chainCarriedTests?: number;
327
+ }): {
328
+ plan: ResealPlan | null;
329
+ reason: string | null;
330
+ };
331
+ /** Runs configured harness setup and teardown around one supervised suite.
332
+ *
333
+ * Args:
334
+ * io: process context.
335
+ * options: parsed supervised-run flags.
336
+ *
337
+ * Returns:
338
+ * Promise<number>: the suite result, or 1 when harness setup/teardown fails.
339
+ */
340
+ export declare function runSupervisedTestGates(io: Io, options: SupervisedOptions): Promise<number>;
72
341
  /**
73
342
  * The supervised `--changed` path (plan Phase 4, ADR 0005 D2/D3):
74
343
  * resolve catalog + mappings → fix the expected set → prepare the
@@ -90,7 +359,20 @@ export interface SupervisedOptions {
90
359
  * supervision/evidence failure, 2 config/usage.
91
360
  * @throws fail-closed errors (exit 2) from config/plugin/pipeline layers.
92
361
  */
93
- export declare function runSupervisedTestGates(io: Io, options: SupervisedOptions): Promise<number>;
362
+ /**
363
+ * Projects every EXPIRED owner quarantine into a blocking finding that
364
+ * names the test and its expiry. An expired
365
+ * quarantine is not silently ignored: it is a stale escape hatch, and
366
+ * the required test is back in the run.
367
+ *
368
+ * Args:
369
+ * expired: the expired partition of the loaded quarantine population.
370
+ *
371
+ * Returns:
372
+ * BlockingEntry[]: one typed `QUARANTINE_EXPIRED` finding per expiry,
373
+ * sorted by test key (the loader's order).
374
+ */
375
+ export declare function expiredQuarantineBlocking(expired: readonly LoadedQuarantine[]): BlockingEntry[];
94
376
  /**
95
377
  * Computes the receipt's executed-case digest from only authenticated,
96
378
  * schema-valid behavior.case records that the evaluator used for a
@@ -1 +1 @@
1
- {"version":3,"file":"test-gates.d.ts","sourceRo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