@astryxdesign/cli 0.6.5-canary.f261d2f → 0.6.5-canary.f2f43e1

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 (364) hide show
  1. package/README.md +58 -55
  2. package/api/build/_adapter.d.mts +19 -0
  3. package/api/build/_adapter.mjs +60 -1
  4. package/api/build/build.test.mjs +74 -1
  5. package/api/build/build.type.d.mts +8 -0
  6. package/api/build/build.type.mjs +2 -0
  7. package/api/build/kit/kit.mjs +40 -7
  8. package/api/build/kit/rank.d.mts +8 -0
  9. package/api/build/kit/rank.mjs +14 -0
  10. package/api/build/kit/weights.d.mts +82 -0
  11. package/api/build/kit/weights.json +1 -0
  12. package/api/build/kit/weights.mjs +305 -0
  13. package/api/build/kit/weights.test.mjs +190 -0
  14. package/api/component/_adapter.d.mts +19 -0
  15. package/api/component/_adapter.mjs +33 -0
  16. package/api/component/component-replacement.test.mjs +603 -0
  17. package/api/component/component.mjs +49 -15
  18. package/api/component/component.test.mjs +32 -0
  19. package/api/component/component.type.d.mts +33 -3
  20. package/api/component/component.type.mjs +10 -3
  21. package/api/component/detail/blocks/blocks.d.mts +2 -1
  22. package/api/component/detail/blocks/blocks.mjs +5 -2
  23. package/api/component/detail/detail.mjs +5 -1
  24. package/api/component/detail/props/props.d.mts +2 -1
  25. package/api/component/detail/props/props.mjs +3 -2
  26. package/api/component/detail/showcase/showcase.d.mts +3 -1
  27. package/api/component/detail/showcase/showcase.mjs +3 -1
  28. package/api/component/detail/source/source.d.mts +3 -2
  29. package/api/component/detail/source/source.mjs +7 -3
  30. package/api/component/list/list.mjs +128 -10
  31. package/api/docs/_adapter.d.mts +11 -0
  32. package/api/docs/_adapter.mjs +25 -0
  33. package/api/docs/detail/detail.mjs +19 -3
  34. package/api/docs/detail/section/section.mjs +7 -1
  35. package/api/docs/docOverlays.test.mjs +10 -6
  36. package/api/docs/docs.d.mts +6 -0
  37. package/api/docs/docs.depth.test.mjs +134 -0
  38. package/api/docs/docs.doc.mjs +31 -2
  39. package/api/docs/docs.mjs +46 -1
  40. package/api/docs/docs.test.mjs +1 -1
  41. package/api/docs/docs.type.d.mts +81 -4
  42. package/api/docs/docs.type.mjs +41 -4
  43. package/api/docs/index/index.mjs +11 -2
  44. package/api/docs/index/index.test.mjs +7 -2
  45. package/api/docs/integrationDocs.test.mjs +6 -5
  46. package/api/docs/node/node.d.mts +28 -3
  47. package/api/docs/node/node.mjs +149 -23
  48. package/api/doctor/_adapter.d.mts +43 -0
  49. package/api/doctor/_adapter.mjs +142 -0
  50. package/api/doctor/doctor.d.mts +0 -10
  51. package/api/doctor/doctor.doc.mjs +1 -3
  52. package/api/doctor/doctor.mjs +6 -123
  53. package/api/doctor/theme-checks.d.mts +12 -0
  54. package/api/doctor/theme-checks.mjs +1117 -0
  55. package/api/doctor/theme-checks.test.mjs +526 -0
  56. package/api/error.d.mts +22 -0
  57. package/api/error.mjs +42 -0
  58. package/api/gap-report/gap-report.d.mts +3 -1
  59. package/api/gap-report/gap-report.mjs +27 -3
  60. package/api/gap-report/gap-report.test.mjs +106 -0
  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.d.mts +1 -1
  68. package/api/hook/list/list.mjs +8 -8
  69. package/api/index.d.mts +1 -1
  70. package/api/index.mjs +4 -0
  71. package/api/init/run/run.d.mts +3 -5
  72. package/api/init/run/run.mjs +10 -11
  73. package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
  74. package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
  75. package/api/integration/add-contribution.d.mts +2 -1
  76. package/api/integration/add-contribution.mjs +7 -3
  77. package/api/integration/add-helpers.d.mts +26 -5
  78. package/api/integration/add-helpers.mjs +50 -5
  79. package/api/integration/add-theme.mjs +352 -27
  80. package/api/integration/add-theme.test.mjs +379 -15
  81. package/api/integration/authoring-checks.mjs +31 -8
  82. package/api/integration/authoring-checks.type.d.mts +8 -0
  83. package/api/integration/authoring-checks.type.mjs +7 -3
  84. package/api/integration/integration-authoring.type.d.mts +4 -1
  85. package/api/integration/integration-authoring.type.mjs +6 -1
  86. package/api/integration/integrationAdd.doc.mjs +6 -0
  87. package/api/integration/integrationAddTheme.doc.mjs +10 -0
  88. package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
  89. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  90. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  91. package/api/integration/pack-check.component-replaces.test.mjs +126 -0
  92. package/api/integration/pack-check.d.mts +10 -0
  93. package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
  94. package/api/integration/pack-check.mjs +483 -1
  95. package/api/integration/pack-check.test.mjs +568 -8
  96. package/api/integration/validate-integration.d.mts +4 -2
  97. package/api/integration/validate-integration.mjs +7 -2
  98. package/api/integration/validate-integration.test.mjs +55 -0
  99. package/api/integration/validate-integration.type.d.mts +5 -0
  100. package/api/integration/validate-integration.type.mjs +5 -1
  101. package/api/integration/validateIntegration.doc.mjs +1 -1
  102. package/api/layout/expand/expand.mjs +12 -7
  103. package/api/layout/expand/expand.receipt.test.mjs +74 -0
  104. package/api/layout/layout.type.d.mts +1 -0
  105. package/api/layout/layout.type.mjs +1 -0
  106. package/api/layout/layoutExpand.doc.mjs +1 -1
  107. package/api/search/search.d.mts +15 -8
  108. package/api/search/search.doc.mjs +4 -4
  109. package/api/search/search.mjs +179 -67
  110. package/api/search/search.test.mjs +128 -9
  111. package/api/search/search.type.d.mts +6 -6
  112. package/api/search/search.type.mjs +5 -5
  113. package/api/swizzle/_adapter.d.mts +10 -0
  114. package/api/swizzle/_adapter.mjs +23 -0
  115. package/api/swizzle/copy/copy.d.mts +5 -6
  116. package/api/swizzle/copy/copy.mjs +95 -13
  117. package/api/swizzle/list/list.mjs +2 -2
  118. package/api/swizzle/swizzle.doc.mjs +4 -0
  119. package/api/swizzle/swizzle.test.mjs +55 -5
  120. package/api/swizzle/swizzle.type.d.mts +8 -0
  121. package/api/swizzle/swizzle.type.mjs +2 -0
  122. package/api/template/copy/copy.mjs +15 -8
  123. package/api/template/copy/copy.receipt.test.mjs +77 -0
  124. package/api/template/show/show.mjs +17 -4
  125. package/api/template/show/show.test.mjs +76 -0
  126. package/api/template/skeleton/skeleton.mjs +2 -1
  127. package/api/template/template.d.mts +1 -1
  128. package/api/template/template.doc.mjs +6 -2
  129. package/api/template/template.mjs +2 -0
  130. package/api/template/template.type.d.mts +14 -0
  131. package/api/template/template.type.mjs +5 -0
  132. package/api/theme/_adapter.d.mts +106 -6
  133. package/api/theme/_adapter.mjs +687 -18
  134. package/api/theme/add/add.binary.test.mjs +76 -3
  135. package/api/theme/add/add.d.mts +5 -9
  136. package/api/theme/add/add.mjs +87 -64
  137. package/api/theme/add/add.rollback.test.mjs +9 -9
  138. package/api/theme/add/add.staging.test.mjs +9 -9
  139. package/api/theme/add/add.test.mjs +461 -55
  140. package/api/theme/add/add.types.test.mjs +151 -0
  141. package/api/theme/build/build.d.mts +50 -2
  142. package/api/theme/build/build.family.test.mjs +13 -4
  143. package/api/theme/build/build.icon-lineage.test.mjs +117 -0
  144. package/api/theme/build/build.icon-preservation.test.mjs +639 -0
  145. package/api/theme/build/build.mjs +463 -155
  146. package/api/theme/build/build.project-core.test.mjs +165 -0
  147. package/api/theme/build/build.test.mjs +220 -1
  148. package/api/theme/build/icon-imports.d.mts +47 -0
  149. package/api/theme/build/icon-imports.mjs +691 -0
  150. package/api/theme/eject/eject.binary.test.mjs +90 -0
  151. package/api/theme/eject/eject.d.mts +17 -0
  152. package/api/theme/eject/eject.mjs +65 -0
  153. package/api/theme/eject/eject.rollback.test.mjs +158 -0
  154. package/api/theme/eject/eject.staging.test.mjs +83 -0
  155. package/api/theme/eject/eject.test.mjs +160 -0
  156. package/api/theme/integration-themes.test.mjs +30 -6
  157. package/api/theme/list/list.d.mts +10 -0
  158. package/api/theme/list/list.mjs +75 -7
  159. package/api/theme/list/list.test.mjs +155 -4
  160. package/api/theme/remove/remove.d.mts +12 -0
  161. package/api/theme/remove/remove.mjs +15 -0
  162. package/api/theme/remove/remove.test.mjs +94 -0
  163. package/api/theme/template/template.mjs +3 -4
  164. package/api/theme/theme.d.mts +5 -2
  165. package/api/theme/theme.mjs +13 -8
  166. package/api/theme/theme.type.d.mts +106 -2
  167. package/api/theme/theme.type.mjs +54 -5
  168. package/api/theme/themeAdd.doc.d.mts +1 -3
  169. package/api/theme/themeAdd.doc.mjs +35 -22
  170. package/api/theme/themeBuild.doc.d.mts +4 -1
  171. package/api/theme/themeBuild.doc.mjs +15 -4
  172. package/api/theme/themeEject.doc.d.mts +8 -0
  173. package/api/theme/themeEject.doc.mjs +89 -0
  174. package/api/theme/themeListAvailable.doc.mjs +4 -4
  175. package/api/theme/themeListCopySources.doc.d.mts +8 -0
  176. package/api/theme/themeListCopySources.doc.mjs +60 -0
  177. package/api/theme/themeRemove.doc.d.mts +6 -0
  178. package/api/theme/themeRemove.doc.mjs +50 -0
  179. package/api/theme/themeTemplate.doc.mjs +4 -3
  180. package/api/theme/themeUse.doc.d.mts +6 -0
  181. package/api/theme/themeUse.doc.mjs +47 -0
  182. package/api/theme/use/use.d.mts +12 -0
  183. package/api/theme/use/use.mjs +15 -0
  184. package/api/theme/use/use.test.mjs +98 -0
  185. package/api/upgrade/_adapter.d.mts +1 -0
  186. package/api/upgrade/_adapter.mjs +3 -0
  187. package/api/upgrade/list/list.mjs +9 -3
  188. package/api/upgrade/run/run.mjs +20 -3
  189. package/api/upgrade/run/run.test.mjs +45 -1
  190. package/api/upgrade/upgrade.doc.mjs +1 -1
  191. package/api/upgrade/upgrade.type.d.mts +5 -0
  192. package/api/upgrade/upgrade.type.mjs +2 -0
  193. package/assets/codemods/integration-discovery.mjs +1 -1
  194. package/assets/codemods/integration-discovery.test.mjs +64 -0
  195. package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
  196. package/assets/codemods/transforms/next/index.mjs +14 -1
  197. package/assets/codemods/transforms/next/migrate-copied-themes-to-descriptors.mjs +54 -0
  198. package/assets/docs/author-a-theme.doc.mjs +161 -0
  199. package/assets/docs/getting-started.doc.mjs +59 -15
  200. package/assets/docs/icons.doc.mjs +1 -0
  201. package/assets/docs/principles.doc.dense.mjs +2 -2
  202. package/assets/docs/principles.doc.mjs +2 -2
  203. package/assets/docs/principles.doc.zh.mjs +2 -2
  204. package/assets/docs/styling-libraries.doc.mjs +1 -1
  205. package/assets/docs/styling.doc.mjs +2 -2
  206. package/assets/docs/theme.doc.dense.mjs +10 -198
  207. package/assets/docs/theme.doc.mjs +13 -770
  208. package/assets/docs/theme.doc.zh.mjs +31 -12
  209. package/assets/docs/tokens.doc.mjs +4 -4
  210. package/assets/docs/tree/add-a-theme.doc.mjs +6 -2
  211. package/assets/docs/tree/checks.doc.mjs +5 -4
  212. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  213. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  214. package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
  215. package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
  216. package/assets/docs/tree/headers-and-footers.doc.mjs +68 -0
  217. package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
  218. package/assets/docs/tree/layout.doc.mjs +32 -0
  219. package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
  220. package/assets/docs/tree/responsive.doc.mjs +102 -0
  221. package/assets/docs/tree/scaffold.doc.mjs +145 -0
  222. package/assets/docs/tree/side-panels.doc.mjs +82 -0
  223. package/assets/docs/tree/structure.doc.mjs +144 -0
  224. package/assets/docs/tree/themes.doc.mjs +2 -2
  225. package/assets/docs/tree/troubleshooting.doc.mjs +4 -0
  226. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
  227. package/assets/docs/tree/versioning.doc.mjs +4 -1
  228. package/assets/docs/use-a-theme.doc.mjs +97 -0
  229. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
  230. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
  231. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
  232. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
  233. package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
  234. package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
  235. package/assets/templates/pages/table-comparison/page.tsx +1449 -0
  236. package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
  237. package/assets/templates/themes/butter/icons.tsx +2 -0
  238. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  239. package/assets/templates/themes/gothic/icons.tsx +2 -0
  240. package/assets/templates/themes/matcha/icons.tsx +2 -0
  241. package/assets/templates/themes/neutral/icons.tsx +2 -0
  242. package/assets/templates/themes/stone/icons.tsx +2 -0
  243. package/assets/templates/themes/y2k/icons.tsx +2 -0
  244. package/authoring/doctypes/command/command.doc.mjs +5 -0
  245. package/authoring/doctypes/command/type.ts +2 -0
  246. package/authoring/doctypes/component/component.doc.mjs +1 -1
  247. package/authoring/doctypes/component/type.ts +8 -4
  248. package/authoring/integration/integration.doc.mjs +1 -1
  249. package/clients/cli/commands/build-theme.mjs +279 -30
  250. package/clients/cli/commands/build.mjs +7 -6
  251. package/clients/cli/commands/build.text-fields.test.mjs +1 -1
  252. package/clients/cli/commands/component/index.mjs +88 -12
  253. package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
  254. package/clients/cli/commands/component.doc.mjs +9 -2
  255. package/clients/cli/commands/discover.mjs +29 -1
  256. package/clients/cli/commands/discover.no-source.test.mjs +75 -0
  257. package/clients/cli/commands/docs.depth.test.mjs +219 -0
  258. package/clients/cli/commands/docs.doc.mjs +15 -2
  259. package/clients/cli/commands/docs.mjs +273 -16
  260. package/clients/cli/commands/docs.test.mjs +2 -3
  261. package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
  262. package/clients/cli/commands/doctor.doc.mjs +1 -1
  263. package/clients/cli/commands/doctor.mjs +4 -4
  264. package/clients/cli/commands/doctor.test.mjs +9 -51
  265. package/clients/cli/commands/gap-report.doc.mjs +2 -2
  266. package/clients/cli/commands/gap-report.mjs +12 -0
  267. package/clients/cli/commands/gap-report.test.mjs +63 -0
  268. package/clients/cli/commands/hook/index.mjs +7 -2
  269. package/clients/cli/commands/import-hint-correctness.test.mjs +5 -5
  270. package/clients/cli/commands/init.next-steps.test.mjs +18 -23
  271. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  272. package/clients/cli/commands/integration-authoring.test.mjs +12 -2
  273. package/clients/cli/commands/integration-real-world.test.mjs +61 -12
  274. package/clients/cli/commands/integration.mjs +3 -1
  275. package/clients/cli/commands/layout-check.doc.mjs +1 -0
  276. package/clients/cli/commands/layout-expand.doc.mjs +4 -1
  277. package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
  278. package/clients/cli/commands/layout.doc.mjs +1 -0
  279. package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
  280. package/clients/cli/commands/layout.mjs +61 -4
  281. package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
  282. package/clients/cli/commands/search.doc.mjs +5 -4
  283. package/clients/cli/commands/search.mjs +30 -6
  284. package/clients/cli/commands/search.test.mjs +63 -17
  285. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  286. package/clients/cli/commands/swizzle.mjs +2 -1
  287. package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
  288. package/clients/cli/commands/template.mjs +70 -6
  289. package/clients/cli/commands/template.show-media.test.mjs +62 -0
  290. package/clients/cli/commands/text-json-parity.test.mjs +40 -0
  291. package/clients/cli/commands/theme-add-lifecycle.test.mjs +132 -0
  292. package/clients/cli/commands/theme-add.doc.mjs +19 -19
  293. package/clients/cli/commands/theme-eject.doc.mjs +47 -0
  294. package/clients/cli/commands/theme-list.behavior.test.mjs +44 -0
  295. package/clients/cli/commands/theme-list.doc.mjs +2 -2
  296. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
  297. package/clients/cli/commands/theme-remove.doc.mjs +22 -0
  298. package/clients/cli/commands/theme-template.doc.mjs +4 -3
  299. package/clients/cli/commands/theme-use.doc.mjs +22 -0
  300. package/clients/cli/commands/theme.doc.mjs +21 -16
  301. package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
  302. package/clients/cli/commands/upgrade.mjs +1 -1
  303. package/clients/cli/commands/write-failure.test.mjs +175 -0
  304. package/clients/cli/index.mjs +4 -1
  305. package/clients/cli/lib/component-format.mjs +19 -2
  306. package/clients/cli/lib/manifest.mjs +44 -165
  307. package/clients/cli/lib/manifest.test.mjs +98 -7
  308. package/clients/cli/lib/resolve-theme.mjs +80 -78
  309. package/clients/cli/lib/resolve-theme.test.mjs +523 -27
  310. package/foundation/agent-docs/agent-docs.mjs +31 -28
  311. package/foundation/agent-docs/agent-docs.test.mjs +35 -32
  312. package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
  313. package/foundation/config/project.d.mts +20 -5
  314. package/foundation/config/project.mjs +43 -6
  315. package/foundation/config/theme-private-vars.d.mts +12 -0
  316. package/foundation/config/theme-private-vars.mjs +107 -0
  317. package/foundation/config/theme-private-vars.test.mjs +55 -0
  318. package/foundation/config/theme-state.d.mts +145 -0
  319. package/foundation/config/theme-state.mjs +417 -0
  320. package/foundation/config/theme-state.test.mjs +182 -0
  321. package/foundation/discovery/component-discovery.d.mts +5 -2
  322. package/foundation/discovery/component-discovery.mjs +12 -6
  323. package/foundation/discovery/component-replacement.d.mts +91 -0
  324. package/foundation/discovery/component-replacement.mjs +417 -0
  325. package/foundation/discovery/component-replacement.test.mjs +480 -0
  326. package/foundation/discovery/docs-output-budget.d.mts +6 -2
  327. package/foundation/discovery/docs-output-budget.mjs +2 -1
  328. package/foundation/discovery/docs-section-key.d.mts +4 -2
  329. package/foundation/discovery/docs-section-key.mjs +1 -1
  330. package/foundation/discovery/module-exports.d.mts +10 -0
  331. package/foundation/discovery/module-exports.mjs +146 -0
  332. package/foundation/discovery/package-exports.d.mts +29 -0
  333. package/foundation/discovery/package-exports.mjs +200 -0
  334. package/foundation/discovery/template-adapter.d.mts +13 -0
  335. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
  336. package/foundation/discovery/template-adapter.mjs +16 -1
  337. package/foundation/discovery/theme-discovery.d.mts +78 -5
  338. package/foundation/discovery/theme-discovery.mjs +143 -18
  339. package/foundation/discovery/theme-discovery.test.mjs +9 -3
  340. package/foundation/discovery/theme-imports.d.mts +15 -0
  341. package/foundation/discovery/theme-imports.mjs +217 -0
  342. package/foundation/discovery/theme-imports.test.mjs +173 -0
  343. package/foundation/doc-compiler/doc-loads.test.mjs +18 -8
  344. package/foundation/doc-compiler/inputs.mjs +2 -1
  345. package/foundation/doc-compiler/lenses.d.mts +4 -2
  346. package/foundation/doc-compiler/lenses.mjs +1 -1
  347. package/foundation/doc-compiler/tree.test.mjs +2 -2
  348. package/foundation/fs/module-loader.d.mts +9 -0
  349. package/foundation/fs/module-loader.mjs +71 -2
  350. package/foundation/integrations/cli-requirement.d.mts +22 -0
  351. package/foundation/integrations/cli-requirement.mjs +31 -0
  352. package/foundation/integrations/cli-requirement.test.mjs +70 -0
  353. package/foundation/integrations/contribution-inventory.mjs +3 -3
  354. package/foundation/response/base.d.ts +9 -3
  355. package/foundation/response/json.d.mts +7 -4
  356. package/foundation/response/json.mjs +10 -6
  357. package/foundation/response/response-types.doc.d.mts +5 -5
  358. package/foundation/response/response-types.doc.mjs +50 -35
  359. package/foundation/response/response.doc.mjs +18 -4
  360. package/foundation/text/copyright-header.mjs +1 -1
  361. package/foundation/text/copyright-header.test.mjs +1 -1
  362. package/package.json +9 -9
  363. package/assets/docs/layout.doc.dense.mjs +0 -388
  364. package/assets/docs/layout.doc.mjs +0 -550
@@ -18,7 +18,9 @@ export const doc = {
18
18
  description:
19
19
  'Parses and validates a compressed XLE/XLO expression, then expands it into ' +
20
20
  'ready-to-use XDS TSX, routing children into slots, scaffolding typed useState for ' +
21
- 'interactive controls, and splicing referenced blocks. Writes to a path, or returns the code.',
21
+ 'interactive controls, and splicing referenced blocks. Writes to a path, or returns the code. ' +
22
+ 'Astryx demo media in a spliced block becomes a placeholder, and the output says how many ' +
23
+ 'references were replaced (as a closing line comment when it prints the code).',
22
24
  fn: 'layoutExpand',
23
25
  args: [
24
26
  {
@@ -79,5 +81,6 @@ export const doc = {
79
81
  when: 'a missing, empty or over-5 MB expression (from stdin or --file), a bad --name or --form, a parse/validation error, or a path escape',
80
82
  },
81
83
  ],
84
+ deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
82
85
  related: ['layout check', 'layout grammar'],
83
86
  };
@@ -26,5 +26,6 @@ export const doc = {
26
26
  {code: 0, when: 'success'},
27
27
  {code: 1, when: 'the component registry cannot be read'},
28
28
  ],
29
+ deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
29
30
  related: ['layout expand', 'layout check'],
30
31
  };
@@ -30,5 +30,6 @@ export const doc = {
30
30
  {code: 0, when: 'a subcommand succeeded, or --help'},
31
31
  {code: 1, when: 'no subcommand (help is printed) or an unknown subcommand'},
32
32
  ],
33
+ deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
33
34
  related: ['template', 'build'],
34
35
  };
@@ -0,0 +1,94 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx layout expand` tells the caller, in JSON and in text, when demo
5
+ * media in a spliced template block was replaced with placeholders. Printed
6
+ * code stays verbatim and valid TSX: the disclosure follows it as a comment.
7
+ */
8
+
9
+ import {describe, it, expect, beforeEach, afterEach} from 'vitest';
10
+ import * as fs from 'node:fs';
11
+ import * as path from 'node:path';
12
+ import ts from 'typescript';
13
+ import {runCli} from '../../../test-utils/run-cli.mjs';
14
+ import {discoverTemplates} from '../../../api/template/template.mjs';
15
+
16
+ const SLOW = 60_000;
17
+ const DISCLOSURE = /demo media/i;
18
+
19
+ /** @param {string} name */
20
+ const hintKey = name => name.toLowerCase().replace(/[^a-z0-9]/g, '');
21
+
22
+ /** @param {string} source */
23
+ const tsxErrors = source =>
24
+ /** @type {any} */ (
25
+ ts.createSourceFile('out.tsx', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX)
26
+ ).parseDiagnostics.map((/** @type {ts.Diagnostic} */ d) =>
27
+ ts.flattenDiagnosticMessageText(d.messageText, ' '),
28
+ );
29
+
30
+ /** A `{hint}` for a template block whose source carries demo media. */
31
+ async function mediaBlockHint() {
32
+ const blocks = /** @type {Array<{dirName: string, type: string, filePath: string}>} */ (
33
+ await discoverTemplates()
34
+ ).filter(t => t.type === 'block' && t.filePath && fs.existsSync(t.filePath));
35
+ const seen = new Map();
36
+ for (const t of blocks) seen.set(hintKey(t.dirName), (seen.get(hintKey(t.dirName)) ?? 0) + 1);
37
+ const found = blocks.find(
38
+ t =>
39
+ seen.get(hintKey(t.dirName)) === 1 &&
40
+ /\/template-assets\/[\w.-]+\.\w+/.test(fs.readFileSync(t.filePath, 'utf-8')),
41
+ );
42
+ if (!found) throw new Error('no template block carries demo media');
43
+ return hintKey(found.dirName);
44
+ }
45
+
46
+ describe('layout expand discloses replaced demo media', () => {
47
+ let cwd;
48
+ beforeEach(() => {
49
+ // Inside the workspace so @astryxdesign/core resolves.
50
+ cwd = fs.mkdtempSync(path.join(process.cwd(), '.xle-media-receipt-'));
51
+ });
52
+ afterEach(() => fs.rmSync(cwd, {recursive: true, force: true}));
53
+
54
+ it('--json carries demoMediaReplaced; the text receipt states it for the written file', async () => {
55
+ const expr = `V > {${await mediaBlockHint()}}`;
56
+ const json = await runCli(['layout', 'expand', expr, './a', '--json'], cwd);
57
+ expect(json.status).toBe(0);
58
+ const {data} = JSON.parse(json.stdout);
59
+ expect(data.demoMediaReplaced).toBeGreaterThan(0);
60
+
61
+ const human = await runCli(['layout', 'expand', expr, './b'], cwd);
62
+ expect(human.status).toBe(0);
63
+ expect(human.stdout).toContain(
64
+ `Replaced ${data.demoMediaReplaced} Astryx demo media reference`,
65
+ );
66
+ expect(human.stdout).toContain(path.join('b', 'GeneratedLayout.tsx'));
67
+ }, SLOW);
68
+
69
+ it('prints the code verbatim, then states the count in a comment that keeps it valid TSX', async () => {
70
+ const expr = `V > {${await mediaBlockHint()}}`;
71
+ const {data} = JSON.parse((await runCli(['layout', 'expand', expr, '--json'], cwd)).stdout);
72
+
73
+ const human = await runCli(['layout', 'expand', expr], cwd);
74
+ expect(human.status).toBe(0);
75
+ expect(human.stdout.startsWith(data.code)).toBe(true);
76
+ expect(human.stdout.slice(data.code.length).trim()).toMatch(
77
+ new RegExp(`^// Replaced ${data.demoMediaReplaced} Astryx demo media references? in the code above: [^\\n]+$`),
78
+ );
79
+ expect(tsxErrors(human.stdout)).toEqual([]);
80
+ }, SLOW);
81
+
82
+ it('says nothing about demo media when none was replaced', async () => {
83
+ const json = await runCli(['layout', 'expand', 'V > B"Save"', '--json'], cwd);
84
+ const {data} = JSON.parse(json.stdout);
85
+ expect(data.demoMediaReplaced).toBe(0);
86
+
87
+ const written = await runCli(['layout', 'expand', 'V > B"Save"', './a'], cwd);
88
+ expect(written.status).toBe(0);
89
+ expect(written.stdout).not.toMatch(DISCLOSURE);
90
+ const printed = await runCli(['layout', 'expand', 'V > B"Save"'], cwd);
91
+ expect(printed.status).toBe(0);
92
+ expect(printed.stdout).toBe(`${data.code}\n`);
93
+ }, SLOW);
94
+ });
@@ -18,7 +18,7 @@
18
18
 
19
19
  import * as fs from 'node:fs';
20
20
  import * as path from 'node:path';
21
- import {jsonOut} from '../../../foundation/response/json.mjs';
21
+ import {jsonOut, isJsonMode} from '../../../foundation/response/json.mjs';
22
22
  import {emit, section, text, list, record, code, WARN} from '../formatters/index.mjs';
23
23
  import {cliError} from '../lib/cli-error.mjs';
24
24
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
@@ -59,6 +59,44 @@ import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
59
59
  * @property {boolean} [loose]
60
60
  */
61
61
 
62
+ /**
63
+ * DEP-0006: the `astryx layout` command group is deprecated.
64
+ *
65
+ * Human mode: one stderr warning per invocation.
66
+ * JSON mode: `meta.deprecation` in the response envelope.
67
+ */
68
+ const DEPRECATION = {
69
+ id: 'DEP-0006',
70
+ cleanup: 'CLN-0006',
71
+ replacement: [
72
+ 'astryx build "<idea>" — choose the template to start from',
73
+ 'astryx template <name> <path> — scaffold it',
74
+ 'astryx docs layout — layout guidance',
75
+ ],
76
+ };
77
+
78
+ function warnDeprecated() {
79
+ if (!isJsonMode()) {
80
+ console.error(
81
+ '[DEP-0006] astryx layout is deprecated and will be removed in a future minor release.\n' +
82
+ ' Use instead:\n' +
83
+ ' astryx build "<idea>" choose the template to start from\n' +
84
+ ' astryx template <name> scaffold it\n' +
85
+ ' astryx docs layout layout guidance\n',
86
+ );
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Add deprecation metadata to a JSON response before output.
92
+ * Canonical stdout (type, data) is unchanged; the metadata sits in `meta`.
93
+ * @param {{type: string, data: unknown}} result
94
+ * @returns {{type: string, data: unknown, meta: {deprecation: typeof DEPRECATION}}}
95
+ */
96
+ function withDeprecation(result) {
97
+ return {...result, meta: {deprecation: DEPRECATION}};
98
+ }
99
+
62
100
  /** The largest layout expression read from --file or stdin. */
63
101
  const MAX_EXPRESSION_BYTES = 5 * 1024 * 1024; // 5 MB
64
102
 
@@ -120,6 +158,20 @@ async function readExpression(expr, options = {}) {
120
158
  return expr ?? '';
121
159
  }
122
160
 
161
+ /**
162
+ * The disclosure for demo media replaced in spliced template blocks, or '' when
163
+ * none was. After printed code it is a line comment, so piped output stays TSX.
164
+ * @param {LayoutExpandResponse['data']} data
165
+ * @returns {string}
166
+ */
167
+ function demoMediaNotice({demoMediaReplaced, written}) {
168
+ if (demoMediaReplaced === 0) return '';
169
+ const notice =
170
+ `Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'} in ${written ?? 'the code above'}: ` +
171
+ 'images now show a neutral placeholder and videos have an empty source. Supply your own media there.';
172
+ return written ? notice : `// ${notice}`;
173
+ }
174
+
123
175
  /**
124
176
  * @param {import('commander').Command} program
125
177
  */
@@ -129,6 +181,7 @@ export function registerLayout(program) {
129
181
  defineCommand(layoutCmd, layoutExpandCommand, {
130
182
  fn: layoutExpandFn,
131
183
  action: async (/** @type {string} */ expression, /** @type {string} */ targetPath, /** @type {LayoutExpandOptions} */ options) => {
184
+ warnDeprecated();
132
185
  const json = program.opts().json || false;
133
186
  const source = await readExpression(expression, options);
134
187
  if (!source || source.trim() === '') {
@@ -154,7 +207,7 @@ export function registerLayout(program) {
154
207
  // Expanding turns an expression into TSX — a transformation, not a
155
208
  // lookup. What it produced is in the output; there is no set to count.
156
209
  if (json) {
157
- jsonOut(result);
210
+ jsonOut(withDeprecation(result));
158
211
  return NO_RESULT_SET;
159
212
  }
160
213
 
@@ -181,6 +234,8 @@ export function registerLayout(program) {
181
234
  // Raw expanded TSX (no target path) — preformatted, emitted verbatim.
182
235
  out.push(code(result.data.code));
183
236
  }
237
+ const mediaNotice = demoMediaNotice(result.data);
238
+ if (mediaNotice) out.push(text(mediaNotice));
184
239
  emit(...out);
185
240
  return NO_RESULT_SET;
186
241
  },
@@ -189,6 +244,7 @@ export function registerLayout(program) {
189
244
  defineCommand(layoutCmd, layoutCheckCommand, {
190
245
  fn: layoutCheckFn,
191
246
  action: async (/** @type {string} */ expression, /** @type {LayoutCheckOptions} */ options) => {
247
+ warnDeprecated();
192
248
  const json = program.opts().json || false;
193
249
  const source = await readExpression(expression, options);
194
250
  if (!source || source.trim() === '') {
@@ -218,7 +274,7 @@ export function registerLayout(program) {
218
274
  // A verdict on one expression: valid or not, with the errors that made
219
275
  // it so. Nothing was looked up.
220
276
  if (json) {
221
- jsonOut(result);
277
+ jsonOut(withDeprecation(result));
222
278
  return NO_RESULT_SET;
223
279
  }
224
280
 
@@ -252,6 +308,7 @@ export function registerLayout(program) {
252
308
  defineCommand(layoutCmd, layoutGrammarCommand, {
253
309
  fn: layoutGrammarFn,
254
310
  action: async () => {
311
+ warnDeprecated();
255
312
  const json = program.opts().json || false;
256
313
  /** @type {LayoutGrammarResponse} */
257
314
  let result;
@@ -264,7 +321,7 @@ export function registerLayout(program) {
264
321
  // One document, the same one every time: the grammar cheatsheet.
265
322
  const answered = resultSet({count: 1, resultKind: 'doc'});
266
323
  if (json) {
267
- jsonOut(result);
324
+ jsonOut(withDeprecation(result));
268
325
  return answered;
269
326
  }
270
327
  // The cheatsheet is a preformatted document — emit verbatim.
@@ -50,13 +50,13 @@ async function optionText(command, flag) {
50
50
  }
51
51
 
52
52
  describe('no help text describes a prompt', () => {
53
- it('theme add --overwrite states the refusal, and a refused run writes nothing', async () => {
54
- const help = await optionText('theme add', '--overwrite');
53
+ it('theme eject --overwrite states the refusal, and a refused run writes nothing', async () => {
54
+ const help = await optionText('theme eject', '--overwrite');
55
55
  expect(help).not.toMatch(/prompt/i);
56
56
  expect(help).toContain('ERR_FILE_EXISTS');
57
57
  expect(help).toMatch(/nothing is written/);
58
58
 
59
- const first = await runCli(['--json', 'theme', 'add', 'matcha'], tmpDir);
59
+ const first = await runCli(['--json', 'theme', 'eject', 'matcha'], tmpDir);
60
60
  expect(first.status).toBe(0);
61
61
  const {outputDir, files} = JSON.parse(first.stdout).data;
62
62
  expect(files.length).toBeGreaterThan(1);
@@ -64,7 +64,7 @@ describe('no help text describes a prompt', () => {
64
64
  fs.writeFileSync(path.join(dir, files[0]), '// edited\n');
65
65
  fs.rmSync(path.join(dir, files[1]));
66
66
 
67
- const refused = await runCli(['--json', 'theme', 'add', 'matcha'], tmpDir);
67
+ const refused = await runCli(['--json', 'theme', 'eject', 'matcha'], tmpDir);
68
68
  expect(refused.status).toBe(1);
69
69
  expect(JSON.parse(refused.stdout).code).toBe('ERR_FILE_EXISTS');
70
70
  expect(fs.readFileSync(path.join(dir, files[0]), 'utf8')).toBe('// edited\n');
@@ -13,11 +13,11 @@ export const doc = {
13
13
  name: 'search',
14
14
  displayName: 'astryx search',
15
15
  namespace: 'cli/commands',
16
- summary: 'Search components, hooks, docs, and templates in one ranked list',
16
+ summary: 'Search components, hooks, docs, templates, and themes in one ranked list',
17
17
  description:
18
18
  'Terminal front-end to search(): prints one ranked, greppable list across ' +
19
19
  'every content domain, each row carrying a follow-up command to act on it. ' +
20
- 'Outside an app, where @astryxdesign/core is not installed, it searches the docs.',
20
+ 'Outside an app, where @astryxdesign/core is not installed, it searches the docs and themes.',
21
21
  fn: 'search',
22
22
  // Every word after `search` is the query: `astryx search dark mode` searches
23
23
  // for "dark mode", with no quotes needed.
@@ -26,8 +26,8 @@ export const doc = {
26
26
  {
27
27
  flag: '--type <domain>',
28
28
  param: 'options.type',
29
- choices: ['component', 'hook', 'doc', 'template'],
30
- description: 'Filter to one domain (component|hook|doc|template)',
29
+ choices: ['component', 'hook', 'doc', 'template', 'theme'],
30
+ description: 'Filter to one domain (component|hook|doc|template|theme)',
31
31
  },
32
32
  {
33
33
  flag: '--limit <n>',
@@ -49,6 +49,7 @@ export const doc = {
49
49
  label: 'Filter + JSON',
50
50
  cli: 'astryx search "data table" --type template --json',
51
51
  },
52
+ {label: 'Themes you can add', cli: 'astryx search warm --type theme'},
52
53
  ],
53
54
  exitCodes: [
54
55
  {code: 0, when: 'success (including zero matches)'},
@@ -4,9 +4,9 @@
4
4
  * @file search command — unified ranked search with a stable result summary.
5
5
  *
6
6
  * One "I'm looking for X" entry point spanning components, hooks, docs topics,
7
- * and templates (page + block). Results are ranked by relevance and tagged
8
- * with their domain, with a follow-up command so the user knows what to run
9
- * next.
7
+ * templates (page + block), and themes. Results are ranked by relevance and
8
+ * tagged with their domain, with a follow-up command so the user knows what to
9
+ * run next.
10
10
  *
11
11
  * The command surface (description, args, flags) is sourced from the colocated
12
12
  * `search.doc.mjs` CommandDoc via `defineCommand`; this file supplies only the
@@ -104,13 +104,13 @@ export function registerSearch(program) {
104
104
  // ── Text output ──────────────────────────────────────────────
105
105
  const run = getCliInvocation();
106
106
  const {query: q, matchCount, results} = result.data;
107
- // Outside an app an open search covers the docs alone. Say so, so a
108
- // docs-only list does not read as "Astryx has no such component".
107
+ // Outside an app an open search covers the docs and themes alone. Say
108
+ // so, so that list does not read as "Astryx has no such component".
109
109
  const note =
110
110
  !options.type && !findCoreDir(process.cwd())
111
111
  ? [
112
112
  text(
113
- '@astryxdesign/core is not installed here, so only the docs were searched.',
113
+ '@astryxdesign/core is not installed here, so only the docs and themes were searched.',
114
114
  ),
115
115
  ]
116
116
  : [];
@@ -123,6 +123,7 @@ export function registerSearch(program) {
123
123
  text(
124
124
  `Try a broader term, or browse: ${run} ${note.length > 0 ? 'docs' : 'component --list'}`,
125
125
  ),
126
+ ...discoverHint(run, q, options.type),
126
127
  );
127
128
  return answered;
128
129
  }
@@ -174,11 +175,34 @@ export function registerSearch(program) {
174
175
  format: {command: formatCliCommand, parent: formatCliCommand},
175
176
  }),
176
177
  ...note,
178
+ ...discoverHint(run, q, options.type),
177
179
  );
178
180
  return answered;
179
181
  },
180
182
  });
181
183
  }
182
184
 
185
+ /**
186
+ * Search reads only what is installed. Point at `discover` for the packages
187
+ * that could add more, except for hooks, which no integration adds.
188
+ * @param {string} run - The caller's CLI invocation prefix.
189
+ * @param {string} query
190
+ * @param {string | undefined} type
191
+ */
192
+ function discoverHint(run, query, type) {
193
+ if (type === 'hook') return [];
194
+ return [
195
+ text(`More in packages you could add: ${run} discover ${shellWord(query)}`),
196
+ ];
197
+ }
198
+
199
+ /**
200
+ * One shell word: the value itself when it is plain, else single-quoted.
201
+ * @param {string} value
202
+ */
203
+ function shellWord(value) {
204
+ return /^[\w@./:-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
205
+ }
206
+
183
207
  // Re-export the API for external consumers.
184
208
  export {search, SEARCH_DOMAINS} from '../../../api/search/search.mjs';
@@ -118,6 +118,15 @@ describe('search() API — filters', () => {
118
118
  }
119
119
  });
120
120
 
121
+ it('--type theme returns only themes, each with the command that adds it', async () => {
122
+ const {data} = await search('warm', {...OPTS, type: 'theme'});
123
+ expect(data.results.map(r => r.name)).toContain('neutral');
124
+ for (const r of data.results) {
125
+ expect(r.domain).toBe('theme');
126
+ expect(r.command).toBe(`astryx theme add --import ${r.name}`);
127
+ }
128
+ });
129
+
121
130
  it('respects --limit', async () => {
122
131
  const {data} = await search('button', {...OPTS, limit: 3});
123
132
  expect(data.results.length).toBeLessThanOrEqual(3);
@@ -198,7 +207,9 @@ describe('search CLI — exit codes + JSON contract', () => {
198
207
  expect(json.status).toBe(0);
199
208
  const env = JSON.parse(json.stdout);
200
209
  expect(env.data.query).toBe('dark mode');
201
- expect(env.data.results[0]).toMatchObject({name: 'theme', section: 'light-dark-mode'});
210
+ // theme topic-level and section tie; either is correct
211
+ const top = env.data.results[0];
212
+ expect(top.name === 'theme' || top.name === 'use-a-theme' || top.section === 'light-dark-mode').toBe(true);
202
213
  const text = await runCli(['search', 'dark', 'mode', '--type', 'doc'], REPO_ROOT);
203
214
  expect(text.stdout).toContain('Results for "dark mode"');
204
215
  }, SCAN_TIMEOUT);
@@ -279,22 +290,31 @@ describe('search CLI — exit codes + JSON contract', () => {
279
290
  });
280
291
 
281
292
  it('prints every result field under its JSON key (score and reason with --verbose)', async () => {
282
- // One query that reaches all four domains, so every per-domain field shows.
283
- const args = ['search', 'theme', '--limit', '60'];
284
- const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
285
- expect(new Set(env.data.results.map(r => r.domain))).toEqual(new Set(SEARCH_DOMAINS));
286
- const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
287
- const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
288
- for (const result of env.data.results) {
289
- for (const [key, value] of Object.entries(result)) {
290
- if (value == null || value === '') continue;
291
- const label = `${result.domain} ${result.name}: ${key}`;
292
- expect(printsField(verbose, key, value), label).toBe(true);
293
- if (key !== 'score' && key !== 'reason') {
294
- expect(printsField(plain, key, value), label).toBe(true);
293
+ // Between them these reach every domain, so every per-domain field shows.
294
+ // A theme matches `theme` only through its description, a prose mention
295
+ // ranked below every name and keyword hit, so the theme domain comes from
296
+ // a theme's own name.
297
+ const domains = new Set();
298
+ for (const args of [
299
+ ['search', 'theme', '--limit', '60'],
300
+ ['search', 'neutral', '--type', 'theme'],
301
+ ]) {
302
+ const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
303
+ const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
304
+ const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
305
+ for (const result of env.data.results) {
306
+ domains.add(result.domain);
307
+ for (const [key, value] of Object.entries(result)) {
308
+ if (value == null || value === '') continue;
309
+ const label = `${result.domain} ${result.name}: ${key}`;
310
+ expect(printsField(verbose, key, value), label).toBe(true);
311
+ if (key !== 'score' && key !== 'reason') {
312
+ expect(printsField(plain, key, value), label).toBe(true);
313
+ }
295
314
  }
296
315
  }
297
316
  }
317
+ expect(domains).toEqual(new Set(SEARCH_DOMAINS));
298
318
  }, 90_000);
299
319
 
300
320
  it('--verbose exits 0 and prints import/match detail', async () => {
@@ -311,16 +331,42 @@ describe('search CLI — exit codes + JSON contract', () => {
311
331
  expect(r.stdout).toContain('reason:');
312
332
  });
313
333
 
314
- it('searches the docs when no @astryxdesign/core is reachable, and exits 1 for --type component', async () => {
334
+ it('points at discover for packages that could add more, except for hooks', async () => {
335
+ const open = await runCli(['search', 'data', 'table'], REPO_ROOT);
336
+ expect(open.status).toBe(0);
337
+ expect(open.stdout).toMatch(/^More in packages you could add: .*discover 'data table'$/m);
338
+ const none = await runCli(['search', 'zzqqxxnomatch'], REPO_ROOT);
339
+ expect(none.stdout).toMatch(/^More in packages you could add: .*discover zzqqxxnomatch$/m);
340
+ const hooks = await runCli(['search', 'click', '--type', 'hook'], REPO_ROOT);
341
+ expect(hooks.status).toBe(0);
342
+ expect(hooks.stdout).not.toContain('More in packages you could add');
343
+ const json = await runCli(['--json', 'search', 'button'], REPO_ROOT);
344
+ expect(json.stdout).not.toContain('More in packages you could add');
345
+ });
346
+
347
+ it('searches the docs and themes when no @astryxdesign/core is reachable, and exits 1 for --type component', async () => {
315
348
  const empty = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-search-cli-no-core-'));
316
349
  try {
317
350
  const open = await runCli(['--json', 'search', 'make', 'an', 'integration'], empty);
318
351
  expect(open.status).toBe(0);
319
352
  expect(JSON.parse(open.stdout).data.results[0]).toMatchObject({domain: 'doc'});
320
- // The text says the search covered the docs alone.
353
+ // Bundled themes need no project, so an open search finds them too.
354
+ const theme = await runCli(['--json', 'search', 'neutral'], empty);
355
+ expect(theme.status).toBe(0);
356
+ expect(JSON.parse(theme.stdout).data.results[0]).toMatchObject({
357
+ domain: 'theme',
358
+ name: 'neutral',
359
+ });
360
+ // The text says the search covered the docs and themes alone.
321
361
  const text = await runCli(['search', 'button'], empty);
322
362
  expect(text.status).toBe(0);
323
- expect(text.stdout).toContain('only the docs were searched');
363
+ expect(text.stdout).toContain('only the docs and themes were searched');
364
+ // A themes-only search needs no core, like a docs-only one.
365
+ const themes = await runCli(['--json', 'search', 'warm', '--type', 'theme'], empty);
366
+ expect(themes.status).toBe(0);
367
+ const found = JSON.parse(themes.stdout).data.results;
368
+ expect(found.map(r => r.name)).toContain('neutral');
369
+ expect(found.every(r => r.domain === 'theme')).toBe(true);
324
370
  const json = await runCli(['--json', 'search', 'button', '--type', 'component'], empty);
325
371
  expect(json.status).toBe(1);
326
372
  expect(JSON.parse(json.stdout)).toMatchObject({code: 'ERR_CORE_NOT_FOUND'});
@@ -17,7 +17,10 @@ export const doc = {
17
17
  description:
18
18
  "Ejects a component's source from the resolved @astryxdesign/core (or its owning " +
19
19
  'integration) into your project for deep customization, rewriting imports that ' +
20
- 'escape the component directory. With no name it lists the swizzlable components.',
20
+ 'escape the component directory. With no name it lists the swizzlable components. ' +
21
+ 'An integration component that replaces a Core component is what that Core name ' +
22
+ 'copies; --package @astryxdesign/core copies the original. --list lists Core ' +
23
+ 'components, including one an integration replaces.',
21
24
  fn: 'swizzle',
22
25
  args: [{name: 'component', param: 'component', required: false}],
23
26
  options: [
@@ -30,12 +33,14 @@ export const doc = {
30
33
  {
31
34
  flag: '--package <pkg>',
32
35
  param: 'options.package',
33
- description: 'Scope to a specific owning package',
36
+ description:
37
+ 'Scope to a specific owning package. Use @astryxdesign/core to copy an original replaced by an integration component',
34
38
  },
35
39
  {
36
40
  flag: '--list',
37
41
  param: 'options.list',
38
- description: 'List available components',
42
+ description:
43
+ 'List the swizzlable Core components, including any that an integration component replaces',
39
44
  },
40
45
  {
41
46
  flag: '-f, --overwrite',
@@ -47,6 +52,10 @@ export const doc = {
47
52
  examples: [
48
53
  {label: 'List swizzlable components', cli: 'astryx swizzle --list'},
49
54
  {label: 'Eject a component', cli: 'astryx swizzle Button'},
55
+ {
56
+ label: 'Copy a replaced Core original',
57
+ cli: 'astryx swizzle SideNav --package @astryxdesign/core',
58
+ },
50
59
  ],
51
60
  exitCodes: [
52
61
  {code: 0, when: 'success'},
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import {jsonOut} from '../../../foundation/response/json.mjs';
14
- import {emit, section, list, text, WARN} from '../formatters/index.mjs';
14
+ import {emit, section, list, text, WARN, record} from '../formatters/index.mjs';
15
15
  import {cliError} from '../lib/cli-error.mjs';
16
16
  import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
17
17
  import {swizzle as swizzleApi} from '../../../api/swizzle/swizzle.mjs';
@@ -60,6 +60,7 @@ export function registerSwizzle(program) {
60
60
  if (result.type === 'swizzle.list') {
61
61
  const components = result.data;
62
62
  emit(
63
+ record({package: result.package}),
63
64
  section('Available components'),
64
65
  list(components),
65
66
  text(`Usage: ${run} swizzle <component>`),
@@ -0,0 +1,60 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx template <name> <path>` tells the caller, in JSON and in text,
5
+ * when demo media in the copied file was replaced with placeholders.
6
+ */
7
+
8
+ import {describe, it, expect, beforeEach, afterEach} from 'vitest';
9
+ import * as fs from 'node:fs';
10
+ import * as os from 'node:os';
11
+ import * as path from 'node:path';
12
+ import {runCli} from '../../../test-utils/run-cli.mjs';
13
+ import {discoverTemplates} from '../../../api/template/template.mjs';
14
+
15
+ const SLOW = 60_000;
16
+
17
+ /** A page template whose source carries demo media, and one that carries none. */
18
+ async function pickPages() {
19
+ const pages = /** @type {Array<{dirName: string, type: string, filePath: string}>} */ (
20
+ await discoverTemplates()
21
+ ).filter(t => t.type === 'page' && fs.existsSync(t.filePath));
22
+ const hasMedia = (/** @type {{filePath: string}} */ t) =>
23
+ /\/template-assets\/[\w.-]+\.\w+/.test(fs.readFileSync(t.filePath, 'utf-8'));
24
+ const withMedia = pages.find(hasMedia);
25
+ const without = pages.find(t => !hasMedia(t));
26
+ if (!withMedia || !without) throw new Error('catalog lacks a page with and without demo media');
27
+ return {withMedia: withMedia.dirName, without: without.dirName};
28
+ }
29
+
30
+ describe('template copy receipt discloses replaced demo media', () => {
31
+ let dir;
32
+ beforeEach(() => {
33
+ dir = fs.mkdtempSync(path.join(os.tmpdir(), 'tmpl-receipt-cli-'));
34
+ });
35
+ afterEach(() => fs.rmSync(dir, {recursive: true, force: true}));
36
+
37
+ it('--json carries demoMediaReplaced and the text states the same count', async () => {
38
+ const {withMedia} = await pickPages();
39
+ const json = await runCli(['template', withMedia, './a', '--json'], dir);
40
+ expect(json.status).toBe(0);
41
+ const {data} = JSON.parse(json.stdout);
42
+ expect(data.demoMediaReplaced).toBeGreaterThan(0);
43
+
44
+ const human = await runCli(['template', withMedia, './b'], dir);
45
+ expect(human.status).toBe(0);
46
+ expect(human.stdout).toContain(
47
+ `Replaced ${data.demoMediaReplaced} Astryx demo media reference`,
48
+ );
49
+ expect(human.stdout).toContain('b/page.tsx');
50
+ }, SLOW);
51
+
52
+ it('says nothing about media when none was replaced', async () => {
53
+ const {without} = await pickPages();
54
+ const json = await runCli(['template', without, './a', '--json'], dir);
55
+ expect(JSON.parse(json.stdout).data.demoMediaReplaced).toBe(0);
56
+ const human = await runCli(['template', without, './b'], dir);
57
+ expect(human.status).toBe(0);
58
+ expect(human.stdout).not.toMatch(/demo media/i);
59
+ }, SLOW);
60
+ });