@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,364 @@
1
+ // The Vercel CLI driver: runs the production `vercel` CLI against one test's proxy, as the default identity
2
+ // `actAs` sets or the token a call names, with `--token`, a saved login or logged out, in directories the test's
3
+ // invocations share. `createVercelCli` takes its Context; `vercelCli` (`entry.ts`), the published entry, passes the
4
+ // live one.
5
+ import { join } from "node:path";
6
+ import { displayCommand, passesFlag, passesScopeFlag, vercelArguments } from "./arguments.js";
7
+ import { authFileConflict, authFileSettled, settledAuthConfig, VERCEL_AUTH_MODES, } from "./auth-config.js";
8
+ import { AUTH_CONFIG_FILE, readConfigText, serializeConfig } from "./config-files.js";
9
+ import { invocationEnvironment } from "./environment.js";
10
+ import { VercelCliError } from "./errors.js";
11
+ import { Invocation, STOP_SIGNALS, WAIT_FOR_TIMEOUT_MS, } from "./invocation.js";
12
+ import { KEY_SEQUENCES } from "./keys.js";
13
+ import { Redactor } from "./redaction.js";
14
+ import { describeEnd, describeInvocation, describeInvocations } from "./report.js";
15
+ /** How long an invocation may run before the driver kills it, unless the driver or the call says otherwise. */
16
+ export const VERCEL_TIMEOUT_MS = 45_000;
17
+ /** The `vercel` the driver runs when `command` isn't given: `vercel` on `PATH`. */
18
+ const DEFAULT_COMMAND = { file: "vercel", args: [] };
19
+ /** A `VercelCli` over `context`. It prepares `<home>/global-config` and `<home>/work` first. */
20
+ export async function createVercelCli(options, context) {
21
+ const defaultTimeoutMs = checkedTimeout(options.timeoutMs ?? VERCEL_TIMEOUT_MS, "timeoutMs");
22
+ const home = options.home;
23
+ const globalConfigDir = join(home, "global-config");
24
+ const workDir = join(home, "work");
25
+ const prepared = await context.processes.prepareDirectories([globalConfigDir, workDir]);
26
+ if (!prepared.ok) {
27
+ throw new VercelCliError(`vercel-cli: could not prepare ${globalConfigDir} and ${workDir}: ${prepared.error.message}`);
28
+ }
29
+ const command = options.command ?? DEFAULT_COMMAND;
30
+ const commandArgs = command.args ?? [];
31
+ const hostEnv = options.hostEnv ?? {};
32
+ // A closure, so a proxy's `redact` is called on the proxy.
33
+ const redactor = new Redactor((text) => options.proxy.redact?.(text) ?? text);
34
+ const invocations = [];
35
+ const deps = { clock: context.clock, redactor, proxy: options.proxy };
36
+ let identity;
37
+ let defaultAuth = "flag";
38
+ /**
39
+ * The last `auth.json` settlement, which the next one waits for: compatible saved logins and logged-out runs may
40
+ * start at once, and each reads, then may write, the one file, so they settle it one at a time.
41
+ */
42
+ let authFileSettling = Promise.resolve();
43
+ const settleAuthFileInTurn = (authentication) => {
44
+ const settled = authFileSettling.then(() => settleAuthFile(context.processes, globalConfigDir, authentication));
45
+ authFileSettling = settled.catch(() => undefined);
46
+ return settled;
47
+ };
48
+ /**
49
+ * Starts an invocation. Everything before the process starts runs synchronously, as the call is made: it resolves
50
+ * the call's identity and how it authenticates, refuses what the driver owns and an `auth.json` another running
51
+ * invocation needs otherwise with a `TypeError`, and registers the invocation, so a later `actAs` doesn't change it
52
+ * and `close()` kills it even while it is starting. Then it settles `auth.json` for a saved login or a logged-out
53
+ * run, after any settlement already under way, and starts the process.
54
+ */
55
+ const launch = async (args, call, how) => {
56
+ const { interactive, stdin } = how;
57
+ const terminal = stdin.kind === "terminal";
58
+ const authentication = resolveAuthentication(checkedAuth(call.auth ?? defaultAuth), call.as, identity?.token);
59
+ if (authentication.mode !== "none")
60
+ redactor.add(authentication.token);
61
+ const scope = resolveScope(call.scope, authentication.mode === "flag" ? identity?.scope : undefined, args);
62
+ const timeoutMs = checkedTimeout(call.timeoutMs ?? defaultTimeoutMs, "timeoutMs");
63
+ const argv = vercelArguments({
64
+ args,
65
+ proxyUrl: options.proxy.url,
66
+ token: authentication.mode === "flag" ? authentication.token : undefined,
67
+ globalConfigDir,
68
+ scope,
69
+ });
70
+ const env = invocationEnvironment({ host: hostEnv, home, terminal, columns: how.columns, extra: call.env });
71
+ const cwd = call.cwd ?? workDir;
72
+ const conflict = invocations.find((other) => other.running && authFileConflict(authentication, other.authentication));
73
+ if (conflict !== undefined)
74
+ throw authFileConflictError(authentication, conflict);
75
+ const invocation = new Invocation({
76
+ number: invocations.length + 1,
77
+ command: displayCommand([command.file, ...commandArgs, ...argv], redactor),
78
+ cwd,
79
+ interactive,
80
+ stdin,
81
+ authentication,
82
+ deps,
83
+ });
84
+ for (const other of invocations) {
85
+ if (!other.running)
86
+ continue;
87
+ other.overlaps(invocation.number);
88
+ invocation.overlaps(other.number);
89
+ }
90
+ invocations.push(invocation);
91
+ const onEnd = options.onInvocationEnd;
92
+ if (onEnd !== undefined)
93
+ void invocation.ended().then(() => {
94
+ try {
95
+ onEnd(invocation.snapshot());
96
+ }
97
+ catch {
98
+ // A listener's failure is its own.
99
+ }
100
+ });
101
+ if (authentication.mode !== "flag") {
102
+ const failure = await settleAuthFileInTurn(authentication);
103
+ if (failure !== undefined) {
104
+ invocation.notStarted({ code: "auth-config", message: failure });
105
+ const snapshot = invocation.snapshot();
106
+ throw new VercelCliError(`vercel-cli: ${snapshot.command}: ${describeEnd(snapshot.end, snapshot.durationMs)}`);
107
+ }
108
+ }
109
+ const started = await context.processes.start({
110
+ file: command.file,
111
+ args: [...commandArgs, ...argv],
112
+ env,
113
+ cwd,
114
+ stdin: stdin.kind === "ignored" ? "ignore" : "pipe",
115
+ onOutput: invocation.output,
116
+ });
117
+ if (!started.ok) {
118
+ invocation.notStarted(started.error);
119
+ const snapshot = invocation.snapshot();
120
+ throw new VercelCliError(`vercel-cli: ${snapshot.command}: ${describeEnd(snapshot.end, snapshot.durationMs)}` +
121
+ (started.error.code === "missing" && command === DEFAULT_COMMAND
122
+ ? "; install vercel with `npm i -g vercel@latest`"
123
+ : ""));
124
+ }
125
+ invocation.attach(started.process, { timeoutMs, signal: options.signal });
126
+ if (stdin.kind === "text")
127
+ invocation.feed(stdin.text);
128
+ return invocation;
129
+ };
130
+ /**
131
+ * The handle a block gets. Without a terminal, `interact`'s overloads type it as an `InteractiveInvocation`, and its
132
+ * `press` and `type`, which an untyped caller can still reach, throw a `TypeError`: stdin was ignored, or piped
133
+ * only for `stdin`, and a test answers prompts at a terminal.
134
+ */
135
+ const handle = (invocation, terminal) => {
136
+ const needTerminal = (method) => {
137
+ if (!terminal) {
138
+ throw new TypeError(`vercel-cli: ${method} needs a terminal; pass terminal: true to interact`);
139
+ }
140
+ };
141
+ return {
142
+ waitFor: (pattern, waitOptions = {}) => invocation.waitFor(pattern, checkedTimeout(waitOptions.timeoutMs ?? WAIT_FOR_TIMEOUT_MS, "waitFor timeoutMs")),
143
+ stop(signal = "SIGINT") {
144
+ if (!STOP_SIGNALS.includes(signal)) {
145
+ // An untyped caller can pass anything, including a symbol a template literal would throw on.
146
+ const received = signal;
147
+ throw new TypeError(`vercel-cli: stop takes ${STOP_SIGNALS.join(" or ")}, not ${String(received)}`);
148
+ }
149
+ return invocation.stop(signal);
150
+ },
151
+ press(key) {
152
+ needTerminal("press");
153
+ if (!Object.hasOwn(KEY_SEQUENCES, key)) {
154
+ // An untyped caller can pass anything, including a symbol a template literal would throw on.
155
+ const received = key;
156
+ throw new TypeError(`vercel-cli: press takes one of ${Object.keys(KEY_SEQUENCES).join(", ")}, not ${String(received)}`);
157
+ }
158
+ invocation.write(KEY_SEQUENCES[key], key);
159
+ },
160
+ type(text) {
161
+ needTerminal("type");
162
+ invocation.write(text, "text");
163
+ },
164
+ };
165
+ };
166
+ /**
167
+ * Starts `vercel`, runs `block` with it, then closes stdin, unless the call asked for it open, and resolves with its
168
+ * result once it has ended. Kills it when `block` throws. Every call but `json` runs through here; `run`'s block
169
+ * does nothing.
170
+ */
171
+ const execute = async (args, call, interactive, block) => {
172
+ const stdin = invocationStdin(call);
173
+ const columns = invocationColumns(call);
174
+ const terminal = stdin.kind === "terminal";
175
+ const invocation = await launch(args, call, { interactive, stdin, columns });
176
+ try {
177
+ await block(handle(invocation, terminal));
178
+ }
179
+ catch (error) {
180
+ invocation.kill("abandon");
181
+ await invocation.ended();
182
+ throw error;
183
+ }
184
+ if (stdin.kind !== "open")
185
+ invocation.closeStdin();
186
+ return invocation.result();
187
+ };
188
+ async function interact(args, callOrBlock, maybeBlock) {
189
+ const [call, block] = typeof callOrBlock === "function" ? [{}, callOrBlock] : [callOrBlock, maybeBlock];
190
+ if (typeof block !== "function") {
191
+ throw new TypeError("vercel-cli: interact takes a block: interact(args, options?, async (invocation) => ...)");
192
+ }
193
+ return execute(args, call, true, block);
194
+ }
195
+ return {
196
+ home,
197
+ globalConfigDir,
198
+ workDir,
199
+ actAs({ token, team }, actAsOptions = {}) {
200
+ if (token.secretString === "")
201
+ throw new TypeError("vercel-cli: actAs names an empty token");
202
+ if (team !== null && team.slug === "")
203
+ throw new TypeError("vercel-cli: actAs names a team with an empty slug");
204
+ const auth = checkedAuth(actAsOptions.auth ?? "flag");
205
+ redactor.add(token.secretString);
206
+ identity = { token: token.secretString, scope: team?.slug };
207
+ defaultAuth = auth;
208
+ },
209
+ run: async (args, call = {}) => execute(args, call, false, () => undefined),
210
+ interact,
211
+ async json(args, schema, call = {}) {
212
+ if (passesFlag(args, "--format")) {
213
+ throw new TypeError("vercel-cli: json adds --format json itself; leave --format out of the arguments");
214
+ }
215
+ const invocation = await launch([...args, "--format", "json"], call, {
216
+ interactive: false,
217
+ stdin: { kind: "ignored" },
218
+ });
219
+ const result = await invocation.result();
220
+ const failed = (why) => new VercelCliError(`vercel-cli: invocation ${invocation.number} ${why}\n${describeInvocation(invocation.snapshot())}`);
221
+ if (result.exitCode !== 0 || result.timedOut || result.aborted)
222
+ throw failed("didn't exit 0");
223
+ let document;
224
+ try {
225
+ document = JSON.parse(result.stdout);
226
+ }
227
+ catch {
228
+ throw failed("printed something other than JSON");
229
+ }
230
+ const parsed = schema.safeParse(document);
231
+ if (!parsed.success) {
232
+ const issue = parsed.error.issues[0];
233
+ const where = issue === undefined || issue.path.length === 0 ? "" : ` at ${issue.path.map(String).join(".")}`;
234
+ throw failed(`printed JSON its schema rejects${where}: ${redactor.redact(issue?.message ?? "invalid")}`);
235
+ }
236
+ return parsed.data;
237
+ },
238
+ get invocations() {
239
+ return invocations.map((invocation) => invocation.snapshot());
240
+ },
241
+ async close() {
242
+ const running = invocations.filter((invocation) => invocation.running);
243
+ for (const invocation of running)
244
+ invocation.kill("close");
245
+ await Promise.all(running.map((invocation) => invocation.ended()));
246
+ },
247
+ failureReport() {
248
+ return describeInvocations(invocations.map((invocation) => invocation.snapshot()));
249
+ },
250
+ };
251
+ }
252
+ /** A `TypeError` for starting `wanted` while `other`, still running, needs `auth.json` to hold something else. */
253
+ function authFileConflictError(wanted, other) {
254
+ const run = wanted.mode === "none" ? 'a logged-out run (auth "none")' : 'a saved login (auth "saved")';
255
+ const needs = wanted.mode === "none" ? "without a token" : "to hold its token";
256
+ const otherNeeds = other.authentication.mode === "none" ? "without one" : "to hold another token";
257
+ return new TypeError(`vercel-cli: ${run} needs ${AUTH_CONFIG_FILE} ${needs}, but invocation ${other.number}, still running, needs it ${otherNeeds}; let it end first`);
258
+ }
259
+ /**
260
+ * Leaves `auth.json` in `globalConfigDir` as `authentication` needs it: its `token` set to the saved token, or the
261
+ * login keys (`LOGIN_KEYS`) removed, every other key kept, and no write when the file already holds that, so a
262
+ * running `vercel`'s own write isn't replaced. Resolves with why it couldn't, naming the file, or `undefined`.
263
+ */
264
+ async function settleAuthFile(processes, globalConfigDir, authentication) {
265
+ const path = join(globalConfigDir, AUTH_CONFIG_FILE);
266
+ const read = await processes.readAuthFile(globalConfigDir);
267
+ if (read.type === "error")
268
+ return `could not read ${path}: ${read.error.message}`;
269
+ let config = {};
270
+ if (read.type === "found") {
271
+ const parsed = readConfigText(read.text, path);
272
+ if (!parsed.ok)
273
+ return parsed.message;
274
+ config = parsed.value;
275
+ }
276
+ if (authFileSettled(config, authentication))
277
+ return undefined;
278
+ const written = await processes.writeAuthFile(globalConfigDir, serializeConfig(settledAuthConfig(config, authentication)));
279
+ return written.ok ? undefined : `could not write ${path}: ${written.error.message}`;
280
+ }
281
+ /**
282
+ * How a call authenticates in `mode`: logged out, refusing an `as`, or with its own `as` token, or else the default
283
+ * identity's.
284
+ */
285
+ function resolveAuthentication(mode, as, fallback) {
286
+ if (mode === "none") {
287
+ if (as !== undefined) {
288
+ throw new TypeError('vercel-cli: auth "none" runs vercel logged out, with no token; leave out as');
289
+ }
290
+ return { mode };
291
+ }
292
+ const token = as === undefined ? fallback : typeof as === "string" ? as : as.secretString;
293
+ if (token === undefined) {
294
+ throw new TypeError("vercel-cli: no token to act as; call vercel.actAs({ token, team }) first, or pass as");
295
+ }
296
+ if (token === "")
297
+ throw new TypeError("vercel-cli: as names an empty token");
298
+ return { mode, token };
299
+ }
300
+ /** `auth`, refused with a `TypeError` unless it's one of the modes: an untyped caller can pass anything. */
301
+ function checkedAuth(auth) {
302
+ if (!VERCEL_AUTH_MODES.includes(auth)) {
303
+ const received = auth;
304
+ throw new TypeError(`vercel-cli: auth is ${VERCEL_AUTH_MODES.map((mode) => `"${mode}"`).join(", ")}, not ${String(received)}`);
305
+ }
306
+ return auth;
307
+ }
308
+ /**
309
+ * The `--scope` an invocation sends: the call's own scope, none for `null`, or else the default identity's, unless
310
+ * the arguments name the scope themselves.
311
+ */
312
+ function resolveScope(call, fallback, args) {
313
+ if (call === null)
314
+ return undefined;
315
+ if (call !== undefined)
316
+ return typeof call === "string" ? call : call.slug;
317
+ return fallback === undefined || passesScopeFlag(args) ? undefined : fallback;
318
+ }
319
+ function checkedTimeout(ms, name) {
320
+ if (!Number.isFinite(ms) || ms <= 0)
321
+ throw new TypeError(`vercel-cli: ${name} must be a positive number of milliseconds, not ${ms}`);
322
+ return ms;
323
+ }
324
+ /**
325
+ * A terminal call's width: its `columns`, checked; undefined when it names none, for `invocationEnvironment`'s default.
326
+ * `columns` without `terminal: true`, or one that isn't a positive integer, is a `TypeError`: an untyped caller can
327
+ * pass anything.
328
+ */
329
+ function invocationColumns(call) {
330
+ const columns = call.columns;
331
+ if (call.terminal !== true) {
332
+ if (columns !== undefined)
333
+ throw new TypeError("vercel-cli: columns needs a terminal; pass terminal: true");
334
+ return undefined;
335
+ }
336
+ if (columns === undefined)
337
+ return undefined;
338
+ if (typeof columns !== "number" || !Number.isInteger(columns) || columns <= 0) {
339
+ throw new TypeError(`vercel-cli: columns must be a positive integer, not ${typeof columns === "number" ? columns : typeof columns}`);
340
+ }
341
+ return columns;
342
+ }
343
+ /**
344
+ * What a call's stdin is: a terminal's, the piped `stdin` it asks for, or ignored. `stdin` with `terminal: true`, or
345
+ * a `stdin` that is neither `"open"` nor `{ text }` with a string `text`, is a `TypeError`: an untyped caller can
346
+ * pass anything.
347
+ */
348
+ function invocationStdin(call) {
349
+ const stdin = call.stdin;
350
+ if (call.terminal === true) {
351
+ if (stdin !== undefined) {
352
+ throw new TypeError("vercel-cli: stdin is for a run without a terminal; at a terminal, answer with type() and press()");
353
+ }
354
+ return { kind: "terminal" };
355
+ }
356
+ if (stdin === undefined)
357
+ return { kind: "ignored" };
358
+ if (stdin === "open")
359
+ return { kind: "open" };
360
+ if (typeof stdin === "object" && stdin !== null && typeof stdin.text === "string") {
361
+ return { kind: "text", text: stdin.text };
362
+ }
363
+ throw new TypeError(`vercel-cli: stdin takes { text: string } or "open", not ${typeof stdin === "string" ? JSON.stringify(stdin) : typeof stdin}`);
364
+ }
@@ -0,0 +1,8 @@
1
+ import { type VercelCli, type VercelCliOptions } from "./driver.ts";
2
+ /**
3
+ * A `VercelCli` for one test, running `vercel` as real processes with `PATH`, `SystemRoot` and `TEMP` from
4
+ * `process.env` unless `hostEnv` says otherwise. It creates `<home>/global-config` and `<home>/work` first. Without an
5
+ * `onInvocationEnd`, it prints each invocation with `describeInvocation` to stderr in a verbose run
6
+ * (`storm run --verbose`, read from `process.env`'s run payload), and nothing otherwise.
7
+ */
8
+ export declare function vercelCli(options: VercelCliOptions): Promise<VercelCli>;
@@ -0,0 +1,13 @@
1
+ import { liveVercelCliContext } from "./context.js";
2
+ import { createVercelCli } from "./driver.js";
3
+ import { defaultInvocationListener } from "./verbose.js";
4
+ /**
5
+ * A `VercelCli` for one test, running `vercel` as real processes with `PATH`, `SystemRoot` and `TEMP` from
6
+ * `process.env` unless `hostEnv` says otherwise. It creates `<home>/global-config` and `<home>/work` first. Without an
7
+ * `onInvocationEnd`, it prints each invocation with `describeInvocation` to stderr in a verbose run
8
+ * (`storm run --verbose`, read from `process.env`'s run payload), and nothing otherwise.
9
+ */
10
+ export function vercelCli(options) {
11
+ const onInvocationEnd = options.onInvocationEnd ?? defaultInvocationListener(process.env, (text) => console.error(text));
12
+ return createVercelCli({ hostEnv: process.env, ...options, ...(onInvocationEnd === undefined ? {} : { onInvocationEnd }) }, liveVercelCliContext());
13
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The width an invocation at a terminal gets, as `CLI_WIDTH` and `COLUMNS`, unless the call names its own `columns`.
3
+ * `vercel`'s prompts wrap their text at that width, and 400 keeps a long prompt, such as one naming an id, on one line
4
+ * for `waitFor`.
5
+ */
6
+ export declare const TERMINAL_COLUMNS = 400;
7
+ /**
8
+ * The variables a call's `env` may not set, because the driver does. `PATH` is passed on but settable. No test may
9
+ * turn the keyring back on, so `VERCEL_TEST_KEYRING_UNAVAILABLE` is reserved with the other fixed variables.
10
+ * `CLI_WIDTH` and `COLUMNS` are a terminal's width, which a call sets with `columns`. `VERCEL_TOKEN` is never set, but
11
+ * the driver owns how an invocation authenticates: `vercel` reads it when there's no `--token`, so it would undo a
12
+ * saved login or a logged-out run.
13
+ */
14
+ export declare const RESERVED_VARIABLES: ReadonlySet<string>;
15
+ /**
16
+ * An invocation's whole environment: `PATH`, `SystemRoot` and `TEMP` from `host` when set, `HOME`, the fixed
17
+ * variables (`NO_COLOR`, `NO_UPDATE_NOTIFIER`, `VERCEL_TELEMETRY_DISABLED`, `VERCEL_TEST_KEYRING_UNAVAILABLE`),
18
+ * `FORCE_TTY=1`, no `CI`, and `CLI_WIDTH` and `COLUMNS` set to `columns` (default `TERMINAL_COLUMNS`) for an
19
+ * invocation at a terminal, or else `CI=1` and no width, as a script or CI has, and the call's `extra`, whose `PATH`
20
+ * replaces the host's. Throws a `TypeError` when `extra` sets any other variable the driver sets, or `VERCEL_TOKEN`.
21
+ *
22
+ * The width matters because the driver pipes a terminal's output and has no pseudo-terminal. `vercel`'s prompts are
23
+ * `@inquirer/*`, which wrap their text at `cli-width`'s answer, and with no TTY to ask, `cli-width` reads only
24
+ * `CLI_WIDTH`, else 80. `COLUMNS` is for any other library that asks.
25
+ */
26
+ export declare function invocationEnvironment(options: {
27
+ readonly host: Readonly<Record<string, string | undefined>>;
28
+ readonly home: string;
29
+ readonly terminal: boolean;
30
+ /** The terminal's width; ignored without a terminal. Default `TERMINAL_COLUMNS`. */
31
+ readonly columns?: number | undefined;
32
+ readonly extra?: Readonly<Record<string, string>> | undefined;
33
+ }): Readonly<Record<string, string>>;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * What every invocation sets, whatever storm's own environment holds. `VERCEL_TEST_KEYRING_UNAVAILABLE=1` keeps
3
+ * `vercel` away from the OS keyring: its default `file` credential storage still reads keyring entries when
4
+ * `auth.json` holds no login and deletes them after each `auth.json` write, and the variable makes each keyring call
5
+ * fail before it loads the keyring module, which `file` storage ignores.
6
+ */
7
+ const FIXED = {
8
+ NO_COLOR: "1",
9
+ NO_UPDATE_NOTIFIER: "1",
10
+ VERCEL_TELEMETRY_DISABLED: "1",
11
+ VERCEL_TEST_KEYRING_UNAVAILABLE: "1",
12
+ };
13
+ /** The variables passed on from storm's own environment, when set. */
14
+ const PASSED_ON = ["PATH", "SystemRoot", "TEMP"];
15
+ /** The variable passed on from `host` that a call's `env` may replace. */
16
+ const SETTABLE = "PATH";
17
+ /**
18
+ * The width an invocation at a terminal gets, as `CLI_WIDTH` and `COLUMNS`, unless the call names its own `columns`.
19
+ * `vercel`'s prompts wrap their text at that width, and 400 keeps a long prompt, such as one naming an id, on one line
20
+ * for `waitFor`.
21
+ */
22
+ export const TERMINAL_COLUMNS = 400;
23
+ /**
24
+ * The variables a call's `env` may not set, because the driver does. `PATH` is passed on but settable. No test may
25
+ * turn the keyring back on, so `VERCEL_TEST_KEYRING_UNAVAILABLE` is reserved with the other fixed variables.
26
+ * `CLI_WIDTH` and `COLUMNS` are a terminal's width, which a call sets with `columns`. `VERCEL_TOKEN` is never set, but
27
+ * the driver owns how an invocation authenticates: `vercel` reads it when there's no `--token`, so it would undo a
28
+ * saved login or a logged-out run.
29
+ */
30
+ export const RESERVED_VARIABLES = new Set([
31
+ ...Object.keys(FIXED),
32
+ ...PASSED_ON.filter((name) => name !== SETTABLE),
33
+ "HOME",
34
+ "CI",
35
+ "FORCE_TTY",
36
+ "CLI_WIDTH",
37
+ "COLUMNS",
38
+ "VERCEL_TOKEN",
39
+ ]);
40
+ /**
41
+ * An invocation's whole environment: `PATH`, `SystemRoot` and `TEMP` from `host` when set, `HOME`, the fixed
42
+ * variables (`NO_COLOR`, `NO_UPDATE_NOTIFIER`, `VERCEL_TELEMETRY_DISABLED`, `VERCEL_TEST_KEYRING_UNAVAILABLE`),
43
+ * `FORCE_TTY=1`, no `CI`, and `CLI_WIDTH` and `COLUMNS` set to `columns` (default `TERMINAL_COLUMNS`) for an
44
+ * invocation at a terminal, or else `CI=1` and no width, as a script or CI has, and the call's `extra`, whose `PATH`
45
+ * replaces the host's. Throws a `TypeError` when `extra` sets any other variable the driver sets, or `VERCEL_TOKEN`.
46
+ *
47
+ * The width matters because the driver pipes a terminal's output and has no pseudo-terminal. `vercel`'s prompts are
48
+ * `@inquirer/*`, which wrap their text at `cli-width`'s answer, and with no TTY to ask, `cli-width` reads only
49
+ * `CLI_WIDTH`, else 80. `COLUMNS` is for any other library that asks.
50
+ */
51
+ export function invocationEnvironment(options) {
52
+ const extra = options.extra ?? {};
53
+ const reserved = Object.keys(extra).filter((name) => RESERVED_VARIABLES.has(name));
54
+ if (reserved.length > 0) {
55
+ throw new TypeError(`vercel-cli: env may not set ${reserved.join(", ")}, which the driver owns`);
56
+ }
57
+ const env = {};
58
+ for (const name of PASSED_ON) {
59
+ const value = options.host[name];
60
+ if (value !== undefined)
61
+ env[name] = value;
62
+ }
63
+ const width = String(options.columns ?? TERMINAL_COLUMNS);
64
+ return {
65
+ ...env,
66
+ HOME: options.home,
67
+ ...FIXED,
68
+ // `vercel` never prompts for a charge (`domains buy`, `domains renew`) under `CI`, so a terminal has none.
69
+ ...(options.terminal ? { FORCE_TTY: "1", CLI_WIDTH: width, COLUMNS: width } : { CI: "1" }),
70
+ ...extra,
71
+ };
72
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A `vercel` invocation that didn't give the test what it asked for: it couldn't start, `json` got no JSON its
3
+ * schema accepts, `waitFor` never saw its pattern, or a key was sent after `vercel` exited. The message holds only
4
+ * redacted output.
5
+ */
6
+ export declare class VercelCliError extends Error {
7
+ readonly name = "VercelCliError";
8
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A `vercel` invocation that didn't give the test what it asked for: it couldn't start, `json` got no JSON its
3
+ * schema accepts, `waitFor` never saw its pattern, or a key was sent after `vercel` exited. The message holds only
4
+ * redacted output.
5
+ */
6
+ export class VercelCliError extends Error {
7
+ name = "VercelCliError";
8
+ }
@@ -0,0 +1,103 @@
1
+ /** Which of a process's output streams a chunk came from. */
2
+ export type OutputStream = "stdout" | "stderr";
3
+ /** One `vercel` process to start. */
4
+ export interface InvocationRequest {
5
+ /** The executable, such as `vercel` (found on `env.PATH`) or `node`. */
6
+ readonly file: string;
7
+ /** Every argument after `file`, as given: no shell. */
8
+ readonly args: readonly string[];
9
+ /** The process's whole environment; nothing else is inherited. */
10
+ readonly env: Readonly<Record<string, string>>;
11
+ readonly cwd: string;
12
+ /** `ignore` closes stdin; `pipe` keeps it open for `write`, until `closeStdin`. stdout and stderr are pipes. */
13
+ readonly stdin: "ignore" | "pipe";
14
+ /** Gets each chunk of output as it arrives, decoded as UTF-8, before the process's `exited` resolves. */
15
+ readonly onOutput: (stream: OutputStream, text: string) => void;
16
+ }
17
+ /**
18
+ * How a started process ended: its exit code, or the signal that ended it, and whether all its output arrived. Output
19
+ * is incomplete only after a hard termination whose bounded drain ran out while a descendant still held a pipe.
20
+ */
21
+ export interface ProcessExit {
22
+ readonly exitCode: number | null;
23
+ readonly signal: string | null;
24
+ readonly outputComplete: boolean;
25
+ }
26
+ /** A graceful signal the driver sends the process itself. */
27
+ export type ProcessSignal = "SIGINT" | "SIGTERM";
28
+ /** A started `vercel` process. */
29
+ export interface VercelProcess {
30
+ /**
31
+ * Resolves once the process has exited and all its output has been delivered, or once a hard termination's bounded
32
+ * drain ran out after the process exited. Never rejects.
33
+ */
34
+ readonly exited: Promise<ProcessExit>;
35
+ /** Writes to stdin. Does nothing once stdin is closed or the process has exited. */
36
+ write(text: string): void;
37
+ /** Closes stdin. Calling it again does nothing. */
38
+ closeStdin(): void;
39
+ /** Sends a graceful `signal` to the process itself, not its descendants. Does nothing once it has exited. */
40
+ signal(signal: ProcessSignal): void;
41
+ /**
42
+ * Hard-terminates the process tree, best effort, then waits a bounded time for output pipes to close. Calling it
43
+ * again does nothing. Does nothing once completion has been reported.
44
+ */
45
+ terminate(): void;
46
+ }
47
+ /** Why a process couldn't start: its executable wasn't found (or its `cwd` doesn't exist), or another error. */
48
+ export interface StartError {
49
+ readonly code: "missing" | "spawn-failed";
50
+ readonly message: string;
51
+ }
52
+ export type StartResult = {
53
+ readonly ok: true;
54
+ readonly process: VercelProcess;
55
+ } | {
56
+ readonly ok: false;
57
+ readonly error: StartError;
58
+ };
59
+ export type PrepareResult = {
60
+ readonly ok: true;
61
+ } | {
62
+ readonly ok: false;
63
+ readonly error: {
64
+ readonly message: string;
65
+ };
66
+ };
67
+ /** What `auth.json` in a global-config directory holds: its text, nothing, or why it couldn't be read. */
68
+ export type AuthFileReadResult = {
69
+ readonly type: "found";
70
+ readonly text: string;
71
+ } | {
72
+ readonly type: "missing";
73
+ } | {
74
+ readonly type: "error";
75
+ readonly error: {
76
+ readonly message: string;
77
+ };
78
+ };
79
+ export type AuthFileWriteResult = {
80
+ readonly ok: true;
81
+ } | {
82
+ readonly ok: false;
83
+ readonly error: {
84
+ readonly message: string;
85
+ };
86
+ };
87
+ /**
88
+ * Starts `vercel` processes, prepares the directories one test's invocations share, and reads and writes the CLI's
89
+ * `auth.json` in their global-config directory.
90
+ */
91
+ export interface VercelCliProcessGateway {
92
+ /** Creates each of `directories`, and any missing parents; one that already exists is fine. */
93
+ prepareDirectories(directories: readonly string[]): Promise<PrepareResult>;
94
+ /** Reads `auth.json` in `globalConfigDir`. Never rejects. */
95
+ readAuthFile(globalConfigDir: string): Promise<AuthFileReadResult>;
96
+ /**
97
+ * Replaces `auth.json` in `globalConfigDir`, an existing directory, with `text` at once: a reader sees the old text
98
+ * or the new, never part of it. Never rejects.
99
+ */
100
+ writeAuthFile(globalConfigDir: string, text: string): Promise<AuthFileWriteResult>;
101
+ /** Starts a process, and resolves once it has started or failed to. Never rejects. */
102
+ start(request: InvocationRequest): Promise<StartResult>;
103
+ }
@@ -0,0 +1,4 @@
1
+ // The Vercel CLI driver's gateway: starting `vercel` processes, preparing the directories a test's invocations
2
+ // share, and reading and writing the `auth.json` a saved login or a logged-out run needs. The live gateway is `live/process-gateway.ts`; the fake is
3
+ // `test/fakes/vercel-cli/process-gateway.ts`.
4
+ export {};
@@ -0,0 +1,10 @@
1
+ export type { VercelAuth } from "./auth-config.ts";
2
+ export type { AuthConfig, GlobalConfig } from "./config-files.ts";
3
+ export { type InteractBlock, type InteractiveInvocation, type TerminalInvocation, type VercelCallOptions, type VercelCli, type VercelCliOptions, type VercelIdentity, VERCEL_TIMEOUT_MS, type VercelRunOptions, type VercelStdin, } from "./driver.ts";
4
+ export { vercelCli } from "./entry.ts";
5
+ export { TERMINAL_COLUMNS } from "./environment.ts";
6
+ export { VercelCliError } from "./errors.ts";
7
+ export { type InvocationEnd, type NotStartedReason, REQUEST_SETTLE_MS, REQUEST_SETTLE_POLL_MS, STOP_GRACE_MS, type VercelInvocation, type VercelInvocationStdin, type VercelResult, type VercelStopSignal, WAIT_FOR_TIMEOUT_MS, } from "./invocation.ts";
8
+ export type { VercelKey } from "./keys.ts";
9
+ export { readAuthConfig, readGlobalConfig, writeAuthConfig, writeGlobalConfig } from "./live/config-files.ts";
10
+ export { describeInvocation, describeInvocations, OUTPUT_REPORT_CHARS, STDIN_REPORT_CHARS } from "./report.ts";
@@ -0,0 +1,15 @@
1
+ // storm's Vercel CLI driver, exported as `@cnc-tools/storm/vercel-cli`: runs the production `vercel` CLI
2
+ // against a test's proxy, as a default identity or the token a call names, with `--token`, a saved login or logged
3
+ // out, in directories the test's invocations share, and reports each invocation with tokens redacted. It builds on
4
+ // the SDK only through `src/sdk/index.ts`, imports neither the Vitest adapter nor vitest, and depends otherwise only
5
+ // on Node builtins and `zod`; nothing in
6
+ // `src/sdk/` or `src/vitest/` imports it, and `.oxlintrc.json` checks the boundary. Its gateway seams (the process
7
+ // gateway, live gateway, clock, Context and `createVercelCli`) are in `./context.ts`, outside this published
8
+ // surface.
9
+ export { VERCEL_TIMEOUT_MS, } from "./driver.js";
10
+ export { vercelCli } from "./entry.js";
11
+ export { TERMINAL_COLUMNS } from "./environment.js";
12
+ export { VercelCliError } from "./errors.js";
13
+ export { REQUEST_SETTLE_MS, REQUEST_SETTLE_POLL_MS, STOP_GRACE_MS, WAIT_FOR_TIMEOUT_MS, } from "./invocation.js";
14
+ export { readAuthConfig, readGlobalConfig, writeAuthConfig, writeGlobalConfig } from "./live/config-files.js";
15
+ export { describeInvocation, describeInvocations, OUTPUT_REPORT_CHARS, STDIN_REPORT_CHARS } from "./report.js";