@cnc-tools/storm 0.0.0-stage → 0.5.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 (513) hide show
  1. package/bin/node-version.js +24 -0
  2. package/bin/storm.js +16 -0
  3. package/dist/application.d.ts +13 -0
  4. package/dist/application.js +23 -0
  5. package/dist/bin/storm.d.ts +1 -0
  6. package/dist/bin/storm.js +45 -0
  7. package/dist/build-info.js +3 -0
  8. package/dist/closed-terminal.d.ts +7 -0
  9. package/dist/closed-terminal.js +18 -0
  10. package/dist/combine-errors.d.ts +11 -0
  11. package/dist/combine-errors.js +19 -0
  12. package/dist/commands/dashboard.d.ts +11 -0
  13. package/dist/commands/dashboard.js +18 -0
  14. package/dist/commands/run/cleanup.d.ts +135 -0
  15. package/dist/commands/run/cleanup.js +171 -0
  16. package/dist/commands/run/command.d.ts +327 -0
  17. package/dist/commands/run/command.js +620 -0
  18. package/dist/commands/run/job-summary.d.ts +6 -0
  19. package/dist/commands/run/job-summary.js +31 -0
  20. package/dist/commands/run/live-view.d.ts +22 -0
  21. package/dist/commands/run/live-view.js +395 -0
  22. package/dist/commands/run/metadata.d.ts +47 -0
  23. package/dist/commands/run/metadata.js +83 -0
  24. package/dist/commands/run/mint-failed.d.ts +11 -0
  25. package/dist/commands/run/mint-failed.js +33 -0
  26. package/dist/commands/run/outcomes.d.ts +307 -0
  27. package/dist/commands/run/outcomes.js +332 -0
  28. package/dist/commands/run/progress.d.ts +44 -0
  29. package/dist/commands/run/progress.js +277 -0
  30. package/dist/commands/run/redaction.d.ts +15 -0
  31. package/dist/commands/run/redaction.js +40 -0
  32. package/dist/commands/run/run-collector.d.ts +30 -0
  33. package/dist/commands/run/run-collector.js +73 -0
  34. package/dist/commands/run/run-record.d.ts +144 -0
  35. package/dist/commands/run/run-record.js +96 -0
  36. package/dist/commands/run/tests-summary.d.ts +34 -0
  37. package/dist/commands/run/tests-summary.js +141 -0
  38. package/dist/commands/run/text.d.ts +22 -0
  39. package/dist/commands/run/text.js +74 -0
  40. package/dist/commands/run/view.d.ts +35 -0
  41. package/dist/commands/run/view.js +163 -0
  42. package/dist/commands/run/waterfall.d.ts +25 -0
  43. package/dist/commands/run/waterfall.js +108 -0
  44. package/dist/commands/run/worker-chart.d.ts +79 -0
  45. package/dist/commands/run/worker-chart.js +313 -0
  46. package/dist/commands/runs/facts.d.ts +150 -0
  47. package/dist/commands/runs/facts.js +292 -0
  48. package/dist/commands/runs/list/command.d.ts +86 -0
  49. package/dist/commands/runs/list/command.js +36 -0
  50. package/dist/commands/runs/list/metadata.d.ts +22 -0
  51. package/dist/commands/runs/list/metadata.js +19 -0
  52. package/dist/commands/runs/list/outcomes.d.ts +74 -0
  53. package/dist/commands/runs/list/outcomes.js +89 -0
  54. package/dist/commands/runs/logs/command.d.ts +72 -0
  55. package/dist/commands/runs/logs/command.js +51 -0
  56. package/dist/commands/runs/logs/metadata.d.ts +22 -0
  57. package/dist/commands/runs/logs/metadata.js +22 -0
  58. package/dist/commands/runs/logs/outcomes.d.ts +55 -0
  59. package/dist/commands/runs/logs/outcomes.js +77 -0
  60. package/dist/commands/runs/metadata.d.ts +3 -0
  61. package/dist/commands/runs/metadata.js +3 -0
  62. package/dist/commands/runs/past-run.d.ts +72 -0
  63. package/dist/commands/runs/past-run.js +99 -0
  64. package/dist/commands/runs/show/command.d.ts +176 -0
  65. package/dist/commands/runs/show/command.js +76 -0
  66. package/dist/commands/runs/show/metadata.d.ts +25 -0
  67. package/dist/commands/runs/show/metadata.js +22 -0
  68. package/dist/commands/runs/show/outcomes.d.ts +164 -0
  69. package/dist/commands/runs/show/outcomes.js +317 -0
  70. package/dist/config/by-name.d.ts +24 -0
  71. package/dist/config/by-name.js +26 -0
  72. package/dist/config/errors.d.ts +58 -0
  73. package/dist/config/errors.js +101 -0
  74. package/dist/config/gateways.d.ts +32 -0
  75. package/dist/config/gateways.js +1 -0
  76. package/dist/config/index.d.ts +9 -0
  77. package/dist/config/index.js +12 -0
  78. package/dist/config/live/config-gateway.d.ts +6 -0
  79. package/dist/config/live/config-gateway.js +71 -0
  80. package/dist/config/load.d.ts +54 -0
  81. package/dist/config/load.js +175 -0
  82. package/dist/config/resolve.d.ts +49 -0
  83. package/dist/config/resolve.js +94 -0
  84. package/dist/config/resource-config.d.ts +132 -0
  85. package/dist/config/resource-config.js +19 -0
  86. package/dist/config/schema.d.ts +64 -0
  87. package/dist/config/schema.js +57 -0
  88. package/dist/config/set.d.ts +16 -0
  89. package/dist/config/set.js +55 -0
  90. package/dist/config/settings-file.d.ts +41 -0
  91. package/dist/config/settings-file.js +72 -0
  92. package/dist/config-file/define.d.ts +37 -0
  93. package/dist/config-file/define.js +9 -0
  94. package/dist/config-file/toolchain.d.ts +9 -0
  95. package/dist/config-file/toolchain.js +41 -0
  96. package/dist/context.d.ts +86 -0
  97. package/dist/context.js +43 -0
  98. package/dist/core/command-provider.d.ts +126 -0
  99. package/dist/core/command-provider.js +13 -0
  100. package/dist/core/command-slots.d.ts +67 -0
  101. package/dist/core/command-slots.js +136 -0
  102. package/dist/core/events.d.ts +128 -0
  103. package/dist/core/events.js +15 -0
  104. package/dist/core/gateways.d.ts +249 -0
  105. package/dist/core/gateways.js +1 -0
  106. package/dist/core/index.d.ts +20 -0
  107. package/dist/core/index.js +18 -0
  108. package/dist/core/keyed.d.ts +12 -0
  109. package/dist/core/keyed.js +24 -0
  110. package/dist/core/lane.d.ts +46 -0
  111. package/dist/core/lane.js +5 -0
  112. package/dist/core/limit.d.ts +9 -0
  113. package/dist/core/limit.js +29 -0
  114. package/dist/core/live/command-gateway.d.ts +11 -0
  115. package/dist/core/live/command-gateway.js +83 -0
  116. package/dist/core/live/job-summary-gateway.d.ts +5 -0
  117. package/dist/core/live/job-summary-gateway.js +20 -0
  118. package/dist/core/live/progress-terminal.d.ts +20 -0
  119. package/dist/core/live/progress-terminal.js +173 -0
  120. package/dist/core/live/run-directory-gateway.d.ts +24 -0
  121. package/dist/core/live/run-directory-gateway.js +437 -0
  122. package/dist/core/mint.d.ts +10 -0
  123. package/dist/core/mint.js +14 -0
  124. package/dist/core/payload.d.ts +26 -0
  125. package/dist/core/payload.js +33 -0
  126. package/dist/core/presentation.d.ts +87 -0
  127. package/dist/core/presentation.js +5 -0
  128. package/dist/core/presentations.d.ts +56 -0
  129. package/dist/core/presentations.js +66 -0
  130. package/dist/core/provider.d.ts +69 -0
  131. package/dist/core/provider.js +5 -0
  132. package/dist/core/resource.d.ts +262 -0
  133. package/dist/core/resource.js +6 -0
  134. package/dist/core/resources.d.ts +131 -0
  135. package/dist/core/resources.js +254 -0
  136. package/dist/core/run-directory.d.ts +69 -0
  137. package/dist/core/run-directory.js +94 -0
  138. package/dist/core/run-state.d.ts +152 -0
  139. package/dist/core/run-state.js +313 -0
  140. package/dist/core/run.d.ts +187 -0
  141. package/dist/core/run.js +321 -0
  142. package/dist/core/state-directory.d.ts +19 -0
  143. package/dist/core/state-directory.js +29 -0
  144. package/dist/core/timeline.d.ts +63 -0
  145. package/dist/core/timeline.js +97 -0
  146. package/dist/core/timing.d.ts +22 -0
  147. package/dist/core/timing.js +26 -0
  148. package/dist/credential/credential.d.ts +46 -0
  149. package/dist/credential/credential.js +80 -0
  150. package/dist/credential/diagnosis.d.ts +18 -0
  151. package/dist/credential/diagnosis.js +99 -0
  152. package/dist/credential/gateways.d.ts +109 -0
  153. package/dist/credential/gateways.js +1 -0
  154. package/dist/credential/index.d.ts +7 -0
  155. package/dist/credential/index.js +7 -0
  156. package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
  157. package/dist/credential/live/github-actions-token-gateway.js +43 -0
  158. package/dist/credential/live/github-actions-token-response.d.ts +19 -0
  159. package/dist/credential/live/github-actions-token-response.js +49 -0
  160. package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
  161. package/dist/credential/live/vercel-cli-gateway.js +64 -0
  162. package/dist/credential/live/vercel-output.d.ts +60 -0
  163. package/dist/credential/live/vercel-output.js +122 -0
  164. package/dist/credential/live/vercel-process.d.ts +14 -0
  165. package/dist/credential/live/vercel-process.js +3 -0
  166. package/dist/credential/settle.d.ts +31 -0
  167. package/dist/credential/settle.js +49 -0
  168. package/dist/credential/source.d.ts +110 -0
  169. package/dist/credential/source.js +114 -0
  170. package/dist/help-logo.d.ts +11 -0
  171. package/dist/help-logo.js +56 -0
  172. package/dist/presentation.d.ts +26 -0
  173. package/dist/presentation.js +21 -0
  174. package/dist/resources/github/cleanup.d.ts +23 -0
  175. package/dist/resources/github/cleanup.js +39 -0
  176. package/dist/resources/github/command.d.ts +74 -0
  177. package/dist/resources/github/command.js +117 -0
  178. package/dist/resources/github/config.d.ts +16 -0
  179. package/dist/resources/github/config.js +37 -0
  180. package/dist/resources/github/events.d.ts +26 -0
  181. package/dist/resources/github/events.js +2 -0
  182. package/dist/resources/github/fixture-repo.d.ts +69 -0
  183. package/dist/resources/github/fixture-repo.js +60 -0
  184. package/dist/resources/github/gateways.d.ts +62 -0
  185. package/dist/resources/github/gateways.js +1 -0
  186. package/dist/resources/github/index.d.ts +12 -0
  187. package/dist/resources/github/index.js +15 -0
  188. package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
  189. package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
  190. package/dist/resources/github/live/gateways.d.ts +6 -0
  191. package/dist/resources/github/live/gateways.js +13 -0
  192. package/dist/resources/github/presentation.d.ts +13 -0
  193. package/dist/resources/github/presentation.js +43 -0
  194. package/dist/resources/github/provider.d.ts +66 -0
  195. package/dist/resources/github/provider.js +58 -0
  196. package/dist/resources/github/resource-provider.d.ts +6 -0
  197. package/dist/resources/github/resource-provider.js +20 -0
  198. package/dist/resources/github/resource.d.ts +33 -0
  199. package/dist/resources/github/resource.js +12 -0
  200. package/dist/resources/testserver/cleanup.d.ts +14 -0
  201. package/dist/resources/testserver/cleanup.js +22 -0
  202. package/dist/resources/testserver/command.d.ts +322 -0
  203. package/dist/resources/testserver/command.js +245 -0
  204. package/dist/resources/testserver/commands/app.d.ts +18 -0
  205. package/dist/resources/testserver/commands/app.js +3 -0
  206. package/dist/resources/testserver/commands/create/command.d.ts +136 -0
  207. package/dist/resources/testserver/commands/create/command.js +158 -0
  208. package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
  209. package/dist/resources/testserver/commands/create/metadata.js +45 -0
  210. package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
  211. package/dist/resources/testserver/commands/create/outcomes.js +172 -0
  212. package/dist/resources/testserver/commands/list/command.d.ts +60 -0
  213. package/dist/resources/testserver/commands/list/command.js +56 -0
  214. package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
  215. package/dist/resources/testserver/commands/list/metadata.js +9 -0
  216. package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
  217. package/dist/resources/testserver/commands/list/outcomes.js +152 -0
  218. package/dist/resources/testserver/config.d.ts +18 -0
  219. package/dist/resources/testserver/config.js +77 -0
  220. package/dist/resources/testserver/credential-facts.d.ts +80 -0
  221. package/dist/resources/testserver/credential-facts.js +83 -0
  222. package/dist/resources/testserver/events.d.ts +59 -0
  223. package/dist/resources/testserver/events.js +4 -0
  224. package/dist/resources/testserver/index.d.ts +16 -0
  225. package/dist/resources/testserver/index.js +24 -0
  226. package/dist/resources/testserver/lane.d.ts +28 -0
  227. package/dist/resources/testserver/lane.js +139 -0
  228. package/dist/resources/testserver/live/gateways.d.ts +6 -0
  229. package/dist/resources/testserver/live/gateways.js +26 -0
  230. package/dist/resources/testserver/options.d.ts +5 -0
  231. package/dist/resources/testserver/options.js +5 -0
  232. package/dist/resources/testserver/pool/channels.d.ts +80 -0
  233. package/dist/resources/testserver/pool/channels.js +48 -0
  234. package/dist/resources/testserver/pool/create.d.ts +48 -0
  235. package/dist/resources/testserver/pool/create.js +45 -0
  236. package/dist/resources/testserver/pool/directory.d.ts +4 -0
  237. package/dist/resources/testserver/pool/directory.js +5 -0
  238. package/dist/resources/testserver/pool/gateways.d.ts +190 -0
  239. package/dist/resources/testserver/pool/gateways.js +1 -0
  240. package/dist/resources/testserver/pool/host.d.ts +8 -0
  241. package/dist/resources/testserver/pool/host.js +21 -0
  242. package/dist/resources/testserver/pool/index.d.ts +9 -0
  243. package/dist/resources/testserver/pool/index.js +10 -0
  244. package/dist/resources/testserver/pool/inspect.d.ts +53 -0
  245. package/dist/resources/testserver/pool/inspect.js +45 -0
  246. package/dist/resources/testserver/pool/lease.d.ts +84 -0
  247. package/dist/resources/testserver/pool/lease.js +125 -0
  248. package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
  249. package/dist/resources/testserver/pool/live/pool-records.js +70 -0
  250. package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
  251. package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
  252. package/dist/resources/testserver/pool/staleness.d.ts +16 -0
  253. package/dist/resources/testserver/pool/staleness.js +27 -0
  254. package/dist/resources/testserver/presentation.d.ts +9 -0
  255. package/dist/resources/testserver/presentation.js +217 -0
  256. package/dist/resources/testserver/provider.d.ts +177 -0
  257. package/dist/resources/testserver/provider.js +254 -0
  258. package/dist/resources/testserver/ran.d.ts +87 -0
  259. package/dist/resources/testserver/ran.js +140 -0
  260. package/dist/resources/testserver/resource-provider.d.ts +12 -0
  261. package/dist/resources/testserver/resource-provider.js +38 -0
  262. package/dist/resources/testserver/resource.d.ts +32 -0
  263. package/dist/resources/testserver/resource.js +10 -0
  264. package/dist/resources/testserver/run-sandbox.d.ts +13 -0
  265. package/dist/resources/testserver/run-sandbox.js +6 -0
  266. package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
  267. package/dist/resources/testserver/sandbox/channels.js +21 -0
  268. package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
  269. package/dist/resources/testserver/sandbox/create-failure.js +65 -0
  270. package/dist/resources/testserver/sandbox/create.d.ts +29 -0
  271. package/dist/resources/testserver/sandbox/create.js +37 -0
  272. package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
  273. package/dist/resources/testserver/sandbox/gateways.js +1 -0
  274. package/dist/resources/testserver/sandbox/index.d.ts +6 -0
  275. package/dist/resources/testserver/sandbox/index.js +7 -0
  276. package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
  277. package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
  278. package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
  279. package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
  280. package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
  281. package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
  282. package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
  283. package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
  284. package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
  285. package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
  286. package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
  287. package/dist/resources/testserver/sandbox/live/sse.js +32 -0
  288. package/dist/resources.d.ts +452 -0
  289. package/dist/resources.js +88 -0
  290. package/dist/runner/base.d.ts +40 -0
  291. package/dist/runner/base.js +52 -0
  292. package/dist/runner/context.d.ts +13 -0
  293. package/dist/runner/context.js +9 -0
  294. package/dist/runner/events.d.ts +179 -0
  295. package/dist/runner/events.js +16 -0
  296. package/dist/runner/gateways.d.ts +351 -0
  297. package/dist/runner/gateways.js +3 -0
  298. package/dist/runner/index.d.ts +19 -0
  299. package/dist/runner/index.js +18 -0
  300. package/dist/runner/live/checkout-gateway.d.ts +3 -0
  301. package/dist/runner/live/checkout-gateway.js +206 -0
  302. package/dist/runner/live/git-output.d.ts +14 -0
  303. package/dist/runner/live/git-output.js +32 -0
  304. package/dist/runner/live/sandbox-errors.d.ts +7 -0
  305. package/dist/runner/live/sandbox-errors.js +21 -0
  306. package/dist/runner/live/sandbox-gateway.d.ts +7 -0
  307. package/dist/runner/live/sandbox-gateway.js +427 -0
  308. package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
  309. package/dist/runner/live/snapshot-cache-gateway.js +104 -0
  310. package/dist/runner/live/snapshot-records.d.ts +11 -0
  311. package/dist/runner/live/snapshot-records.js +57 -0
  312. package/dist/runner/live/terminal.d.ts +16 -0
  313. package/dist/runner/live/terminal.js +37 -0
  314. package/dist/runner/live/user.d.ts +2 -0
  315. package/dist/runner/live/user.js +11 -0
  316. package/dist/runner/output.d.ts +23 -0
  317. package/dist/runner/output.js +58 -0
  318. package/dist/runner/prepare.d.ts +67 -0
  319. package/dist/runner/prepare.js +59 -0
  320. package/dist/runner/ready.d.ts +68 -0
  321. package/dist/runner/ready.js +159 -0
  322. package/dist/runner/recipe.d.ts +126 -0
  323. package/dist/runner/recipe.js +302 -0
  324. package/dist/runner/remote-command.d.ts +77 -0
  325. package/dist/runner/remote-command.js +127 -0
  326. package/dist/runner/scope.d.ts +58 -0
  327. package/dist/runner/scope.js +117 -0
  328. package/dist/runner/snapshot-build.d.ts +33 -0
  329. package/dist/runner/snapshot-build.js +112 -0
  330. package/dist/runner/snapshot-cache.d.ts +84 -0
  331. package/dist/runner/snapshot-cache.js +126 -0
  332. package/dist/runner/snapshot-key.d.ts +52 -0
  333. package/dist/runner/snapshot-key.js +91 -0
  334. package/dist/runner/steps.d.ts +41 -0
  335. package/dist/runner/steps.js +49 -0
  336. package/dist/sdk/container/api-request.d.ts +32 -0
  337. package/dist/sdk/container/api-request.js +46 -0
  338. package/dist/sdk/container/container.d.ts +144 -0
  339. package/dist/sdk/container/container.js +346 -0
  340. package/dist/sdk/container/feature-flags.d.ts +37 -0
  341. package/dist/sdk/container/feature-flags.js +118 -0
  342. package/dist/sdk/container/gateways.d.ts +108 -0
  343. package/dist/sdk/container/gateways.js +1 -0
  344. package/dist/sdk/container/index.d.ts +5 -0
  345. package/dist/sdk/container/index.js +5 -0
  346. package/dist/sdk/container/live/container-gateway.d.ts +17 -0
  347. package/dist/sdk/container/live/container-gateway.js +114 -0
  348. package/dist/sdk/factories/build.d.ts +66 -0
  349. package/dist/sdk/factories/build.js +98 -0
  350. package/dist/sdk/factories/definition.d.ts +28 -0
  351. package/dist/sdk/factories/definition.js +16 -0
  352. package/dist/sdk/factories/definitions.d.ts +166 -0
  353. package/dist/sdk/factories/definitions.js +235 -0
  354. package/dist/sdk/factories/gateways.d.ts +25 -0
  355. package/dist/sdk/factories/gateways.js +1 -0
  356. package/dist/sdk/factories/index.d.ts +5 -0
  357. package/dist/sdk/factories/index.js +5 -0
  358. package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
  359. package/dist/sdk/factories/live/factory-gateway.js +29 -0
  360. package/dist/sdk/index.d.ts +7 -0
  361. package/dist/sdk/index.js +15 -0
  362. package/dist/sdk/payload/index.d.ts +2 -0
  363. package/dist/sdk/payload/index.js +4 -0
  364. package/dist/sdk/payload/payload.d.ts +47 -0
  365. package/dist/sdk/payload/payload.js +74 -0
  366. package/dist/sdk/payload/test-events.d.ts +102 -0
  367. package/dist/sdk/payload/test-events.js +59 -0
  368. package/dist/sdk/proxy/exchange.d.ts +58 -0
  369. package/dist/sdk/proxy/exchange.js +173 -0
  370. package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
  371. package/dist/sdk/proxy/faulted-exchange.js +106 -0
  372. package/dist/sdk/proxy/faults.d.ts +133 -0
  373. package/dist/sdk/proxy/faults.js +147 -0
  374. package/dist/sdk/proxy/index.d.ts +3 -0
  375. package/dist/sdk/proxy/index.js +3 -0
  376. package/dist/sdk/proxy/proxy.d.ts +93 -0
  377. package/dist/sdk/proxy/proxy.js +99 -0
  378. package/dist/sdk/proxy/records.d.ts +56 -0
  379. package/dist/sdk/proxy/records.js +56 -0
  380. package/dist/sdk/records/body.d.ts +89 -0
  381. package/dist/sdk/records/body.js +236 -0
  382. package/dist/sdk/records/index.d.ts +2 -0
  383. package/dist/sdk/records/index.js +4 -0
  384. package/dist/sdk/records/records.d.ts +49 -0
  385. package/dist/sdk/records/records.js +16 -0
  386. package/dist/sdk/seed/index.d.ts +1 -0
  387. package/dist/sdk/seed/index.js +3 -0
  388. package/dist/sdk/seed/seed.d.ts +221 -0
  389. package/dist/sdk/seed/seed.js +171 -0
  390. package/dist/sdk/testserver/clock.d.ts +8 -0
  391. package/dist/sdk/testserver/clock.js +10 -0
  392. package/dist/sdk/testserver/failure.d.ts +73 -0
  393. package/dist/sdk/testserver/failure.js +61 -0
  394. package/dist/sdk/testserver/index.d.ts +5 -0
  395. package/dist/sdk/testserver/index.js +8 -0
  396. package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
  397. package/dist/sdk/testserver/live/connect-failure.js +30 -0
  398. package/dist/sdk/testserver/live/request.d.ts +69 -0
  399. package/dist/sdk/testserver/live/request.js +89 -0
  400. package/dist/sdk/testserver/service-ids.d.ts +19 -0
  401. package/dist/sdk/testserver/service-ids.js +77 -0
  402. package/dist/sdk/testserver/test-id.d.ts +15 -0
  403. package/dist/sdk/testserver/test-id.js +28 -0
  404. package/dist/story/align.d.ts +37 -0
  405. package/dist/story/align.js +39 -0
  406. package/dist/story/artifact.d.ts +60 -0
  407. package/dist/story/artifact.js +93 -0
  408. package/dist/story/definition.d.ts +52 -0
  409. package/dist/story/definition.js +9 -0
  410. package/dist/story/diff.d.ts +9 -0
  411. package/dist/story/diff.js +97 -0
  412. package/dist/story/errors.d.ts +14 -0
  413. package/dist/story/errors.js +21 -0
  414. package/dist/story/gateways.d.ts +74 -0
  415. package/dist/story/gateways.js +3 -0
  416. package/dist/story/host.d.ts +27 -0
  417. package/dist/story/host.js +97 -0
  418. package/dist/story/index.d.ts +7 -0
  419. package/dist/story/index.js +9 -0
  420. package/dist/story/json.d.ts +16 -0
  421. package/dist/story/json.js +59 -0
  422. package/dist/story/live/artifact-gateway.d.ts +2 -0
  423. package/dist/story/live/artifact-gateway.js +82 -0
  424. package/dist/story/mode.d.ts +17 -0
  425. package/dist/story/mode.js +21 -0
  426. package/dist/story/orphans.d.ts +17 -0
  427. package/dist/story/orphans.js +15 -0
  428. package/dist/story/report.d.ts +30 -0
  429. package/dist/story/report.js +118 -0
  430. package/dist/story/run.d.ts +49 -0
  431. package/dist/story/run.js +160 -0
  432. package/dist/story/sequence.d.ts +30 -0
  433. package/dist/story/sequence.js +74 -0
  434. package/dist/story/settle.d.ts +94 -0
  435. package/dist/story/settle.js +70 -0
  436. package/dist/time/duration.d.ts +19 -0
  437. package/dist/time/duration.js +37 -0
  438. package/dist/time/index.d.ts +2 -0
  439. package/dist/time/index.js +4 -0
  440. package/dist/time/time.d.ts +15 -0
  441. package/dist/time/time.js +23 -0
  442. package/dist/vercel-cli/ansi.d.ts +13 -0
  443. package/dist/vercel-cli/ansi.js +32 -0
  444. package/dist/vercel-cli/arguments.d.ts +25 -0
  445. package/dist/vercel-cli/arguments.js +78 -0
  446. package/dist/vercel-cli/auth-config.d.ts +43 -0
  447. package/dist/vercel-cli/auth-config.js +36 -0
  448. package/dist/vercel-cli/clock.d.ts +9 -0
  449. package/dist/vercel-cli/clock.js +10 -0
  450. package/dist/vercel-cli/config-files.d.ts +24 -0
  451. package/dist/vercel-cli/config-files.js +40 -0
  452. package/dist/vercel-cli/context.d.ts +12 -0
  453. package/dist/vercel-cli/context.js +12 -0
  454. package/dist/vercel-cli/driver.d.ts +218 -0
  455. package/dist/vercel-cli/driver.js +364 -0
  456. package/dist/vercel-cli/entry.d.ts +8 -0
  457. package/dist/vercel-cli/entry.js +13 -0
  458. package/dist/vercel-cli/environment.d.ts +33 -0
  459. package/dist/vercel-cli/environment.js +72 -0
  460. package/dist/vercel-cli/errors.d.ts +8 -0
  461. package/dist/vercel-cli/errors.js +8 -0
  462. package/dist/vercel-cli/gateways.d.ts +103 -0
  463. package/dist/vercel-cli/gateways.js +4 -0
  464. package/dist/vercel-cli/index.d.ts +10 -0
  465. package/dist/vercel-cli/index.js +15 -0
  466. package/dist/vercel-cli/invocation.d.ts +234 -0
  467. package/dist/vercel-cli/invocation.js +397 -0
  468. package/dist/vercel-cli/keys.d.ts +14 -0
  469. package/dist/vercel-cli/keys.js +12 -0
  470. package/dist/vercel-cli/live/config-files.d.ts +28 -0
  471. package/dist/vercel-cli/live/config-files.js +66 -0
  472. package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
  473. package/dist/vercel-cli/live/process-gateway.js +178 -0
  474. package/dist/vercel-cli/redaction.d.ts +13 -0
  475. package/dist/vercel-cli/redaction.js +22 -0
  476. package/dist/vercel-cli/report.d.ts +22 -0
  477. package/dist/vercel-cli/report.js +110 -0
  478. package/dist/vercel-cli/verbose.d.ts +7 -0
  479. package/dist/vercel-cli/verbose.js +24 -0
  480. package/dist/version.d.ts +20 -0
  481. package/dist/version.js +57 -0
  482. package/dist/vitest/config.d.ts +51 -0
  483. package/dist/vitest/config.js +61 -0
  484. package/dist/vitest/container-scope.d.ts +108 -0
  485. package/dist/vitest/container-scope.js +234 -0
  486. package/dist/vitest/diagnostics.d.ts +146 -0
  487. package/dist/vitest/diagnostics.js +306 -0
  488. package/dist/vitest/fixtures.d.ts +64 -0
  489. package/dist/vitest/fixtures.js +172 -0
  490. package/dist/vitest/gateways.d.ts +47 -0
  491. package/dist/vitest/gateways.js +3 -0
  492. package/dist/vitest/index.d.ts +3 -0
  493. package/dist/vitest/index.js +9 -0
  494. package/dist/vitest/list-output.d.ts +3 -0
  495. package/dist/vitest/list-output.js +19 -0
  496. package/dist/vitest/live/list-gateway.d.ts +7 -0
  497. package/dist/vitest/live/list-gateway.js +60 -0
  498. package/dist/vitest/ownership.d.ts +29 -0
  499. package/dist/vitest/ownership.js +68 -0
  500. package/dist/vitest/plan.d.ts +33 -0
  501. package/dist/vitest/plan.js +73 -0
  502. package/dist/vitest/sandbox.d.ts +16 -0
  503. package/dist/vitest/sandbox.js +35 -0
  504. package/dist/vitest/test-events.d.ts +41 -0
  505. package/dist/vitest/test-events.js +92 -0
  506. package/dist/vitest/test-results.d.ts +84 -0
  507. package/dist/vitest/test-results.js +160 -0
  508. package/dist/vitest/types.d.ts +68 -0
  509. package/dist/vitest/types.js +4 -0
  510. package/package.json +123 -4
  511. package/skills/overview.md +32 -0
  512. package/skills/read-run-output.md +65 -0
  513. package/README.md +0 -3
@@ -0,0 +1,94 @@
1
+ // Resolving what a command reads: each top-level setting from its flag or the file, and each held resource's options
2
+ // from its rules' defaults, the file and the flags, then the resource's own `resolve`.
3
+ import { resolvedResourcesByName } from "./by-name.js";
4
+ import { optionKeyPath, } from "./resource-config.js";
5
+ /**
6
+ * Resolves each top-level setting: the flag's value, else the config file's. `runner` has no flag. `file` is the
7
+ * loaded config file's settings, already checked, or `undefined` when no file applies.
8
+ */
9
+ export function resolveSettings(flags, file) {
10
+ const pick = (flag, fromFile) => flag !== undefined
11
+ ? { value: flag, source: "flag" }
12
+ : fromFile === undefined
13
+ ? undefined
14
+ : { value: fromFile, source: "file" };
15
+ return {
16
+ scope: pick(flags.scope, file?.scope),
17
+ project: pick(flags.project, file?.project),
18
+ runner: pick(undefined, file?.runner),
19
+ };
20
+ }
21
+ /**
22
+ * One held resource's options merged: each option's rule's default, overridden by the file's value, overridden by a
23
+ * flag's (a `--set`, or a command's own flag for the option), each with its source. A required option none of them
24
+ * gives is a problem. The values are checked already, so nothing else is.
25
+ */
26
+ export function mergeResourceOptions(config, file, flags) {
27
+ const fromFile = file ?? {};
28
+ const fromFlags = flags ?? {};
29
+ const merged = {};
30
+ const problems = [];
31
+ for (const [option, rule] of Object.entries(config.options)) {
32
+ const flag = fromFlags[option];
33
+ const given = fromFile[option];
34
+ if (flag !== undefined)
35
+ merged[option] = { value: flag, source: "flag" };
36
+ else if (given !== undefined)
37
+ merged[option] = { value: given, source: "file" };
38
+ else if (rule.default !== undefined)
39
+ merged[option] = { value: rule.default, source: "default" };
40
+ else if (rule.required === true) {
41
+ const key = optionKeyPath(config.name, option);
42
+ problems.push({
43
+ key,
44
+ problem: `is required; give it in ${config.factory.call} or with --set ${key}=<value>`,
45
+ values: [],
46
+ });
47
+ }
48
+ }
49
+ if (problems.length > 0)
50
+ return { ok: false, problems };
51
+ // Every option with a default or marked required is in `merged`, so it is what `config.resolve` takes.
52
+ return { ok: true, value: merged };
53
+ }
54
+ /**
55
+ * The resolved options of each resource the run holds, by name: one the file has, or one any `--set` names an option
56
+ * of. Each is merged (`mergeResourceOptions`) and then resolved by its config's `resolve`, which checks its options
57
+ * against each other. Every problem of every held resource is returned at once, in config order.
58
+ */
59
+ export function resolveResourceOptions(configs, file, sets) {
60
+ const fromFile = file ?? {};
61
+ const fromSets = sets;
62
+ const resolved = {};
63
+ const problems = [];
64
+ for (const config of configs) {
65
+ const given = fromFile[config.name];
66
+ const set = fromSets[config.name];
67
+ if (given === undefined && set === undefined)
68
+ continue;
69
+ const merged = mergeResourceOptions(config, given, set);
70
+ if (!merged.ok) {
71
+ problems.push(...merged.problems);
72
+ continue;
73
+ }
74
+ const settings = merged.value;
75
+ const result = config.resolve(merged.value);
76
+ if (result.ok)
77
+ resolved[config.name] = result.value;
78
+ else
79
+ for (const { option, problem, involves } of result.problems)
80
+ problems.push({
81
+ key: optionKeyPath(config.name, option),
82
+ problem,
83
+ values: involves.flatMap((each) => {
84
+ const setting = settings[each];
85
+ return setting === undefined
86
+ ? []
87
+ : [{ key: optionKeyPath(config.name, each), value: setting.value, source: setting.source }];
88
+ }),
89
+ });
90
+ }
91
+ if (problems.length > 0)
92
+ return { ok: false, problems };
93
+ return { ok: true, value: resolvedResourcesByName(configs, resolved) };
94
+ }
@@ -0,0 +1,132 @@
1
+ import type { Checked } from "./schema.ts";
2
+ /** Where a value came from: a flag (`--scope`, `--set`, a command's own option flag), the file, or a default. */
3
+ export type SettingSource = "flag" | "file" | "default";
4
+ /** A value and where it came from. */
5
+ export interface Setting<T> {
6
+ readonly value: T;
7
+ readonly source: SettingSource;
8
+ }
9
+ /**
10
+ * How one resource option is checked, read from `--set` text and defaulted.
11
+ *
12
+ * - `check`: the option's rule, for a value from the file or from `--set` once read.
13
+ * - `readText`: a `--set` value's text as the value `check` reads, such as a whole number or a boolean. Text that
14
+ * doesn't read as its kind is passed on as text, which `check` refuses by name.
15
+ * - `default`: the value when neither the file nor a `--set` gives one.
16
+ * - `required`: a resource held without this option is a problem.
17
+ */
18
+ export interface OptionRule<T> {
19
+ readonly check: (value: unknown) => Checked<T>;
20
+ readonly readText: (text: string) => unknown;
21
+ readonly default?: T;
22
+ readonly required?: boolean;
23
+ }
24
+ /** An option's value once given: its type in the options interface, without `undefined`. */
25
+ type OptionValue<Options, K extends keyof Options> = Exclude<Options[K], undefined>;
26
+ /**
27
+ * One rule for each option of `Options`. An option in `Present` has a default or is required, so a resource that
28
+ * holds it always has a value for it; any other option has neither. An option `Options` gains or loses fails to
29
+ * compile until its rule follows.
30
+ */
31
+ export type OptionRules<Options, Present extends keyof Options> = {
32
+ readonly [K in keyof Options]-?: OptionRule<OptionValue<Options, K>> & (K extends Present ? {
33
+ readonly default: OptionValue<Options, K>;
34
+ } | {
35
+ readonly required: true;
36
+ } : {
37
+ readonly default?: undefined;
38
+ readonly required?: false;
39
+ });
40
+ };
41
+ /** Each option of a held resource as a `Setting`, once defaults, the file and `--set` are merged. */
42
+ export type OptionSettings<Options, Present extends keyof Options> = {
43
+ readonly [K in keyof Options]-?: K extends Present ? Setting<OptionValue<Options, K>> : Setting<OptionValue<Options, K>> | undefined;
44
+ };
45
+ /**
46
+ * One thing wrong with a resource's merged options: the option it is about, what is wrong, worded to follow the
47
+ * option's key path, and every option whose value it is about, `option` included, whose sources the error names.
48
+ */
49
+ export interface OptionProblem<Option extends string> {
50
+ readonly option: Option;
51
+ readonly problem: string;
52
+ readonly involves: readonly Option[];
53
+ }
54
+ /** A resource's options resolved: the value, or each thing wrong with them. */
55
+ export type OptionsResolution<T, Option extends string> = {
56
+ readonly ok: true;
57
+ readonly value: T;
58
+ } | {
59
+ readonly ok: false;
60
+ readonly problems: readonly OptionProblem<Option>[];
61
+ };
62
+ /**
63
+ * What a "must be made by …" problem names: the tag the factory's value carries (`kind`), how its call is written,
64
+ * such as `widget({ … })`, and the published subpath it comes from.
65
+ */
66
+ export interface ResourceFactory {
67
+ readonly kind: string;
68
+ readonly call: string;
69
+ readonly subpath: string;
70
+ }
71
+ /**
72
+ * What one resource declares about its section under `resources`:
73
+ *
74
+ * - `name`: its key under `resources`.
75
+ * - `factory`: the factory a config file makes its value with.
76
+ * - `options`: one rule for each option.
77
+ * - `resolve`: given each option of a held resource as a `Setting`, its resolved options, or what is wrong with them:
78
+ * the checks across options. A required option that is missing never reaches it.
79
+ *
80
+ * `resolve` is a method, so the registry's list of resource configs fits `AnyResourceConfig`: a method's parameter is
81
+ * checked both ways, where a function property's would be checked only contravariantly.
82
+ */
83
+ export interface ResourceConfig<Name extends string, Options, Resolved, Present extends keyof Options = never> {
84
+ readonly name: Name;
85
+ readonly factory: ResourceFactory;
86
+ readonly options: OptionRules<Options, Present>;
87
+ resolve(settings: OptionSettings<Options, Present>): OptionsResolution<Resolved, keyof Options & string>;
88
+ }
89
+ /** Any resource config, as the generic machinery loops over them. */
90
+ export interface AnyResourceConfig {
91
+ readonly name: string;
92
+ readonly factory: ResourceFactory;
93
+ readonly options: {
94
+ readonly [option: string]: OptionRule<unknown>;
95
+ };
96
+ resolve(settings: {
97
+ readonly [option: string]: Setting<unknown> | undefined;
98
+ }): OptionsResolution<unknown, string>;
99
+ }
100
+ /** A resource config's option names. */
101
+ export type OptionOf<C extends AnyResourceConfig> = keyof C["options"] & string;
102
+ /** The value one rule checks to. */
103
+ type RuleValue<R> = R extends {
104
+ readonly check: (value: unknown) => Checked<infer T>;
105
+ } ? T : never;
106
+ /** A resource's options as the file or `--set` gives them, each checked; an option not given is absent. */
107
+ export type GivenOptions<C extends AnyResourceConfig> = {
108
+ readonly [K in OptionOf<C>]?: RuleValue<C["options"][K]>;
109
+ };
110
+ /** What a resource config's `resolve` takes: each option as a `Setting`. */
111
+ export type SettingsOf<C extends AnyResourceConfig> = Parameters<C["resolve"]>[0];
112
+ /** What a resource config's `resolve` resolves to. */
113
+ export type ResolvedOf<C extends AnyResourceConfig> = Extract<ReturnType<C["resolve"]>, {
114
+ readonly ok: true;
115
+ }>["value"];
116
+ /** The given options of each resource in `Configs`, by name; a resource none are given for is absent. */
117
+ export type GivenResources<Configs extends readonly AnyResourceConfig[]> = {
118
+ readonly [C in Configs[number] as C["name"]]?: GivenOptions<C>;
119
+ };
120
+ /** The resolved options of each resource in `Configs` a run holds, by name; a resource it doesn't hold is absent. */
121
+ export type ResolvedResources<Configs extends readonly AnyResourceConfig[]> = {
122
+ readonly [C in Configs[number] as C["name"]]?: ResolvedOf<C>;
123
+ };
124
+ /** A resource option's place in the file, as problems and `--set` name it: `resources.<name>.<option>`. */
125
+ export declare function optionKeyPath(resource: string, option: string): string;
126
+ /** `true` or `false` as the boolean; any other text as itself, which a true-or-false rule refuses by name. */
127
+ export declare function readBooleanText(text: string): unknown;
128
+ /** Digits as the whole number they spell; any other text as itself, which a number rule refuses by name. */
129
+ export declare function readWholeNumberText(text: string): unknown;
130
+ /** `--set` text as itself, for an option whose value is text. */
131
+ export declare function readTextAsIs(text: string): unknown;
132
+ export {};
@@ -0,0 +1,19 @@
1
+ // The resource config: what one resource declares about its section under `resources` in `storm.config.ts`. Each
2
+ // resource folder implements one in its `config.ts`; this module declares the shape and names no resource. The
3
+ // generic machinery (`load.ts`, `set.ts`, `resolve.ts`) loops over the resource configs its caller passes in.
4
+ /** A resource option's place in the file, as problems and `--set` name it: `resources.<name>.<option>`. */
5
+ export function optionKeyPath(resource, option) {
6
+ return ["resources", resource, option].join(".");
7
+ }
8
+ /** `true` or `false` as the boolean; any other text as itself, which a true-or-false rule refuses by name. */
9
+ export function readBooleanText(text) {
10
+ return text === "true" ? true : text === "false" ? false : text;
11
+ }
12
+ /** Digits as the whole number they spell; any other text as itself, which a number rule refuses by name. */
13
+ export function readWholeNumberText(text) {
14
+ return /^\d+$/.test(text) ? Number(text) : text;
15
+ }
16
+ /** `--set` text as itself, for an option whose value is text. */
17
+ export function readTextAsIs(text) {
18
+ return text;
19
+ }
@@ -0,0 +1,64 @@
1
+ import { type CheckedRecipe, type RunnerRecipe } from "../runner/index.ts";
2
+ /** The config file's name. storm looks for it in the working directory and its parents. */
3
+ export declare const CONFIG_FILE_NAME = "storm.config.ts";
4
+ /**
5
+ * The settings a `storm.config.ts` can give at its top level, as the file gives them. A flag (`--scope`,
6
+ * `--project`) overrides the file; none has a built-in default. `@cnc-tools/storm/config`'s `StormConfig` adds
7
+ * `resources` to these.
8
+ */
9
+ export interface ConfigSettings {
10
+ /** The control plane team (`--scope`), which a runner run also mints for. */
11
+ readonly scope?: string;
12
+ /** The control plane project (`--project`), which a runner run also mints for. */
13
+ readonly project?: string;
14
+ /** The runner recipe: what `storm run` runs the command in, unless `--local`. Only a runner run reads it. */
15
+ readonly runner?: RunnerRecipe;
16
+ }
17
+ /** A top-level setting's name. */
18
+ export type ConfigSettingKey = keyof ConfigSettings;
19
+ /** A top-level key of `storm.config.ts`: a setting, or `resources`. */
20
+ export type ConfigKey = ConfigSettingKey | "resources";
21
+ /** The keys whose checked value differs from what the file gives: a recipe gains its defaults. */
22
+ interface CheckedSettingValues {
23
+ readonly runner: CheckedRecipe;
24
+ }
25
+ /** The value a top-level setting takes once checked. */
26
+ export type SettingValue<K extends ConfigSettingKey> = K extends keyof CheckedSettingValues ? CheckedSettingValues[K] : Exclude<ConfigSettings[K], undefined>;
27
+ /** The top-level settings a loaded config file gave, each checked; a setting the file doesn't give is absent. */
28
+ export type CheckedSettings = {
29
+ readonly [K in ConfigSettingKey]?: SettingValue<K>;
30
+ };
31
+ /**
32
+ * One thing wrong with a value: the path inside the value (empty for the value itself, `["snapshot", "vcpus"]` inside
33
+ * a runner recipe), and what is wrong, worded to follow the key (`must be …, not …`).
34
+ */
35
+ export interface ValueProblem {
36
+ readonly path: readonly string[];
37
+ readonly problem: string;
38
+ }
39
+ /** A value checked: the value, or each thing wrong with it. */
40
+ export type Checked<T> = {
41
+ readonly ok: true;
42
+ readonly value: T;
43
+ } | {
44
+ readonly ok: false;
45
+ readonly problems: readonly ValueProblem[];
46
+ };
47
+ /** A check that failed with one problem about the value itself. */
48
+ export declare function wrongValue(problem: string): {
49
+ readonly ok: false;
50
+ readonly problems: readonly ValueProblem[];
51
+ };
52
+ /** A string with at least one character. */
53
+ export declare function checkNonEmptyString(value: unknown): Checked<string>;
54
+ /** `true` or `false`. */
55
+ export declare function checkBoolean(value: unknown): Checked<boolean>;
56
+ /** Every top-level setting, in the order a config file's problems list them. */
57
+ export declare const CONFIG_SETTING_KEYS: readonly ConfigSettingKey[];
58
+ /** Whether `key` is a top-level setting. */
59
+ export declare function isConfigSettingKey(key: string): key is ConfigSettingKey;
60
+ /** Checks one top-level setting's value from the file. */
61
+ export declare function checkSettingValue<K extends ConfigSettingKey>(key: K, value: unknown): Checked<SettingValue<K>>;
62
+ /** A value as a problem names it: a string or number as written, otherwise its kind. */
63
+ export declare function describeValue(value: unknown): string;
64
+ export {};
@@ -0,0 +1,57 @@
1
+ // What a `storm.config.ts` holds at its top level: the settings `scope`, `project` and `runner`, each with its
2
+ // rule, and `resources`, whose sections the resource configs a caller passes in describe (`resource-config.ts`). Also
3
+ // the check vocabulary every rule shares: `Checked`, `ValueProblem` and how a problem names a value.
4
+ import { checkRecipe } from "../runner/index.js";
5
+ /** The config file's name. storm looks for it in the working directory and its parents. */
6
+ export const CONFIG_FILE_NAME = "storm.config.ts";
7
+ /** A check that failed with one problem about the value itself. */
8
+ export function wrongValue(problem) {
9
+ return { ok: false, problems: [{ path: [], problem }] };
10
+ }
11
+ /** A string with at least one character. */
12
+ export function checkNonEmptyString(value) {
13
+ return typeof value === "string" && value.length > 0
14
+ ? { ok: true, value }
15
+ : wrongValue(`must be a non-empty string, not ${describeValue(value)}`);
16
+ }
17
+ /** `true` or `false`. */
18
+ export function checkBoolean(value) {
19
+ return typeof value === "boolean"
20
+ ? { ok: true, value }
21
+ : wrongValue(`must be true or false, not ${describeValue(value)}`);
22
+ }
23
+ /**
24
+ * Each top-level setting's rule. Typed against `ConfigSettings`, so a key it gains or loses, or a value type that
25
+ * changes, fails to compile here until its rule follows. A runner recipe's problems name the key inside the recipe.
26
+ */
27
+ const SETTING_CHECKS = {
28
+ scope: checkNonEmptyString,
29
+ project: checkNonEmptyString,
30
+ runner: checkRecipe,
31
+ };
32
+ /** Every top-level setting, in the order a config file's problems list them. */
33
+ export const CONFIG_SETTING_KEYS = ["scope", "project", "runner"];
34
+ /** Whether `key` is a top-level setting. */
35
+ export function isConfigSettingKey(key) {
36
+ return Object.hasOwn(SETTING_CHECKS, key);
37
+ }
38
+ /** Checks one top-level setting's value from the file. */
39
+ export function checkSettingValue(key, value) {
40
+ return SETTING_CHECKS[key](value);
41
+ }
42
+ /** A value as a problem names it: a string or number as written, otherwise its kind. */
43
+ export function describeValue(value) {
44
+ if (typeof value === "string")
45
+ return JSON.stringify(value);
46
+ if (typeof value === "number" || typeof value === "boolean")
47
+ return String(value);
48
+ if (value === null)
49
+ return "null";
50
+ if (value === undefined)
51
+ return "undefined";
52
+ if (typeof value === "function")
53
+ return "a function";
54
+ if (Array.isArray(value))
55
+ return "an array";
56
+ return typeof value === "object" ? "an object" : `a ${typeof value}`;
57
+ }
@@ -0,0 +1,16 @@
1
+ import { type AnyResourceConfig, type GivenResources } from "./resource-config.ts";
2
+ /** What `parseSetFlags` found: the values, or one problem for each `--set` it couldn't use. */
3
+ export type SetFlagsParse<Configs extends readonly AnyResourceConfig[]> = {
4
+ readonly ok: true;
5
+ readonly values: GivenResources<Configs>;
6
+ } | {
7
+ readonly ok: false;
8
+ readonly problems: readonly string[];
9
+ };
10
+ /** The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order. */
11
+ export declare function setKeyPaths(configs: readonly AnyResourceConfig[]): readonly string[];
12
+ /**
13
+ * Reads each `--set <key path>=<value>` in `texts` against `configs`. Each problem names the `--set` as given: one
14
+ * without `=`, a key path `--set` doesn't take, a key path given twice, or a value its option's rule refuses.
15
+ */
16
+ export declare function parseSetFlags<Configs extends readonly AnyResourceConfig[]>(texts: readonly string[], configs: Configs): SetFlagsParse<Configs>;
@@ -0,0 +1,55 @@
1
+ // `--set <key path>=<value>`: a resource's option given on the command line by its key path in `storm.config.ts`,
2
+ // `resources.<name>.<option>`. Every option of every resource config passed in takes one. Each value is text, read by
3
+ // its option's rule (`readText`) and then checked by the rule, as a value from the file would be. The values come
4
+ // back by resource, then by option.
5
+ import { givenResourcesByName } from "./by-name.js";
6
+ import { optionKeyPath } from "./resource-config.js";
7
+ /** Each key path `--set` takes, with the option it names, in config order, then option order. */
8
+ function setTargets(configs) {
9
+ return configs.flatMap((config) => Object.entries(config.options).map(([option, rule]) => [optionKeyPath(config.name, option), { resource: config.name, option, rule }]));
10
+ }
11
+ /** The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order. */
12
+ export function setKeyPaths(configs) {
13
+ return setTargets(configs).map(([path]) => path);
14
+ }
15
+ /**
16
+ * Reads each `--set <key path>=<value>` in `texts` against `configs`. Each problem names the `--set` as given: one
17
+ * without `=`, a key path `--set` doesn't take, a key path given twice, or a value its option's rule refuses.
18
+ */
19
+ export function parseSetFlags(texts, configs) {
20
+ const targets = setTargets(configs);
21
+ const byPath = new Map(targets);
22
+ const paths = targets.map(([path]) => path);
23
+ const values = {};
24
+ const seen = new Set();
25
+ const problems = [];
26
+ for (const text of texts) {
27
+ const equals = text.indexOf("=");
28
+ if (equals <= 0) {
29
+ problems.push(`--set ${text} must be <key path>=<value>${paths[0] === undefined ? "" : `, such as ${paths[0]}=<value>`}`);
30
+ continue;
31
+ }
32
+ const path = text.slice(0, equals);
33
+ const target = byPath.get(path);
34
+ if (target === undefined) {
35
+ problems.push(paths.length === 0
36
+ ? `--set ${path} isn't a key path --set takes; it takes none`
37
+ : `--set ${path} isn't a key path --set takes; it takes ${paths.join(", ")}`);
38
+ continue;
39
+ }
40
+ if (seen.has(path)) {
41
+ problems.push(`--set ${path} is given more than once`);
42
+ continue;
43
+ }
44
+ seen.add(path);
45
+ const checked = target.rule.check(target.rule.readText(text.slice(equals + 1)));
46
+ if (!checked.ok) {
47
+ problems.push(...checked.problems.map(({ problem }) => `--set ${path} ${problem}`));
48
+ continue;
49
+ }
50
+ values[target.resource] = { ...values[target.resource], [target.option]: checked.value };
51
+ }
52
+ if (problems.length > 0)
53
+ return { ok: false, problems };
54
+ return { ok: true, values: givenResourcesByName(configs, values) };
55
+ }
@@ -0,0 +1,41 @@
1
+ import { type Refusable } from "@vercel/clinkr";
2
+ import { configErrors } from "./errors.ts";
3
+ import type { ConfigGateway } from "./gateways.ts";
4
+ import { type ConfigProblem, type ConfigValues } from "./load.ts";
5
+ import { type ResolvedSettings, type ResourceOptionProblem, type SettingFlags } from "./resolve.ts";
6
+ import type { AnyResourceConfig, GivenOptions, GivenResources, ResolvedResources } from "./resource-config.ts";
7
+ type InvalidConfig = ReturnType<typeof configErrors.invalidConfig>;
8
+ type InvalidResourceOptions = ReturnType<typeof configErrors.invalidResourceOptions>;
9
+ /**
10
+ * The config file a command's settings come from: its absolute path and checked values, or neither when none
11
+ * applies. `configs` are the resource configs it was checked against.
12
+ */
13
+ export interface SettingsFile<Configs extends readonly AnyResourceConfig[]> {
14
+ readonly path: string | null;
15
+ readonly values: ConfigValues<Configs> | undefined;
16
+ readonly configs: Configs;
17
+ }
18
+ /**
19
+ * Loads and checks the config file from `cwd` against `configs`, refusing with `invalid_config` when it can't be used
20
+ * or any value in it is invalid.
21
+ */
22
+ export declare function loadSettingsFile<Configs extends readonly AnyResourceConfig[]>(gateway: ConfigGateway, cwd: string, configs: Configs): Promise<Refusable<SettingsFile<Configs>, InvalidConfig>>;
23
+ /** The top-level settings from `flags` over `file`. */
24
+ export declare function fileSettings(file: SettingsFile<readonly AnyResourceConfig[]>, flags: SettingFlags): ResolvedSettings;
25
+ /**
26
+ * What the file gives resource config `config`'s section, if anything: the file was checked against `config`, so its
27
+ * section holds `config`'s options. It throws when the file wasn't checked against `config`.
28
+ */
29
+ export declare function fileOptions<C extends AnyResourceConfig>(file: SettingsFile<readonly AnyResourceConfig[]>, config: C): GivenOptions<C> | undefined;
30
+ /**
31
+ * The resolved options of each resource the run holds, from the file and `sets`, refusing with
32
+ * `invalid_resource_options` when a held resource's merged options don't fit together or lack a required one.
33
+ */
34
+ export declare function settleResourceOptions<Configs extends readonly AnyResourceConfig[]>(file: SettingsFile<Configs>, sets: GivenResources<Configs>): Refusable<{
35
+ readonly options: ResolvedResources<Configs>;
36
+ }, InvalidResourceOptions>;
37
+ /** The `invalid_config` error for the file at `file`. */
38
+ export declare function invalidConfig(file: string, problems: readonly ConfigProblem[]): InvalidConfig;
39
+ /** The `invalid_resource_options` error, each value as text. */
40
+ export declare function invalidResourceOptions(configFile: string | null, problems: readonly ResourceOptionProblem[]): InvalidResourceOptions;
41
+ export {};
@@ -0,0 +1,72 @@
1
+ // How a command that reads `storm.config.ts` settles its settings: find, load and check all of it against the
2
+ // resource configs it is handed, take each top-level setting from its flag or the file, and merge each held resource's
3
+ // options from its defaults, the file and the flags, refusing with `invalid_config` or `invalid_resource_options`.
4
+ import { refused } from "@vercel/clinkr";
5
+ import { givenOptionsOf } from "./by-name.js";
6
+ import { configErrors } from "./errors.js";
7
+ import { loadConfig } from "./load.js";
8
+ import { resolveResourceOptions, resolveSettings, } from "./resolve.js";
9
+ import { describeValue } from "./schema.js";
10
+ /**
11
+ * Loads and checks the config file from `cwd` against `configs`, refusing with `invalid_config` when it can't be used
12
+ * or any value in it is invalid.
13
+ */
14
+ export async function loadSettingsFile(gateway, cwd, configs) {
15
+ const loaded = await loadConfig(gateway, cwd, configs);
16
+ if (loaded.kind === "invalid")
17
+ return refused(invalidConfig(loaded.path, loaded.problems));
18
+ return loaded.kind === "loaded"
19
+ ? { ok: true, path: loaded.path, values: loaded.values, configs }
20
+ : { ok: true, path: null, values: undefined, configs };
21
+ }
22
+ /** The top-level settings from `flags` over `file`. */
23
+ export function fileSettings(file, flags) {
24
+ return resolveSettings(flags, file.values?.settings);
25
+ }
26
+ /**
27
+ * What the file gives resource config `config`'s section, if anything: the file was checked against `config`, so its
28
+ * section holds `config`'s options. It throws when the file wasn't checked against `config`.
29
+ */
30
+ export function fileOptions(file, config) {
31
+ if (!file.configs.includes(config))
32
+ throw new Error(`The config file wasn't checked against ${config.name}`);
33
+ const resources = file.values?.resources;
34
+ const given = resources?.[config.name];
35
+ return given === undefined ? undefined : givenOptionsOf(config, given);
36
+ }
37
+ /**
38
+ * The resolved options of each resource the run holds, from the file and `sets`, refusing with
39
+ * `invalid_resource_options` when a held resource's merged options don't fit together or lack a required one.
40
+ */
41
+ export function settleResourceOptions(file, sets) {
42
+ const resolved = resolveResourceOptions(file.configs, file.values?.resources, sets);
43
+ if (!resolved.ok)
44
+ return refused(invalidResourceOptions(file.path, resolved.problems));
45
+ return { ok: true, options: resolved.value };
46
+ }
47
+ /** The `invalid_config` error for the file at `file`. */
48
+ export function invalidConfig(file, problems) {
49
+ return configErrors.invalidConfig({
50
+ file,
51
+ problems: problems.map(({ key, location, problem }) => ({
52
+ key,
53
+ location: location === null ? null : { line: location.line, column: location.column ?? null },
54
+ problem,
55
+ })),
56
+ });
57
+ }
58
+ /** The `invalid_resource_options` error, each value as text. */
59
+ export function invalidResourceOptions(configFile, problems) {
60
+ return configErrors.invalidResourceOptions({
61
+ configFile,
62
+ problems: problems.map(({ key, problem, values }) => ({
63
+ key,
64
+ problem,
65
+ values: values.map(({ key: valueKey, value, source }) => ({ key: valueKey, value: valueText(value), source })),
66
+ })),
67
+ });
68
+ }
69
+ /** A value as an error's facts give it: a string as written, a number or boolean as its text, anything else by kind. */
70
+ function valueText(value) {
71
+ return typeof value === "string" ? value : describeValue(value);
72
+ }
@@ -0,0 +1,37 @@
1
+ import type { ConfigSettings } from "../config/index.ts";
2
+ import type { GitHubFixtureRepoResource } from "../resources/github/index.ts";
3
+ import type { TestserverPoolResource } from "../resources/testserver/index.ts";
4
+ export { pnpmToolchains } from "./toolchain.ts";
5
+ export type { RunnerRecipe, RunnerResources, RunnerStep, RunnerStepContext, RunnerSteps } from "../runner/index.ts";
6
+ /**
7
+ * The resources a run holds for its command, each made by its own factory. Without one, a run holds nothing beside
8
+ * its command. `storm run --set resources.<name>.<option>=<value>` sets any resource's option for one run, and
9
+ * gives the run that resource when the file has none.
10
+ */
11
+ export interface StormResources {
12
+ /**
13
+ * The Testserver pool resource, from `testserverPool()` in `@cnc-tools/storm/testserver`. Its presence gives a run
14
+ * a Testserver side. `pool create` reads its `build` and `ttl` whether or not a run would.
15
+ */
16
+ readonly testserverPool?: TestserverPoolResource;
17
+ /**
18
+ * The GitHub fixture repository resource, from `githubFixtureRepo()` in `@cnc-tools/storm/github`: one standing
19
+ * GitHub repository, a token for it and a run prefix, handed to the command, whose branches under the run prefix the
20
+ * run deletes once the command has stopped. Only `run` reads it.
21
+ */
22
+ readonly githubFixtureRepo?: GitHubFixtureRepoResource;
23
+ }
24
+ /**
25
+ * What a `storm.config.ts` can give: the top-level settings, and the resources a run holds. A flag (`--scope`,
26
+ * `--project`, or `--set` for a resource's option) overrides the file, and the file overrides the built-in default.
27
+ * storm checks the whole file whenever a command loads it.
28
+ */
29
+ export interface StormConfig extends ConfigSettings {
30
+ /**
31
+ * The resources a run holds. Without `resources.testserverPool`, and without a `--set resources.testserverPool.*`,
32
+ * `storm run` holds no Testserver sandbox: it runs the command with a run payload that names none.
33
+ */
34
+ readonly resources?: StormResources;
35
+ }
36
+ /** Types a `storm.config.ts`'s default export. It returns `config` as given. */
37
+ export declare function defineConfig(config: StormConfig): StormConfig;
@@ -0,0 +1,9 @@
1
+ // The config file's published surface, `@cnc-tools/storm/config`. A user's `storm.config.ts` imports it, so it
2
+ // imports nothing at run time but `toolchain.ts`, which imports nothing either: loading a config file pulls in no
3
+ // Clinkr, zod or CLI code. Everything it takes from the modules, the top-level settings, the runner recipe's types and
4
+ // each resource's factory type, is a type-only import, erased at run time.
5
+ export { pnpmToolchains } from "./toolchain.js";
6
+ /** Types a `storm.config.ts`'s default export. It returns `config` as given. */
7
+ export function defineConfig(config) {
8
+ return config;
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { RunnerStep, RunnerStepContext } from "../runner/index.ts";
2
+ /**
3
+ * The runner snapshot's toolchain step for the root `package.json` at the base: `git` on `PATH`, a Node that meets
4
+ * `engines.node`'s minimum when the runtime's is older, and the `packageManager`'s pnpm through corepack. Shims and a
5
+ * downloaded Node go in `~/.local/bin`, which the login shell's `PATH` puts first. Give it as a recipe's
6
+ * `snapshot.toolchains`. It rejects when `packageManager` isn't `pnpm@<x.y.z>` or `engines.node` isn't `>=<x.y.z>`,
7
+ * which keeps a cached runner snapshot at that base from being used.
8
+ */
9
+ export declare function pnpmToolchains({ readBaseFile }: RunnerStepContext): Promise<readonly RunnerStep[]>;