@cnc-tools/storm 0.15.0 → 0.17.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 (305) hide show
  1. package/dist/application.d.ts +22 -13
  2. package/dist/application.js +21 -10
  3. package/dist/bin/run.d.ts +18 -0
  4. package/dist/bin/run.js +31 -0
  5. package/dist/bin/storm.js +42 -26
  6. package/dist/build-info.js +1 -1
  7. package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
  8. package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
  9. package/dist/chunks/{chunk-SZEURWRS.js → chunk-4O5C2XGJ.js} +18 -15
  10. package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
  11. package/dist/chunks/{chunk-QVS7HRU7.js → chunk-6UHIJXZG.js} +3 -3
  12. package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
  13. package/dist/chunks/{chunk-4U4DZ7VG.js → chunk-7DZE67QM.js} +2 -2
  14. package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
  15. package/dist/chunks/{chunk-QUHY6FGN.js → chunk-CKGZA25H.js} +1 -18
  16. package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
  17. package/dist/chunks/{chunk-KC4KDJ5K.js → chunk-DADEYJDW.js} +174 -153
  18. package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
  19. package/dist/chunks/chunk-F4MOYHRY.js +198 -0
  20. package/dist/chunks/{chunk-CXAT7ZKP.js → chunk-FNBB6V4R.js} +1 -1
  21. package/dist/chunks/{chunk-OX7X4B2L.js → chunk-GRT3UIBV.js} +18 -1
  22. package/dist/chunks/chunk-HP3CURSZ.js +88 -0
  23. package/dist/chunks/{chunk-PN5ULTTH.js → chunk-HWIQ2S7K.js} +5 -5
  24. package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
  25. package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
  26. package/dist/chunks/{chunk-XEVHP5ZW.js → chunk-M7EKRGVD.js} +8 -8
  27. package/dist/chunks/chunk-MR77L2GK.js +340 -0
  28. package/dist/chunks/{chunk-L36GBUBB.js → chunk-RNAS7JHE.js} +1755 -522
  29. package/dist/chunks/{chunk-5GBMR4HM.js → chunk-RWIXDDCK.js} +4 -192
  30. package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
  31. package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
  32. package/dist/chunks/{chunk-YV7GE6EV.js → chunk-YEPFSLQR.js} +480 -375
  33. package/dist/chunks/{live-app-PI3BAN6Y.js → live-app-R76JQXZL.js} +15 -13
  34. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
  35. package/dist/commands/exec/across-sandboxes-outcomes.js +4 -3
  36. package/dist/commands/exec/before-run.d.ts +123 -0
  37. package/dist/commands/exec/before-run.js +105 -0
  38. package/dist/commands/exec/command.d.ts +39 -4
  39. package/dist/commands/exec/command.js +31 -95
  40. package/dist/commands/exec/driver-plan.d.ts +9 -4
  41. package/dist/commands/exec/driver-plan.js +8 -8
  42. package/dist/commands/exec/exec-words.js +1 -1
  43. package/dist/commands/exec/execute-run.d.ts +39 -0
  44. package/dist/commands/exec/execute-run.js +325 -0
  45. package/dist/commands/exec/live-view.d.ts +3 -3
  46. package/dist/commands/exec/live-view.js +16 -15
  47. package/dist/commands/exec/metadata.js +1 -1
  48. package/dist/commands/exec/mint-failed.d.ts +38 -0
  49. package/dist/commands/exec/mint-failed.js +27 -4
  50. package/dist/commands/exec/outcomes.d.ts +38 -9
  51. package/dist/commands/exec/outcomes.js +32 -25
  52. package/dist/commands/exec/plan-run.d.ts +58 -150
  53. package/dist/commands/exec/plan-run.js +232 -88
  54. package/dist/commands/exec/planned-outcome.js +8 -1
  55. package/dist/commands/exec/progress.d.ts +10 -6
  56. package/dist/commands/exec/progress.js +38 -25
  57. package/dist/commands/exec/run-bin.d.ts +11 -11
  58. package/dist/commands/exec/run-bin.js +9 -9
  59. package/dist/commands/exec/run-flags.d.ts +69 -0
  60. package/dist/commands/exec/run-flags.js +58 -0
  61. package/dist/commands/exec/run-metadata.js +5 -5
  62. package/dist/commands/exec/run-summary.d.ts +58 -0
  63. package/dist/commands/exec/run-summary.js +205 -0
  64. package/dist/commands/exec/runner-refusals.d.ts +82 -0
  65. package/dist/commands/exec/runner-refusals.js +71 -0
  66. package/dist/commands/exec/sandbox-progress.js +3 -0
  67. package/dist/commands/exec/stopped-outcome.d.ts +12 -0
  68. package/dist/commands/exec/stopped-outcome.js +77 -0
  69. package/dist/commands/exec/view.d.ts +20 -11
  70. package/dist/commands/exec/view.js +103 -47
  71. package/dist/commands/runs/facts.d.ts +9 -4
  72. package/dist/commands/runs/facts.js +28 -11
  73. package/dist/commands/runs/list/command.d.ts +16 -6
  74. package/dist/commands/runs/list/command.js +10 -10
  75. package/dist/commands/runs/list/outcomes.d.ts +8 -3
  76. package/dist/commands/runs/logs/command.d.ts +6 -2
  77. package/dist/commands/runs/logs/command.js +10 -10
  78. package/dist/commands/runs/logs/outcomes.d.ts +3 -1
  79. package/dist/commands/runs/past-run.d.ts +14 -5
  80. package/dist/commands/runs/past-run.js +16 -5
  81. package/dist/commands/runs/show/command.d.ts +20 -8
  82. package/dist/commands/runs/show/command.js +30 -28
  83. package/dist/commands/runs/show/outcomes.d.ts +10 -4
  84. package/dist/commands/runs/show/outcomes.js +7 -5
  85. package/dist/commands/snapshots/access.d.ts +111 -0
  86. package/dist/commands/snapshots/access.js +96 -0
  87. package/dist/commands/snapshots/build/command.d.ts +360 -93
  88. package/dist/commands/snapshots/build/command.js +446 -150
  89. package/dist/commands/snapshots/build/metadata.d.ts +10 -0
  90. package/dist/commands/snapshots/build/metadata.js +31 -11
  91. package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
  92. package/dist/commands/snapshots/build/outcomes.js +200 -36
  93. package/dist/commands/snapshots/list/command.d.ts +368 -27
  94. package/dist/commands/snapshots/list/command.js +296 -66
  95. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  96. package/dist/commands/snapshots/list/metadata.js +29 -6
  97. package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
  98. package/dist/commands/snapshots/list/outcomes.js +221 -50
  99. package/dist/commands/snapshots/metadata.js +1 -1
  100. package/dist/commands/snapshots/prune/command.d.ts +430 -0
  101. package/dist/commands/snapshots/prune/command.js +161 -0
  102. package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
  103. package/dist/commands/snapshots/prune/metadata.js +39 -0
  104. package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
  105. package/dist/commands/snapshots/prune/outcomes.js +78 -0
  106. package/dist/commands/suites/list/command.js +19 -18
  107. package/dist/commands/suites/list/outcomes.js +4 -4
  108. package/dist/commands/test/command.d.ts +39 -4
  109. package/dist/commands/test/command.js +50 -255
  110. package/dist/commands/test/metadata.js +1 -1
  111. package/dist/commands/test/outcomes.d.ts +19 -2
  112. package/dist/commands/test/outcomes.js +2 -2
  113. package/dist/config/check-runner.d.ts +5 -3
  114. package/dist/config/check-runner.js +33 -7
  115. package/dist/config/check-suites.js +1 -0
  116. package/dist/config/credential-resolver.d.ts +50 -5
  117. package/dist/config/credential-resolver.js +51 -19
  118. package/dist/config/credential-settle.d.ts +6 -2
  119. package/dist/config/credential-settle.js +11 -5
  120. package/dist/config/gateways.d.ts +7 -3
  121. package/dist/config/index.d.ts +4 -5
  122. package/dist/config/index.js +3 -4
  123. package/dist/config/live/config-gateway.js +5 -2
  124. package/dist/config/load.d.ts +21 -4
  125. package/dist/config/load.js +129 -15
  126. package/dist/config/runner.d.ts +7 -8
  127. package/dist/config/runner.js +1 -1
  128. package/dist/config/schema.d.ts +17 -5
  129. package/dist/config/schema.js +11 -3
  130. package/dist/config/typed-options.d.ts +1 -6
  131. package/dist/config/typed-options.js +2 -10
  132. package/dist/config-file/define.d.ts +1 -11
  133. package/dist/config-file/define.js +3 -3
  134. package/dist/config-file/runner.d.ts +5 -6
  135. package/dist/config-file/toolchain.d.ts +13 -7
  136. package/dist/config-file/toolchain.js +53 -37
  137. package/dist/context.d.ts +8 -6
  138. package/dist/context.js +7 -6
  139. package/dist/core/across-sandboxes.d.ts +7 -6
  140. package/dist/core/across-sandboxes.js +123 -152
  141. package/dist/core/coordinator.d.ts +166 -0
  142. package/dist/core/coordinator.js +233 -0
  143. package/dist/core/events.d.ts +2 -2
  144. package/dist/core/index.d.ts +4 -2
  145. package/dist/core/index.js +1 -1
  146. package/dist/core/outcomes.d.ts +148 -0
  147. package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
  148. package/dist/core/resources.d.ts +31 -53
  149. package/dist/core/resources.js +32 -70
  150. package/dist/core/run-state.d.ts +7 -1
  151. package/dist/core/run-state.js +2 -0
  152. package/dist/core/run.d.ts +32 -236
  153. package/dist/core/run.js +106 -266
  154. package/dist/core/state-directory.d.ts +1 -1
  155. package/dist/core/state-directory.js +2 -2
  156. package/dist/credential/gateways.d.ts +15 -1
  157. package/dist/credential/index.d.ts +4 -3
  158. package/dist/credential/index.js +3 -2
  159. package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
  160. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  161. package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
  162. package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
  163. package/dist/credential/source.d.ts +73 -6
  164. package/dist/credential/source.js +55 -2
  165. package/dist/extension-commands.d.ts +6 -1
  166. package/dist/extension-commands.js +15 -1
  167. package/dist/extensions/github/resource.d.ts +1 -1
  168. package/dist/extensions/github/resource.js +1 -1
  169. package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
  170. package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
  171. package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
  172. package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
  173. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  174. package/dist/extensions/testserver/credential-facts.d.ts +6 -2
  175. package/dist/extensions/testserver/credential-facts.js +29 -11
  176. package/dist/extensions/testserver/lifecycle.js +7 -1
  177. package/dist/extensions/testserver/limit.d.ts +3 -0
  178. package/dist/extensions/testserver/limit.js +3 -0
  179. package/dist/extensions/testserver/provision.d.ts +8 -1
  180. package/dist/extensions/testserver/provision.js +8 -3
  181. package/dist/extensions/testserver/refusals.d.ts +6 -1
  182. package/dist/extensions/testserver/refusals.js +16 -1
  183. package/dist/extensions/testserver/resource.d.ts +2 -2
  184. package/dist/extensions/testserver/resource.js +2 -2
  185. package/dist/extensions/testserver/result.d.ts +1 -1
  186. package/dist/extensions/testserver/result.js +9 -4
  187. package/dist/planning/driver-file-lists.d.ts +0 -15
  188. package/dist/planning/driver-file-lists.js +2 -21
  189. package/dist/planning/plan-only.d.ts +7 -15
  190. package/dist/planning/plan-only.js +16 -22
  191. package/dist/planning/run-kind-flags.js +2 -2
  192. package/dist/planning/run-plan.d.ts +45 -13
  193. package/dist/planning/run-plan.js +4 -3
  194. package/dist/planning/suites.d.ts +1 -1
  195. package/dist/planning/suites.js +2 -2
  196. package/dist/planning/test-plan.d.ts +9 -0
  197. package/dist/planning/test-plan.js +10 -2
  198. package/dist/run-directory/recording.js +2 -2
  199. package/dist/run-directory/run-record.d.ts +21 -6
  200. package/dist/run-directory/run-record.js +12 -9
  201. package/dist/runner/base.d.ts +0 -6
  202. package/dist/runner/base.js +1 -16
  203. package/dist/runner/build-snapshots.d.ts +55 -29
  204. package/dist/runner/build-snapshots.js +135 -35
  205. package/dist/runner/context.d.ts +15 -7
  206. package/dist/runner/context.js +19 -6
  207. package/dist/runner/events.d.ts +16 -10
  208. package/dist/runner/gateways.d.ts +92 -21
  209. package/dist/runner/gateways.js +1 -1
  210. package/dist/runner/index.d.ts +11 -7
  211. package/dist/runner/index.js +9 -4
  212. package/dist/runner/live/sandbox-errors.d.ts +2 -0
  213. package/dist/runner/live/sandbox-errors.js +4 -0
  214. package/dist/runner/live/sandbox-gateway.js +141 -3
  215. package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
  216. package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
  217. package/dist/runner/live/snapshot-records.js +6 -7
  218. package/dist/runner/local-snapshot-index.d.ts +199 -0
  219. package/dist/runner/local-snapshot-index.js +211 -0
  220. package/dist/runner/network-policy.d.ts +6 -6
  221. package/dist/runner/network-policy.js +7 -7
  222. package/dist/runner/policy-writes.d.ts +1 -1
  223. package/dist/runner/policy-writes.js +1 -1
  224. package/dist/runner/prepare.d.ts +25 -24
  225. package/dist/runner/prepare.js +28 -20
  226. package/dist/runner/ready.d.ts +18 -10
  227. package/dist/runner/ready.js +104 -33
  228. package/dist/runner/sandboxed-command.d.ts +3 -3
  229. package/dist/runner/sandboxed-command.js +3 -3
  230. package/dist/runner/scope.d.ts +10 -6
  231. package/dist/runner/scope.js +10 -3
  232. package/dist/runner/secrets.d.ts +13 -13
  233. package/dist/runner/secrets.js +18 -15
  234. package/dist/runner/session.d.ts +8 -8
  235. package/dist/runner/session.js +3 -3
  236. package/dist/runner/shared-snapshot-entry.d.ts +92 -0
  237. package/dist/runner/shared-snapshot-entry.js +168 -0
  238. package/dist/runner/shared-snapshot-list.d.ts +81 -0
  239. package/dist/runner/shared-snapshot-list.js +155 -0
  240. package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
  241. package/dist/runner/shared-snapshot-lookup.js +118 -0
  242. package/dist/runner/shared-snapshot-prune.d.ts +58 -0
  243. package/dist/runner/shared-snapshot-prune.js +133 -0
  244. package/dist/runner/snapshot-build.d.ts +42 -14
  245. package/dist/runner/snapshot-build.js +38 -28
  246. package/dist/runner/snapshot-choice.js +1 -1
  247. package/dist/runner/snapshot-inspect.d.ts +39 -40
  248. package/dist/runner/snapshot-inspect.js +58 -38
  249. package/dist/runner/snapshot-key.d.ts +30 -21
  250. package/dist/runner/snapshot-key.js +49 -29
  251. package/dist/runner/steps.d.ts +1 -1
  252. package/dist/runner/steps.js +1 -1
  253. package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
  254. package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
  255. package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +82 -82
  256. package/dist/runner/vercel-sandbox-options.js +510 -0
  257. package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
  258. package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
  259. package/dist/sdk/extension/commands.d.ts +8 -3
  260. package/dist/sdk/extension/commands.js +3 -1
  261. package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
  262. package/dist/sdk/extension/credential-diagnosis.js +25 -5
  263. package/dist/sdk/extension/credential-source.d.ts +20 -3
  264. package/dist/sdk/extension/credential-source.js +4 -4
  265. package/dist/sdk/extension/index.d.ts +3 -2
  266. package/dist/sdk/extension/index.js +2 -1
  267. package/dist/sdk/extension/resource-definition.d.ts +4 -3
  268. package/dist/sdk/extension/resource-definition.js +3 -2
  269. package/dist/sdk/extension/resource-factory.js +3 -4
  270. package/dist/sdk/extension/secret-source.d.ts +1 -1
  271. package/dist/sdk/extension/secret-source.js +1 -1
  272. package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
  273. package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
  274. package/dist/sdk/run/present.d.ts +3 -3
  275. package/dist/sdk/run/present.js +1 -3
  276. package/dist/shared/cleanup.d.ts +3 -3
  277. package/dist/shared/cleanup.js +15 -5
  278. package/dist/shared/snapshot-text.d.ts +4 -4
  279. package/dist/shared/snapshot-text.js +11 -11
  280. package/dist/time/duration.js +1 -1
  281. package/package.json +3 -2
  282. package/skills/overview.md +6 -4
  283. package/skills/plan-runs.md +2 -2
  284. package/skills/read-run-output.md +6 -6
  285. package/dist/chunks/chunk-E4PJNZVG.js +0 -783
  286. package/dist/chunks/chunk-RAQEXKL6.js +0 -2591
  287. package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
  288. package/dist/commands/exec/across-sandboxes-run.js +0 -339
  289. package/dist/commands/exec/plan-only.d.ts +0 -10
  290. package/dist/commands/exec/plan-only.js +0 -46
  291. package/dist/commands/exec/run-command.d.ts +0 -476
  292. package/dist/commands/exec/run-command.js +0 -604
  293. package/dist/commands/exec/run-planned.d.ts +0 -20
  294. package/dist/commands/exec/run-planned.js +0 -22
  295. package/dist/commands/exec/sandbox-view.d.ts +0 -19
  296. package/dist/commands/exec/sandbox-view.js +0 -72
  297. package/dist/commands/test/plan.d.ts +0 -92
  298. package/dist/commands/test/plan.js +0 -128
  299. package/dist/config/recipe-run.d.ts +0 -33
  300. package/dist/config/recipe-run.js +0 -28
  301. package/dist/core/sandbox-end.d.ts +0 -64
  302. package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
  303. package/dist/runner/recipe.js +0 -425
  304. package/dist/runner/snapshot-cache.d.ts +0 -148
  305. package/dist/runner/snapshot-cache.js +0 -126
@@ -1,13 +1,13 @@
1
1
  // The credential launcher resolver: how a command gets the credential source `--credential` names, and then a
2
2
  // credential, without settling the choice or building the source itself, and the errors a source's `obtain()` refuses
3
- // a command with: the mint failed (`mint_failed`), or the GitHub Actions OIDC token request did
4
- // (`token_request_failed`). The launcher builds it once, over its credential gateways, clock and timer, and hands it to
5
- // every command. It lives in `config`, beside the config launcher resolver, and not in `credential`, since it loads
6
- // Clinkr and the `credential` module loads none.
3
+ // a command with: the mint failed (`mint_failed`), the GitHub Actions OIDC token request failed
4
+ // (`token_request_failed`), or reading `VERCEL_OIDC_TOKEN` failed (`vercel_oidc_token_failed`). The launcher builds
5
+ // it once, over its credential gateways, clock, and timer, and hands it to every command. It lives in `config`, beside
6
+ // the config launcher resolver, and not in `credential`, since it loads Clinkr and the `credential` module loads none.
7
7
  import { defineErrors } from "@vercel/clinkr";
8
8
  import { z } from "zod";
9
- import { credentialSourceFor, describeMintFailure, mintTargetText, REQUESTING_TOKEN_LINE, tokenRequestFailureFacts, tokenRequestFailureShape, } from "../credential/index.js";
10
- import { settleCredential } from "./credential-settle.js";
9
+ import { credentialSourceFor, describeMintFailure, mintTargetText, REQUESTING_TOKEN_LINE, tokenRequestFailureFacts, tokenRequestFailureShape, vercelOidcTokenFailureFacts, vercelOidcTokenFailureShape, vercelProjectSource, } from "../credential/index.js";
10
+ import { requireTarget, settleCredential } from "./credential-settle.js";
11
11
  /**
12
12
  * The errors a credential source's `obtain()` refuses with. A command that obtains a credential spreads them into its
13
13
  * outcomes.
@@ -31,12 +31,29 @@ export const credentialSourceErrors = defineErrors({
31
31
  next: [{ type: "text", text: fix }],
32
32
  }),
33
33
  },
34
+ vercelOidcTokenFailed: {
35
+ exitCode: 1,
36
+ description: "With --credential vercel-oidc, VERCEL_OIDC_TOKEN is missing, empty, or not a valid Vercel project OIDC token.",
37
+ schema: z.object(vercelOidcTokenFailureShape),
38
+ render: ({ detail, fix }) => ({
39
+ message: `Couldn't use VERCEL_OIDC_TOKEN: ${detail}.`,
40
+ next: [{ type: "text", text: fix }],
41
+ }),
42
+ },
34
43
  });
35
44
  /** A credential source's failure as the error `obtain()` refuses with. */
36
45
  export function credentialSourceError(failure) {
37
- return failure.source === "mint"
38
- ? credentialSourceErrors.mintFailed({ ...failure.target, ...describeMintFailure(failure.failure, failure.target) })
39
- : credentialSourceErrors.tokenRequestFailed(tokenRequestFailureFacts(failure.failure));
46
+ switch (failure.source) {
47
+ case "mint":
48
+ return credentialSourceErrors.mintFailed({
49
+ ...failure.target,
50
+ ...describeMintFailure(failure.failure, failure.target),
51
+ });
52
+ case "github-actions":
53
+ return credentialSourceErrors.tokenRequestFailed(tokenRequestFailureFacts(failure.failure));
54
+ case "vercel-oidc":
55
+ return credentialSourceErrors.vercelOidcTokenFailed(vercelOidcTokenFailureFacts(failure.failure));
56
+ }
40
57
  }
41
58
  /** The credential launcher resolver over `gateways`. */
42
59
  export function credentialResolver(gateways) {
@@ -45,16 +62,7 @@ export function credentialResolver(gateways) {
45
62
  const chosen = settleCredential(choice, target.scope, target.project);
46
63
  if (!chosen.ok)
47
64
  return chosen;
48
- const { progress } = report;
49
- // The source's events as the command's lines: one before the mint and one before each token request.
50
- const source = credentialSourceFor(chosen.credential, gateways, {
51
- emit: async (event) => {
52
- if (event.kind === "minting")
53
- await progress?.(`Minting a credential for ${mintTargetText(event.target)}…`);
54
- else if (event.kind === "requesting-token")
55
- await progress?.(REQUESTING_TOKEN_LINE);
56
- },
57
- });
65
+ const source = credentialSourceFor(chosen.credential, gateways, commandLines(report));
58
66
  return {
59
67
  ok: true,
60
68
  source: {
@@ -66,5 +74,29 @@ export function credentialResolver(gateways) {
66
74
  },
67
75
  };
68
76
  },
77
+ vercelProjectSource(choice, target, report = {}) {
78
+ let credential;
79
+ if (choice === "vercel-oidc")
80
+ credential = { source: choice };
81
+ else {
82
+ const required = requireTarget(target.scope, target.project);
83
+ if (!required.ok)
84
+ return required;
85
+ credential = { source: choice, target: required.target };
86
+ }
87
+ const { obtain } = vercelProjectSource(credential, gateways, commandLines(report));
88
+ return { ok: true, source: { obtain } };
89
+ },
90
+ };
91
+ }
92
+ /** A credential source's events as a command's lines: one before the mint and one before each token request. */
93
+ function commandLines({ progress }) {
94
+ return {
95
+ emit: async (event) => {
96
+ if (event.kind === "minting")
97
+ await progress?.(`Minting a credential for ${mintTargetText(event.target)}…`);
98
+ else if (event.kind === "requesting-token")
99
+ await progress?.(REQUESTING_TOKEN_LINE);
100
+ },
69
101
  };
70
102
  }
@@ -39,10 +39,14 @@ interface GivenSetting {
39
39
  export declare function requireTarget(scope: GivenSetting | undefined, project: GivenSetting | undefined): Refusable<{
40
40
  readonly target: MintTarget;
41
41
  }, MissingTarget>;
42
+ /**
43
+ * The control plane team and project the flags or the config file give, as a command shows them, or null when either
44
+ * is unset. With `--credential mint` they are the mint's target.
45
+ */
46
+ export declare function givenTarget(scope: GivenSetting | undefined, project: GivenSetting | undefined): MintTarget | null;
42
47
  /**
43
48
  * The credential source `--credential` names: the mint needs the control plane team and project, refusing with
44
- * `missing_target` when either is unset; a GitHub Actions OIDC token request needs neither, and leaves any given
45
- * unused.
49
+ * `missing_target` when either is unset; `github-actions` and `vercel-oidc` need neither, and leave any given unused.
46
50
  */
47
51
  export declare function settleCredential(source: CredentialSourceChoice["source"], scope: GivenSetting | undefined, project: GivenSetting | undefined): Refusable<{
48
52
  readonly credential: CredentialSourceChoice;
@@ -1,6 +1,6 @@
1
1
  // How a command settles the credential source `--credential` names, before it gets a credential: the mint needs the
2
- // control plane team and project, and refuses with `missing_target` without either; a GitHub Actions OIDC token request
3
- // needs neither.
2
+ // control plane team and project, and refuses with `missing_target` without either; a GitHub Actions OIDC token
3
+ // request or `VERCEL_OIDC_TOKEN` needs neither.
4
4
  import { defineErrors, refused } from "@vercel/clinkr";
5
5
  import { z } from "zod";
6
6
  /** The errors settling a credential source refuses a command with. */
@@ -34,13 +34,19 @@ export function requireTarget(scope, project) {
34
34
  }));
35
35
  return { ok: true, target: { team: scope.value, project: project.value } };
36
36
  }
37
+ /**
38
+ * The control plane team and project the flags or the config file give, as a command shows them, or null when either
39
+ * is unset. With `--credential mint` they are the mint's target.
40
+ */
41
+ export function givenTarget(scope, project) {
42
+ return scope === undefined || project === undefined ? null : { team: scope.value, project: project.value };
43
+ }
37
44
  /**
38
45
  * The credential source `--credential` names: the mint needs the control plane team and project, refusing with
39
- * `missing_target` when either is unset; a GitHub Actions OIDC token request needs neither, and leaves any given
40
- * unused.
46
+ * `missing_target` when either is unset; `github-actions` and `vercel-oidc` need neither, and leave any given unused.
41
47
  */
42
48
  export function settleCredential(source, scope, project) {
43
- if (source === "github-actions")
49
+ if (source === "github-actions" || source === "vercel-oidc")
44
50
  return { ok: true, credential: { source } };
45
51
  const required = requireTarget(scope, project);
46
52
  if (!required.ok)
@@ -1,3 +1,4 @@
1
+ import type { ConfigFileName } from "./schema.ts";
1
2
  /** Where Node said an import failed, in the config file: a line, and a column when it gave one. */
2
3
  export interface ConfigLocation {
3
4
  readonly line: number;
@@ -21,10 +22,13 @@ export type ConfigImport = {
21
22
  readonly message: string;
22
23
  readonly location?: ConfigLocation;
23
24
  };
24
- /** What finding and loading `storm.config.ts` needs from the world. No method rejects. */
25
+ /** What finding and loading the config file needs from the world. No method rejects. */
25
26
  export interface ConfigGateway {
26
- /** Whether `directory` holds a `storm.config.ts` file. A directory storm can't read holds none. */
27
- hasConfigFile(directory: string): Promise<boolean>;
27
+ /**
28
+ * The config file names (`CONFIG_FILE_NAMES`) that `directory` holds as files, in that list's order. A directory
29
+ * storm can't read holds none.
30
+ */
31
+ configFileNames(directory: string): Promise<readonly ConfigFileName[]>;
28
32
  /** Whether `directory` is a git worktree's root: it holds `.git`, a directory or a file. */
29
33
  isWorktreeRoot(directory: string): Promise<boolean>;
30
34
  /** Imports the config file at `path`, running it. */
@@ -1,14 +1,13 @@
1
- export { type CommandCredentialSource, type CredentialReport, credentialResolver, type CredentialResolver, credentialSourceError, type CredentialSourceError, credentialSourceErrors, type CredentialTarget, } from "./credential-resolver.ts";
2
- export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.ts";
1
+ export { type CommandCredentialSource, type CommandVercelProjectSource, type CredentialReport, credentialResolver, type CredentialResolver, credentialSourceError, type CredentialSourceError, credentialSourceErrors, type CredentialTarget, } from "./credential-resolver.ts";
2
+ export { credentialErrors, givenTarget, requireTarget, settleCredential } from "./credential-settle.ts";
3
3
  export { configErrors, configProblemLine, optionProblemLine } from "./errors.ts";
4
4
  export type { ConfigGateway, ConfigImport, ConfigLocation, FileListsFileGateway, FileListsFileRead, } from "./gateways.ts";
5
5
  export { liveConfigGateway } from "./live/config-gateway.ts";
6
6
  export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.ts";
7
- export { type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfig, loadConfig } from "./load.ts";
8
- export { type RecipeResource, type RecipeRun, recipeRun } from "./recipe-run.ts";
7
+ export { type ConfigFileLookup, type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfig, loadConfig, } from "./load.ts";
9
8
  export { type MergedResourceOptions, type MergedRunResources, mergeRunResources, mergeResourceOptions, type PlannedOption, type ResolvedResourceOptions, type ResolvedResourceRecord, type ResolvedSettings, resolveSettings, type ResourceFlagOptions, type ResourceOptionProblem, type ResourceRecord, type SettingFlags, } from "./resolve.ts";
10
9
  export type { CheckedRunner, LaunchMachineRunner, RunnerConfig, RunnerKind, SuiteRunnerConfig, VercelSandboxRunner, } from "./runner.ts";
11
- export { type CheckedSettings, checkWith, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, type ConfigKey, type ConfigSettingKey, type ConfigSettings, type SettingValue, } from "./schema.ts";
10
+ export { type CheckedSettings, checkWith, CONFIG_FILE_NAME, CONFIG_FILE_NAMES, CONFIG_FILE_NAMES_TEXT, CONFIG_SETTING_KEYS, type ConfigFileName, type ConfigKey, type ConfigSettingKey, type ConfigSettings, type SettingValue, } from "./schema.ts";
12
11
  export { type ConfigLoadError, type ConfigResolver, configResolver, type LoadedResourceSettings, type StormConfigResolver, type TargetSettings, } from "./resolver.ts";
13
12
  export { effectiveConfig, fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, type SettingsFile, settleRunResources, } from "./settings-file.ts";
14
13
  export { type CheckedSuite, type CheckedSuiteMap, SUITE_NAME_PATTERN, type SuiteConfig, type SuiteConfigMap, } from "./suite.ts";
@@ -6,14 +6,13 @@
6
6
  // definition's own names (`defineResource`, the option rules and helpers, the merged options' types) are the extension
7
7
  // API's, which a caller imports from `sdk/extension/index.ts`.
8
8
  export { credentialResolver, credentialSourceError, credentialSourceErrors, } from "./credential-resolver.js";
9
- export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.js";
9
+ export { credentialErrors, givenTarget, requireTarget, settleCredential } from "./credential-settle.js";
10
10
  export { configErrors, configProblemLine, optionProblemLine } from "./errors.js";
11
11
  export { liveConfigGateway } from "./live/config-gateway.js";
12
12
  export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.js";
13
- export { findConfigFile, loadConfig } from "./load.js";
14
- export { recipeRun } from "./recipe-run.js";
13
+ export { findConfigFile, loadConfig, } from "./load.js";
15
14
  export { mergeRunResources, mergeResourceOptions, resolveSettings, } from "./resolve.js";
16
- export { checkWith, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, } from "./schema.js";
15
+ export { checkWith, CONFIG_FILE_NAME, CONFIG_FILE_NAMES, CONFIG_FILE_NAMES_TEXT, CONFIG_SETTING_KEYS, } from "./schema.js";
17
16
  export { configResolver, } from "./resolver.js";
18
17
  export { effectiveConfig, fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, settleRunResources, } from "./settings-file.js";
19
18
  export { SUITE_NAME_PATTERN, } from "./suite.js";
@@ -9,14 +9,17 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
9
9
  import { stat } from "node:fs/promises";
10
10
  import { basename, join } from "node:path";
11
11
  import { pathToFileURL } from "node:url";
12
- import { CONFIG_FILE_NAME } from "../schema.js";
12
+ import { CONFIG_FILE_NAMES } from "../schema.js";
13
13
  /**
14
14
  * The live config gateway: `stat` for the config file and `.git`, and a plain `import()`, so Node's own type
15
15
  * stripping loads the file. Node caches a module by its URL, so a process imports each config file once.
16
16
  */
17
17
  export function liveConfigGateway() {
18
18
  return {
19
- hasConfigFile: async (directory) => (await kind(join(directory, CONFIG_FILE_NAME))) === "file",
19
+ configFileNames: async (directory) => {
20
+ const kinds = await Promise.all(CONFIG_FILE_NAMES.map((name) => kind(join(directory, name))));
21
+ return CONFIG_FILE_NAMES.filter((_, index) => kinds[index] === "file");
22
+ },
20
23
  isWorktreeRoot: async (directory) => (await kind(join(directory, ".git"))) !== undefined,
21
24
  importConfig: async (path) => {
22
25
  try {
@@ -42,11 +42,28 @@ export type LoadedConfig = {
42
42
  readonly problems: readonly ConfigProblem[];
43
43
  };
44
44
  /**
45
- * Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each parent up to the
46
- * git worktree's root, the first directory holding `.git`; outside a git worktree, only in `startDirectory`. The
47
- * first file found wins.
45
+ * What `findConfigFile` found:
46
+ *
47
+ * - `none`: no directory it looked in holds a config file.
48
+ * - `found`: the config file at `path`.
49
+ * - `conflict`: the nearest directory holding a config file holds more than one, at `paths`, in `CONFIG_FILE_NAMES`
50
+ * order. storm picks none of them.
51
+ */
52
+ export type ConfigFileLookup = {
53
+ readonly kind: "none";
54
+ } | {
55
+ readonly kind: "found";
56
+ readonly path: string;
57
+ } | {
58
+ readonly kind: "conflict";
59
+ readonly paths: readonly [string, string, ...string[]];
60
+ };
61
+ /**
62
+ * Finds the config file for `startDirectory` (absolute): `storm.config.ts` or `storm.config.mts` in it, then in each
63
+ * parent up to the git worktree's root, the first directory holding `.git`; outside a git worktree, only in
64
+ * `startDirectory`. The nearest directory holding one wins, and it must hold only one.
48
65
  */
49
- export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<string | undefined>;
66
+ export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<ConfigFileLookup>;
50
67
  /**
51
68
  * Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
52
69
  * command reads it. The file must default-export an object holding only known keys, each top-level setting by its
@@ -1,26 +1,37 @@
1
- import { dirname, join } from "node:path";
1
+ import { basename, dirname, join } from "node:path";
2
2
  import { describeValue } from "../sdk/extension/index.js";
3
3
  import { checkResources } from "./check-resources.js";
4
4
  import { rawVercelSandboxOptions } from "./check-runner.js";
5
5
  import { checkSuites } from "./check-suites.js";
6
- import { CONFIG_FILE_NAME, checkSettingValue, isConfigSettingKey, } from "./schema.js";
6
+ import { checkSettingValue, isConfigSettingKey, } from "./schema.js";
7
7
  /**
8
- * Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each parent up to the
9
- * git worktree's root, the first directory holding `.git`; outside a git worktree, only in `startDirectory`. The
10
- * first file found wins.
8
+ * Finds the config file for `startDirectory` (absolute): `storm.config.ts` or `storm.config.mts` in it, then in each
9
+ * parent up to the git worktree's root, the first directory holding `.git`; outside a git worktree, only in
10
+ * `startDirectory`. The nearest directory holding one wins, and it must hold only one.
11
11
  */
12
12
  export async function findConfigFile(gateway, startDirectory) {
13
- if (await gateway.hasConfigFile(startDirectory))
14
- return join(startDirectory, CONFIG_FILE_NAME);
13
+ const here = await lookIn(gateway, startDirectory);
14
+ if (here !== undefined)
15
+ return here;
15
16
  const root = await worktreeRoot(gateway, startDirectory);
16
17
  if (root === undefined)
17
- return undefined;
18
+ return { kind: "none" };
18
19
  for (let directory = startDirectory; directory !== root;) {
19
20
  directory = dirname(directory);
20
- if (await gateway.hasConfigFile(directory))
21
- return join(directory, CONFIG_FILE_NAME);
21
+ const found = await lookIn(gateway, directory);
22
+ if (found !== undefined)
23
+ return found;
22
24
  }
23
- return undefined;
25
+ return { kind: "none" };
26
+ }
27
+ /** What `directory` holds: one config file, a conflict, or nothing (undefined). */
28
+ async function lookIn(gateway, directory) {
29
+ const [first, second, ...rest] = (await gateway.configFileNames(directory)).map((name) => join(directory, name));
30
+ if (first === undefined)
31
+ return undefined;
32
+ if (second === undefined)
33
+ return { kind: "found", path: first };
34
+ return { kind: "conflict", paths: [first, second, ...rest] };
24
35
  }
25
36
  /** The nearest directory at or above `directory` holding `.git`, if any. */
26
37
  async function worktreeRoot(gateway, directory) {
@@ -40,9 +51,21 @@ async function worktreeRoot(gateway, directory) {
40
51
  * merge with the flags (`mergeRunResources`) and its plan.
41
52
  */
42
53
  export async function loadConfig(gateway, startDirectory, definitions, drivers) {
43
- const path = await findConfigFile(gateway, startDirectory);
44
- if (path === undefined)
54
+ const found = await findConfigFile(gateway, startDirectory);
55
+ if (found.kind === "none")
45
56
  return { kind: "none" };
57
+ if (found.kind === "conflict") {
58
+ const [path, ...others] = found.paths;
59
+ const names = others.map((other) => basename(other)).join(" and ");
60
+ return {
61
+ kind: "invalid",
62
+ path,
63
+ problems: [
64
+ fileProblem(`is in the same directory as ${names}, so storm can't tell which config file applies; keep one of them`),
65
+ ],
66
+ };
67
+ }
68
+ const { path } = found;
46
69
  const imported = await gateway.importConfig(path);
47
70
  switch (imported.kind) {
48
71
  case "import-failed":
@@ -73,7 +96,7 @@ function checkFile(path, value, definitions, drivers) {
73
96
  let resources = {};
74
97
  let rawSuites;
75
98
  let hasSuitesKey = false;
76
- const settingContext = { drivers };
99
+ const settingContext = { definitions, drivers };
77
100
  const hasTopLevelDriver = value["driver"] !== undefined;
78
101
  for (const [key, keyValue] of Object.entries(value)) {
79
102
  if (key === "resources")
@@ -87,7 +110,7 @@ function checkFile(path, value, definitions, drivers) {
87
110
  checkSetting(key, keyValue, settings, settingContext, problems);
88
111
  }
89
112
  else
90
- problems.push({ key, location: null, problem: `is not a ${CONFIG_FILE_NAME} key` });
113
+ problems.push({ key, location: null, problem: `is not a ${basename(path)} key` });
91
114
  }
92
115
  if (settings.args !== undefined && !hasTopLevelDriver) {
93
116
  problems.push({ key: "args", location: null, problem: "requires a top-level driver" });
@@ -100,10 +123,101 @@ function checkFile(path, value, definitions, drivers) {
100
123
  topLevelRunnerOptions: rawVercelSandboxOptions(value["runner"]),
101
124
  }, problems)
102
125
  : {};
126
+ checkPlainData(value, problems);
103
127
  if (problems.length > 0)
104
128
  return { kind: "invalid", path, problems };
105
129
  return { kind: "loaded", path, values: { settings, resources, suites } };
106
130
  }
131
+ /**
132
+ * Refuses any value JSON cannot hold anywhere in the loaded config object: functions, symbols, bigints, non-finite
133
+ * numbers (`NaN`, `Infinity`), `undefined` array elements, non-plain objects (such as `Date`, `RegExp`, `Map`, `Set`,
134
+ * or class instances), and circular references. Paths already reported by schema checks (such as a function at
135
+ * `runner.vcpus`, whose schema check names the declared form) are not duplicated.
136
+ */
137
+ function checkPlainData(root, problems) {
138
+ const reported = new Set(problems.map(({ key }) => key).filter((key) => key !== null));
139
+ const visiting = new Set();
140
+ const addProblem = (path, problem) => {
141
+ const key = path.join(".");
142
+ if (reported.has(key))
143
+ return;
144
+ reported.add(key);
145
+ problems.push({ key: key.length === 0 ? null : key, location: null, problem });
146
+ };
147
+ const visit = (current, path) => {
148
+ if (current === null || typeof current === "string" || typeof current === "boolean")
149
+ return;
150
+ if (current === undefined) {
151
+ addProblem(path, "must be plain data (JSON cannot hold undefined in an array)");
152
+ return;
153
+ }
154
+ if (typeof current === "number") {
155
+ if (!Number.isFinite(current))
156
+ addProblem(path, `must be plain data (JSON cannot hold ${String(current)})`);
157
+ return;
158
+ }
159
+ if (typeof current === "function") {
160
+ addProblem(path, "must be plain data (JSON cannot hold a function)");
161
+ return;
162
+ }
163
+ if (typeof current === "symbol") {
164
+ addProblem(path, "must be plain data (JSON cannot hold a symbol)");
165
+ return;
166
+ }
167
+ if (typeof current === "bigint") {
168
+ addProblem(path, "must be plain data (JSON cannot hold a bigint)");
169
+ return;
170
+ }
171
+ if (typeof current !== "object")
172
+ return;
173
+ if (visiting.has(current)) {
174
+ addProblem(path, "must be plain data (circular reference)");
175
+ return;
176
+ }
177
+ if (Array.isArray(current)) {
178
+ visiting.add(current);
179
+ for (let index = 0; index < current.length; index += 1)
180
+ visit(current[index], [...path, String(index)]);
181
+ visiting.delete(current);
182
+ return;
183
+ }
184
+ const proto = Object.getPrototypeOf(current);
185
+ if (proto !== Object.prototype && proto !== null) {
186
+ addProblem(path, `must be plain data (expected a plain object, not ${describeNonPlainObject(proto)})`);
187
+ return;
188
+ }
189
+ visiting.add(current);
190
+ const isRunnerWrapper = (path.length === 1 && path[0] === "runner") ||
191
+ (path.length === 3 && path[0] === "suites" && path[2] === "runner");
192
+ const unwrapRunnerOptions = isRunnerWrapper && current["kind"] === "vercel-sandbox";
193
+ const isResourceWrapper = (path.length === 2 && path[0] === "resources") ||
194
+ (path.length === 4 && path[0] === "suites" && path[2] === "resources");
195
+ const unwrapResourceOptions = isResourceWrapper && typeof current["name"] === "string";
196
+ for (const [key, entry] of Object.entries(current)) {
197
+ if (entry === undefined)
198
+ continue;
199
+ if ((unwrapRunnerOptions || unwrapResourceOptions) && key === "options" && isPlainObject(entry)) {
200
+ visit(entry, path);
201
+ continue;
202
+ }
203
+ visit(entry, [...path, key]);
204
+ }
205
+ visiting.delete(current);
206
+ };
207
+ visit(root, []);
208
+ }
209
+ function isPlainObject(value) {
210
+ if (typeof value !== "object" || value === null || Array.isArray(value))
211
+ return false;
212
+ const proto = Object.getPrototypeOf(value);
213
+ return proto === Object.prototype || proto === null;
214
+ }
215
+ function describeNonPlainObject(proto) {
216
+ const ctor = typeof proto === "object" && proto !== null ? proto.constructor : undefined;
217
+ if (typeof ctor === "function" && ctor.name.length > 0 && ctor.name !== "Object")
218
+ return ctor.name;
219
+ return "a non-plain object";
220
+ }
107
221
  /** Checks one top-level setting, putting its value in `settings` or each thing wrong with it onto `problems`. */
108
222
  function checkSetting(key, value, settings, context, problems) {
109
223
  const checked = checkSettingValue(key, value, context);
@@ -1,5 +1,4 @@
1
- import type { CheckedRecipe, RunnerRecipe } from "../runner/recipe.ts";
2
- import type { RecipeRun } from "./recipe-run.ts";
1
+ import type { CheckedVercelSandboxOptions, VercelSandboxOptions } from "../runner/vercel-sandbox-options.ts";
3
2
  /** One runner kind storm supports. */
4
3
  export type RunnerKind = "launch-machine" | "vercel-sandbox";
5
4
  /** The launch machine runner value, made by `launchMachine()`. */
@@ -7,18 +6,18 @@ export interface LaunchMachineRunner {
7
6
  readonly kind: "launch-machine";
8
7
  }
9
8
  /** The Vercel Sandbox runner value, made by `vercelSandbox(options)`. */
10
- export interface VercelSandboxRunner<TOptions = RunnerRecipe<RecipeRun>> {
9
+ export interface VercelSandboxRunner<TOptions = VercelSandboxOptions> {
11
10
  readonly kind: "vercel-sandbox";
12
11
  readonly options: TOptions;
13
12
  }
14
13
  /** A top-level `runner` value in `storm.config.ts`: complete Vercel Sandbox options, or the launch machine. */
15
- export type RunnerConfig<Run = RecipeRun> = LaunchMachineRunner | VercelSandboxRunner<RunnerRecipe<Run>>;
14
+ export type RunnerConfig = LaunchMachineRunner | VercelSandboxRunner;
16
15
  /** A suite's `runner` value in `storm.config.ts`: complete or partial Vercel Sandbox options, or the launch machine. */
17
- export type SuiteRunnerConfig<Run = RecipeRun> = LaunchMachineRunner | VercelSandboxRunner<Partial<RunnerRecipe<Run>>>;
18
- /** A checked `runner` value after loading `storm.config.ts`, with defaults filled in on a Vercel Sandbox recipe. */
19
- export type CheckedRunner<Run = RecipeRun> = {
16
+ export type SuiteRunnerConfig = LaunchMachineRunner | VercelSandboxRunner<Partial<VercelSandboxOptions>>;
17
+ /** A checked `runner` value after loading `storm.config.ts`, with defaults filled in on Vercel Sandbox options. */
18
+ export type CheckedRunner = {
20
19
  readonly kind: "launch-machine";
21
20
  } | {
22
21
  readonly kind: "vercel-sandbox";
23
- readonly recipe: CheckedRecipe<Run>;
22
+ readonly options: CheckedVercelSandboxOptions;
24
23
  };
@@ -1,4 +1,4 @@
1
1
  // The declared `runner` value in `storm.config.ts` and its checked form: two peer runner kinds, the launch machine
2
2
  // (`launchMachine()`) and Vercel Sandbox (`vercelSandbox(options)`). Type-only so `@vercel/storm/config`'s
3
- // declarations reach only `runner/recipe.ts` and `recipe-run.ts`, never Clinkr or zod.
3
+ // declarations reach only `runner/vercel-sandbox-options.ts`, never Clinkr or zod.
4
4
  export {};
@@ -1,7 +1,18 @@
1
1
  import type { z } from "zod";
2
2
  import type { CheckedRunner, RunnerConfig } from "./runner.ts";
3
- /** The config file's name. storm looks for it in the working directory and its parents. */
3
+ import { type ResourceDefinition } from "../sdk/extension/index.ts";
4
+ /** The config file's usual name, which storm's text names it by. */
4
5
  export declare const CONFIG_FILE_NAME = "storm.config.ts";
6
+ /**
7
+ * Each name a config file may have, in the working directory or a parent. `storm.config.mts` is always an ES module,
8
+ * so Node loads it without the `MODULE_TYPELESS_PACKAGE_JSON` warning in a package with no `"type": "module"`, where
9
+ * `storm.config.ts` is first parsed as CommonJS. One directory may hold only one of them.
10
+ */
11
+ export declare const CONFIG_FILE_NAMES: readonly ["storm.config.ts", "storm.config.mts"];
12
+ /** One of `CONFIG_FILE_NAMES`. */
13
+ export type ConfigFileName = (typeof CONFIG_FILE_NAMES)[number];
14
+ /** The config file names as text says them: `storm.config.ts or storm.config.mts`. */
15
+ export declare const CONFIG_FILE_NAMES_TEXT: string;
5
16
  /**
6
17
  * The settings a `storm.config.ts` can give at its top level, as the file gives them. A flag (`--scope` or
7
18
  * `--project`) overrides the file; none has a built-in default here. `@vercel/storm/config`'s `StormConfig` adds
@@ -18,7 +29,7 @@ export interface ConfigSettings {
18
29
  readonly args?: readonly string[];
19
30
  /**
20
31
  * Where the command runs, made by `launchMachine()` or `vercelSandbox({ … })`. For `vercelSandbox`, its `vcpus` may
21
- * be a function of the run, which reads a resource by its resource factory: `run.get(<name>)`.
32
+ * be a positive whole number or a declared resource-scaling rule (`RunnerVcpuRule`).
22
33
  */
23
34
  readonly runner?: RunnerConfig;
24
35
  /**
@@ -33,7 +44,7 @@ export interface ConfigSettings {
33
44
  export type ConfigSettingKey = keyof ConfigSettings;
34
45
  /** A top-level key of `storm.config.ts`: a setting, `resources`, or `suites`. */
35
46
  export type ConfigKey = ConfigSettingKey | "resources" | "suites";
36
- /** The keys whose checked value differs from what the file gives: a Vercel Sandbox recipe gains its defaults. */
47
+ /** The keys whose checked value differs from what the file gives: the Vercel Sandbox runner options gain their defaults. */
37
48
  interface CheckedSettingValues {
38
49
  readonly runner: CheckedRunner;
39
50
  }
@@ -45,7 +56,7 @@ export type CheckedSettings = {
45
56
  };
46
57
  /**
47
58
  * One thing wrong with a value: the path inside the value (empty for the value itself, `["snapshot", "vcpus"]` inside
48
- * a runner recipe), and what is wrong, worded to follow the key (`must be …, not …`).
59
+ * the Vercel Sandbox runner options), and what is wrong, worded to follow the key (`must be …, not …`).
49
60
  */
50
61
  export interface ValueProblem {
51
62
  readonly path: readonly string[];
@@ -61,8 +72,9 @@ export type Checked<T> = {
61
72
  };
62
73
  /** `value` checked by `schema`: its output, or each issue as a problem at the issue's path inside the value. */
63
74
  export declare function checkWith<T>(schema: z.ZodType<T>, value: unknown): Checked<T>;
64
- /** What setting rules need beside the value itself: the registered driver names and any top-level `vercelSandbox` options. */
75
+ /** What setting rules need beside the value itself: the resource definitions, registered driver names, and any top-level `vercelSandbox` options. */
65
76
  export interface SettingCheckContext {
77
+ readonly definitions: readonly ResourceDefinition[];
66
78
  readonly drivers: readonly string[];
67
79
  /** Raw options from a top-level `vercelSandbox(...)`, for a suite's `vercelSandbox(...)` to merge over. */
68
80
  readonly topLevelRunnerOptions?: Readonly<Record<string, unknown>> | undefined;
@@ -4,8 +4,16 @@
4
4
  // vocabulary every rule shares: `Checked`, `ValueProblem`, `checkWith`, and how a problem names a value.
5
5
  import { checkRunner } from "./check-runner.js";
6
6
  import { booleanOption, describeValue, nonEmptyString } from "../sdk/extension/index.js";
7
- /** The config file's name. storm looks for it in the working directory and its parents. */
7
+ /** The config file's usual name, which storm's text names it by. */
8
8
  export const CONFIG_FILE_NAME = "storm.config.ts";
9
+ /**
10
+ * Each name a config file may have, in the working directory or a parent. `storm.config.mts` is always an ES module,
11
+ * so Node loads it without the `MODULE_TYPELESS_PACKAGE_JSON` warning in a package with no `"type": "module"`, where
12
+ * `storm.config.ts` is first parsed as CommonJS. One directory may hold only one of them.
13
+ */
14
+ export const CONFIG_FILE_NAMES = [CONFIG_FILE_NAME, "storm.config.mts"];
15
+ /** The config file names as text says them: `storm.config.ts or storm.config.mts`. */
16
+ export const CONFIG_FILE_NAMES_TEXT = CONFIG_FILE_NAMES.join(" or ");
9
17
  /** `value` checked by `schema`: its output, or each issue as a problem at the issue's path inside the value. */
10
18
  export function checkWith(schema, value) {
11
19
  const parsed = schema.safeParse(value);
@@ -40,14 +48,14 @@ function checkDriver(value, drivers) {
40
48
  }
41
49
  /**
42
50
  * Each top-level setting's rule. Typed against `ConfigSettings`, so a key it gains or loses, or a value type that
43
- * changes, fails to compile here until its rule follows. A runner recipe's problems name the key inside the recipe.
51
+ * changes, fails to compile here until its rule follows. A Vercel Sandbox runner's problems name the key inside the runner options.
44
52
  */
45
53
  const SETTING_CHECKS = {
46
54
  scope: (value) => checkWith(nonEmptyString, value),
47
55
  project: (value) => checkWith(nonEmptyString, value),
48
56
  driver: (value, { drivers }) => checkDriver(value, drivers),
49
57
  args: checkStringList,
50
- runner: (value, { topLevelRunnerOptions }) => checkRunner(value, topLevelRunnerOptions),
58
+ runner: (value, { topLevelRunnerOptions, definitions }) => checkRunner(value, topLevelRunnerOptions, definitions),
51
59
  testPlan: (value) => checkWith(booleanOption, value),
52
60
  };
53
61
  /** Every top-level setting, in the order a config file's problems list them. */
@@ -1,4 +1,4 @@
1
- import type { ResourceDefinition, GivenOptions, OptionsOf, Setting, SettingsOf } from "../sdk/extension/index.ts";
1
+ import type { ResourceDefinition, GivenOptions, Setting, SettingsOf } from "../sdk/extension/index.ts";
2
2
  /**
3
3
  * One resource's given options as `GivenOptions<D>`. Sound because every key is one of `definition.options` and every value
4
4
  * passed that option's schema.
@@ -14,8 +14,3 @@ export declare function givenOptionsOf<D extends ResourceDefinition>(_definition
14
14
  export declare function settingsOf<D extends ResourceDefinition>(_definition: D, settings: {
15
15
  readonly [option: string]: Setting<unknown>;
16
16
  }): SettingsOf<D>;
17
- /**
18
- * One resource's options, of definition `D`, as `OptionsOf<D>`. Sound because the caller checked that
19
- * the resource's record names `D`, and the run has each resource's options merged and checked by its definition.
20
- */
21
- export declare function resourceOptionsOf<D extends ResourceDefinition>(_definition: D, value: object): OptionsOf<D>;
@@ -1,9 +1,8 @@
1
1
  // The casts in the config module that type one resource's options as its definition's. The config module builds a
2
2
  // resource's options as a record by option name, from a loop over its definition's options or over what the file or
3
3
  // the flags give. TypeScript widens such a record to `Record<string, …>` and can't relate it to the mapped type over
4
- // one definition's options (`GivenOptions`, `SettingsOf`, `OptionsOf`), which the typed reads take: the config
5
- // resolver's `load<D>` and a runner recipe's `run.get(<name>)`. Each function below states that fact once, for every
6
- // call site.
4
+ // one definition's options (`GivenOptions`, `SettingsOf`), which the config resolver's `load<D>` takes. Each function
5
+ // below states that fact once, for every call site.
7
6
  /**
8
7
  * One resource's given options as `GivenOptions<D>`. Sound because every key is one of `definition.options` and every value
9
8
  * passed that option's schema.
@@ -19,10 +18,3 @@ export function givenOptionsOf(_definition, values) {
19
18
  export function settingsOf(_definition, settings) {
20
19
  return settings;
21
20
  }
22
- /**
23
- * One resource's options, of definition `D`, as `OptionsOf<D>`. Sound because the caller checked that
24
- * the resource's record names `D`, and the run has each resource's options merged and checked by its definition.
25
- */
26
- export function resourceOptionsOf(_definition, value) {
27
- return value;
28
- }