@cnc-tools/storm 0.16.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 (281) 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-P357TZAY.js → chunk-4O5C2XGJ.js} +18 -15
  10. package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
  11. package/dist/chunks/{chunk-OIY3DMF2.js → chunk-6UHIJXZG.js} +3 -3
  12. package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
  13. package/dist/chunks/{chunk-CK2GZEPK.js → chunk-7DZE67QM.js} +2 -2
  14. package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
  15. package/dist/chunks/{chunk-2MAD5NKK.js → chunk-CKGZA25H.js} +1 -18
  16. package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
  17. package/dist/chunks/{chunk-V4IKA3WI.js → chunk-DADEYJDW.js} +24 -17
  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-HVNK3I45.js → chunk-FNBB6V4R.js} +1 -1
  21. package/dist/chunks/{chunk-G3PHMXH5.js → chunk-GRT3UIBV.js} +18 -1
  22. package/dist/chunks/chunk-HP3CURSZ.js +88 -0
  23. package/dist/chunks/{chunk-DWEAHX4T.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-3L52KNQA.js → chunk-M7EKRGVD.js} +8 -8
  27. package/dist/chunks/chunk-MR77L2GK.js +340 -0
  28. package/dist/chunks/{chunk-DC2CDHNK.js → chunk-RNAS7JHE.js} +1438 -445
  29. package/dist/chunks/{chunk-FCQUJDA4.js → chunk-RWIXDDCK.js} +4 -189
  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-FOZWA52V.js → chunk-YEPFSLQR.js} +480 -375
  33. package/dist/chunks/{live-app-WECQOQ4C.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 +2 -2
  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 +31 -2
  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 +34 -8
  51. package/dist/commands/exec/outcomes.js +30 -23
  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/progress.d.ts +10 -6
  55. package/dist/commands/exec/progress.js +38 -25
  56. package/dist/commands/exec/run-bin.d.ts +11 -11
  57. package/dist/commands/exec/run-bin.js +9 -9
  58. package/dist/commands/exec/run-flags.d.ts +69 -0
  59. package/dist/commands/exec/run-flags.js +58 -0
  60. package/dist/commands/exec/run-metadata.js +4 -4
  61. package/dist/commands/exec/run-summary.d.ts +58 -0
  62. package/dist/commands/exec/run-summary.js +205 -0
  63. package/dist/commands/exec/runner-refusals.d.ts +82 -0
  64. package/dist/commands/exec/runner-refusals.js +71 -0
  65. package/dist/commands/exec/sandbox-progress.js +3 -0
  66. package/dist/commands/exec/stopped-outcome.d.ts +12 -0
  67. package/dist/commands/exec/stopped-outcome.js +77 -0
  68. package/dist/commands/exec/view.d.ts +20 -11
  69. package/dist/commands/exec/view.js +103 -47
  70. package/dist/commands/runs/facts.d.ts +7 -3
  71. package/dist/commands/runs/facts.js +17 -8
  72. package/dist/commands/runs/list/command.d.ts +14 -6
  73. package/dist/commands/runs/list/command.js +10 -10
  74. package/dist/commands/runs/list/outcomes.d.ts +7 -3
  75. package/dist/commands/runs/logs/command.js +10 -10
  76. package/dist/commands/runs/show/command.d.ts +14 -6
  77. package/dist/commands/runs/show/command.js +30 -28
  78. package/dist/commands/runs/show/outcomes.d.ts +7 -3
  79. package/dist/commands/runs/show/outcomes.js +7 -5
  80. package/dist/commands/snapshots/access.d.ts +111 -0
  81. package/dist/commands/snapshots/access.js +96 -0
  82. package/dist/commands/snapshots/build/command.d.ts +360 -93
  83. package/dist/commands/snapshots/build/command.js +446 -150
  84. package/dist/commands/snapshots/build/metadata.d.ts +10 -0
  85. package/dist/commands/snapshots/build/metadata.js +31 -11
  86. package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
  87. package/dist/commands/snapshots/build/outcomes.js +200 -36
  88. package/dist/commands/snapshots/list/command.d.ts +366 -25
  89. package/dist/commands/snapshots/list/command.js +296 -66
  90. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  91. package/dist/commands/snapshots/list/metadata.js +29 -6
  92. package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
  93. package/dist/commands/snapshots/list/outcomes.js +221 -50
  94. package/dist/commands/snapshots/metadata.js +1 -1
  95. package/dist/commands/snapshots/prune/command.d.ts +430 -0
  96. package/dist/commands/snapshots/prune/command.js +161 -0
  97. package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
  98. package/dist/commands/snapshots/prune/metadata.js +39 -0
  99. package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
  100. package/dist/commands/snapshots/prune/outcomes.js +78 -0
  101. package/dist/commands/suites/list/command.js +17 -17
  102. package/dist/commands/suites/list/outcomes.js +2 -2
  103. package/dist/commands/test/command.d.ts +31 -2
  104. package/dist/commands/test/command.js +49 -252
  105. package/dist/commands/test/outcomes.d.ts +15 -1
  106. package/dist/config/check-runner.d.ts +3 -3
  107. package/dist/config/check-runner.js +8 -7
  108. package/dist/config/credential-resolver.d.ts +50 -5
  109. package/dist/config/credential-resolver.js +51 -19
  110. package/dist/config/credential-settle.d.ts +6 -2
  111. package/dist/config/credential-settle.js +11 -5
  112. package/dist/config/index.d.ts +2 -2
  113. package/dist/config/index.js +1 -1
  114. package/dist/config/runner.d.ts +5 -5
  115. package/dist/config/runner.js +1 -1
  116. package/dist/config/schema.d.ts +2 -2
  117. package/dist/config/schema.js +1 -1
  118. package/dist/config-file/define.d.ts +1 -1
  119. package/dist/config-file/define.js +1 -1
  120. package/dist/config-file/runner.d.ts +5 -5
  121. package/dist/config-file/toolchain.d.ts +1 -1
  122. package/dist/config-file/toolchain.js +2 -2
  123. package/dist/context.d.ts +8 -6
  124. package/dist/context.js +7 -6
  125. package/dist/core/across-sandboxes.d.ts +7 -6
  126. package/dist/core/across-sandboxes.js +123 -152
  127. package/dist/core/coordinator.d.ts +166 -0
  128. package/dist/core/coordinator.js +233 -0
  129. package/dist/core/events.d.ts +2 -2
  130. package/dist/core/index.d.ts +4 -2
  131. package/dist/core/index.js +1 -1
  132. package/dist/core/outcomes.d.ts +148 -0
  133. package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
  134. package/dist/core/resources.d.ts +31 -53
  135. package/dist/core/resources.js +32 -70
  136. package/dist/core/run-state.d.ts +7 -1
  137. package/dist/core/run-state.js +2 -0
  138. package/dist/core/run.d.ts +32 -236
  139. package/dist/core/run.js +106 -266
  140. package/dist/core/state-directory.d.ts +1 -1
  141. package/dist/core/state-directory.js +2 -2
  142. package/dist/credential/gateways.d.ts +15 -1
  143. package/dist/credential/index.d.ts +4 -3
  144. package/dist/credential/index.js +3 -2
  145. package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
  146. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  147. package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
  148. package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
  149. package/dist/credential/source.d.ts +73 -6
  150. package/dist/credential/source.js +55 -2
  151. package/dist/extension-commands.d.ts +6 -1
  152. package/dist/extension-commands.js +15 -1
  153. package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
  154. package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
  155. package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
  156. package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
  157. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  158. package/dist/extensions/testserver/credential-facts.d.ts +6 -2
  159. package/dist/extensions/testserver/credential-facts.js +29 -11
  160. package/dist/extensions/testserver/lifecycle.js +7 -1
  161. package/dist/extensions/testserver/limit.d.ts +3 -0
  162. package/dist/extensions/testserver/limit.js +3 -0
  163. package/dist/extensions/testserver/provision.d.ts +8 -1
  164. package/dist/extensions/testserver/provision.js +8 -3
  165. package/dist/extensions/testserver/refusals.d.ts +6 -1
  166. package/dist/extensions/testserver/refusals.js +16 -1
  167. package/dist/extensions/testserver/resource.d.ts +1 -1
  168. package/dist/extensions/testserver/resource.js +1 -1
  169. package/dist/extensions/testserver/result.d.ts +1 -1
  170. package/dist/extensions/testserver/result.js +9 -4
  171. package/dist/planning/driver-file-lists.d.ts +0 -15
  172. package/dist/planning/driver-file-lists.js +2 -21
  173. package/dist/planning/plan-only.d.ts +3 -14
  174. package/dist/planning/plan-only.js +11 -20
  175. package/dist/planning/run-kind-flags.js +2 -2
  176. package/dist/planning/run-plan.d.ts +45 -12
  177. package/dist/planning/run-plan.js +4 -3
  178. package/dist/planning/suites.d.ts +1 -1
  179. package/dist/planning/suites.js +2 -2
  180. package/dist/planning/test-plan.d.ts +9 -0
  181. package/dist/planning/test-plan.js +9 -0
  182. package/dist/run-directory/recording.js +2 -2
  183. package/dist/run-directory/run-record.d.ts +21 -6
  184. package/dist/run-directory/run-record.js +12 -9
  185. package/dist/runner/base.js +1 -1
  186. package/dist/runner/build-snapshots.d.ts +55 -29
  187. package/dist/runner/build-snapshots.js +130 -29
  188. package/dist/runner/context.d.ts +15 -7
  189. package/dist/runner/context.js +19 -6
  190. package/dist/runner/events.d.ts +16 -10
  191. package/dist/runner/gateways.d.ts +87 -21
  192. package/dist/runner/gateways.js +1 -1
  193. package/dist/runner/index.d.ts +11 -7
  194. package/dist/runner/index.js +9 -4
  195. package/dist/runner/live/sandbox-errors.d.ts +2 -0
  196. package/dist/runner/live/sandbox-errors.js +4 -0
  197. package/dist/runner/live/sandbox-gateway.js +129 -3
  198. package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
  199. package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
  200. package/dist/runner/live/snapshot-records.js +6 -7
  201. package/dist/runner/local-snapshot-index.d.ts +199 -0
  202. package/dist/runner/local-snapshot-index.js +211 -0
  203. package/dist/runner/network-policy.d.ts +6 -6
  204. package/dist/runner/network-policy.js +7 -7
  205. package/dist/runner/policy-writes.d.ts +1 -1
  206. package/dist/runner/policy-writes.js +1 -1
  207. package/dist/runner/prepare.d.ts +14 -14
  208. package/dist/runner/prepare.js +20 -11
  209. package/dist/runner/ready.d.ts +18 -10
  210. package/dist/runner/ready.js +104 -33
  211. package/dist/runner/sandboxed-command.d.ts +3 -3
  212. package/dist/runner/sandboxed-command.js +3 -3
  213. package/dist/runner/scope.d.ts +10 -6
  214. package/dist/runner/scope.js +10 -3
  215. package/dist/runner/secrets.d.ts +13 -13
  216. package/dist/runner/secrets.js +18 -15
  217. package/dist/runner/session.d.ts +8 -8
  218. package/dist/runner/session.js +3 -3
  219. package/dist/runner/shared-snapshot-entry.d.ts +92 -0
  220. package/dist/runner/shared-snapshot-entry.js +168 -0
  221. package/dist/runner/shared-snapshot-list.d.ts +81 -0
  222. package/dist/runner/shared-snapshot-list.js +155 -0
  223. package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
  224. package/dist/runner/shared-snapshot-lookup.js +118 -0
  225. package/dist/runner/shared-snapshot-prune.d.ts +58 -0
  226. package/dist/runner/shared-snapshot-prune.js +133 -0
  227. package/dist/runner/snapshot-build.d.ts +42 -14
  228. package/dist/runner/snapshot-build.js +32 -29
  229. package/dist/runner/snapshot-choice.js +1 -1
  230. package/dist/runner/snapshot-inspect.d.ts +39 -40
  231. package/dist/runner/snapshot-inspect.js +55 -35
  232. package/dist/runner/snapshot-key.d.ts +13 -12
  233. package/dist/runner/snapshot-key.js +13 -12
  234. package/dist/runner/steps.d.ts +1 -1
  235. package/dist/runner/steps.js +1 -1
  236. package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
  237. package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
  238. package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +24 -23
  239. package/dist/runner/{recipe.js → vercel-sandbox-options.js} +70 -69
  240. package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
  241. package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
  242. package/dist/sdk/extension/commands.d.ts +8 -3
  243. package/dist/sdk/extension/commands.js +3 -1
  244. package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
  245. package/dist/sdk/extension/credential-diagnosis.js +25 -5
  246. package/dist/sdk/extension/credential-source.d.ts +20 -3
  247. package/dist/sdk/extension/credential-source.js +4 -4
  248. package/dist/sdk/extension/index.d.ts +3 -2
  249. package/dist/sdk/extension/index.js +2 -1
  250. package/dist/sdk/extension/resource-definition.d.ts +1 -1
  251. package/dist/sdk/extension/secret-source.d.ts +1 -1
  252. package/dist/sdk/extension/secret-source.js +1 -1
  253. package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
  254. package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
  255. package/dist/shared/cleanup.d.ts +3 -3
  256. package/dist/shared/cleanup.js +15 -5
  257. package/dist/shared/snapshot-text.d.ts +4 -4
  258. package/dist/shared/snapshot-text.js +11 -11
  259. package/dist/time/duration.js +1 -1
  260. package/package.json +3 -2
  261. package/skills/overview.md +4 -4
  262. package/skills/plan-runs.md +1 -1
  263. package/skills/read-run-output.md +6 -6
  264. package/dist/chunks/chunk-7EENF73W.js +0 -782
  265. package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
  266. package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
  267. package/dist/commands/exec/across-sandboxes-run.js +0 -339
  268. package/dist/commands/exec/plan-only.d.ts +0 -10
  269. package/dist/commands/exec/plan-only.js +0 -45
  270. package/dist/commands/exec/run-command.d.ts +0 -475
  271. package/dist/commands/exec/run-command.js +0 -603
  272. package/dist/commands/exec/run-planned.d.ts +0 -20
  273. package/dist/commands/exec/run-planned.js +0 -22
  274. package/dist/commands/exec/sandbox-view.d.ts +0 -19
  275. package/dist/commands/exec/sandbox-view.js +0 -72
  276. package/dist/commands/test/plan.d.ts +0 -92
  277. package/dist/commands/test/plan.js +0 -125
  278. package/dist/core/sandbox-end.d.ts +0 -64
  279. package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
  280. package/dist/runner/snapshot-cache.d.ts +0 -148
  281. package/dist/runner/snapshot-cache.js +0 -126
@@ -3,84 +3,74 @@ import {
3
3
  resolveProjectTests,
4
4
  resolveSuite,
5
5
  targetRedactor
6
- } from "../../chunks/chunk-OIY3DMF2.js";
6
+ } from "../../chunks/chunk-6UHIJXZG.js";
7
7
  import {
8
8
  suiteNamesText,
9
9
  suiteNotFoundErrors
10
- } from "../../chunks/chunk-CK2GZEPK.js";
10
+ } from "../../chunks/chunk-7DZE67QM.js";
11
11
  import {
12
12
  DRIVER_FILE_LISTS_HELP,
13
13
  DRIVER_SANDBOXES_HELP,
14
- SANDBOXES_DEFAULT_KEY,
15
- planAskedSandboxesRun,
16
- planDefaultSandboxesRun,
14
+ RUN_CLI_OPTIONS,
15
+ RUN_REQUEST_FIELDS,
16
+ driverSandboxesProblem,
17
+ executePlannedRun,
18
+ planRun,
19
+ runFlagProblems,
17
20
  runHelp,
18
- runPlanned
19
- } from "../../chunks/chunk-7EENF73W.js";
21
+ sandboxesFlagProblems
22
+ } from "../../chunks/chunk-JN3YY6ZH.js";
23
+ import "../../chunks/chunk-RWIXDDCK.js";
24
+ import "../../chunks/chunk-MR77L2GK.js";
25
+ import "../../chunks/chunk-I5GZLOLQ.js";
20
26
  import {
21
27
  PLANNED_DESCRIPTION,
22
28
  RAN_DESCRIPTION,
23
- RUN_CLI_OPTIONS,
24
29
  RUN_ERRORS,
25
- RUN_REQUEST_FIELDS,
26
30
  SANDBOXES_RAN_DESCRIPTION,
27
- canceledBeforeStart,
28
- checkoutFailedRefusal,
29
31
  fileListErrors,
30
- planCommandRun,
31
32
  plannedSchema,
32
33
  ranSchema,
33
- readFileListsFile,
34
34
  renderPlanned,
35
35
  renderRan,
36
36
  renderSandboxesRan,
37
- resolveCallerFileLists,
38
- runFlagProblems,
39
37
  sandboxesDefaultErrors,
40
38
  sandboxesErrors,
41
- sandboxesFlagProblems,
42
39
  sandboxesRanSchema
43
- } from "../../chunks/chunk-Z5PBVG3Y.js";
44
- import "../../chunks/chunk-I5GZLOLQ.js";
45
- import {
46
- dealFileLists,
47
- recordedPlan
48
- } from "../../chunks/chunk-FCQUJDA4.js";
40
+ } from "../../chunks/chunk-2VP4GRJM.js";
41
+ import "../../chunks/chunk-FNBB6V4R.js";
42
+ import "../../chunks/chunk-M7EKRGVD.js";
43
+ import "../../chunks/chunk-F4MOYHRY.js";
49
44
  import {
50
45
  DRIVER_NAMES,
51
46
  driverNamed
52
- } from "../../chunks/chunk-DWEAHX4T.js";
53
- import "../../chunks/chunk-R7XVBZOY.js";
54
- import "../../chunks/chunk-CN4EFA5J.js";
55
- import "../../chunks/chunk-HVNK3I45.js";
56
- import "../../chunks/chunk-3L52KNQA.js";
57
- import "../../chunks/chunk-VUPZH7J2.js";
58
- import "../../chunks/chunk-ZG3WQ4UF.js";
59
- import "../../chunks/chunk-5CCP36QQ.js";
60
- import "../../chunks/chunk-2MAD5NKK.js";
47
+ } from "../../chunks/chunk-HWIQ2S7K.js";
48
+ import "../../chunks/chunk-EEENLQHE.js";
49
+ import "../../chunks/chunk-72ZFEMAW.js";
50
+ import "../../chunks/chunk-BCBKYOHW.js";
51
+ import "../../chunks/chunk-D27KILIA.js";
52
+ import "../../chunks/chunk-2RNDPDTJ.js";
53
+ import "../../chunks/chunk-CKGZA25H.js";
54
+ import "../../chunks/chunk-GRT3UIBV.js";
61
55
  import {
62
56
  planSchema
63
- } from "../../chunks/chunk-P357TZAY.js";
64
- import "../../chunks/chunk-G3PHMXH5.js";
57
+ } from "../../chunks/chunk-4O5C2XGJ.js";
65
58
  import "../../chunks/chunk-F6N34UWB.js";
66
- import "../../chunks/chunk-FOZWA52V.js";
59
+ import "../../chunks/chunk-YEPFSLQR.js";
67
60
  import {
68
61
  CONFIG_FILE_NAME,
69
- CONFIG_FILE_NAMES_TEXT,
70
- resolveSandboxCountDefault
71
- } from "../../chunks/chunk-DC2CDHNK.js";
62
+ CONFIG_FILE_NAMES_TEXT
63
+ } from "../../chunks/chunk-RNAS7JHE.js";
72
64
  import {
73
- DRIVER_PLAN_FAILURE_KINDS,
74
- NOT_COUNTED
75
- } from "../../chunks/chunk-AWBSONHB.js";
65
+ DRIVER_PLAN_FAILURE_KINDS
66
+ } from "../../chunks/chunk-XBDRVFEV.js";
76
67
  import {
77
68
  stormCommands
78
- } from "../../chunks/chunk-5VXBKPW6.js";
69
+ } from "../../chunks/chunk-WV3DP6NR.js";
79
70
  import {
80
71
  defineErrors,
81
- defineOutcomes,
82
- refused
83
- } from "../../chunks/chunk-VL7WFTVQ.js";
72
+ defineOutcomes
73
+ } from "../../chunks/chunk-4WAMTUWZ.js";
84
74
 
85
75
  // src/commands/test/command.ts
86
76
  import { z as z3 } from "zod";
@@ -257,198 +247,6 @@ var outcomes = defineOutcomes({
257
247
  }
258
248
  });
259
249
 
260
- // src/planning/driver-file-lists.ts
261
- function driverSandboxesRun(run) {
262
- const asked = run.asked.from === "flag" ? run.asked.count : Math.min(run.asked.default, run.max);
263
- const lists = dealFileLists(run.testFiles, asked);
264
- return {
265
- count: {
266
- count: lists.length,
267
- from: run.asked.from,
268
- max: run.max,
269
- ...run.asked.from === "default" ? { default: run.asked.default } : {},
270
- ...lists.length < asked ? { requested: asked } : {}
271
- },
272
- sandboxes: lists.map((files) => ({ argv: run.argv, files }))
273
- };
274
- }
275
- function driverCallerFileListsRun(run) {
276
- const resolved = resolveCallerFileLists(run.testFiles, run.lists);
277
- if (!resolved.ok) return resolved;
278
- return {
279
- ok: true,
280
- sandboxes: {
281
- count: {
282
- count: resolved.lists.length,
283
- from: "file-lists",
284
- max: run.max,
285
- ...resolved.leftOut > 0 ? { leftOut: resolved.leftOut } : {}
286
- },
287
- sandboxes: resolved.lists.map((files) => ({ argv: run.argv, files }))
288
- }
289
- };
290
- }
291
-
292
- // src/commands/exec/run-bin.ts
293
- import { join } from "node:path";
294
- async function findRunBin(app, name, where) {
295
- if (where.kind === "unsandboxed") {
296
- const cwd2 = app.cwd;
297
- const found2 = await app.packageBins.find(name, cwd2);
298
- return found2.ok ? { kind: "found", cwd: cwd2, counts: found2.path, runs: found2.path } : { kind: "not-found", cwd: cwd2, searched: found2.searched };
299
- }
300
- const root = await app.context.checkout.repositoryRoot({ cwd: app.cwd });
301
- if (!root.ok) return { kind: "checkout-failed", failure: root.failure };
302
- const cwd = join(root.value, where.recipe.cwd);
303
- const found = await app.context.packageBins.find({ name, from: cwd, root: root.value });
304
- return found.ok ? { kind: "found", cwd, counts: found.path, runs: name } : { kind: "not-found", cwd, searched: found.searched };
305
- }
306
-
307
- // src/commands/exec/driver-plan.ts
308
- function driverCount(driver, testPlan, countTests) {
309
- if (!testPlan && !countTests) return void 0;
310
- return { countTests: driver.countsFilesOnly !== true || countTests };
311
- }
312
- async function planDriverCommand(app, driver, errors, args, count, where, signal) {
313
- const { bin: name } = driver.program;
314
- if (count === void 0 && where.kind === "runner")
315
- return { ok: true, argv: driver.launch(name, args), testPlan: NOT_COUNTED.testPlan };
316
- const bin = await findRunBin(app, name, where);
317
- if (bin.kind === "checkout-failed") return refused(checkoutFailedRefusal(bin.failure));
318
- const planned = { args, cwd: bin.cwd };
319
- if (bin.kind === "not-found")
320
- return refused(
321
- errors.planFailed(
322
- driver.name,
323
- { kind: "start-failed", message: `found no ${name} in node_modules/.bin of ${bin.searched.join(", ")}` },
324
- planned
325
- )
326
- );
327
- if (count === void 0) return { ok: true, argv: driver.launch(bin.runs, args), testPlan: NOT_COUNTED.testPlan };
328
- const contexts = app.driverContexts;
329
- const answer = await driver.plan(contexts[driver.name])({
330
- ...planned,
331
- bin: bin.counts,
332
- countTests: count.countTests,
333
- signal
334
- });
335
- if (!answer.ok) {
336
- const { kind, message } = answer;
337
- if (kind === "canceled") return refused(canceledBeforeStart());
338
- return refused(errors.planFailed(driver.name, { kind, message }, planned));
339
- }
340
- const { tests, files } = answer.plan;
341
- if ((tests ?? files) === 0) return refused(errors.noMatchingTests(driver.name, planned));
342
- return {
343
- ok: true,
344
- argv: driver.launch(bin.runs, args),
345
- testPlan: { kind: "counted", ...tests === void 0 ? {} : { tests }, files },
346
- ...answer.testFiles === void 0 ? {} : { testFiles: answer.testFiles }
347
- };
348
- }
349
-
350
- // src/commands/test/plan.ts
351
- function driverSandboxesProblem(driver, args, asks) {
352
- const flag = asks.fileLists !== void 0 ? "--file-lists" : asks.sandboxes !== void 0 ? "--sandboxes" : void 0;
353
- if (flag === void 0) return void 0;
354
- if (driver.fileLists === void 0)
355
- return {
356
- kind: "unsupported",
357
- flag,
358
- problem: `The ${driver.name} driver has no file list support, so storm test can't run it across runner sandboxes.`
359
- };
360
- const checked = driver.fileLists.validate(args);
361
- return checked.ok ? void 0 : { kind: "args", flag, problem: checked.problem };
362
- }
363
- function testSandboxesProblems(request) {
364
- const { sandboxes } = request;
365
- return sandboxes === void 0 || Number.isInteger(sandboxes) && sandboxes >= 1 ? [] : [{ field: "sandboxes", message: `--sandboxes takes a whole number from 1, not ${sandboxes}.` }];
366
- }
367
- async function planTestRun({ app, signal }, driver, errors, args, request, asks) {
368
- const { countTests, sandboxes, fileLists: listsPath } = asks;
369
- const planDriverSandboxes = (make) => async (plan, planSignal) => {
370
- const planned = await planDriverCommand(
371
- app,
372
- driver,
373
- errors,
374
- args,
375
- { countTests: driver.countsFilesOnly !== true || countTests },
376
- plan.where,
377
- planSignal
378
- );
379
- if (!planned.ok) return planned;
380
- const { argv, testPlan, testFiles } = planned;
381
- if (testFiles === void 0)
382
- throw new Error(
383
- `planTestRun: driver ${driver.name} has file list support, and its plan step answered no test files`
384
- );
385
- const made = make({ argv, testFiles, testPlan }, plan);
386
- if (!made.ok) return made;
387
- return { ok: true, argv, testPlan, testFiles, sandboxes: made.sandboxes };
388
- };
389
- let lists;
390
- if (listsPath !== void 0) {
391
- const read = await readFileListsFile(app.context.fileListsFiles, { path: listsPath, cwd: app.cwd, sandboxes });
392
- if (!read.ok)
393
- return refused(
394
- read.kind === "unreadable" ? fileListErrors.fileListsUnreadable({ path: read.path, problem: read.problem, message: read.message }) : fileListErrors.invalidFileLists({
395
- path: read.path,
396
- problems: read.problems.map(
397
- (problem) => problem.kind === "in-two-lists" ? { ...problem, sandboxes: [...problem.sandboxes] } : { ...problem }
398
- )
399
- })
400
- );
401
- lists = read.lists;
402
- }
403
- const asked = lists !== void 0 ? { count: lists.lists.length, flag: "--file-lists" } : sandboxes === void 0 ? void 0 : { count: sandboxes, flag: "--sandboxes" };
404
- if (asked !== void 0) {
405
- const planSandboxes = planDriverSandboxes(
406
- ({ argv, testFiles }, { max }) => {
407
- if (lists === void 0)
408
- return {
409
- ok: true,
410
- sandboxes: driverSandboxesRun({ argv, testFiles, asked: { from: "flag", count: asked.count }, max })
411
- };
412
- const resolved = driverCallerFileListsRun({ argv, testFiles, lists, max });
413
- return resolved.ok ? resolved : refused(
414
- fileListErrors.fileListsUnlisted({
415
- path: lists.path,
416
- files: [...resolved.unlisted],
417
- listed: resolved.listed
418
- })
419
- );
420
- }
421
- );
422
- return await planAskedSandboxesRun(app, request, asked, planSandboxes, signal);
423
- }
424
- const planCommand = async (where, planSignal, { testPlan }) => await planDriverCommand(app, driver, errors, args, driverCount(driver, testPlan, countTests), where, planSignal);
425
- if (driver.fileLists === void 0) return await planCommandRun(app, request, planCommand, signal);
426
- const planDefaultSandboxes = planDriverSandboxes(
427
- ({ argv, testFiles, testPlan }, { where, max, settings }) => {
428
- const sandboxesDefault = where.recipe.sandboxes?.default;
429
- if (sandboxesDefault === void 0)
430
- throw new Error("planTestRun: a run across runner sandboxes from the default needs runner.sandboxes.default");
431
- const resolved = resolveSandboxCountDefault(sandboxesDefault, testPlan);
432
- const checked = driver.fileLists?.validate(args);
433
- if (checked !== void 0 && !checked.ok)
434
- return refused(
435
- sandboxesDefaultErrors.sandboxesDefaultRefused({
436
- key: SANDBOXES_DEFAULT_KEY,
437
- sandboxes: Math.min(resolved, max, testFiles.length),
438
- field: "args",
439
- problem: checked.problem,
440
- configFile: settings.configFile
441
- })
442
- );
443
- return {
444
- ok: true,
445
- sandboxes: driverSandboxesRun({ argv, testFiles, asked: { from: "default", default: resolved }, max })
446
- };
447
- }
448
- );
449
- return await planDefaultSandboxesRun(app, request, planCommand, planDefaultSandboxes, signal);
450
- }
451
-
452
250
  // src/commands/test/test-words.ts
453
251
  var TEST_HELP = {
454
252
  usage: "[--suite <NAME>] [--count-tests] [--sandboxes <N> | --file-lists <PATH>] [<args>...] [-- <dash options>...]",
@@ -491,6 +289,10 @@ var COUNT_TESTS_FLAG_HELP = {
491
289
 
492
290
  // src/commands/test/command.ts
493
291
  var help = runHelp(TEST_HELP, "args");
292
+ function testSandboxesProblems(request) {
293
+ const { sandboxes } = request;
294
+ return sandboxes === void 0 || Number.isInteger(sandboxes) && sandboxes >= 1 ? [] : [{ field: "sandboxes", message: `--sandboxes takes a whole number from 1, not ${sandboxes}.` }];
295
+ }
494
296
  var command_default = stormCommands.define({
495
297
  requestSchema: z3.object({
496
298
  ...RUN_REQUEST_FIELDS,
@@ -541,18 +343,16 @@ var command_default = stormCommands.define({
541
343
  configFile: file.path
542
344
  });
543
345
  await ui.progress?.(preRunLine(target, request.args.length, targetRedactor(target, app.env)));
544
- const plan = await planTestRun(
545
- context,
546
- driver,
547
- testDriverRefusals,
548
- args,
346
+ const plan = await planRun(
347
+ app,
549
348
  { ...request, settingsFile: target.settingsFile, suite: target.name },
550
- { countTests: request.countTests, sandboxes, fileLists }
349
+ { kind: "driver", driver, args, countTests: request.countTests, errors: testDriverRefusals },
350
+ context.signal
551
351
  );
552
352
  if (!plan.ok) return plan.refusal;
553
353
  const test = { driver: driver.name, suite: target.name };
554
354
  const extraMismatchHint = driver.fileLists?.extraMismatchHint;
555
- return await runPlanned(
355
+ return await executePlannedRun(
556
356
  context,
557
357
  request,
558
358
  {
@@ -560,15 +360,12 @@ var command_default = stormCommands.define({
560
360
  test,
561
361
  hints: driver.hints,
562
362
  ...extraMismatchHint === void 0 ? {} : { extraMismatchHint },
563
- ran: (facts, { testPlan, options }, noFinalTestResults) => {
564
- const recorded = recordedPlan(testPlan, options);
565
- return outcomes.ran({
566
- ...facts,
567
- ...recorded === void 0 ? {} : { plan: recorded },
568
- noFinalTestResults,
569
- ...test
570
- });
571
- },
363
+ ran: (facts, plan2, noFinalTestResults) => outcomes.ran({
364
+ ...facts,
365
+ ...plan2 === void 0 ? {} : { plan: plan2 },
366
+ noFinalTestResults,
367
+ ...test
368
+ }),
572
369
  sandboxesRan: (facts, noFinalTestResults) => outcomes.sandboxesRan({ ...facts, noFinalTestResults, ...test }),
573
370
  planned: (facts) => outcomes.planned(facts)
574
371
  },
@@ -267,7 +267,7 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
267
267
  sandbox: z.ZodNumber;
268
268
  name: z.ZodString;
269
269
  stopsAt: z.ZodString;
270
- url: z.ZodString;
270
+ url: z.ZodNullable<z.ZodString>;
271
271
  }, z.core.$strip>>;
272
272
  notKept: z.ZodArray<z.ZodObject<{
273
273
  sandbox: z.ZodNumber;
@@ -553,6 +553,13 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
553
553
  minLength: number;
554
554
  configFile: string | null;
555
555
  }]>;
556
+ vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
557
+ cause: "invalid-token" | "missing-token";
558
+ detail: string;
559
+ fix: string;
560
+ runner: boolean;
561
+ cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
562
+ }]>;
556
563
  }, {
557
564
  readonly conflictingOptions: import("@vercel/clinkr").SharedError<"conflicting_options", [data: {
558
565
  conflicts: {
@@ -765,4 +772,11 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
765
772
  minLength: number;
766
773
  configFile: string | null;
767
774
  }]>;
775
+ readonly vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
776
+ cause: "invalid-token" | "missing-token";
777
+ detail: string;
778
+ fix: string;
779
+ runner: boolean;
780
+ cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
781
+ }]>;
768
782
  }>;
@@ -3,9 +3,9 @@ import type { CheckedRunner } from "./runner.ts";
3
3
  import type { Checked } from "./schema.ts";
4
4
  /**
5
5
  * Checks a `runner` value from `storm.config.ts`. When `inherited` is given (the top level's raw `vercelSandbox`
6
- * options object), a suite's `vercelSandbox` options merge shallowly over `inherited` before `checkRecipe` runs, so
7
- * the suite may override only the top-level keys that differ. A declared `vcpus` rule is also checked against
8
- * `definitions` so unknown resources or options fail at config load.
6
+ * options object), a suite's `vercelSandbox` options merge shallowly over `inherited` before
7
+ * `checkVercelSandboxOptions` runs, so the suite may override only the top-level keys that differ. A declared `vcpus`
8
+ * rule is also checked against `definitions` so unknown resources or options fail at config load.
9
9
  */
10
10
  export declare function checkRunner(value: unknown, inherited?: Readonly<Record<string, unknown>>, definitions?: readonly ResourceDefinition[]): Checked<CheckedRunner>;
11
11
  /**
@@ -1,13 +1,14 @@
1
1
  // Checks a `runner` value from `storm.config.ts` (top-level or suite) and extracts top-level `vercelSandbox` options
2
- // so a suite of the same kind can merge its partial options over them before `checkRecipe` fills defaults.
3
- import { checkRecipe } from "../runner/index.js";
2
+ // so a suite of the same kind can merge its partial options over them before `checkVercelSandboxOptions` fills
3
+ // defaults.
4
+ import { checkVercelSandboxOptions } from "../runner/index.js";
4
5
  import { describeValue } from "../sdk/extension/index.js";
5
6
  const FACTORY_HINT = "must be made by vercelSandbox({ … }) or launchMachine()";
6
7
  /**
7
8
  * Checks a `runner` value from `storm.config.ts`. When `inherited` is given (the top level's raw `vercelSandbox`
8
- * options object), a suite's `vercelSandbox` options merge shallowly over `inherited` before `checkRecipe` runs, so
9
- * the suite may override only the top-level keys that differ. A declared `vcpus` rule is also checked against
10
- * `definitions` so unknown resources or options fail at config load.
9
+ * options object), a suite's `vercelSandbox` options merge shallowly over `inherited` before
10
+ * `checkVercelSandboxOptions` runs, so the suite may override only the top-level keys that differ. A declared `vcpus`
11
+ * rule is also checked against `definitions` so unknown resources or options fail at config load.
11
12
  */
12
13
  export function checkRunner(value, inherited, definitions = []) {
13
14
  if (!isRecord(value)) {
@@ -33,13 +34,13 @@ export function checkRunner(value, inherited, definitions = []) {
33
34
  ...inherited,
34
35
  ...Object.fromEntries(Object.entries(options).filter(([, entry]) => entry !== undefined)),
35
36
  };
36
- const checked = checkRecipe(rawOptions);
37
+ const checked = checkVercelSandboxOptions(rawOptions);
37
38
  if (!checked.ok)
38
39
  return checked;
39
40
  const vcpusProblems = checkVcpusRuleDefinitions(checked.value.vcpus, definitions);
40
41
  if (vcpusProblems.length > 0)
41
42
  return { ok: false, problems: vcpusProblems };
42
- return { ok: true, value: { kind: "vercel-sandbox", recipe: checked.value } };
43
+ return { ok: true, value: { kind: "vercel-sandbox", options: checked.value } };
43
44
  }
44
45
  return { ok: false, problems: [{ path: [], problem: `${FACTORY_HINT}, not ${describeValue(value)}` }] };
45
46
  }
@@ -1,6 +1,6 @@
1
1
  import { type Refusable } from "@vercel/clinkr";
2
2
  import { z } from "zod";
3
- import { type Credential, type CredentialContext, type CredentialFailure, type CredentialOrigin, type CredentialSourceChoice } from "../credential/index.ts";
3
+ import { type Credential, type CredentialContext, type CredentialFailure, type CredentialOrigin, type CredentialSourceChoice, type VercelProjectOutcome } from "../credential/index.ts";
4
4
  import { type credentialErrors } from "./credential-settle.ts";
5
5
  /**
6
6
  * The errors a credential source's `obtain()` refuses with. A command that obtains a credential spreads them into its
@@ -27,6 +27,14 @@ export declare const credentialSourceErrors: import("@vercel/clinkr").SharedErro
27
27
  detail: z.ZodString;
28
28
  fix: z.ZodString;
29
29
  }, z.core.$strip>;
30
+ vercelOidcTokenFailed: z.ZodObject<{
31
+ cause: z.ZodEnum<{
32
+ "invalid-token": "invalid-token";
33
+ "missing-token": "missing-token";
34
+ }>;
35
+ detail: z.ZodString;
36
+ fix: z.ZodString;
37
+ }, z.core.$strip>;
30
38
  }, {
31
39
  readonly mintFailed: {
32
40
  readonly exitCode: 1;
@@ -82,16 +90,39 @@ export declare const credentialSourceErrors: import("@vercel/clinkr").SharedErro
82
90
  }[];
83
91
  };
84
92
  };
93
+ readonly vercelOidcTokenFailed: {
94
+ readonly exitCode: 1;
95
+ readonly description: "With --credential vercel-oidc, VERCEL_OIDC_TOKEN is missing, empty, or not a valid Vercel project OIDC token.";
96
+ readonly schema: z.ZodObject<{
97
+ cause: z.ZodEnum<{
98
+ "invalid-token": "invalid-token";
99
+ "missing-token": "missing-token";
100
+ }>;
101
+ detail: z.ZodString;
102
+ fix: z.ZodString;
103
+ }, z.core.$strip>;
104
+ readonly render: ({ detail, fix }: {
105
+ cause: "invalid-token" | "missing-token";
106
+ detail: string;
107
+ fix: string;
108
+ }) => {
109
+ message: string;
110
+ next: {
111
+ type: "text";
112
+ text: string;
113
+ }[];
114
+ };
115
+ };
85
116
  }>;
86
117
  /** The error a credential source's `obtain()` refuses with. */
87
- export type CredentialSourceError = ReturnType<typeof credentialSourceErrors.mintFailed> | ReturnType<typeof credentialSourceErrors.tokenRequestFailed>;
118
+ export type CredentialSourceError = ReturnType<typeof credentialSourceErrors.mintFailed> | ReturnType<typeof credentialSourceErrors.tokenRequestFailed> | ReturnType<typeof credentialSourceErrors.vercelOidcTokenFailed>;
88
119
  /** A credential source's failure as the error `obtain()` refuses with. */
89
120
  export declare function credentialSourceError(failure: CredentialFailure): CredentialSourceError;
90
121
  /** A credential source as a command gets it from the credential launcher resolver. */
91
122
  export interface CommandCredentialSource {
92
123
  /**
93
124
  * A credential to use now, getting one first if the source holds none it would hand out, or the error to end the
94
- * command with: `mint_failed` or `token_request_failed`.
125
+ * command with: `mint_failed`, `token_request_failed`, or `vercel_oidc_token_failed`.
95
126
  */
96
127
  obtain(): Promise<Refusable<{
97
128
  readonly credential: Credential;
@@ -115,6 +146,13 @@ export interface CredentialTarget {
115
146
  export interface CredentialReport {
116
147
  readonly progress?: ((line: string) => Promise<void>) | undefined;
117
148
  }
149
+ /**
150
+ * A credential source for a Vercel Sandbox, as a command gets it from the credential launcher resolver: what it
151
+ * obtains carries the team and project the credential names, or why it has none (`VercelProjectOutcome`).
152
+ */
153
+ export interface CommandVercelProjectSource {
154
+ readonly obtain: () => Promise<VercelProjectOutcome>;
155
+ }
118
156
  /**
119
157
  * The credential launcher resolver. A command that uses it spreads `credentialErrors` and `credentialSourceErrors` into
120
158
  * its outcomes.
@@ -122,12 +160,19 @@ export interface CredentialReport {
122
160
  export interface CredentialResolver {
123
161
  /**
124
162
  * The credential source `choice` names. The mint needs the target's team and project, and refuses with
125
- * `missing_target` without either; a GitHub Actions OIDC token request needs neither. It gets nothing until
126
- * `obtain()`.
163
+ * `missing_target` without either; `github-actions` and `vercel-oidc` need neither. It gets nothing until `obtain()`.
127
164
  */
128
165
  source(choice: CredentialSourceChoice["source"], target: CredentialTarget, report?: CredentialReport): Refusable<{
129
166
  readonly source: CommandCredentialSource;
130
167
  }, ReturnType<typeof credentialErrors.missingTarget>>;
168
+ /**
169
+ * The credential source `choice` names for a Vercel Sandbox (`mint` or `vercel-oidc`), whose credential comes with
170
+ * the team and project it names (`vercelProjectSource`). It refuses as `source` does, and gets nothing until
171
+ * `obtain()`.
172
+ */
173
+ vercelProjectSource(choice: "mint" | "vercel-oidc", target: CredentialTarget, report?: CredentialReport): Refusable<{
174
+ readonly source: CommandVercelProjectSource;
175
+ }, ReturnType<typeof credentialErrors.missingTarget>>;
131
176
  }
132
177
  /** The credential launcher resolver over `gateways`. */
133
178
  export declare function credentialResolver(gateways: CredentialContext): CredentialResolver;
@@ -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
  }