@cnc-tools/storm 0.14.2 → 0.16.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 (414) hide show
  1. package/dist/application.js +3 -1
  2. package/dist/bin/storm.js +9 -7
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/chunk-2MAD5NKK.js +108 -0
  5. package/dist/chunks/{chunk-HDL4WKIB.js → chunk-3L52KNQA.js} +2 -2
  6. package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
  7. package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
  8. package/dist/chunks/chunk-7EENF73W.js +782 -0
  9. package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
  10. package/dist/chunks/chunk-CK2GZEPK.js +40 -0
  11. package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
  12. package/dist/chunks/{chunk-I7AN3DIJ.js → chunk-DC2CDHNK.js} +1928 -738
  13. package/dist/chunks/{chunk-UUBZTGLV.js → chunk-DWEAHX4T.js} +140 -130
  14. package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
  15. package/dist/chunks/chunk-FCQUJDA4.js +963 -0
  16. package/dist/chunks/{chunk-VH2POPW5.js → chunk-FOZWA52V.js} +635 -79
  17. package/dist/chunks/{chunk-XZCDA5PE.js → chunk-G3PHMXH5.js} +7 -2
  18. package/dist/chunks/{chunk-3HBPNQ4Y.js → chunk-HVNK3I45.js} +2 -2
  19. package/dist/chunks/chunk-OIY3DMF2.js +74 -0
  20. package/dist/chunks/{chunk-GJOEPJJL.js → chunk-P357TZAY.js} +446 -52
  21. package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
  22. package/dist/chunks/chunk-TJNFVNKR.js +246 -0
  23. package/dist/chunks/{chunk-RUPD4TLT.js → chunk-V4IKA3WI.js} +198 -63
  24. package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
  25. package/dist/chunks/{chunk-LUOHJ3LB.js → chunk-Z5PBVG3Y.js} +1131 -468
  26. package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
  27. package/dist/chunks/{live-app-SZGEILCQ.js → live-app-WECQOQ4C.js} +28 -23
  28. package/dist/command-tree.d.ts +2 -2
  29. package/dist/command-tree.js +2 -2
  30. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
  31. package/dist/commands/exec/across-sandboxes-outcomes.js +230 -0
  32. package/dist/commands/exec/across-sandboxes-run.d.ts +180 -0
  33. package/dist/commands/exec/across-sandboxes-run.js +339 -0
  34. package/dist/commands/exec/command.d.ts +583 -75
  35. package/dist/commands/exec/command.js +165 -32
  36. package/dist/commands/exec/driver-plan.d.ts +8 -2
  37. package/dist/commands/exec/driver-plan.js +13 -3
  38. package/dist/commands/exec/exec-words.d.ts +17 -3
  39. package/dist/commands/exec/exec-words.js +27 -16
  40. package/dist/commands/exec/live-view.d.ts +3 -4
  41. package/dist/commands/exec/live-view.js +37 -28
  42. package/dist/commands/exec/metadata.js +2 -2
  43. package/dist/commands/exec/mint-failed.d.ts +4 -4
  44. package/dist/commands/exec/mint-failed.js +6 -6
  45. package/dist/commands/exec/outcomes.d.ts +533 -73
  46. package/dist/commands/exec/outcomes.js +203 -67
  47. package/dist/commands/exec/plan-only.d.ts +10 -0
  48. package/dist/commands/exec/plan-only.js +45 -0
  49. package/dist/commands/exec/plan-run.d.ts +54 -35
  50. package/dist/commands/exec/plan-run.js +81 -38
  51. package/dist/commands/exec/planned-outcome.d.ts +15 -0
  52. package/dist/commands/exec/planned-outcome.js +42 -0
  53. package/dist/commands/exec/progress.d.ts +2 -2
  54. package/dist/commands/exec/progress.js +35 -18
  55. package/dist/commands/exec/resource-refusals.d.ts +2 -2
  56. package/dist/commands/exec/resource-refusals.js +3 -3
  57. package/dist/commands/exec/run-bin.d.ts +1 -1
  58. package/dist/commands/exec/run-bin.js +2 -2
  59. package/dist/commands/exec/run-command.d.ts +344 -63
  60. package/dist/commands/exec/run-command.js +312 -263
  61. package/dist/commands/exec/run-metadata.d.ts +42 -8
  62. package/dist/commands/exec/run-metadata.js +40 -21
  63. package/dist/commands/exec/run-planned.d.ts +20 -0
  64. package/dist/commands/exec/run-planned.js +22 -0
  65. package/dist/commands/exec/sandbox-lines.d.ts +42 -0
  66. package/dist/commands/exec/sandbox-lines.js +59 -0
  67. package/dist/commands/exec/sandbox-progress.d.ts +30 -0
  68. package/dist/commands/exec/sandbox-progress.js +232 -0
  69. package/dist/commands/exec/sandbox-view.d.ts +19 -0
  70. package/dist/commands/exec/sandbox-view.js +72 -0
  71. package/dist/commands/exec/view.d.ts +3 -2
  72. package/dist/commands/exec/view.js +10 -6
  73. package/dist/commands/runs/facts.d.ts +53 -10
  74. package/dist/commands/runs/facts.js +60 -32
  75. package/dist/commands/runs/list/command.d.ts +82 -4
  76. package/dist/commands/runs/list/command.js +11 -10
  77. package/dist/commands/runs/list/metadata.js +1 -1
  78. package/dist/commands/runs/list/outcomes.d.ts +41 -2
  79. package/dist/commands/runs/logs/command.d.ts +109 -10
  80. package/dist/commands/runs/logs/command.js +139 -24
  81. package/dist/commands/runs/logs/metadata.d.ts +4 -0
  82. package/dist/commands/runs/logs/metadata.js +14 -7
  83. package/dist/commands/runs/logs/outcomes.d.ts +52 -3
  84. package/dist/commands/runs/logs/outcomes.js +110 -6
  85. package/dist/commands/runs/past-run.d.ts +91 -11
  86. package/dist/commands/runs/past-run.js +149 -9
  87. package/dist/commands/runs/show/command.d.ts +574 -12
  88. package/dist/commands/runs/show/command.js +634 -119
  89. package/dist/commands/runs/show/metadata.d.ts +17 -0
  90. package/dist/commands/runs/show/metadata.js +48 -7
  91. package/dist/commands/runs/show/outcomes.d.ts +279 -6
  92. package/dist/commands/runs/show/outcomes.js +484 -96
  93. package/dist/commands/snapshots/build/command.d.ts +109 -18
  94. package/dist/commands/snapshots/build/command.js +72 -36
  95. package/dist/commands/snapshots/build/metadata.d.ts +4 -0
  96. package/dist/commands/snapshots/build/metadata.js +5 -1
  97. package/dist/commands/snapshots/build/outcomes.d.ts +53 -8
  98. package/dist/commands/snapshots/build/outcomes.js +26 -3
  99. package/dist/commands/snapshots/list/command.d.ts +72 -7
  100. package/dist/commands/snapshots/list/command.js +57 -24
  101. package/dist/commands/snapshots/list/metadata.d.ts +4 -0
  102. package/dist/commands/snapshots/list/metadata.js +5 -1
  103. package/dist/commands/snapshots/list/outcomes.d.ts +31 -0
  104. package/dist/commands/snapshots/list/outcomes.js +25 -2
  105. package/dist/commands/suites/list/command.d.ts +129 -0
  106. package/dist/commands/suites/list/command.js +163 -0
  107. package/dist/commands/suites/list/metadata.d.ts +11 -0
  108. package/dist/commands/suites/list/metadata.js +15 -0
  109. package/dist/commands/suites/list/outcomes.d.ts +91 -0
  110. package/dist/commands/suites/list/outcomes.js +122 -0
  111. package/dist/commands/suites/metadata.js +8 -0
  112. package/dist/commands/test/command.d.ts +1395 -0
  113. package/dist/commands/test/command.js +581 -0
  114. package/dist/commands/test/metadata.js +8 -0
  115. package/dist/commands/test/outcomes.d.ts +768 -0
  116. package/dist/commands/test/outcomes.js +140 -0
  117. package/dist/commands/test/plan.d.ts +92 -0
  118. package/dist/commands/test/plan.js +125 -0
  119. package/dist/commands/test/test-words.d.ts +12 -0
  120. package/dist/commands/test/test-words.js +42 -0
  121. package/dist/config/check-resources.d.ts +14 -0
  122. package/dist/config/check-resources.js +98 -0
  123. package/dist/config/check-runner.d.ts +15 -0
  124. package/dist/config/check-runner.js +79 -0
  125. package/dist/config/check-suites.d.ts +14 -0
  126. package/dist/config/check-suites.js +100 -0
  127. package/dist/config/gateways.d.ts +31 -3
  128. package/dist/config/index.d.ts +8 -6
  129. package/dist/config/index.js +5 -4
  130. package/dist/config/live/config-gateway.js +5 -2
  131. package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
  132. package/dist/config/live/file-lists-file-gateway.js +27 -0
  133. package/dist/config/load.d.ts +32 -14
  134. package/dist/config/load.js +162 -116
  135. package/dist/config/resolve.d.ts +3 -2
  136. package/dist/config/resolve.js +6 -3
  137. package/dist/config/resolver.d.ts +20 -6
  138. package/dist/config/resolver.js +11 -8
  139. package/dist/config/runner.d.ts +23 -0
  140. package/dist/config/runner.js +4 -0
  141. package/dist/config/schema.d.ts +39 -19
  142. package/dist/config/schema.js +50 -10
  143. package/dist/config/settings-file.d.ts +9 -3
  144. package/dist/config/settings-file.js +41 -4
  145. package/dist/config/suite.d.ts +39 -0
  146. package/dist/config/suite.js +5 -0
  147. package/dist/config/typed-options.d.ts +1 -6
  148. package/dist/config/typed-options.js +2 -10
  149. package/dist/config-file/define.d.ts +45 -24
  150. package/dist/config-file/define.js +9 -8
  151. package/dist/config-file/runner.d.ts +11 -0
  152. package/dist/config-file/runner.js +9 -0
  153. package/dist/config-file/toolchain.d.ts +13 -7
  154. package/dist/config-file/toolchain.js +51 -35
  155. package/dist/context.d.ts +12 -8
  156. package/dist/context.js +9 -3
  157. package/dist/core/across-sandboxes.d.ts +43 -0
  158. package/dist/core/across-sandboxes.js +319 -0
  159. package/dist/core/before-run.d.ts +5 -3
  160. package/dist/core/before-run.js +12 -1
  161. package/dist/core/events.d.ts +62 -6
  162. package/dist/core/events.js +14 -0
  163. package/dist/core/index.d.ts +4 -2
  164. package/dist/core/index.js +3 -1
  165. package/dist/core/payload.d.ts +2 -1
  166. package/dist/core/payload.js +2 -1
  167. package/dist/core/presentations.js +1 -1
  168. package/dist/core/resource.d.ts +1 -1
  169. package/dist/core/resources.d.ts +56 -6
  170. package/dist/core/resources.js +81 -5
  171. package/dist/core/run-state.js +9 -0
  172. package/dist/core/run.d.ts +77 -15
  173. package/dist/core/run.js +150 -86
  174. package/dist/core/sandbox-end.d.ts +64 -0
  175. package/dist/core/sandbox-end.js +128 -0
  176. package/dist/core/timeline.d.ts +4 -4
  177. package/dist/core/timeline.js +3 -3
  178. package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
  179. package/dist/credential/live/vercel-cli-gateway.js +14 -1
  180. package/dist/extensions/github/context.d.ts +1 -1
  181. package/dist/extensions/github/definition.d.ts +11 -9
  182. package/dist/extensions/github/definition.js +8 -6
  183. package/dist/extensions/github/extension.d.ts +3 -3
  184. package/dist/extensions/github/fixture-repo.d.ts +21 -2
  185. package/dist/extensions/github/fixture-repo.js +31 -2
  186. package/dist/extensions/github/index.d.ts +2 -2
  187. package/dist/extensions/github/index.js +2 -2
  188. package/dist/extensions/github/lifecycle.d.ts +16 -6
  189. package/dist/extensions/github/lifecycle.js +42 -25
  190. package/dist/extensions/github/options.d.ts +17 -11
  191. package/dist/extensions/github/options.js +14 -13
  192. package/dist/extensions/github/refusals.d.ts +23 -6
  193. package/dist/extensions/github/refusals.js +34 -12
  194. package/dist/extensions/github/resource.d.ts +21 -12
  195. package/dist/extensions/github/resource.js +16 -8
  196. package/dist/extensions/github/run/payload.d.ts +6 -6
  197. package/dist/extensions/github/run/payload.js +3 -5
  198. package/dist/extensions/github/split.d.ts +10 -0
  199. package/dist/extensions/github/split.js +12 -0
  200. package/dist/extensions/playwright/driver.js +6 -26
  201. package/dist/extensions/playwright/extension.js +1 -1
  202. package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
  203. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  204. package/dist/extensions/testserver/definition.d.ts +4 -4
  205. package/dist/extensions/testserver/definition.js +41 -31
  206. package/dist/extensions/testserver/extension.d.ts +4 -5
  207. package/dist/extensions/testserver/extension.js +14 -41
  208. package/dist/extensions/testserver/index.d.ts +1 -1
  209. package/dist/extensions/testserver/index.js +1 -1
  210. package/dist/extensions/testserver/lifecycle.d.ts +10 -2
  211. package/dist/extensions/testserver/lifecycle.js +29 -6
  212. package/dist/extensions/testserver/options/rules.d.ts +5 -5
  213. package/dist/extensions/testserver/options/rules.js +10 -8
  214. package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
  215. package/dist/extensions/testserver/options/sandboxes.js +8 -3
  216. package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
  217. package/dist/extensions/testserver/pool/index.d.ts +2 -2
  218. package/dist/extensions/testserver/pool/index.js +1 -1
  219. package/dist/extensions/testserver/pool/lease.d.ts +10 -0
  220. package/dist/extensions/testserver/pool/lease.js +21 -0
  221. package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
  222. package/dist/extensions/testserver/refusals.d.ts +12 -0
  223. package/dist/extensions/testserver/refusals.js +18 -0
  224. package/dist/extensions/testserver/release.d.ts +16 -0
  225. package/dist/extensions/testserver/release.js +56 -4
  226. package/dist/extensions/testserver/resource.d.ts +6 -6
  227. package/dist/extensions/testserver/resource.js +3 -3
  228. package/dist/extensions/testserver/split.d.ts +9 -0
  229. package/dist/extensions/testserver/split.js +22 -0
  230. package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
  231. package/dist/extensions/testserver/vitest/fixtures.js +9 -38
  232. package/dist/extensions/vitest/driver.d.ts +7 -0
  233. package/dist/extensions/vitest/driver.js +33 -37
  234. package/dist/extensions/vitest/extension.js +1 -1
  235. package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
  236. package/dist/extensions/vitest/plan/plan-over.js +16 -2
  237. package/dist/extensions.d.ts +17 -16
  238. package/dist/extensions.js +5 -4
  239. package/dist/forward-sigterm.js +1 -1
  240. package/dist/launcher-resolvers/local-services.d.ts +1 -1
  241. package/dist/live-app.js +4 -3
  242. package/dist/local-services.js +1 -1
  243. package/dist/planning/driver-file-lists.d.ts +61 -0
  244. package/dist/planning/driver-file-lists.js +66 -0
  245. package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
  246. package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
  247. package/dist/planning/file-lists-file.d.ts +58 -0
  248. package/dist/planning/file-lists-file.js +105 -0
  249. package/dist/planning/file-lists.d.ts +28 -0
  250. package/dist/planning/file-lists.js +52 -0
  251. package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
  252. package/dist/{commands/exec → planning}/final-results.js +6 -6
  253. package/dist/planning/plan-only.d.ts +84 -0
  254. package/dist/planning/plan-only.js +86 -0
  255. package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
  256. package/dist/{commands/exec → planning}/redaction.js +5 -4
  257. package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
  258. package/dist/{commands/exec → planning}/resource-flags.js +6 -16
  259. package/dist/planning/run-kind-flags.d.ts +20 -0
  260. package/dist/planning/run-kind-flags.js +48 -0
  261. package/dist/planning/run-plan.d.ts +29 -0
  262. package/dist/planning/run-plan.js +4 -0
  263. package/dist/planning/sandbox-placeholders.d.ts +22 -0
  264. package/dist/planning/sandbox-placeholders.js +60 -0
  265. package/dist/planning/suite-not-found.d.ts +37 -0
  266. package/dist/planning/suite-not-found.js +36 -0
  267. package/dist/planning/suites.d.ts +43 -0
  268. package/dist/planning/suites.js +89 -0
  269. package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
  270. package/dist/{commands/exec → planning}/test-plan.js +32 -5
  271. package/dist/playwright/reporter.d.ts +20 -8
  272. package/dist/playwright/reporter.js +195 -15
  273. package/dist/presentation.d.ts +10 -6
  274. package/dist/presentation.js +13 -15
  275. package/dist/run-directory/gateways.d.ts +60 -4
  276. package/dist/run-directory/index.d.ts +4 -4
  277. package/dist/run-directory/index.js +2 -1
  278. package/dist/run-directory/live/run-directory-gateway.js +92 -16
  279. package/dist/run-directory/plan.d.ts +35 -2
  280. package/dist/run-directory/plan.js +44 -7
  281. package/dist/run-directory/reader.d.ts +26 -5
  282. package/dist/run-directory/reader.js +24 -1
  283. package/dist/run-directory/recording.d.ts +75 -49
  284. package/dist/run-directory/recording.js +214 -28
  285. package/dist/run-directory/run-directory.d.ts +22 -1
  286. package/dist/run-directory/run-directory.js +24 -0
  287. package/dist/run-directory/run-record.d.ts +144 -21
  288. package/dist/run-directory/run-record.js +118 -19
  289. package/dist/run-directory/timeline-facts.js +4 -4
  290. package/dist/runner/base.d.ts +0 -6
  291. package/dist/runner/base.js +0 -15
  292. package/dist/runner/build-snapshots.d.ts +7 -7
  293. package/dist/runner/build-snapshots.js +19 -24
  294. package/dist/runner/events.d.ts +29 -8
  295. package/dist/runner/gateways.d.ts +54 -6
  296. package/dist/runner/index.d.ts +6 -4
  297. package/dist/runner/index.js +3 -2
  298. package/dist/runner/live/sandbox-gateway.js +173 -31
  299. package/dist/runner/network-policy.d.ts +55 -0
  300. package/dist/runner/network-policy.js +46 -0
  301. package/dist/runner/policy-writes.d.ts +40 -0
  302. package/dist/runner/policy-writes.js +124 -0
  303. package/dist/runner/prepare.d.ts +16 -16
  304. package/dist/runner/prepare.js +11 -12
  305. package/dist/runner/ready.d.ts +39 -10
  306. package/dist/runner/ready.js +59 -47
  307. package/dist/runner/recipe-check.d.ts +6 -0
  308. package/dist/runner/recipe-check.js +29 -0
  309. package/dist/runner/recipe-secrets.d.ts +67 -0
  310. package/dist/runner/recipe-secrets.js +230 -0
  311. package/dist/runner/recipe.d.ts +151 -63
  312. package/dist/runner/recipe.js +277 -200
  313. package/dist/runner/sandboxed-command.d.ts +22 -8
  314. package/dist/runner/sandboxed-command.js +33 -10
  315. package/dist/runner/scope.d.ts +107 -21
  316. package/dist/runner/scope.js +274 -54
  317. package/dist/runner/secrets.d.ts +42 -31
  318. package/dist/runner/secrets.js +62 -40
  319. package/dist/runner/session.d.ts +59 -26
  320. package/dist/runner/session.js +82 -41
  321. package/dist/runner/snapshot-build.d.ts +8 -5
  322. package/dist/runner/snapshot-build.js +56 -29
  323. package/dist/runner/snapshot-choice.d.ts +37 -0
  324. package/dist/runner/snapshot-choice.js +38 -0
  325. package/dist/runner/snapshot-inspect.d.ts +4 -4
  326. package/dist/runner/snapshot-inspect.js +7 -7
  327. package/dist/runner/snapshot-key.d.ts +27 -17
  328. package/dist/runner/snapshot-key.js +51 -26
  329. package/dist/runner/steps.d.ts +13 -5
  330. package/dist/runner/steps.js +34 -4
  331. package/dist/runner/time-limit.d.ts +10 -0
  332. package/dist/runner/time-limit.js +43 -0
  333. package/dist/sdk/extension/commands.d.ts +1 -7
  334. package/dist/sdk/extension/driver.d.ts +39 -46
  335. package/dist/sdk/extension/driver.js +6 -6
  336. package/dist/sdk/extension/index.d.ts +3 -3
  337. package/dist/sdk/extension/index.js +3 -4
  338. package/dist/sdk/extension/lifecycle.d.ts +52 -9
  339. package/dist/sdk/extension/lifecycle.js +1 -1
  340. package/dist/sdk/extension/resource-definition.d.ts +16 -12
  341. package/dist/sdk/extension/resource-definition.js +10 -4
  342. package/dist/sdk/extension/resource-factory.js +3 -4
  343. package/dist/sdk/extension/resource.d.ts +2 -2
  344. package/dist/sdk/extension/secret-source.d.ts +58 -0
  345. package/dist/sdk/extension/secret-source.js +78 -0
  346. package/dist/sdk/index.d.ts +2 -2
  347. package/dist/sdk/index.js +1 -1
  348. package/dist/sdk/run/launcher.d.ts +1 -1
  349. package/dist/sdk/run/launcher.js +1 -1
  350. package/dist/sdk/run/payload.d.ts +16 -1
  351. package/dist/sdk/run/payload.js +17 -2
  352. package/dist/sdk/run/present.d.ts +3 -3
  353. package/dist/sdk/run/present.js +1 -3
  354. package/dist/sdk/run/redact.js +2 -2
  355. package/dist/sdk/run/test-events.d.ts +23 -6
  356. package/dist/sdk/run/test-events.js +6 -4
  357. package/dist/sdk/run/test-result-writer.d.ts +8 -3
  358. package/dist/sdk/run/test-result-writer.js +22 -2
  359. package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
  360. package/dist/{commands/exec → shared}/cleanup.js +11 -6
  361. package/dist/shared/job-summary.d.ts +19 -0
  362. package/dist/{commands/exec → shared}/job-summary.js +17 -0
  363. package/dist/shared/sandbox-table.d.ts +48 -0
  364. package/dist/shared/sandbox-table.js +109 -0
  365. package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
  366. package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
  367. package/dist/{commands/exec → shared}/tests-summary.js +74 -31
  368. package/dist/{commands/exec → shared}/text.d.ts +7 -2
  369. package/dist/{commands/exec → shared}/text.js +9 -1
  370. package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
  371. package/dist/{commands/exec → shared}/waterfall.js +71 -24
  372. package/dist/shared/worker-chart.d.ts +172 -0
  373. package/dist/shared/worker-chart.js +623 -0
  374. package/dist/vitest/config.d.ts +35 -11
  375. package/dist/vitest/config.js +47 -14
  376. package/dist/vitest/index.d.ts +1 -1
  377. package/dist/vitest/index.js +3 -3
  378. package/dist/vitest/sequencer.d.ts +23 -0
  379. package/dist/vitest/sequencer.js +73 -0
  380. package/dist/vitest/setup.d.ts +1 -0
  381. package/dist/vitest/setup.js +34 -0
  382. package/dist/vitest/test-events.d.ts +32 -6
  383. package/dist/vitest/test-events.js +25 -5
  384. package/dist/vitest/test-results.d.ts +8 -3
  385. package/dist/vitest/test-results.js +6 -0
  386. package/package.json +7 -2
  387. package/skills/overview.md +23 -17
  388. package/skills/plan-runs.md +67 -0
  389. package/skills/read-run-output.md +51 -19
  390. package/dist/chunks/chunk-E3QU74NX.js +0 -49
  391. package/dist/chunks/chunk-HP54VHGY.js +0 -201
  392. package/dist/chunks/chunk-NMVODY3P.js +0 -19
  393. package/dist/chunks/chunk-TVMEKVOW.js +0 -607
  394. package/dist/commands/exec/define-run-command.d.ts +0 -671
  395. package/dist/commands/exec/define-run-command.js +0 -91
  396. package/dist/commands/exec/job-summary.d.ts +0 -10
  397. package/dist/commands/exec/worker-chart.d.ts +0 -87
  398. package/dist/commands/exec/worker-chart.js +0 -343
  399. package/dist/commands/playwright/command.d.ts +0 -661
  400. package/dist/commands/playwright/command.js +0 -31
  401. package/dist/commands/playwright/metadata.js +0 -8
  402. package/dist/commands/vitest/command.d.ts +0 -662
  403. package/dist/commands/vitest/command.js +0 -31
  404. package/dist/commands/vitest/metadata.js +0 -8
  405. package/dist/config/recipe-run.d.ts +0 -26
  406. package/dist/config/recipe-run.js +0 -27
  407. package/dist/sdk/extension/ci.d.ts +0 -2
  408. package/dist/sdk/extension/ci.js +0 -6
  409. package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
  410. package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
  411. package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
  412. /package/dist/{commands → shared}/dashboard.d.ts +0 -0
  413. /package/dist/{commands → shared}/dashboard.js +0 -0
  414. /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
@@ -0,0 +1,100 @@
1
+ // The check of `suites` in `storm.config.ts`: each suite name matches `SUITE_NAME_PATTERN`, each suite holds only the
2
+ // four suite keys (`driver`, `args`, `runner`, `resources`), each `driver`, `args`, and `runner` passes the same rule
3
+ // as the top level (with a suite's `vercelSandbox` options merging over the top level's), and a suite with no `driver`
4
+ // requires a top-level `driver`.
5
+ import { describeValue } from "../sdk/extension/index.js";
6
+ import { checkResources } from "./check-resources.js";
7
+ import { checkSettingValue } from "./schema.js";
8
+ import { SUITE_NAME_PATTERN } from "./suite.js";
9
+ const SUITE_KEYS = new Set(["driver", "args", "runner", "resources"]);
10
+ /**
11
+ * Checks `suites` in `storm.config.ts`: each key is a valid suite name, each entry holds only `driver`, `args`,
12
+ * `runner`, and `resources`, every `driver` is in `drivers`, every `runner` merges over `topLevelRunnerOptions` when
13
+ * of the same kind, and every suite without its own `driver` requires the top level to name one (`hasTopLevelDriver`).
14
+ */
15
+ export function checkSuites(value, options, problems) {
16
+ if (value === undefined)
17
+ return {};
18
+ if (!isRecord(value)) {
19
+ problems.push({ key: "suites", location: null, problem: `must be an object, not ${describeValue(value)}` });
20
+ return {};
21
+ }
22
+ const settingContext = {
23
+ definitions: options.definitions,
24
+ drivers: options.drivers,
25
+ topLevelRunnerOptions: options.topLevelRunnerOptions,
26
+ };
27
+ const checked = {};
28
+ for (const [name, raw] of Object.entries(value)) {
29
+ const at = `suites.${name}`;
30
+ if (!SUITE_NAME_PATTERN.test(name)) {
31
+ problems.push({
32
+ key: at,
33
+ location: null,
34
+ problem: "must hold only lowercase letters, digits, and hyphens, starting with a letter or a digit",
35
+ });
36
+ }
37
+ if (!isRecord(raw)) {
38
+ problems.push({ key: at, location: null, problem: `must be an object, not ${describeValue(raw)}` });
39
+ continue;
40
+ }
41
+ let driver;
42
+ let hasOwnDriverKey = false;
43
+ let args;
44
+ let runner;
45
+ let resources = {};
46
+ for (const [key, keyValue] of Object.entries(raw)) {
47
+ if (!SUITE_KEYS.has(key)) {
48
+ problems.push({ key: `${at}.${key}`, location: null, problem: "is not a suite key" });
49
+ continue;
50
+ }
51
+ if (keyValue === undefined)
52
+ continue;
53
+ if (key === "driver") {
54
+ hasOwnDriverKey = true;
55
+ const result = checkSettingValue("driver", keyValue, settingContext);
56
+ if (result.ok)
57
+ driver = result.value;
58
+ else
59
+ for (const { path: inside, problem } of result.problems)
60
+ problems.push({ key: [`${at}.driver`, ...inside].join("."), location: null, problem });
61
+ }
62
+ else if (key === "args") {
63
+ const result = checkSettingValue("args", keyValue, settingContext);
64
+ if (result.ok)
65
+ args = result.value;
66
+ else
67
+ for (const { path: inside, problem } of result.problems)
68
+ problems.push({ key: [`${at}.args`, ...inside].join("."), location: null, problem });
69
+ }
70
+ else if (key === "runner") {
71
+ const result = checkSettingValue("runner", keyValue, settingContext);
72
+ if (result.ok)
73
+ runner = result.value;
74
+ else
75
+ for (const { path: inside, problem } of result.problems)
76
+ problems.push({ key: [`${at}.runner`, ...inside].join("."), location: null, problem });
77
+ }
78
+ else if (key === "resources") {
79
+ resources = checkResources(keyValue, options.definitions, problems, `${at}.resources`);
80
+ }
81
+ }
82
+ if (!hasOwnDriverKey && !options.hasTopLevelDriver) {
83
+ problems.push({
84
+ key: `${at}.driver`,
85
+ location: null,
86
+ problem: "must name a driver when the top level names none",
87
+ });
88
+ }
89
+ checked[name] = {
90
+ ...(driver === undefined ? {} : { driver }),
91
+ ...(args === undefined ? {} : { args }),
92
+ ...(runner === undefined ? {} : { runner }),
93
+ resources,
94
+ };
95
+ }
96
+ return checked;
97
+ }
98
+ function isRecord(value) {
99
+ return typeof value === "object" && value !== null && !Array.isArray(value);
100
+ }
@@ -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,12 +22,39 @@ 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. */
31
35
  importConfig(path: string): Promise<ConfigImport>;
32
36
  }
37
+ /**
38
+ * What reading a caller's file lists file (`--file-lists <path>`) gave:
39
+ *
40
+ * - `read`: the file's JSON, parsed, whatever its shape; the caller checks the shape.
41
+ * - `unreadable`: the file can't be read, such as a path with no file. `message` is the OS's.
42
+ * - `not-json`: the file's text is not JSON. `message` is the parser's.
43
+ */
44
+ export type FileListsFileRead = {
45
+ readonly kind: "read";
46
+ readonly value: unknown;
47
+ } | {
48
+ readonly kind: "unreadable";
49
+ readonly message: string;
50
+ } | {
51
+ readonly kind: "not-json";
52
+ readonly message: string;
53
+ };
54
+ /** What reading a caller's file lists file needs from the world. No method rejects. */
55
+ export interface FileListsFileGateway {
56
+ /** Reads the file lists file at the absolute path `path`, or stdin when `path` is `"-"`, and parses its JSON. */
57
+ readFileListsFile(request: {
58
+ readonly path: string;
59
+ }): Promise<FileListsFileRead>;
60
+ }
@@ -1,11 +1,13 @@
1
1
  export { type CommandCredentialSource, type CredentialReport, credentialResolver, type CredentialResolver, credentialSourceError, type CredentialSourceError, credentialSourceErrors, type CredentialTarget, } from "./credential-resolver.ts";
2
2
  export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.ts";
3
3
  export { configErrors, configProblemLine, optionProblemLine } from "./errors.ts";
4
- export type { ConfigGateway, ConfigImport, ConfigLocation } from "./gateways.ts";
4
+ export type { ConfigGateway, ConfigImport, ConfigLocation, FileListsFileGateway, FileListsFileRead, } from "./gateways.ts";
5
5
  export { liveConfigGateway } from "./live/config-gateway.ts";
6
- export { type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfig, loadConfig } from "./load.ts";
7
- export { type RecipeResource, type RecipeRun, recipeRun } from "./recipe-run.ts";
6
+ export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.ts";
7
+ export { type ConfigFileLookup, type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfig, loadConfig, } from "./load.ts";
8
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";
9
- export { type CheckedSettings, checkWith, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, type ConfigKey, type ConfigSettingKey, type ConfigSettings, type SettingValue, } from "./schema.ts";
10
- export { type ConfigLoadError, type ConfigResolver, configResolver, type LoadedResourceSettings, type TargetSettings, } from "./resolver.ts";
11
- export { fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, type SettingsFile, settleRunResources, } from "./settings-file.ts";
9
+ export type { CheckedRunner, LaunchMachineRunner, RunnerConfig, RunnerKind, SuiteRunnerConfig, VercelSandboxRunner, } from "./runner.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";
11
+ export { type ConfigLoadError, type ConfigResolver, configResolver, type LoadedResourceSettings, type StormConfigResolver, type TargetSettings, } from "./resolver.ts";
12
+ export { effectiveConfig, fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, type SettingsFile, settleRunResources, } from "./settings-file.ts";
13
+ export { type CheckedSuite, type CheckedSuiteMap, SUITE_NAME_PATTERN, type SuiteConfig, type SuiteConfigMap, } from "./suite.ts";
@@ -9,9 +9,10 @@ export { credentialResolver, credentialSourceError, credentialSourceErrors, } fr
9
9
  export { credentialErrors, 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
- export { findConfigFile, loadConfig } from "./load.js";
13
- export { recipeRun } from "./recipe-run.js";
12
+ export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.js";
13
+ export { findConfigFile, loadConfig, } from "./load.js";
14
14
  export { mergeRunResources, mergeResourceOptions, resolveSettings, } from "./resolve.js";
15
- 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";
16
16
  export { configResolver, } from "./resolver.js";
17
- export { fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, settleRunResources, } from "./settings-file.js";
17
+ export { effectiveConfig, fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, settleRunResources, } from "./settings-file.js";
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 {
@@ -0,0 +1,4 @@
1
+ import type { Readable } from "node:stream";
2
+ import type { FileListsFileGateway } from "../gateways.ts";
3
+ /** The live file lists file gateway: reads UTF-8 from `path` (or `stdin` when `path` is `"-"`), then `JSON.parse`. */
4
+ export declare function liveFileListsFileGateway(stdin?: Readable): FileListsFileGateway;
@@ -0,0 +1,27 @@
1
+ import { readFile } from "node:fs/promises";
2
+ async function readStream(stream) {
3
+ const chunks = [];
4
+ for await (const chunk of stream)
5
+ chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
6
+ return Buffer.concat(chunks).toString("utf8");
7
+ }
8
+ /** The live file lists file gateway: reads UTF-8 from `path` (or `stdin` when `path` is `"-"`), then `JSON.parse`. */
9
+ export function liveFileListsFileGateway(stdin = process.stdin) {
10
+ return {
11
+ readFileListsFile: async ({ path }) => {
12
+ let text;
13
+ try {
14
+ text = path === "-" ? await readStream(stdin) : await readFile(path, "utf8");
15
+ }
16
+ catch (error) {
17
+ return { kind: "unreadable", message: error instanceof Error ? error.message : String(error) };
18
+ }
19
+ try {
20
+ return { kind: "read", value: JSON.parse(text) };
21
+ }
22
+ catch (error) {
23
+ return { kind: "not-json", message: error instanceof Error ? error.message : String(error) };
24
+ }
25
+ },
26
+ };
27
+ }
@@ -1,7 +1,8 @@
1
- import type { ConfigGateway, ConfigLocation } from "./gateways.ts";
2
1
  import { type ResourceDefinition } from "../sdk/extension/index.ts";
3
- import { type CheckedSettings } from "./schema.ts";
2
+ import type { ConfigGateway, ConfigLocation } from "./gateways.ts";
4
3
  import type { ResourceRecord } from "./resolve.ts";
4
+ import { type CheckedSettings } from "./schema.ts";
5
+ import type { CheckedSuiteMap } from "./suite.ts";
5
6
  /**
6
7
  * One thing wrong with a config file: the key it is about (`null` when none is), where Node said an import failed
7
8
  * (`null` otherwise), and the problem, worded to follow the key or the file name.
@@ -12,15 +13,15 @@ export interface ConfigProblem {
12
13
  readonly problem: string;
13
14
  }
14
15
  /**
15
- * What a loaded config file gave, every value checked: its top-level settings, and each resource it has,
16
- * by resource key, as its definition's name and the options the file gives it, as written. A resource the file holds
17
- * with no options has empty options.
16
+ * What a loaded config file gave, every value checked: its top-level settings, each resource it has by resource key,
17
+ * and each suite it declares under `suites`. A resource the file holds with no options has empty options.
18
18
  */
19
19
  export interface ConfigValues {
20
20
  readonly settings: CheckedSettings;
21
21
  readonly resources: {
22
22
  readonly [key: string]: ResourceRecord;
23
23
  };
24
+ readonly suites: CheckedSuiteMap;
24
25
  }
25
26
  /**
26
27
  * What `loadConfig` found:
@@ -41,17 +42,34 @@ export type LoadedConfig = {
41
42
  readonly problems: readonly ConfigProblem[];
42
43
  };
43
44
  /**
44
- * Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each parent up to the
45
- * git worktree's root, the first directory holding `.git`; outside a git worktree, only in `startDirectory`. The
46
- * 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.
47
65
  */
48
- export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<string | undefined>;
66
+ export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<ConfigFileLookup>;
49
67
  /**
50
68
  * Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
51
69
  * command reads it. The file must default-export an object holding only known keys, each top-level setting by its
52
- * rule, and a `resources` that is an object holding only resources of the definitions in `definitions`, each keyed by
53
- * its definition's name, for now, and a resource its definition made, holding only that resource's options, each by its
54
- * rule. Every problem found goes into one `invalid`. Whether a resource's options fit together, and whether a
55
- * required one is given, waits for the merge with the flags (`mergeRunResources`) and its plan.
70
+ * rule, a `resources` object holding only resources of `definitions`, and a `suites` object whose drivers are in
71
+ * `drivers` (when passed) and whose suites without a driver sit under a top-level `driver`. Every problem found goes
72
+ * into one `invalid`. Whether a resource's options fit together, and whether a required one is given, waits for the
73
+ * merge with the flags (`mergeRunResources`) and its plan.
56
74
  */
57
- export declare function loadConfig(gateway: ConfigGateway, startDirectory: string, definitions: readonly ResourceDefinition[]): Promise<LoadedConfig>;
75
+ export declare function loadConfig(gateway: ConfigGateway, startDirectory: string, definitions: readonly ResourceDefinition[], drivers: readonly string[]): Promise<LoadedConfig>;
@@ -1,24 +1,37 @@
1
- import { dirname, join } from "node:path";
2
- import { defaultResourceKey, resourceCall } from "../sdk/extension/index.js";
1
+ import { basename, dirname, join } from "node:path";
3
2
  import { describeValue } from "../sdk/extension/index.js";
4
- import { CONFIG_FILE_NAME, checkSettingValue, checkWith, isConfigSettingKey, } from "./schema.js";
3
+ import { checkResources } from "./check-resources.js";
4
+ import { rawVercelSandboxOptions } from "./check-runner.js";
5
+ import { checkSuites } from "./check-suites.js";
6
+ import { checkSettingValue, isConfigSettingKey, } from "./schema.js";
5
7
  /**
6
- * Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each parent up to the
7
- * git worktree's root, the first directory holding `.git`; outside a git worktree, only in `startDirectory`. The
8
- * 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.
9
11
  */
10
12
  export async function findConfigFile(gateway, startDirectory) {
11
- if (await gateway.hasConfigFile(startDirectory))
12
- return join(startDirectory, CONFIG_FILE_NAME);
13
+ const here = await lookIn(gateway, startDirectory);
14
+ if (here !== undefined)
15
+ return here;
13
16
  const root = await worktreeRoot(gateway, startDirectory);
14
17
  if (root === undefined)
15
- return undefined;
18
+ return { kind: "none" };
16
19
  for (let directory = startDirectory; directory !== root;) {
17
20
  directory = dirname(directory);
18
- if (await gateway.hasConfigFile(directory))
19
- return join(directory, CONFIG_FILE_NAME);
21
+ const found = await lookIn(gateway, directory);
22
+ if (found !== undefined)
23
+ return found;
20
24
  }
21
- 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] };
22
35
  }
23
36
  /** The nearest directory at or above `directory` holding `.git`, if any. */
24
37
  async function worktreeRoot(gateway, directory) {
@@ -32,15 +45,27 @@ async function worktreeRoot(gateway, directory) {
32
45
  /**
33
46
  * Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
34
47
  * command reads it. The file must default-export an object holding only known keys, each top-level setting by its
35
- * rule, and a `resources` that is an object holding only resources of the definitions in `definitions`, each keyed by
36
- * its definition's name, for now, and a resource its definition made, holding only that resource's options, each by its
37
- * rule. Every problem found goes into one `invalid`. Whether a resource's options fit together, and whether a
38
- * required one is given, waits for the merge with the flags (`mergeRunResources`) and its plan.
48
+ * rule, a `resources` object holding only resources of `definitions`, and a `suites` object whose drivers are in
49
+ * `drivers` (when passed) and whose suites without a driver sit under a top-level `driver`. Every problem found goes
50
+ * into one `invalid`. Whether a resource's options fit together, and whether a required one is given, waits for the
51
+ * merge with the flags (`mergeRunResources`) and its plan.
39
52
  */
40
- export async function loadConfig(gateway, startDirectory, definitions) {
41
- const path = await findConfigFile(gateway, startDirectory);
42
- if (path === undefined)
53
+ export async function loadConfig(gateway, startDirectory, definitions, drivers) {
54
+ const found = await findConfigFile(gateway, startDirectory);
55
+ if (found.kind === "none")
43
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;
44
69
  const imported = await gateway.importConfig(path);
45
70
  switch (imported.kind) {
46
71
  case "import-failed":
@@ -56,10 +81,10 @@ export async function loadConfig(gateway, startDirectory, definitions) {
56
81
  problems: [fileProblem("has no default export; export default defineConfig({ … })")],
57
82
  };
58
83
  case "default-export":
59
- return checkFile(path, imported.value, definitions);
84
+ return checkFile(path, imported.value, definitions, drivers);
60
85
  }
61
86
  }
62
- function checkFile(path, value, definitions) {
87
+ function checkFile(path, value, definitions, drivers) {
63
88
  if (!isRecord(value))
64
89
  return {
65
90
  kind: "invalid",
@@ -69,23 +94,133 @@ function checkFile(path, value, definitions) {
69
94
  const settings = {};
70
95
  const problems = [];
71
96
  let resources = {};
97
+ let rawSuites;
98
+ let hasSuitesKey = false;
99
+ const settingContext = { definitions, drivers };
100
+ const hasTopLevelDriver = value["driver"] !== undefined;
72
101
  for (const [key, keyValue] of Object.entries(value)) {
73
102
  if (key === "resources")
74
- resources = checkResources(keyValue, definitions, problems);
103
+ resources = checkResources(keyValue, definitions, problems, "resources");
104
+ else if (key === "suites") {
105
+ hasSuitesKey = true;
106
+ rawSuites = keyValue;
107
+ }
75
108
  else if (isConfigSettingKey(key)) {
76
109
  if (keyValue !== undefined)
77
- checkSetting(key, keyValue, settings, problems);
110
+ checkSetting(key, keyValue, settings, settingContext, problems);
78
111
  }
79
112
  else
80
- 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` });
114
+ }
115
+ if (settings.args !== undefined && !hasTopLevelDriver) {
116
+ problems.push({ key: "args", location: null, problem: "requires a top-level driver" });
81
117
  }
118
+ const suites = hasSuitesKey
119
+ ? checkSuites(rawSuites, {
120
+ definitions,
121
+ drivers,
122
+ hasTopLevelDriver,
123
+ topLevelRunnerOptions: rawVercelSandboxOptions(value["runner"]),
124
+ }, problems)
125
+ : {};
126
+ checkPlainData(value, problems);
82
127
  if (problems.length > 0)
83
128
  return { kind: "invalid", path, problems };
84
- return { kind: "loaded", path, values: { settings, resources } };
129
+ return { kind: "loaded", path, values: { settings, resources, suites } };
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";
85
220
  }
86
221
  /** Checks one top-level setting, putting its value in `settings` or each thing wrong with it onto `problems`. */
87
- function checkSetting(key, value, settings, problems) {
88
- const checked = checkSettingValue(key, value);
222
+ function checkSetting(key, value, settings, context, problems) {
223
+ const checked = checkSettingValue(key, value, context);
89
224
  // `Object.assign`, since TypeScript can't relate a union key's value to the mapped type's entry for that key.
90
225
  if (checked.ok)
91
226
  Object.assign(settings, { [key]: checked.value });
@@ -93,95 +228,6 @@ function checkSetting(key, value, settings, problems) {
93
228
  for (const { path: inside, problem } of checked.problems)
94
229
  problems.push({ key: [key, ...inside].join("."), location: null, problem });
95
230
  }
96
- /**
97
- * Each resource `resources` holds, by resource key, its options checked; empty when the file sets `resources`
98
- * to undefined. Each thing wrong is pushed onto `problems`: a `resources` that isn't an object, a key no definition
99
- * names, a value that isn't a resource its definition made, a resource whose key isn't its definition's name (for now a
100
- * config file holds only default resources), an unknown option, or a value its option's rule refuses.
101
- */
102
- function checkResources(value, definitions, problems) {
103
- if (value === undefined)
104
- return {};
105
- if (!isRecord(value)) {
106
- problems.push({ key: "resources", location: null, problem: `must be an object, not ${describeValue(value)}` });
107
- return {};
108
- }
109
- const byName = new Map(definitions.map((definition) => [definition.name, definition]));
110
- const holds = definitions.length === 0 ? "none" : definitions.map((each) => each.name).join(", ");
111
- const found = {};
112
- for (const [key, resource] of Object.entries(value)) {
113
- const named = entryName(resource);
114
- // The definition a resource names, when storm knows it; else the one the key names, which must have made it.
115
- const definition = byName.get(named !== undefined && byName.has(named) ? named : key);
116
- // A resource under a key other than its definition's name: `defineConfig` refuses it in the editor, and a file
117
- // that skips `defineConfig` is refused here.
118
- if (named !== undefined && definition !== undefined && key !== defaultResourceKey(definition)) {
119
- problems.push({
120
- key: `resources.${key}`,
121
- location: null,
122
- problem: `holds a ${named} resource; for now a resource's key must be its definition's name: name its key ${defaultResourceKey(definition)}`,
123
- });
124
- continue;
125
- }
126
- if (definition === undefined) {
127
- problems.push({
128
- key: `resources.${key}`,
129
- location: null,
130
- problem: `is not a resource; resources holds ${holds}`,
131
- });
132
- continue;
133
- }
134
- if (resource === undefined)
135
- continue;
136
- const options = checkResource(definition, key, resource, problems);
137
- if (options !== undefined)
138
- found[key] = { definition: definition.name, options };
139
- }
140
- return found;
141
- }
142
- /** The definition's name `value` carries, when it is shaped like a resource; undefined otherwise. */
143
- function entryName(value) {
144
- return isRecord(value) && typeof value["name"] === "string" ? value["name"] : undefined;
145
- }
146
- /**
147
- * The options of resource `key`, of `definition`, each checked; undefined when the value isn't a resource its
148
- * definition made, or holds an option `definition` doesn't define, or a value an option's rule refuses, each thing
149
- * wrong pushed onto `problems`.
150
- */
151
- function checkResource(definition, key, value, problems) {
152
- const { name } = definition;
153
- const options = isRecord(value) && value["name"] === name ? value["options"] : undefined;
154
- if (!isRecord(options)) {
155
- problems.push({
156
- key: `resources.${key}`,
157
- location: null,
158
- problem: `must be made by ${resourceCall(name)}, not ${describeValue(value)}`,
159
- });
160
- return undefined;
161
- }
162
- const checked = {};
163
- let valid = true;
164
- for (const [option, optionValue] of Object.entries(options)) {
165
- const path = `resources.${key}.${option}`;
166
- const rule = Object.hasOwn(definition.options, option) ? definition.options[option] : undefined;
167
- if (rule === undefined) {
168
- valid = false;
169
- problems.push({ key: path, location: null, problem: `is not a ${name} option` });
170
- continue;
171
- }
172
- if (optionValue === undefined)
173
- continue;
174
- const result = checkWith(rule.schema, optionValue);
175
- if (result.ok)
176
- checked[option] = result.value;
177
- else {
178
- valid = false;
179
- for (const { path: inside, problem } of result.problems)
180
- problems.push({ key: [path, ...inside].join("."), location: null, problem });
181
- }
182
- }
183
- return valid ? checked : undefined;
184
- }
185
231
  function isRecord(value) {
186
232
  return typeof value === "object" && value !== null && !Array.isArray(value);
187
233
  }