@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
@@ -68,16 +68,6 @@ export function requireCoreDir(cwd: string): string;
68
68
  * @returns {Promise<import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]>}
69
69
  */
70
70
  export function loadIntegrationsSafely(cwd: string): Promise<import("../../foundation/integrations/integrations.mjs").LoadedIntegration[]>;
71
- /**
72
- * Read the exact installed version available to a package-qualified component
73
- * selector. Legacy docs packages do not expose a reliable version here, so a
74
- * version-qualified lookup never falls through to them.
75
- * @param {string} coreDir
76
- * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
77
- * @param {string} packageName
78
- * @returns {string|null}
79
- */
80
- export function installedComponentPackageVersion(coreDir: string, loadedIntegrations: import("../../foundation/integrations/integrations.mjs").LoadedIntegration[], packageName: string): string | null;
81
71
  /**
82
72
  * Build the set of OWNER packages that provide a component with this name
83
73
  * across core + every loaded integration. This is what lets the CLI
@@ -190,20 +180,6 @@ export function scopeSubComponent(docs: LoadedComponentDoc, dirName: string, cor
190
180
  matchingComponent: any;
191
181
  } | null;
192
182
  export { CORE_PACKAGE };
193
- /**
194
- * Internal ambiguity marker. Single-component callers still receive the same
195
- * AstryxError code, message, and suggestions; batch callers can additionally
196
- * project every installed candidate without parsing prose.
197
- */
198
- export class ComponentAmbiguityError extends AstryxError {
199
- /**
200
- * @param {ComponentOwner[]} owners
201
- * @param {string} dirName
202
- */
203
- constructor(owners: ComponentOwner[], dirName: string);
204
- /** @type {import('./component.type.mjs').ComponentBatchCandidate[]} */
205
- candidates: import("./component.type.mjs").ComponentBatchCandidate[];
206
- }
207
183
  /**
208
184
  * A loaded component doc. The shared validated loader accepts stamped and legacy
209
185
  * component docs; this loose view captures the fields the API reads across both.
@@ -282,4 +258,3 @@ export type ResolvedUnscopedDoc = {
282
258
  resolvedSourcePath: string | null;
283
259
  };
284
260
  import { CORE_PACKAGE } from '../../foundation/discovery/component-discovery.mjs';
285
- import { AstryxError } from '../error.mjs';
@@ -18,8 +18,6 @@
18
18
  * deduped, so each leaf stays a thin projection.
19
19
  */
20
20
 
21
- import * as fs from 'node:fs';
22
- import * as path from 'node:path';
23
21
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
24
22
  import {
25
23
  findCoreDir,
@@ -148,34 +146,6 @@ function findLoadedIntegration(loadedIntegrations, packageName) {
148
146
  return loadedIntegrations.find(i => i.name === packageName) ?? null;
149
147
  }
150
148
 
151
- /**
152
- * Read the exact installed version available to a package-qualified component
153
- * selector. Legacy docs packages do not expose a reliable version here, so a
154
- * version-qualified lookup never falls through to them.
155
- * @param {string} coreDir
156
- * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
157
- * @param {string} packageName
158
- * @returns {string|null}
159
- */
160
- export function installedComponentPackageVersion(
161
- coreDir,
162
- loadedIntegrations,
163
- packageName,
164
- ) {
165
- if (packageName === CORE_PACKAGE) {
166
- try {
167
- const pkg = JSON.parse(
168
- fs.readFileSync(path.join(coreDir, 'package.json'), 'utf8'),
169
- );
170
- return typeof pkg.version === 'string' ? pkg.version : null;
171
- } catch {
172
- return null;
173
- }
174
- }
175
- const integration = findLoadedIntegration(loadedIntegrations, packageName);
176
- return typeof integration?.version === 'string' ? integration.version : null;
177
- }
178
-
179
149
  /**
180
150
  * Resolve an external package by name from the discovered externals list.
181
151
  * @param {string} packageName - e.g. '@acme/xds-widgets'
@@ -274,34 +244,6 @@ export function classifyScope(
274
244
  return {kind: 'legacy', ext};
275
245
  }
276
246
 
277
- /**
278
- * Internal ambiguity marker. Single-component callers still receive the same
279
- * AstryxError code, message, and suggestions; batch callers can additionally
280
- * project every installed candidate without parsing prose.
281
- */
282
- export class ComponentAmbiguityError extends AstryxError {
283
- /** @type {import('./component.type.mjs').ComponentBatchCandidate[]} */
284
- candidates;
285
-
286
- /**
287
- * @param {ComponentOwner[]} owners
288
- * @param {string} dirName
289
- */
290
- constructor(owners, dirName) {
291
- super(
292
- `Component "${dirName}" is provided by multiple packages. Re-run with --package <pkg> to choose one.`,
293
- owners.map(o => ({name: o.package, reason: 'provides this component'})),
294
- ERROR_CODES.ERR_UNKNOWN_COMPONENT,
295
- );
296
- this.candidates = owners.map(owner => ({
297
- package: owner.package,
298
- component: dirName,
299
- kind: 'component',
300
- installed: true,
301
- }));
302
- }
303
- }
304
-
305
247
  /**
306
248
  * Refuse to guess when the name is owned by MORE THAN ONE package (core and/or
307
249
  * integrations) and the caller did not scope with --package. Legacy
@@ -312,7 +254,11 @@ export class ComponentAmbiguityError extends AstryxError {
312
254
  */
313
255
  export function assertUnambiguousOwners(owners, dirName) {
314
256
  if (owners.length > 1) {
315
- throw new ComponentAmbiguityError(owners, dirName);
257
+ throw new AstryxError(
258
+ `Component "${dirName}" is provided by multiple packages. Re-run with --package <pkg> to choose one.`,
259
+ owners.map(o => ({name: o.package, reason: 'provides this component'})),
260
+ ERROR_CODES.ERR_UNKNOWN_COMPONENT,
261
+ );
316
262
  }
317
263
  }
318
264
 
@@ -2,7 +2,7 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * @param {string|string[]} [name]
5
+ * @param {string} [name]
6
6
  * @param {object} [options]
7
7
  * @param {string} [options.cwd]
8
8
  * @param {boolean} [options.list]
@@ -18,7 +18,6 @@
18
18
  * @param {boolean} [options.dense]
19
19
  * @returns {Promise<(
20
20
  * import('./component.type.mjs').ComponentListResponse
21
- * | import('./component.type.mjs').ComponentBatchResponse
22
21
  * | import('./component.type.mjs').ComponentDetailResponse
23
22
  * | import('./component.type.mjs').ComponentDetailPropsResponse
24
23
  * | import('./component.type.mjs').ComponentDetailSourceResponse
@@ -26,7 +25,7 @@
26
25
  * | import('./component.type.mjs').ComponentDetailBlocksResponse
27
26
  * )>}
28
27
  */
29
- export function component(name?: string | string[], options?: {
28
+ export function component(name?: string, options?: {
30
29
  cwd?: string | undefined;
31
30
  list?: boolean | undefined;
32
31
  category?: string | undefined;
@@ -39,6 +38,4 @@ export function component(name?: string | string[], options?: {
39
38
  lang?: string | undefined;
40
39
  zh?: boolean | undefined;
41
40
  dense?: boolean | undefined;
42
- }): Promise<(import("./component.type.mjs").ComponentListResponse | import("./component.type.mjs").ComponentBatchResponse | import("./component.type.mjs").ComponentDetailResponse | import("./component.type.mjs").ComponentDetailPropsResponse | import("./component.type.mjs").ComponentDetailSourceResponse | import("./component.type.mjs").ComponentDetailShowcaseResponse | import("./component.type.mjs").ComponentDetailBlocksResponse)>;
43
- /** Maximum selectors accepted before any component resolution starts. */
44
- export const COMPONENT_BATCH_SELECTOR_LIMIT: 100;
41
+ }): Promise<(import("./component.type.mjs").ComponentListResponse | import("./component.type.mjs").ComponentDetailResponse | import("./component.type.mjs").ComponentDetailPropsResponse | import("./component.type.mjs").ComponentDetailSourceResponse | import("./component.type.mjs").ComponentDetailShowcaseResponse | import("./component.type.mjs").ComponentDetailBlocksResponse)>;
@@ -15,16 +15,16 @@ export const doc = {
15
15
  namespace: 'cli/api',
16
16
  displayName: 'component()',
17
17
  summary:
18
- 'Resolve one or several components by name, or list the catalog, with optional focused slices (props, source, showcase, blocks).',
18
+ 'Resolve a component by name, or list the catalog, with optional focused slices (props, source, showcase, blocks).',
19
19
  description:
20
- 'Routes on its arguments: one string resolves that component across core and ' +
21
- 'integration packages; an array returns one ordered result row per selector at ' +
22
- 'every array length; and no name returns the catalog grouped by category. ' +
23
- 'Boolean flags narrow each resolved component to just its props, source, ' +
24
- 'showcase, or example blocks.',
20
+ 'Routes on its arguments: a name resolves that component across core and ' +
21
+ 'integration packages and returns its authored ComponentDoc plus ownership ' +
22
+ 'metadata; no name (or `list`/`category`) returns the catalog grouped by ' +
23
+ 'category. Boolean flags narrow a single component to just its props, ' +
24
+ 'source, showcase, or example blocks.',
25
25
  importPath: '@astryxdesign/cli/api',
26
26
  signature:
27
- 'component(name?: string | string[], options?: ComponentOptions): Promise<ComponentListResponse | ComponentBatchResponse | ComponentDetailResponse | ComponentDetailPropsResponse | ComponentDetailSourceResponse | ComponentDetailShowcaseResponse | ComponentDetailBlocksResponse>',
27
+ 'component(name?: string, options?: ComponentOptions): Promise<ComponentListResponse | ComponentDetailResponse | ComponentDetailPropsResponse | ComponentDetailSourceResponse | ComponentDetailShowcaseResponse | ComponentDetailBlocksResponse>',
28
28
  keywords: [
29
29
  'component',
30
30
  'components',
@@ -37,15 +37,14 @@ export const doc = {
37
37
  params: [
38
38
  {
39
39
  name: 'name',
40
- type: 'string | string[]',
40
+ type: 'string',
41
41
  description:
42
- "Pass one selector string for the existing single-result response, or an array of at most 100 selectors for an ordered component.batch response. The limit counts duplicates in every projection mode. An array always requests a batch, including [] and ['Button']. Use 'Button', 'widgets/Button', '@acme/widgets/Button', or '@acme/widgets@1.2.3/Button'. A version applies to the package and must match the installed version. Omit the argument to list the catalog.",
42
+ "Component name to resolve (e.g. 'Button'). Omit to list the catalog.",
43
43
  },
44
44
  {
45
45
  name: 'options.cwd',
46
46
  type: 'string',
47
47
  description: 'Directory to resolve @astryxdesign/core from.',
48
- default: 'process.cwd()',
49
48
  },
50
49
  {
51
50
  name: 'options.list',
@@ -55,14 +54,13 @@ export const doc = {
55
54
  {
56
55
  name: 'options.category',
57
56
  type: 'string',
58
- description:
59
- "List only the components in this group: a key of the unfiltered list (each component's group field), such as 'Layout' or 'Button'. It is not the category field of a component detail.",
57
+ description: 'List only components in this category.',
60
58
  },
61
59
  {
62
60
  name: 'options.package',
63
61
  type: 'string',
64
62
  description:
65
- "Scope lookup to a specific external package (e.g. '@acme/widgets').",
63
+ "Scope lookup to a specific external package (e.g. '@acme/xds-widgets').",
66
64
  },
67
65
  {
68
66
  name: 'options.props',
@@ -89,8 +87,7 @@ export const doc = {
89
87
  name: 'options.detail',
90
88
  type: "'full' | 'compact' | 'brief'",
91
89
  description: 'Detail level for list views.',
92
- default:
93
- "'full' for a named component; 'brief' for lists (returned as data.detail: 'names')",
90
+ default: "'full' for a named component, 'brief' for list views",
94
91
  },
95
92
  {
96
93
  name: 'options.lang',
@@ -113,12 +110,7 @@ export const doc = {
113
110
  {
114
111
  type: 'component.list',
115
112
  description:
116
- "The catalog grouped by component group. data.detail is the level ('names' | 'compact' | 'full') and data.components is the grouped map: names entries with name, package, and an optional canonical import for integration and legacy package components; brief entries; or full ComponentDoc entries.",
117
- },
118
- {
119
- type: 'component.batch',
120
- description:
121
- 'An explicit selector array returns one ordered receipt at every array length: count and one results row per selector, including duplicates. ComponentBatchResponse specializes the shared BatchResponse and BatchRow types. Each row carries selector and status (found, not_found, ambiguous, or error); found rows carry the single-selector result, ambiguous rows carry installed candidates ({package, component, kind, installed}), and failed rows carry code, error, and optional suggestions.',
113
+ "The catalog grouped by category. data.detail is the level ('names' | 'compact' | 'full') and data.components is the grouped map: names entries with name, package, and an optional canonical import for integration and legacy package components; brief entries; or full ComponentDoc entries.",
122
114
  },
123
115
  {
124
116
  type: 'component.detail',
@@ -145,10 +137,6 @@ export const doc = {
145
137
  },
146
138
  ],
147
139
  throws: [
148
- {
149
- code: 'ERR_INVALID_ARGUMENT',
150
- when: 'a selector array has more than 100 entries, a package-shaped selector has no component item, or its package conflicts with options.package',
151
- },
152
140
  {
153
141
  code: 'ERR_INVALID_DETAIL',
154
142
  when: "options.detail is not 'full', 'compact', or 'brief'",
@@ -163,7 +151,7 @@ export const doc = {
163
151
  },
164
152
  {
165
153
  code: 'ERR_UNKNOWN_CATEGORY',
166
- when: 'options.category is not a string or matches no component group',
154
+ when: 'options.category is not a string or matches no known category',
167
155
  },
168
156
  {
169
157
  code: 'ERR_UNKNOWN_COMPONENT',
@@ -171,16 +159,12 @@ export const doc = {
171
159
  },
172
160
  {
173
161
  code: 'ERR_UNKNOWN_PACKAGE',
174
- when: 'options.package names a legacy external package that cannot be found, or a package-qualified selector requests a version that is not installed',
162
+ when: 'options.package names a legacy external package that cannot be found',
175
163
  },
176
164
  {
177
165
  code: 'ERR_NO_DOC',
178
166
  when: 'the resolved component has no .doc.mjs typed doc file',
179
167
  },
180
- {
181
- code: 'ERR_INVALID_DOC',
182
- when: "the resolved component's .doc.mjs fails to load or validate",
183
- },
184
168
  {
185
169
  code: 'ERR_NO_SOURCE',
186
170
  when: 'options.source is set but the component has no source file',
@@ -195,14 +179,10 @@ export const doc = {
195
179
  label: 'Look up a component',
196
180
  code: "const r = await component('Button');",
197
181
  },
198
- {
199
- label: 'Look up several components',
200
- code: "await component(['Button', 'Badge']);",
201
- },
202
182
  {label: 'Props only', code: "await component('Button', {props: true});"},
203
183
  {
204
- label: 'Browse one group',
205
- code: "await component(undefined, {category: 'Layout', detail: 'compact'});",
184
+ label: 'Browse a category',
185
+ code: "await component(undefined, {category: 'Form', detail: 'compact'});",
206
186
  },
207
187
  ],
208
188
  command: 'component',
@@ -4,10 +4,10 @@
4
4
  * @file Programmatic API for the component command — DISPATCHER + BARREL.
5
5
  *
6
6
  * Returns the same typed envelope { type, data } that `astryx --json component`
7
- * outputs. `component(name, opts)` parses one selector or an ordered selector
8
- * list, resolves each subject through `_adapter`, and routes to the correct leaf
9
- * (list · detail · detail.props/source/showcase/blocks). The CLI command handler
10
- * is a thin wrapper around this function.
7
+ * outputs. `component(name, opts)` parses the (name, options) pair, resolves the
8
+ * subject once via `_adapter`, and routes to the correct leaf
9
+ * (list · detail · detail.props/source/showcase/blocks), returning that leaf's
10
+ * envelope. The CLI command handler is a thin wrapper around this function.
11
11
  *
12
12
  * Every leaf is also re-exported for direct scripting use.
13
13
  */
@@ -26,8 +26,6 @@ import {
26
26
  resolveUnscopedDoc,
27
27
  loadComponentDoc,
28
28
  scopeSubComponent,
29
- ComponentAmbiguityError,
30
- installedComponentPackageVersion,
31
29
  } from './_adapter.mjs';
32
30
  import {componentList} from './list/list.mjs';
33
31
  import {componentDetail} from './detail/detail.mjs';
@@ -36,199 +34,13 @@ import {componentDetailSource} from './detail/source/source.mjs';
36
34
  import {componentDetailShowcase} from './detail/showcase/showcase.mjs';
37
35
  import {componentDetailBlocks} from './detail/blocks/blocks.mjs';
38
36
 
39
- /** Maximum selectors accepted before any component resolution starts. */
40
- export const COMPONENT_BATCH_SELECTOR_LIMIT = 100;
41
-
42
37
  /** @type {ReadonlyArray<string>} */
43
38
  const DETAIL_LEVELS = ['full', 'compact', 'brief'];
44
39
  /** @type {ReadonlyArray<string>} */
45
40
  const LANGS = ['en', 'zh', 'dense'];
46
- /** @type {Set<string>} */
47
- const NOT_FOUND_CODES = new Set([
48
- ERROR_CODES.ERR_UNKNOWN_COMPONENT,
49
- ERROR_CODES.ERR_UNKNOWN_PACKAGE,
50
- ERROR_CODES.ERR_NOT_FOUND,
51
- ]);
52
-
53
- /**
54
- * Discover-compatible package target grammar. Versions belong to the package
55
- * head, never the item after the package slash.
56
- * @param {string} selector
57
- * @returns {{scoped: boolean, name: string, version?: string, item?: string}}
58
- */
59
- function splitSelector(selector) {
60
- const scoped = selector.startsWith('@');
61
- const firstSlash = selector.indexOf('/');
62
- let head = selector;
63
- /** @type {string | undefined} */
64
- let rest;
65
- const split = scoped
66
- ? firstSlash < 0
67
- ? -1
68
- : selector.indexOf('/', firstSlash + 1)
69
- : firstSlash;
70
- if (split > 0) {
71
- head = selector.slice(0, split);
72
- rest = selector.slice(split + 1) || undefined;
73
- }
74
- const at = head.indexOf('@', 1);
75
- return {
76
- scoped,
77
- name: at > 0 ? head.slice(0, at) : head,
78
- ...(at > 0 && head.slice(at + 1) ? {version: head.slice(at + 1)} : {}),
79
- ...(rest ? {item: rest} : {}),
80
- };
81
- }
82
-
83
- /**
84
- * Resolve one component selector into the existing single-component API inputs.
85
- * @param {unknown} value
86
- * @param {string|undefined} packageScope
87
- * @returns {{selector: string, name: string, package?: string, version?: string}}
88
- */
89
- function parseComponentSelector(value, packageScope) {
90
- if (typeof value !== 'string' || value.length === 0) {
91
- throw new AstryxError(
92
- `Invalid component selector "${String(value)}"`,
93
- undefined,
94
- ERROR_CODES.ERR_INVALID_ARGUMENT,
95
- );
96
- }
97
- const target = splitSelector(value);
98
- const packageShaped =
99
- target.scoped || target.item != null || target.version != null;
100
- if (!packageShaped) {
101
- return {selector: value, name: target.name, package: packageScope};
102
- }
103
- if (!target.item) {
104
- throw new AstryxError(
105
- `Component selector "${value}" names a package but no component`,
106
- undefined,
107
- ERROR_CODES.ERR_INVALID_ARGUMENT,
108
- );
109
- }
110
- if (packageScope && packageScope !== target.name) {
111
- throw new AstryxError(
112
- `Component selector "${value}" conflicts with --package "${packageScope}"`,
113
- undefined,
114
- ERROR_CODES.ERR_INVALID_ARGUMENT,
115
- );
116
- }
117
- return {
118
- selector: value,
119
- name: target.item,
120
- package: target.name,
121
- ...(target.version ? {version: target.version} : {}),
122
- };
123
- }
124
-
125
- /**
126
- * A version-qualified selector never falls through to another installed
127
- * version. Its structured suggestion points at the command that can discover
128
- * the requested package release.
129
- * @param {{package?: string, version?: string}} target
130
- * @param {string} coreDir
131
- * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
132
- * @returns {void}
133
- */
134
- function requireInstalledSelectorVersion(target, coreDir, loadedIntegrations) {
135
- if (!target.version) return;
136
- const packageName = /** @type {string} */ (target.package);
137
- const installed = installedComponentPackageVersion(
138
- coreDir,
139
- loadedIntegrations,
140
- packageName,
141
- );
142
- if (installed === target.version) return;
143
- const exact = `${packageName}@${target.version}`;
144
- throw new AstryxError(
145
- `Package "${exact}" is not installed`,
146
- [
147
- {
148
- name: `astryx discover ${exact}`,
149
- reason: 'look up this package version',
150
- },
151
- ],
152
- ERROR_CODES.ERR_UNKNOWN_PACKAGE,
153
- );
154
- }
155
-
156
- /**
157
- * Turn a single-lookup failure into one complete batch row.
158
- * @param {string} selector
159
- * @param {unknown} error
160
- * @returns {import('./component.type.mjs').ComponentBatchResult}
161
- */
162
- function batchFailure(selector, error) {
163
- const err =
164
- error instanceof AstryxError
165
- ? error
166
- : new AstryxError(
167
- error instanceof Error ? error.message : String(error),
168
- undefined,
169
- ERROR_CODES.ERR_UNKNOWN,
170
- );
171
- if (err instanceof ComponentAmbiguityError) {
172
- return {
173
- selector,
174
- status: 'ambiguous',
175
- code: err.code,
176
- error: err.message,
177
- candidates: err.candidates,
178
- };
179
- }
180
- return {
181
- selector,
182
- status: NOT_FOUND_CODES.has(err.code) ? 'not_found' : 'error',
183
- code: err.code,
184
- error: err.message,
185
- ...(err.suggestions ? {suggestions: err.suggestions} : {}),
186
- };
187
- }
188
41
 
189
42
  /**
190
- * @param {unknown[]} selectors
191
- * @param {object} options
192
- * @param {string} options.cwd
193
- * @param {string} [options.package]
194
- * @param {boolean} [options.props]
195
- * @param {boolean} [options.source]
196
- * @param {boolean} [options.showcase]
197
- * @param {boolean} [options.blocks]
198
- * @param {'full'|'compact'|'brief'} [options.detail]
199
- * @param {string|null} [options.lang]
200
- * @param {boolean} [options.zh]
201
- * @param {boolean} [options.dense]
202
- * @param {string} coreDir
203
- * @returns {Promise<import('./component.type.mjs').ComponentBatchResponse>}
204
- */
205
- async function componentBatch(selectors, options, coreDir) {
206
- const loadedIntegrations = await loadIntegrationsSafely(options.cwd);
207
- /** @type {import('./component.type.mjs').ComponentBatchResult[]} */
208
- const results = [];
209
- for (const value of selectors) {
210
- const selector = typeof value === 'string' ? value : String(value);
211
- try {
212
- const target = parseComponentSelector(value, options.package);
213
- requireInstalledSelectorVersion(target, coreDir, loadedIntegrations);
214
- const result =
215
- /** @type {import('./component.type.mjs').ComponentSingleResponse} */ (
216
- await component(target.name, {
217
- ...options,
218
- lang: options.lang ?? undefined,
219
- package: target.package,
220
- })
221
- );
222
- results.push({selector, status: 'found', result});
223
- } catch (error) {
224
- results.push(batchFailure(selector, error));
225
- }
226
- }
227
- return {type: 'component.batch', data: {count: results.length, results}};
228
- }
229
-
230
- /**
231
- * @param {string|string[]} [name]
43
+ * @param {string} [name]
232
44
  * @param {object} [options]
233
45
  * @param {string} [options.cwd]
234
46
  * @param {boolean} [options.list]
@@ -244,7 +56,6 @@ async function componentBatch(selectors, options, coreDir) {
244
56
  * @param {boolean} [options.dense]
245
57
  * @returns {Promise<(
246
58
  * import('./component.type.mjs').ComponentListResponse
247
- * | import('./component.type.mjs').ComponentBatchResponse
248
59
  * | import('./component.type.mjs').ComponentDetailResponse
249
60
  * | import('./component.type.mjs').ComponentDetailPropsResponse
250
61
  * | import('./component.type.mjs').ComponentDetailSourceResponse
@@ -268,16 +79,11 @@ export async function component(name, options = {}) {
268
79
  dense = false,
269
80
  } = options;
270
81
 
271
- const selectorList = Array.isArray(name) ? name : null;
272
- const noName = selectorList == null && !name;
273
-
274
82
  // Default detail level mirrors the CLI (see commands/component/index.mjs):
275
83
  // single-component views default to 'full', list-style views (--list,
276
84
  // --category, or no name) default to 'brief' (scannable name lists).
277
- // An explicit array remains a batch even when it is empty or a caller also
278
- // passes a list-only option.
279
- const isListView =
280
- selectorList == null && (list || category != null || noName);
85
+ // Keeping this in sync with the CLI is what the API↔CLI parity test checks.
86
+ const isListView = list || category != null || !name;
281
87
  const detail = detailOption ?? (isListView ? 'brief' : 'full');
282
88
 
283
89
  // Same accepted values and codes as the CLI's --detail and --lang, checked
@@ -297,14 +103,6 @@ export async function component(name, options = {}) {
297
103
  );
298
104
  }
299
105
 
300
- if (selectorList && selectorList.length > COMPONENT_BATCH_SELECTOR_LIMIT) {
301
- throw new AstryxError(
302
- `Component batch accepts at most ${COMPONENT_BATCH_SELECTOR_LIMIT} selectors; received ${selectorList.length}`,
303
- undefined,
304
- ERROR_CODES.ERR_INVALID_ARGUMENT,
305
- );
306
- }
307
-
308
106
  const coreDir = requireCoreDir(cwd);
309
107
 
310
108
  // A public API caller could pass a non-string category; the list leaf does
@@ -318,46 +116,11 @@ export async function component(name, options = {}) {
318
116
  );
319
117
  }
320
118
 
321
- // ── Explicit batch selector list ─────────────────────────────────
322
- // Array shape owns cardinality even if a caller also supplies a list-only
323
- // option. The aggregate limit above is checked before core or integrations
324
- // are resolved, so an oversized request can never emit a partial receipt.
325
- if (selectorList) {
326
- return componentBatch(
327
- selectorList,
328
- {
329
- cwd,
330
- package: packageScope,
331
- props,
332
- source,
333
- showcase,
334
- blocks,
335
- detail,
336
- lang,
337
- zh,
338
- dense,
339
- },
340
- coreDir,
341
- );
342
- }
343
-
344
119
  // ── List mode ──────────────────────────────────────────────────
345
- if (category || list || noName) {
120
+ if (category || list || !name) {
346
121
  return componentList(coreDir, {cwd, category, detail, zh, dense, lang});
347
122
  }
348
123
 
349
- if (typeof name === 'string') {
350
- const target = parseComponentSelector(name, packageScope);
351
- if (target.version) {
352
- const loadedIntegrations = await loadIntegrationsSafely(cwd);
353
- requireInstalledSelectorVersion(target, coreDir, loadedIntegrations);
354
- }
355
- if (target.name !== name || target.package !== packageScope) {
356
- return component(target.name, {...options, package: target.package});
357
- }
358
- name = target.name;
359
- }
360
-
361
124
  // ── Single component ───────────────────────────────────────────
362
125
  if (typeof name !== 'string') {
363
126
  throw new AstryxError(
@@ -423,10 +186,7 @@ export async function component(name, options = {}) {
423
186
  if (extDocPath) {
424
187
  // Legacy packages ship docs, never source.
425
188
  if (source) {
426
- return componentDetailSource(dirName, null, {
427
- name,
428
- notFoundInPackage: packageScope,
429
- });
189
+ return componentDetailSource(dirName, null, {name, notFoundInPackage: packageScope});
430
190
  }
431
191
  if (blocks) {
432
192
  return componentDetailBlocks(dirName, cwd);
@@ -28,31 +28,6 @@ export type ComponentListData = ({
28
28
  detail: "full";
29
29
  components: Record<string, import("@astryxdesign/cli/authoring").ComponentDoc[]>;
30
30
  });
31
- /**
32
- * `component(string[])` always returns this type, including empty and one-item
33
- * arrays. The CLI returns it for two or more positional selectors.
34
- */
35
- export type ComponentBatchResponse = import("../../foundation/response/batch.type.mjs").BatchResponse<"component.batch", ComponentSingleResponse, ComponentBatchCandidate>;
36
- /**
37
- * One installed component that makes an unqualified selector ambiguous.
38
- * Keys match a component row in `discover.search` so a caller does not learn a
39
- * second candidate shape.
40
- */
41
- export type ComponentBatchCandidate = {
42
- package: string;
43
- component: string;
44
- kind: "component";
45
- installed: true;
46
- };
47
- /**
48
- * The response a successful single selector would have returned.
49
- */
50
- export type ComponentSingleResponse = (ComponentDetailResponse | ComponentDetailPropsResponse | ComponentDetailSourceResponse | ComponentDetailShowcaseResponse | ComponentDetailBlocksResponse);
51
- /**
52
- * One row per requested selector, in argument order. Duplicate selectors keep
53
- * duplicate rows.
54
- */
55
- export type ComponentBatchResult = import("../../foundation/response/batch.type.mjs").BatchRow<ComponentSingleResponse, ComponentBatchCandidate>;
56
31
  /**
57
32
  * A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
58
33
  * list moved from bare strings to package-qualified objects so consumers can