@astryxdesign/cli 0.6.4 → 0.6.5-canary.00f1ed9

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 (405) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +103 -95
  3. package/api/build/_adapter.d.mts +36 -2
  4. package/api/build/_adapter.mjs +41 -10
  5. package/api/build/build.doc.mjs +8 -3
  6. package/api/build/build.test.mjs +60 -2
  7. package/api/build/kit/kit.mjs +109 -26
  8. package/api/build/kit/rank.d.mts +24 -8
  9. package/api/build/kit/rank.mjs +277 -97
  10. package/api/build/kit/rank.test.mjs +231 -48
  11. package/api/component/_adapter.d.mts +25 -0
  12. package/api/component/_adapter.mjs +59 -5
  13. package/api/component/component.d.mts +6 -3
  14. package/api/component/component.doc.mjs +37 -17
  15. package/api/component/component.mjs +249 -9
  16. package/api/component/component.type.d.mts +25 -0
  17. package/api/component/component.type.mjs +44 -0
  18. package/api/discover/_adapter.d.mts +114 -6
  19. package/api/discover/_adapter.mjs +372 -17
  20. package/api/discover/_adapter.test.mjs +215 -0
  21. package/api/discover/_catalog-view.d.mts +115 -0
  22. package/api/discover/_catalog-view.mjs +203 -0
  23. package/api/discover/_catalog-view.test.mjs +128 -0
  24. package/api/discover/detail/detail.d.mts +18 -6
  25. package/api/discover/detail/detail.mjs +67 -13
  26. package/api/discover/detail/detail.test.mjs +85 -0
  27. package/api/discover/detail/item/item.d.mts +26 -0
  28. package/api/discover/detail/item/item.mjs +78 -0
  29. package/api/discover/detail/item/item.test.mjs +73 -0
  30. package/api/discover/discover.d.mts +3 -9
  31. package/api/discover/discover.doc.mjs +61 -18
  32. package/api/discover/discover.mjs +220 -36
  33. package/api/discover/discover.test.mjs +11 -2
  34. package/api/discover/discover.type.d.mts +147 -8
  35. package/api/discover/discover.type.mjs +102 -12
  36. package/api/discover/list/list.d.mts +20 -6
  37. package/api/discover/list/list.mjs +45 -12
  38. package/api/discover/list/list.test.mjs +46 -0
  39. package/api/discover/search/search.d.mts +18 -16
  40. package/api/discover/search/search.mjs +102 -56
  41. package/api/discover/search/search.test.mjs +144 -10
  42. package/api/docs/_adapter.d.mts +8 -3
  43. package/api/docs/_adapter.mjs +14 -6
  44. package/api/docs/docOverlays.test.mjs +27 -1
  45. package/api/docs/docs.doc.mjs +2 -2
  46. package/api/docs/docs.test.mjs +54 -18
  47. package/api/docs/integration-tree.test.mjs +17 -0
  48. package/api/docs/integrationDocs.test.mjs +27 -5
  49. package/api/doctor/doctor.d.mts +8 -3
  50. package/api/doctor/doctor.doc.mjs +17 -8
  51. package/api/doctor/doctor.mjs +90 -9
  52. package/api/doctor/doctor.test.mjs +122 -10
  53. package/api/doctor/doctor.type.d.mts +1 -1
  54. package/api/doctor/doctor.type.mjs +1 -1
  55. package/api/error.d.mts +22 -0
  56. package/api/error.mjs +42 -0
  57. package/api/gap-report/gap-report.doc.mjs +19 -10
  58. package/api/hook/hook.doc.mjs +6 -3
  59. package/api/index.d.mts +1 -0
  60. package/api/index.mjs +5 -3
  61. package/api/init/init.doc.mjs +17 -12
  62. package/api/integration/add-contribution.d.mts +2 -1
  63. package/api/integration/add-contribution.mjs +7 -3
  64. package/api/integration/add-contribution.test.mjs +3 -3
  65. package/api/integration/add-helpers.d.mts +5 -2
  66. package/api/integration/add-helpers.mjs +36 -9
  67. package/api/integration/add-theme.mjs +266 -23
  68. package/api/integration/add-theme.test.mjs +247 -0
  69. package/api/integration/authoring-checks.mjs +12 -9
  70. package/api/integration/authoring-checks.type.d.mts +8 -0
  71. package/api/integration/authoring-checks.type.mjs +7 -3
  72. package/api/integration/integration-authoring.type.d.mts +4 -1
  73. package/api/integration/integration-authoring.type.mjs +6 -1
  74. package/api/integration/integrationAdd.doc.mjs +6 -0
  75. package/api/integration/integrationAddTheme.doc.mjs +10 -0
  76. package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
  77. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  78. package/api/integration/integrationPackCheck.doc.mjs +3 -3
  79. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  80. package/api/integration/pack-check.lifecycle-output.test.mjs +107 -0
  81. package/api/integration/pack-check.mjs +92 -10
  82. package/api/integration/pack-check.test.mjs +140 -1
  83. package/api/integration/pack-check.type.mjs +1 -1
  84. package/api/integration/validate-integration.d.mts +4 -2
  85. package/api/integration/validate-integration.mjs +7 -2
  86. package/api/integration/validate-integration.test.mjs +55 -0
  87. package/api/integration/validate-integration.type.d.mts +5 -0
  88. package/api/integration/validate-integration.type.mjs +5 -1
  89. package/api/integration/validateIntegration.doc.mjs +1 -1
  90. package/api/json/assertResponse.doc.mjs +1 -1
  91. package/api/json/isError.doc.mjs +1 -1
  92. package/api/layout/expand/expand.mjs +12 -7
  93. package/api/layout/expand/expand.receipt.test.mjs +74 -0
  94. package/api/layout/layout.type.d.mts +1 -0
  95. package/api/layout/layout.type.mjs +1 -0
  96. package/api/layout/layoutExpand.doc.mjs +1 -1
  97. package/api/search/search.d.mts +51 -1
  98. package/api/search/search.doc.mjs +2 -2
  99. package/api/search/search.mjs +299 -17
  100. package/api/search/search.test.mjs +216 -18
  101. package/api/swizzle/copy/copy.mjs +66 -3
  102. package/api/swizzle/swizzle.doc.mjs +11 -5
  103. package/api/template/copy/copy.mjs +15 -9
  104. package/api/template/copy/copy.receipt.test.mjs +77 -0
  105. package/api/template/copy/copy.test.mjs +9 -0
  106. package/api/template/show/show.mjs +15 -4
  107. package/api/template/show/show.test.mjs +76 -0
  108. package/api/template/template-integration.test.mjs +14 -0
  109. package/api/template/template.d.mts +1 -1
  110. package/api/template/template.doc.mjs +8 -3
  111. package/api/template/template.mjs +1 -0
  112. package/api/template/template.type.d.mts +2 -0
  113. package/api/template/template.type.mjs +2 -0
  114. package/api/theme/add/add.mjs +17 -25
  115. package/api/theme/add/add.rollback.test.mjs +158 -0
  116. package/api/theme/add/add.staging.test.mjs +40 -23
  117. package/api/theme/build/build.d.mts +24 -0
  118. package/api/theme/build/build.family.test.mjs +7 -12
  119. package/api/theme/build/build.mjs +243 -26
  120. package/api/theme/build/build.project-core.test.mjs +165 -0
  121. package/api/theme/build/build.rollback.test.mjs +148 -0
  122. package/api/theme/generateTonalPalette.doc.mjs +1 -2
  123. package/api/theme/listThemes.doc.mjs +1 -1
  124. package/api/theme/themeAdd.doc.mjs +9 -10
  125. package/api/theme/themeBuild.doc.mjs +13 -13
  126. package/api/theme/themeList.doc.mjs +1 -1
  127. package/api/theme/themeListAvailable.doc.mjs +2 -1
  128. package/api/theme/themePaletteGenerate.doc.mjs +15 -8
  129. package/api/theme/themeTargets.doc.mjs +3 -2
  130. package/api/theme/themeTemplate.doc.mjs +2 -1
  131. package/api/upgrade/run/files-changed.test.mjs +111 -0
  132. package/api/upgrade/run/run.mjs +25 -6
  133. package/api/upgrade/run/run.test.mjs +45 -1
  134. package/api/upgrade/upgrade.doc.mjs +24 -22
  135. package/api/upgrade/upgrade.type.d.mts +1 -0
  136. package/api/upgrade/upgrade.type.mjs +3 -2
  137. package/assets/codemods/__tests__/runner.test.mjs +3 -1
  138. package/assets/codemods/file-count.test.mjs +163 -0
  139. package/assets/codemods/integration-runner.mjs +3 -3
  140. package/assets/codemods/runner.mjs +5 -4
  141. package/assets/docs/README.md +4 -2
  142. package/assets/docs/browser-support.doc.mjs +11 -11
  143. package/assets/docs/color.doc.mjs +8 -2
  144. package/assets/docs/elevation.doc.mjs +6 -4
  145. package/assets/docs/getting-started.doc.mjs +5 -16
  146. package/assets/docs/icons.doc.mjs +3 -21
  147. package/assets/docs/illustrations.doc.mjs +7 -15
  148. package/assets/docs/internationalization.doc.mjs +7 -5
  149. package/assets/docs/layout.doc.dense.mjs +130 -82
  150. package/assets/docs/layout.doc.mjs +133 -77
  151. package/assets/docs/migration.doc.mjs +19 -21
  152. package/assets/docs/motion.doc.mjs +16 -3
  153. package/assets/docs/principles.doc.dense.mjs +5 -5
  154. package/assets/docs/principles.doc.mjs +8 -0
  155. package/assets/docs/principles.doc.zh.mjs +6 -6
  156. package/assets/docs/shape.doc.mjs +8 -3
  157. package/assets/docs/spacing.doc.mjs +7 -2
  158. package/assets/docs/styling-libraries.doc.mjs +6 -2
  159. package/assets/docs/styling.doc.mjs +19 -23
  160. package/assets/docs/theme.doc.dense.mjs +58 -18
  161. package/assets/docs/theme.doc.mjs +57 -47
  162. package/assets/docs/theme.doc.zh.mjs +9 -8
  163. package/assets/docs/tokens.doc.dense.mjs +2 -2
  164. package/assets/docs/tokens.doc.mjs +389 -8
  165. package/assets/docs/tokens.doc.zh.mjs +2 -2
  166. package/assets/docs/tree/add-a-component.doc.mjs +75 -0
  167. package/assets/docs/tree/add-a-theme.doc.mjs +85 -0
  168. package/assets/docs/tree/add-a-topic.doc.mjs +144 -0
  169. package/assets/docs/tree/agent-guidance.doc.mjs +138 -0
  170. package/assets/docs/tree/block-template.doc.mjs +130 -0
  171. package/assets/docs/tree/build-the-template.doc.mjs +28 -0
  172. package/assets/docs/tree/building-blocks.doc.mjs +46 -0
  173. package/assets/docs/tree/check-your-docs.doc.mjs +137 -0
  174. package/assets/docs/tree/checks.doc.mjs +119 -0
  175. package/assets/docs/tree/codemods.doc.mjs +147 -0
  176. package/assets/docs/tree/component-family.doc.mjs +113 -0
  177. package/assets/docs/tree/component-imports.doc.mjs +69 -0
  178. package/assets/docs/tree/component-lookups.doc.mjs +149 -0
  179. package/assets/docs/tree/components.doc.mjs +23 -0
  180. package/assets/docs/tree/configuration.doc.mjs +23 -0
  181. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +182 -0
  182. package/assets/docs/tree/define-the-theme.doc.mjs +118 -0
  183. package/assets/docs/tree/describe-the-component.doc.mjs +57 -0
  184. package/assets/docs/tree/docs.doc.mjs +21 -0
  185. package/assets/docs/tree/document-the-template.doc.mjs +28 -0
  186. package/assets/docs/tree/document-the-theme.doc.mjs +68 -0
  187. package/assets/docs/tree/export-template-assets.doc.mjs +147 -0
  188. package/assets/docs/tree/extend-or-replace.doc.mjs +103 -0
  189. package/assets/docs/tree/fonts-and-assets.doc.mjs +106 -0
  190. package/assets/docs/tree/generate-a-palette.doc.mjs +66 -0
  191. package/assets/docs/tree/grade-template-with-agent.doc.mjs +105 -0
  192. package/assets/docs/tree/help.doc.mjs +16 -0
  193. package/assets/docs/tree/integrations.doc.mjs +25 -451
  194. package/assets/docs/tree/links.doc.mjs +98 -0
  195. package/assets/docs/tree/package-and-test.doc.mjs +32 -0
  196. package/assets/docs/tree/page-template.doc.mjs +71 -0
  197. package/assets/docs/tree/publishing.doc.mjs +111 -0
  198. package/assets/docs/tree/quick-start.doc.mjs +272 -0
  199. package/assets/docs/tree/replace-a-core-component.doc.mjs +104 -0
  200. package/assets/docs/tree/replace-a-core-template.doc.mjs +172 -0
  201. package/assets/docs/tree/sections-and-placement.doc.mjs +108 -0
  202. package/assets/docs/tree/see-it-in-an-app.doc.mjs +59 -0
  203. package/assets/docs/tree/ship.doc.mjs +16 -0
  204. package/assets/docs/tree/short-and-findable.doc.mjs +108 -0
  205. package/assets/docs/tree/single-component.doc.mjs +165 -0
  206. package/assets/docs/tree/start-a-template.doc.mjs +143 -0
  207. package/assets/docs/tree/subcomponent.doc.mjs +115 -0
  208. package/assets/docs/tree/template-assets.doc.mjs +64 -0
  209. package/assets/docs/tree/template-doc-overview.doc.mjs +121 -0
  210. package/assets/docs/tree/template-fonts.doc.mjs +102 -0
  211. package/assets/docs/tree/template-grading-rubric.doc.mjs +452 -0
  212. package/assets/docs/tree/template-icons.doc.mjs +97 -0
  213. package/assets/docs/tree/template-images-media.doc.mjs +127 -0
  214. package/assets/docs/tree/template-styles.doc.mjs +93 -0
  215. package/assets/docs/tree/templates.doc.mjs +34 -0
  216. package/assets/docs/tree/test-in-an-app.doc.mjs +115 -0
  217. package/assets/docs/tree/test-template-in-app.doc.mjs +128 -0
  218. package/assets/docs/tree/themes.doc.mjs +39 -0
  219. package/assets/docs/tree/troubleshooting.doc.mjs +153 -0
  220. package/assets/docs/tree/upgrading.doc.mjs +103 -0
  221. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +51 -0
  222. package/assets/docs/tree/verify-packed-template.doc.mjs +77 -0
  223. package/assets/docs/tree/versioning.doc.mjs +162 -0
  224. package/assets/docs/tree/write-good-templates.doc.mjs +64 -0
  225. package/assets/docs/tree/write-the-template-file.doc.mjs +154 -0
  226. package/assets/docs/typography.doc.mjs +24 -4
  227. package/assets/docs/working-with-ai.doc.mjs +30 -22
  228. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  229. package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
  230. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
  231. package/assets/templates/pages/blank/template.doc.mjs +3 -1
  232. package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
  233. package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
  234. package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
  235. package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
  236. package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
  237. package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
  238. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
  239. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
  240. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
  241. package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
  242. package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
  243. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
  244. package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
  245. package/assets/templates/pages/documentation/template.doc.mjs +10 -1
  246. package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
  247. package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
  248. package/assets/templates/pages/editor/template.doc.mjs +9 -1
  249. package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
  250. package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
  251. package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
  252. package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
  253. package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
  254. package/assets/templates/pages/ide/template.doc.mjs +9 -1
  255. package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
  256. package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
  257. package/assets/templates/pages/library/template.doc.mjs +15 -1
  258. package/assets/templates/pages/login/template.doc.mjs +10 -1
  259. package/assets/templates/pages/login-card/template.doc.mjs +11 -1
  260. package/assets/templates/pages/login-split/template.doc.mjs +10 -1
  261. package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
  262. package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
  263. package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
  264. package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
  265. package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
  266. package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
  267. package/assets/templates/pages/settings/template.doc.mjs +3 -1
  268. package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
  269. package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
  270. package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
  271. package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
  272. package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
  273. package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
  274. package/assets/templates/pages/table/template.doc.mjs +11 -1
  275. package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
  276. package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
  277. package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
  278. package/assets/templates/pages/table-page/template.doc.mjs +20 -1
  279. package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
  280. package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
  281. package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
  282. package/assets/templates/themes/butter/icons.tsx +2 -0
  283. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  284. package/assets/templates/themes/gothic/icons.tsx +2 -0
  285. package/assets/templates/themes/matcha/icons.tsx +2 -0
  286. package/assets/templates/themes/neutral/icons.tsx +2 -0
  287. package/assets/templates/themes/stone/icons.tsx +2 -0
  288. package/assets/templates/themes/y2k/icons.tsx +2 -0
  289. package/authoring/config/config.doc.mjs +9 -1
  290. package/authoring/config/parse.d.mts +2 -0
  291. package/authoring/config/parse.mjs +19 -0
  292. package/authoring/config/parse.test.mjs +8 -0
  293. package/authoring/config/type.ts +11 -0
  294. package/authoring/discover/discover.doc.d.mts +13 -0
  295. package/authoring/discover/discover.doc.mjs +138 -0
  296. package/authoring/discover/parse.d.mts +24 -0
  297. package/authoring/discover/parse.mjs +128 -0
  298. package/authoring/discover/parse.test.mjs +124 -0
  299. package/authoring/discover/type.ts +87 -0
  300. package/authoring/doctypes/_schema.d.mts +3 -2
  301. package/authoring/doctypes/_schema.mjs +6 -0
  302. package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
  303. package/authoring/doctypes/base/type.ts +4 -2
  304. package/authoring/doctypes/component/component.doc.mjs +6 -0
  305. package/authoring/doctypes/component/type.ts +8 -0
  306. package/authoring/doctypes/reference/reference.doc.mjs +7 -0
  307. package/authoring/doctypes/reference/type.ts +5 -0
  308. package/authoring/doctypes/schema/schema.doc.mjs +2 -2
  309. package/authoring/doctypes/template/parse.d.mts +2 -0
  310. package/authoring/doctypes/template/parse.mjs +1 -0
  311. package/authoring/doctypes/template/parse.test.mjs +21 -0
  312. package/authoring/doctypes/template/template.doc.mjs +7 -1
  313. package/authoring/doctypes/template/type.ts +12 -2
  314. package/authoring/index.d.mts +1 -0
  315. package/authoring/index.d.ts +10 -0
  316. package/authoring/index.mjs +1 -0
  317. package/authoring/integration/integration.doc.mjs +12 -10
  318. package/clients/cli/commands/component/index.mjs +152 -55
  319. package/clients/cli/commands/component-batch.test.mjs +341 -0
  320. package/clients/cli/commands/component-ownership.test.mjs +89 -0
  321. package/clients/cli/commands/component.doc.mjs +27 -9
  322. package/clients/cli/commands/discover.doc.mjs +53 -9
  323. package/clients/cli/commands/discover.mjs +393 -118
  324. package/clients/cli/commands/discover.sources.test.mjs +267 -0
  325. package/clients/cli/commands/docs.doc.mjs +1 -1
  326. package/clients/cli/commands/docs.mjs +60 -17
  327. package/clients/cli/commands/docs.test.mjs +113 -24
  328. package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -2
  329. package/clients/cli/commands/doctor-integration.test.mjs +53 -0
  330. package/clients/cli/commands/doctor.doc.mjs +3 -1
  331. package/clients/cli/commands/doctor.mjs +53 -9
  332. package/clients/cli/commands/gap-report.doc.mjs +10 -9
  333. package/clients/cli/commands/init.doc.mjs +9 -6
  334. package/clients/cli/commands/integration-add.doc.mjs +17 -7
  335. package/clients/cli/commands/integration-authoring.test.mjs +70 -9
  336. package/clients/cli/commands/integration-pack.doc.mjs +5 -9
  337. package/clients/cli/commands/integration-real-world.test.mjs +1 -1
  338. package/clients/cli/commands/integration-verify.doc.mjs +22 -0
  339. package/clients/cli/commands/integration.doc.mjs +4 -4
  340. package/clients/cli/commands/integration.mjs +76 -43
  341. package/clients/cli/commands/layout-expand.doc.mjs +3 -1
  342. package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
  343. package/clients/cli/commands/layout.mjs +16 -0
  344. package/clients/cli/commands/manifest.doc.mjs +1 -1
  345. package/clients/cli/commands/search.doc.mjs +10 -3
  346. package/clients/cli/commands/search.mjs +21 -2
  347. package/clients/cli/commands/search.test.mjs +21 -4
  348. package/clients/cli/commands/swizzle.doc.mjs +1 -1
  349. package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
  350. package/clients/cli/commands/template.doc.mjs +1 -1
  351. package/clients/cli/commands/template.mjs +19 -5
  352. package/clients/cli/commands/template.show-media.test.mjs +62 -0
  353. package/clients/cli/commands/text-json-parity.test.mjs +7 -1
  354. package/clients/cli/commands/theme-add.doc.mjs +1 -1
  355. package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
  356. package/clients/cli/commands/theme-palette.doc.mjs +1 -2
  357. package/clients/cli/commands/theme-targets.doc.mjs +2 -2
  358. package/clients/cli/commands/theme.doc.mjs +2 -1
  359. package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
  360. package/clients/cli/commands/upgrade.doc.mjs +62 -3
  361. package/clients/cli/commands/write-failure.test.mjs +175 -0
  362. package/clients/cli/index.mjs +28 -6
  363. package/clients/cli/lib/define-command.mjs +28 -4
  364. package/clients/cli/lib/define-command.test.mjs +54 -0
  365. package/clients/cli/lib/exit-codes.test.mjs +17 -1
  366. package/clients/cli/lib/json-shim.mjs +24 -14
  367. package/clients/cli/lib/manifest.mjs +48 -156
  368. package/clients/cli/lib/manifest.test.mjs +103 -9
  369. package/clients/cli/lib/parse-error-format.test.mjs +81 -0
  370. package/foundation/agent-docs/agent-docs.mjs +1 -1
  371. package/foundation/agent-docs/agent-docs.test.mjs +3 -2
  372. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  373. package/foundation/discovery/authoring-self-docs.test.mjs +6 -2
  374. package/foundation/discovery/cli-self-docs.mjs +16 -2
  375. package/foundation/discovery/cli-self-docs.test.mjs +20 -0
  376. package/foundation/discovery/docs-discovery.mjs +5 -1
  377. package/foundation/discovery/docs-discovery.test.mjs +21 -0
  378. package/foundation/discovery/docs-section-key.d.mts +1 -1
  379. package/foundation/discovery/docs-section-key.mjs +1 -1
  380. package/foundation/discovery/template-adapter.d.mts +14 -0
  381. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
  382. package/foundation/discovery/template-adapter.mjs +21 -1
  383. package/foundation/doc-compiler/doc-loads.test.mjs +5 -4
  384. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  385. package/foundation/doc-compiler/tree.d.mts +4 -0
  386. package/foundation/doc-compiler/tree.mjs +6 -1
  387. package/foundation/doc-compiler/tree.test.mjs +65 -14
  388. package/foundation/integrations/cli-requirement.d.mts +75 -11
  389. package/foundation/integrations/cli-requirement.mjs +120 -23
  390. package/foundation/integrations/cli-requirement.test.mjs +141 -9
  391. package/foundation/integrations/contribution-inventory.mjs +1 -1
  392. package/foundation/integrations/integrations.d.mts +14 -1
  393. package/foundation/integrations/integrations.mjs +41 -1
  394. package/foundation/integrations/integrations.test.mjs +31 -0
  395. package/foundation/response/batch.type.d.mts +33 -0
  396. package/foundation/response/batch.type.mjs +34 -0
  397. package/foundation/response/error-codes.doc.mjs +6 -8
  398. package/foundation/response/error-codes.test.mjs +30 -5
  399. package/foundation/response/response-types.doc.d.mts +5 -4
  400. package/foundation/response/response-types.doc.mjs +49 -19
  401. package/foundation/response/response-types.doc.test.mjs +23 -0
  402. package/foundation/response/response.doc.mjs +11 -10
  403. package/package.json +9 -9
  404. package/assets/docs/tree/integrations.test.mjs +0 -62
  405. package/assets/docs/tree/writing-docs.doc.mjs +0 -286
@@ -307,6 +307,7 @@ const ComponentBaseSchema = z
307
307
  theming: z.unknown().optional(),
308
308
  playground: z.unknown().optional(),
309
309
  examples: z.array(z.unknown()).optional(),
310
+ replaces: z.string().min(1).optional(),
310
311
  })
311
312
  .passthrough();
312
313
 
@@ -414,6 +415,9 @@ export const GenericDocKindSchema = z
414
415
  ...BaseDocFields,
415
416
  type: z.literal('generic'),
416
417
  title: nonEmptyString.optional(),
418
+ // Search terms the title and sections do not use; `astryx search` matches
419
+ // them as keywords of the whole topic (ReferenceDoc `keywords`).
420
+ keywords: z.array(z.string()).optional(),
417
421
  sections: z.array(ReferenceSectionSchema).min(1).optional(),
418
422
  replaces: nonEmptyString.optional(),
419
423
  extends: nonEmptyString.optional(),
@@ -730,6 +734,8 @@ const LegacyBaseDocSchema = z.object({
730
734
  const LegacyReferenceDocSchema = LegacyBaseDocSchema.extend({
731
735
  title: nonEmptyString,
732
736
  description: z.string(),
737
+ // As on the stamped schema: search terms for the whole topic.
738
+ keywords: z.array(z.string()).optional(),
733
739
  sections: z.array(ReferenceSectionSchema).min(1),
734
740
  replaces: nonEmptyString.optional(),
735
741
  extends: nonEmptyString.optional(),
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'Authored doc graph fields',
13
13
  namespace: 'authoring',
14
14
  description:
15
- "Placement, compatibility aliases, and audience: fields every authored doc kind declares for the docs tree. The docs tree reads `placement` for every guide, the CLI's and each integration's; aliases and audience are not built yet. A reference topic outside the docs tree that sets one fails to load, and other doc kinds accept them and ignore them.",
15
+ "Fields every authored doc kind can declare for the docs tree: `placement`, plus two reserved fields, `aliases` and `audience`. The docs tree reads `placement` for every guide, the CLI's and each integration's. Nothing reads `aliases` or `audience` today: a reference topic outside the docs tree that sets one fails to load, and other doc kinds accept them and ignore them.",
16
16
  appliesTo: 'Every supported .doc.mjs object',
17
17
  fields: [
18
18
  {
@@ -45,13 +45,13 @@ export const doc = {
45
45
  name: 'aliases',
46
46
  type: 'string[]',
47
47
  description:
48
- 'Prior names or routes the docs tree will keep resolving to this doc, without creating another identity. Not read yet: a topic that sets it fails to load.',
48
+ 'Reserved: prior names or routes the docs tree will keep resolving to this doc, without creating another identity. Nothing reads it today, and a topic that sets it fails to load.',
49
49
  },
50
50
  {
51
51
  name: 'audience',
52
52
  type: "'public' | 'internal'",
53
53
  description:
54
- "Which docs bundle includes this doc ('public' when omitted). Not read yet: a topic that sets it fails to load.",
54
+ "Reserved: which docs bundle includes this doc ('public' when omitted). Nothing reads it today, and a topic that sets it fails to load.",
55
55
  default: "'public'",
56
56
  },
57
57
  ],
@@ -39,9 +39,11 @@ export interface DocPlacement {
39
39
  export interface AuthoredDocGraphFields {
40
40
  /** The doc's one parent in the docs tree: a namespace of its own package. */
41
41
  placement?: DocPlacement;
42
- /** Prior routes or names the docs tree will keep resolving. Not read yet. */
42
+ /** Reserved: prior routes or names the docs tree will keep resolving.
43
+ * Nothing reads it yet. */
43
44
  aliases?: string[];
44
- /** Docs bundle audience; omit for public docs. Not read yet. */
45
+ /** Reserved: docs bundle audience; omit for public docs. Nothing reads it
46
+ * yet. */
45
47
  audience?: DocAudience;
46
48
  }
47
49
 
@@ -52,6 +52,12 @@ export const doc = {
52
52
  description:
53
53
  'Exact public package specifier consumers use to import an integration-owned component. The packed-package gate resolves this specifier and verifies it exports the component name.',
54
54
  },
55
+ {
56
+ name: 'replaces',
57
+ type: 'string',
58
+ description:
59
+ "Integration components only: the exact `name` of the Core ComponentDoc this component takes over for unqualified lookup, so every app that loads the integration gets it from component detail, lists, search, swizzle, and issue routing. The Core original stays reachable with `--package @astryxdesign/core`. Set it only to intentionally own a Core identity; give an alternative or variant its own name instead.",
60
+ },
55
61
  {
56
62
  name: 'keywords',
57
63
  type: 'string[]',
@@ -48,6 +48,14 @@ export interface ComponentBaseDoc extends AuthoredDocGraphFields {
48
48
  displayName: string;
49
49
  /** Exact consumer import specifier for integration-owned components. */
50
50
  import?: string;
51
+ /** Integration components only: the exact `name` of the Core ComponentDoc
52
+ * this component takes over for unqualified lookup, so every app that loads
53
+ * the integration gets this component from component detail, lists, search,
54
+ * swizzle, and issue routing. The Core original stays reachable with
55
+ * `--package @astryxdesign/core`. Set it only to intentionally own a Core
56
+ * identity; give an alternative or variant its own name instead. Older CLIs
57
+ * that do not read `replaces` keep the component under its own name. */
58
+ replaces?: string;
51
59
  /** Search keywords for CLI discovery. Terms a developer might type when
52
60
  * looking for this component: synonyms, related UI concepts, and common
53
61
  * names from other design systems (MUI, Chakra, Radix, and others).
@@ -51,6 +51,13 @@ export const doc = {
51
51
  type: 'string',
52
52
  description: "Navigation category: 'guide' or 'foundations'.",
53
53
  },
54
+ {
55
+ name: 'keywords',
56
+ type: 'string[]',
57
+ description:
58
+ "Words a reader may search for that the title and sections do not use: a synonym, a task, or another library's name for the same thing. `astryx search` matches each as a keyword of the whole topic, so an exact one ranks the topic like its own title does.",
59
+ example: "['dark mode', 'color scheme']",
60
+ },
54
61
  {
55
62
  name: 'replaces',
56
63
  type: 'string',
@@ -127,6 +127,11 @@ export interface ReferenceDoc extends AuthoredDocGraphFields {
127
127
  description: string;
128
128
  /** Navigation category: 'guide' or 'foundations'. */
129
129
  category?: string;
130
+ /** Words a reader may search for that the title and sections do not use:
131
+ * a synonym, a task ("dark mode"), or another library's name for the same
132
+ * thing. `astryx search` matches each as a keyword of the whole topic, so
133
+ * an exact one ranks the topic like its own title does. */
134
+ keywords?: string[];
130
135
  /** Name of an existing topic this doc takes the place of. Authored by an
131
136
  * integration whose guide should be served instead of the built-in one —
132
137
  * `replaces: 'getting-started'` on a doc named `getting-started` swaps the
@@ -49,7 +49,7 @@ export const doc = {
49
49
  name: 'namespace',
50
50
  type: 'string',
51
51
  description:
52
- "The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
52
+ "The group that reads this doc: 'authoring' for a file an author writes (a section of {@link generic:authoring}), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
53
53
  },
54
54
  {
55
55
  name: 'aliases',
@@ -162,7 +162,7 @@ export const doc = {
162
162
  type: '{ dir: string }',
163
163
  description: 'Where component sources live.',
164
164
  fields: [
165
- {name: 'components.dir', type: 'string', description: 'Glob root for XDS*.tsx files.', required: true},
165
+ {name: 'components.dir', type: 'string', description: 'Glob root for Acme*.tsx files.', required: true},
166
166
  ],
167
167
  },
168
168
  ],
@@ -43,6 +43,7 @@ declare const pageTemplateSchema: z.ZodObject<{
43
43
  name: z.ZodString;
44
44
  displayName: z.ZodOptional<z.ZodString>;
45
45
  description: z.ZodOptional<z.ZodString>;
46
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
47
  category: z.ZodOptional<z.ZodString>;
47
48
  componentsUsed: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
49
  preview: z.ZodOptional<z.ZodObject<{
@@ -79,6 +80,7 @@ declare const blockTemplateSchema: z.ZodObject<{
79
80
  name: z.ZodString;
80
81
  displayName: z.ZodOptional<z.ZodString>;
81
82
  description: z.ZodOptional<z.ZodString>;
83
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
84
  category: z.ZodOptional<z.ZodString>;
83
85
  componentsUsed: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
86
  preview: z.ZodOptional<z.ZodObject<{
@@ -44,6 +44,7 @@ const baseTemplateFields = {
44
44
  name: z.string().min(1, 'name is required'),
45
45
  displayName: z.string().min(1).optional(),
46
46
  description: z.string().min(1, 'description is required').optional(),
47
+ keywords: z.array(z.string().min(1)).optional(),
47
48
  category: z.string().optional(),
48
49
  componentsUsed: z.array(z.string()).optional(),
49
50
  preview: previewSchema.optional(),
@@ -34,6 +34,27 @@ describe('parseTemplate (load boundary)', () => {
34
34
  }
35
35
  });
36
36
 
37
+ it('accepts keywords on page and block templates', () => {
38
+ for (const type of ['page', 'block']) {
39
+ const parsed = parseTemplate({
40
+ type,
41
+ name: 'Acme health',
42
+ description: 'Status tiles over time charts.',
43
+ keywords: ['uptime', 'on-call'],
44
+ });
45
+ expect(parsed.keywords).toEqual(['uptime', 'on-call']);
46
+ }
47
+ });
48
+
49
+ it('rejects keywords that are not a list of words', () => {
50
+ expect(
51
+ reason({type: 'page', name: 'Acme health', keywords: 'uptime'}),
52
+ ).toMatch(/keywords/);
53
+ expect(reason({type: 'page', name: 'Acme health', keywords: ['']})).toMatch(
54
+ /keywords/,
55
+ );
56
+ });
57
+
37
58
  it('rejects an empty replaces', () => {
38
59
  expect(reason({type: 'page', name: 'Acme shell', replaces: ''})).toMatch(
39
60
  /replaces must name a Core template id/,
@@ -52,11 +52,17 @@ export const doc = {
52
52
  type: 'string',
53
53
  description: 'One-sentence description of what the template provides.',
54
54
  },
55
+ {
56
+ name: 'keywords',
57
+ type: 'string[]',
58
+ description:
59
+ "Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field, drop that template, and hide the package's doc topics.",
60
+ },
55
61
  {
56
62
  name: 'replaces',
57
63
  type: 'string',
58
64
  description:
59
- "Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field and withhold the package's templates and doc topics.",
65
+ "Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field, drop that template, and hide the package's doc topics.",
60
66
  },
61
67
  {
62
68
  name: 'isReady',
@@ -26,6 +26,16 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
26
26
  /** One-sentence description of what the template provides. */
27
27
  description?: string;
28
28
 
29
+ /** Search keywords for CLI discovery: the ideas, domains, and other names a
30
+ * builder might use for what this template serves (e.g. `['monitoring',
31
+ * 'uptime', 'on-call']` for a service-health dashboard). Lowercase.
32
+ * `astryx search` matches them as it matches the description, and
33
+ * `astryx build` ranks page templates on them, so the `description` can
34
+ * stay a description of the layout. Integration templates need
35
+ * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field, drop
36
+ * that template, and hide the package's doc topics. */
37
+ keywords?: string[];
38
+
29
39
  /** Optional stable slug override and prior aliases for registry output. */
30
40
  registry?: RegistryDocIdentity;
31
41
 
@@ -33,8 +43,8 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
33
43
  * replaces for unqualified lookup (find it with
34
44
  * `astryx --json template --list --package @astryxdesign/core`). The Core
35
45
  * original stays selectable with `--package @astryxdesign/core`. Needs
36
- * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field and
37
- * withhold the package's templates and doc topics. */
46
+ * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field,
47
+ * drop that template, and hide the package's doc topics. */
38
48
  replaces?: string;
39
49
  /** Whether this template is ready for use. Templates with
40
50
  * isReady: false show as "(WIP)" in the gallery and CLI. */
@@ -3,6 +3,7 @@
3
3
 
4
4
  export { parseConfig } from "./config/parse.mjs";
5
5
  export { parseIntegration } from "./integration/parse.mjs";
6
+ export { parseDiscoverCatalog } from "./discover/parse.mjs";
6
7
  export { parseCodemod } from "./codemod/parse.mjs";
7
8
  export { parseDebugEvent } from "./debug/parse.mjs";
8
9
  export { parseDoc } from "./doctypes/parse.mjs";
@@ -44,6 +44,15 @@ export type {
44
44
  GapReportTarget,
45
45
  GapReportHandlerReceipt,
46
46
  } from './gap-report/type.js'; // gap-report handler contract
47
+ export type {
48
+ DiscoverSource,
49
+ DiscoverSourceContext,
50
+ DiscoverCatalog,
51
+ DiscoverPackage,
52
+ DiscoverVersion,
53
+ DiscoverContribution,
54
+ DiscoverKind,
55
+ } from './discover/type.js'; // discover source contract
47
56
  export type {AstryxCodemod, AstryxConfigCodemod} from './codemod/type.js'; // codemods/*
48
57
 
49
58
  // ═══════════════════════════════════════════════════════════════════════
@@ -67,6 +76,7 @@ export {
67
76
  parseGapReportHandler,
68
77
  parseGapReportReceipt,
69
78
  } from './gap-report/parse.mjs';
79
+ export {parseDiscoverCatalog} from './discover/parse.mjs';
70
80
  export {parseCodemod} from './codemod/parse.mjs';
71
81
  export {parseDebugEvent} from './debug/parse.mjs';
72
82
 
@@ -20,6 +20,7 @@ export {
20
20
  parseGapReportHandler,
21
21
  parseGapReportReceipt,
22
22
  } from './gap-report/parse.mjs';
23
+ export {parseDiscoverCatalog} from './discover/parse.mjs';
23
24
  export {parseCodemod} from './codemod/parse.mjs';
24
25
  export {parseDebugEvent} from './debug/parse.mjs';
25
26
  export {parseDoc} from './doctypes/parse.mjs';
@@ -23,48 +23,49 @@ export const doc = {
23
23
  name: 'providerId',
24
24
  type: 'string',
25
25
  description:
26
- 'Stable logical provider ID. Omit to use package.json#name; set it to the prior package name only when an explicit rename must preserve artifact IDs. If two packages claim the same ID, the package being authored is used, otherwise the first-loaded one, and the CLI warns about the other.',
26
+ 'The name that marks this package as the source of everything it contributes. Leave it out to use the package name from package.json. Set it to the old name only during a rename, so the IDs of what the package already contributed stay the same. If two packages use the same name here, the one you are working on wins; otherwise the one the CLI reads first wins, and the CLI warns about the other.',
27
27
  example: "'@acme/widgets'",
28
28
  },
29
29
  {
30
30
  name: 'components',
31
31
  type: 'string',
32
32
  description:
33
- 'Relative path to the components/docs root (resolved to absolute).',
33
+ 'The folder that holds your components and their docs, relative to package.json.',
34
34
  example: "'./src/components'",
35
35
  },
36
36
  {
37
37
  name: 'templates',
38
38
  type: 'string',
39
39
  description:
40
- 'Relative path to the templates root (resolved to absolute).',
40
+ 'The folder that holds your templates, relative to package.json.',
41
41
  example: "'./src/templates'",
42
42
  },
43
43
  {
44
44
  name: 'codemods',
45
45
  type: 'string',
46
- description: 'Relative path to the codemods root (resolved to absolute).',
46
+ description:
47
+ 'The folder that holds your codemods, relative to package.json.',
47
48
  example: "'./codemods'",
48
49
  },
49
50
  {
50
51
  name: 'docs',
51
52
  type: 'string',
52
53
  description:
53
- 'Relative path to the reference-docs (topics) root (resolved to absolute). Every {topic}.doc.{ts,mjs,js} under it is served by `astryx docs` beside the built-in topics; a topic may also declare `replaces` or `extends` to take the place of a built-in one or merge onto it.',
54
+ 'The folder that holds your doc topics, relative to package.json. Every {topic}.doc.{ts,mjs,js} in it shows up in `astryx docs` next to the built-in topics; a topic can also set `replaces` or `extends` to take over a built-in topic or add to it.',
54
55
  example: "'./docs'",
55
56
  },
56
57
  {
57
58
  name: 'themes',
58
59
  type: 'string',
59
60
  description:
60
- 'Relative path to a source-theme root with one directory per theme slug. Each directory contains a source module and mandatory same-stem, strongly typed .doc.mjs descriptor. Installed themes appear in `astryx theme list` and can be copied with `astryx theme add`.',
61
+ 'The folder that holds your themes, relative to package.json, with one folder per theme. Each theme folder has the theme source and a matching .doc.mjs file with the same name. Installed themes show up in `astryx theme list` and can be copied with `astryx theme add`.',
61
62
  example: "'./themes'",
62
63
  },
63
64
  {
64
65
  name: 'agentDocs',
65
66
  type: '{ append?: readonly string[] }',
66
67
  description:
67
- 'Static package guidance appended to the end of the managed agent block. The CLI owns the section heading, package labels, bullets, target files, and writes.',
68
+ 'Lines of guidance your package adds to the end of the agent instructions the CLI manages. The CLI owns the heading, labels, bullets, and which files it writes.',
68
69
  example: "{ append: ['Run acme verify.'] }",
69
70
  },
70
71
  {
@@ -94,9 +95,10 @@ export const doc = {
94
95
  {
95
96
  type: 'prose',
96
97
  text:
97
- 'Provider identity defaults to package.json#name. During an explicit ' +
98
- 'package rename, set `providerId` to the prior canonical package name so ' +
99
- 'existing artifact IDs remain stable. Package version always comes from package.json.',
98
+ 'The provider name defaults to the package name in package.json. ' +
99
+ 'During a rename, set `providerId` to the old package name so the IDs ' +
100
+ 'of what the package already contributed stay the same. The package ' +
101
+ 'version always comes from package.json.',
100
102
  },
101
103
  {
102
104
  type: 'prose',
@@ -38,6 +38,7 @@ import {doc as componentFn} from '../../../../api/component/component.doc.mjs';
38
38
  *
39
39
  * @typedef {(
40
40
  * | import('../../../../api/component/component.type.mjs').ComponentListResponse
41
+ * | import('../../../../api/component/component.type.mjs').ComponentBatchResponse
41
42
  * | import('../../../../api/component/component.type.mjs').ComponentDetailResponse
42
43
  * | import('../../../../api/component/component.type.mjs').ComponentDetailPropsResponse
43
44
  * | import('../../../../api/component/component.type.mjs').ComponentDetailSourceResponse
@@ -67,6 +68,11 @@ function summarize(result) {
67
68
  );
68
69
  return resultSet({count, resultKind: 'component'});
69
70
  }
71
+ case 'component.batch':
72
+ return resultSet({
73
+ count: result.data.results.filter(row => row.status === 'found').length,
74
+ resultKind: 'component',
75
+ });
70
76
  case 'component.detail':
71
77
  case 'component.detail.props':
72
78
  case 'component.detail.source':
@@ -82,19 +88,103 @@ function summarize(result) {
82
88
  }
83
89
  }
84
90
 
91
+ /**
92
+ * Project one single-component API result through the existing formatter kit.
93
+ * @param {import('../../../../api/component/component.type.mjs').ComponentSingleResponse} result
94
+ * @param {string} requestedName
95
+ * @param {'full'|'compact'|'brief'} detail
96
+ * @param {ReturnType<typeof resolveTheme>} themeData
97
+ * @returns {import('../../formatters/index.mjs').Block[]}
98
+ */
99
+ function componentDetailBlocks(result, requestedName, detail, themeData) {
100
+ const resolvedName = (requestedName.split('/').pop() ?? requestedName).replace(
101
+ /^XDS/,
102
+ '',
103
+ );
104
+ switch (result.type) {
105
+ case 'component.detail': {
106
+ /** @type {import('../../formatters/index.mjs').Block[]} */
107
+ const out = [];
108
+ if (result.data.parentDoc) {
109
+ out.push(record(result.data, {fields: ['parentDoc']}));
110
+ }
111
+ out.push(
112
+ detail === 'brief'
113
+ ? code(
114
+ formatBrief(result.data, resolvedName, result.data.import, {
115
+ themeData,
116
+ }),
117
+ )
118
+ : detail === 'compact'
119
+ ? code(
120
+ formatCompact(result.data, resolvedName, result.data.import),
121
+ )
122
+ : code(
123
+ formatFull(result.data, {
124
+ themeData,
125
+ importHint: result.data.import,
126
+ }),
127
+ ),
128
+ );
129
+ return out;
130
+ }
131
+ case 'component.detail.props':
132
+ return [code(formatProps({props: result.data}, resolvedName))];
133
+ case 'component.detail.source':
134
+ case 'component.detail.showcase':
135
+ return [code(result.data.source)];
136
+ case 'component.detail.blocks': {
137
+ const {showcase, examples, related} = result.data;
138
+ /** @type {import('../../formatters/index.mjs').Block[]} */
139
+ const out = [];
140
+ if (showcase) {
141
+ out.push(
142
+ section('Showcase'),
143
+ record(showcase, {fields: ['displayName', 'description']}),
144
+ );
145
+ }
146
+ if (examples.length > 0) {
147
+ out.push(
148
+ section('Examples'),
149
+ records(examples, {fields: ['name', 'description']}),
150
+ );
151
+ }
152
+ if (related.length > 0) {
153
+ out.push(
154
+ section(
155
+ `Related: ${related.length} blocks that use ${result.data.component}`,
156
+ ),
157
+ list(related.map(block => block.name)),
158
+ );
159
+ }
160
+ if (!showcase && examples.length === 0 && related.length === 0) {
161
+ out.push(text(`No blocks found for ${result.data.component}`));
162
+ }
163
+ return out;
164
+ }
165
+ default:
166
+ return [];
167
+ }
168
+ }
169
+
85
170
  /**
86
171
  * @param {import('commander').Command} program
87
172
  */
88
173
  export function registerComponent(program) {
89
174
  defineCommand(program, componentCommand, {
90
175
  fn: componentFn,
91
- action: async (/** @type {string | undefined} */ name, /** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options) => {
176
+ action: async (
177
+ /** @type {string[] | undefined} */ names,
178
+ /** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options,
179
+ ) => {
92
180
  const run = getCliInvocation();
181
+ const name = names?.length === 1 ? names[0] : undefined;
182
+ const apiInput = !names?.length ? undefined : name ?? names;
93
183
  const zh = program.opts().zh || false;
94
184
  const dense = program.opts().dense || false;
95
185
  const lang = program.opts().lang || null;
96
186
  const detailSource = program.getOptionValueSource('detail');
97
- const isListView = options.list || options.category || !name;
187
+ const isListView = options.list || options.category || !names?.length;
98
188
  // Default detail level is full for single-component view, brief for list views.
99
189
  // (List views are scannable name lists; users can opt into compact/full.)
100
190
  let detail = program.opts().detail || 'full';
@@ -119,7 +209,7 @@ export function registerComponent(program) {
119
209
  /** @type {ComponentResult} */
120
210
  let result;
121
211
  try {
122
- result = /** @type {ComponentResult} */ (await componentApi(name, {
212
+ result = /** @type {ComponentResult} */ (await componentApi(apiInput, {
123
213
  cwd: process.cwd(),
124
214
  list: options.list,
125
215
  category: options.category,
@@ -137,6 +227,12 @@ export function registerComponent(program) {
137
227
  }
138
228
 
139
229
  const answered = summarize(result);
230
+ if (
231
+ result.type === 'component.batch' &&
232
+ result.data.results.some(row => row.status !== 'found')
233
+ ) {
234
+ process.exitCode = 1;
235
+ }
140
236
  if (json) {
141
237
  jsonOut(result);
142
238
  return answered;
@@ -152,7 +248,7 @@ export function registerComponent(program) {
152
248
  const listFooter = text(
153
249
  [
154
250
  `Import from the path shown (e.g. import {Button} from '@astryxdesign/core/Button')`,
155
- `Usage: ${run} component <name>`,
251
+ `Usage: ${run} component <name> [name...]`,
156
252
  ].join('\n'),
157
253
  );
158
254
 
@@ -231,64 +327,65 @@ export function registerComponent(program) {
231
327
  break;
232
328
  }
233
329
 
234
- case 'component.detail': {
235
- const resolvedName = (name || '').replace(/^XDS/, '');
236
- const importHint = result.data.import;
237
- if (result.data.parentDoc) emit(record(result.data, {fields: ['parentDoc']}));
238
- const doc =
239
- detail === 'brief'
240
- ? code(formatBrief(result.data, resolvedName, importHint, {themeData}))
241
- : detail === 'compact'
242
- ? code(formatCompact(result.data, resolvedName, importHint))
243
- : code(formatFull(result.data, {themeData, importHint}));
244
- emit(doc);
245
- break;
246
- }
247
-
248
- case 'component.detail.props': {
249
- const resolvedName = (name || '').replace(/^XDS/, '');
250
- emit(code(formatProps({props: result.data}, resolvedName)));
251
- break;
252
- }
253
-
254
- case 'component.detail.source': {
255
- emit(code(result.data.source));
256
- break;
257
- }
258
-
259
- case 'component.detail.showcase': {
260
- emit(code(result.data.source));
261
- break;
262
- }
263
-
264
- case 'component.detail.blocks': {
265
- const {showcase, examples, related} = result.data;
330
+ case 'component.batch': {
266
331
  /** @type {import('../../formatters/index.mjs').Block[]} */
267
- const out = [];
268
- if (showcase) {
269
- out.push(
270
- section('Showcase'),
271
- record(showcase, {fields: ['displayName', 'description']}),
272
- );
273
- }
274
- if (examples.length > 0) {
275
- out.push(
276
- section('Examples'),
277
- records(examples, {fields: ['name', 'description']}),
278
- );
279
- }
280
- if (related.length > 0) {
332
+ const out = [
333
+ section('Component batch'),
334
+ record({count: result.data.count}),
335
+ section('Results'),
336
+ ];
337
+ for (const row of result.data.results) {
338
+ out.push(section(row.selector));
339
+ if (row.status === 'found') {
340
+ out.push(
341
+ record(row, {fields: ['selector', 'status']}),
342
+ section('Result'),
343
+ ...componentDetailBlocks(
344
+ row.result,
345
+ row.selector,
346
+ detail,
347
+ themeData,
348
+ ),
349
+ );
350
+ continue;
351
+ }
281
352
  out.push(
282
- section(`Related: ${related.length} blocks that use ${result.data.component}`),
283
- list(related.map(b => b.name)),
353
+ record(row, {
354
+ fields: ['selector', 'status', 'code', 'error'],
355
+ }),
284
356
  );
285
- }
286
- if (!showcase && examples.length === 0 && related.length === 0) {
287
- out.push(text(`No blocks found for ${result.data.component}`));
357
+ if (row.status === 'ambiguous') {
358
+ out.push(
359
+ section('Candidates'),
360
+ records(row.candidates, {
361
+ fields: ['package', 'component', 'kind', 'installed'],
362
+ }),
363
+ );
364
+ } else if (row.suggestions?.length) {
365
+ out.push(
366
+ section('Suggestions'),
367
+ records(row.suggestions, {fields: ['name', 'reason']}),
368
+ );
369
+ }
288
370
  }
289
371
  emit(...out);
290
372
  break;
291
373
  }
374
+
375
+ case 'component.detail':
376
+ case 'component.detail.props':
377
+ case 'component.detail.source':
378
+ case 'component.detail.showcase':
379
+ case 'component.detail.blocks':
380
+ emit(
381
+ ...componentDetailBlocks(
382
+ result,
383
+ name ?? '',
384
+ detail,
385
+ themeData,
386
+ ),
387
+ );
388
+ break;
292
389
  }
293
390
  return answered;
294
391
  },