@astryxdesign/cli 0.6.6 → 0.6.7-canary.13feb39

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
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import {jsonOut} from '../../../foundation/response/json.mjs';
8
- import {emit, section, text, records, code} from '../formatters/index.mjs';
8
+ import {emit, section, text, records, code, record} from '../formatters/index.mjs';
9
9
  import {cliError} from '../lib/cli-error.mjs';
10
10
  import {template as templateApi} from '../../../api/template/template.mjs';
11
11
  import {Project} from '../../../foundation/config/project.mjs';
@@ -111,6 +111,52 @@ export function registerTemplate(program) {
111
111
  case 'template.list': {
112
112
  const pages = result.data.filter(t => t.type === 'page');
113
113
  const blocks = result.data.filter(t => t.type === 'block');
114
+
115
+ // Bare `template` (no --list, no name) shows a grouped summary so a
116
+ // no-context agent or terminal doesn't receive 150 KB of catalog. The
117
+ // full catalog stays reachable via `template --list`.
118
+ if (!options.list && !name) {
119
+ /** @param {import('../../../api/template/template.type.mjs').TemplateListEntry[]} items */
120
+ const grouped = items => {
121
+ /** @type {Map<string, string[]>} */
122
+ const groups = new Map();
123
+ for (const t of items) {
124
+ const cat = t.category || 'Other';
125
+ const list = groups.get(cat);
126
+ if (list) {
127
+ list.push(t.id);
128
+ } else {
129
+ groups.set(cat, [t.id]);
130
+ }
131
+ }
132
+ /** @type {string[]} */
133
+ const lines = [];
134
+ for (const [cat, ids] of groups) {
135
+ lines.push(`${cat}: ${ids.join(', ')}`);
136
+ }
137
+ return lines.join('\n');
138
+ };
139
+ emit(
140
+ pages.length > 0 && section(`Page Templates (${pages.length})`),
141
+ pages.length > 0 && text(grouped(pages)),
142
+ blocks.length > 0 && section(`Block Templates (${blocks.length})`),
143
+ blocks.length > 0 && text(grouped(blocks)),
144
+ section('Usage'),
145
+ text(
146
+ [
147
+ `${run} template <id> Show full source`,
148
+ `${run} template <id> [target-path] Scaffold page or block`,
149
+ `${run} template <id> --skeleton Layout reference`,
150
+ `${run} template --list Full catalog with descriptions`,
151
+ `${run} template --list --type block List only blocks`,
152
+ `${run} template --list --package <pkg> List from one package`,
153
+ `${run} template --cdn CDN starter page, no build step`,
154
+ ].join('\n'),
155
+ ),
156
+ );
157
+ break;
158
+ }
159
+
114
160
  // Project each entry to its JSON-mirroring fields; the WIP marker is
115
161
  // folded into `name` (as before) and the package is shown only when it
116
162
  // isn't the built-in core package.
@@ -146,6 +192,7 @@ export function registerTemplate(program) {
146
192
  case 'template.skeleton': {
147
193
  const {template: tName, description, components, skeleton} = result.data;
148
194
  emit(
195
+ record({package: result.package}),
149
196
  text(
150
197
  `# ${tName}${description ? ' — ' + description : ''}\n` +
151
198
  `# Components: ${components.join(', ')}`,
@@ -156,10 +203,12 @@ export function registerTemplate(program) {
156
203
  }
157
204
 
158
205
  case 'template.show': {
159
- // Source must survive piping byte-for-byte, so the note about
160
- // replaced demo media goes to stderr, in the copy receipt's words.
161
- // (Text mode only: --json returned above with the count in data.)
206
+ // Source must survive piping byte-for-byte, so the package it comes
207
+ // from (cli-surface INV28) and the note about replaced demo media go
208
+ // to stderr, the note in the copy receipt's words. (Text mode only:
209
+ // --json returned above with both in the envelope.)
162
210
  const {source, demoMediaReplaced} = result.data;
211
+ console.error(`package: ${result.package}`);
163
212
  emit(code(source));
164
213
  if (demoMediaReplaced > 0) {
165
214
  console.error(
@@ -171,15 +220,17 @@ export function registerTemplate(program) {
171
220
  }
172
221
 
173
222
  case 'template.copy': {
174
- const {outputDir, fileName, demoMediaReplaced} = result.data;
223
+ const {outputDir, fileName, demoMediaReplaced, notes} = result.data;
175
224
  const file = `${outputDir}/${fileName}`;
176
225
  emit(
177
226
  text(`Copied template to ${file}`),
227
+ record({package: result.package}),
178
228
  demoMediaReplaced > 0 &&
179
229
  text(
180
230
  `Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'} in ${file}: ` +
181
231
  'images now show a neutral placeholder and videos have an empty source. Supply your own media there.',
182
232
  ),
233
+ ...notes.map(/** @param {string} note */ note => text(note)),
183
234
  );
184
235
  break;
185
236
  }
@@ -35,6 +35,17 @@ import {runCli} from '../../../test-utils/run-cli.mjs';
35
35
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
36
36
  const REPO_ROOT = path.resolve(__dirname, '../../../../..');
37
37
 
38
+ /**
39
+ * Response types whose text output is the artifact's source, printed byte for
40
+ * byte so it can be piped (spec cli-surface INV28). Their JSON still names the
41
+ * package; their text does not.
42
+ */
43
+ const VERBATIM_TYPES = new Set([
44
+ 'component.detail.source',
45
+ 'component.detail.showcase',
46
+ 'template.show',
47
+ ]);
48
+
38
49
  // ─── Helpers ────────────────────────────────────────────────────────────────
39
50
 
40
51
  /**
@@ -438,6 +449,24 @@ const CASES = [
438
449
  // Themes are rendered as list items, not records.
439
450
  skipFieldChecks: true,
440
451
  },
452
+ {
453
+ name: 'theme remove',
454
+ args: ['theme', 'remove', 'does-not-exist'],
455
+ errorExpected: true,
456
+ skipFieldChecks: true,
457
+ },
458
+ {
459
+ name: 'theme use',
460
+ args: ['theme', 'use', 'does-not-exist'],
461
+ errorExpected: true,
462
+ skipFieldChecks: true,
463
+ },
464
+ {
465
+ name: 'theme eject',
466
+ args: ['theme', 'eject', 'does-not-exist'],
467
+ errorExpected: true,
468
+ skipFieldChecks: true,
469
+ },
441
470
  {
442
471
  name: 'theme build',
443
472
  args: ['theme', 'build', 'nonexistent.ts'],
@@ -561,6 +590,15 @@ describe('text-json-parity', () => {
561
590
  expect(run.textStatus).toBe(run.jsonStatus);
562
591
  });
563
592
 
593
+ // spec cli-surface INV28: text names the package the envelope names.
594
+ // Verbatim source output prints only the source, so a pipe gets the
595
+ // file byte for byte.
596
+ it('text names the package the JSON envelope names', () => {
597
+ if (run.json?.package === undefined) return;
598
+ if (VERBATIM_TYPES.has(run.json.type)) return;
599
+ expect(run.text).toContain(run.json.package);
600
+ });
601
+
564
602
  if (!tc.skipFieldChecks && !tc.errorExpected) {
565
603
  it('every text record key exists in the JSON data', () => {
566
604
  if (!run.json?.data) return;
@@ -569,6 +607,8 @@ describe('text-json-parity', () => {
569
607
  if (run.json.meta) {
570
608
  for (const k of jsonLeafKeys(run.json.meta)) jsonKeys.add(k);
571
609
  }
610
+ // The envelope's own `package` (spec cli-surface INV28) is JSON too.
611
+ if (run.json.package !== undefined) jsonKeys.add('package');
572
612
  const violations = [];
573
613
  for (const key of textKeys.keys()) {
574
614
  if (!jsonKeys.has(key)) {
@@ -0,0 +1,135 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file Compatibility and deprecation coverage for the two-step theme-add lifecycle. */
4
+
5
+ import {afterEach, beforeEach, describe, expect, it} from 'vitest';
6
+ import * as fs from 'node:fs';
7
+ import * as os from 'node:os';
8
+ import * as path from 'node:path';
9
+ import {runCli} from '../../../test-utils/run-cli.mjs';
10
+ import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
11
+
12
+ let tmpDir;
13
+
14
+ beforeEach(() => {
15
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-theme-add-cli-'));
16
+ fs.mkdirSync(path.join(tmpDir, 'src'));
17
+ fs.writeFileSync(
18
+ path.join(tmpDir, 'package.json'),
19
+ JSON.stringify({name: 'app', private: true}),
20
+ );
21
+ });
22
+
23
+ afterEach(() => {
24
+ fs.rmSync(tmpDir, {recursive: true, force: true});
25
+ });
26
+
27
+ describe('theme add compatibility lifecycle', () => {
28
+ it('keeps copy stdout and emits one text-only deprecation warning', async () => {
29
+ const result = await runCli(['theme', 'add', 'neutral'], tmpDir);
30
+
31
+ expect(result.status, result.stderr).toBe(0);
32
+ expect(result.stdout).toContain(
33
+ '[ok] Added Neutral theme from @astryxdesign/cli to src/themes/neutral/',
34
+ );
35
+ expect(result.stdout).toContain('This is your copy of the Neutral theme');
36
+ expect(result.stderr.match(/source copying is deprecated/g)).toHaveLength(
37
+ 1,
38
+ );
39
+ // The app has no CLI installed, so the commands name the scoped package.
40
+ const run = getCliInvocation(tmpDir);
41
+ expect(run).toMatch(/ @astryxdesign\/cli$/);
42
+ expect(result.stderr).toContain(`${run} theme eject neutral`);
43
+ expect(result.stderr).toContain(`${run} theme add neutral --import`);
44
+ expect(fs.existsSync(path.join(tmpDir, 'src/themes/neutral'))).toBe(true);
45
+ expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
46
+ false,
47
+ );
48
+ });
49
+
50
+ it('keeps theme.add data and adds machine-readable deprecation metadata', async () => {
51
+ const result = await runCli(['theme', 'add', 'neutral', '--json'], tmpDir);
52
+
53
+ expect(result.status, result.stderr).toBe(0);
54
+ expect(result.stderr).not.toContain('source copying is deprecated');
55
+ expect(JSON.parse(result.stdout)).toMatchObject({
56
+ type: 'theme.add',
57
+ data: {
58
+ slug: 'neutral',
59
+ package: '@astryxdesign/cli',
60
+ outputDir: 'src/themes/neutral',
61
+ },
62
+ meta: {
63
+ deprecations: [
64
+ {
65
+ id: 'DEP-0005',
66
+ replacements: ['theme eject', 'theme add --import'],
67
+ },
68
+ ],
69
+ },
70
+ });
71
+ });
72
+
73
+ it('keeps the list JSON unchanged and names the stage commands in text', async () => {
74
+ fs.mkdirSync(path.join(tmpDir, 'src/themes/broken'), {recursive: true});
75
+ fs.writeFileSync(
76
+ path.join(tmpDir, 'src/themes/broken/brokenTheme.ts'),
77
+ 'export const brokenTheme = {};\n',
78
+ );
79
+
80
+ const textResult = await runCli(['theme', 'add', '--list'], tmpDir);
81
+ expect(textResult.status, textResult.stderr).toBe(0);
82
+ const run = getCliInvocation(tmpDir);
83
+ expect(textResult.stdout).toContain(
84
+ `Import one: ${run} theme add <slug> --import [--package <package>]`,
85
+ );
86
+ expect(textResult.stdout).toContain(
87
+ `Fork source: ${run} theme eject <slug> [target-path]`,
88
+ );
89
+ expect(textResult.stdout).not.toContain('theme add <slug> [target-path]');
90
+ expect(textResult.stderr).not.toContain('deprecated');
91
+
92
+ const result = await runCli(['theme', 'add', '--list', '--json'], tmpDir);
93
+
94
+ expect(result.status, result.stderr).toBe(0);
95
+ const payload = JSON.parse(result.stdout);
96
+ expect(payload).toMatchObject({type: 'theme.list'});
97
+ expect(payload.meta).toBeUndefined();
98
+ expect(payload.data.some(theme => theme.slug === 'broken')).toBe(false);
99
+ expect(Object.keys(payload.data[0]).sort()).toEqual([
100
+ 'description',
101
+ 'displayName',
102
+ 'maintained',
103
+ 'package',
104
+ 'slug',
105
+ ]);
106
+ expect(result.stderr).not.toContain('deprecated');
107
+ });
108
+
109
+ it.each([
110
+ ['target path', ['src/brand']],
111
+ ['overwrite', ['--overwrite']],
112
+ ])('rejects --import with a %s before writing', async (_label, extra) => {
113
+ const result = await runCli(
114
+ ['theme', 'add', 'neutral', '--import', ...extra, '--json'],
115
+ tmpDir,
116
+ );
117
+
118
+ expect(result.status).not.toBe(0);
119
+ expect(JSON.parse(result.stdout)).toMatchObject({
120
+ code: 'ERR_THEME_INVALID',
121
+ error: expect.stringContaining('cannot be combined'),
122
+ });
123
+ expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
124
+ false,
125
+ );
126
+ expect(fs.existsSync(path.join(tmpDir, 'src/brand'))).toBe(false);
127
+ });
128
+
129
+ it('lists --import in help', async () => {
130
+ const result = await runCli(['theme', 'add', '--help'], tmpDir);
131
+
132
+ expect(result.status, result.stderr).toBe(0);
133
+ expect(result.stdout).toContain('--import');
134
+ });
135
+ });
@@ -1,12 +1,6 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- /**
4
- * @file CommandDoc for `astryx theme add`. The terminal binding of the
5
- * `themeAdd()` function (referenced via `fn`); its args/flags map to that
6
- * function's params so a converter can build Commander config + --help from one
7
- * source of truth.
8
- * @position packages/cli/clients/cli/commands — command documentation
9
- */
3
+ /** @file CommandDoc for `astryx theme add`. */
10
4
 
11
5
  /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
12
6
  export const doc = {
@@ -14,11 +8,9 @@ export const doc = {
14
8
  name: 'theme add',
15
9
  displayName: 'astryx theme add',
16
10
  namespace: 'cli/commands',
17
- summary: 'Scaffold a theme into your project as editable source',
11
+ summary: 'Copy a theme, or import its built output into the app',
18
12
  description:
19
- "Copies a bundled or installed integration theme's source into your project so you own it. " +
20
- 'Writes are staged then renamed, rolling back on failure. Running it with no slug, or with ' +
21
- '--list, lists available themes; use --package when more than one owner provides the slug.',
13
+ 'With --import, records the theme in the generated app module and imports its built module and stylesheets. Without --import, keeps the released source-copy behavior, emits one text warning, and adds meta.deprecations with DEP-0005 and the theme eject/theme add --import replacements to JSON. A bare command or --list delegates to themeListCopySources() so the released list fields stay unchanged; use --package when owners share a slug.',
22
14
  fn: 'themeAdd',
23
15
  args: [
24
16
  {name: 'slug', param: 'slug', required: false},
@@ -28,10 +20,15 @@ export const doc = {
28
20
  {
29
21
  flag: '-f, --overwrite',
30
22
  param: 'options.overwrite',
31
- description:
32
- 'Replace existing files. Without it, existing files fail the command with ERR_FILE_EXISTS and nothing is written',
23
+ description: 'Replace copied files. Cannot be combined with --import',
33
24
  },
34
25
  {flag: '--list', description: 'List available themes'},
26
+ {
27
+ flag: '--import',
28
+ param: 'options.import',
29
+ description:
30
+ 'Use the built theme through the generated app module instead of copying source',
31
+ },
35
32
  {
36
33
  flag: '--package <package>',
37
34
  param: 'options.package',
@@ -39,18 +36,21 @@ export const doc = {
39
36
  },
40
37
  ],
41
38
  examples: [
42
- {label: 'Scaffold a theme', cli: 'astryx theme add matcha'},
43
39
  {
44
- label: 'Pick the owner when two packages ship the same slug',
45
- cli: 'astryx theme add ocean --package @acme/themes',
40
+ label: 'Import a built theme into the app',
41
+ cli: 'astryx theme add ocean --import',
42
+ },
43
+ {
44
+ label: 'Select a package theme over a local theme',
45
+ cli: 'astryx theme add ocean --import --package @acme/themes',
46
46
  },
47
47
  ],
48
48
  exitCodes: [
49
- {code: 0, when: 'success'},
49
+ {code: 0, when: 'the theme is listed, copied, or imported'},
50
50
  {
51
51
  code: 1,
52
- when: 'unknown or ambiguous theme, a path escape, a missing descriptor or source, or an existing file without --overwrite',
52
+ when: 'the theme, its source or built imports, its record, the target path, or the option combination is invalid',
53
53
  },
54
54
  ],
55
- related: ['theme list', 'theme build'],
55
+ related: ['theme list', 'theme remove', 'theme use', 'theme eject'],
56
56
  };
@@ -21,7 +21,9 @@ export const doc = {
21
21
  'theme. --family combines one selected extension tree into the three files named by ' +
22
22
  'the required --family-key, ready for one CSS load and identity-only switching. ' +
23
23
  'With --check it writes nothing and reports source drift. --icons-specifier keeps ' +
24
- 'its existing generated-module behavior.',
24
+ 'its existing generated-module behavior. It prints one line per built theme and ' +
25
+ 'one line naming fonts the themes do not load; --detail full adds the install ' +
26
+ 'example and the font recipe, once for a batch.',
25
27
  fn: 'themeBuild',
26
28
  args: [{name: 'files', param: 'file', required: true, variadic: true}],
27
29
  options: [
@@ -0,0 +1,47 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx theme eject`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'theme eject',
9
+ displayName: 'astryx theme eject',
10
+ namespace: 'cli/commands',
11
+ summary: 'Fork a theme as editable local source',
12
+ description:
13
+ "Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Use --package when package themes share a slug.",
14
+ fn: 'themeEject',
15
+ args: [
16
+ {name: 'slug', param: 'slug', required: true},
17
+ {name: 'path', param: 'options.targetPath', required: false},
18
+ ],
19
+ options: [
20
+ {
21
+ flag: '-f, --overwrite',
22
+ param: 'options.overwrite',
23
+ description:
24
+ 'Replace existing files. Without it, an existing file fails with ERR_FILE_EXISTS and nothing is written',
25
+ },
26
+ {
27
+ flag: '--package <package>',
28
+ param: 'options.package',
29
+ description: 'Select the package that owns the theme',
30
+ },
31
+ ],
32
+ examples: [
33
+ {label: 'Fork a theme into the local root', cli: 'astryx theme eject ocean'},
34
+ {
35
+ label: 'Fork one package theme elsewhere',
36
+ cli: 'astryx theme eject ocean src/themes/my-ocean --package @acme/themes',
37
+ },
38
+ ],
39
+ exitCodes: [
40
+ {code: 0, when: 'all source and descriptor files are written'},
41
+ {
42
+ code: 1,
43
+ when: 'the theme is unknown or ambiguous, a path escapes, a source file is missing, or a destination exists',
44
+ },
45
+ ],
46
+ related: ['theme add', 'theme build', 'theme list'],
47
+ };
@@ -23,11 +23,14 @@ afterEach(() => {
23
23
  });
24
24
 
25
25
  describe('astryx theme list', () => {
26
- it('lists the bundled themes and points at discover for more', async () => {
26
+ it('lists bundled themes and points at import, eject, and discover', async () => {
27
27
  const {status, stdout} = await runCli(['theme', 'list'], {cwd: tmpDir});
28
28
 
29
29
  expect(status).toBe(0);
30
- expect(stdout).toMatch(/^- neutral \(maintained, @astryxdesign\/cli\)/m);
30
+ expect(stdout).toMatch(/^slug:\s+neutral$/m);
31
+ expect(stdout).toMatch(/^package:\s+@astryxdesign\/cli$/m);
32
+ expect(stdout).toMatch(/Import one: .*theme add <slug> --import/m);
33
+ expect(stdout).toMatch(/Fork source: .*theme eject <slug>/m);
31
34
  expect(stdout).toMatch(/More themes in packages you could add: .*discover theme$/m);
32
35
  });
33
36
 
@@ -16,8 +16,8 @@ export const doc = {
16
16
  namespace: 'cli/commands',
17
17
  summary: 'List themes available to add',
18
18
  description:
19
- 'Lists themes bundled with this CLI and source themes contributed by installed integrations, ' +
20
- 'each with its slug, display name, description, maintained flag, and owner package.',
19
+ 'Lists bundled, package, and local themes with their owner, source, added state, and default state. ' +
20
+ 'Earlier descriptor-less copies are not listed as themes; the receipt names them with the upgrade command.',
21
21
  fn: 'themeListAvailable',
22
22
  options: [
23
23
  {
@@ -21,8 +21,7 @@ export const doc = {
21
21
  'JSON is also supported. Existing author-owned files are left untouched unless --overwrite is explicit. ' +
22
22
  'When used in a theme integration, keep the palette request under the theme slug, ' +
23
23
  'write the candidate and receipt under that same slug, import the candidate from the theme source, ' +
24
- 'and keep all three inside the theme directory: `astryx theme add` copies that whole ' +
25
- 'directory into the consumer project, so nothing else has to list them.',
24
+ 'and keep all three inside the theme directory. The package ships that directory as one source unit for discovery and explicit eject, while apps use its built exports.',
26
25
  fn: 'themePaletteGenerate',
27
26
  args: [{name: 'config', param: 'configPath', required: true}],
28
27
  options: [
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx theme remove`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'theme remove',
9
+ displayName: 'astryx theme remove',
10
+ namespace: 'cli/commands',
11
+ summary: 'Remove a non-default theme from the app',
12
+ description:
13
+ 'Removes one added theme from the generated module and regenerates the whole module. Choose another default with theme use before removing the current default.',
14
+ fn: 'themeRemove',
15
+ args: [{name: 'slug', param: 'slug', required: true}],
16
+ examples: [{label: 'Remove an added theme', cli: 'astryx theme remove ocean'}],
17
+ exitCodes: [
18
+ {code: 0, when: 'the module is regenerated without the theme'},
19
+ {code: 1, when: 'the theme is not added, is the default, or state is invalid'},
20
+ ],
21
+ related: ['theme add', 'theme use', 'theme list'],
22
+ };
@@ -19,8 +19,9 @@ export const doc = {
19
19
  'Writes theme.template.ts: the annotated reference for the whole theme surface, covering every ' +
20
20
  'defineTheme field, the token families, the component override syntax, and how a theme is ' +
21
21
  'consumed, naming the CLI command that prints the authoritative reference for each. Read ' +
22
- 'it, copy what you need into your own theme file, delete it. Use `theme add <slug>` instead ' +
23
- 'to start from a theme we ship. Leaves an existing file untouched unless --overwrite.',
22
+ 'it, copy what you need into your own theme file, delete it. Use `theme add <slug> --import` to ' +
23
+ 'use an installed built theme, extend that theme for ordinary customization, or use ' +
24
+ '`theme eject <slug>` for a complete source fork. Leaves an existing file untouched unless --overwrite.',
24
25
  fn: 'themeTemplate',
25
26
  args: [{name: 'path', param: 'options.targetPath', required: false}],
26
27
  options: [
@@ -38,5 +39,5 @@ export const doc = {
38
39
  {code: 0, when: 'success, including when an existing file was left untouched'},
39
40
  {code: 1, when: 'the target path escapes the project, or the file cannot be written'},
40
41
  ],
41
- related: ['theme add', 'theme list', 'theme build'],
42
+ related: ['theme add', 'theme eject', 'theme list', 'theme build'],
42
43
  };
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @file CommandDoc for `astryx theme use`. */
4
+
5
+ /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
6
+ export const doc = {
7
+ type: 'command',
8
+ name: 'theme use',
9
+ displayName: 'astryx theme use',
10
+ namespace: 'cli/commands',
11
+ summary: 'Choose the app default from its added themes',
12
+ description:
13
+ 'Sets one added slug as the default and regenerates the generated theme module. Add the theme first if it is not already in the app.',
14
+ fn: 'themeUse',
15
+ args: [{name: 'slug', param: 'slug', required: true}],
16
+ examples: [{label: 'Choose the default theme', cli: 'astryx theme use ocean'}],
17
+ exitCodes: [
18
+ {code: 0, when: 'the module is regenerated with the selected default'},
19
+ {code: 1, when: 'the theme is not added or state is invalid'},
20
+ ],
21
+ related: ['theme add', 'theme remove', 'theme list'],
22
+ };
@@ -1,10 +1,8 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file CommandDoc for the `astryx theme` command group. A parent group with no
5
- * behavior of its own; it dispatches to the build/add/list subcommands, which
6
- * carry the actual args, flags, and wrapped functions.
7
- * @position packages/cli/clients/cli/commands — command documentation
4
+ * @file CommandDoc for the `astryx theme` command group. It is a real group,
5
+ * not a compatibility alias. Its subcommands own the work.
8
6
  */
9
7
 
10
8
  /** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
@@ -13,18 +11,25 @@ export const doc = {
13
11
  name: 'theme',
14
12
  displayName: 'astryx theme',
15
13
  namespace: 'cli/commands',
16
- summary:
17
- 'Create and build themes: add a shipped one, compile to CSS, or list what a theme can override',
14
+ summary: 'Add, switch, build, and author themes',
18
15
  description:
19
- 'The theme command group. Running astryx theme with no subcommand prints the ' +
20
- 'subcommand list; the work happens in the subcommands: compile a theme (build), ' +
21
- 'scaffold one into your project (add), start a custom one from the annotated template (template), ' +
22
- 'list the bundled and installed integration themes (list), generate a palette candidate (palette), or list the ' +
23
- 'component theming targets a theme can override (targets).',
24
- subcommands: ['build', 'add', 'list', 'template', 'palette', 'targets'],
16
+ 'The theme command group. Import built themes into an app, choose its default, remove them, list available and added themes, or eject source to make a local fork. Plain theme add still copies source while that default is deprecated. The authoring commands build themes, generate palettes, write the annotated template, and list component theme targets.',
17
+ subcommands: [
18
+ 'build',
19
+ 'list',
20
+ 'add',
21
+ 'remove',
22
+ 'use',
23
+ 'eject',
24
+ 'template',
25
+ 'palette',
26
+ 'targets',
27
+ ],
25
28
  examples: [
26
- {label: 'List available themes', cli: 'astryx theme list'},
27
- {label: 'Scaffold a theme', cli: 'astryx theme add matcha'},
29
+ {label: 'List available and added themes', cli: 'astryx theme list'},
30
+ {label: 'Import a theme into the app', cli: 'astryx theme add ocean --import'},
31
+ {label: 'Choose the default', cli: 'astryx theme use ocean'},
32
+ {label: 'Fork source to customize', cli: 'astryx theme eject ocean'},
28
33
  {
29
34
  label: 'Generate a palette candidate',
30
35
  cli: 'astryx theme palette generate palette.config.json',
@@ -32,8 +37,8 @@ export const doc = {
32
37
  {label: 'See what a theme can override', cli: 'astryx theme targets'},
33
38
  ],
34
39
  exitCodes: [
35
- {code: 0, when: 'success (help shown, or a subcommand succeeded)'},
36
- {code: 1, when: 'an unknown subcommand'},
40
+ {code: 0, when: 'help is shown or a subcommand succeeds'},
41
+ {code: 1, when: 'an unknown subcommand or a subcommand failure'},
37
42
  ],
38
43
  related: ['init'],
39
44
  };
@@ -187,8 +187,9 @@ describe('upgrade — core codemods run before config load', () => {
187
187
 
188
188
  const out = await runHuman(['upgrade', '--from', '0.1.2', '--path', 'src']);
189
189
  expect(out).toMatch(/fails strict validation/i);
190
+ // The fixture has no `astryx` bin installed, so the command names the scoped package.
190
191
  expect(out).toContain(
191
- 'astryx upgrade --from 0.1.2 --codemod migrate-layout-components-to-experimental --apply',
192
+ '@astryxdesign/cli upgrade --from 0.1.2 --codemod migrate-layout-components-to-experimental --apply',
192
193
  );
193
194
  expect(exitCode).not.toBe(1);
194
195
  });
@@ -69,7 +69,7 @@ export function registerUpgrade(program) {
69
69
  emit(
70
70
  section('Available codemods'),
71
71
  records(result.data, {
72
- fields: ['name', 'title', 'version', 'optional'],
72
+ fields: ['name', 'package', 'title', 'version', 'optional'],
73
73
  }),
74
74
  );
75
75
  }