@astryxdesign/cli 0.6.4-canary.f0355e3 → 0.6.4

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 (331) hide show
  1. package/README.md +96 -99
  2. package/api/build/build.doc.mjs +1 -6
  3. package/api/build/build.test.mjs +0 -22
  4. package/api/build/kit/kit.mjs +5 -44
  5. package/api/component/_adapter.d.mts +0 -25
  6. package/api/component/_adapter.mjs +5 -59
  7. package/api/component/component.d.mts +3 -6
  8. package/api/component/component.doc.mjs +17 -37
  9. package/api/component/component.mjs +9 -249
  10. package/api/component/component.type.d.mts +0 -25
  11. package/api/component/component.type.mjs +0 -44
  12. package/api/discover/_adapter.d.mts +6 -114
  13. package/api/discover/_adapter.mjs +17 -372
  14. package/api/discover/detail/detail.d.mts +6 -18
  15. package/api/discover/detail/detail.mjs +13 -67
  16. package/api/discover/detail/detail.test.mjs +0 -85
  17. package/api/discover/discover.d.mts +9 -3
  18. package/api/discover/discover.doc.mjs +18 -61
  19. package/api/discover/discover.mjs +36 -220
  20. package/api/discover/discover.test.mjs +2 -11
  21. package/api/discover/discover.type.d.mts +8 -147
  22. package/api/discover/discover.type.mjs +12 -102
  23. package/api/discover/list/list.d.mts +6 -20
  24. package/api/discover/list/list.mjs +12 -45
  25. package/api/discover/list/list.test.mjs +0 -46
  26. package/api/discover/search/search.d.mts +16 -18
  27. package/api/discover/search/search.mjs +56 -102
  28. package/api/discover/search/search.test.mjs +10 -144
  29. package/api/docs/_adapter.d.mts +3 -8
  30. package/api/docs/_adapter.mjs +6 -14
  31. package/api/docs/docOverlays.test.mjs +1 -27
  32. package/api/docs/docs.doc.mjs +2 -2
  33. package/api/docs/docs.test.mjs +243 -0
  34. package/api/docs/integration-tree.test.mjs +555 -0
  35. package/api/docs/integrationDocs.test.mjs +314 -0
  36. package/api/doctor/doctor.d.mts +3 -8
  37. package/api/doctor/doctor.doc.mjs +8 -17
  38. package/api/doctor/doctor.mjs +9 -90
  39. package/api/doctor/doctor.test.mjs +10 -122
  40. package/api/doctor/doctor.type.d.mts +1 -1
  41. package/api/doctor/doctor.type.mjs +1 -1
  42. package/api/gap-report/gap-report.doc.mjs +10 -19
  43. package/api/hook/hook.doc.mjs +3 -6
  44. package/api/index.d.mts +2 -1
  45. package/api/index.mjs +5 -5
  46. package/api/init/init.doc.mjs +12 -17
  47. package/api/integration/add-helpers.d.mts +2 -5
  48. package/api/integration/add-helpers.mjs +9 -36
  49. package/api/integration/add-theme.mjs +1 -22
  50. package/api/integration/add-theme.test.mjs +0 -34
  51. package/api/integration/authoring-checks.mjs +2 -2
  52. package/api/integration/integrationPackCheck.doc.mjs +3 -3
  53. package/api/integration/pack-check.mjs +9 -82
  54. package/api/integration/pack-check.test.mjs +0 -90
  55. package/api/integration/pack-check.type.mjs +1 -1
  56. package/api/json/assertResponse.doc.mjs +1 -1
  57. package/api/json/index.ts +1 -0
  58. package/api/json/isError.doc.mjs +1 -1
  59. package/api/layout/_adapter.d.mts +34 -0
  60. package/api/layout/_adapter.mjs +148 -0
  61. package/api/layout/check/check.d.mts +16 -0
  62. package/api/layout/check/check.mjs +40 -0
  63. package/api/layout/expand/expand.d.mts +22 -0
  64. package/api/layout/expand/expand.mjs +155 -0
  65. package/api/layout/expand/expand.path-safety.test.mjs +53 -0
  66. package/api/layout/grammar/grammar.d.mts +13 -0
  67. package/api/layout/grammar/grammar.mjs +87 -0
  68. package/api/layout/layout.d.mts +6 -0
  69. package/api/layout/layout.mjs +17 -0
  70. package/api/layout/layout.test.mjs +297 -0
  71. package/api/layout/layout.type.d.mts +89 -0
  72. package/api/layout/layout.type.mjs +103 -0
  73. package/api/layout/layoutCheck.doc.d.mts +11 -0
  74. package/api/layout/layoutCheck.doc.mjs +85 -0
  75. package/api/layout/layoutExpand.doc.d.mts +11 -0
  76. package/api/layout/layoutExpand.doc.mjs +107 -0
  77. package/api/layout/layoutGrammar.doc.d.mts +11 -0
  78. package/api/layout/layoutGrammar.doc.mjs +57 -0
  79. package/api/search/search.d.mts +1 -27
  80. package/api/search/search.doc.mjs +2 -2
  81. package/api/search/search.mjs +16 -228
  82. package/api/search/search.test.mjs +512 -0
  83. package/api/swizzle/swizzle.doc.mjs +5 -7
  84. package/api/template/copy/copy.mjs +1 -1
  85. package/api/template/copy/copy.test.mjs +0 -9
  86. package/api/template/template-integration.test.mjs +65 -1
  87. package/api/template/template.doc.mjs +1 -2
  88. package/api/template/template.mjs +1 -1
  89. package/api/theme/add/add.mjs +25 -17
  90. package/api/theme/add/add.staging.test.mjs +23 -40
  91. package/api/theme/build/build.family.test.mjs +12 -7
  92. package/api/theme/build/build.mjs +18 -8
  93. package/api/theme/generateTonalPalette.doc.mjs +2 -1
  94. package/api/theme/listThemes.doc.mjs +1 -1
  95. package/api/theme/themeAdd.doc.mjs +10 -9
  96. package/api/theme/themeBuild.doc.mjs +13 -13
  97. package/api/theme/themeList.doc.mjs +1 -1
  98. package/api/theme/themeListAvailable.doc.mjs +1 -2
  99. package/api/theme/themePaletteGenerate.doc.mjs +8 -15
  100. package/api/theme/themeTargets.doc.mjs +2 -3
  101. package/api/theme/themeTemplate.doc.mjs +1 -2
  102. package/api/upgrade/run/run.mjs +4 -6
  103. package/api/upgrade/upgrade.doc.mjs +22 -24
  104. package/api/upgrade/upgrade.type.mjs +2 -2
  105. package/assets/codemods/__tests__/runner.test.mjs +1 -3
  106. package/assets/codemods/integration-runner.mjs +3 -3
  107. package/assets/codemods/runner.mjs +4 -5
  108. package/assets/docs/README.md +2 -4
  109. package/assets/docs/browser-support.doc.mjs +11 -11
  110. package/assets/docs/color.doc.mjs +2 -8
  111. package/assets/docs/elevation.doc.mjs +4 -6
  112. package/assets/docs/getting-started.doc.mjs +16 -5
  113. package/assets/docs/icons.doc.mjs +21 -2
  114. package/assets/docs/illustrations.doc.mjs +15 -7
  115. package/assets/docs/internationalization.doc.mjs +5 -7
  116. package/assets/docs/layout.doc.dense.mjs +82 -130
  117. package/assets/docs/layout.doc.mjs +77 -133
  118. package/assets/docs/migration.doc.mjs +21 -19
  119. package/assets/docs/motion.doc.mjs +3 -16
  120. package/assets/docs/principles.doc.dense.mjs +5 -5
  121. package/assets/docs/principles.doc.mjs +0 -8
  122. package/assets/docs/principles.doc.zh.mjs +6 -6
  123. package/assets/docs/shape.doc.mjs +3 -8
  124. package/assets/docs/spacing.doc.mjs +2 -7
  125. package/assets/docs/styling-libraries.doc.mjs +2 -6
  126. package/assets/docs/styling.doc.mjs +23 -19
  127. package/assets/docs/theme.doc.dense.mjs +18 -58
  128. package/assets/docs/theme.doc.mjs +46 -56
  129. package/assets/docs/theme.doc.zh.mjs +8 -9
  130. package/assets/docs/tokens.doc.dense.mjs +2 -2
  131. package/assets/docs/tokens.doc.mjs +8 -389
  132. package/assets/docs/tokens.doc.zh.mjs +2 -2
  133. package/assets/docs/tree/integrations.doc.mjs +451 -25
  134. package/assets/docs/tree/integrations.test.mjs +62 -0
  135. package/assets/docs/tree/writing-docs.doc.mjs +286 -0
  136. package/assets/docs/typography.doc.mjs +4 -24
  137. package/assets/docs/working-with-ai.doc.mjs +22 -30
  138. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  139. package/authoring/config/config.doc.mjs +2 -10
  140. package/authoring/config/parse.d.mts +0 -2
  141. package/authoring/config/parse.mjs +0 -19
  142. package/authoring/config/parse.test.mjs +0 -8
  143. package/authoring/config/type.ts +2 -13
  144. package/authoring/doctypes/_schema.d.mts +2 -3
  145. package/authoring/doctypes/_schema.mjs +0 -6
  146. package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
  147. package/authoring/doctypes/base/type.ts +2 -4
  148. package/authoring/doctypes/command/command.doc.mjs +1 -1
  149. package/authoring/doctypes/command/type.ts +1 -1
  150. package/authoring/doctypes/component/component.doc.mjs +0 -6
  151. package/authoring/doctypes/component/type.ts +0 -8
  152. package/authoring/doctypes/reference/reference.doc.mjs +0 -7
  153. package/authoring/doctypes/reference/type.ts +0 -5
  154. package/authoring/doctypes/schema/schema.doc.mjs +2 -2
  155. package/authoring/doctypes/template/template.doc.mjs +1 -1
  156. package/authoring/doctypes/template/type.ts +2 -2
  157. package/authoring/index.d.mts +0 -1
  158. package/authoring/index.d.ts +0 -10
  159. package/authoring/index.mjs +0 -1
  160. package/authoring/integration/integration.doc.mjs +10 -12
  161. package/clients/cli/command-result-coverage.test.mjs +7 -7
  162. package/clients/cli/commands/component/index.mjs +55 -152
  163. package/clients/cli/commands/component-ownership.test.mjs +0 -89
  164. package/clients/cli/commands/component.doc.mjs +9 -27
  165. package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
  166. package/clients/cli/commands/discover.doc.mjs +9 -53
  167. package/clients/cli/commands/discover.mjs +118 -393
  168. package/clients/cli/commands/docs.doc.mjs +1 -1
  169. package/clients/cli/commands/docs.mjs +17 -60
  170. package/clients/cli/commands/docs.test.mjs +294 -0
  171. package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -3
  172. package/clients/cli/commands/doctor-integration.test.mjs +0 -53
  173. package/clients/cli/commands/doctor.doc.mjs +1 -3
  174. package/clients/cli/commands/doctor.mjs +5 -49
  175. package/clients/cli/commands/gap-report.doc.mjs +9 -10
  176. package/clients/cli/commands/init.doc.mjs +6 -9
  177. package/clients/cli/commands/integration-add.doc.mjs +9 -9
  178. package/clients/cli/commands/integration-authoring.test.mjs +10 -61
  179. package/clients/cli/commands/integration-pack.doc.mjs +9 -5
  180. package/clients/cli/commands/integration-real-world.test.mjs +1 -1
  181. package/clients/cli/commands/integration.doc.mjs +4 -4
  182. package/clients/cli/commands/integration.mjs +43 -74
  183. package/clients/cli/commands/layout-check.doc.mjs +65 -0
  184. package/clients/cli/commands/layout-expand.doc.mjs +83 -0
  185. package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
  186. package/clients/cli/commands/layout.doc.mjs +34 -0
  187. package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
  188. package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
  189. package/clients/cli/commands/layout.mjs +275 -0
  190. package/clients/cli/commands/layout.path-help.test.mjs +33 -0
  191. package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
  192. package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
  193. package/clients/cli/commands/manifest.doc.mjs +1 -1
  194. package/clients/cli/commands/search.doc.mjs +3 -10
  195. package/clients/cli/commands/search.mjs +2 -21
  196. package/clients/cli/commands/search.test.mjs +4 -21
  197. package/clients/cli/commands/swizzle.doc.mjs +1 -1
  198. package/clients/cli/commands/template.doc.mjs +1 -1
  199. package/clients/cli/commands/text-json-parity.test.mjs +16 -5
  200. package/clients/cli/commands/theme-add.doc.mjs +1 -1
  201. package/clients/cli/commands/theme-palette-generate.doc.mjs +2 -3
  202. package/clients/cli/commands/theme-palette.doc.mjs +2 -1
  203. package/clients/cli/commands/theme-targets.doc.mjs +2 -2
  204. package/clients/cli/commands/theme.doc.mjs +1 -2
  205. package/clients/cli/commands/upgrade.doc.mjs +3 -62
  206. package/clients/cli/index.mjs +10 -28
  207. package/clients/cli/lib/define-command.mjs +4 -28
  208. package/clients/cli/lib/define-command.test.mjs +0 -54
  209. package/clients/cli/lib/exit-codes.test.mjs +9 -18
  210. package/clients/cli/lib/json-shim.mjs +14 -24
  211. package/clients/cli/lib/json-shim.test.mjs +20 -6
  212. package/clients/cli/lib/manifest.mjs +13 -18
  213. package/clients/cli/lib/manifest.test.mjs +2 -5
  214. package/foundation/agent-docs/agent-docs.mjs +1 -1
  215. package/foundation/agent-docs/agent-docs.test.mjs +1159 -0
  216. package/foundation/discovery/authoring-self-docs.mjs +0 -1
  217. package/foundation/discovery/authoring-self-docs.test.mjs +2 -6
  218. package/foundation/discovery/cli-self-docs.mjs +2 -16
  219. package/foundation/discovery/cli-self-docs.test.mjs +0 -20
  220. package/foundation/discovery/docs-discovery.mjs +1 -5
  221. package/foundation/discovery/docs-discovery.test.mjs +0 -21
  222. package/foundation/discovery/docs-section-key.d.mts +1 -1
  223. package/foundation/discovery/docs-section-key.mjs +1 -1
  224. package/foundation/discovery/template-adapter.mjs +1 -1
  225. package/foundation/doc-compiler/doc-loads.test.mjs +14 -3
  226. package/foundation/doc-compiler/tree.d.mts +0 -4
  227. package/foundation/doc-compiler/tree.mjs +1 -6
  228. package/foundation/doc-compiler/tree.test.mjs +598 -0
  229. package/foundation/integrations/cli-requirement.d.mts +6 -26
  230. package/foundation/integrations/cli-requirement.mjs +11 -46
  231. package/foundation/integrations/cli-requirement.test.mjs +2 -7
  232. package/foundation/integrations/contribution-inventory.mjs +1 -1
  233. package/foundation/integrations/integrations.d.mts +1 -14
  234. package/foundation/integrations/integrations.mjs +1 -41
  235. package/foundation/integrations/integrations.test.mjs +0 -31
  236. package/foundation/response/error-codes.doc.mjs +8 -6
  237. package/foundation/response/error-codes.test.mjs +5 -30
  238. package/foundation/response/response-types.doc.d.mts +3 -4
  239. package/foundation/response/response-types.doc.mjs +27 -40
  240. package/foundation/response/response-types.doc.test.mjs +0 -23
  241. package/foundation/response/response.doc.mjs +10 -11
  242. package/foundation/xle/browser.d.mts +3 -3
  243. package/foundation/xle/browser.mjs +3 -3
  244. package/foundation/xle/expand.mjs +2 -2
  245. package/foundation/xle/parse.mjs +1 -1
  246. package/foundation/xle/print.mjs +2 -2
  247. package/foundation/xle/splice.mjs +1 -1
  248. package/package.json +9 -9
  249. package/api/discover/_adapter.test.mjs +0 -215
  250. package/api/discover/_catalog-view.d.mts +0 -115
  251. package/api/discover/_catalog-view.mjs +0 -203
  252. package/api/discover/_catalog-view.test.mjs +0 -128
  253. package/api/discover/detail/item/item.d.mts +0 -26
  254. package/api/discover/detail/item/item.mjs +0 -78
  255. package/api/discover/detail/item/item.test.mjs +0 -73
  256. package/api/integration/pack-check.lifecycle-output.test.mjs +0 -107
  257. package/api/theme/add/add.rollback.test.mjs +0 -158
  258. package/api/theme/build/build.rollback.test.mjs +0 -148
  259. package/api/upgrade/run/files-changed.test.mjs +0 -111
  260. package/assets/codemods/file-count.test.mjs +0 -163
  261. package/assets/docs/tree/add-a-component.doc.mjs +0 -75
  262. package/assets/docs/tree/add-a-theme.doc.mjs +0 -85
  263. package/assets/docs/tree/add-a-topic.doc.mjs +0 -144
  264. package/assets/docs/tree/agent-guidance.doc.mjs +0 -138
  265. package/assets/docs/tree/block-template.doc.mjs +0 -130
  266. package/assets/docs/tree/build-the-template.doc.mjs +0 -28
  267. package/assets/docs/tree/building-blocks.doc.mjs +0 -46
  268. package/assets/docs/tree/check-your-docs.doc.mjs +0 -137
  269. package/assets/docs/tree/checks.doc.mjs +0 -119
  270. package/assets/docs/tree/codemods.doc.mjs +0 -147
  271. package/assets/docs/tree/component-family.doc.mjs +0 -113
  272. package/assets/docs/tree/component-imports.doc.mjs +0 -69
  273. package/assets/docs/tree/component-lookups.doc.mjs +0 -149
  274. package/assets/docs/tree/components.doc.mjs +0 -23
  275. package/assets/docs/tree/configuration.doc.mjs +0 -23
  276. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +0 -182
  277. package/assets/docs/tree/define-the-theme.doc.mjs +0 -118
  278. package/assets/docs/tree/describe-the-component.doc.mjs +0 -57
  279. package/assets/docs/tree/docs.doc.mjs +0 -21
  280. package/assets/docs/tree/document-the-template.doc.mjs +0 -28
  281. package/assets/docs/tree/document-the-theme.doc.mjs +0 -68
  282. package/assets/docs/tree/export-template-assets.doc.mjs +0 -147
  283. package/assets/docs/tree/extend-or-replace.doc.mjs +0 -103
  284. package/assets/docs/tree/fonts-and-assets.doc.mjs +0 -106
  285. package/assets/docs/tree/generate-a-palette.doc.mjs +0 -66
  286. package/assets/docs/tree/grade-template-with-agent.doc.mjs +0 -105
  287. package/assets/docs/tree/help.doc.mjs +0 -16
  288. package/assets/docs/tree/links.doc.mjs +0 -98
  289. package/assets/docs/tree/package-and-test.doc.mjs +0 -32
  290. package/assets/docs/tree/page-template.doc.mjs +0 -71
  291. package/assets/docs/tree/publishing.doc.mjs +0 -111
  292. package/assets/docs/tree/quick-start.doc.mjs +0 -272
  293. package/assets/docs/tree/replace-a-core-component.doc.mjs +0 -104
  294. package/assets/docs/tree/replace-a-core-template.doc.mjs +0 -172
  295. package/assets/docs/tree/sections-and-placement.doc.mjs +0 -108
  296. package/assets/docs/tree/see-it-in-an-app.doc.mjs +0 -59
  297. package/assets/docs/tree/ship.doc.mjs +0 -16
  298. package/assets/docs/tree/short-and-findable.doc.mjs +0 -108
  299. package/assets/docs/tree/single-component.doc.mjs +0 -165
  300. package/assets/docs/tree/start-a-template.doc.mjs +0 -143
  301. package/assets/docs/tree/subcomponent.doc.mjs +0 -115
  302. package/assets/docs/tree/template-assets.doc.mjs +0 -64
  303. package/assets/docs/tree/template-doc-overview.doc.mjs +0 -109
  304. package/assets/docs/tree/template-fonts.doc.mjs +0 -102
  305. package/assets/docs/tree/template-grading-rubric.doc.mjs +0 -452
  306. package/assets/docs/tree/template-icons.doc.mjs +0 -97
  307. package/assets/docs/tree/template-images-media.doc.mjs +0 -127
  308. package/assets/docs/tree/template-styles.doc.mjs +0 -93
  309. package/assets/docs/tree/templates.doc.mjs +0 -34
  310. package/assets/docs/tree/test-in-an-app.doc.mjs +0 -115
  311. package/assets/docs/tree/test-template-in-app.doc.mjs +0 -128
  312. package/assets/docs/tree/themes.doc.mjs +0 -39
  313. package/assets/docs/tree/troubleshooting.doc.mjs +0 -149
  314. package/assets/docs/tree/upgrading.doc.mjs +0 -103
  315. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +0 -51
  316. package/assets/docs/tree/verify-packed-template.doc.mjs +0 -77
  317. package/assets/docs/tree/versioning.doc.mjs +0 -161
  318. package/assets/docs/tree/write-good-templates.doc.mjs +0 -64
  319. package/assets/docs/tree/write-the-template-file.doc.mjs +0 -154
  320. package/authoring/discover/discover.doc.d.mts +0 -13
  321. package/authoring/discover/discover.doc.mjs +0 -138
  322. package/authoring/discover/parse.d.mts +0 -24
  323. package/authoring/discover/parse.mjs +0 -128
  324. package/authoring/discover/parse.test.mjs +0 -124
  325. package/authoring/discover/type.ts +0 -87
  326. package/clients/cli/commands/component-batch.test.mjs +0 -341
  327. package/clients/cli/commands/discover.sources.test.mjs +0 -267
  328. package/clients/cli/commands/integration-verify.doc.mjs +0 -22
  329. package/clients/cli/lib/parse-error-format.test.mjs +0 -81
  330. package/foundation/response/batch.type.d.mts +0 -33
  331. package/foundation/response/batch.type.mjs +0 -34
@@ -39,13 +39,16 @@ export const doc = {
39
39
  name: 'type',
40
40
  type: 'string',
41
41
  description:
42
- 'Names the payload shape. Every value is listed in the response-types enum.',
42
+ 'Discriminator naming the payload shape. Each command guarantees ' +
43
+ 'its own `type` at its return; there is no central union.',
43
44
  required: true,
44
45
  },
45
46
  {
46
47
  name: 'data',
47
48
  type: 'unknown',
48
- description: "The command's payload; its shape depends on `type`.",
49
+ description:
50
+ "The command's payload. Structural by design, narrowed by the " +
51
+ 'per-command return type, not by a map in the serializer.',
49
52
  required: true,
50
53
  },
51
54
  {
@@ -61,7 +64,7 @@ export const doc = {
61
64
  type: '{ apiVersion: number; error: string; code: ErrorCode; suggestions?: Suggestion[] }',
62
65
  description:
63
66
  'Emitted for every failure in --json mode, including uncaught throws ' +
64
- 'and command-line parse errors, which are converted to this shape.',
67
+ 'and Commander parse errors, which are converted to this shape.',
65
68
  fields: [
66
69
  {
67
70
  name: 'apiVersion',
@@ -118,7 +121,7 @@ export const doc = {
118
121
  label: 'Success',
119
122
  code: `{
120
123
  "apiVersion": 1,
121
- "type": "component.detail",
124
+ "type": "component",
122
125
  "data": { "name": "Button" }
123
126
  }`,
124
127
  },
@@ -150,13 +153,9 @@ export const doc = {
150
153
  {
151
154
  type: 'prose',
152
155
  text:
153
- 'The process exit code is part of the contract too. Exit 0 means success, ' +
154
- 'and every error envelope exits 1. Some commands also exit 1 with a success ' +
155
- 'envelope when what they report failed: a failed check (layout check, doctor ' +
156
- 'and its integration subcommands, integration verify, theme build ' +
157
- '--check), a gap report that was not delivered, an upgrade left incomplete, ' +
158
- 'or init agent docs refused for a path outside the project. Read the ' +
159
- 'envelope, not the exit code, to tell them apart.',
156
+ 'The process exit code is part of the contract too: successful commands ' +
157
+ 'exit 0, and a JSON error envelope is accompanied by a non-zero exit ' +
158
+ '(jsonError exits 1).',
160
159
  },
161
160
  ],
162
161
  };
@@ -2,8 +2,8 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * Validate an expression and return both canonical surfaces. Never throws on
6
- * invalid input; returns the errors.
5
+ * Validate an expression and return both canonical surfaces — the browser
6
+ * twin of `layout check`. Never throws on invalid input; returns the errors.
7
7
  *
8
8
  * @param {string} expression
9
9
  * @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
@@ -19,7 +19,7 @@ export function checkExpression(expression: string, registry: import("./xle-ast"
19
19
  loose?: boolean | undefined;
20
20
  }): import("./browser").CheckResult;
21
21
  /**
22
- * Validate + expand to TSX.
22
+ * Validate + expand to TSX — the browser twin of `layout expand`.
23
23
  * Returns either {code, ...} or {errors} (never writes files).
24
24
  *
25
25
  * @param {string} expression
@@ -44,8 +44,8 @@ function formatIssue(issue) {
44
44
  }
45
45
 
46
46
  /**
47
- * Validate an expression and return both canonical surfaces. Never throws on
48
- * invalid input; returns the errors.
47
+ * Validate an expression and return both canonical surfaces — the browser
48
+ * twin of `layout check`. Never throws on invalid input; returns the errors.
49
49
  *
50
50
  * @param {string} expression
51
51
  * @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
@@ -85,7 +85,7 @@ export function checkExpression(expression, registry, opts = {}) {
85
85
  }
86
86
 
87
87
  /**
88
- * Validate + expand to TSX.
88
+ * Validate + expand to TSX — the browser twin of `layout expand`.
89
89
  * Returns either {code, ...} or {errors} (never writes files).
90
90
  *
91
91
  * @param {string} expression
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @input validated doc (nodes carry .bound) + registry
15
15
  * @output expand() → {code, componentsUsed, states, todos}
16
- * @position lib/xle — last stage; the browser barrel orchestrates
16
+ * @position lib/xle — last stage; api/layout.mjs orchestrates
17
17
  */
18
18
 
19
19
  import {PAYLOAD_PROPS} from './validate.mjs';
@@ -751,7 +751,7 @@ export function expand(doc, registry, options = {}) {
751
751
  : [];
752
752
 
753
753
  const code = [
754
- `// Generated by the Astryx XLE expander — this file is the artifact; edit freely.`,
754
+ `// Generated by \`astryx layout expand\` — this file is the artifact; edit freely.`,
755
755
  ...importLines,
756
756
  ...blockSection,
757
757
  '',
@@ -302,7 +302,7 @@ function parseAttrToken(token, line) {
302
302
  * Guard against unbounded recursion in the compact parser. A layout tree this
303
303
  * deep is never hand-authored; without the cap the recursive descent blows the
304
304
  * JS call stack and surfaces a raw RangeError (→ ERR_UNKNOWN, no line/col)
305
- * instead of a located parse error. The counter is module-level so it
305
+ * instead of a located ERR_LAYOUT_PARSE. The counter is module-level so it
306
306
  * spans group / attribute sub-streams; each parse entry point resets it.
307
307
  */
308
308
  const MAX_COMPACT_DEPTH = 512;
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @file XLE canonical printers — AST → compact (XLE) or outline (XLO) text.
5
5
  *
6
- * Used by `checkExpression` so either party (agent or human) can request the
7
- * other surface, and by round-trip conformance tests.
6
+ * Used by `astryx layout check --form …` so either party (agent or human)
7
+ * can request the other surface, and by round-trip conformance tests.
8
8
  * Printing is best-effort canonical: spelling variants the lexer
9
9
  * normalized are emitted in canonical form.
10
10
  *
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @input block TSX source (splice) or a name+importPath (import)
20
20
  * @output prepareSpliceModule / parseImportStatements + import-merge helpers
21
- * @position lib/xle — used by expand.mjs; sources gathered by the caller
21
+ * @position lib/xle — used by expand.mjs; sources gathered in api/layout.mjs
22
22
  */
23
23
 
24
24
  const IMPORT_RE =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.4-canary.f0355e3",
3
+ "version": "0.6.4",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -101,10 +101,10 @@
101
101
  "zod": "^4.4.3"
102
102
  },
103
103
  "peerDependencies": {
104
- "@astryxdesign/charts": "0.6.4-canary.f0355e3",
105
- "@astryxdesign/core": "0.6.4-canary.f0355e3",
106
- "@astryxdesign/lab": "0.6.4-canary.f0355e3",
107
- "@astryxdesign/theme-neutral": "0.6.4-canary.f0355e3"
104
+ "@astryxdesign/charts": "*",
105
+ "@astryxdesign/core": "*",
106
+ "@astryxdesign/lab": "*",
107
+ "@astryxdesign/theme-neutral": "*"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.6.4-canary.f0355e3",
125
- "@astryxdesign/core": "0.6.4-canary.f0355e3",
126
- "@astryxdesign/lab": "0.6.4-canary.f0355e3",
127
- "@astryxdesign/theme-neutral": "0.6.4-canary.f0355e3",
124
+ "@astryxdesign/charts": "*",
125
+ "@astryxdesign/core": "*",
126
+ "@astryxdesign/lab": "*",
127
+ "@astryxdesign/theme-neutral": "*",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",
@@ -1,215 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file Tests for how the discover adapter calls discover sources: order,
5
- * failure isolation, timeouts, and the saved copy. Sources are plain functions
6
- * on a stand-in project, and the saved copies go to a temp directory.
7
- */
8
-
9
- import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
10
- import * as fs from 'node:fs';
11
- import * as os from 'node:os';
12
- import * as path from 'node:path';
13
- import {callSources} from './_adapter.mjs';
14
-
15
- /**
16
- * @param {string} name
17
- * @param {object[]} packages
18
- */
19
- function catalog(name, packages) {
20
- return {
21
- schemaVersion: 1,
22
- source: {name, generatedAt: '2026-09-30T00:00:00.000Z', complete: true},
23
- packages,
24
- };
25
- }
26
-
27
- /**
28
- * @param {string} name
29
- * @param {object} [extra]
30
- */
31
- function pkg(name, extra = {}) {
32
- return {
33
- package: name,
34
- integration: name,
35
- aliases: [],
36
- latest: '1.0.0',
37
- versions: [
38
- {version: '1.0.0', publishedAt: null, prerelease: false, status: 'ok'},
39
- ],
40
- contributions: [],
41
- ...extra,
42
- };
43
- }
44
-
45
- /**
46
- * @param {{config?: object, integrations?: object[]}} parts
47
- * @returns {any}
48
- */
49
- function project({config = {}, integrations = []}) {
50
- return {config, loadedIntegrations: integrations, cwd: '/virtual/project'};
51
- }
52
-
53
- let cacheDir;
54
-
55
- beforeEach(() => {
56
- cacheDir = fs.mkdtempSync(path.join(os.tmpdir(), 'discover-cache-'));
57
- });
58
-
59
- afterEach(() => {
60
- fs.rmSync(cacheDir, {recursive: true, force: true});
61
- });
62
-
63
- describe('callSources', () => {
64
- it('asks the project source first, then each integration in load order, once per function', async () => {
65
- /** @type {string[]} */
66
- const calls = [];
67
- const shared = vi.fn(async () => {
68
- calls.push('shared');
69
- return catalog('Shared', [pkg('@a/one')]);
70
- });
71
- const own = vi.fn(async () => {
72
- calls.push('own');
73
- return catalog('Own', [pkg('@a/one', {latest: '9.9.9'}), pkg('@a/two')]);
74
- });
75
-
76
- const result = await callSources(
77
- project({
78
- config: {discover: own},
79
- integrations: [
80
- {name: '@x/first', __discover: shared},
81
- {name: '@x/second', __discover: shared},
82
- ],
83
- }),
84
- {},
85
- {cacheDir},
86
- );
87
-
88
- expect(calls).toEqual(['own', 'shared']);
89
- expect(result.sources.map(s => [s.name, s.from, s.status])).toEqual([
90
- ['Own', 'astryx.config', 'fresh'],
91
- ['Shared', '@x/first', 'fresh'],
92
- ]);
93
- expect(result.packages.map(p => [p.package, p.latest, p.source])).toEqual([
94
- ['@a/one', '9.9.9', 'Own'],
95
- ['@a/two', '1.0.0', 'Own'],
96
- ]);
97
- });
98
-
99
- it('passes the package and version it wants, with an abort signal', async () => {
100
- const source = vi.fn(async () => catalog('S', []));
101
-
102
- await callSources(
103
- project({integrations: [{name: '@x/src', __discover: source}]}),
104
- {package: '@a/one', version: '1.0.0'},
105
- {cacheDir},
106
- );
107
-
108
- expect(source).toHaveBeenCalledWith({
109
- signal: expect.any(globalThis.AbortSignal),
110
- package: '@a/one',
111
- version: '1.0.0',
112
- });
113
- });
114
-
115
- it('keeps every other source when one throws, returns bad data, or is not a function', async () => {
116
- const result = await callSources(
117
- project({
118
- integrations: [
119
- {
120
- name: '@x/throws',
121
- __discover: async () => {
122
- throw new Error('offline');
123
- },
124
- },
125
- {name: '@x/bad', __discover: async () => ({schemaVersion: 2})},
126
- {
127
- name: '@x/broken',
128
- __discoverError: 'named export "discover" must be a function',
129
- },
130
- {
131
- name: '@x/good',
132
- __discover: async () => catalog('Good', [pkg('@a/one')]),
133
- },
134
- ],
135
- }),
136
- {},
137
- {cacheDir},
138
- );
139
-
140
- expect(result.sources.map(s => [s.from, s.status])).toEqual([
141
- ['@x/throws', 'failed'],
142
- ['@x/bad', 'failed'],
143
- ['@x/broken', 'failed'],
144
- ['@x/good', 'fresh'],
145
- ]);
146
- expect(result.sources[0].error).toContain('offline');
147
- expect(result.sources[1].error).toContain('schemaVersion 2');
148
- expect(result.sources[2].error).toContain('must be a function');
149
- expect(result.packages.map(p => p.package)).toEqual(['@a/one']);
150
- });
151
-
152
- it('gives up on a source after the timeout and aborts its signal', async () => {
153
- /** @type {AbortSignal | undefined} */
154
- let seen;
155
- const slow = ({signal}) => {
156
- seen = signal;
157
- return new Promise(() => {});
158
- };
159
-
160
- const result = await callSources(
161
- project({integrations: [{name: '@x/slow', __discover: slow}]}),
162
- {},
163
- {cacheDir, timeoutMs: 20},
164
- );
165
-
166
- expect(result.sources[0]).toMatchObject({
167
- status: 'failed',
168
- error: expect.stringContaining('did not answer'),
169
- });
170
- expect(seen?.aborted).toBe(true);
171
- });
172
-
173
- it('uses the copy saved for the same request when a source fails, and says when it was saved', async () => {
174
- let online = true;
175
- const source = async () => {
176
- if (!online) throw new Error('offline');
177
- return catalog('S', [pkg('@a/one')]);
178
- };
179
- const p = project({integrations: [{name: '@x/src', __discover: source}]});
180
-
181
- await callSources(p, {}, {cacheDir});
182
- online = false;
183
- const offline = await callSources(p, {}, {cacheDir});
184
-
185
- expect(offline.sources[0]).toMatchObject({
186
- name: 'S',
187
- status: 'saved',
188
- error: 'offline',
189
- savedAt: expect.any(String),
190
- });
191
- expect(offline.packages.map(x => x.package)).toEqual(['@a/one']);
192
-
193
- const otherRequest = await callSources(p, {package: '@a/one'}, {cacheDir});
194
- expect(otherRequest.sources[0].status).toBe('failed');
195
- });
196
-
197
- it('keeps the saved copy in the cache directory, not in the project', async () => {
198
- await callSources(
199
- project({
200
- integrations: [
201
- {name: '@x/src', __discover: async () => catalog('S', [])},
202
- ],
203
- }),
204
- {},
205
- {cacheDir},
206
- );
207
-
208
- expect(fs.readdirSync(path.join(cacheDir, 'discover'))).toHaveLength(1);
209
- expect(fs.existsSync('/virtual/project')).toBe(false);
210
- });
211
-
212
- it('returns nothing when there is no project', async () => {
213
- expect(await callSources(undefined)).toEqual({sources: [], packages: []});
214
- });
215
- });
@@ -1,115 +0,0 @@
1
- // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
- // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
-
4
- /**
5
- * @typedef {import('./_adapter.mjs').InstalledPackage} InstalledPackage
6
- * @typedef {import('./_adapter.mjs').CatalogResult} CatalogResult
7
- * @typedef {CatalogResult['packages'][number]} CatalogPackage
8
- * @typedef {import('../../authoring/discover/type').DiscoverKind} DiscoverKind
9
- */
10
- /**
11
- * An item search looks through. `kind: 'package'` is a package itself.
12
- * @typedef {object} SearchItem
13
- * @property {string} package
14
- * @property {DiscoverKind | 'package'} kind
15
- * @property {string} name
16
- * @property {boolean} installed
17
- * @property {string} [title]
18
- * @property {string} [summary]
19
- * @property {string[]} [keywords]
20
- * @property {string} [description]
21
- */
22
- /**
23
- * Group a version's contributions into the entry fields, one list per kind.
24
- * `components` is always present, like on an installed entry.
25
- * @param {CatalogPackage['contributions']} contributions
26
- * @returns {Record<string, string[]>}
27
- */
28
- export function kindLists(contributions: CatalogPackage["contributions"]): Record<string, string[]>;
29
- /**
30
- * Whether an entry adds at least one item of `kind`.
31
- * @param {Record<string, unknown>} entry
32
- * @param {DiscoverKind} kind
33
- * @returns {boolean}
34
- */
35
- export function hasKind(entry: Record<string, unknown>, kind: DiscoverKind): boolean;
36
- /**
37
- * Where a catalog package stands against the project.
38
- * @param {CatalogPackage} pkg
39
- * @param {Set<string>} installedNames
40
- * @param {Set<string>} declared
41
- * @returns {{state: 'installed' | 'declared' | 'alias' | 'available', installedAs?: string}}
42
- */
43
- export function catalogState(pkg: CatalogPackage, installedNames: Set<string>, declared: Set<string>): {
44
- state: "installed" | "declared" | "alias" | "available";
45
- installedAs?: string;
46
- };
47
- /**
48
- * The version a catalog package shows by default.
49
- * @param {CatalogPackage} pkg
50
- * @returns {string | undefined}
51
- */
52
- export function defaultVersion(pkg: CatalogPackage): string | undefined;
53
- /**
54
- * Project a catalog package into the entry shape installed packages use.
55
- * @param {CatalogPackage} pkg
56
- * @param {string | undefined} version
57
- */
58
- export function catalogEntry(pkg: CatalogPackage, version: string | undefined): {
59
- description?: string | undefined;
60
- version?: string | undefined;
61
- name: string;
62
- category: string;
63
- components: string[];
64
- };
65
- /**
66
- * What the project could add: every catalog package it does not have, once per
67
- * integration (the first name a source lists), never an alias of one it has.
68
- * @param {CatalogResult} catalog
69
- * @param {InstalledPackage[]} installed
70
- * @param {Set<string>} declared
71
- */
72
- export function availableEntries(catalog: CatalogResult, installed: InstalledPackage[], declared: Set<string>): {
73
- source: string;
74
- aliases?: string[] | undefined;
75
- description?: string | undefined;
76
- version?: string | undefined;
77
- name: string;
78
- components: string[];
79
- }[];
80
- /**
81
- * Installed packages with the latest release a source knows for each.
82
- * @param {InstalledPackage[]} installed
83
- * @param {CatalogResult} catalog
84
- * @returns {Array<InstalledPackage & {latest?: string}>}
85
- */
86
- export function withLatest(installed: InstalledPackage[], catalog: CatalogResult): Array<InstalledPackage & {
87
- latest?: string;
88
- }>;
89
- /**
90
- * Everything search looks through besides installed components (which the
91
- * search leaf keeps resolving the way it always has): installed packages and
92
- * their other items, and every package the project could add with its items.
93
- * @param {InstalledPackage[]} installed
94
- * @param {CatalogResult} catalog
95
- * @param {Set<string>} declared
96
- * @returns {SearchItem[]}
97
- */
98
- export function searchItems(installed: InstalledPackage[], catalog: CatalogResult, declared: Set<string>): SearchItem[];
99
- export type InstalledPackage = import("./_adapter.mjs").InstalledPackage;
100
- export type CatalogResult = import("./_adapter.mjs").CatalogResult;
101
- export type CatalogPackage = CatalogResult["packages"][number];
102
- export type DiscoverKind = import("../../authoring/discover/type").DiscoverKind;
103
- /**
104
- * An item search looks through. `kind: 'package'` is a package itself.
105
- */
106
- export type SearchItem = {
107
- package: string;
108
- kind: DiscoverKind | "package";
109
- name: string;
110
- installed: boolean;
111
- title?: string | undefined;
112
- summary?: string | undefined;
113
- keywords?: string[] | undefined;
114
- description?: string | undefined;
115
- };