@astryxdesign/cli 0.7.0-canary.693da50 → 0.7.0-canary.7ec7d16

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 (224) hide show
  1. package/README.md +79 -84
  2. package/api/build/build.mjs +9 -0
  3. package/api/component/_adapter.d.mts +2 -0
  4. package/api/component/_adapter.mjs +3 -1
  5. package/api/component/component.doc.mjs +5 -1
  6. package/api/docs/compiled-topics.test.mjs +16 -0
  7. package/api/doctor/doctor.doc.mjs +1 -1
  8. package/api/doctor/doctor.test.mjs +28 -0
  9. package/api/doctor/theme-checks.mjs +10 -10
  10. package/api/doctor/theme-checks.test.mjs +5 -4
  11. package/api/gap-report/gap-report.doc.mjs +1 -1
  12. package/api/gap-report/gap-report.mjs +15 -0
  13. package/api/gap-report/gap-report.test.mjs +1 -1
  14. package/api/index.d.mts +0 -2
  15. package/api/index.mjs +0 -2
  16. package/api/init/init.doc.mjs +5 -1
  17. package/api/init/init.mjs +22 -0
  18. package/api/init/init.type.d.mts +4 -1
  19. package/api/init/init.type.mjs +1 -1
  20. package/api/init/remove/remove.mjs +8 -3
  21. package/api/init/remove/remove.test.mjs +12 -0
  22. package/api/init/run/run.d.mts +1 -1
  23. package/api/init/run/run.mjs +3 -3
  24. package/api/integration/pack-check.test.mjs +8 -0
  25. package/api/integration/validate-integration.d.mts +4 -0
  26. package/api/integration/validate-integration.mjs +5 -2
  27. package/api/integration/validateIntegration.doc.mjs +1 -1
  28. package/api/json/index.ts +0 -1
  29. package/api/search/search.doc.mjs +1 -1
  30. package/api/search/search.mjs +1 -1
  31. package/api/search/search.test.mjs +1 -1
  32. package/api/search/search.type.d.mts +1 -1
  33. package/api/search/search.type.mjs +1 -1
  34. package/api/template/list/list.mjs +23 -2
  35. package/api/template/list/list.test.mjs +52 -0
  36. package/api/template/template-integration.test.mjs +37 -100
  37. package/api/template/template.doc.mjs +8 -3
  38. package/api/template/template.mjs +45 -0
  39. package/api/template/template.type.mjs +1 -1
  40. package/api/theme/_adapter.mjs +3 -3
  41. package/api/theme/add/add.d.mts +11 -5
  42. package/api/theme/add/add.mjs +19 -192
  43. package/api/theme/add/add.test.mjs +68 -258
  44. package/api/theme/add/add.types.test.mjs +0 -1
  45. package/api/theme/build/build.d.mts +3 -4
  46. package/api/theme/build/build.mjs +26 -65
  47. package/api/theme/build/build.test.mjs +11 -24
  48. package/api/theme/build/family.mjs +1 -1
  49. package/api/theme/eject/eject.copy-compat.test.mjs +168 -0
  50. package/api/theme/integration-themes.test.mjs +3 -3
  51. package/api/theme/remove/remove.test.mjs +1 -1
  52. package/api/theme/targets/targets.test.mjs +0 -4
  53. package/api/theme/template/template.mjs +1 -1
  54. package/api/theme/theme.type.d.mts +1 -30
  55. package/api/theme/theme.type.mjs +3 -13
  56. package/api/theme/themeAdd.doc.mjs +19 -27
  57. package/api/theme/themeTargets.doc.mjs +3 -4
  58. package/api/theme/themeTemplate.doc.mjs +1 -1
  59. package/api/theme/use/use.test.mjs +1 -1
  60. package/api/upgrade/upgrade.doc.mjs +1 -1
  61. package/api/upgrade/upgrade.mjs +19 -0
  62. package/assets/codemods/transforms/next/__tests__/migrate-deprecated-theme-surface.test.mjs +322 -0
  63. package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
  64. package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
  65. package/assets/codemods/transforms/next/index.mjs +27 -1
  66. package/assets/codemods/transforms/next/migrate-deprecated-theme-surface-v0.6-data.mjs +229 -0
  67. package/assets/codemods/transforms/next/migrate-deprecated-theme-surface.mjs +624 -0
  68. package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
  69. package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
  70. package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +38 -18
  71. package/assets/docs/author-a-theme.doc.mjs +5 -5
  72. package/assets/docs/getting-started.doc.mjs +2 -2
  73. package/assets/docs/theme.doc.dense.mjs +1 -1
  74. package/assets/docs/theme.doc.mjs +2 -2
  75. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  76. package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
  77. package/assets/docs/tree/fonts-and-assets.doc.mjs +3 -3
  78. package/assets/docs/tree/styling-advanced.doc.mjs +21 -14
  79. package/assets/docs/tree/themes.doc.mjs +1 -1
  80. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  81. package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
  82. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +2 -2
  83. package/assets/docs/tree/versioning.doc.mjs +1 -4
  84. package/assets/docs/use-a-theme.doc.mjs +16 -16
  85. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
  86. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
  87. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
  88. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  89. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
  90. package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
  91. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
  92. package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
  93. package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
  94. package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
  95. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  96. package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
  97. package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
  98. package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
  99. package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
  100. package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
  101. package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
  102. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
  103. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
  104. package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
  105. package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
  106. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
  107. package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
  108. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
  109. package/assets/templates/pages/canvas-editor/page.tsx +2 -2
  110. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  111. package/assets/templates/pages/payment-form/page.tsx +1 -1
  112. package/assets/templates/pages/table-filter/page.tsx +3 -3
  113. package/assets/templates/pages/theme-showcase/page.tsx +2 -2
  114. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +10 -9
  115. package/authoring/debug/type.ts +2 -2
  116. package/authoring/doctypes/base/type.ts +0 -9
  117. package/authoring/integration/integration.doc.mjs +1 -1
  118. package/clients/cli/command-result-coverage.test.mjs +1 -1
  119. package/clients/cli/commands/build-theme.adaptations.test.mjs +4 -0
  120. package/clients/cli/commands/build-theme.ascii-output.test.mjs +35 -8
  121. package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
  122. package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
  123. package/clients/cli/commands/build-theme.mjs +31 -67
  124. package/clients/cli/commands/build-theme.registry.test.mjs +0 -10
  125. package/clients/cli/commands/build.doc.mjs +1 -1
  126. package/clients/cli/commands/build.mjs +1 -1
  127. package/clients/cli/commands/component-ownership.test.mjs +2 -2
  128. package/clients/cli/commands/debug-result-summary.test.mjs +0 -16
  129. package/clients/cli/commands/discover.mjs +2 -1
  130. package/clients/cli/commands/doctor.mjs +5 -2
  131. package/clients/cli/commands/empty-argument.test.mjs +16 -0
  132. package/clients/cli/commands/gap-report.doc.mjs +1 -1
  133. package/clients/cli/commands/gap-report.test.mjs +2 -2
  134. package/clients/cli/commands/init.doc.mjs +4 -4
  135. package/clients/cli/commands/init.flag-help.test.mjs +7 -10
  136. package/clients/cli/commands/init.next-steps.test.mjs +1 -1
  137. package/clients/cli/commands/integration.mjs +2 -1
  138. package/clients/cli/commands/option-pair-refusals.test.mjs +37 -0
  139. package/clients/cli/commands/search.test.mjs +1 -1
  140. package/clients/cli/commands/silent-success-refusals.test.mjs +15 -0
  141. package/clients/cli/commands/swizzle.mjs +4 -1
  142. package/clients/cli/commands/template.doc.mjs +4 -4
  143. package/clients/cli/commands/template.flag-help.test.mjs +18 -11
  144. package/clients/cli/commands/template.mjs +7 -1
  145. package/clients/cli/commands/text-json-parity.test.mjs +0 -17
  146. package/clients/cli/commands/theme-add-lifecycle.test.mjs +142 -49
  147. package/clients/cli/commands/theme-add.doc.mjs +10 -17
  148. package/clients/cli/commands/theme-list.behavior.test.mjs +2 -1
  149. package/clients/cli/commands/theme-targets.behavior.test.mjs +8 -6
  150. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  151. package/clients/cli/commands/theme.doc.mjs +2 -2
  152. package/clients/cli/commands/upgrade.doc.mjs +1 -1
  153. package/clients/cli/commands/upgrade.flag-help.test.mjs +7 -11
  154. package/clients/cli/commands/validate-nothing-exits-nonzero.test.mjs +67 -0
  155. package/clients/cli/index.mjs +0 -4
  156. package/clients/cli/lib/cli-error.mjs +19 -0
  157. package/clients/cli/lib/component-format.mjs +111 -57
  158. package/clients/cli/lib/component-format.test.mjs +28 -39
  159. package/clients/cli/lib/doc-text-ascii.test.mjs +5 -2
  160. package/clients/cli/lib/exit-codes.test.mjs +0 -7
  161. package/clients/cli/lib/json-shim.test.mjs +0 -24
  162. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  163. package/foundation/agent-docs/agent-docs.mjs +6 -1
  164. package/foundation/agent-docs/app-theme-workflow.test.mjs +3 -0
  165. package/foundation/config/theme-state.mjs +3 -3
  166. package/foundation/debug/debug-fields.test.mjs +13 -35
  167. package/foundation/debug/event.mjs +13 -78
  168. package/foundation/debug/privacy-contract.test.mjs +20 -12
  169. package/foundation/debug/redact.d.mts +2 -2
  170. package/foundation/debug/redact.mjs +2 -2
  171. package/foundation/discovery/template-needs.mjs +93 -11
  172. package/foundation/discovery/template-needs.test.mjs +106 -3
  173. package/foundation/discovery/theme-imports.mjs +1 -1
  174. package/foundation/discovery/theming-targets.d.mts +1 -20
  175. package/foundation/discovery/theming-targets.mjs +1 -38
  176. package/foundation/discovery/theming-targets.test.mjs +9 -175
  177. package/foundation/doc-compiler/doc-loads.test.mjs +0 -12
  178. package/foundation/env/package-manager.d.mts +13 -0
  179. package/foundation/env/package-manager.mjs +106 -63
  180. package/foundation/response/error-codes.doc.mjs +1 -1
  181. package/foundation/response/response-types.doc.mjs +11 -31
  182. package/foundation/response/response-types.doc.test.mjs +36 -14
  183. package/foundation/response/response.doc.mjs +1 -1
  184. package/foundation/xle/browser.d.mts +2 -2
  185. package/foundation/xle/browser.mjs +2 -2
  186. package/foundation/xle/expand.mjs +1 -1
  187. package/foundation/xle/print.mjs +1 -1
  188. package/package.json +9 -9
  189. package/api/layout/_adapter.d.mts +0 -34
  190. package/api/layout/_adapter.mjs +0 -148
  191. package/api/layout/check/check.d.mts +0 -17
  192. package/api/layout/check/check.mjs +0 -41
  193. package/api/layout/expand/expand.d.mts +0 -23
  194. package/api/layout/expand/expand.mjs +0 -161
  195. package/api/layout/expand/expand.path-safety.test.mjs +0 -53
  196. package/api/layout/expand/expand.receipt.test.mjs +0 -74
  197. package/api/layout/grammar/grammar.d.mts +0 -14
  198. package/api/layout/grammar/grammar.mjs +0 -88
  199. package/api/layout/layout.d.mts +0 -6
  200. package/api/layout/layout.mjs +0 -17
  201. package/api/layout/layout.test.mjs +0 -297
  202. package/api/layout/layout.type.d.mts +0 -90
  203. package/api/layout/layout.type.mjs +0 -104
  204. package/api/layout/layoutCheck.doc.d.mts +0 -11
  205. package/api/layout/layoutCheck.doc.mjs +0 -85
  206. package/api/layout/layoutExpand.doc.d.mts +0 -11
  207. package/api/layout/layoutExpand.doc.mjs +0 -107
  208. package/api/layout/layoutGrammar.doc.d.mts +0 -11
  209. package/api/layout/layoutGrammar.doc.mjs +0 -57
  210. package/api/theme/add/add.binary.test.mjs +0 -157
  211. package/api/theme/add/add.rollback.test.mjs +0 -158
  212. package/api/theme/add/add.staging.test.mjs +0 -83
  213. package/clients/cli/commands/layout-check.doc.mjs +0 -67
  214. package/clients/cli/commands/layout-expand.doc.mjs +0 -87
  215. package/clients/cli/commands/layout-grammar.doc.mjs +0 -32
  216. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +0 -140
  217. package/clients/cli/commands/layout.doc.mjs +0 -36
  218. package/clients/cli/commands/layout.error-codes.test.mjs +0 -66
  219. package/clients/cli/commands/layout.exit-parity.test.mjs +0 -41
  220. package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
  221. package/clients/cli/commands/layout.mjs +0 -327
  222. package/clients/cli/commands/layout.path-help.test.mjs +0 -33
  223. package/clients/cli/commands/layout.stdin-cap.test.mjs +0 -47
  224. package/clients/cli/commands/layout.text-fields.test.mjs +0 -39
package/README.md CHANGED
@@ -78,24 +78,23 @@ Options:
78
78
 
79
79
  <!-- BEGIN GENERATED: commands -->
80
80
 
81
- | Command | Description |
82
- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
83
- | `blog` | Read the Astryx blog from the published feed |
84
- | `build` | Build a page: the template to start from, or the workflow playbook (no query) |
85
- | `component` | List components or print component docs |
86
- | `discover` | Browse and search integrations: the ones you have and the ones you could add |
87
- | `docs` | Print reference docs |
88
- | `doctor` | Diagnose Astryx projects and integration packages |
89
- | `gap-report` | Report a missing component or feature to the package that owns it |
90
- | `hook` | List hooks or print hook docs |
91
- | `init` | Initialize the design system in your project |
92
- | `integration` | Author and verify an Astryx integration package |
93
- | `layout` | Generate XDS layouts from compressed expressions (XLE/XLO) [DEPRECATED: DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.] |
94
- | `search` | Search components, hooks, docs, templates, and themes in one ranked list |
95
- | `swizzle` | Copy component source for customization |
96
- | `template` | List, show, or scaffold page and block templates |
97
- | `theme` | Add, switch, build, and author themes |
98
- | `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components |
81
+ | Command | Description |
82
+ | ------------- | ----------------------------------------------------------------------------- |
83
+ | `blog` | Read the Astryx blog from the published feed |
84
+ | `build` | Build a page: the template to start from, or the workflow playbook (no query) |
85
+ | `component` | List components or print component docs |
86
+ | `discover` | Browse and search integrations: the ones you have and the ones you could add |
87
+ | `docs` | Print reference docs |
88
+ | `doctor` | Diagnose Astryx projects and integration packages |
89
+ | `gap-report` | Report a missing component or feature to the package that owns it |
90
+ | `hook` | List hooks or print hook docs |
91
+ | `init` | Initialize the design system in your project |
92
+ | `integration` | Author and verify an Astryx integration package |
93
+ | `search` | Search components, hooks, docs, templates, and themes in one ranked list |
94
+ | `swizzle` | Copy component source for customization |
95
+ | `template` | List, show, or scaffold page and block templates |
96
+ | `theme` | Add, switch, build, and author themes |
97
+ | `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components |
99
98
 
100
99
  <!-- END GENERATED: commands -->
101
100
  <!-- Generated by scripts/generate-cli-readme.mjs from `astryx manifest`. Run `pnpm -F @astryxdesign/cli readme`. -->
@@ -165,7 +164,7 @@ if (isError(result)) {
165
164
  | `ERR_UNKNOWN` | Fallback for any error without a more specific code. |
166
165
  | `ERR_UNKNOWN_COMMAND` | A top-level command name was not recognized (e.g. `astryx bogus`). |
167
166
  | `ERR_UNKNOWN_SUBCOMMAND` | A subcommand under a command group was not recognized (e.g. `astryx theme bogus`). |
168
- | `ERR_INVALID_OPTION` | An unknown option was passed, --json was given to a command without JSON output, or layout --form got a value other than compact, outline, or auto. |
167
+ | `ERR_INVALID_OPTION` | An unknown option was passed, --json was given to a command without JSON output. |
169
168
  | `ERR_INVALID_ARGUMENT` | An argument or option value is invalid: wrong type, out of range, an unknown choice, an extra argument, or a conflicting combination. |
170
169
  | `ERR_MISSING_ARGUMENT` | A required argument or option value was omitted. |
171
170
  | `ERR_INVALID_LANG` | `--lang` was given a value outside its choices (en, zh, dense). |
@@ -420,71 +419,67 @@ Every response has a `type` discriminant. The full set is below (generated from
420
419
 
421
420
  <!-- BEGIN GENERATED: response-types -->
422
421
 
423
- | Type | What `data` carries |
424
- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
425
- | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
426
- | `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set. |
427
- | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
428
- | `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |
429
- | `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |
430
- | `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |
431
- | `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |
432
- | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |
433
- | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |
434
- | `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
435
- | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
436
- | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
437
- | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |
438
- | `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
439
- | `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
440
- | `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
441
- | `discover.list` | The integrations the project loads (name, category, components, version, a list per other kind they add, and latest when a source knows it); with a discover source, meta.available lists what the project could add and meta.sources reports each source; when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
442
- | `discover.detail` | One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it. |
443
- | `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
444
- | `discover.item` | One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. |
445
- | `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |
446
- | `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |
447
- | `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
448
- | `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, package, command, basis, reason, alternatives, ...} (the start and each alternative name the package that owns the template), pages (search's closest templates), blocks and domain as SearchResultEntry[] (each naming its package), frame and foundation (Core component names), and hint {reason, commands} when thin. |
449
- | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |
450
- | `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package. |
451
- | `gap-report.categories` | The fixed gap category values and human-readable labels. |
452
- | `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals. |
453
- | `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
454
- | `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |
455
- | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. The envelope's package names the npm package that owns the template. |
456
- | `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing). The envelope's package names the npm package that owns the template. |
457
- | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
458
- | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |
459
- | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
460
- | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
461
- | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
462
- | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
463
- | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
464
- | `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
465
- | `theme.add` | The released source-copy receipt: slug, displayName, maintained flag, owner package, outputDir, source entry, exportName, and files. Its additive meta.deprecations entry names DEP-0005 and the source-fork/import replacements. |
466
- | `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
467
- | `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |
468
- | `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
469
- | `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states, deprecatedFor?}, where props and states are its legal override keys and deprecatedFor names the canonical replacement key. |
470
- | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
471
- | `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
472
- | `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |
473
- | `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
474
- | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
475
- | `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |
476
- | `help` | Help, in one of two shapes. A bare `astryx --json` returns the root manifest: name, version, commands (the command names), jsonSupported, and manifest (the full payload `astryx manifest --json` returns). `--help --json` on any command, or `astryx help [command] --json`, returns that command's help: command, description, usage, options (each flags, description, and defaultValue and choices when set), and subcommands (each name and description). data.manifest marks the first shape; data.usage marks the second. |
477
- | `version` | The CLI version, for `astryx --version --json`: {version}. |
478
- | `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and an optional fix, always present on warn and fail) plus a `summary` of counts per status. |
479
- | `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
480
- | `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |
481
- | `integration.validate` | The validation result: validated (false when no integration manifest was found, so nothing was checked and the empty issues list proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
482
- | `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
483
- | `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
484
- | `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
485
- | `layout.expand` | The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, written (the output path, or null when nothing was written), and demoMediaReplaced (count of demo media placeholders). Carries `meta.deprecations` with DEP-0006 and its replacement commands. |
486
- | `layout.check` | The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline). Carries `meta.deprecations` with DEP-0006 and its replacement commands. |
487
- | `layout.grammar` | The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry. Carries `meta.deprecations` with DEP-0006 and its replacement commands. |
422
+ | Type | What `data` carries |
423
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
424
+ | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
425
+ | `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |
426
+ | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
427
+ | `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |
428
+ | `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |
429
+ | `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |
430
+ | `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |
431
+ | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |
432
+ | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |
433
+ | `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
434
+ | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
435
+ | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
436
+ | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |
437
+ | `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
438
+ | `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
439
+ | `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
440
+ | `discover.list` | The integrations the project loads (name, category, components, version, a list per other kind they add, and latest when a source knows it); with a discover source, meta.available lists what the project could add and meta.sources reports each source; when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
441
+ | `discover.detail` | One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it. |
442
+ | `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
443
+ | `discover.item` | One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. |
444
+ | `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |
445
+ | `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |
446
+ | `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
447
+ | `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, package, command, basis, reason, alternatives, ...} (the start and each alternative name the package that owns the template), pages (search's closest templates), blocks and domain as SearchResultEntry[] (each naming its package), frame and foundation (Core component names), and hint {reason, commands} when thin. |
448
+ | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |
449
+ | `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package. |
450
+ | `gap-report.categories` | The fixed gap category values and human-readable labels. |
451
+ | `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals. |
452
+ | `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
453
+ | `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |
454
+ | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. The envelope's package names the npm package that owns the template. |
455
+ | `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template. |
456
+ | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
457
+ | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |
458
+ | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
459
+ | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
460
+ | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
461
+ | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
462
+ | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
463
+ | `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
464
+ | `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
465
+ | `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |
466
+ | `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
467
+ | `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |
468
+ | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
469
+ | `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
470
+ | `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |
471
+ | `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
472
+ | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
473
+ | `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |
474
+ | `help` | Help, in one of two shapes. A bare `astryx --json` returns the root manifest: name, version, commands (the command names), jsonSupported, and manifest (the full payload `astryx manifest --json` returns). `--help --json` on any command, or `astryx help [command] --json`, returns that command's help: command, description, usage, options (each flags, description, and defaultValue and choices when set), and subcommands (each name and description). data.manifest marks the first shape; data.usage marks the second. |
475
+ | `version` | The CLI version, for `astryx --version --json`: {version}. |
476
+ | `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and an optional fix, always present on warn and fail) plus a `summary` of counts per status. |
477
+ | `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
478
+ | `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |
479
+ | `integration.validate` | The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
480
+ | `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
481
+ | `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
482
+ | `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
488
483
 
489
484
  <!-- END GENERATED: response-types -->
490
485
  <!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
@@ -13,6 +13,8 @@
13
13
  * a query → build.kit (api/build/kit/kit.mjs)
14
14
  */
15
15
 
16
+ import {AstryxError} from '../error.mjs';
17
+ import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
16
18
  import {buildHelp} from './help/help.mjs';
17
19
  import {buildKit} from './kit/kit.mjs';
18
20
 
@@ -31,5 +33,12 @@ export async function build(query, options = {}) {
31
33
  if (!query || !String(query).trim()) {
32
34
  return buildHelp();
33
35
  }
36
+ if (options.limit != null && (!Number.isInteger(options.limit) || options.limit <= 0)) {
37
+ throw new AstryxError(
38
+ `Invalid limit "${options.limit}". Must be a positive integer.`,
39
+ undefined,
40
+ ERROR_CODES.ERR_INVALID_ARGUMENT,
41
+ );
42
+ }
34
43
  return buildKit(query, options);
35
44
  }
@@ -149,6 +149,8 @@ export function resolveCoreSourcePath(coreDir: string, dirName: string): string
149
149
  /**
150
150
  * Resolve a bare (unscoped) name to a `.doc.mjs`: core first, then back-compat
151
151
  * externals, then a conservative fuzzy search. Throws ERR_UNKNOWN_COMPONENT
152
+ * for a genuinely unknown name, and ERR_AMBIGUOUS_COMPONENT when multiple
153
+ * packages provide the same name
152
154
  * (with candidate suggestions when close) or ERR_NO_DOC.
153
155
  * @param {string} dirName - bare component name (no `XDS` prefix)
154
156
  * @param {{coreDir: string, cwd: string, name: string}} ctx - `name` is the caller's original (prefixed) input, used in error text
@@ -324,7 +324,7 @@ export class ComponentAmbiguityError extends AstryxError {
324
324
  super(
325
325
  `Component "${dirName}" is provided by multiple packages. Re-run with --package <pkg> to choose one.`,
326
326
  owners.map(o => ({name: o.package, reason: 'provides this component'})),
327
- ERROR_CODES.ERR_UNKNOWN_COMPONENT,
327
+ ERROR_CODES.ERR_AMBIGUOUS_COMPONENT,
328
328
  );
329
329
  this.candidates = owners.map(owner => ({
330
330
  package: owner.package,
@@ -375,6 +375,8 @@ export function resolveCoreSourcePath(coreDir, dirName) {
375
375
  /**
376
376
  * Resolve a bare (unscoped) name to a `.doc.mjs`: core first, then back-compat
377
377
  * externals, then a conservative fuzzy search. Throws ERR_UNKNOWN_COMPONENT
378
+ * for a genuinely unknown name, and ERR_AMBIGUOUS_COMPONENT when multiple
379
+ * packages provide the same name
378
380
  * (with candidate suggestions when close) or ERR_NO_DOC.
379
381
  * @param {string} dirName - bare component name (no `XDS` prefix)
380
382
  * @param {{coreDir: string, cwd: string, name: string}} ctx - `name` is the caller's original (prefixed) input, used in error text
@@ -170,7 +170,11 @@ export const doc = {
170
170
  },
171
171
  {
172
172
  code: 'ERR_UNKNOWN_COMPONENT',
173
- when: 'name is not a string, resolves to no known component, is provided by multiple packages (pass options.package), or is absent from the requested options.package',
173
+ when: 'name is not a string, resolves to no known component, or is absent from the requested options.package',
174
+ },
175
+ {
176
+ code: 'ERR_AMBIGUOUS_COMPONENT',
177
+ when: 'the component is provided by multiple packages (pass options.package to disambiguate)',
174
178
  },
175
179
  {
176
180
  code: 'ERR_UNKNOWN_PACKAGE',
@@ -48,6 +48,22 @@ describe('every shipped topic compiles to plain JSON', () => {
48
48
  );
49
49
  });
50
50
 
51
+ describe('author-a-theme color guidance', () => {
52
+ it('teaches committed generated palette references as the main example', async () => {
53
+ const catalog = await loadDocsCatalog();
54
+ const topic = detailView(
55
+ await compileTopic(catalog, catalog.resolve('author-a-theme')),
56
+ );
57
+ const rendered = JSON.stringify(topic);
58
+
59
+ expect(rendered).toContain("import {palette} from './palette.generated';");
60
+ expect(rendered).toContain('palette.neutral.light[100]');
61
+ expect(rendered).toContain('palette.neutral.dark[15]');
62
+ expect(rendered).toContain('color (existing themes)');
63
+ expect(rendered).not.toContain("color: { accent: ['#7B61FF'");
64
+ });
65
+ });
66
+
51
67
  describe('reads that share a catalog', () => {
52
68
  it(
53
69
  'never let one read change another',
@@ -23,7 +23,7 @@ export const doc = {
23
23
  'integration provider identity and contribution issues, agent docs, the ' +
24
24
  'detected package manager, and the health of the docs the CLI reads (authoring ' +
25
25
  'and CLI docs, the docs tree, doc size), and returns a structured ' +
26
- 'report. Theme checks run when the generated app module exists; without one, doctor reports that the CLI manages no themes and names theme add --import. Earlier descriptor-less copies are a non-failing upgrade warning. It never installs, writes, or mutates. It imports astryx.config, executes every added theme source while validating private inputs, and loads every recorded built theme module to prove its runtime imports work, including themes from installed packages. Local theme source also runs during build-freshness checks. Stylesheets are parsed without execution. Config and theme top-level code therefore run, so use doctor only with project code you trust.',
26
+ 'report. Theme checks run when the generated app module exists; without one, doctor reports that the CLI manages no themes and names theme add. Earlier descriptor-less copies are a non-failing upgrade warning. It never installs, writes, or mutates. It imports astryx.config, executes every added theme source while validating private inputs, and loads every recorded built theme module to prove its runtime imports work, including themes from installed packages. Local theme source also runs during build-freshness checks. Stylesheets are parsed without execution. Config and theme top-level code therefore run, so use doctor only with project code you trust.',
27
27
  importPath: '@astryxdesign/cli/api',
28
28
  signature: 'doctor(options?: DoctorOptions): Promise<DoctorResponse>',
29
29
  keywords: ['doctor', 'diagnose', 'health', 'check', 'verify', 'environment'],
@@ -1122,3 +1122,31 @@ describe('doctor says why it skipped and what it checked', () => {
1122
1122
  );
1123
1123
  });
1124
1124
  });
1125
+
1126
+ describe('no Astryx-owned environment variables (spec:AST-017 FR14)', () => {
1127
+ it('no source file reads an ASTRYX_* env var', () => {
1128
+ const cliDir = path.resolve(REPO, 'packages/cli');
1129
+ const SKIP = new Set(['node_modules', 'dist', 'coverage']);
1130
+ const ENV_READ = /process\.env(?:\.|\[\s*['"`])ASTRYX_/;
1131
+ /** @type {string[]} */
1132
+ const hits = [];
1133
+ /** @param {string} dir */
1134
+ const walk = dir => {
1135
+ for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
1136
+ if (SKIP.has(entry.name)) continue;
1137
+ const full = path.join(dir, entry.name);
1138
+ if (entry.isDirectory()) {
1139
+ walk(full);
1140
+ continue;
1141
+ }
1142
+ if (!/\.[cm]?[jt]sx?$/.test(entry.name)) continue;
1143
+ if (/\.test\.|\.d\.[cm]?ts$/.test(entry.name)) continue;
1144
+ if (ENV_READ.test(fs.readFileSync(full, 'utf8'))) {
1145
+ hits.push(path.relative(cliDir, full));
1146
+ }
1147
+ }
1148
+ };
1149
+ walk(cliDir);
1150
+ expect(hits).toEqual([]);
1151
+ });
1152
+ });
@@ -69,7 +69,7 @@ function unavailableChecks(message, moduleError = null) {
69
69
  moduleError && id === 'theme-module' ? moduleError.message : message,
70
70
  ...(moduleError && id === 'theme-module'
71
71
  ? {
72
- fix: 'Keep one CLI-generated astryx-themes.ts or astryx-themes.js file, then run `astryx theme add <slug> --import`.',
72
+ fix: 'Keep one CLI-generated astryx-themes.ts or astryx-themes.js file, then run `astryx theme add <slug>`.',
73
73
  }
74
74
  : {}),
75
75
  }));
@@ -101,12 +101,12 @@ function refreshThemeCommand(projectDir, run, available, slug, owner) {
101
101
  );
102
102
  if (!isLocalThemeOwner(owner)) {
103
103
  const selector = theme?.package ?? owner;
104
- return `npm install ${owner}@latest; ${run} theme add ${slug} --import --package ${selector}`;
104
+ return `npm install ${owner}@latest; ${run} theme add ${slug} --package ${selector}`;
105
105
  }
106
106
  const source = theme
107
107
  ? relative(projectDir, path.join(theme.sourceDir, theme.entry))
108
108
  : projectPath(path.join(owner, slug, `${slug}Theme.ts`));
109
- return `${run} theme build ${source}; ${run} theme add ${slug} --import`;
109
+ return `${run} theme build ${source}; ${run} theme add ${slug}`;
110
110
  }
111
111
 
112
112
  /** @param {string} source */
@@ -478,7 +478,7 @@ export function checkThemes(cwd, appChecks) {
478
478
  label,
479
479
  status: 'warn',
480
480
  message: 'No @astryxdesign/theme-* packages are installed.',
481
- fix: `Install a theme, e.g. \`npm install @astryxdesign/theme-neutral\`, then add it to the app with \`${run} theme add neutral --import\`.`,
481
+ fix: `Install a theme, e.g. \`npm install @astryxdesign/theme-neutral\`, then add it to the app with \`${run} theme add neutral\`.`,
482
482
  };
483
483
  }
484
484
  const names = packages.join(', ');
@@ -488,7 +488,7 @@ export function checkThemes(cwd, appChecks) {
488
488
  label,
489
489
  status: 'warn',
490
490
  message: `Theme package(s) installed (${names}) but no theme appears wired.`,
491
- fix: `Add one to the app with \`${run} theme add <slug> --import\`.`,
491
+ fix: `Add one to the app with \`${run} theme add <slug>\`.`,
492
492
  };
493
493
  }
494
494
  return {
@@ -538,7 +538,7 @@ export async function checkAppThemes(cwd) {
538
538
  message: state.legacyTheme
539
539
  ? `The CLI manages no themes. The released package.json astryx.theme value ${JSON.stringify(state.legacyTheme)} remains active.`
540
540
  : 'The CLI manages no themes because this project has no generated theme module.',
541
- fix: `Start managing app themes with \`${run} theme add <slug> --import\`.`,
541
+ fix: `Start managing app themes with \`${run} theme add <slug>\`.`,
542
542
  },
543
543
  ];
544
544
  const migration = unmigratedCopyCheck(state.projectDir);
@@ -656,7 +656,7 @@ export async function checkAppThemes(cwd) {
656
656
  label: 'Theme owners and built imports',
657
657
  status: 'fail',
658
658
  message: 'The generated record has no added themes.',
659
- fix: `${run} theme add <slug> --import`,
659
+ fix: `${run} theme add <slug>`,
660
660
  });
661
661
  } else if (discoveryError) {
662
662
  checks.push({
@@ -664,7 +664,7 @@ export async function checkAppThemes(cwd) {
664
664
  label: 'Theme owners and built imports',
665
665
  status: 'fail',
666
666
  message: discoveryError.message,
667
- fix: `${run} theme add <slug> --import`,
667
+ fix: `${run} theme add <slug>`,
668
668
  });
669
669
  } else if (resolutionProblems.length > 0) {
670
670
  checks.push({
@@ -1003,7 +1003,7 @@ export async function checkAppThemes(cwd) {
1003
1003
  fix:
1004
1004
  ownerEntries.length > 0
1005
1005
  ? `${run} theme use ${ownerEntries[0][0]}`
1006
- : `${run} theme add <slug> --import`,
1006
+ : `${run} theme add <slug>`,
1007
1007
  },
1008
1008
  );
1009
1009
 
@@ -1083,7 +1083,7 @@ export async function checkAppThemes(cwd) {
1083
1083
  if (localWarnings.length > 0) {
1084
1084
  fontWarningFixes.push(
1085
1085
  `Add <slug>.fonts.css beside each built local theme output, then ${localWarnings
1086
- .map(problem => `${run} theme add ${problem.theme.slug} --import`)
1086
+ .map(problem => `${run} theme add ${problem.theme.slug}`)
1087
1087
  .join('; ')}.`,
1088
1088
  );
1089
1089
  }