@cnc-tools/storm 0.0.0 → 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 +119 -3
  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,306 @@
1
+ import { describeFailure, FEATURE_FLAG_CLIENTS, REDACTED, redactTokenFields, } from "../sdk/index.js";
2
+ /** The most characters of one body, input, response or container log line a failure report prints. */
3
+ export const BODY_REPORT_CHARS = 1000;
4
+ /** The most container log records a failure report prints, the last ones. */
5
+ export const LOG_REPORT_RECORDS = 50;
6
+ /**
7
+ * One request record as a line: its method, URL as sent, result, whether it carried `authorization`, duration and
8
+ * any session id, such as `GET /v2/user → 200, authorization sent, 412ms, session 7f3a`. A proxy record whose
9
+ * exchange was still open reads `open`, its duration counted to the read. A proxy record of a request a fault rule
10
+ * matched tags its result with the action and what Testserver answered, such as `500 (fault: replace, Testserver
11
+ * 200)`.
12
+ */
13
+ export function describeRequest(request) {
14
+ const result = "open" in request
15
+ ? "open"
16
+ : !("status" in request)
17
+ ? `failed (${request.error})`
18
+ : request.error === undefined
19
+ ? `${request.status}`
20
+ : `${request.status}, then failed (${request.error})`;
21
+ const authorization = request.authorization ? "authorization sent" : "no authorization";
22
+ const session = !("sessionId" in request) || request.sessionId === undefined ? "" : `, session ${request.sessionId}`;
23
+ const fault = "fault" in request && request.fault !== undefined ? ` ${faultTag(request.fault)}` : "";
24
+ return `${request.method} ${request.url} → ${result}${fault}, ${authorization}, ${Math.round(request.durationMs)}ms${session}`;
25
+ }
26
+ /** A fault's tag, such as `(fault: respond)` or `(fault: reset, Testserver 201)`. */
27
+ function faultTag(fault) {
28
+ return `(fault: ${fault.action}${fault.upstream === undefined ? "" : `, ${describeUpstream(fault.upstream)}`})`;
29
+ }
30
+ /** What Testserver answered under a forwarding fault, such as `Testserver 200` or `Testserver failed: …`. */
31
+ function describeUpstream(upstream) {
32
+ if (!("status" in upstream))
33
+ return `Testserver failed: ${upstream.error}`;
34
+ if (upstream.error === undefined)
35
+ return `Testserver ${upstream.status}`;
36
+ return `Testserver ${upstream.status}, then failed: ${upstream.error}`;
37
+ }
38
+ /**
39
+ * A recorded body on one line, cut at `BODY_REPORT_CHARS`: JSON compact, a form as its encoded fields, text
40
+ * quoted, and an omitted body as its note, such as `[binary, 5 bytes, image/png]`.
41
+ */
42
+ export function describeBody(body, redact) {
43
+ return cut(redact(bodyText(body)), BODY_REPORT_CHARS);
44
+ }
45
+ function bodyText(body) {
46
+ switch (body.kind) {
47
+ case "json":
48
+ return JSON.stringify(body.value) ?? "undefined";
49
+ case "form": {
50
+ const params = new URLSearchParams();
51
+ for (const [key, value] of Object.entries(body.fields)) {
52
+ for (const each of typeof value === "string" ? [value] : value)
53
+ params.append(key, each);
54
+ }
55
+ // `<token>` reads better unescaped.
56
+ return params.toString().replaceAll("%3Ctoken%3E", REDACTED);
57
+ }
58
+ case "text":
59
+ return JSON.stringify(body.text);
60
+ case "omitted":
61
+ return `[${body.reason}, ${body.bytes} bytes${body.contentType === undefined ? "" : `, ${body.contentType}`}]`;
62
+ }
63
+ }
64
+ function cut(text, max) {
65
+ return text.length <= max ? text : `${text.slice(0, max)} … (${text.length - max} more characters)`;
66
+ }
67
+ /**
68
+ * One request record as its line, then a line for each body it has: what the client sent and got, and what
69
+ * Testserver answered under a forwarding fault.
70
+ */
71
+ function describeExchange(request, redact) {
72
+ const upstreamBody = "fault" in request ? request.fault?.upstream?.responseBody : undefined;
73
+ return [
74
+ redact(describeRequest(request)),
75
+ ...(request.requestBody === undefined ? [] : [` request body: ${describeBody(request.requestBody, redact)}`]),
76
+ ...(request.responseBody === undefined ? [] : [` response body: ${describeBody(request.responseBody, redact)}`]),
77
+ ...(upstreamBody === undefined ? [] : [` Testserver response body: ${describeBody(upstreamBody, redact)}`]),
78
+ ];
79
+ }
80
+ /**
81
+ * `value` as compact JSON on one line, as it was sent or received, every token field reading `<token>`, then
82
+ * `redact`ed and cut.
83
+ */
84
+ function describeJson(value, redact) {
85
+ const json = JSON.stringify(value);
86
+ const text = json === undefined ? "undefined" : JSON.stringify(redactTokenFields(JSON.parse(json)));
87
+ return cut(redact(text), BODY_REPORT_CHARS);
88
+ }
89
+ /**
90
+ * One factory call as its line, such as `factory users → ok, 182ms`, then its input, its options when it had any,
91
+ * and its response when it succeeded, each on one line with every token field reading `<token>`.
92
+ */
93
+ export function describeFactoryCall(call, redact) {
94
+ const result = call.outcome.ok ? "ok" : `failed (${describeFailure(call.outcome.failure)})`;
95
+ return [
96
+ redact(`factory ${call.path} → ${result}, ${Math.round(call.durationMs)}ms`),
97
+ ` input: ${describeJson(call.input, redact)}`,
98
+ ...(call.options === undefined ? [] : [` options: ${describeJson(call.options, redact)}`]),
99
+ ...(call.outcome.ok ? [` response: ${describeJson(call.outcome.response, redact)}`] : []),
100
+ ];
101
+ }
102
+ /**
103
+ * A container's activity: its factory calls and API requests merged in the order they started, each with the
104
+ * lines beneath it, or `no container activity`.
105
+ */
106
+ export function describeActivity(factoryCalls, apiRequests, redact) {
107
+ const entries = [
108
+ ...factoryCalls.map((call) => ({ startedAt: call.startedAt, lines: () => describeFactoryCall(call, redact) })),
109
+ ...apiRequests.map((request) => ({ startedAt: request.startedAt, lines: () => describeExchange(request, redact) })),
110
+ ];
111
+ if (entries.length === 0)
112
+ return "no container activity";
113
+ // A stable sort keeps factory calls before API requests that started at the same reading.
114
+ entries.sort((a, b) => a.startedAt - b.startedAt);
115
+ return ["container activity:", ...entries.flatMap((entry) => entry.lines()).map((line) => ` ${line}`)].join("\n");
116
+ }
117
+ /**
118
+ * One container log record as a line: its timestamp, service, protocol, message and status code, any missing or
119
+ * empty one left out, cut at `BODY_REPORT_CHARS`, then its stack's lines indented beneath it.
120
+ */
121
+ export function describeLogRecord(record, redact) {
122
+ const fields = [record.timestamp, record.serviceId, record["protocol"], record.message, record["statusCode"]];
123
+ const line = fields
124
+ .flatMap((field) => (typeof field === "string" || typeof field === "number" ? [String(field)] : []))
125
+ .filter((field) => field !== "")
126
+ .join(" ");
127
+ const stack = record["stack"];
128
+ const stackLines = typeof stack === "string" && stack !== "" ? stack.split("\n") : [];
129
+ return [
130
+ cut(redact(line), BODY_REPORT_CHARS),
131
+ ...stackLines.map((each) => ` ${cut(redact(each.trim()), BODY_REPORT_CHARS)}`),
132
+ ];
133
+ }
134
+ /** The container log section of a failure report. */
135
+ export function describeLog(log, redact) {
136
+ if (log.kind === "unreadable")
137
+ return `container log: couldn't read it: ${redact(log.message)}`;
138
+ if (log.kind === "unread")
139
+ return "container log: not read before the container ended";
140
+ const count = log.records.length;
141
+ const records = `${count} ${count === 1 ? "record" : "records"}`;
142
+ let header = `container log, ${records}`;
143
+ if (log.origin === "test")
144
+ header += " from this test";
145
+ if (log.origin === "uncertain")
146
+ header += `, which may include earlier tests' (${redact(log.reason)})`;
147
+ if (count === 0)
148
+ return header;
149
+ const shown = log.records.slice(-LOG_REPORT_RECORDS);
150
+ const earlier = count - shown.length;
151
+ return [
152
+ `${header}:`,
153
+ ...(earlier === 0 ? [] : [` (${earlier} earlier ${earlier === 1 ? "record" : "records"} not shown)`]),
154
+ ...shown.flatMap((record) => describeLogRecord(record, redact)).map((line) => ` ${line}`),
155
+ ].join("\n");
156
+ }
157
+ /** Where a container's container output is: the Testserver process's own output for the test id, as text. */
158
+ export function containerOutputUrl(testserverUrl, testId) {
159
+ return `${testserverUrl.replace(/\/+$/, "")}/raw?testId=${encodeURIComponent(testId)}`;
160
+ }
161
+ /**
162
+ * What a failed test prints about its container: its test id and Testserver URL, its feature flags when it has
163
+ * any, a line for each warmup, its container activity, its container log, and its container output's URL.
164
+ */
165
+ export function containerFailureReport(report) {
166
+ const flags = describeFeatureFlags(report.featureFlags);
167
+ return [
168
+ `storm: test id ${report.testId} on ${report.testserverUrl}`,
169
+ ...(flags === undefined ? [] : [cut(report.redact(`feature flags: ${flags}`), BODY_REPORT_CHARS)]),
170
+ ...report.warmups.map((warmup) => describeWarmup(warmup, report.redact)),
171
+ describeActivity(report.factoryCalls, report.apiRequests, report.redact),
172
+ describeLog(report.log, report.redact),
173
+ `container output: ${containerOutputUrl(report.testserverUrl, report.testId)}`,
174
+ ].join("\n");
175
+ }
176
+ /**
177
+ * Feature flags on one line, each client's flags as `name=value`, the value as JSON, clients apart by `; `, such as
178
+ * `all: env-var-config-secret-ui=true; team: x="y"`; `undefined` for none.
179
+ */
180
+ export function describeFeatureFlags(flags) {
181
+ const clients = FEATURE_FLAG_CLIENTS.flatMap((client) => {
182
+ const entries = Object.entries(flags[client] ?? {});
183
+ if (entries.length === 0)
184
+ return [];
185
+ return [`${client}: ${entries.map(([name, value]) => `${name}=${JSON.stringify(value)}`).join(", ")}`];
186
+ });
187
+ return clients.length === 0 ? undefined : clients.join("; ");
188
+ }
189
+ /** How many flags `flags` sets, over every client. */
190
+ function countFeatureFlags(flags) {
191
+ return FEATURE_FLAG_CLIENTS.reduce((count, client) => count + Object.keys(flags[client] ?? {}).length, 0);
192
+ }
193
+ /**
194
+ * What a failed test prints about the container its file's tests share: `containerFailureReport` over only the
195
+ * factory calls and API requests the test made, those after the counts in `before`, and a line saying the
196
+ * container is shared, how many of each earlier tests made, and whether ending it after this failure succeeded.
197
+ */
198
+ export function sharedContainerFailureReport(container, before, log, ending) {
199
+ const own = containerFailureReport({
200
+ ...container,
201
+ factoryCalls: container.factoryCalls.slice(before.factoryCalls),
202
+ apiRequests: container.apiRequests.slice(before.apiRequests),
203
+ log,
204
+ });
205
+ const counts = [
206
+ ...(before.factoryCalls === 0
207
+ ? []
208
+ : [`${before.factoryCalls} factory ${before.factoryCalls === 1 ? "call" : "calls"}`]),
209
+ ...(before.apiRequests === 0
210
+ ? []
211
+ : [`${before.apiRequests} API ${before.apiRequests === 1 ? "request" : "requests"}`]),
212
+ ];
213
+ const earlier = counts.length === 0 ? "" : `, after ${counts.join(" and ")} by earlier tests`;
214
+ const end = ending.kind === "ended"
215
+ ? "ended after this failure"
216
+ : `ending it after this failure failed: ${container.redact(ending.message)}`;
217
+ return `${own}\n(container shared by this file's tests${earlier}; ${end})`;
218
+ }
219
+ /**
220
+ * What a verbose run prints as the proxy records a request: the request line with its bodies, as a failure report
221
+ * would show it, naming the test id.
222
+ */
223
+ export function proxyRequestReport(testId, request, redact) {
224
+ return [`storm: the proxy for test id ${testId} received:`, ...describeExchange(request, redact)].join("\n ");
225
+ }
226
+ /**
227
+ * One warmup as a failure report's line: how many services, how long, and each that failed with why, such as
228
+ * `warmup: 3 services in 2140ms, 1 failed (api-projects: HTTP 500: …)`.
229
+ */
230
+ export function describeWarmup(warmup, redact) {
231
+ const failed = warmup.services.flatMap((service) => (service.ok ? [] : [`${service.serviceId}: ${service.error}`]));
232
+ const failures = failed.length === 0 ? "" : `, ${failed.length} failed (${failed.join("; ")})`;
233
+ return cut(redact(`warmup: ${services(warmup.services.length)} in ${Math.round(warmup.ms)}ms${failures}`), BODY_REPORT_CHARS);
234
+ }
235
+ /**
236
+ * What a verbose run prints once a container has started: what it is for, whether it replaced the file's container
237
+ * because the feature flags differ, how long it took, how many feature flags it has, any warmup after it with the
238
+ * services that failed, and its test id, such as `storm: started a container for the file a.test.ts in 812ms, 1
239
+ * feature flag, warmed 3 services in 2140ms (1 failed: api-projects), test id ts-…`.
240
+ */
241
+ export function containerStartReport(start) {
242
+ const what = start.scope === "file" ? `the file ${start.name}` : `the test ${JSON.stringify(start.name)}`;
243
+ const replacing = start.replaced === true ? ", replacing the file's container (feature flags differ)," : "";
244
+ const count = countFeatureFlags(start.featureFlags ?? {});
245
+ const flags = count === 0 ? "" : `, ${count} feature ${count === 1 ? "flag" : "flags"}`;
246
+ const warmed = start.warmup === undefined ? "" : `, ${describeWarmed(start.warmup.warmup, start.warmup.ms)}`;
247
+ return `storm: started a container for ${what}${replacing} in ${Math.round(start.ms)}ms${flags}${warmed}, test id ${start.testId}`;
248
+ }
249
+ /** `warmed 3 services in 2140ms`, with `(1 failed: api-projects)` when any failed. */
250
+ function describeWarmed(warmup, ms) {
251
+ const failed = warmup.services.flatMap((service) => (service.ok ? [] : [service.serviceId]));
252
+ const failures = failed.length === 0 ? "" : ` (${failed.length} failed: ${failed.join(", ")})`;
253
+ return `warmed ${services(warmup.services.length)} in ${Math.round(ms)}ms${failures}`;
254
+ }
255
+ function services(count) {
256
+ return `${count} ${count === 1 ? "service" : "services"}`;
257
+ }
258
+ /**
259
+ * What a failed test prints about its proxy: each request it received, with its bodies beneath it, then each fault
260
+ * rule with hits left (its method, path template, action, and hits of its times), every line through `redact` (the
261
+ * container's, so a secret the proxy's own redaction can't know of, such as another seeded token, reads `<token>`
262
+ * too).
263
+ */
264
+ export function proxyFailureReport(testId, requests, redact, faults = []) {
265
+ const received = requests.length === 0
266
+ ? [`storm: the proxy for test id ${testId} received no requests`]
267
+ : [
268
+ `storm: requests the proxy received for test id ${testId}:`,
269
+ ...requests.flatMap((request) => describeExchange(request, redact)).map((line) => ` ${line}`),
270
+ ];
271
+ const unused = faults.filter((handle) => handle.remaining > 0);
272
+ const rules = unused.length === 0
273
+ ? []
274
+ : [
275
+ `storm: fault rules with hits left on the proxy for test id ${testId}:`,
276
+ ...unused.map((handle) => ` ${redact(describeFaultRule(handle))}`),
277
+ ];
278
+ return [...received, ...rules].join("\n");
279
+ }
280
+ /** A fault rule as a line, such as `POST /v1/buy/:id → reset (after-answer), 0 of 2 hits`. */
281
+ function describeFaultRule({ rule, hits, remaining }) {
282
+ const action = rule.action === "reset" ? `reset (${rule.when})` : `${rule.action} ${rule.response.status}`;
283
+ const times = hits + remaining;
284
+ return `${rule.method.toUpperCase()} ${rule.path} → ${action}, ${hits} of ${times} ${times === 1 ? "hit" : "hits"}`;
285
+ }
286
+ /**
287
+ * Why a test fails when its proxy forwarded a request under a fault rule and Testserver failed, with no answer or
288
+ * one that stopped before its end, naming each such request, through `redact`; `undefined` when none did. A status
289
+ * Testserver answered is never a failure.
290
+ */
291
+ export function faultUpstreamFailure(requests, redact) {
292
+ const failed = requests.flatMap((request) => {
293
+ const error = request.fault?.upstream?.error;
294
+ return error === undefined ? [] : [{ request: `${request.method} ${request.url}`, error }];
295
+ });
296
+ const [only] = failed;
297
+ if (only === undefined)
298
+ return undefined;
299
+ if (failed.length === 1) {
300
+ return redact(`storm: a fault rule forwarded ${only.request}, and Testserver failed: ${only.error}`);
301
+ }
302
+ return redact([
303
+ `storm: fault rules forwarded ${failed.length} requests, and Testserver failed for each:`,
304
+ ...failed.map((each) => ` ${each.request}: ${each.error}`),
305
+ ].join("\n"));
306
+ }
@@ -0,0 +1,64 @@
1
+ import type { StormTest } from "./types.ts";
2
+ declare module "vitest" {
3
+ interface TaskMeta {
4
+ /**
5
+ * What the storm Vitest adapter recorded for the test: the Testserver URL its container is on, and the
6
+ * container's test id once the test was handed it (missing if its start failed or the test aborted first).
7
+ */
8
+ storm?: {
9
+ testserverUrl: string;
10
+ testId?: string;
11
+ };
12
+ }
13
+ }
14
+ /**
15
+ * vitest's `test` with storm's fixtures. Each is set up only when a test (or another fixture) asks for it, and
16
+ * torn down after the test (or file, or worker), in reverse order:
17
+ *
18
+ * Every test, whatever it asks for, appends test events to the run payload's `testEvents` file when it names one:
19
+ * the file's start and finish, each attempt at a test, its start and how it ended, and each container start and how
20
+ * long it took. A retried test reports each attempt; its final result comes from `stormReporter`
21
+ * (`@cnc-tools/storm/vitest/config`), in vitest's main process. `stormEvents`, `stormFileEvents` and
22
+ * `stormTestEvents` are the adapter's own, which tests don't use.
23
+ *
24
+ * - `verbose` (per worker): whether the run is verbose, under `storm run --verbose`, from the run payload. Then
25
+ * `container` prints each container start and `proxy` each request as it is recorded, for passing tests too, and
26
+ * a test's own fixture can print what it does, as the Vercel CLI driver's invocations.
27
+ * - `testserverUrl` (per worker): this worker's Testserver sandbox, `sandboxes[(VITEST_POOL_ID - 1) % N]` from the
28
+ * run payload's `resources.testserverPool`. Outside `storm run`, or with a `VITEST_POOL_ID` that isn't a
29
+ * positive integer, it throws, so the test fails rather than skips.
30
+ * - `stormFile` (per file): the adapter's own state for the file, which tests don't use: its `container`, the
31
+ * holder of the file's container, and its `acquisitions`, the container and proxy starts still in flight. Creating
32
+ * it starts nothing. When the file finishes, it ends the file's container once any start in flight settles, and
33
+ * waits for every other start, so the file's worker can't exit while one is still starting.
34
+ * - `containerScope`: how long `container` lives, `'file'` (`CONTAINER_SCOPE`, the default) or `'test'`. A file or
35
+ * `describe` sets it with `test.override({ containerScope: "test" })`.
36
+ * - `warmServices`: the Testserver services to warm in each new container before a test gets it, by default none.
37
+ * A suite sets it on its own `test` with `.override("warmServices", [...])`, a file or `describe` with
38
+ * `test.override({ warmServices: [...] })`. In `'file'` scope the list is that of the test that starts the
39
+ * container. A service that fails to warm is reported, and starts on first use as before.
40
+ * - `featureFlags`: the feature flags each new container's services read, by flag client, by default `{}`, none,
41
+ * set before any service starts. A suite sets it on its own `test` with `.override("featureFlags", {...})`, a file
42
+ * or `describe` with `test.override({ featureFlags })`; a value replaces the whole object. In `'file'` scope, a
43
+ * test whose feature flags differ from those of the file's container ends it and starts a new one.
44
+ * - `container`: in `'file'` scope, the file's container, labeled with the file's path, started by the file's first
45
+ * test that asks for it and ended after a failed test that used it, so the next test that asks starts a new one.
46
+ * A concurrent test fails instead. In `'test'` scope, a container started for the test, labeled with the test's
47
+ * name, and ended after it. The test's `task.meta.storm` records the Testserver URL and, once the test has the
48
+ * container, its test id.
49
+ * - `seed`: a `Seeder` over `container`, per test.
50
+ * - `proxy`: a proxy adding `container`'s test id, per test, closed after it. Once closed, its cleanup fails the
51
+ * test when a fault rule forwarded a request and Testserver failed (`fault.upstream.error`); a rule with hits
52
+ * left doesn't.
53
+ *
54
+ * A container or proxy that finishes starting after the test was aborted or timed out never reaches the test. A
55
+ * test's own container or proxy is ended or closed at once; the file's container stays the file's. If a late start
56
+ * or an end at the file's finish fails, the file fails with the error.
57
+ *
58
+ * Outside a verbose run, a passing test prints nothing. When a test fails, `container` prints its test id, its container activity (factory
59
+ * calls and API requests in the order they started), its container log, read before the container ends, and its
60
+ * container output's URL, in `'file'` scope only the test's own, with a line about the shared container. `proxy`
61
+ * prints the requests it received, each a fault rule matched tagged with the fault, then each fault rule with hits
62
+ * left. Tokens are redacted throughout.
63
+ */
64
+ export declare const test: StormTest;
@@ -0,0 +1,172 @@
1
+ import { test as vitestTest } from "vitest";
2
+ import { featureFlagsKey, readRunPayload, seeder, startContainer, startProxy, } from "../sdk/index.js";
3
+ import { CONTAINER_SCOPE, closeFile, FileContainer, provideContainer, warmNewContainer } from "./container-scope.js";
4
+ import { containerStartReport, faultUpstreamFailure, proxyFailureReport, proxyRequestReport } from "./diagnostics.js";
5
+ import { acquireOwned, Acquisitions } from "./ownership.js";
6
+ import { sandboxForWorker } from "./sandbox.js";
7
+ import { countTests, reportedStart, testEventReporter, testEventState } from "./test-events.js";
8
+ /**
9
+ * The Testserver URL of this worker's Testserver sandbox, `sandboxes[(VITEST_POOL_ID - 1) % N]` of the run
10
+ * payload's `resources.testserverPool`. Throws outside `storm run`, and outside a vitest worker.
11
+ */
12
+ function workerTestserverUrl() {
13
+ return sandboxForWorker(readRunPayload(), process.env["VITEST_POOL_ID"]);
14
+ }
15
+ /** The default `warmServices`: no service is warmed. */
16
+ const NO_SERVICES = [];
17
+ /** The default `featureFlags`: none. */
18
+ const NO_FEATURE_FLAGS = {};
19
+ // The fixture chain, as vitest types it; published as `test` below, under its named type.
20
+ const fixtures = vitestTest
21
+ .extend("testserverUrl", { scope: "worker" }, () => workerTestserverUrl())
22
+ .extend("verbose", { scope: "worker" }, () => readRunPayload().verbose === true)
23
+ .extend("stormEvents", { scope: "worker" }, () => testEventReporter())
24
+ .extend("stormFileEvents", { scope: "file" }, ({ stormEvents }, { onCleanup }) => {
25
+ // A file fixture can't see the file, so the file's first test names it.
26
+ const file = { name: undefined };
27
+ onCleanup(() => {
28
+ if (file.name !== undefined)
29
+ stormEvents({ kind: "file-finished", file: file.name });
30
+ });
31
+ return file;
32
+ })
33
+ .extend("stormTestEvents", { auto: true }, ({ stormEvents, stormFileEvents, task, onTestFinished }) => {
34
+ const file = task.file.name;
35
+ if (stormFileEvents.name === undefined) {
36
+ stormFileEvents.name = file;
37
+ stormEvents({ kind: "file-started", file });
38
+ }
39
+ stormEvents({ kind: "test-started", file, test: task.name, fileTests: countTests(task.file) });
40
+ // Vitest sets a test's duration only after its `onTestFinished` handlers, so the test is timed here, from before
41
+ // its other fixtures, a container's start among them.
42
+ const startedAt = Date.now();
43
+ onTestFinished(({ task: finished }) => {
44
+ stormEvents({
45
+ kind: "test-attempt-finished",
46
+ file,
47
+ test: task.name,
48
+ state: testEventState(finished.result?.state),
49
+ ms: Date.now() - startedAt,
50
+ });
51
+ });
52
+ })
53
+ // oxlint-disable-next-line no-empty-pattern -- vitest requires a fixture to destructure its first argument
54
+ .extend("stormFile", { scope: "file" }, ({}, { onCleanup }) => {
55
+ const file = { container: new FileContainer(), acquisitions: new Acquisitions() };
56
+ onCleanup(() => closeFile(file.container, file.acquisitions));
57
+ return file;
58
+ })
59
+ .extend("containerScope", CONTAINER_SCOPE)
60
+ .extend("warmServices", NO_SERVICES)
61
+ .extend("featureFlags", NO_FEATURE_FLAGS)
62
+ .extend("container", async ({ containerScope, warmServices, featureFlags, stormFile, stormEvents, testserverUrl, verbose, task, signal, onTestFailed, }, { onCleanup }) => {
63
+ // Starts a container labeled `name` with `featureFlags`, then warms `warmServices`, both the start's test's, in
64
+ // it, reporting both as one container start. Under a verbose run, each container start prints as it ends, for
65
+ // passing tests too, saying when it replaced the file's container because the feature flags differ.
66
+ const startWarmed = async (scope, name, replacing = false) => {
67
+ const warm = warmServices.length === 0 ? undefined : (started) => warmNewContainer(started, warmServices);
68
+ const started = await reportedStart(stormEvents, task.file.name, () => startContainer({ testserverUrl, name, featureFlags }), warm);
69
+ if (verbose) {
70
+ console.error(containerStartReport({
71
+ name,
72
+ scope,
73
+ ms: started.startMs,
74
+ testId: started.value.testId,
75
+ featureFlags: started.value.featureFlags,
76
+ ...(replacing ? { replaced: true } : {}),
77
+ ...(started.warmup === undefined ? {} : { warmup: started.warmup }),
78
+ }));
79
+ }
80
+ return started.value;
81
+ };
82
+ task.meta.storm = { testserverUrl };
83
+ const container = await stormFile.acquisitions.track(signal, provideContainer({
84
+ scope: containerScope,
85
+ fileContainer: stormFile.container,
86
+ signal,
87
+ onCleanup,
88
+ onTestFailed,
89
+ isConcurrent: task.concurrent === true,
90
+ failed: () => task.result?.state === "fail",
91
+ featureFlagsKey: featureFlagsKey(featureFlags),
92
+ startShared: (replacing) => startWarmed("file", task.file.name, replacing),
93
+ startOwn: () => startWarmed("test", task.name),
94
+ report: (text) => console.error(text),
95
+ }));
96
+ task.meta.storm = { testserverUrl, testId: container.testId };
97
+ return container;
98
+ })
99
+ .extend("seed", ({ container }) => seeder(container))
100
+ .extend("proxy", async ({ container, stormFile, verbose, signal, onTestFailed }, { onCleanup }) => {
101
+ // Under a verbose run, each request prints as the proxy records it, for passing tests too.
102
+ const onRequest = verbose
103
+ ? (record) => console.error(proxyRequestReport(container.testId, record, (text) => container.redact(text)))
104
+ : undefined;
105
+ const proxy = await stormFile.acquisitions.track(signal, acquireOwned(signal, onCleanup, () => startProxy({ container, ...(onRequest === undefined ? {} : { onRequest }) }),
106
+ // Checked once closed, when every record has ended: a test whose fault rule forwarded a request Testserver
107
+ // failed fails, since its premise, what Testserver answered, never held.
108
+ async (owned) => {
109
+ await owned.close();
110
+ const failure = faultUpstreamFailure(owned.requests, (text) => owned.redact(text));
111
+ if (failure !== undefined)
112
+ throw new Error(failure);
113
+ }));
114
+ onTestFailed(() => {
115
+ console.error(proxyFailureReport(container.testId, proxy.requests, (text) => proxy.redact(text), proxy.faults));
116
+ });
117
+ return proxy;
118
+ });
119
+ /**
120
+ * vitest's `test` with storm's fixtures. Each is set up only when a test (or another fixture) asks for it, and
121
+ * torn down after the test (or file, or worker), in reverse order:
122
+ *
123
+ * Every test, whatever it asks for, appends test events to the run payload's `testEvents` file when it names one:
124
+ * the file's start and finish, each attempt at a test, its start and how it ended, and each container start and how
125
+ * long it took. A retried test reports each attempt; its final result comes from `stormReporter`
126
+ * (`@cnc-tools/storm/vitest/config`), in vitest's main process. `stormEvents`, `stormFileEvents` and
127
+ * `stormTestEvents` are the adapter's own, which tests don't use.
128
+ *
129
+ * - `verbose` (per worker): whether the run is verbose, under `storm run --verbose`, from the run payload. Then
130
+ * `container` prints each container start and `proxy` each request as it is recorded, for passing tests too, and
131
+ * a test's own fixture can print what it does, as the Vercel CLI driver's invocations.
132
+ * - `testserverUrl` (per worker): this worker's Testserver sandbox, `sandboxes[(VITEST_POOL_ID - 1) % N]` from the
133
+ * run payload's `resources.testserverPool`. Outside `storm run`, or with a `VITEST_POOL_ID` that isn't a
134
+ * positive integer, it throws, so the test fails rather than skips.
135
+ * - `stormFile` (per file): the adapter's own state for the file, which tests don't use: its `container`, the
136
+ * holder of the file's container, and its `acquisitions`, the container and proxy starts still in flight. Creating
137
+ * it starts nothing. When the file finishes, it ends the file's container once any start in flight settles, and
138
+ * waits for every other start, so the file's worker can't exit while one is still starting.
139
+ * - `containerScope`: how long `container` lives, `'file'` (`CONTAINER_SCOPE`, the default) or `'test'`. A file or
140
+ * `describe` sets it with `test.override({ containerScope: "test" })`.
141
+ * - `warmServices`: the Testserver services to warm in each new container before a test gets it, by default none.
142
+ * A suite sets it on its own `test` with `.override("warmServices", [...])`, a file or `describe` with
143
+ * `test.override({ warmServices: [...] })`. In `'file'` scope the list is that of the test that starts the
144
+ * container. A service that fails to warm is reported, and starts on first use as before.
145
+ * - `featureFlags`: the feature flags each new container's services read, by flag client, by default `{}`, none,
146
+ * set before any service starts. A suite sets it on its own `test` with `.override("featureFlags", {...})`, a file
147
+ * or `describe` with `test.override({ featureFlags })`; a value replaces the whole object. In `'file'` scope, a
148
+ * test whose feature flags differ from those of the file's container ends it and starts a new one.
149
+ * - `container`: in `'file'` scope, the file's container, labeled with the file's path, started by the file's first
150
+ * test that asks for it and ended after a failed test that used it, so the next test that asks starts a new one.
151
+ * A concurrent test fails instead. In `'test'` scope, a container started for the test, labeled with the test's
152
+ * name, and ended after it. The test's `task.meta.storm` records the Testserver URL and, once the test has the
153
+ * container, its test id.
154
+ * - `seed`: a `Seeder` over `container`, per test.
155
+ * - `proxy`: a proxy adding `container`'s test id, per test, closed after it. Once closed, its cleanup fails the
156
+ * test when a fault rule forwarded a request and Testserver failed (`fault.upstream.error`); a rule with hits
157
+ * left doesn't.
158
+ *
159
+ * A container or proxy that finishes starting after the test was aborted or timed out never reaches the test. A
160
+ * test's own container or proxy is ended or closed at once; the file's container stays the file's. If a late start
161
+ * or an end at the file's finish fails, the file fails with the error.
162
+ *
163
+ * Outside a verbose run, a passing test prints nothing. When a test fails, `container` prints its test id, its container activity (factory
164
+ * calls and API requests in the order they started), its container log, read before the container ends, and its
165
+ * container output's URL, in `'file'` scope only the test's own, with a line about the shared container. `proxy`
166
+ * prints the requests it received, each a fault rule matched tagged with the fault, then each fault rule with hits
167
+ * left. Tokens are redacted throughout.
168
+ */
169
+ // The chain also holds the adapter's own fixtures (`stormEvents`, `stormFileEvents`, `stormTestEvents`,
170
+ // `stormFile`), which exist at run time but aren't published, so vitest's types can't see the chain as a
171
+ // `StormTest`; the cast drops them from the type.
172
+ export const test = fixtures;
@@ -0,0 +1,47 @@
1
+ /** One test `vitest list --json` names. */
2
+ export interface ListedTest {
3
+ /** Its full name, its `describe` names and its own joined by ` > `. */
4
+ readonly name: string;
5
+ /** The absolute path of its file. */
6
+ readonly file: string;
7
+ }
8
+ /** What to list: `vitest list --json` with `args` after it, such as a project and file filters. */
9
+ export interface VitestListRequest {
10
+ /** Passed after `list --json`, as `vitest run` takes them. */
11
+ readonly args: readonly string[];
12
+ /** Where vitest runs; default the current directory. */
13
+ readonly cwd?: string;
14
+ /** How long the listing may take before it is killed. */
15
+ readonly timeoutMs: number;
16
+ }
17
+ /**
18
+ * Why the tests couldn't be listed: `vitest` couldn't be started (not on `PATH`, or no such `cwd`), it didn't finish
19
+ * within `timeoutMs`, it exited other than 0 (with the last line of its stderr that isn't blank or a stack frame, empty
20
+ * when there is none), or its output wasn't a list of tests.
21
+ */
22
+ export type VitestListFailure = {
23
+ readonly kind: "start-failed";
24
+ readonly message: string;
25
+ } | {
26
+ readonly kind: "timed-out";
27
+ readonly timeoutMs: number;
28
+ } | {
29
+ readonly kind: "exited";
30
+ readonly exitCode: number | null;
31
+ readonly signal: string | null;
32
+ readonly lastStderrLine: string;
33
+ } | {
34
+ readonly kind: "unreadable-output";
35
+ readonly message: string;
36
+ };
37
+ export type VitestListResult = {
38
+ readonly ok: true;
39
+ readonly tests: readonly ListedTest[];
40
+ } | {
41
+ readonly ok: false;
42
+ readonly failure: VitestListFailure;
43
+ };
44
+ /** Lists the tests a `vitest run` with the same arguments would run, without running them. */
45
+ export interface VitestListGateway {
46
+ listTests(request: VitestListRequest): Promise<VitestListResult>;
47
+ }
@@ -0,0 +1,3 @@
1
+ // The Vitest adapter's gateway: listing the tests a `vitest run` would run, before any Testserver sandbox is leased.
2
+ // The live gateway is `live/list-gateway.ts`; the fake is `test/fakes/vitest/list-gateway.ts`.
3
+ export {};
@@ -0,0 +1,3 @@
1
+ export { CONTAINER_SCOPE, type ContainerScope } from "./container-scope.ts";
2
+ export { test } from "./fixtures.ts";
3
+ export type { StormContext, StormScopes, StormTest, StormTestFixtures, StormWorkerFixtures } from "./types.ts";
@@ -0,0 +1,9 @@
1
+ // storm's Vitest adapter, exported as `@cnc-tools/storm/vitest`: vitest's `test` extended with fixtures for
2
+ // the worker's Testserver sandbox, a container (shared by a test file's tests unless `containerScope` is `'test'`),
3
+ // its seeder and its proxy. A `vitest.config.ts` can't import it, since extending vitest's `test` throws there;
4
+ // `testserverWorkers` is in `./config.ts` (`@cnc-tools/storm/vitest/config`) for that reason, and isn't re-exported
5
+ // here. It imports the SDK only through `src/sdk/index.ts`, and the SDK never imports it. Besides Node builtins and
6
+ // the SDK, it depends only on `vitest`, an optional peer dependency of `@cnc-tools/storm`; `.oxlintrc.json` checks
7
+ // the boundary.
8
+ export { CONTAINER_SCOPE } from "./container-scope.js";
9
+ export { test } from "./fixtures.js";
@@ -0,0 +1,3 @@
1
+ import type { ListedTest } from "./gateways.ts";
2
+ /** The tests `stdout` names. Throws an `Error` when it isn't JSON, or isn't a list of tests. */
3
+ export declare function readVitestList(stdout: string): readonly ListedTest[];
@@ -0,0 +1,19 @@
1
+ // Reading `vitest list --json`'s output: a JSON array with one `{ name, file }` object per test. Pure, so the live
2
+ // gateway and `parseVitestList` (`plan.ts`) share it.
3
+ import { z } from "zod";
4
+ /** `vitest list --json`'s output; other fields, such as `projectName`, pass through unchecked. */
5
+ const VITEST_LIST = z.array(z.looseObject({ name: z.string(), file: z.string() }));
6
+ /** The tests `stdout` names. Throws an `Error` when it isn't JSON, or isn't a list of tests. */
7
+ export function readVitestList(stdout) {
8
+ let document;
9
+ try {
10
+ document = JSON.parse(stdout);
11
+ }
12
+ catch {
13
+ throw new Error("`vitest list --json` did not print JSON");
14
+ }
15
+ const parsed = VITEST_LIST.safeParse(document);
16
+ if (!parsed.success)
17
+ throw new Error("`vitest list --json` did not print a list of tests");
18
+ return parsed.data.map(({ name, file }) => ({ name, file }));
19
+ }
@@ -0,0 +1,7 @@
1
+ import type { VitestListGateway } from "../gateways.ts";
2
+ /**
3
+ * The live list gateway: spawns `vitest list --json <args>` from `PATH`, no shell, in `cwd`, with stdin ignored,
4
+ * and kills it after `timeoutMs` (`AbortSignal.timeout`). An `error` before the process exits is a start failure,
5
+ * unless the timeout caused it.
6
+ */
7
+ export declare const liveVitestListGateway: VitestListGateway;