@astryxdesign/cli 0.6.6 → 0.6.7-canary.037dfb6

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 (399) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +84 -82
  3. package/api/build/_adapter.d.mts +20 -0
  4. package/api/build/_adapter.mjs +24 -0
  5. package/api/build/build.doc.mjs +1 -1
  6. package/api/build/build.test.mjs +1 -1
  7. package/api/build/build.type.d.mts +12 -0
  8. package/api/build/build.type.mjs +3 -0
  9. package/api/build/help/help.mjs +1 -1
  10. package/api/build/kit/kit.mjs +13 -1
  11. package/api/component/_adapter.d.mts +19 -0
  12. package/api/component/_adapter.mjs +33 -0
  13. package/api/component/component-replacement.test.mjs +615 -0
  14. package/api/component/component.doc.mjs +5 -2
  15. package/api/component/component.mjs +49 -15
  16. package/api/component/component.test.mjs +32 -0
  17. package/api/component/component.type.d.mts +33 -3
  18. package/api/component/component.type.mjs +10 -3
  19. package/api/component/detail/blocks/blocks.d.mts +2 -1
  20. package/api/component/detail/blocks/blocks.mjs +5 -2
  21. package/api/component/detail/detail.mjs +5 -1
  22. package/api/component/detail/props/props.d.mts +2 -1
  23. package/api/component/detail/props/props.mjs +3 -2
  24. package/api/component/detail/showcase/showcase.d.mts +3 -1
  25. package/api/component/detail/showcase/showcase.mjs +3 -1
  26. package/api/component/detail/source/source.d.mts +3 -2
  27. package/api/component/detail/source/source.mjs +7 -3
  28. package/api/component/list/list.mjs +128 -10
  29. package/api/docs/_adapter.d.mts +11 -0
  30. package/api/docs/_adapter.mjs +73 -1
  31. package/api/docs/compiled-topics.test.mjs +1 -1
  32. package/api/docs/detail/detail.mjs +19 -3
  33. package/api/docs/detail/section/section.d.mts +44 -0
  34. package/api/docs/detail/section/section.mjs +171 -14
  35. package/api/docs/detail/section/section.test.mjs +4 -4
  36. package/api/docs/docOverlays.test.mjs +52 -23
  37. package/api/docs/docs.depth.test.mjs +2 -0
  38. package/api/docs/docs.doc.mjs +3 -3
  39. package/api/docs/docs.mjs +13 -16
  40. package/api/docs/docs.test.mjs +9 -10
  41. package/api/docs/docs.type.d.mts +43 -3
  42. package/api/docs/docs.type.mjs +23 -3
  43. package/api/docs/index/index.mjs +11 -2
  44. package/api/docs/index/index.test.mjs +7 -2
  45. package/api/docs/integration-tree.test.mjs +26 -26
  46. package/api/docs/integrationDocs.test.mjs +8 -7
  47. package/api/docs/namespace-section.test.mjs +260 -0
  48. package/api/docs/node/node.mjs +3 -0
  49. package/api/docs/token-tables.test.mjs +93 -0
  50. package/api/doctor/_adapter.d.mts +50 -0
  51. package/api/doctor/_adapter.mjs +190 -0
  52. package/api/doctor/doctor.d.mts +6 -10
  53. package/api/doctor/doctor.doc.mjs +1 -3
  54. package/api/doctor/doctor.mjs +144 -150
  55. package/api/doctor/doctor.test.mjs +104 -0
  56. package/api/doctor/theme-checks.d.mts +24 -0
  57. package/api/doctor/theme-checks.mjs +1231 -0
  58. package/api/doctor/theme-checks.test.mjs +667 -0
  59. package/api/gap-report/gap-report.doc.mjs +2 -1
  60. package/api/gap-report/gap-report.mjs +15 -1
  61. package/api/hook/_adapter.d.mts +1 -0
  62. package/api/hook/_adapter.mjs +3 -0
  63. package/api/hook/detail/detail.mjs +2 -2
  64. package/api/hook/detail/params/params.mjs +2 -2
  65. package/api/hook/hook.type.d.mts +12 -0
  66. package/api/hook/hook.type.mjs +3 -0
  67. package/api/hook/list/list.mjs +8 -8
  68. package/api/index.d.mts +1 -1
  69. package/api/index.mjs +4 -0
  70. package/api/init/run/run.d.mts +3 -5
  71. package/api/init/run/run.mjs +11 -11
  72. package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
  73. package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
  74. package/api/integration/add-helpers.d.mts +26 -5
  75. package/api/integration/add-helpers.mjs +50 -5
  76. package/api/integration/add-theme.mjs +16 -2
  77. package/api/integration/add-theme.test.mjs +66 -15
  78. package/api/integration/authoring-checks.mjs +21 -1
  79. package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
  80. package/api/integration/pack-check.component-replaces.test.mjs +126 -0
  81. package/api/integration/pack-check.d.mts +10 -0
  82. package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
  83. package/api/integration/pack-check.mjs +485 -3
  84. package/api/integration/pack-check.test.mjs +578 -10
  85. package/api/integration/validate-integration.mjs +20 -4
  86. package/api/integration/validate-integration.test.mjs +73 -0
  87. package/api/layout/check/check.d.mts +1 -0
  88. package/api/layout/check/check.mjs +1 -0
  89. package/api/layout/expand/expand.d.mts +1 -0
  90. package/api/layout/expand/expand.mjs +1 -0
  91. package/api/layout/grammar/grammar.d.mts +1 -0
  92. package/api/layout/grammar/grammar.mjs +1 -0
  93. package/api/layout/layoutCheck.doc.mjs +1 -1
  94. package/api/layout/layoutExpand.doc.mjs +1 -1
  95. package/api/layout/layoutGrammar.doc.mjs +1 -1
  96. package/api/search/search.d.mts +47 -3
  97. package/api/search/search.doc.mjs +1 -1
  98. package/api/search/search.domain-priority.test.mjs +261 -0
  99. package/api/search/search.mjs +247 -43
  100. package/api/search/search.test.mjs +5 -1
  101. package/api/search/search.type.d.mts +3 -3
  102. package/api/search/search.type.mjs +2 -2
  103. package/api/swizzle/_adapter.d.mts +10 -0
  104. package/api/swizzle/_adapter.mjs +23 -0
  105. package/api/swizzle/copy/copy.d.mts +5 -6
  106. package/api/swizzle/copy/copy.mjs +29 -10
  107. package/api/swizzle/list/list.mjs +2 -2
  108. package/api/swizzle/swizzle.doc.mjs +5 -2
  109. package/api/swizzle/swizzle.test.mjs +55 -5
  110. package/api/swizzle/swizzle.type.d.mts +8 -0
  111. package/api/swizzle/swizzle.type.mjs +2 -0
  112. package/api/template/copy/copy.mjs +14 -1
  113. package/api/template/show/show.mjs +2 -0
  114. package/api/template/skeleton/skeleton.mjs +2 -1
  115. package/api/template/template.d.mts +1 -1
  116. package/api/template/template.doc.mjs +1 -1
  117. package/api/template/template.mjs +1 -0
  118. package/api/template/template.type.d.mts +15 -0
  119. package/api/template/template.type.mjs +6 -0
  120. package/api/theme/_adapter.d.mts +106 -6
  121. package/api/theme/_adapter.mjs +687 -18
  122. package/api/theme/add/add.binary.test.mjs +76 -3
  123. package/api/theme/add/add.d.mts +5 -9
  124. package/api/theme/add/add.mjs +87 -64
  125. package/api/theme/add/add.rollback.test.mjs +9 -9
  126. package/api/theme/add/add.staging.test.mjs +9 -9
  127. package/api/theme/add/add.test.mjs +461 -55
  128. package/api/theme/add/add.types.test.mjs +151 -0
  129. package/api/theme/build/build.d.mts +96 -2
  130. package/api/theme/build/build.family.test.mjs +13 -4
  131. package/api/theme/build/build.mjs +286 -118
  132. package/api/theme/build/build.test.mjs +30 -0
  133. package/api/theme/build/font-warning.d.mts +11 -0
  134. package/api/theme/build/font-warning.mjs +28 -3
  135. package/api/theme/eject/eject.binary.test.mjs +90 -0
  136. package/api/theme/eject/eject.d.mts +17 -0
  137. package/api/theme/eject/eject.mjs +65 -0
  138. package/api/theme/eject/eject.rollback.test.mjs +158 -0
  139. package/api/theme/eject/eject.staging.test.mjs +83 -0
  140. package/api/theme/eject/eject.test.mjs +160 -0
  141. package/api/theme/integration-themes.test.mjs +30 -6
  142. package/api/theme/list/list.d.mts +10 -0
  143. package/api/theme/list/list.mjs +75 -7
  144. package/api/theme/list/list.test.mjs +155 -4
  145. package/api/theme/remove/remove.d.mts +12 -0
  146. package/api/theme/remove/remove.mjs +15 -0
  147. package/api/theme/remove/remove.test.mjs +94 -0
  148. package/api/theme/template/template.mjs +3 -4
  149. package/api/theme/theme.d.mts +5 -2
  150. package/api/theme/theme.mjs +13 -8
  151. package/api/theme/theme.type.d.mts +106 -2
  152. package/api/theme/theme.type.mjs +54 -5
  153. package/api/theme/themeAdd.doc.d.mts +1 -3
  154. package/api/theme/themeAdd.doc.mjs +35 -22
  155. package/api/theme/themeBuild.doc.mjs +1 -1
  156. package/api/theme/themeEject.doc.d.mts +8 -0
  157. package/api/theme/themeEject.doc.mjs +89 -0
  158. package/api/theme/themeListAvailable.doc.mjs +4 -4
  159. package/api/theme/themeListCopySources.doc.d.mts +8 -0
  160. package/api/theme/themeListCopySources.doc.mjs +60 -0
  161. package/api/theme/themeRemove.doc.d.mts +6 -0
  162. package/api/theme/themeRemove.doc.mjs +50 -0
  163. package/api/theme/themeTemplate.doc.mjs +4 -3
  164. package/api/theme/themeUse.doc.d.mts +6 -0
  165. package/api/theme/themeUse.doc.mjs +47 -0
  166. package/api/theme/use/use.d.mts +12 -0
  167. package/api/theme/use/use.mjs +15 -0
  168. package/api/theme/use/use.test.mjs +98 -0
  169. package/api/upgrade/_adapter.d.mts +1 -0
  170. package/api/upgrade/_adapter.mjs +3 -0
  171. package/api/upgrade/list/list.mjs +9 -3
  172. package/api/upgrade/upgrade.type.d.mts +4 -0
  173. package/api/upgrade/upgrade.type.mjs +1 -0
  174. package/assets/codemods/__tests__/registry.test.mjs +1 -0
  175. package/assets/codemods/integration-discovery.mjs +1 -1
  176. package/assets/codemods/integration-discovery.test.mjs +64 -0
  177. package/assets/codemods/registry.mjs +1 -0
  178. package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
  179. package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
  180. package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
  181. package/assets/docs/author-a-theme.doc.mjs +166 -0
  182. package/assets/docs/getting-started.doc.mjs +61 -17
  183. package/assets/docs/principles.doc.dense.mjs +4 -4
  184. package/assets/docs/principles.doc.mjs +6 -6
  185. package/assets/docs/principles.doc.zh.mjs +4 -4
  186. package/assets/docs/styling-overview.doc.mjs +211 -0
  187. package/assets/docs/theme.doc.dense.mjs +11 -197
  188. package/assets/docs/theme.doc.mjs +16 -764
  189. package/assets/docs/theme.doc.zh.mjs +31 -12
  190. package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
  191. package/assets/docs/tree/checks.doc.mjs +6 -5
  192. package/assets/docs/tree/component-migration.doc.mjs +107 -0
  193. package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
  194. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  195. package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
  196. package/assets/docs/tree/font-setup.doc.mjs +122 -0
  197. package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
  198. package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
  199. package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
  200. package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
  201. package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
  202. package/assets/docs/tree/internationalization.doc.mjs +29 -0
  203. package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
  204. package/assets/docs/tree/layout.doc.mjs +55 -0
  205. package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
  206. package/assets/docs/tree/migration-verification.doc.mjs +67 -0
  207. package/assets/docs/tree/migration.doc.mjs +28 -0
  208. package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
  209. package/assets/docs/tree/other-libraries.doc.mjs +218 -0
  210. package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
  211. package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
  212. package/assets/docs/tree/responsive.doc.mjs +98 -0
  213. package/assets/docs/tree/scaffold.doc.mjs +140 -0
  214. package/assets/docs/tree/side-panels.doc.mjs +81 -0
  215. package/assets/docs/tree/structure.doc.mjs +140 -0
  216. package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
  217. package/assets/docs/tree/styling-basics.doc.mjs +181 -0
  218. package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
  219. package/assets/docs/tree/styling.doc.mjs +29 -0
  220. package/assets/docs/tree/tailwind.doc.mjs +65 -0
  221. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  222. package/assets/docs/tree/themes.doc.mjs +2 -2
  223. package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
  224. package/assets/docs/tree/tokens-border.doc.mjs +46 -0
  225. package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
  226. package/assets/docs/tree/tokens-color.doc.mjs +438 -0
  227. package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
  228. package/assets/docs/tree/tokens-data.doc.mjs +323 -0
  229. package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
  230. package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
  231. package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
  232. package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
  233. package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
  234. package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
  235. package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
  236. package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
  237. package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
  238. package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
  239. package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
  240. package/assets/docs/tree/tokens-size.doc.mjs +54 -0
  241. package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
  242. package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
  243. package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
  244. package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
  245. package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
  246. package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
  247. package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
  248. package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
  249. package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
  250. package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
  251. package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
  252. package/assets/docs/tree/tokens.doc.mjs +28 -0
  253. package/assets/docs/tree/troubleshooting.doc.mjs +7 -3
  254. package/assets/docs/tree/type-scale.doc.mjs +147 -0
  255. package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
  256. package/assets/docs/tree/typography.doc.mjs +29 -0
  257. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
  258. package/assets/docs/tree/versioning.doc.mjs +6 -3
  259. package/assets/docs/use-a-theme.doc.mjs +212 -0
  260. package/assets/templates/pages/incident-console/page.tsx +1 -1
  261. package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
  262. package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
  263. package/assets/templates/pages/table-comparison/page.tsx +1449 -0
  264. package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
  265. package/assets/theme.template.ts +28 -11
  266. package/authoring/doctypes/command/command.doc.mjs +5 -0
  267. package/authoring/doctypes/command/type.ts +2 -0
  268. package/authoring/doctypes/component/component.doc.mjs +1 -1
  269. package/authoring/doctypes/component/type.ts +8 -4
  270. package/authoring/doctypes/template/template.doc.mjs +2 -2
  271. package/authoring/doctypes/template/type.ts +5 -3
  272. package/authoring/integration/integration.doc.mjs +1 -1
  273. package/clients/cli/commands/blog.mjs +3 -3
  274. package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
  275. package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
  276. package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
  277. package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
  278. package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
  279. package/clients/cli/commands/build-theme.mjs +338 -45
  280. package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
  281. package/clients/cli/commands/build.mjs +8 -6
  282. package/clients/cli/commands/build.text-fields.test.mjs +1 -1
  283. package/clients/cli/commands/component/index.mjs +91 -12
  284. package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
  285. package/clients/cli/commands/component.doc.mjs +9 -2
  286. package/clients/cli/commands/docs.doc.mjs +2 -1
  287. package/clients/cli/commands/docs.mjs +63 -23
  288. package/clients/cli/commands/docs.test.mjs +17 -15
  289. package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
  290. package/clients/cli/commands/doctor.doc.mjs +1 -1
  291. package/clients/cli/commands/doctor.test.mjs +59 -52
  292. package/clients/cli/commands/gap-report.doc.mjs +2 -2
  293. package/clients/cli/commands/hook/index.mjs +7 -2
  294. package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
  295. package/clients/cli/commands/init.next-steps.test.mjs +18 -23
  296. package/clients/cli/commands/integration-real-world.test.mjs +61 -12
  297. package/clients/cli/commands/layout-check.doc.mjs +2 -0
  298. package/clients/cli/commands/layout-expand.doc.mjs +2 -0
  299. package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
  300. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
  301. package/clients/cli/commands/layout.doc.mjs +2 -0
  302. package/clients/cli/commands/layout.mjs +40 -4
  303. package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
  304. package/clients/cli/commands/search.test.mjs +10 -4
  305. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  306. package/clients/cli/commands/swizzle.mjs +2 -1
  307. package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
  308. package/clients/cli/commands/template.mjs +56 -5
  309. package/clients/cli/commands/text-json-parity.test.mjs +40 -0
  310. package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
  311. package/clients/cli/commands/theme-add.doc.mjs +19 -19
  312. package/clients/cli/commands/theme-build.doc.mjs +3 -1
  313. package/clients/cli/commands/theme-eject.doc.mjs +47 -0
  314. package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
  315. package/clients/cli/commands/theme-list.doc.mjs +2 -2
  316. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
  317. package/clients/cli/commands/theme-remove.doc.mjs +22 -0
  318. package/clients/cli/commands/theme-template.doc.mjs +4 -3
  319. package/clients/cli/commands/theme-use.doc.mjs +22 -0
  320. package/clients/cli/commands/theme.doc.mjs +21 -16
  321. package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
  322. package/clients/cli/commands/upgrade.mjs +1 -1
  323. package/clients/cli/index.mjs +5 -2
  324. package/clients/cli/lib/component-format.mjs +29 -2
  325. package/clients/cli/lib/component-format.test.mjs +1 -1
  326. package/clients/cli/lib/define-command.mjs +4 -0
  327. package/clients/cli/lib/resolve-theme.mjs +80 -78
  328. package/clients/cli/lib/resolve-theme.test.mjs +523 -27
  329. package/foundation/agent-docs/agent-docs.mjs +48 -30
  330. package/foundation/agent-docs/agent-docs.test.mjs +47 -34
  331. package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
  332. package/foundation/config/project.d.mts +20 -5
  333. package/foundation/config/project.mjs +43 -6
  334. package/foundation/config/project.test.mjs +1 -1
  335. package/foundation/config/theme-private-vars.d.mts +12 -0
  336. package/foundation/config/theme-private-vars.mjs +107 -0
  337. package/foundation/config/theme-private-vars.test.mjs +55 -0
  338. package/foundation/config/theme-state.d.mts +145 -0
  339. package/foundation/config/theme-state.mjs +417 -0
  340. package/foundation/config/theme-state.test.mjs +182 -0
  341. package/foundation/discovery/component-discovery.d.mts +5 -2
  342. package/foundation/discovery/component-discovery.mjs +12 -6
  343. package/foundation/discovery/component-replacement.d.mts +91 -0
  344. package/foundation/discovery/component-replacement.mjs +417 -0
  345. package/foundation/discovery/component-replacement.test.mjs +480 -0
  346. package/foundation/discovery/docs-discovery.test.mjs +1 -1
  347. package/foundation/discovery/docs-output-budget.d.mts +6 -2
  348. package/foundation/discovery/docs-output-budget.mjs +2 -1
  349. package/foundation/discovery/docs-section-key.d.mts +4 -2
  350. package/foundation/discovery/docs-section-key.mjs +1 -1
  351. package/foundation/discovery/module-exports.d.mts +10 -0
  352. package/foundation/discovery/module-exports.mjs +146 -0
  353. package/foundation/discovery/package-exports.d.mts +29 -0
  354. package/foundation/discovery/package-exports.mjs +200 -0
  355. package/foundation/discovery/template-needs.d.mts +31 -0
  356. package/foundation/discovery/template-needs.mjs +156 -0
  357. package/foundation/discovery/template-needs.test.mjs +203 -0
  358. package/foundation/discovery/theme-discovery.d.mts +72 -5
  359. package/foundation/discovery/theme-discovery.mjs +134 -18
  360. package/foundation/discovery/theme-discovery.test.mjs +9 -3
  361. package/foundation/discovery/theme-imports.d.mts +15 -0
  362. package/foundation/discovery/theme-imports.mjs +217 -0
  363. package/foundation/discovery/theme-imports.test.mjs +173 -0
  364. package/foundation/doc-compiler/bundle.mjs +52 -1
  365. package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
  366. package/foundation/doc-compiler/inputs.mjs +2 -1
  367. package/foundation/doc-compiler/lenses.d.mts +4 -2
  368. package/foundation/doc-compiler/lenses.mjs +1 -1
  369. package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
  370. package/foundation/doc-compiler/tree.d.mts +10 -0
  371. package/foundation/doc-compiler/tree.mjs +22 -0
  372. package/foundation/doc-compiler/tree.test.mjs +3 -2
  373. package/foundation/env/package-manager.d.mts +31 -8
  374. package/foundation/env/package-manager.mjs +120 -13
  375. package/foundation/env/package-manager.test.mjs +174 -1
  376. package/foundation/fs/module-loader.d.mts +9 -0
  377. package/foundation/fs/module-loader.mjs +71 -2
  378. package/foundation/integrations/cli-requirement.d.mts +43 -10
  379. package/foundation/integrations/cli-requirement.mjs +56 -13
  380. package/foundation/integrations/cli-requirement.test.mjs +160 -23
  381. package/foundation/integrations/contribution-inventory.mjs +3 -3
  382. package/foundation/integrations/validate-contributions.d.mts +16 -0
  383. package/foundation/integrations/validate-contributions.mjs +56 -8
  384. package/foundation/response/base.d.ts +9 -3
  385. package/foundation/response/json.d.mts +7 -4
  386. package/foundation/response/json.mjs +10 -6
  387. package/foundation/response/response-types.doc.mjs +41 -26
  388. package/foundation/response/response.doc.mjs +18 -4
  389. package/foundation/text/copyright-header.mjs +1 -1
  390. package/foundation/text/copyright-header.test.mjs +1 -1
  391. package/package.json +9 -9
  392. package/assets/docs/layout.doc.dense.mjs +0 -388
  393. package/assets/docs/layout.doc.mjs +0 -550
  394. package/assets/docs/styling-libraries.doc.mjs +0 -469
  395. package/assets/docs/styling.doc.mjs +0 -412
  396. package/assets/docs/tokens.doc.dense.mjs +0 -15
  397. package/assets/docs/tokens.doc.mjs +0 -1491
  398. package/assets/docs/tokens.doc.zh.mjs +0 -15
  399. package/assets/docs/typography.doc.mjs +0 -286
@@ -30,13 +30,23 @@ export function cliRangeProblem(pkg: any, feature: string, loss: string, floor:
30
30
  */
31
31
  export function docsTreeCliProblem(pkg: any): string | null;
32
32
  /**
33
- * Why a package with a template that sets `replaces` would lose templates and
34
- * doc topics on an older CLI (spec:AST-035), or null when its declared CLI
35
- * range admits only CLIs that read the field.
33
+ * Why a package with a template that sets `replaces` would lose that template
34
+ * and its doc topics on an older CLI (spec:AST-035 FR1), or null when its
35
+ * declared CLI range admits only CLIs that apply the field. Published 0.6.3
36
+ * rejects the field; published 0.6.4 applies it.
36
37
  * @param {any} pkg package.json
37
38
  * @returns {string | null}
38
39
  */
39
40
  export function replacesCliProblem(pkg: any): string | null;
41
+ /**
42
+ * Why a package with a component that sets `replaces` would not get the
43
+ * replacement (spec:AST-035 FR10), or null when its declared CLI range starts
44
+ * at the release that applies it. That range is the package's opt-in: without
45
+ * it the component keeps its own name and the Core component stays selected.
46
+ * @param {any} pkg package.json
47
+ * @returns {string | null}
48
+ */
49
+ export function componentReplacesCliProblem(pkg: any): string | null;
40
50
  /**
41
51
  * Why a package with a doc section that sets `id` would lose its doc topics on
42
52
  * an older CLI, or null when its declared CLI range admits only CLIs that read
@@ -58,9 +68,10 @@ export function sectionIdsCliProblem(pkg: any): string | null;
58
68
  export function themesCliProblem(pkg: any): string | null;
59
69
  /**
60
70
  * Why a package with a template that sets `keywords` would lose that template
61
- * and its doc topics on an older CLI, or null when its declared CLI range
62
- * admits only CLIs that read the field. Published 0.6.3 rejects the field,
63
- * drops that template, and hides the package's doc topics.
71
+ * on an older CLI, or null when its declared CLI range admits only CLIs that
72
+ * read the field. Published 0.6.4 and 0.6.5 reject the field and drop that
73
+ * template; 0.6.3 and earlier also hide the package's doc topics. Published
74
+ * 0.6.6 reads it.
64
75
  * @param {any} pkg package.json
65
76
  * @returns {string | null}
66
77
  */
@@ -89,11 +100,33 @@ export const CLI_PACKAGE: "@astryxdesign/cli";
89
100
  */
90
101
  export const NAMESPACE_DOCS_CLI: "0.6.4";
91
102
  /**
92
- * The first CLI release that reads a template's `replaces` and `keywords`. A
93
- * release before it rejects either field, drops that template, and hides the
94
- * package's doc topics.
103
+ * The first stable CLI release that applies a template's `replaces`
104
+ * (spec:AST-035 FR1). Published 0.6.3 and earlier reject the field, drop that
105
+ * template, and hide every doc topic the package ships. Published 0.6.4 lists
106
+ * the template, keeps the topics, answers the Core id with the replacement,
107
+ * and still selects the Core original with `--package @astryxdesign/core`.
108
+ */
109
+ export const TEMPLATE_REPLACES_CLI: "0.6.4";
110
+ /**
111
+ * The first stable CLI release that reads a template's `keywords`. Published
112
+ * 0.6.4 and 0.6.5 reject the field and drop that template but keep the
113
+ * package's doc topics; 0.6.3 and earlier also hide them. Published 0.6.6
114
+ * lists the template, and search matches its keywords.
115
+ */
116
+ export const KEYWORDS_CLI: "0.6.6";
117
+ /**
118
+ * The first stable CLI release that applies a component's `replaces`
119
+ * (spec:AST-035 FR10). It is also the opt-in: a CLI applies a package's
120
+ * component replacements only when the package's `@astryxdesign/cli` peer
121
+ * range starts here, so a package published for an earlier CLI keeps the
122
+ * behavior it shipped with. Earlier stable CLIs accept the field and keep the
123
+ * component under its own name.
124
+ *
125
+ * Tied to the next patch slot: it must equal the first stable release that
126
+ * ships component replacement. If that slot moves, change this constant and
127
+ * its row in the floor table test together.
95
128
  */
96
- export const REPLACES_CLI: "0.7.0";
129
+ export const COMPONENT_REPLACES_CLI: "0.6.7";
97
130
  /**
98
131
  * The first stable CLI release that reads typed theme descriptors, the theme
99
132
  * folder `integration add theme` writes. Published 0.6.3 rejects a themes root
@@ -26,11 +26,35 @@ export const CLI_PACKAGE = '@astryxdesign/cli';
26
26
  export const NAMESPACE_DOCS_CLI = '0.6.4';
27
27
 
28
28
  /**
29
- * The first CLI release that reads a template's `replaces` and `keywords`. A
30
- * release before it rejects either field, drops that template, and hides the
31
- * package's doc topics.
29
+ * The first stable CLI release that applies a template's `replaces`
30
+ * (spec:AST-035 FR1). Published 0.6.3 and earlier reject the field, drop that
31
+ * template, and hide every doc topic the package ships. Published 0.6.4 lists
32
+ * the template, keeps the topics, answers the Core id with the replacement,
33
+ * and still selects the Core original with `--package @astryxdesign/core`.
32
34
  */
33
- export const REPLACES_CLI = '0.7.0';
35
+ export const TEMPLATE_REPLACES_CLI = '0.6.4';
36
+
37
+ /**
38
+ * The first stable CLI release that reads a template's `keywords`. Published
39
+ * 0.6.4 and 0.6.5 reject the field and drop that template but keep the
40
+ * package's doc topics; 0.6.3 and earlier also hide them. Published 0.6.6
41
+ * lists the template, and search matches its keywords.
42
+ */
43
+ export const KEYWORDS_CLI = '0.6.6';
44
+
45
+ /**
46
+ * The first stable CLI release that applies a component's `replaces`
47
+ * (spec:AST-035 FR10). It is also the opt-in: a CLI applies a package's
48
+ * component replacements only when the package's `@astryxdesign/cli` peer
49
+ * range starts here, so a package published for an earlier CLI keeps the
50
+ * behavior it shipped with. Earlier stable CLIs accept the field and keep the
51
+ * component under its own name.
52
+ *
53
+ * Tied to the next patch slot: it must equal the first stable release that
54
+ * ships component replacement. If that slot moves, change this constant and
55
+ * its row in the floor table test together.
56
+ */
57
+ export const COMPONENT_REPLACES_CLI = '0.6.7';
34
58
 
35
59
  /**
36
60
  * The first stable CLI release that reads typed theme descriptors, the theme
@@ -152,9 +176,10 @@ export function docsTreeCliProblem(pkg) {
152
176
  }
153
177
 
154
178
  /**
155
- * Why a package with a template that sets `replaces` would lose templates and
156
- * doc topics on an older CLI (spec:AST-035), or null when its declared CLI
157
- * range admits only CLIs that read the field.
179
+ * Why a package with a template that sets `replaces` would lose that template
180
+ * and its doc topics on an older CLI (spec:AST-035 FR1), or null when its
181
+ * declared CLI range admits only CLIs that apply the field. Published 0.6.3
182
+ * rejects the field; published 0.6.4 applies it.
158
183
  * @param {any} pkg package.json
159
184
  * @returns {string | null}
160
185
  */
@@ -163,7 +188,24 @@ export function replacesCliProblem(pkg) {
163
188
  pkg,
164
189
  'has a template that sets `replaces`',
165
190
  "rejects the field, drops that template, and hides the package's doc topics",
166
- REPLACES_CLI,
191
+ TEMPLATE_REPLACES_CLI,
192
+ );
193
+ }
194
+
195
+ /**
196
+ * Why a package with a component that sets `replaces` would not get the
197
+ * replacement (spec:AST-035 FR10), or null when its declared CLI range starts
198
+ * at the release that applies it. That range is the package's opt-in: without
199
+ * it the component keeps its own name and the Core component stays selected.
200
+ * @param {any} pkg package.json
201
+ * @returns {string | null}
202
+ */
203
+ export function componentReplacesCliProblem(pkg) {
204
+ return cliRangeProblem(
205
+ pkg,
206
+ 'has a component that sets `replaces`',
207
+ 'ignores the field and keeps the component under its own name, and a later CLI applies the replacement only for a package whose range starts at that release',
208
+ COMPONENT_REPLACES_CLI,
167
209
  );
168
210
  }
169
211
 
@@ -204,9 +246,10 @@ export function themesCliProblem(pkg) {
204
246
 
205
247
  /**
206
248
  * Why a package with a template that sets `keywords` would lose that template
207
- * and its doc topics on an older CLI, or null when its declared CLI range
208
- * admits only CLIs that read the field. Published 0.6.3 rejects the field,
209
- * drops that template, and hides the package's doc topics.
249
+ * on an older CLI, or null when its declared CLI range admits only CLIs that
250
+ * read the field. Published 0.6.4 and 0.6.5 reject the field and drop that
251
+ * template; 0.6.3 and earlier also hide the package's doc topics. Published
252
+ * 0.6.6 reads it.
210
253
  * @param {any} pkg package.json
211
254
  * @returns {string | null}
212
255
  */
@@ -214,8 +257,8 @@ export function keywordsCliProblem(pkg) {
214
257
  return cliRangeProblem(
215
258
  pkg,
216
259
  'has a template that sets `keywords`',
217
- "rejects the field, drops that template, and hides the package's doc topics",
218
- REPLACES_CLI,
260
+ "rejects the field and drops that template, and one before 0.6.4 also hides the package's doc topics",
261
+ KEYWORDS_CLI,
219
262
  );
220
263
  }
221
264
 
@@ -5,10 +5,13 @@ import {describe, expect, it} from 'vitest';
5
5
  import {semverCompare} from '../env/semver.mjs';
6
6
  import * as requirement from './cli-requirement.mjs';
7
7
  import {
8
+ COMPONENT_REPLACES_CLI,
9
+ KEYWORDS_CLI,
8
10
  NAMESPACE_DOCS_CLI,
9
- REPLACES_CLI,
10
11
  SECTION_IDS_CLI,
12
+ TEMPLATE_REPLACES_CLI,
11
13
  cliRangeProblem,
14
+ componentReplacesCliProblem,
12
15
  THEMES_CLI,
13
16
  lowestAdmitted,
14
17
  docsTreeCliProblem,
@@ -89,20 +92,142 @@ describe('docsTreeCliProblem', () => {
89
92
  });
90
93
 
91
94
  describe('replacesCliProblem', () => {
92
- it('asks a package that sets replaces for a CLI that reads the field', () => {
95
+ // Published 0.6.4 applies a template's `replaces`. Published 0.6.3 and
96
+ // earlier reject the field, drop the template, and hide the package's doc
97
+ // topics.
98
+ it('asks a package that sets replaces for a CLI from 0.6.4', () => {
93
99
  expect(replacesCliProblem({name: '@acme/kit'})).toContain(
94
100
  'sets `replaces`',
95
101
  );
96
- expect(
97
- replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '^0.6.0'}}),
98
- ).toContain('admits a stable CLI before');
99
- expect(
100
- replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
101
- ).toBeNull();
102
- // Unlike the docs tree, `replaces` still needs 0.7.0.
103
- expect(
104
- replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}}),
105
- ).toContain('admits a stable CLI before 0.7.0');
102
+ expect(replacesCliProblem({name: '@acme/kit'})).toContain(
103
+ "A stable CLI before 0.6.4 rejects the field, drops that template, and hides the package's doc topics.",
104
+ );
105
+ for (const range of ['>=0.6.4', '^0.6.4', '>=0.6.5', '>=0.7.0']) {
106
+ expect(
107
+ replacesCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
108
+ ).toBeNull();
109
+ }
110
+ for (const range of ['>=0.6.3', '^0.6.0', '*']) {
111
+ expect(
112
+ replacesCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
113
+ ).toContain('admits a stable CLI before 0.6.4');
114
+ }
115
+ });
116
+ });
117
+
118
+ describe('keywordsCliProblem', () => {
119
+ // Published 0.6.6 reads a template's `keywords`. Published 0.6.4 and 0.6.5
120
+ // reject the field and drop the template; 0.6.3 and earlier also hide the
121
+ // package's doc topics.
122
+ it('asks a package that sets keywords for a CLI from 0.6.6', () => {
123
+ expect(keywordsCliProblem({name: '@acme/kit'})).toContain(
124
+ 'sets `keywords`',
125
+ );
126
+ expect(keywordsCliProblem({name: '@acme/kit'})).toContain(
127
+ "A stable CLI before 0.6.6 rejects the field and drops that template, and one before 0.6.4 also hides the package's doc topics.",
128
+ );
129
+ for (const range of ['>=0.6.6', '^0.6.6', '>=0.6.7', '>=0.7.0']) {
130
+ expect(
131
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
132
+ ).toBeNull();
133
+ }
134
+ for (const range of ['>=0.6.5', '>=0.6.4', '^0.6.4', '^0.6.0']) {
135
+ expect(
136
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
137
+ ).toContain('admits a stable CLI before 0.6.6');
138
+ }
139
+ });
140
+ });
141
+
142
+ describe('template replaces and keywords floors in the shipped docs', () => {
143
+ // The range an author is told to declare is the range `integration verify`
144
+ // accepts, so following the docs never fails the check or asks for a CLI
145
+ // no release satisfies.
146
+ const read = (/** @type {string} */ file) =>
147
+ fs.readFileSync(new URL(file, import.meta.url), 'utf-8');
148
+
149
+ it('shows the replaces floor in the replace-a-core-template guide', () => {
150
+ const named = [
151
+ ...read(
152
+ '../../assets/docs/tree/replace-a-core-template.doc.mjs',
153
+ ).matchAll(/"@astryxdesign\/cli":\s*">=(\d+\.\d+\.\d+)"/g),
154
+ ].map(match => match[1]);
155
+ expect(named.length).toBeGreaterThan(0);
156
+ expect(new Set(named)).toEqual(new Set([TEMPLATE_REPLACES_CLI]));
157
+ });
158
+
159
+ it.each([
160
+ ['`replaces_needs_cli`', TEMPLATE_REPLACES_CLI],
161
+ ['`keywords_needs_cli`', KEYWORDS_CLI],
162
+ ])('gives the %s fix the floor the check asks for', (code, floor) => {
163
+ const row = read('../../assets/docs/tree/troubleshooting.doc.mjs')
164
+ .split('],')
165
+ .find(part => part.includes(`${code}:`));
166
+ expect(row).toContain(`@astryxdesign/cli=>=${floor}'`);
167
+ });
168
+ });
169
+
170
+ describe('componentReplacesCliProblem', () => {
171
+ // The floor is also the opt-in (spec:AST-035 FR10): a component's `replaces`
172
+ // applies only for a package whose CLI range starts at it. Earlier stable
173
+ // CLIs accept the field and keep the component under its own name.
174
+ it('asks a package whose component sets replaces for the release that applies it', () => {
175
+ expect(componentReplacesCliProblem({name: '@acme/kit'})).toContain(
176
+ 'has a component that sets `replaces`',
177
+ );
178
+ expect(componentReplacesCliProblem({name: '@acme/kit'})).toContain(
179
+ 'keeps the component under its own name',
180
+ );
181
+ for (const range of ['>=0.6.4', '^0.6.0', '>=0.6.5', '*']) {
182
+ expect(
183
+ componentReplacesCliProblem({
184
+ peerDependencies: {'@astryxdesign/cli': range},
185
+ }),
186
+ ).toContain(`admits a stable CLI before ${COMPONENT_REPLACES_CLI}`);
187
+ }
188
+ for (const range of [
189
+ `>=${COMPONENT_REPLACES_CLI}`,
190
+ `^${COMPONENT_REPLACES_CLI}`,
191
+ '>=0.7.0',
192
+ ]) {
193
+ expect(
194
+ componentReplacesCliProblem({
195
+ peerDependencies: {'@astryxdesign/cli': range},
196
+ }),
197
+ ).toBeNull();
198
+ }
199
+ });
200
+
201
+ it('is the range every shipped doc tells an author to declare', () => {
202
+ // The floor is tied to the next patch slot. If the slot moves, these docs
203
+ // move with the constant and its row in the floor table below.
204
+ for (const file of [
205
+ '../../assets/docs/tree/replace-a-core-component.doc.mjs',
206
+ '../../authoring/doctypes/component/component.doc.mjs',
207
+ '../../authoring/doctypes/component/type.ts',
208
+ ]) {
209
+ const text = fs.readFileSync(new URL(file, import.meta.url), 'utf-8');
210
+ const named = [
211
+ ...text.matchAll(/"@astryxdesign\/cli\\?":\s*\\?">=(\d+\.\d+\.\d+)/g),
212
+ ].map(match => match[1]);
213
+ expect(named.length, file).toBeGreaterThan(0);
214
+ expect(new Set(named), file).toEqual(new Set([COMPONENT_REPLACES_CLI]));
215
+ }
216
+ const troubleshooting = fs.readFileSync(
217
+ new URL(
218
+ '../../assets/docs/tree/troubleshooting.doc.mjs',
219
+ import.meta.url,
220
+ ),
221
+ 'utf-8',
222
+ );
223
+ const row = troubleshooting
224
+ .split('],')
225
+ .find(part => part.includes('`component_replaces_needs_cli`'));
226
+ expect(row).toContain(`@astryxdesign/cli=>=${COMPONENT_REPLACES_CLI}'`);
227
+ // Every version that row names is the floor.
228
+ expect(new Set(row?.match(/\d+\.\d+\.\d+/g))).toEqual(
229
+ new Set([COMPONENT_REPLACES_CLI]),
230
+ );
106
231
  });
107
232
  });
108
233
 
@@ -127,17 +252,17 @@ describe('themesCliProblem and sectionIdsCliProblem', () => {
127
252
  }
128
253
  });
129
254
 
130
- it('keeps 0.7.0 for replaces and keywords', () => {
255
+ it('gives replaces and keywords their own floors', () => {
256
+ // `>=0.6.4` admits published 0.6.4 and 0.6.5, which drop a template that
257
+ // sets `keywords` but apply one that sets `replaces`.
131
258
  const pkg = {peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}};
132
259
  expect(docsTreeCliProblem(pkg)).toBeNull();
133
- expect(replacesCliProblem(pkg)).toContain(
134
- 'admits a stable CLI before 0.7.0',
135
- );
260
+ expect(replacesCliProblem(pkg)).toBeNull();
136
261
  expect(keywordsCliProblem(pkg)).toContain(
137
- 'admits a stable CLI before 0.7.0',
262
+ 'admits a stable CLI before 0.6.6',
138
263
  );
139
264
  expect(
140
- keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
265
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.6'}}),
141
266
  ).toBeNull();
142
267
  });
143
268
 
@@ -145,7 +270,13 @@ describe('themesCliProblem and sectionIdsCliProblem', () => {
145
270
  const {version} = JSON.parse(
146
271
  fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'),
147
272
  );
148
- for (const floor of [NAMESPACE_DOCS_CLI, THEMES_CLI, SECTION_IDS_CLI]) {
273
+ for (const floor of [
274
+ NAMESPACE_DOCS_CLI,
275
+ THEMES_CLI,
276
+ SECTION_IDS_CLI,
277
+ TEMPLATE_REPLACES_CLI,
278
+ KEYWORDS_CLI,
279
+ ]) {
149
280
  expect(semverCompare(floor, version.split('-')[0])).toBeLessThanOrEqual(
150
281
  0,
151
282
  );
@@ -184,9 +315,10 @@ describe('every feature check names its CLI floor', () => {
184
315
  // check whose floor changes, fails here until this table says so on
185
316
  // purpose, so a floor never moves as a side effect of another change.
186
317
  const FLOORS = {
318
+ componentReplacesCliProblem: COMPONENT_REPLACES_CLI,
187
319
  docsTreeCliProblem: '0.6.4',
188
- replacesCliProblem: REPLACES_CLI,
189
- keywordsCliProblem: REPLACES_CLI,
320
+ replacesCliProblem: TEMPLATE_REPLACES_CLI,
321
+ keywordsCliProblem: KEYWORDS_CLI,
190
322
  sectionIdsCliProblem: '0.6.4',
191
323
  themesCliProblem: '0.6.4',
192
324
  };
@@ -209,8 +341,13 @@ describe('every feature check names its CLI floor', () => {
209
341
  );
210
342
  expect(named).toEqual({
211
343
  ...FLOORS,
212
- replacesCliProblem: '0.7.0',
213
- keywordsCliProblem: '0.7.0',
344
+ // Tied to the next patch slot: the first stable release that ships
345
+ // component replacement.
346
+ componentReplacesCliProblem: '0.6.7',
347
+ // Measured on published releases: 0.6.4 applies a template's
348
+ // `replaces`, and 0.6.6 reads its `keywords`.
349
+ replacesCliProblem: '0.6.4',
350
+ keywordsCliProblem: '0.6.6',
214
351
  });
215
352
  });
216
353
  });
@@ -71,9 +71,9 @@ function enumerateThemeFiles(root, pkgDir) {
71
71
  if (!root || !fs.existsSync(root) || !fs.statSync(root).isDirectory()) {
72
72
  return [];
73
73
  }
74
- // Exactly what `theme add` copies: each theme folder's files, including
75
- // tests and fixtures, but no dot entry or file npm never publishes. Files
76
- // beside the theme folders belong to no theme.
74
+ // Exactly what `theme eject` copies and what the package ships as source:
75
+ // each theme folder's files, including tests and fixtures, but no dot entry
76
+ // or file npm never publishes. Files beside the theme folders belong to no theme.
77
77
  /** @type {string[]} */
78
78
  const files = [];
79
79
  for (const entry of fs.readdirSync(root, {withFileTypes: true})) {
@@ -5,6 +5,22 @@
5
5
  export function issueError(code: string, message: string): Issue;
6
6
  /** @param {string} code @param {string} message @returns {Issue} */
7
7
  export function issueWarning(code: string, message: string): Issue;
8
+ /**
9
+ * Why a declared root cannot be read as a folder, or null when it can.
10
+ * A missing root keeps its own issue; a root that is a file or that the
11
+ * user running astryx cannot read used to surface as a raw errno from
12
+ * whichever check touched it first, or end validation outright.
13
+ * @param {string} root
14
+ * @returns {{kind: 'missing'} | {kind: 'not-a-folder'} | {kind: 'unreadable', code: string} | null}
15
+ */
16
+ export function rootProblem(root: string): {
17
+ kind: "missing";
18
+ } | {
19
+ kind: "not-a-folder";
20
+ } | {
21
+ kind: "unreadable";
22
+ code: string;
23
+ } | null;
8
24
  /**
9
25
  * Validate an already-LOADED integration (as produced by `loadIntegrations` —
10
26
  * absolute contribution roots plus identity) and return its issues. This is the
@@ -99,8 +99,40 @@ function checkUnknownKeys(integration, issues) {
99
99
  }
100
100
 
101
101
  /**
102
- * Verify each declared contribution root exists on disk. A declared-but-missing
103
- * root is a `missing_root` error.
102
+ * Why a declared root cannot be read as a folder, or null when it can.
103
+ * A missing root keeps its own issue; a root that is a file or that the
104
+ * user running astryx cannot read used to surface as a raw errno from
105
+ * whichever check touched it first, or end validation outright.
106
+ * @param {string} root
107
+ * @returns {{kind: 'missing'} | {kind: 'not-a-folder'} | {kind: 'unreadable', code: string} | null}
108
+ */
109
+ export function rootProblem(root) {
110
+ let stat;
111
+ try {
112
+ stat = fs.statSync(root);
113
+ } catch (err) {
114
+ const code = /** @type {any} */ (err)?.code;
115
+ return code === 'ENOENT' || code === 'ENOTDIR'
116
+ ? {kind: 'missing'}
117
+ : {kind: 'unreadable', code: String(code ?? 'unknown error')};
118
+ }
119
+ if (!stat.isDirectory()) return {kind: 'not-a-folder'};
120
+ try {
121
+ fs.accessSync(root, fs.constants.R_OK | fs.constants.X_OK);
122
+ } catch (err) {
123
+ return {
124
+ kind: 'unreadable',
125
+ code: String(/** @type {any} */ (err)?.code ?? 'unknown error'),
126
+ };
127
+ }
128
+ return null;
129
+ }
130
+
131
+ /**
132
+ * Verify each declared contribution root is a folder Astryx can read. A
133
+ * declared-but-missing root is a `missing_root` error, a file is an
134
+ * `invalid_root` error, and a folder that cannot be read is an
135
+ * `unreadable_root` error. The contribution checks skip all three.
104
136
  * @param {{components?: string, templates?: string, codemods?: string, docs?: string, themes?: string}} resolved
105
137
  * absolute resolved roots (undefined when not declared)
106
138
  * @param {Issue[]} issues
@@ -116,13 +148,29 @@ function checkRoots(resolved, issues) {
116
148
  for (const kind of kinds) {
117
149
  const root = resolved[kind];
118
150
  if (root == null) continue;
119
- if (!fs.existsSync(root)) {
151
+ const problem = rootProblem(root);
152
+ if (problem == null) continue;
153
+ if (problem.kind === 'missing') {
120
154
  issues.push(
121
155
  issueError(
122
156
  'missing_root',
123
157
  `Declared ${kind} root does not exist on disk: ${root}`,
124
158
  ),
125
159
  );
160
+ } else if (problem.kind === 'not-a-folder') {
161
+ issues.push(
162
+ issueError(
163
+ 'invalid_root',
164
+ `Declared ${kind} root is a file, not a folder: ${root}. Fix: point "${kind}" in the manifest at the folder that holds them.`,
165
+ ),
166
+ );
167
+ } else {
168
+ issues.push(
169
+ issueError(
170
+ 'unreadable_root',
171
+ `Declared ${kind} root cannot be read (${problem.code}): ${root}. Fix: make it readable by the user running astryx.`,
172
+ ),
173
+ );
126
174
  }
127
175
  }
128
176
  }
@@ -135,7 +183,7 @@ function checkRoots(resolved, issues) {
135
183
  * @param {Issue[]} issues
136
184
  */
137
185
  async function checkCodemods(integration, issues) {
138
- if (!integration.codemods || !fs.existsSync(integration.codemods)) return;
186
+ if (!integration.codemods || rootProblem(integration.codemods)) return;
139
187
  const context = integration.__packageDir
140
188
  ? createFixContext(integration.__packageDir, integration)
141
189
  : null;
@@ -232,7 +280,7 @@ async function checkCodemods(integration, issues) {
232
280
  * @param {Issue[]} issues
233
281
  */
234
282
  async function checkTemplates(integration, issues) {
235
- if (!integration.templates || !fs.existsSync(integration.templates)) return;
283
+ if (!integration.templates || rootProblem(integration.templates)) return;
236
284
  try {
237
285
  const {errors} = await discoverIntegrationTemplatesForOne(integration);
238
286
  for (const e of errors) {
@@ -257,7 +305,7 @@ async function checkTemplates(integration, issues) {
257
305
  * @param {Issue[]} issues
258
306
  */
259
307
  async function checkComponents(integration, issues) {
260
- if (!integration.components || !fs.existsSync(integration.components)) return;
308
+ if (!integration.components || rootProblem(integration.components)) return;
261
309
  const discover = componentDiscovery.discoverValidIntegrationComponents;
262
310
  if (typeof discover !== 'function') return; // feature not present yet
263
311
  try {
@@ -330,7 +378,7 @@ async function checkComponents(integration, issues) {
330
378
  * @param {Issue[]} issues
331
379
  */
332
380
  async function checkDocs(integration, issues) {
333
- if (!integration.docs || !fs.existsSync(integration.docs)) return;
381
+ if (!integration.docs || rootProblem(integration.docs)) return;
334
382
  try {
335
383
  const {errors} = await discoverIntegrationDocs(integration);
336
384
  for (const e of errors) {
@@ -349,7 +397,7 @@ async function checkDocs(integration, issues) {
349
397
  * @param {Issue[]} issues
350
398
  */
351
399
  async function checkThemes(integration, issues) {
352
- if (!integration.themes || !fs.existsSync(integration.themes)) return;
400
+ if (!integration.themes || rootProblem(integration.themes)) return;
353
401
  try {
354
402
  await discoverIntegrationThemes(integration);
355
403
  } catch (err) {
@@ -44,15 +44,21 @@ export interface CLIUnsupportedError {
44
44
  }
45
45
 
46
46
  /**
47
- * A success response: a `type` discriminator, its `data` payload, and an
48
- * optional `meta` sidecar (emitted as a sibling of `data`, never merged in).
49
- * `--json` prints it with `apiVersion` added (see `parseResponse`).
47
+ * A success response: a `type` discriminator, the `package` that owns what the
48
+ * response is about, its `data` payload, and an optional `meta` sidecar
49
+ * (emitted as a sibling of `data`, never merged in). `--json` prints it with
50
+ * `apiVersion` added (see `parseResponse`).
51
+ *
52
+ * `package` is present when the response is about one thing: one component,
53
+ * one doc, one template. A response that lists things from more than one
54
+ * package leaves it out, and each listed item names its own `package`.
50
55
  *
51
56
  * Structural by design — there is no central union of every response `type`.
52
57
  * A specific command narrows `data` via its own return type.
53
58
  */
54
59
  export interface CLIResponse {
55
60
  type: string;
61
+ package?: string;
56
62
  data: unknown;
57
63
  meta?: Record<string, unknown>;
58
64
  }
@@ -31,15 +31,18 @@ export function humanWarn(...args: unknown[]): void;
31
31
  * Output a JSON response envelope and mark it handled.
32
32
  *
33
33
  * Structural serializer: pass a command/API result straight through as
34
- * `{type, data, meta?}`. There is no central response union — the correctness
35
- * of the `type` discriminator is guaranteed at each API function's `@returns`
36
- * (that's the fractal source-of-truth point), not by a map in this file.
34
+ * `{type, package?, data, meta?}`. There is no central response union — the
35
+ * correctness of the `type` discriminator is guaranteed at each API function's
36
+ * `@returns` (that's the fractal source-of-truth point), not by a map in this
37
+ * file. `package` names the npm package that owns the one thing the result is
38
+ * about (spec cli-surface INV28); it is written directly after `type`.
37
39
  *
38
- * @param {{type: string, data: unknown, meta?: Record<string, unknown>}} response
40
+ * @param {{type: string, package?: string, data: unknown, meta?: Record<string, unknown>}} response
39
41
  * @returns {void}
40
42
  */
41
43
  export function jsonOut(response: {
42
44
  type: string;
45
+ package?: string;
43
46
  data: unknown;
44
47
  meta?: Record<string, unknown>;
45
48
  }): void;
@@ -7,7 +7,7 @@
7
7
  * The contract has four guarantees, enforced here and in index.mjs:
8
8
  *
9
9
  * 1. EVERY emission in --json mode is a single valid JSON envelope.
10
- * Success: { apiVersion, type, data }
10
+ * Success: { apiVersion, type, package?, data, meta? }
11
11
  * Error: { apiVersion, error, code, suggestions? }
12
12
  * The `code` is a stable, machine-readable identifier (see
13
13
  * error-codes.mjs). Consumers should branch on `code`, never on the
@@ -87,16 +87,20 @@ export function humanWarn(...args) {
87
87
  * Output a JSON response envelope and mark it handled.
88
88
  *
89
89
  * Structural serializer: pass a command/API result straight through as
90
- * `{type, data, meta?}`. There is no central response union — the correctness
91
- * of the `type` discriminator is guaranteed at each API function's `@returns`
92
- * (that's the fractal source-of-truth point), not by a map in this file.
90
+ * `{type, package?, data, meta?}`. There is no central response union — the
91
+ * correctness of the `type` discriminator is guaranteed at each API function's
92
+ * `@returns` (that's the fractal source-of-truth point), not by a map in this
93
+ * file. `package` names the npm package that owns the one thing the result is
94
+ * about (spec cli-surface INV28); it is written directly after `type`.
93
95
  *
94
- * @param {{type: string, data: unknown, meta?: Record<string, unknown>}} response
96
+ * @param {{type: string, package?: string, data: unknown, meta?: Record<string, unknown>}} response
95
97
  * @returns {void}
96
98
  */
97
99
  export function jsonOut(response) {
98
100
  /** @type {any} */
99
- const envelope = {apiVersion: API_VERSION, type: response.type, data: response.data};
101
+ const envelope = {apiVersion: API_VERSION, type: response.type};
102
+ if (response.package !== undefined) envelope.package = response.package;
103
+ envelope.data = response.data;
100
104
  if (response.meta !== undefined) envelope.meta = response.meta;
101
105
  // Serialize BEFORE marking handled. If JSON.stringify throws (a circular
102
106
  // reference or a BigInt in `data` — an author bug in a command's return