@astryxdesign/cli 0.7.2-canary.081ccea → 0.7.2-canary.0d5d64e

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 (324) hide show
  1. package/README.md +104 -84
  2. package/api/build/_adapter.d.mts +8 -0
  3. package/api/build/_adapter.mjs +12 -1
  4. package/api/build/build.doc.mjs +4 -0
  5. package/api/build/kit/kit.mjs +3 -11
  6. package/api/component/_adapter.mjs +3 -11
  7. package/api/component/component.doc.mjs +6 -1
  8. package/api/discover/_adapter.d.mts +13 -0
  9. package/api/discover/_adapter.mjs +39 -17
  10. package/api/discover/discover.doc.mjs +3 -2
  11. package/api/discover/discover.mjs +22 -8
  12. package/api/discover/discover.type.d.mts +5 -3
  13. package/api/discover/discover.type.mjs +5 -3
  14. package/api/docs/_adapter.mjs +3 -2
  15. package/api/docs/docs.doc.mjs +2 -1
  16. package/api/docs/docs.mjs +2 -1
  17. package/api/docs/docs.test.mjs +5 -2
  18. package/api/docs/reference-blocks.test.mjs +1 -3
  19. package/api/doctor/_adapter.d.mts +108 -0
  20. package/api/doctor/_adapter.mjs +223 -4
  21. package/api/doctor/doctor.d.mts +199 -0
  22. package/api/doctor/doctor.doc.mjs +3 -2
  23. package/api/doctor/doctor.mjs +503 -31
  24. package/api/doctor/doctor.test.mjs +137 -14
  25. package/api/doctor/release-checks.test.mjs +156 -0
  26. package/api/doctor/theme-checks.mjs +16 -3
  27. package/api/doctor/theme-checks.test.mjs +87 -7
  28. package/api/error.d.mts +10 -0
  29. package/api/error.mjs +25 -0
  30. package/api/hook/_adapter.mjs +3 -11
  31. package/api/hook/hook.doc.mjs +4 -0
  32. package/api/hook/list/list.d.mts +1 -1
  33. package/api/init/_adapter.d.mts +22 -0
  34. package/api/init/_adapter.mjs +59 -0
  35. package/api/init/init.d.mts +7 -5
  36. package/api/init/init.doc.mjs +28 -7
  37. package/api/init/init.mjs +28 -4
  38. package/api/init/init.type.d.mts +48 -3
  39. package/api/init/init.type.mjs +37 -3
  40. package/api/init/run/run.d.mts +1 -1
  41. package/api/init/run/run.mjs +15 -4
  42. package/api/init/user/user.d.mts +14 -0
  43. package/api/init/user/user.mjs +87 -0
  44. package/api/init/user/user.test.mjs +232 -0
  45. package/api/integration/authoring-checks.mjs +2 -2
  46. package/api/integration/integrationCheck.doc.mjs +1 -1
  47. package/api/integration/pack-check.mjs +10 -9
  48. package/api/integration/pack-check.test.mjs +9 -15
  49. package/api/integration/validate-integration.d.mts +8 -0
  50. package/api/integration/validate-integration.mjs +27 -6
  51. package/api/integration/validate-integration.type.d.mts +8 -0
  52. package/api/integration/validate-integration.type.mjs +3 -1
  53. package/api/integration/validate-unread-theme-folders.test.mjs +3 -2
  54. package/api/integration/validateIntegration.doc.mjs +1 -1
  55. package/api/search/_adapter.d.mts +11 -0
  56. package/api/search/_adapter.mjs +25 -0
  57. package/api/search/search.d.mts +1 -1
  58. package/api/search/search.doc.mjs +8 -3
  59. package/api/search/search.mjs +38 -14
  60. package/api/search/search.test.mjs +4 -1
  61. package/api/search/search.type.d.mts +14 -1
  62. package/api/search/search.type.mjs +6 -1
  63. package/api/swizzle/_adapter.mjs +2 -2
  64. package/api/swizzle/copy/copy.mjs +1 -1
  65. package/api/template/template-integration.test.mjs +1 -1
  66. package/api/theme/_adapter.d.mts +16 -0
  67. package/api/theme/_adapter.mjs +32 -5
  68. package/api/theme/build/build.d.mts +2 -1
  69. package/api/theme/build/build.mjs +70 -14
  70. package/api/theme/build/build.packed-old-core.test.mjs +20 -3
  71. package/api/theme/build/font-warning.mjs +5 -3
  72. package/api/theme/build/font-warning.test.mjs +2 -1
  73. package/api/theme/remove/remove.test.mjs +2 -2
  74. package/api/theme/targets/targets.mjs +3 -10
  75. package/api/theme/themeTargets.doc.mjs +4 -0
  76. package/api/theme/use/use.test.mjs +1 -1
  77. package/api/upgrade/_adapter.mjs +1 -1
  78. package/api/upgrade/run/run.mjs +5 -1
  79. package/api/upgrade/upgrade.doc.mjs +2 -1
  80. package/api/upgrade/upgrade.mjs +5 -1
  81. package/assets/docs/getting-started.doc.mjs +23 -3
  82. package/assets/docs/tree/add-a-component.doc.mjs +11 -1
  83. package/assets/docs/tree/add-a-theme.doc.mjs +12 -2
  84. package/assets/docs/tree/add-a-topic.doc.mjs +43 -1
  85. package/assets/docs/tree/agent-guidance.doc.mjs +18 -4
  86. package/assets/docs/tree/building-blocks.doc.mjs +4 -0
  87. package/assets/docs/tree/check-the-props.doc.mjs +1 -1
  88. package/assets/docs/tree/check-your-docs.doc.mjs +5 -5
  89. package/assets/docs/tree/checks.doc.mjs +9 -9
  90. package/assets/docs/tree/ci-and-containers.doc.mjs +88 -0
  91. package/assets/docs/tree/cli-command.doc.mjs +142 -0
  92. package/assets/docs/tree/cli.doc.mjs +6 -0
  93. package/assets/docs/tree/codemods.doc.mjs +13 -3
  94. package/assets/docs/tree/commands.doc.mjs +7 -1
  95. package/assets/docs/tree/component-imports.doc.mjs +11 -1
  96. package/assets/docs/tree/components.doc.mjs +6 -0
  97. package/assets/docs/tree/computer-agent-guide.doc.mjs +160 -0
  98. package/assets/docs/tree/computer-integrations.doc.mjs +93 -0
  99. package/assets/docs/tree/configuration.doc.mjs +7 -3
  100. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +11 -1
  101. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  102. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  103. package/assets/docs/tree/docs.doc.mjs +6 -0
  104. package/assets/docs/tree/extend-or-replace.doc.mjs +13 -3
  105. package/assets/docs/tree/generate-a-palette.doc.mjs +2 -2
  106. package/assets/docs/tree/global-integrations.doc.mjs +124 -0
  107. package/assets/docs/tree/global.doc.mjs +131 -0
  108. package/assets/docs/tree/grade-template-with-agent.doc.mjs +4 -4
  109. package/assets/docs/tree/install-once.doc.mjs +105 -0
  110. package/assets/docs/tree/integrations.doc.mjs +5 -1
  111. package/assets/docs/tree/layout.doc.mjs +1 -1
  112. package/assets/docs/tree/links.doc.mjs +1 -1
  113. package/assets/docs/tree/monorepos.doc.mjs +84 -0
  114. package/assets/docs/tree/problems.doc.mjs +205 -0
  115. package/assets/docs/tree/project-global-or-both.doc.mjs +131 -0
  116. package/assets/docs/tree/publishing.doc.mjs +2 -2
  117. package/assets/docs/tree/quick-start.doc.mjs +15 -5
  118. package/assets/docs/tree/reference.doc.mjs +192 -0
  119. package/assets/docs/tree/replace-a-core-component.doc.mjs +11 -1
  120. package/assets/docs/tree/replace-a-core-template.doc.mjs +4 -4
  121. package/assets/docs/tree/scaffold.doc.mjs +1 -1
  122. package/assets/docs/tree/sections-and-placement.doc.mjs +3 -3
  123. package/assets/docs/tree/see-it-in-an-app.doc.mjs +13 -3
  124. package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
  125. package/assets/docs/tree/single-component.doc.mjs +3 -3
  126. package/assets/docs/tree/start-a-template.doc.mjs +15 -5
  127. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  128. package/assets/docs/tree/templates.doc.mjs +6 -0
  129. package/assets/docs/tree/test-in-an-app.doc.mjs +4 -4
  130. package/assets/docs/tree/test-template-in-app.doc.mjs +4 -4
  131. package/assets/docs/tree/themes.doc.mjs +4 -0
  132. package/assets/docs/tree/troubleshooting.doc.mjs +15 -7
  133. package/assets/docs/tree/uninstall.doc.mjs +109 -0
  134. package/assets/docs/tree/updates.doc.mjs +92 -0
  135. package/assets/docs/tree/upgrading.doc.mjs +2 -2
  136. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +11 -1
  137. package/assets/docs/tree/verify-packed-template.doc.mjs +2 -2
  138. package/assets/docs/tree/versioning.doc.mjs +3 -3
  139. package/assets/docs/tree/who-answers.doc.mjs +119 -0
  140. package/assets/docs/tree/write-the-template-file.doc.mjs +3 -3
  141. package/assets/docs/working-with-ai.doc.mjs +23 -9
  142. package/authoring/debug/parse.d.mts +5 -5
  143. package/authoring/discover/discover.doc.mjs +6 -0
  144. package/authoring/doctypes/_schema.d.mts +8 -3
  145. package/authoring/doctypes/_schema.mjs +1 -0
  146. package/authoring/doctypes/command/command.doc.mjs +6 -0
  147. package/authoring/doctypes/command/type.ts +14 -0
  148. package/authoring/doctypes/reference/reference.doc.mjs +1 -1
  149. package/authoring/index.d.ts +1 -0
  150. package/authoring/integration/integration.doc.mjs +18 -2
  151. package/authoring/integration/parse.test.mjs +11 -0
  152. package/authoring/integration/schema.d.mts +14 -3
  153. package/authoring/integration/schema.mjs +33 -2
  154. package/authoring/integration/type.ts +8 -0
  155. package/clients/cli/bin/astryx.mjs +20 -3
  156. package/clients/cli/cli-command.test.mjs +166 -0
  157. package/clients/cli/commands/blog.doc.mjs +1 -0
  158. package/clients/cli/commands/build-theme.batch-report.test.mjs +14 -2
  159. package/clients/cli/commands/build-theme.font-warning.test.mjs +3 -3
  160. package/clients/cli/commands/build-theme.mjs +25 -12
  161. package/clients/cli/commands/build.doc.mjs +1 -0
  162. package/clients/cli/commands/build.exit-codes-doc.test.mjs +4 -0
  163. package/clients/cli/commands/component.doc.mjs +1 -0
  164. package/clients/cli/commands/discover.broken-integration.test.mjs +7 -6
  165. package/clients/cli/commands/discover.doc.mjs +8 -0
  166. package/clients/cli/commands/discover.no-source.test.mjs +1 -0
  167. package/clients/cli/commands/docs.doc.mjs +1 -0
  168. package/clients/cli/commands/docs.mjs +49 -19
  169. package/clients/cli/commands/docs.test.mjs +2 -2
  170. package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -0
  171. package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -0
  172. package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -0
  173. package/clients/cli/commands/doctor-integration-validate.doc.mjs +10 -1
  174. package/clients/cli/commands/doctor-integration.test.mjs +4 -3
  175. package/clients/cli/commands/doctor.doc.mjs +12 -2
  176. package/clients/cli/commands/doctor.mjs +12 -3
  177. package/clients/cli/commands/doctor.test.mjs +10 -4
  178. package/clients/cli/commands/gap-report.doc.mjs +1 -0
  179. package/clients/cli/commands/hook.doc.mjs +1 -0
  180. package/clients/cli/commands/init.behavior.test.mjs +5 -0
  181. package/clients/cli/commands/init.doc.mjs +29 -3
  182. package/clients/cli/commands/integration-add.doc.mjs +7 -0
  183. package/clients/cli/commands/integration-authoring.test.mjs +3 -3
  184. package/clients/cli/commands/integration-check.doc.mjs +10 -2
  185. package/clients/cli/commands/integration-check.test.mjs +31 -1
  186. package/clients/cli/commands/integration-pack.doc.mjs +8 -1
  187. package/clients/cli/commands/integration-verify.doc.mjs +8 -1
  188. package/clients/cli/commands/integration.mjs +3 -2
  189. package/clients/cli/commands/json-contract.test.mjs +6 -1
  190. package/clients/cli/commands/manifest.doc.mjs +1 -0
  191. package/clients/cli/commands/outside-project.test.mjs +774 -0
  192. package/clients/cli/commands/search.doc.mjs +1 -0
  193. package/clients/cli/commands/search.mjs +16 -11
  194. package/clients/cli/commands/search.test.mjs +429 -296
  195. package/clients/cli/commands/setup-nudge.test.mjs +26 -4
  196. package/clients/cli/commands/swizzle.doc.mjs +7 -0
  197. package/clients/cli/commands/swizzle.routing.test.mjs +1 -1
  198. package/clients/cli/commands/template.doc.mjs +1 -0
  199. package/clients/cli/commands/theme-add-lifecycle.test.mjs +3 -3
  200. package/clients/cli/commands/theme-add.doc.mjs +8 -1
  201. package/clients/cli/commands/theme-build.doc.mjs +1 -0
  202. package/clients/cli/commands/theme-eject.doc.mjs +1 -0
  203. package/clients/cli/commands/theme-list.behavior.test.mjs +6 -0
  204. package/clients/cli/commands/theme-list.doc.mjs +1 -0
  205. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -0
  206. package/clients/cli/commands/theme-remove.doc.mjs +7 -0
  207. package/clients/cli/commands/theme-targets.doc.mjs +1 -0
  208. package/clients/cli/commands/theme-template.doc.mjs +1 -0
  209. package/clients/cli/commands/theme-use.doc.mjs +7 -0
  210. package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
  211. package/clients/cli/commands/upgrade.doc.mjs +8 -1
  212. package/clients/cli/commands/upgrade.file-protection.test.mjs +3 -2
  213. package/clients/cli/commands/upgrade.hook-output.test.mjs +2 -1
  214. package/clients/cli/index.mjs +84 -13
  215. package/clients/cli/lib/cli-error.mjs +4 -1
  216. package/clients/cli/lib/component-format.test.mjs +1 -1
  217. package/clients/cli/lib/define-command.mjs +2 -2
  218. package/clients/cli/lib/json-shim.mjs +3 -1
  219. package/clients/cli/lib/manifest.d.ts +9 -0
  220. package/clients/cli/lib/manifest.mjs +17 -1
  221. package/clients/cli/lib/manifest.test.mjs +25 -0
  222. package/foundation/agent-docs/agent-doc-state.d.mts +21 -6
  223. package/foundation/agent-docs/agent-doc-state.mjs +29 -7
  224. package/foundation/agent-docs/agent-docs.d.mts +2 -2
  225. package/foundation/agent-docs/agent-docs.mjs +3 -3
  226. package/foundation/agent-docs/computer-agent-text.d.mts +133 -0
  227. package/foundation/agent-docs/computer-agent-text.mjs +623 -0
  228. package/foundation/agent-docs/computer-agent-text.test.mjs +602 -0
  229. package/foundation/config/project.d.mts +35 -3
  230. package/foundation/config/project.mjs +145 -8
  231. package/foundation/config/project.test.mjs +66 -0
  232. package/foundation/config/theme-state.mjs +5 -4
  233. package/foundation/discovery/cli-self-docs.mjs +20 -3
  234. package/foundation/discovery/cli-self-docs.test.mjs +3 -2
  235. package/foundation/discovery/component-replacement.mjs +2 -1
  236. package/foundation/discovery/runner-allowlist.d.mts +40 -0
  237. package/foundation/discovery/runner-allowlist.mjs +53 -0
  238. package/foundation/discovery/template-needs.mjs +5 -2
  239. package/foundation/discovery/theme-imports.mjs +8 -4
  240. package/foundation/discovery/theme-imports.test.mjs +1 -1
  241. package/foundation/doc-compiler/doc-loads.test.mjs +20 -0
  242. package/foundation/doc-compiler/inputs.mjs +4 -1
  243. package/foundation/doc-compiler/read.d.mts +1 -1
  244. package/foundation/doc-compiler/tree.test.mjs +1 -1
  245. package/foundation/env/cli-command.d.mts +83 -0
  246. package/foundation/env/cli-command.mjs +152 -0
  247. package/foundation/env/cli-command.test.mjs +129 -0
  248. package/foundation/env/node-version.test.mjs +15 -3
  249. package/foundation/env/package-manager.d.mts +61 -9
  250. package/foundation/env/package-manager.global.test.mjs +66 -0
  251. package/foundation/env/package-manager.mjs +137 -13
  252. package/foundation/env/package-manager.test.mjs +148 -9
  253. package/foundation/env/project-scope.d.mts +9 -0
  254. package/foundation/env/project-scope.mjs +33 -0
  255. package/foundation/env/search-path.d.mts +42 -0
  256. package/foundation/env/search-path.mjs +205 -0
  257. package/foundation/env/search-path.test.mjs +122 -0
  258. package/foundation/env/user-dirs.d.mts +39 -0
  259. package/foundation/env/user-dirs.mjs +93 -0
  260. package/foundation/env/user-dirs.test.mjs +72 -0
  261. package/foundation/env/user-settings.d.mts +46 -0
  262. package/foundation/env/user-settings.mjs +106 -0
  263. package/foundation/env/user-settings.test.mjs +64 -0
  264. package/foundation/fs/file-protection.mjs +15 -1
  265. package/foundation/fs/module-loader.stdout.test.mjs +3 -2
  266. package/foundation/fs/path-compare.d.mts +33 -0
  267. package/foundation/fs/path-compare.mjs +73 -0
  268. package/foundation/fs/paths.d.mts +57 -1
  269. package/foundation/fs/paths.mjs +131 -3
  270. package/foundation/fs/paths.test.mjs +10 -1
  271. package/foundation/integrations/computer-integrations.d.mts +78 -0
  272. package/foundation/integrations/computer-integrations.mjs +316 -0
  273. package/foundation/integrations/computer-integrations.test.mjs +292 -0
  274. package/foundation/integrations/integration-warnings.mjs +3 -2
  275. package/foundation/integrations/integration-warnings.test.mjs +8 -9
  276. package/foundation/integrations/integrations.d.mts +25 -1
  277. package/foundation/integrations/integrations.mjs +46 -3
  278. package/foundation/integrations/validate-contributions.d.mts +2 -0
  279. package/foundation/integrations/validate-contributions.mjs +11 -0
  280. package/foundation/release/agent-text-worker.d.mts +4 -0
  281. package/foundation/release/agent-text-worker.mjs +52 -0
  282. package/foundation/release/cache.d.mts +310 -0
  283. package/foundation/release/cache.mjs +1216 -0
  284. package/foundation/release/cache.test.mjs +920 -0
  285. package/foundation/release/choose.d.mts +207 -0
  286. package/foundation/release/choose.mjs +677 -0
  287. package/foundation/release/choose.test.mjs +427 -0
  288. package/foundation/release/core-worker.d.mts +4 -0
  289. package/foundation/release/core-worker.mjs +38 -0
  290. package/foundation/release/global-state.d.mts +259 -0
  291. package/foundation/release/global-state.mjs +472 -0
  292. package/foundation/release/global-state.test.mjs +381 -0
  293. package/foundation/release/handoff.d.mts +60 -0
  294. package/foundation/release/handoff.e2e.test.mjs +278 -0
  295. package/foundation/release/handoff.mjs +357 -0
  296. package/foundation/release/lock-lease.d.mts +23 -0
  297. package/foundation/release/lock-lease.mjs +80 -0
  298. package/foundation/release/notices.d.mts +253 -0
  299. package/foundation/release/notices.mjs +596 -0
  300. package/foundation/release/notices.test.mjs +565 -0
  301. package/foundation/release/npm-guard.d.mts +4 -0
  302. package/foundation/release/npm-guard.mjs +126 -0
  303. package/foundation/release/project.d.mts +141 -0
  304. package/foundation/release/project.mjs +466 -0
  305. package/foundation/release/project.test.mjs +288 -0
  306. package/foundation/release/refresh-worker.d.mts +4 -0
  307. package/foundation/release/refresh-worker.mjs +27 -0
  308. package/foundation/release/run-context.d.mts +47 -0
  309. package/foundation/release/run-context.mjs +149 -0
  310. package/foundation/release/update-notice-env.d.mts +28 -0
  311. package/foundation/release/update-notice-env.mjs +39 -0
  312. package/foundation/response/base.d.ts +26 -3
  313. package/foundation/response/error-codes.d.mts +3 -1
  314. package/foundation/response/error-codes.doc.mjs +12 -0
  315. package/foundation/response/error-codes.mjs +17 -0
  316. package/foundation/response/error-codes.test.mjs +2 -0
  317. package/foundation/response/json-contract.test.mjs +7 -2
  318. package/foundation/response/json.mjs +4 -1
  319. package/foundation/response/response-types.doc.mjs +8 -3
  320. package/foundation/response/response-types.doc.test.mjs +46 -0
  321. package/foundation/response/response.doc.mjs +3 -3
  322. package/foundation/xle/browser-imports.test.mjs +74 -0
  323. package/package.json +9 -9
  324. package/scripts/postinstall.mjs +21 -2
@@ -45,7 +45,7 @@ export function findManifestPaths(dir: string): string[];
45
45
  * @param {string} file absolute manifest path
46
46
  * @param {string} [label] used in error messages
47
47
  * @param {{fresh?: boolean}} [options]
48
- * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string}>}
48
+ * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string}>}
49
49
  */
50
50
  export function loadManifest(file: string, label?: string, { fresh }?: {
51
51
  fresh?: boolean;
@@ -58,6 +58,7 @@ export function loadManifest(file: string, label?: string, { fresh }?: {
58
58
  discover?: import("../../authoring/discover/type").DiscoverSource;
59
59
  discoverError?: string;
60
60
  agentDocsError?: string;
61
+ cliCommandError?: string;
61
62
  }>;
62
63
  /**
63
64
  * Load and validate a manifest module's default export against the integration
@@ -126,6 +127,10 @@ export function loadIntegrations(specs?: string[], { cwd, fresh, resolveProvider
126
127
  * @property {string} [themes]
127
128
  * @property {string} [issuesUrl]
128
129
  * @property {{append?: readonly string[]}} [agentDocs]
130
+ * @property {string} [cliCommand] the command this package's users run the
131
+ * CLI with; read by the picker in foundation/env (see cli-command.mjs)
132
+ * @property {string} [__cliCommandError] why a declared `cliCommand` was
133
+ * ignored; the rest of the manifest still contributes
129
134
  * @property {string} [__agentDocsError] contribution-specific validation
130
135
  * failure; other manifest contributions remain available
131
136
  * @property {string} __spec
@@ -145,6 +150,9 @@ export function loadIntegrations(specs?: string[], { cwd, fresh, resolveProvider
145
150
  * @property {boolean} [__autolinked] loaded because the project declares the
146
151
  * package as a dependency and it ships a manifest, with no astryx.config
147
152
  * entry naming it — see foundation/integrations/autolink.mjs
153
+ * @property {boolean} [__computer] loaded because it is installed beside the
154
+ * running CLI and the folder is outside a project (spec AST-081 FR12) — see
155
+ * foundation/integrations/computer-integrations.mjs
148
156
  * @property {boolean} [__local] loaded from the package containing the current
149
157
  * working directory, so an author sees the exact bytes they are editing
150
158
  * @property {string} [__dependencyField] for an autolinked integration, the
@@ -186,6 +194,16 @@ export type LoadedIntegration = {
186
194
  agentDocs?: {
187
195
  append?: readonly string[];
188
196
  } | undefined;
197
+ /**
198
+ * the command this package's users run the
199
+ * CLI with; read by the picker in foundation/env (see cli-command.mjs)
200
+ */
201
+ cliCommand?: string | undefined;
202
+ /**
203
+ * why a declared `cliCommand` was
204
+ * ignored; the rest of the manifest still contributes
205
+ */
206
+ __cliCommandError?: string | undefined;
189
207
  /**
190
208
  * contribution-specific validation
191
209
  * failure; other manifest contributions remain available
@@ -226,6 +244,12 @@ export type LoadedIntegration = {
226
244
  * entry naming it — see foundation/integrations/autolink.mjs
227
245
  */
228
246
  __autolinked?: boolean | undefined;
247
+ /**
248
+ * loaded because it is installed beside the
249
+ * running CLI and the folder is outside a project (spec AST-081 FR12) — see
250
+ * foundation/integrations/computer-integrations.mjs
251
+ */
252
+ __computer?: boolean | undefined;
229
253
  /**
230
254
  * loaded from the package containing the current
231
255
  * working directory, so an author sees the exact bytes they are editing
@@ -6,7 +6,8 @@
6
6
  * Integrations are PACKAGE NAMES listed in astryx.config.{ts,mjs,js}. Each
7
7
  * package declares a single conventional root manifest sibling to its
8
8
  * package.json — astryx.integration.{ts,mjs,js} — which contributes
9
- * components/templates/codemods/docs/themes roots and an optional issuesUrl.
9
+ * components/templates/codemods/docs/themes roots, an optional issuesUrl, and
10
+ * an optional cliCommand.
10
11
  * Stable provider identity and package metadata come from package.json, not the
11
12
  * manifest.
12
13
  *
@@ -24,6 +25,7 @@ import {normalizeProviderId} from '../identity/provider-identity.mjs';
24
25
  // the loader can isolate an invalid optional contribution from valid roots.
25
26
  import {
26
27
  parseAgentDocsField,
28
+ parseCliCommandField,
27
29
  parseIntegrationBase,
28
30
  unknownIntegrationKeys,
29
31
  } from '../../authoring/integration/schema.mjs';
@@ -51,6 +53,10 @@ import {resolveProviders} from './provider-resolution.mjs';
51
53
  * @property {string} [themes]
52
54
  * @property {string} [issuesUrl]
53
55
  * @property {{append?: readonly string[]}} [agentDocs]
56
+ * @property {string} [cliCommand] the command this package's users run the
57
+ * CLI with; read by the picker in foundation/env (see cli-command.mjs)
58
+ * @property {string} [__cliCommandError] why a declared `cliCommand` was
59
+ * ignored; the rest of the manifest still contributes
54
60
  * @property {string} [__agentDocsError] contribution-specific validation
55
61
  * failure; other manifest contributions remain available
56
62
  * @property {string} __spec
@@ -70,6 +76,9 @@ import {resolveProviders} from './provider-resolution.mjs';
70
76
  * @property {boolean} [__autolinked] loaded because the project declares the
71
77
  * package as a dependency and it ships a manifest, with no astryx.config
72
78
  * entry naming it — see foundation/integrations/autolink.mjs
79
+ * @property {boolean} [__computer] loaded because it is installed beside the
80
+ * running CLI and the folder is outside a project (spec AST-081 FR12) — see
81
+ * foundation/integrations/computer-integrations.mjs
73
82
  * @property {boolean} [__local] loaded from the package containing the current
74
83
  * working directory, so an author sees the exact bytes they are editing
75
84
  * @property {string} [__dependencyField] for an autolinked integration, the
@@ -204,7 +213,7 @@ function parseDiscoverSourceExport(value, label) {
204
213
  * @param {string} file absolute manifest path
205
214
  * @param {string} [label] used in error messages
206
215
  * @param {{fresh?: boolean}} [options]
207
- * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string}>}
216
+ * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string}>}
208
217
  */
209
218
  export async function loadManifest(
210
219
  file,
@@ -239,8 +248,31 @@ export async function loadManifest(
239
248
  }
240
249
  }
241
250
 
251
+ /** @type {string | undefined} */
252
+ let cliCommand;
253
+ /** @type {string | undefined} */
254
+ let cliCommandError;
255
+ const rawCliCommand =
256
+ raw != null && typeof raw === 'object' && !Array.isArray(raw)
257
+ ? /** @type {{cliCommand?: unknown}} */ (raw).cliCommand
258
+ : undefined;
259
+ if (rawCliCommand !== undefined) {
260
+ try {
261
+ cliCommand = parseCliCommandField(
262
+ rawCliCommand,
263
+ `${label} field "cliCommand"`,
264
+ );
265
+ } catch (err) {
266
+ cliCommandError = err instanceof Error ? err.message : String(err);
267
+ }
268
+ }
269
+
242
270
  return {
243
- manifest: agentDocs == null ? baseManifest : {...baseManifest, agentDocs},
271
+ manifest: {
272
+ ...baseManifest,
273
+ ...(agentDocs == null ? {} : {agentDocs}),
274
+ ...(cliCommand == null ? {} : {cliCommand}),
275
+ },
244
276
  unknownKeys: unknownIntegrationKeys(raw),
245
277
  debug:
246
278
  typeof mod?.debug === 'function'
@@ -253,6 +285,7 @@ export async function loadManifest(
253
285
  discover: discover.source,
254
286
  discoverError: discover.error,
255
287
  agentDocsError,
288
+ cliCommandError,
256
289
  };
257
290
  }
258
291
 
@@ -375,6 +408,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
375
408
  let discoverError;
376
409
  /** @type {string | undefined} */
377
410
  let agentDocsError;
411
+ /** @type {string | undefined} */
412
+ let cliCommandError;
378
413
  try {
379
414
  ({
380
415
  manifest,
@@ -385,6 +420,7 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
385
420
  discover: discoverSource,
386
421
  discoverError,
387
422
  agentDocsError,
423
+ cliCommandError,
388
424
  } = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
389
425
  } catch (err) {
390
426
  return {
@@ -422,6 +458,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
422
458
  themes: resolveRoot(manifest.themes),
423
459
  issuesUrl: manifest.issuesUrl,
424
460
  agentDocs: manifest.agentDocs,
461
+ cliCommand: manifest.cliCommand,
462
+ __cliCommandError: cliCommandError,
425
463
  __agentDocsError: agentDocsError,
426
464
  __unknownKeys: unknownKeys,
427
465
  __debug: debugHandler,
@@ -486,6 +524,8 @@ export async function loadIntegrations(
486
524
  let discoverError;
487
525
  /** @type {string | undefined} */
488
526
  let agentDocsError;
527
+ /** @type {string | undefined} */
528
+ let cliCommandError;
489
529
  try {
490
530
  ({
491
531
  manifest,
@@ -496,6 +536,7 @@ export async function loadIntegrations(
496
536
  discover: discoverSource,
497
537
  discoverError,
498
538
  agentDocsError,
539
+ cliCommandError,
499
540
  } = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
500
541
  } catch (err) {
501
542
  // A manifest that throws on import or fails schema validation must NOT take
@@ -540,6 +581,8 @@ export async function loadIntegrations(
540
581
  themes: resolveRoot(manifest.themes),
541
582
  issuesUrl: manifest.issuesUrl,
542
583
  agentDocs: manifest.agentDocs,
584
+ cliCommand: manifest.cliCommand,
585
+ __cliCommandError: cliCommandError,
543
586
  __agentDocsError: agentDocsError,
544
587
  __unknownKeys: unknownKeys,
545
588
  __debug: debugHandler,
@@ -38,6 +38,8 @@ export function validateLoadedIntegration(loaded: LoadedIntegration): Promise<Is
38
38
  */
39
39
  /** Stable issue code for an invalid optional agent-doc contribution. */
40
40
  export const INVALID_AGENT_DOCS: "invalid_agent_docs";
41
+ /** Stable issue code for a `cliCommand` that was ignored as invalid. */
42
+ export const INVALID_CLI_COMMAND: "invalid_cli_command";
41
43
  /** Stable issue code for a package whose provider ID is already claimed. */
42
44
  export const DUPLICATE_PROVIDER: "duplicate_provider";
43
45
  export type Issue = import("./issue").AstryxIntegrationIssue;
@@ -59,6 +59,9 @@ import {discoverIntegrationThemes} from '../discovery/theme-discovery.mjs';
59
59
  /** Stable issue code for an invalid optional agent-doc contribution. */
60
60
  export const INVALID_AGENT_DOCS = 'invalid_agent_docs';
61
61
 
62
+ /** Stable issue code for a `cliCommand` that was ignored as invalid. */
63
+ export const INVALID_CLI_COMMAND = 'invalid_cli_command';
64
+
62
65
  /** Stable issue code for a package whose provider ID is already claimed. */
63
66
  export const DUPLICATE_PROVIDER = 'duplicate_provider';
64
67
 
@@ -479,6 +482,14 @@ export async function validateLoadedIntegration(loaded) {
479
482
  if (loaded.__agentDocsError) {
480
483
  issues.push(issueError(INVALID_AGENT_DOCS, loaded.__agentDocsError));
481
484
  }
485
+ if (loaded.__cliCommandError) {
486
+ issues.push(
487
+ issueWarning(
488
+ INVALID_CLI_COMMAND,
489
+ `${loaded.__cliCommandError}. The command is ignored; printed commands use the package-manager prefix.`,
490
+ ),
491
+ );
492
+ }
482
493
  checkRoots(
483
494
  {
484
495
  components: loaded.components,
@@ -0,0 +1,4 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ export {};
@@ -0,0 +1,52 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The global copy's background step that keeps the computer-level
5
+ * agent text installed (spec AST-081 FR8), as its own detached process.
6
+ *
7
+ * Started by `maybeKeepAgentText` (global-state.mjs) from the global copy,
8
+ * with one argument, the per-user configuration folder. It writes the files
9
+ * the person's settings choose, with this release's text and the plain `astryx` command, and keeps every file a
10
+ * person edited, every file without the Astryx markers, and every link, as
11
+ * `astryx init --user` does. It then records this release as the one that
12
+ * wrote the text. It writes nothing to any stream and never reaches a
13
+ * person: it is not a command and takes no options.
14
+ *
15
+ * @input argv[2]: the per-user configuration folder (the state file's); the
16
+ * settings file
17
+ * @output the computer-level agent text and the updated global state on disk
18
+ * @position foundation/release — one of the two detached processes the CLI
19
+ * starts; the other is refresh-worker.mjs.
20
+ */
21
+
22
+ import {fileURLToPath} from 'node:url';
23
+ import {
24
+ COMPUTER_COMMAND,
25
+ writeComputerAgentText,
26
+ } from '../agent-docs/computer-agent-text.mjs';
27
+ import {
28
+ computerAgentTextSettings,
29
+ recordComputerAgentTextSettings,
30
+ } from '../env/user-settings.mjs';
31
+ import {recordAgentTextWritten} from './global-state.mjs';
32
+ import {readJson} from './project.mjs';
33
+
34
+ const stateDir = process.argv[2];
35
+ if (stateDir) {
36
+ try {
37
+ const settings = computerAgentTextSettings();
38
+ if (settings.install) {
39
+ const {links} = writeComputerAgentText({command: COMPUTER_COMMAND});
40
+ recordComputerAgentTextSettings({
41
+ install: true,
42
+ links: [...new Set([...settings.links, ...links])],
43
+ });
44
+ const pkg = readJson(
45
+ fileURLToPath(new URL('../../package.json', import.meta.url)),
46
+ );
47
+ recordAgentTextWritten(pkg?.version ?? null, stateDir);
48
+ }
49
+ } catch {
50
+ // A home folder that cannot be written is tried again later.
51
+ }
52
+ }
@@ -0,0 +1,310 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * The per-user cache directory every Astryx cache lives in, never inside a
6
+ * project (`foundation/env/user-dirs.mjs`).
7
+ * @returns {string}
8
+ */
9
+ export function userCacheDir(): string;
10
+ /**
11
+ * The folder all cached releases live in.
12
+ * @param {string} [cacheDir]
13
+ * @returns {string}
14
+ */
15
+ export function releasesDir(cacheDir?: string): string;
16
+ /**
17
+ * Is `version` a plain release version?
18
+ * @param {unknown} version
19
+ * @returns {version is string}
20
+ */
21
+ export function isReleaseVersion(version: unknown): version is string;
22
+ /**
23
+ * A cached, verified release.
24
+ * @typedef {object} CachedRelease
25
+ * @property {string} version
26
+ * @property {string} dir the release folder
27
+ * @property {string} cliDir its `@astryxdesign/cli`
28
+ * @property {string} coreDir its `@astryxdesign/core`
29
+ * @property {string} bin the CLI's `astryx` entry file
30
+ */
31
+ /**
32
+ * The entry file a CLI package's `astryx` bin points at.
33
+ * @param {string} cliDir
34
+ * @returns {string | null}
35
+ */
36
+ export function cliBinOf(cliDir: string): string | null;
37
+ /**
38
+ * The cached release `version`, when it is installed and verified: its
39
+ * marker parses, names the version, and records the bytes of the CLI's and
40
+ * Core's package.json and the CLI's entry file, and those files still have
41
+ * them, and the number and total size of the two packages' files are the
42
+ * ones recorded. Anything else is a damaged release, which counts as absent and is
43
+ * replaced the next time a run needs it.
44
+ * @param {string} version
45
+ * @param {string} [cacheDir]
46
+ * @returns {CachedRelease | null}
47
+ */
48
+ export function cachedRelease(version: string, cacheDir?: string): CachedRelease | null;
49
+ /** Forget which releases this process verified, so the next look checks again. */
50
+ export function forgetVerifiedReleases(): void;
51
+ /**
52
+ * The size record of a release's two packages.
53
+ * @param {string} dir the release folder
54
+ * @returns {{cli: {count: number, bytes: number}, core: {count: number, bytes: number}} | null}
55
+ */
56
+ export function releaseTree(dir: string): {
57
+ cli: {
58
+ count: number;
59
+ bytes: number;
60
+ };
61
+ core: {
62
+ count: number;
63
+ bytes: number;
64
+ };
65
+ } | null;
66
+ /**
67
+ * Is `dir` inside the release cache? A copy that lives there was started by
68
+ * global mode, never installed by a person.
69
+ * @param {string} dir
70
+ * @param {string} [cacheDir]
71
+ * @returns {boolean}
72
+ */
73
+ export function isInReleaseCache(dir: string, cacheDir?: string): boolean;
74
+ /**
75
+ * How to start npm, never through a shell, so nothing a project declares is
76
+ * read by one: npm's own entry file run with this Node, from beside the
77
+ * running Node, else from beside an `npm` on the PATH (on Windows, npm's
78
+ * `npm.cmd` shim sits next to its `node_modules`); else `npm` on the PATH,
79
+ * started directly. An `npm` beside the running Node or on the PATH that
80
+ * links to npm's entry file (as distribution packages install it, such as
81
+ * `/usr/bin/npm` to `/usr/lib/node_modules_22/npm/bin/npm-cli.js`) counts as
82
+ * that entry file.
83
+ * @param {{env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, execPath?: string}} [where]
84
+ * `execPath`: the Node that runs npm (default: this one)
85
+ * @returns {{command: string, prefix: string[], shell: false}}
86
+ */
87
+ export function npmCommand(where?: {
88
+ env?: NodeJS.ProcessEnv;
89
+ platform?: NodeJS.Platform;
90
+ execPath?: string;
91
+ }): {
92
+ command: string;
93
+ prefix: string[];
94
+ shell: false;
95
+ };
96
+ /**
97
+ * Whether `spec` reads as an npm version range and nothing else: versions,
98
+ * `x`/`*` wildcards, prerelease tags, the range operators, `||`, and spaces.
99
+ * Anything a shell or npm would read as more, such as `&`, `;`, a lone `|`,
100
+ * quotes, or a URL, is refused.
101
+ * @param {string} spec
102
+ * @returns {boolean}
103
+ */
104
+ export function isVersionRange(spec: string): boolean;
105
+ /**
106
+ * The result of running npm.
107
+ * @typedef {object} NpmResult
108
+ * @property {number | null} status
109
+ * @property {NodeJS.Signals | null} [signal] the signal that ended npm, such as Ctrl-C's
110
+ * @property {string} stdout
111
+ * @property {string} stderr
112
+ * @property {Error} [error]
113
+ */
114
+ /**
115
+ * Run npm synchronously with no output on the caller's streams.
116
+ * @param {string[]} args
117
+ * npm runs under npm-guard.mjs, which gives it a process group of its own
118
+ * and ends that group when the time limit passes, when this run goes away
119
+ * (even killed outright), or when this run receives Ctrl-C. So no install
120
+ * outlives the run that started it.
121
+ *
122
+ * @param {string[]} args
123
+ * @param {{cwd?: string, timeoutMs?: number, pidFile?: string, npm?: {command: string, prefix: string[], shell?: false}}} [options]
124
+ * `pidFile` receives npm's process id while it runs (the release lock's
125
+ * record); `npm` replaces how npm is started (tests).
126
+ * @returns {NpmResult}
127
+ */
128
+ export function runNpm(args: string[], options?: {
129
+ cwd?: string;
130
+ timeoutMs?: number;
131
+ pidFile?: string;
132
+ npm?: {
133
+ command: string;
134
+ prefix: string[];
135
+ shell?: false;
136
+ };
137
+ }): NpmResult;
138
+ /**
139
+ * The newest published version that `spec` (a dist-tag or a range) names,
140
+ * asked of the registry through npm.
141
+ * @param {string} name e.g. `@astryxdesign/core`
142
+ * @param {string} spec e.g. `latest`, `^0.6.8`
143
+ * @param {{run?: typeof runNpm}} [options]
144
+ * @returns {string | null}
145
+ */
146
+ export function resolvePublishedVersion(name: string, spec: string, options?: {
147
+ run?: typeof runNpm;
148
+ }): string | null;
149
+ /**
150
+ * The release the registry tags `latest` for the CLI, and the Node range it
151
+ * declares; null when the registry cannot be asked, with the reason given to
152
+ * `onFailure`: `npm-missing` (npm cannot be started), `npm-failed: <npm's
153
+ * error code>` (npm ran and failed, such as on ECONNREFUSED or E404), or
154
+ * `bad-reply` (npm's answer names no release).
155
+ * @param {{run?: typeof runNpm, onFailure?: (reason: string) => void}} [options]
156
+ * @returns {{version: string, node: string | null} | null}
157
+ */
158
+ export function resolveLatestRelease(options?: {
159
+ run?: typeof runNpm;
160
+ onFailure?: (reason: string) => void;
161
+ }): {
162
+ version: string;
163
+ node: string | null;
164
+ } | null;
165
+ /**
166
+ * How long a failed install of a release is remembered, so offline runs do
167
+ * not start npm again on every run (spec AST-081 FR2): 2 minutes after a
168
+ * first failure, so a passing registry hiccup is retried soon, and 10 minutes
169
+ * after a second failure in a row. A successful install forgets it.
170
+ * @param {number} failures the failures in a row, 1 or more
171
+ * @returns {number}
172
+ */
173
+ export function failedInstallWaitMs(failures: number): number;
174
+ /**
175
+ * The recorded failed installs of `version` in a row, when the last was
176
+ * within its wait (failedInstallWaitMs), or null.
177
+ * @param {string} version
178
+ * @param {string} cacheDir
179
+ * @param {number} [now]
180
+ * @returns {{at: number, reason: string, failures: number, waitMs: number} | null}
181
+ */
182
+ export function recentFailedInstall(version: string, cacheDir: string, now?: number): {
183
+ at: number;
184
+ reason: string;
185
+ failures: number;
186
+ waitMs: number;
187
+ } | null;
188
+ /**
189
+ * Take a lock folder, or return false when another live run holds it. A lock
190
+ * whose holder has gone, such as a run stopped with Ctrl-C or killed, is taken
191
+ * over at once, and one from another computer once its holder has stopped
192
+ * renewing it. Throws when the cache folder cannot be written.
193
+ * @param {string} lockDir
194
+ * @param {{now?: number}} [options] the clock, for tests
195
+ * @returns {boolean}
196
+ */
197
+ export function tryLock(lockDir: string, { now }?: {
198
+ now?: number;
199
+ }): boolean;
200
+ /**
201
+ * Whether a process's arguments are this CLI's install of `version`, as
202
+ * runNpm starts it: the program (`argv[0]`) is npm, or node running npm's
203
+ * entry file `npm-cli.js` (`argv[1]`), each exactly by name, and the arguments
204
+ * include `install` and `@astryxdesign/cli@<version>`. A program that only has
205
+ * `npm` somewhere in its name or arguments is not.
206
+ * @param {string[]} argv
207
+ * @param {string} version
208
+ * @returns {boolean}
209
+ */
210
+ export function isReleaseInstall(argv: string[], version: string): boolean;
211
+ /**
212
+ * End the npm process group a stale lock records, only when that process is
213
+ * surely the install the lock was taken for: its command line is this CLI's
214
+ * install of the lock's release (isReleaseInstall), the lock is younger than
215
+ * any install may take, and the process started no earlier than the lock.
216
+ * Anything less certain is left alone, and the lock is simply taken over,
217
+ * since a recorded process id can name an unrelated process once the install
218
+ * ended.
219
+ * @param {string} lockDir a `.lock-<version>` folder
220
+ * @param {{now?: number, procRoot?: string, factsOf?: (pid: number) => {argv: string[] | null, startedAt: number | null}}} [options]
221
+ * the clock, the process table's folder, and the fact reader, for tests
222
+ * @returns {'ended' | 'left'} whether a process group was ended
223
+ */
224
+ export function endRecordedInstall(lockDir: string, { now, procRoot, factsOf }?: {
225
+ now?: number;
226
+ procRoot?: string;
227
+ factsOf?: (pid: number) => {
228
+ argv: string[] | null;
229
+ startedAt: number | null;
230
+ };
231
+ }): "ended" | "left";
232
+ /**
233
+ * Why a release could not be made available.
234
+ * @typedef {object} ReleaseUnavailable
235
+ * @property {string} version
236
+ * @property {string} reason one plain sentence
237
+ * @property {NodeJS.Signals} [signal] the install was stopped by this signal
238
+ */
239
+ /**
240
+ * Install release `version` into the cache, verify it, and return it. A
241
+ * release already cached returns at once. When another run is installing the
242
+ * same release, this waits for it.
243
+ *
244
+ * @param {string} version
245
+ * @param {{cacheDir?: string, run?: typeof runNpm, nodeVersion?: string, waitMs?: number, onProgress?: (event: 'install' | 'wait', version: string) => void}} [options]
246
+ * `onProgress` hears once when an install starts and once when the run
247
+ * starts waiting for another run's install.
248
+ * @returns {CachedRelease | ReleaseUnavailable}
249
+ */
250
+ export function ensureRelease(version: string, options?: {
251
+ cacheDir?: string;
252
+ run?: typeof runNpm;
253
+ nodeVersion?: string;
254
+ waitMs?: number;
255
+ onProgress?: (event: "install" | "wait", version: string) => void;
256
+ }): CachedRelease | ReleaseUnavailable;
257
+ /**
258
+ * The longest an install may take: generous, so a slow but moving download
259
+ * finishes, while a stalled one still ends in ERR_VERSIONS_UNAVAILABLE.
260
+ */
261
+ export const INSTALL_TIMEOUT_MS: number;
262
+ /**
263
+ * A cached, verified release.
264
+ */
265
+ export type CachedRelease = {
266
+ version: string;
267
+ /**
268
+ * the release folder
269
+ */
270
+ dir: string;
271
+ /**
272
+ * its `@astryxdesign/cli`
273
+ */
274
+ cliDir: string;
275
+ /**
276
+ * its `@astryxdesign/core`
277
+ */
278
+ coreDir: string;
279
+ /**
280
+ * the CLI's `astryx` entry file
281
+ */
282
+ bin: string;
283
+ };
284
+ /**
285
+ * The result of running npm.
286
+ */
287
+ export type NpmResult = {
288
+ status: number | null;
289
+ /**
290
+ * the signal that ended npm, such as Ctrl-C's
291
+ */
292
+ signal?: NodeJS.Signals | null | undefined;
293
+ stdout: string;
294
+ stderr: string;
295
+ error?: Error | undefined;
296
+ };
297
+ /**
298
+ * Why a release could not be made available.
299
+ */
300
+ export type ReleaseUnavailable = {
301
+ version: string;
302
+ /**
303
+ * one plain sentence
304
+ */
305
+ reason: string;
306
+ /**
307
+ * the install was stopped by this signal
308
+ */
309
+ signal?: NodeJS.Signals | undefined;
310
+ };