@astryxdesign/cli 0.1.8-canary.0c4d8d7 → 0.1.8-canary.0db5dfd

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 (303) hide show
  1. package/{src/api → api/blog}/blog.mjs +42 -6
  2. package/{src/api → api/blog}/blog.test.mjs +2 -2
  3. package/api/build/build.mjs +92 -0
  4. package/api/build/build.test.mjs +92 -0
  5. package/{src/api → api/component}/component.mjs +49 -26
  6. package/{src/api → api/discover}/discover.mjs +55 -18
  7. package/{src/api → api/docs}/docs.mjs +47 -21
  8. package/{src/api → api/doctor}/doctor.mjs +11 -8
  9. package/{src/api → api/hook}/hook.mjs +11 -11
  10. package/{src/api → api}/index.mjs +16 -9
  11. package/{src/api → api/integration}/validate-integration.mjs +48 -15
  12. package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
  13. package/{src/api → api/layout}/layout.mjs +66 -17
  14. package/{src/api → api/layout}/layout.test.mjs +1 -1
  15. package/{src/api → api/search}/search.mjs +71 -12
  16. package/api/swizzle/swizzle.mjs +283 -0
  17. package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
  18. package/{src/api → api/template}/template-integration.test.mjs +2 -2
  19. package/{src/api → api/template}/template-suffix.test.mjs +3 -3
  20. package/{src/api → api/template}/template.mjs +96 -19
  21. package/{src/api → api/theme}/theme-add.mjs +35 -7
  22. package/{src → authoring}/codemod.mjs +6 -6
  23. package/{src → authoring}/config.test.mjs +1 -1
  24. package/{src → authoring}/doc.mjs +1 -1
  25. package/{src → authoring}/doc.test.mjs +1 -1
  26. package/{src → authoring}/template.mjs +1 -1
  27. package/bin/astryx.mjs +12 -10
  28. package/{src → cli}/commands/blog.mjs +48 -7
  29. package/{src → cli}/commands/build-theme.mjs +125 -46
  30. package/{src → cli}/commands/build.mjs +33 -57
  31. package/{src → cli}/commands/component/index.mjs +49 -22
  32. package/{src → cli}/commands/component-ownership.test.mjs +3 -3
  33. package/{src → cli}/commands/component-package.test.mjs +1 -1
  34. package/{src → cli}/commands/component-resolution.test.mjs +2 -2
  35. package/{src → cli}/commands/discover.mjs +17 -8
  36. package/{src → cli}/commands/docs.mjs +39 -7
  37. package/{src → cli}/commands/docs.test.mjs +1 -1
  38. package/{src → cli}/commands/doctor.mjs +3 -3
  39. package/{src → cli}/commands/doctor.test.mjs +2 -2
  40. package/{src → cli}/commands/ensure-core-built.mjs +3 -2
  41. package/{src → cli}/commands/external-showcase.test.mjs +1 -1
  42. package/{src → cli}/commands/hook/index.mjs +37 -14
  43. package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
  44. package/{src → cli}/commands/init.mjs +20 -9
  45. package/{src → cli}/commands/layout.mjs +58 -18
  46. package/{src → cli}/commands/search.mjs +19 -12
  47. package/{src → cli}/commands/search.test.mjs +1 -1
  48. package/{src → cli}/commands/setup-nudge.test.mjs +1 -1
  49. package/cli/commands/swizzle.mjs +103 -0
  50. package/{src → cli}/commands/template.mjs +73 -22
  51. package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
  52. package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
  53. package/{src → cli}/commands/upgrade.mjs +160 -52
  54. package/{src → cli}/commands/upgrade.test.mjs +1 -1
  55. package/{src → cli}/commands/validate-integration.mjs +17 -37
  56. package/{src → cli}/index.mjs +17 -15
  57. package/{src/codemods → codemods}/ensure-jscodeshift.mjs +1 -1
  58. package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
  59. package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
  60. package/{src/codemods → codemods}/integration-runner.mjs +8 -3
  61. package/{src/codemods → codemods}/registry.mjs +3 -1
  62. package/{src/codemods → codemods}/run-codemod.mjs +17 -10
  63. package/{src/codemods → codemods}/runner.mjs +22 -12
  64. package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
  65. package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
  66. package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
  67. package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
  68. package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
  69. package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
  70. package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
  71. package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
  72. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
  73. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
  74. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
  75. package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
  76. package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
  77. package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
  78. package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
  79. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
  80. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
  81. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
  82. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
  83. package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
  84. package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
  85. package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
  86. package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
  87. package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
  88. package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
  89. package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
  90. package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
  91. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
  92. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
  93. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
  94. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
  95. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
  96. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
  97. package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
  98. package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
  99. package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
  100. package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +19 -14
  101. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
  102. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
  103. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +16 -11
  104. package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
  105. package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
  106. package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
  107. package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
  108. package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
  109. package/{src/codemods → codemods}/transforms/v0.1.8/rename-avatar-size-scale.mjs +15 -10
  110. package/docs/internationalization.doc.mjs +92 -46
  111. package/{src/commands → lib/agent-docs}/agent-docs.mjs +30 -11
  112. package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
  113. package/{src/lib → lib}/component-discovery.mjs +44 -2
  114. package/{src/lib → lib}/component-format.mjs +65 -24
  115. package/{src/lib → lib}/component-loader.mjs +27 -13
  116. package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
  117. package/{src/lib → lib}/error-codes.test.mjs +1 -1
  118. package/{src/lib → lib}/hook-discovery.mjs +14 -1
  119. package/{src/lib → lib}/hook-format.mjs +29 -5
  120. package/{src/lib → lib}/integration-warnings.mjs +2 -2
  121. package/{src/lib → lib}/integrations.mjs +20 -0
  122. package/{src/lib → lib}/integrations.test.mjs +1 -1
  123. package/{src/lib → lib}/json-contract.test.mjs +1 -1
  124. package/{src/lib → lib}/json-shim.mjs +10 -5
  125. package/{src/lib → lib}/json-shim.test.mjs +1 -1
  126. package/{src/lib → lib}/levenshtein.mjs +6 -0
  127. package/{src/lib → lib}/manifest.mjs +7 -5
  128. package/{src/lib → lib}/manifest.test.mjs +2 -2
  129. package/{src/lib → lib}/module-loader.mjs +1 -0
  130. package/{src/lib → lib}/package-scanner.mjs +47 -0
  131. package/{src/lib → lib}/project.mjs +48 -18
  132. package/{src/lib → lib}/project.test.mjs +1 -1
  133. package/{src/lib → lib}/resolve-theme.mjs +5 -0
  134. package/{src/lib → lib}/string-utils.mjs +15 -0
  135. package/{src/lib → lib}/term-log.mjs +12 -3
  136. package/{src/lib → lib}/xle/browser.mjs +18 -8
  137. package/{src/lib → lib}/xle/expand.mjs +155 -22
  138. package/{src/lib → lib}/xle/parse.mjs +119 -13
  139. package/{src/lib → lib}/xle/print.mjs +54 -14
  140. package/{src/lib → lib}/xle/registry-core.mjs +28 -3
  141. package/{src/lib → lib}/xle/registry.mjs +9 -4
  142. package/{src/lib → lib}/xle/splice.mjs +13 -2
  143. package/{src/lib → lib}/xle/validate.mjs +95 -14
  144. package/lib/xle/xle-ast.d.ts +214 -0
  145. package/package.json +33 -26
  146. package/scripts/postinstall.mjs +4 -4
  147. package/templates/blocks/components/Avatar/AvatarShowcase.tsx +1 -1
  148. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
  149. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
  150. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
  151. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
  152. package/{src/types → types}/api.contract.assert.ts +17 -8
  153. package/{src/types → types}/api.d.ts +106 -0
  154. package/{src/types → types}/base.d.ts +17 -2
  155. package/types/build.d.ts +53 -0
  156. package/types/codemod.d.ts +166 -0
  157. package/{src/types → types}/component.d.ts +1 -1
  158. package/{src/types → types}/discover.d.ts +1 -1
  159. package/{src/types → types}/docs.d.ts +1 -4
  160. package/{src/types → types}/hook.d.ts +1 -1
  161. package/types/jscodeshift.d.ts +19 -0
  162. package/types/layout.d.ts +74 -0
  163. package/types/theme.d.ts +53 -0
  164. package/{src/types → types}/upgrade.d.ts +8 -1
  165. package/{src/utils → utils}/paths.mjs +4 -1
  166. package/src/commands/swizzle.mjs +0 -417
  167. package/src/types/build.d.ts +0 -23
  168. package/src/types/codemod.d.ts +0 -81
  169. package/src/types/theme.d.ts +0 -23
  170. /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
  171. /package/{src/api → api}/error.mjs +0 -0
  172. /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
  173. /package/{src/api → api/template}/template.test.mjs +0 -0
  174. /package/{src → authoring}/codemod.test.mjs +0 -0
  175. /package/{src → authoring}/config.mjs +0 -0
  176. /package/{src → authoring}/integration.mjs +0 -0
  177. /package/{src → authoring}/template.test.mjs +0 -0
  178. /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
  179. /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
  180. /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
  181. /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
  182. /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
  183. /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
  184. /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
  185. /package/{src → cli}/commands/cli-postinstall.test.mjs +0 -0
  186. /package/{src → cli}/commands/component.test.mjs +0 -0
  187. /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
  188. /package/{src → cli}/commands/init.next-steps.test.mjs +0 -0
  189. /package/{src → cli}/commands/interactive-guard.test.mjs +0 -0
  190. /package/{src → cli}/commands/json-contract.test.mjs +0 -0
  191. /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
  192. /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
  193. /package/{src → cli}/commands/template.test.mjs +0 -0
  194. /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
  195. /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
  196. /package/{src → cli}/update-hint-commands.test.mjs +0 -0
  197. /package/{src/codemods → codemods}/__tests__/registry.test.mjs +0 -0
  198. /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
  199. /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
  200. /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
  201. /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
  202. /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
  203. /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
  204. /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
  205. /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
  206. /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
  207. /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
  208. /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
  209. /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
  210. /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
  211. /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
  212. /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
  213. /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
  214. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
  215. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
  216. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
  217. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
  218. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
  219. /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
  220. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
  221. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
  222. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
  223. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
  224. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
  225. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
  226. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
  227. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
  228. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
  229. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
  230. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
  231. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
  232. /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
  233. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
  234. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
  235. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
  236. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
  237. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
  238. /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
  239. /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
  240. /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
  241. /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
  242. /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
  243. /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
  244. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +0 -0
  245. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
  246. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
  247. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +0 -0
  248. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
  249. /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
  250. /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
  251. /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
  252. /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
  253. /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
  254. /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
  255. /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
  256. /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
  257. /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
  258. /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
  259. /package/{src/codemods → codemods}/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +0 -0
  260. /package/{src/codemods → codemods}/transforms/v0.1.8/index.mjs +0 -0
  261. /package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +0 -0
  262. /package/{src/lib → lib}/cli-error.mjs +0 -0
  263. /package/{src/lib → lib}/cli-error.test.mjs +0 -0
  264. /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
  265. /package/{src/lib → lib}/component-format.test.mjs +0 -0
  266. /package/{src/lib → lib}/component-loader.test.mjs +0 -0
  267. /package/{src/lib → lib}/config-cache.mjs +0 -0
  268. /package/{src/lib → lib}/config-cache.test.mjs +0 -0
  269. /package/{src/lib → lib}/config-schema.mjs +0 -0
  270. /package/{src/lib → lib}/error-codes.mjs +0 -0
  271. /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
  272. /package/{src/lib → lib}/json.mjs +0 -0
  273. /package/{src/lib → lib}/module-loader.test.mjs +0 -0
  274. /package/{src/lib → lib}/node-version.mjs +0 -0
  275. /package/{src/lib → lib}/node-version.test.mjs +0 -0
  276. /package/{src/lib → lib}/parse.mjs +0 -0
  277. /package/{src/lib → lib}/site.mjs +0 -0
  278. /package/{src/lib → lib}/xle/browser.d.ts +0 -0
  279. /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
  280. /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
  281. /package/{src/schemas → schemas}/template-schema.mjs +0 -0
  282. /package/{src/types → types}/config.d.ts +0 -0
  283. /package/{src/types → types}/doc.d.ts +0 -0
  284. /package/{src/types → types}/doctor.d.ts +0 -0
  285. /package/{src/types → types}/error-codes.d.ts +0 -0
  286. /package/{src/types → types}/index.d.ts +0 -0
  287. /package/{src/types → types}/integration.d.ts +0 -0
  288. /package/{src/types → types}/manifest.d.ts +0 -0
  289. /package/{src/types → types}/search.d.ts +0 -0
  290. /package/{src/types → types}/swizzle.d.ts +0 -0
  291. /package/{src/types → types}/template-api.d.ts +0 -0
  292. /package/{src/types → types}/template.d.ts +0 -0
  293. /package/{src/types → types}/validate-integration.d.ts +0 -0
  294. /package/{src/utils → utils}/github.mjs +0 -0
  295. /package/{src/utils → utils}/package-manager.mjs +0 -0
  296. /package/{src/utils → utils}/package-manager.test.mjs +0 -0
  297. /package/{src/utils → utils}/path-safety.mjs +0 -0
  298. /package/{src/utils → utils}/path-safety.test.mjs +0 -0
  299. /package/{src/utils → utils}/paths.test.mjs +0 -0
  300. /package/{src/utils → utils}/semver.mjs +0 -0
  301. /package/{src/utils → utils}/semver.test.mjs +0 -0
  302. /package/{src/utils → utils}/update-check.mjs +0 -0
  303. /package/{src/utils → utils}/update-check.test.mjs +0 -0
@@ -11,14 +11,29 @@ import {
11
11
  formatHookCompact,
12
12
  formatHookBrief,
13
13
  formatHookParams,
14
- } from '../../lib/hook-format.mjs';
15
- import {getCliInvocation} from '../../utils/package-manager.mjs';
16
- import {jsonOut, humanLog} from '../../lib/json.mjs';
17
- import {cliError} from '../../lib/cli-error.mjs';
18
- import {ERROR_CODES} from '../../lib/error-codes.mjs';
19
- import {hook as hookApi} from '../../api/hook.mjs';
20
- import {findRelatedBlocks} from '../../api/template.mjs';
14
+ } from '../../../lib/hook-format.mjs';
15
+ import {getCliInvocation} from '../../../utils/package-manager.mjs';
16
+ import {jsonOut, humanLog} from '../../../lib/json.mjs';
17
+ import {cliError} from '../../../lib/cli-error.mjs';
18
+ import {ERROR_CODES} from '../../../lib/error-codes.mjs';
19
+ import {hook as hookApi} from '../../../api/hook/hook.mjs';
20
+ import {findRelatedBlocks} from '../../../api/template/template.mjs';
21
21
 
22
+ /**
23
+ * The api layer's hook() widens its return to `{type: string, data: unknown}`,
24
+ * so annotate the command-local result with the precise discriminated union from
25
+ * src/types/hook to get narrowing + typed data.
26
+ *
27
+ * @typedef {(
28
+ * | import('../../../types/hook').HookListResponse
29
+ * | import('../../../types/hook').HookBriefResponse
30
+ * | import('../../../types/hook').HookFullResponse
31
+ * | import('../../../types/hook').HookDetailResponse
32
+ * | import('../../../types/hook').HookDetailParamsResponse
33
+ * )} HookResult
34
+ */
35
+
36
+ /** @param {import('commander').Command} program */
22
37
  export function registerHook(program) {
23
38
  program
24
39
  .command('hook [name]')
@@ -26,7 +41,12 @@ export function registerHook(program) {
26
41
  .option('--list', 'List all hooks grouped by category')
27
42
  .option('--category <category>', 'List hooks in a specific category')
28
43
  .option('--params', 'Print only the parameters table')
29
- .action(async (name, options) => {
44
+ .action(
45
+ /**
46
+ * @param {string|undefined} name
47
+ * @param {{list?: boolean, category?: string, params?: boolean}} options
48
+ */
49
+ async (name, options) => {
30
50
  const run = getCliInvocation();
31
51
  const zh = program.opts().zh || false;
32
52
  const lang = program.opts().lang || null;
@@ -43,18 +63,20 @@ export function registerHook(program) {
43
63
  return;
44
64
  }
45
65
 
66
+ /** @type {HookResult} */
46
67
  let result;
47
68
  try {
48
- result = await hookApi(name, {
69
+ result = /** @type {HookResult} */ (await hookApi(name, {
49
70
  cwd: process.cwd(),
50
71
  list: options.list,
51
72
  category: options.category,
52
73
  params: options.params,
53
74
  detail,
54
75
  lang, zh,
55
- });
76
+ }));
56
77
  } catch (e) {
57
- cliError(e.message, {suggestions: e.suggestions, code: e.code});
78
+ const err = /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
79
+ cliError(err.message, {suggestions: err.suggestions, code: err.code});
58
80
  return;
59
81
  }
60
82
 
@@ -123,6 +145,7 @@ export function registerHook(program) {
123
145
  }
124
146
  // Show related block templates from relatedComponents
125
147
  const relatedComps = result.data.relatedComponents || [];
148
+ /** @type {import('../../../api/template/template.mjs').DiscoveredTemplate[]} */
126
149
  const allBlocks = [];
127
150
  for (const comp of relatedComps) {
128
151
  const blocks = await findRelatedBlocks(comp);
@@ -152,12 +175,12 @@ export function registerHook(program) {
152
175
  }
153
176
 
154
177
  // Re-export lib functions for external consumers
155
- export {discoverHooks, findHookDoc, getAllHookNames} from '../../lib/hook-discovery.mjs';
156
- export {loadDocs} from '../../lib/component-loader.mjs';
178
+ export {discoverHooks, findHookDoc, getAllHookNames} from '../../../lib/hook-discovery.mjs';
179
+ export {loadDocs} from '../../../lib/component-loader.mjs';
157
180
  export {
158
181
  formatHookFull,
159
182
  formatHookCompact,
160
183
  formatHookBrief,
161
184
  formatHookBriefAll,
162
185
  formatHookParams,
163
- } from '../../lib/hook-format.mjs';
186
+ } from '../../../lib/hook-format.mjs';
@@ -23,7 +23,7 @@ import {
23
23
  discoverComponents,
24
24
  findComponentSource,
25
25
  } from './component/index.mjs';
26
- import {findCoreDir} from '../utils/paths.mjs';
26
+ import {findCoreDir} from '../../utils/paths.mjs';
27
27
 
28
28
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
29
29
  const CLI_BIN = path.resolve(__dirname, '../../bin/astryx.mjs');
@@ -17,14 +17,14 @@
17
17
 
18
18
  import * as path from 'node:path';
19
19
  import * as fs from 'node:fs';
20
- import {CLI_ROOT} from '../utils/paths.mjs';
21
- import {PathSafetyError} from '../utils/path-safety.mjs';
22
- import {getCliInvocation} from '../utils/package-manager.mjs';
23
- import {installAgentDocs, removeAgentDocs} from './agent-docs.mjs';
20
+ import {CLI_ROOT} from '../../utils/paths.mjs';
21
+ import {PathSafetyError} from '../../utils/path-safety.mjs';
22
+ import {getCliInvocation} from '../../utils/package-manager.mjs';
23
+ import {installAgentDocs, removeAgentDocs} from '../../lib/agent-docs/agent-docs.mjs';
24
24
  import {listTemplates} from './template.mjs';
25
- import {humanLog} from '../lib/json.mjs';
26
- import {cliError} from '../lib/cli-error.mjs';
27
- import {ERROR_CODES} from '../lib/error-codes.mjs';
25
+ import {humanLog} from '../../lib/json.mjs';
26
+ import {cliError} from '../../lib/cli-error.mjs';
27
+ import {ERROR_CODES} from '../../lib/error-codes.mjs';
28
28
 
29
29
  const VALID_FEATURES = ['agents', 'theme', 'template'];
30
30
  const run = getCliInvocation();
@@ -62,6 +62,10 @@ export function getNextSteps(invocation) {
62
62
 
63
63
  // ─── Feature: agents ─────────────────────────────────────────────────────────
64
64
 
65
+ /**
66
+ * @param {string} targetDir
67
+ * @param {{agent?: string, agentDocsPath?: string | string[]}} [opts]
68
+ */
65
69
  function runAgents(targetDir, {agent, agentDocsPath} = {}) {
66
70
  try {
67
71
  const paths = agentDocsPath
@@ -93,6 +97,10 @@ function runTheme() {
93
97
 
94
98
  // ─── Feature: template ───────────────────────────────────────────────────────
95
99
 
100
+ /**
101
+ * @param {string} targetDir
102
+ * @param {{templateName?: string}} [opts]
103
+ */
96
104
  function runTemplate(targetDir, {templateName} = {}) {
97
105
  const templates = listTemplates();
98
106
  if (templates.length === 0) return;
@@ -124,6 +132,9 @@ function runTemplate(targetDir, {templateName} = {}) {
124
132
 
125
133
  // ─── Command ─────────────────────────────────────────────────────────────────
126
134
 
135
+ /**
136
+ * @param {import('commander').Command} program
137
+ */
127
138
  export function registerInit(program) {
128
139
  program
129
140
  .command('init')
@@ -133,7 +144,7 @@ export function registerInit(program) {
133
144
  .option('--remove-agents', 'Remove AI agent docs from all agent doc files')
134
145
  .option('--agent <tool>', 'Target AI tool for agent docs: claude, cursor, codex, hermes, all')
135
146
  .option('--agent-docs-path <path...>', 'Explicit file path(s) for agent docs')
136
- .action((options) => {
147
+ .action((/** @type {{features?: string, all?: boolean, removeAgents?: boolean, agent?: string, agentDocsPath?: string | string[]}} */ options) => {
137
148
  const targetDir = process.cwd();
138
149
 
139
150
  // Remove mode
@@ -147,7 +158,7 @@ export function registerInit(program) {
147
158
  if (options.features || options.all) {
148
159
  const features = options.all
149
160
  ? VALID_FEATURES
150
- : options.features.split(',').map(f => f.trim().toLowerCase());
161
+ : /** @type {string} */ (options.features).split(',').map(f => f.trim().toLowerCase());
151
162
 
152
163
  const invalid = features.filter(f => !VALID_FEATURES.includes(f));
153
164
  if (invalid.length > 0) {
@@ -13,21 +13,55 @@
13
13
  */
14
14
 
15
15
  import * as fs from 'node:fs';
16
- import {jsonOut, humanLog} from '../lib/json.mjs';
17
- import {cliError} from '../lib/cli-error.mjs';
18
- import {layoutExpand, layoutCheck, layoutGrammar} from '../api/layout.mjs';
16
+ import {jsonOut, humanLog} from '../../lib/json.mjs';
17
+ import {cliError} from '../../lib/cli-error.mjs';
18
+ import {layoutExpand, layoutCheck, layoutGrammar} from '../../api/layout/layout.mjs';
19
19
 
20
- /** Resolve the expression from arg, --file, or stdin ('-'). */
21
- async function readExpression(expr, options) {
20
+ /**
21
+ * The api layer's @returns for these functions widen the `type` discriminator
22
+ * to `string`, so annotate the command-local result with the precise response
23
+ * shapes from src/types/layout so narrowing + jsonOut typecheck.
24
+ *
25
+ * @typedef {import('../../types/layout').LayoutExpandResponse} LayoutExpandResponse
26
+ * @typedef {import('../../types/layout').LayoutCheckResponse} LayoutCheckResponse
27
+ * @typedef {import('../../types/layout').LayoutGrammarResponse} LayoutGrammarResponse
28
+ */
29
+
30
+ /**
31
+ * @typedef {object} LayoutExpandOptions
32
+ * @property {string} [file]
33
+ * @property {'compact'|'outline'|'auto'} [form]
34
+ * @property {string} [name]
35
+ * @property {boolean} [loose]
36
+ */
37
+
38
+ /**
39
+ * @typedef {object} LayoutCheckOptions
40
+ * @property {string} [file]
41
+ * @property {'compact'|'outline'|'auto'} [form]
42
+ * @property {boolean} [loose]
43
+ */
44
+
45
+ /**
46
+ * Resolve the expression from arg, --file, or stdin ('-').
47
+ * @param {string} [expr]
48
+ * @param {{file?: string}} [options]
49
+ * @returns {Promise<string>}
50
+ */
51
+ async function readExpression(expr, options = {}) {
22
52
  if (options.file) return fs.readFileSync(options.file, 'utf-8');
23
53
  if (expr === '-') {
54
+ /** @type {Buffer[]} */
24
55
  const chunks = [];
25
- for await (const chunk of process.stdin) chunks.push(chunk);
56
+ for await (const chunk of process.stdin) chunks.push(/** @type {Buffer} */ (chunk));
26
57
  return Buffer.concat(chunks).toString('utf-8');
27
58
  }
28
- return expr;
59
+ return expr ?? '';
29
60
  }
30
61
 
62
+ /**
63
+ * @param {import('commander').Command} program
64
+ */
31
65
  export function registerLayout(program) {
32
66
  const layoutCmd = program
33
67
  .command('layout')
@@ -40,24 +74,26 @@ export function registerLayout(program) {
40
74
  .option('--form <form>', 'Input surface: compact, outline, or auto', 'auto')
41
75
  .option('--name <name>', 'Generated component name (PascalCase)', 'GeneratedLayout')
42
76
  .option('--loose', 'Downgrade unknown {block} hints to TODO placeholders')
43
- .action(async (expression, targetPath, options) => {
77
+ .action(async (/** @type {string} */ expression, /** @type {string} */ targetPath, /** @type {LayoutExpandOptions} */ options) => {
44
78
  const json = program.opts().json || false;
45
79
  const source = await readExpression(expression, options);
46
80
  if (!source || source.trim() === '') {
47
81
  cliError('No layout expression given — pass it as an argument, via --file, or on stdin');
48
82
  return;
49
83
  }
84
+ /** @type {LayoutExpandResponse} */
50
85
  let result;
51
86
  try {
52
- result = await layoutExpand(source, {
87
+ result = /** @type {LayoutExpandResponse} */ (await layoutExpand(source, {
53
88
  targetPath,
54
89
  form: options.form,
55
90
  loose: options.loose || false,
56
91
  name: options.name,
57
92
  cwd: process.cwd(),
58
- });
93
+ }));
59
94
  } catch (e) {
60
- cliError(e.message, {suggestions: e.suggestions || [], code: e.code});
95
+ const err = /** @type {import('../../api/error.mjs').AstryxError} */ (e);
96
+ cliError(err.message, {suggestions: err.suggestions || [], code: err.code});
61
97
  return;
62
98
  }
63
99
  if (json) return jsonOut(result.type, result.data);
@@ -81,22 +117,24 @@ export function registerLayout(program) {
81
117
  .option('--file <file>', 'Read the expression from a file')
82
118
  .option('--form <form>', 'Input surface: compact, outline, or auto', 'auto')
83
119
  .option('--loose', 'Downgrade unknown {block} hints to TODO placeholders')
84
- .action(async (expression, options) => {
120
+ .action(async (/** @type {string} */ expression, /** @type {LayoutCheckOptions} */ options) => {
85
121
  const json = program.opts().json || false;
86
122
  const source = await readExpression(expression, options);
87
123
  if (!source || source.trim() === '') {
88
124
  cliError('No layout expression given — pass it as an argument, via --file, or on stdin');
89
125
  return;
90
126
  }
127
+ /** @type {LayoutCheckResponse} */
91
128
  let result;
92
129
  try {
93
- result = await layoutCheck(source, {
130
+ result = /** @type {LayoutCheckResponse} */ (await layoutCheck(source, {
94
131
  form: options.form,
95
132
  loose: options.loose || false,
96
133
  cwd: process.cwd(),
97
- });
134
+ }));
98
135
  } catch (e) {
99
- cliError(e.message, {suggestions: e.suggestions || [], code: e.code});
136
+ const err = /** @type {import('../../api/error.mjs').AstryxError} */ (e);
137
+ cliError(err.message, {suggestions: err.suggestions || [], code: err.code});
100
138
  return;
101
139
  }
102
140
  if (json) return jsonOut(result.type, result.data);
@@ -106,7 +144,7 @@ export function registerLayout(program) {
106
144
  humanLog(`\n✗ Invalid (${errors.length} error${errors.length === 1 ? '' : 's'}):`);
107
145
  for (const e of errors) {
108
146
  humanLog(` - ${e.formatted}`);
109
- if (e.suggestions?.length > 0) humanLog(` did you mean: ${e.suggestions.join(', ')}?`);
147
+ if (e.suggestions && e.suggestions.length > 0) humanLog(` did you mean: ${e.suggestions.join(', ')}?`);
110
148
  }
111
149
  humanLog('');
112
150
  process.exitCode = 1;
@@ -126,11 +164,13 @@ export function registerLayout(program) {
126
164
  .description('Print the XLE/XLO cheatsheet (alias table generated from this branch)')
127
165
  .action(async () => {
128
166
  const json = program.opts().json || false;
167
+ /** @type {LayoutGrammarResponse} */
129
168
  let result;
130
169
  try {
131
- result = await layoutGrammar({cwd: process.cwd()});
170
+ result = /** @type {LayoutGrammarResponse} */ (await layoutGrammar({cwd: process.cwd()}));
132
171
  } catch (e) {
133
- cliError(e.message, {suggestions: e.suggestions || [], code: e.code});
172
+ const err = /** @type {import('../../api/error.mjs').AstryxError} */ (e);
173
+ cliError(err.message, {suggestions: err.suggestions || [], code: err.code});
134
174
  return;
135
175
  }
136
176
  if (json) return jsonOut(result.type, result.data);
@@ -16,10 +16,10 @@
16
16
  * astryx search button --json Typed JSON envelope
17
17
  */
18
18
 
19
- import {getCliInvocation, formatCliCommand} from '../utils/package-manager.mjs';
20
- import {jsonOut, humanLog} from '../lib/json.mjs';
21
- import {cliError} from '../lib/cli-error.mjs';
22
- import {search as searchApi, SEARCH_DOMAINS} from '../api/search.mjs';
19
+ import {getCliInvocation, formatCliCommand} from '../../utils/package-manager.mjs';
20
+ import {jsonOut, humanLog} from '../../lib/json.mjs';
21
+ import {cliError} from '../../lib/cli-error.mjs';
22
+ import {search as searchApi, SEARCH_DOMAINS} from '../../api/search/search.mjs';
23
23
 
24
24
  const DOMAIN_LABEL = {
25
25
  component: 'component',
@@ -28,6 +28,9 @@ const DOMAIN_LABEL = {
28
28
  template: 'template',
29
29
  };
30
30
 
31
+ /**
32
+ * @param {import('commander').Command} program
33
+ */
31
34
  export function registerSearch(program) {
32
35
  program
33
36
  .command('search <query>')
@@ -35,7 +38,7 @@ export function registerSearch(program) {
35
38
  .option('--type <domain>', `Filter to one domain (${SEARCH_DOMAINS.join('|')})`)
36
39
  .option('--limit <n>', 'Max number of results (default 20)')
37
40
  .option('--detail', 'Verbose output (include import paths and match reason)')
38
- .action(async (query, options) => {
41
+ .action(async (/** @type {string} */ query, /** @type {{type?: import('../../types/search').SearchDomain, limit?: string, detail?: boolean}} */ options) => {
39
42
  const json = program.opts().json || false;
40
43
 
41
44
  let limit = 20;
@@ -48,15 +51,19 @@ export function registerSearch(program) {
48
51
  limit = parsed;
49
52
  }
50
53
 
54
+ /** @type {import('../../types/search').SearchResponse} */
51
55
  let result;
52
56
  try {
53
- result = await searchApi(query, {
54
- cwd: process.cwd(),
55
- type: options.type,
56
- limit,
57
- });
57
+ result = /** @type {import('../../types/search').SearchResponse} */ (
58
+ await searchApi(query, {
59
+ cwd: process.cwd(),
60
+ type: options.type,
61
+ limit,
62
+ })
63
+ );
58
64
  } catch (e) {
59
- cliError(e.message, {suggestions: e.suggestions});
65
+ const err = /** @type {import('../../api/error.mjs').AstryxError} */ (e);
66
+ cliError(err.message, {suggestions: err.suggestions});
60
67
  return;
61
68
  }
62
69
 
@@ -97,4 +104,4 @@ export function registerSearch(program) {
97
104
  }
98
105
 
99
106
  // Re-export the API for external consumers.
100
- export {search, SEARCH_DOMAINS} from '../api/search.mjs';
107
+ export {search, SEARCH_DOMAINS} from '../../api/search/search.mjs';
@@ -14,7 +14,7 @@ import {describe, it, expect} from 'vitest';
14
14
  import {spawnSync} from 'node:child_process';
15
15
  import * as path from 'node:path';
16
16
  import {fileURLToPath} from 'node:url';
17
- import {search, scoreCandidate, SEARCH_DOMAINS} from '../api/search.mjs';
17
+ import {search, scoreCandidate, SEARCH_DOMAINS} from '../../api/search/search.mjs';
18
18
 
19
19
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
20
20
  const CLI_BIN = path.resolve(__dirname, '../../bin/astryx.mjs');
@@ -18,7 +18,7 @@ import * as fs from 'node:fs';
18
18
  import * as path from 'node:path';
19
19
  import * as os from 'node:os';
20
20
  import {fileURLToPath} from 'node:url';
21
- import {isAstryxInitialized} from './agent-docs.mjs';
21
+ import {isAstryxInitialized} from '../../lib/agent-docs/agent-docs.mjs';
22
22
 
23
23
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
24
  const CLI = path.resolve(__dirname, '..', '..', 'bin', 'astryx.mjs');
@@ -0,0 +1,103 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file swizzle command — thin wrapper around api/swizzle.
5
+ *
6
+ * Copies a component's source into the consumer project for customization
7
+ * (imports rewritten to the owner package's subpaths). All logic — owner
8
+ * resolution, copy, import rewriting, StyleX detection, maintainer feedback —
9
+ * lives in api/swizzle; this file only parses flags, prints, and prefixes
10
+ * commands for the caller's package manager.
11
+ */
12
+
13
+ import {jsonOut, humanLog} from '../../lib/json.mjs';
14
+ import {cliError} from '../../lib/cli-error.mjs';
15
+ import {getCliInvocation} from '../../utils/package-manager.mjs';
16
+ import {swizzle as swizzleApi} from '../../api/swizzle/swizzle.mjs';
17
+
18
+ /**
19
+ * @param {import('commander').Command} program
20
+ */
21
+ export function registerSwizzle(program) {
22
+ program
23
+ .command('swizzle [component]')
24
+ .description('Copy component source for customization')
25
+ .option('--output <dir>', 'Output directory', './components/astryx')
26
+ .option('--package <pkg>', 'Scope to a specific owning package')
27
+ .option('--list', 'List available components')
28
+ .option('-f, --overwrite', 'Overwrite existing files without prompting')
29
+ .action(async (/** @type {string | undefined} */ component, /** @type {{output: string, package?: string, list?: boolean, overwrite?: boolean}} */ options) => {
30
+ const json = program.opts().json || false;
31
+ const run = getCliInvocation();
32
+
33
+ /** @type {import('../../types/swizzle').SwizzleListResponse | import('../../types/swizzle').SwizzleCopyResponse} */
34
+ let result;
35
+ try {
36
+ result = await swizzleApi(component, {
37
+ cwd: process.cwd(),
38
+ output: options.output,
39
+ package: options.package,
40
+ list: options.list,
41
+ overwrite: options.overwrite,
42
+ });
43
+ } catch (e) {
44
+ const err = /** @type {import('../../api/error.mjs').AstryxError} */ (e);
45
+ cliError(err.message, {suggestions: err.suggestions, code: err.code});
46
+ return;
47
+ }
48
+
49
+ if (json) return jsonOut(result.type, result.data);
50
+
51
+ if (result.type === 'swizzle.list') {
52
+ const components = result.data;
53
+ humanLog('\nAvailable components:\n');
54
+ for (const name of components) {
55
+ humanLog(` ${name}`);
56
+ }
57
+ humanLog(`\nUsage: ${run} swizzle <component>\n`);
58
+ humanLog(`Example: ${run} swizzle Button`);
59
+ humanLog(` ${run} swizzle XDSButton (XDS prefix also works)\n`);
60
+ return;
61
+ }
62
+
63
+ const {package: ownerPackage, outputDir, filesCopied, usesStyleX, feedback} =
64
+ result.data;
65
+
66
+ humanLog(`\n✓ Copied ${filesCopied} files to ${outputDir}/\n`);
67
+ humanLog(`Relative imports have been rewritten to use ${ownerPackage}.`);
68
+ humanLog('You can now customize the component source freely.\n');
69
+
70
+ // StyleX build requirement — swizzled StyleX source renders unstyled with
71
+ // no error unless the consumer's build runs a StyleX compiler.
72
+ if (usesStyleX) {
73
+ humanLog(
74
+ '⚠ These components use StyleX and require a StyleX compiler in your build.',
75
+ );
76
+ humanLog(
77
+ ' Without one they render unstyled (no error). See setup per framework:',
78
+ );
79
+ humanLog(` ${run} docs styling`);
80
+ humanLog(
81
+ ' Next.js note: the StyleX Babel plugin disables SWC and breaks next/font —',
82
+ );
83
+ humanLog(
84
+ ' use an SWC-based StyleX transform instead (covered in the guide).',
85
+ );
86
+ humanLog('');
87
+ }
88
+
89
+ // Maintainer feedback note (skipped when the owner ships no issues URL).
90
+ if (feedback) {
91
+ humanLog(
92
+ 'Customizing a component often signals a gap in the design system.',
93
+ );
94
+ humanLog('Let the maintainers know what you needed:');
95
+ if (feedback.ghCommand) {
96
+ humanLog(` ${feedback.ghCommand}`);
97
+ } else {
98
+ humanLog(` ${feedback.issuesUrl}`);
99
+ }
100
+ humanLog('');
101
+ }
102
+ });
103
+ }