@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
@@ -0,0 +1,119 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx docs global/who-answers`: which version answers in each folder, the
5
+ * hand-off, and how to see who answered (spec AST-081 FR2, FR3, FR5, FR9).
6
+ */
7
+
8
+ /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
9
+ export const docs = {
10
+ type: 'generic',
11
+ name: 'who-answers',
12
+ placement: {
13
+ parent: 'namespace:global',
14
+ slot: 'guides',
15
+ order: 3,
16
+ },
17
+ title: 'Which version runs, and why',
18
+ category: 'guide',
19
+ keywords: [
20
+ 'which release',
21
+ 'wrong version',
22
+ 'different version',
23
+ 'answered by',
24
+ 'answeredBy',
25
+ 'hand-off',
26
+ 'handed over',
27
+ 'project version',
28
+ ],
29
+ description:
30
+ "Inside a project, the project's own CLI answers, whichever astryx command you start; in a project with only Core, the astryx command you started answers. Outside a project, your global install answers. How to see which one did.",
31
+ sections: [
32
+ {
33
+ id: 'in-a-project',
34
+ title: "In a project, the project's version",
35
+ content: [
36
+ {
37
+ type: 'list',
38
+ style: 'unordered',
39
+ items: [
40
+ "The project installs the CLI, as recommended: that CLI answers, whatever its version, as it always has. When you type the global astryx command instead, it passes the run to the project's CLI, with the same arguments, input, output, and exit status, so either command gives the same answer.",
41
+ "The project installs only Core, or nothing is installed yet, as in a fresh clone: the astryx command you started answers, as it always has. When its version differs from the project's Core, a hint after the command, once a day, names the command that adds the CLI at Core's version.",
42
+ "The project's CLI is installed but cannot start: the CLI version equal to the project's Core answers instead (from the installed Core, else the lockfile, else the newest one the declared range allows), installed once into a cache.",
43
+ ],
44
+ },
45
+ {
46
+ type: 'prose',
47
+ text: "Components come from `@astryxdesign/core`, and templates, docs, and agent guides come from the CLI. In a project, that Core is the one the project installs, so component commands work offline once the project's dependencies are installed. Outside a project, or in a project with nothing installed yet (a fresh clone), they use the answering version's own Core, from beside the CLI or the cache; when that Core cannot be downloaded, the error says to install the project's dependencies. When the project's CLI and Core are different versions, `astryx doctor` warns and prints the command that brings them to one version.",
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ id: 'outside',
53
+ title: 'Outside a project, your global install',
54
+ content: [
55
+ {
56
+ type: 'prose',
57
+ text: 'In a folder that belongs to no project, your global install answers as a brand-new project on its version would, so you and your agents can read every component and doc. It never installs a newer version by itself.',
58
+ },
59
+ {
60
+ type: 'prose',
61
+ text: 'A few commands work on your computer rather than a folder, such as `astryx init --user`: your global install answers them in any folder.',
62
+ },
63
+ ],
64
+ },
65
+ {
66
+ id: 'see-it',
67
+ title: 'See which version answered',
68
+ content: [
69
+ {
70
+ type: 'prose',
71
+ text: 'In a project with only Core, the hint looks like this, after the command, at most once a day per project:',
72
+ },
73
+ {
74
+ type: 'code',
75
+ lang: 'text',
76
+ code: 'astryx: this project has no Astryx CLI installed; answered by CLI 0.7.2 while its Core is 0.6.8. To match, run: npm install @astryxdesign/cli@0.6.8',
77
+ },
78
+ {
79
+ type: 'prose',
80
+ text: "Otherwise, in text mode, one line on standard error names the version, unless the project's own CLI answered directly:",
81
+ },
82
+ {
83
+ type: 'code',
84
+ lang: 'text',
85
+ code: "astryx: answered by this project's CLI 0.6.8, handed over from CLI 0.7.2\nastryx: answered by CLI 0.6.8 with Core 0.6.8, the release that matches this project's Core\nastryx: answered by CLI 0.7.2 with Core 0.7.2, outside a project\nastryx: answered by CLI 0.7.2 with Core 0.7.2, for this computer",
86
+ },
87
+ {
88
+ type: 'prose',
89
+ text: 'With `--json` nothing extra prints; every result carries `meta.answeredBy` instead ({@link generic:reference}):',
90
+ },
91
+ {
92
+ type: 'code',
93
+ lang: 'json',
94
+ code: '{"meta": {"answeredBy": {"cli": "0.7.2", "core": "0.6.8", "copy": "starting"}}}',
95
+ },
96
+ ],
97
+ },
98
+ {
99
+ id: 'printed-commands',
100
+ title: 'Commands Astryx prints',
101
+ content: [
102
+ {
103
+ type: 'prose',
104
+ text: "Commands the CLI prints for you to run start with a name that reaches the same version: the project's runner (such as `pnpm exec astryx`) in a project, `astryx` outside a project when your global install answered, and otherwise the CLI pinned to the version, such as `npx @astryxdesign/cli@0.6.8`. An integration can name its own command: {@link generic:cli-command}.",
105
+ },
106
+ ],
107
+ },
108
+ {
109
+ id: 'more',
110
+ title: 'More on global mode',
111
+ content: [
112
+ {
113
+ type: 'prose',
114
+ text: 'This page is part of {@link namespace:global}, which explains what global mode is and how each part works. To check your computer, run `astryx doctor` outside any project ({@link command:doctor}). Monorepos: {@link generic:monorepos}.',
115
+ },
116
+ ],
117
+ },
118
+ ],
119
+ };
@@ -44,13 +44,13 @@ export const docs = {
44
44
  type: 'code',
45
45
  lang: 'bash',
46
46
  code: `# Page: src/app/account/page.tsx
47
- npx astryx template acme-account src/app/account
47
+ astryx template acme-account src/app/account
48
48
 
49
49
  # Block: src/features/account/acme-stat-card.tsx
50
- npx astryx template acme-stat-card src/features/account
50
+ astryx template acme-stat-card src/features/account
51
51
 
52
52
  # Exact destination for either kind
53
- npx astryx template acme-stat-card src/features/account/StatusCard.tsx`,
53
+ astryx template acme-stat-card src/features/account/StatusCard.tsx`,
54
54
  },
55
55
  {
56
56
  type: 'prose',
@@ -36,7 +36,7 @@ export const docs = {
36
36
  type: 'code',
37
37
  lang: 'text',
38
38
  label: 'Paste this into your AI',
39
- code: 'Install @astryxdesign/cli and run `npx @astryxdesign/cli init --features agents` to set up your Astryx context. Read the generated file.',
39
+ code: 'Install @astryxdesign/cli and run `astryx init --features agents` to set up your Astryx context. Read the generated file.',
40
40
  },
41
41
  {
42
42
  type: 'prose',
@@ -50,12 +50,16 @@ export const docs = {
50
50
  type: 'code',
51
51
  lang: 'bash',
52
52
  label: 'Manual options',
53
- code: `npx @astryxdesign/cli init --features agents --agent claude # CLAUDE.md if present, else .claude/CLAUDE.md
54
- npx @astryxdesign/cli init --features agents --agent cursor # .cursorrules if present, else AGENTS.md
55
- npx @astryxdesign/cli init --features agents --agent codex # AGENTS.md (Copilot, Codex, etc.)
56
- npx @astryxdesign/cli init --features agents --agent hermes # .hermes.md or HERMES.md if present, else AGENTS.md
57
- npx @astryxdesign/cli init --features agents --agent muse # AGENTS.md (Muse)
58
- npx @astryxdesign/cli init --features agents --agent all # every agent file present, else AGENTS.md and .claude/CLAUDE.md`,
53
+ code: `astryx init --features agents --agent claude # CLAUDE.md if present, else .claude/CLAUDE.md
54
+ astryx init --features agents --agent cursor # .cursorrules if present, else AGENTS.md
55
+ astryx init --features agents --agent codex # AGENTS.md (Copilot, Codex, etc.)
56
+ astryx init --features agents --agent hermes # .hermes.md or HERMES.md if present, else AGENTS.md
57
+ astryx init --features agents --agent muse # AGENTS.md (Muse)
58
+ astryx init --features agents --agent all # every agent file present, else AGENTS.md and .claude/CLAUDE.md`,
59
+ },
60
+ {
61
+ type: 'prose',
62
+ text: "For agents that work outside any one project, your global install keeps one short Astryx skill, `~/.agents/skills/astryx/SKILL.md`, linked into the skill folders agent tools read, such as `~/.claude/skills/astryx`. It tells agents Astryx is there and when to use it; `astryx init --user` writes it now or, with `--remove-agents`, turns it off. Inside a project, agents follow that project's own agent docs. See {@link generic:computer-agent-guide}.",
59
63
  },
60
64
  ],
61
65
  },
@@ -92,7 +96,7 @@ npx @astryxdesign/cli init --features agents --agent all # every agent fil
92
96
  type: 'code',
93
97
  lang: 'bash',
94
98
  label: 'Install as a Cursor project rule',
95
- code: `npx @astryxdesign/cli init --features agents --agent-docs-path .cursor/rules/astryx.mdc`,
99
+ code: `astryx init --features agents --agent-docs-path .cursor/rules/astryx.mdc`,
96
100
  },
97
101
  {
98
102
  type: 'prose',
@@ -117,7 +121,7 @@ npx @astryxdesign/cli init --features agents --agent all # every agent fil
117
121
  2. How do you make a Dialog non-dismissible?
118
122
  3. What prop does Selector use for its items?
119
123
 
120
- If you don't know all three, run \`npx @astryxdesign/cli init --features agents\` to generate agent docs, then read the generated file.`,
124
+ If you don't know all three, run \`astryx init --features agents\` to generate agent docs, then read the generated file.`,
121
125
  },
122
126
  ],
123
127
  },
@@ -242,5 +246,15 @@ astryx docs principles --dense`,
242
246
  },
243
247
  ],
244
248
  },
249
+ {
250
+ id: 'global-mode',
251
+ title: 'In global mode',
252
+ content: [
253
+ {
254
+ type: 'prose',
255
+ text: "In global mode: your global install keeps one Astryx skill in your home folder, linked into the folders agent tools read, so agents outside any project know Astryx is there; inside a project, its own agent docs come first. See {@link namespace:global} and {@link generic:computer-agent-guide}.",
256
+ },
257
+ ],
258
+ },
245
259
  ],
246
260
  };
@@ -44,9 +44,9 @@ declare const eventSchema: z.ZodObject<{
44
44
  args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
45
45
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
46
  optionSources: z.ZodRecord<z.ZodString, z.ZodEnum<{
47
- default: "default";
48
47
  cli: "cli";
49
48
  env: "env";
49
+ default: "default";
50
50
  config: "config";
51
51
  implied: "implied";
52
52
  }>>;
@@ -75,16 +75,16 @@ declare const eventSchema: z.ZodObject<{
75
75
  resultCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
76
76
  emptyResult: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
77
77
  resultKind: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
78
- theme: "theme";
79
- component: "component";
80
78
  command: "command";
79
+ none: "none";
80
+ component: "component";
81
81
  hook: "hook";
82
- template: "template";
83
82
  doc: "doc";
83
+ template: "template";
84
+ theme: "theme";
84
85
  integration: "integration";
85
86
  migration: "migration";
86
87
  mixed: "mixed";
87
- none: "none";
88
88
  }>>>;
89
89
  directMatch: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
90
90
  stdout: z.ZodString;
@@ -135,4 +135,10 @@ export const doc = {
135
135
  '};',
136
136
  },
137
137
  ],
138
+ notes: [
139
+ {
140
+ type: 'prose',
141
+ text: "In global mode: the discover source of an integration installed for the computer is called in folders outside any project; inside a project, only the sources of integrations the project installs are. See {@link namespace:global} and {@link generic:global-integrations}.",
142
+ },
143
+ ],
138
144
  };
@@ -4,12 +4,12 @@
4
4
  /** Every authored doc-kind discriminant accepted by parseDoc. */
5
5
  export const AuthoredDocKindSchema: z.ZodEnum<{
6
6
  function: "function";
7
+ command: "command";
7
8
  component: "component";
8
9
  generic: "generic";
9
10
  page: "page";
10
11
  block: "block";
11
12
  schema: "schema";
12
- command: "command";
13
13
  enum: "enum";
14
14
  namespace: "namespace";
15
15
  }>;
@@ -497,6 +497,11 @@ export const CommandDocKindSchema: z.ZodObject<{
497
497
  code: z.ZodNumber;
498
498
  when: z.ZodString;
499
499
  }, z.core.$loose>>>;
500
+ outsideProject: z.ZodOptional<z.ZodEnum<{
501
+ same: "same";
502
+ refuse: "refuse";
503
+ own: "own";
504
+ }>>;
500
505
  related: z.ZodOptional<z.ZodArray<z.ZodString>>;
501
506
  notes: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
502
507
  type: z.ZodLiteral<"prose">;
@@ -582,12 +587,12 @@ export const NamespaceDocKindSchema: z.ZodObject<{
582
587
  accepts: z.ZodObject<{
583
588
  kinds: z.ZodArray<z.ZodEnum<{
584
589
  function: "function";
590
+ command: "command";
585
591
  component: "component";
586
592
  generic: "generic";
587
593
  page: "page";
588
594
  block: "block";
589
595
  schema: "schema";
590
- command: "command";
591
596
  enum: "enum";
592
597
  namespace: "namespace";
593
598
  }>>;
@@ -602,12 +607,12 @@ export const NamespaceDocKindSchema: z.ZodObject<{
602
607
  group: z.ZodString;
603
608
  kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
604
609
  function: "function";
610
+ command: "command";
605
611
  component: "component";
606
612
  generic: "generic";
607
613
  page: "page";
608
614
  block: "block";
609
615
  schema: "schema";
610
- command: "command";
611
616
  enum: "enum";
612
617
  namespace: "namespace";
613
618
  }>>>;
@@ -574,6 +574,7 @@ export const CommandDocKindSchema = z
574
574
  exitCodes: z
575
575
  .array(z.object({code: z.number(), when: z.string()}).passthrough())
576
576
  .optional(),
577
+ outsideProject: z.enum(['same', 'refuse', 'own']).optional(),
577
578
  related: z.array(z.string()).optional(),
578
579
  notes: z.array(ReferenceContentBlockSchema).optional(),
579
580
  })
@@ -198,6 +198,12 @@ export const doc = {
198
198
  },
199
199
  ],
200
200
  },
201
+ {
202
+ name: 'outsideProject',
203
+ type: "'same' | 'refuse' | 'own'",
204
+ description:
205
+ 'What the command does outside a project. `same`: the answer it gives in a new project. `refuse`: it writes nothing and fails, naming the app project or integration package it needs. `own`: something else. Every `refuse` and `own` command also carries an `In global mode:` note in its `notes` that tells readers exactly what it does. Every command and subcommand declares one, and `astryx manifest` publishes it; a command that only groups subcommands declares none. The CLI tests run every command in an empty folder and check what it does against this value; `astryx doctor` does not check it.',
206
+ },
201
207
  {
202
208
  name: 'deprecated',
203
209
  type: 'string',
@@ -40,6 +40,18 @@ export interface CommandOptionDoc {
40
40
  cliOnly?: boolean;
41
41
  }
42
42
 
43
+ /**
44
+ * What a command does in a folder outside any project:
45
+ * - `same`: it gives the answer it gives in a new project, reading the Core
46
+ * the answering release carries.
47
+ * - `refuse`: it writes nothing and fails before doing any work, naming the app
48
+ * project or integration package it needs.
49
+ * - `own`: it does something else.
50
+ * Every `refuse` and `own` command also carries an `In global mode:` note
51
+ * in its `notes`, for readers.
52
+ */
53
+ export type CommandOutsideProject = 'same' | 'refuse' | 'own';
54
+
43
55
  export interface CommandExampleDoc {
44
56
  label?: string;
45
57
  /** A full terminal invocation, e.g. 'astryx search button --json'. */
@@ -81,6 +93,8 @@ export interface CommandDoc extends AuthoredDocGraphFields {
81
93
  examples?: CommandExampleDoc[];
82
94
  /** Documented exit codes. */
83
95
  exitCodes?: {code: number; when: string}[];
96
+ /** What the command does outside a project: `same`, `refuse`, or `own`. Every command and subcommand declares one, and `astryx manifest` publishes it; a command that only groups subcommands declares none. */
97
+ outsideProject?: CommandOutsideProject;
84
98
  /** Deprecation notice — a DEP-* id and the replacement. */
85
99
  deprecated?: string;
86
100
  /** Related command names; the CLI links each to its doc. */
@@ -152,7 +152,7 @@ export default {
152
152
  },
153
153
  {
154
154
  type: 'prose',
155
- text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref, plus the reference block (ReferenceDocBlock). A read inlines a reference block the way it inlines a token-ref, so `astryx docs`, in text and in `--json`, returns only the stable block kinds. Docs-graph-only workflow and collection blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.',
155
+ text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref, plus the reference block (ReferenceDocBlock). A read inlines a reference block the way it inlines a token-ref, so `astryx docs`, in text and in `--json`, returns only the stable block kinds. Docs-graph-only workflow and collection blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc. Write a CLI command in text, shell code, or a table cell as a bare `astryx` command: a text read adds the runner the reader uses in front of it, and `--json` returns it as written.',
156
156
  },
157
157
  {
158
158
  type: 'prose',
@@ -163,6 +163,7 @@ export type {
163
163
  CommandArgDoc,
164
164
  CommandOptionDoc,
165
165
  CommandExampleDoc,
166
+ CommandOutsideProject,
166
167
  // enum
167
168
  EnumMemberDoc,
168
169
  } from './doctypes/types.js';
@@ -16,7 +16,7 @@ export const doc = {
16
16
  'The astryx.integration.* manifest that sits beside an integration ' +
17
17
  "package's package.json. It can preserve a stable provider identity across a package rename, " +
18
18
  "and points the CLI at the package's components, templates, codemods, doc topics, " +
19
- 'source themes, managed agent guidance, and issue tracker. Every field is optional.',
19
+ 'source themes, managed agent guidance, issue tracker, and the command its users run the CLI with. Every field is optional.',
20
20
  appliesTo: 'astryx.integration.{ts,mjs,js}',
21
21
  fields: [
22
22
  {
@@ -82,6 +82,13 @@ export const doc = {
82
82
  "Link to this integration's docs site, such as its home page. Catalogs that list the package may show it.",
83
83
  example: "'https://widgets.acme.dev'",
84
84
  },
85
+ {
86
+ name: 'cliCommand',
87
+ type: 'string',
88
+ description:
89
+ 'The command your users run the Astryx CLI with, when it is not their package manager, such as a wrapper your company ships. Every command the CLI prints in an app that loads your package starts with it, in place of `pnpm exec astryx` or `yarn astryx`: hints, errors, Doctor fixes, and doc text. One line, without a subcommand. If two loaded packages set different commands, neither is used and `astryx doctor` warns. An invalid value is ignored with an `invalid_cli_command` warning, and the rest of the manifest still loads. JSON output keeps commands bare.',
90
+ example: "'acme astryx'",
91
+ },
85
92
  ],
86
93
  examples: [
87
94
  {
@@ -100,6 +107,10 @@ export const doc = {
100
107
  },
101
108
  ],
102
109
  notes: [
110
+ {
111
+ type: 'prose',
112
+ text: "In global mode: a manifest loads the same way when users install your package for their computer, beside the global CLI, and then applies in folders outside any project; inside a project, only if the project installs it. Peer ranges for `@astryxdesign/core` and `@astryxdesign/cli` are checked against the global CLI's release. See {@link namespace:global} and {@link generic:global-integrations}.",
113
+ },
103
114
  {
104
115
  type: 'prose',
105
116
  text:
@@ -115,7 +126,12 @@ export const doc = {
115
126
  'trimmed, non-blank string of at most 240 Unicode code points with no ' +
116
127
  'line separators, control characters, NUL, or Astryx/XDS managed-marker ' +
117
128
  'text. The configured project may contain at most 32 integration lines ' +
118
- 'total.',
129
+ 'total. Write each command in a line as a bare `astryx` command; the ' +
130
+ 'managed block says once, before your lines, how the app starts the CLI.',
131
+ },
132
+ {
133
+ type: 'prose',
134
+ text: "Set `cliCommand` only when your users run the CLI with a command other than their package manager's, such as `acme astryx`. The CLI picks the command it prints in this order: the `cliCommand` of the loaded integrations when they name one command, then the command a host tool names, then the package manager's. Two different `cliCommand` values cancel out, and `astryx doctor` warns in its `cli-command` check. See `astryx docs cli/integrations/building-blocks/configuration/cli-command`.",
119
135
  },
120
136
  {
121
137
  type: 'prose',
@@ -97,6 +97,17 @@ describe('parseIntegration (load boundary)', () => {
97
97
  expect(reason({docsiteUrl: 'nope'})).toContain('docsiteUrl');
98
98
  });
99
99
 
100
+ it('accepts a cliCommand and rejects one that is not a single clean line', () => {
101
+ expect(parseIntegration({cliCommand: 'acme astryx'})).toEqual({
102
+ cliCommand: 'acme astryx',
103
+ });
104
+ expect(reason({cliCommand: ''})).toContain('cliCommand');
105
+ expect(reason({cliCommand: ' acme astryx'})).toContain('cliCommand');
106
+ expect(reason({cliCommand: 'acme\nastryx'})).toContain('cliCommand');
107
+ expect(reason({cliCommand: 'a'.repeat(121)})).toContain('120');
108
+ expect(reason({cliCommand: 42})).toContain('cliCommand');
109
+ });
110
+
100
111
  it('rejects a noncanonical providerId', () => {
101
112
  expect(reason({providerId: 'Acme Widgets'})).toContain('providerId');
102
113
  });
@@ -3,12 +3,12 @@
3
3
 
4
4
  /**
5
5
  * Parse every default-manifest field except the independently isolated
6
- * `agentDocs` contribution.
6
+ * `agentDocs` and `cliCommand` fields.
7
7
  * @param {unknown} input
8
8
  * @param {string} label
9
- * @returns {Omit<AstryxIntegration, 'agentDocs'>}
9
+ * @returns {Omit<AstryxIntegration, 'agentDocs' | 'cliCommand'>}
10
10
  */
11
- export function parseIntegrationBase(input: unknown, label: string): Omit<AstryxIntegration, "agentDocs">;
11
+ export function parseIntegrationBase(input: unknown, label: string): Omit<AstryxIntegration, "agentDocs" | "cliCommand">;
12
12
  /**
13
13
  * Parse only the optional agent-doc contribution.
14
14
  * @param {unknown} input
@@ -16,6 +16,15 @@ export function parseIntegrationBase(input: unknown, label: string): Omit<Astryx
16
16
  * @returns {NonNullable<AstryxIntegration['agentDocs']>}
17
17
  */
18
18
  export function parseAgentDocsField(input: unknown, label: string): NonNullable<AstryxIntegration["agentDocs"]>;
19
+ /**
20
+ * Parse only the optional `cliCommand` field. Isolated like `agentDocs`: an
21
+ * invalid command is ignored with a warning, and the rest of the manifest
22
+ * still contributes.
23
+ * @param {unknown} input
24
+ * @param {string} label
25
+ * @returns {string}
26
+ */
27
+ export function parseCliCommandField(input: unknown, label: string): string;
19
28
  /**
20
29
  * The manifest keys this CLI does not know, in the order they were authored.
21
30
  *
@@ -28,6 +37,7 @@ export function parseAgentDocsField(input: unknown, label: string): NonNullable<
28
37
  * @returns {string[]}
29
38
  */
30
39
  export function unknownIntegrationKeys(input: unknown): string[];
40
+ export const cliCommandSchema: z.ZodString;
31
41
  export const agentDocsSchema: z.ZodObject<{
32
42
  append: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
33
43
  }, z.core.$strip>;
@@ -53,6 +63,7 @@ export const integrationSchema: z.ZodObject<{
53
63
  agentDocs: z.ZodOptional<z.ZodObject<{
54
64
  append: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
55
65
  }, z.core.$strip>>;
66
+ cliCommand: z.ZodOptional<z.ZodString>;
56
67
  }, z.core.$strip>;
57
68
  /**
58
69
  * Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
@@ -19,6 +19,7 @@ import {formatZodError} from '../_shared/errors.mjs';
19
19
  /** @typedef {import('./type.js').AstryxIntegration} AstryxIntegration */
20
20
 
21
21
  const MAX_AGENT_DOC_LINES = 8;
22
+ const MAX_CLI_COMMAND_CODE_POINTS = 120;
22
23
  const MAX_AGENT_DOC_LINE_CODE_POINTS = 240;
23
24
  const MANAGED_MARKER_TEXT = /(?:ASTRYX|XDS):(START|END)/u;
24
25
  const PROVIDER_ID_RE =
@@ -51,6 +52,21 @@ function invalidAgentDocLine(value) {
51
52
  return null;
52
53
  }
53
54
 
55
+ export const cliCommandSchema = z.string().superRefine((value, ctx) => {
56
+ const message = invalidAgentDocLine(value);
57
+ if (message) {
58
+ ctx.addIssue({code: 'custom', message});
59
+ return;
60
+ }
61
+ const codePoints = [...value].length;
62
+ if (codePoints > MAX_CLI_COMMAND_CODE_POINTS) {
63
+ ctx.addIssue({
64
+ code: 'custom',
65
+ message: `must contain at most ${MAX_CLI_COMMAND_CODE_POINTS} Unicode code points (received ${codePoints})`,
66
+ });
67
+ }
68
+ });
69
+
54
70
  const agentDocLineSchema = z.string().superRefine((value, ctx) => {
55
71
  const message = invalidAgentDocLine(value);
56
72
  if (message) ctx.addIssue({code: 'custom', message});
@@ -92,14 +108,15 @@ export const integrationBaseSchema = z.object({
92
108
  // IS an authoring mistake and still fails here.
93
109
  export const integrationSchema = integrationBaseSchema.extend({
94
110
  agentDocs: agentDocsSchema.optional(),
111
+ cliCommand: cliCommandSchema.optional(),
95
112
  });
96
113
 
97
114
  /**
98
115
  * Parse every default-manifest field except the independently isolated
99
- * `agentDocs` contribution.
116
+ * `agentDocs` and `cliCommand` fields.
100
117
  * @param {unknown} input
101
118
  * @param {string} label
102
- * @returns {Omit<AstryxIntegration, 'agentDocs'>}
119
+ * @returns {Omit<AstryxIntegration, 'agentDocs' | 'cliCommand'>}
103
120
  */
104
121
  export function parseIntegrationBase(input, label) {
105
122
  const result = integrationBaseSchema.safeParse(input);
@@ -119,6 +136,20 @@ export function parseAgentDocsField(input, label) {
119
136
  return result.data;
120
137
  }
121
138
 
139
+ /**
140
+ * Parse only the optional `cliCommand` field. Isolated like `agentDocs`: an
141
+ * invalid command is ignored with a warning, and the rest of the manifest
142
+ * still contributes.
143
+ * @param {unknown} input
144
+ * @param {string} label
145
+ * @returns {string}
146
+ */
147
+ export function parseCliCommandField(input, label) {
148
+ const result = cliCommandSchema.safeParse(input);
149
+ if (!result.success) throw new Error(formatZodError(label, result.error));
150
+ return result.data;
151
+ }
152
+
122
153
  /**
123
154
  * Compile-time drift-lock: sealed schema must infer exactly {@link AstryxIntegration}.
124
155
  *
@@ -48,6 +48,14 @@ export interface AstryxIntegration {
48
48
  * accepts it as a known field; catalogs that list the package may show
49
49
  * it. */
50
50
  docsiteUrl?: string;
51
+ /** The command that runs the Astryx CLI for this package's users, such as
52
+ * `acme astryx`. Every command the CLI prints in a project that loads
53
+ * this package starts with it, in place of the package-manager prefix
54
+ * (`pnpm exec astryx`, `yarn astryx`). One line, no subcommand. When two
55
+ * loaded integrations set different commands, neither is used and
56
+ * `astryx doctor` warns. An invalid value is ignored with a warning; the
57
+ * rest of the manifest still loads. JSON output keeps commands bare. */
58
+ cliCommand?: string;
51
59
  }
52
60
 
53
61
  /**
@@ -14,7 +14,7 @@
14
14
  // unsupported runtimes this guard protects against.
15
15
  //
16
16
  // Sibling package modules (e.g. `cli/`, `lib/`) are resolved by this bin's REAL
17
- // path. When the CLI is installed as a package, `npx astryx` runs this file
17
+ // path. When the CLI is installed as a package, the package manager runs this file
18
18
  // through the `node_modules/.bin/astryx` symlink, and some Node versions resolve
19
19
  // relative specifiers from the symlink's directory rather than the real package
20
20
  // — breaking bare `../…` imports with a cryptic ERR_MODULE_NOT_FOUND.
@@ -53,10 +53,24 @@ if (!isNodeVersionSupported(process.versions.node)) {
53
53
  process.exit(1);
54
54
  }
55
55
 
56
+ // Global mode: choose the release that answers this folder and, when it is
57
+ // not this copy, hand the run to it before anything the project provides (its
58
+ // astryx.config, integrations, or Core) is loaded. Returns only when this copy
59
+ // answers. See foundation/release/handoff.mjs and spec AST-081 FR2 and FR9.
60
+ const {startRun} = await importSrc('../../foundation/release/handoff.mjs');
61
+ await startRun({
62
+ cliRoot: join(binDir, '..', '..', '..'),
63
+ argv: process.argv.slice(2),
64
+ });
65
+
56
66
  // Imports that transitively load `styleText` must happen AFTER the gate above,
57
67
  // so they are dynamically imported here rather than at the top of the module.
58
- const {program, loadProjectDebugHandler, handleVersionJsonPreflight} =
59
- await importSrc('index.mjs');
68
+ const {
69
+ program,
70
+ loadProjectDebugHandler,
71
+ loadProjectForHelp,
72
+ handleVersionJsonPreflight,
73
+ } = await importSrc('index.mjs');
60
74
  const {isJsonMode, toErrorEnvelope} = await importSrc('../../foundation/response/json.mjs');
61
75
  const {handleCommanderError} = await importSrc('lib/json-shim.mjs');
62
76
  const {setOutcome} = await importSrc('../../foundation/debug/index.mjs');
@@ -107,6 +121,9 @@ process.on('uncaughtException', handleFatal);
107
121
  // Pick up the project's `debug` function before parsing, so parse errors and
108
122
  // `--help` — which short-circuit before any hook runs — are reported too.
109
123
  await loadProjectDebugHandler();
124
+ // Help prints its commands while Commander parses, so a help run reads the
125
+ // project's declared `cliCommand` here.
126
+ await loadProjectForHelp();
110
127
 
111
128
  // `--version --json` answers and exits without Commander, so it runs here —
112
129
  // after the handler exists, or the run would go unrecorded.