@astryxdesign/cli 0.1.7 → 0.1.8-canary.07362a9

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 (389) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +115 -19
  3. package/{src/api → api/blog}/blog.mjs +42 -6
  4. package/{src/api → api/blog}/blog.test.mjs +2 -2
  5. package/api/build/build.mjs +92 -0
  6. package/api/build/build.test.mjs +92 -0
  7. package/{src/api → api/component}/component.mjs +49 -26
  8. package/{src/api → api/discover}/discover.mjs +55 -18
  9. package/{src/api → api/docs}/docs.mjs +47 -21
  10. package/{src/api → api/doctor}/doctor.mjs +13 -10
  11. package/{src/api → api}/error.mjs +2 -2
  12. package/{src/api → api/hook}/hook.mjs +11 -11
  13. package/{src/api → api}/index.mjs +16 -9
  14. package/{src/api → api/integration}/validate-integration.mjs +48 -15
  15. package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
  16. package/{src/api → api/layout}/layout.mjs +66 -17
  17. package/{src/api → api/layout}/layout.test.mjs +1 -1
  18. package/{src/api → api/search}/search.mjs +71 -12
  19. package/api/swizzle/swizzle.mjs +283 -0
  20. package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
  21. package/{src/api → api/template}/template-integration.test.mjs +2 -2
  22. package/{src/api → api/template}/template-suffix.test.mjs +3 -3
  23. package/{src/api → api/template}/template.mjs +96 -19
  24. package/{src/api → api/theme}/theme-add.mjs +35 -7
  25. package/{src → authoring}/codemod.mjs +6 -6
  26. package/{src → authoring}/config.test.mjs +1 -1
  27. package/{src → authoring}/doc.mjs +1 -1
  28. package/{src → authoring}/doc.test.mjs +1 -1
  29. package/{src → authoring}/template.mjs +1 -1
  30. package/bin/astryx.mjs +12 -10
  31. package/{src → cli}/commands/blog.mjs +48 -7
  32. package/{src → cli}/commands/build-theme.mjs +133 -115
  33. package/cli/commands/build.mjs +172 -0
  34. package/cli/commands/cli-postinstall.test.mjs +42 -0
  35. package/{src → cli}/commands/component/index.mjs +52 -25
  36. package/{src → cli}/commands/component-ownership.test.mjs +3 -3
  37. package/{src → cli}/commands/component-package.test.mjs +1 -1
  38. package/{src → cli}/commands/component-resolution.test.mjs +2 -2
  39. package/{src → cli}/commands/discover.mjs +23 -12
  40. package/{src → cli}/commands/docs.mjs +42 -10
  41. package/{src → cli}/commands/docs.test.mjs +1 -1
  42. package/{src → cli}/commands/doctor.mjs +3 -3
  43. package/{src → cli}/commands/doctor.test.mjs +2 -2
  44. package/{src → cli}/commands/ensure-core-built.mjs +3 -2
  45. package/{src → cli}/commands/external-showcase.test.mjs +1 -1
  46. package/{src → cli}/commands/hook/index.mjs +40 -17
  47. package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
  48. package/cli/commands/init.mjs +195 -0
  49. package/{src → cli}/commands/init.next-steps.test.mjs +1 -1
  50. package/cli/commands/interactive-guard.test.mjs +66 -0
  51. package/{src → cli}/commands/json-contract.test.mjs +2 -2
  52. package/{src → cli}/commands/layout.mjs +59 -19
  53. package/{src → cli}/commands/search.mjs +22 -15
  54. package/{src → cli}/commands/search.test.mjs +1 -1
  55. package/cli/commands/setup-nudge.test.mjs +108 -0
  56. package/cli/commands/swizzle.mjs +103 -0
  57. package/{src → cli}/commands/template.mjs +84 -53
  58. package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
  59. package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
  60. package/{src → cli}/commands/upgrade.mjs +291 -77
  61. package/cli/commands/upgrade.test.mjs +314 -0
  62. package/{src → cli}/commands/validate-integration.mjs +17 -37
  63. package/{src → cli}/index.mjs +55 -19
  64. package/{src/codemods → codemods}/__tests__/registry.test.mjs +1 -0
  65. package/{src/codemods → codemods}/ensure-jscodeshift.mjs +12 -28
  66. package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
  67. package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
  68. package/{src/codemods → codemods}/integration-runner.mjs +8 -3
  69. package/{src/codemods → codemods}/registry.mjs +4 -1
  70. package/{src/codemods → codemods}/run-codemod.mjs +18 -11
  71. package/{src/codemods → codemods}/runner.mjs +24 -14
  72. package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
  73. package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
  74. package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
  75. package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
  76. package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
  77. package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
  78. package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
  79. package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
  80. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
  81. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
  82. package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
  83. package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
  84. package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
  85. package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
  86. package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
  87. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
  88. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
  89. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
  90. package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
  91. package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
  92. package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
  93. package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
  94. package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
  95. package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
  96. package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
  97. package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
  98. package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
  99. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
  100. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
  101. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
  102. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
  103. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
  104. package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
  105. package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
  106. package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
  107. package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
  108. package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +42 -7
  109. package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +43 -0
  110. package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +117 -13
  111. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
  112. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
  113. package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +86 -15
  114. package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
  115. package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
  116. package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
  117. package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
  118. package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
  119. package/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +161 -0
  120. package/codemods/transforms/v0.1.8/index.mjs +19 -0
  121. package/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +239 -0
  122. package/docs/cli-integrations.doc.mjs +150 -0
  123. package/docs/elevation.doc.mjs +79 -1
  124. package/docs/getting-started.doc.mjs +9 -9
  125. package/docs/internationalization.doc.mjs +92 -46
  126. package/docs/migration.doc.mjs +18 -18
  127. package/docs/principles.doc.dense.mjs +1 -1
  128. package/docs/principles.doc.mjs +6 -6
  129. package/docs/principles.doc.zh.mjs +1 -1
  130. package/docs/styling-libraries.doc.mjs +3 -3
  131. package/docs/styling.doc.mjs +4 -4
  132. package/docs/theme.doc.dense.mjs +2 -2
  133. package/docs/theme.doc.mjs +7 -7
  134. package/docs/theme.doc.zh.mjs +1 -1
  135. package/docs/tokens.doc.mjs +1 -1
  136. package/docs/working-with-ai.doc.mjs +19 -19
  137. package/{src/commands → lib/agent-docs}/agent-docs.mjs +164 -29
  138. package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
  139. package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +123 -10
  140. package/{src/lib → lib}/cli-error.mjs +2 -2
  141. package/{src/lib → lib}/component-discovery.mjs +44 -2
  142. package/{src/lib → lib}/component-format.mjs +67 -25
  143. package/{src/lib → lib}/component-loader.mjs +27 -13
  144. package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
  145. package/{src/lib → lib}/error-codes.test.mjs +1 -1
  146. package/{src/lib → lib}/hook-discovery.mjs +14 -1
  147. package/{src/lib → lib}/hook-format.mjs +29 -5
  148. package/{src/lib → lib}/integration-warnings.mjs +2 -2
  149. package/{src/lib → lib}/integrations.mjs +20 -0
  150. package/{src/lib → lib}/integrations.test.mjs +1 -1
  151. package/{src/lib → lib}/json-contract.test.mjs +1 -1
  152. package/{src/lib → lib}/json-shim.mjs +11 -6
  153. package/{src/lib → lib}/json-shim.test.mjs +1 -1
  154. package/{src/lib → lib}/json.mjs +3 -3
  155. package/{src/lib → lib}/levenshtein.mjs +6 -0
  156. package/{src/lib → lib}/manifest.mjs +7 -5
  157. package/{src/lib → lib}/manifest.test.mjs +2 -2
  158. package/{src/lib → lib}/module-loader.mjs +1 -0
  159. package/{src/lib → lib}/package-scanner.mjs +47 -0
  160. package/{src/lib → lib}/project.mjs +48 -18
  161. package/{src/lib → lib}/project.test.mjs +1 -1
  162. package/{src/lib → lib}/resolve-theme.mjs +5 -0
  163. package/{src/lib → lib}/string-utils.mjs +15 -0
  164. package/lib/term-log.mjs +57 -0
  165. package/{src/lib → lib}/xle/browser.mjs +18 -8
  166. package/{src/lib → lib}/xle/expand.mjs +155 -22
  167. package/{src/lib → lib}/xle/parse.mjs +119 -13
  168. package/{src/lib → lib}/xle/print.mjs +54 -14
  169. package/{src/lib → lib}/xle/registry-core.mjs +28 -3
  170. package/{src/lib → lib}/xle/registry.mjs +9 -4
  171. package/{src/lib → lib}/xle/splice.mjs +13 -2
  172. package/{src/lib → lib}/xle/validate.mjs +95 -14
  173. package/lib/xle/xle-ast.d.ts +214 -0
  174. package/package.json +37 -28
  175. package/scripts/postinstall.mjs +74 -0
  176. package/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +4 -4
  177. package/templates/blocks/components/Avatar/AvatarGroup.tsx +2 -2
  178. package/templates/blocks/components/Avatar/AvatarInitialsFallback.tsx +1 -1
  179. package/templates/blocks/components/Avatar/AvatarShowcase.tsx +5 -5
  180. package/templates/blocks/components/Avatar/AvatarUserCard.tsx +1 -1
  181. package/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
  182. package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
  183. package/templates/blocks/components/AvatarGroup/AvatarGroupShowcase.tsx +2 -2
  184. package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowCustomText.tsx +1 -1
  185. package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowDefault.tsx +1 -1
  186. package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowShowcase.tsx +2 -2
  187. package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +3 -3
  188. package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +3 -3
  189. package/templates/blocks/components/Banner/BannerFloating.doc.mjs +14 -0
  190. package/templates/blocks/components/Banner/BannerFloating.tsx +16 -0
  191. package/templates/blocks/components/Button/ButtonFloating.doc.mjs +14 -0
  192. package/templates/blocks/components/Button/ButtonFloating.tsx +37 -0
  193. package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.doc.mjs +14 -0
  194. package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +23 -0
  195. package/templates/blocks/components/Card/CardElevations.doc.mjs +14 -0
  196. package/templates/blocks/components/Card/CardElevations.tsx +32 -0
  197. package/templates/blocks/components/Card/ClickableCardElevated.doc.mjs +14 -0
  198. package/templates/blocks/components/Card/ClickableCardElevated.tsx +21 -0
  199. package/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +14 -0
  200. package/templates/blocks/components/Card/SelectableCardElevated.tsx +37 -0
  201. package/templates/blocks/components/Carousel/CarouselSnap.tsx +1 -1
  202. package/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +14 -0
  203. package/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +75 -0
  204. package/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx +2 -2
  205. package/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx +1 -1
  206. package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleGrouping.tsx +1 -1
  207. package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +1 -1
  208. package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +5 -9
  209. package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -1
  210. package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
  211. package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -1
  212. package/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +14 -0
  213. package/templates/blocks/components/IconButton/IconButtonFloating.tsx +37 -0
  214. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
  215. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
  216. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
  217. package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
  218. package/templates/blocks/components/Item/ItemWithMedia.tsx +2 -2
  219. package/templates/blocks/components/ListItem/ListItemWithMedia.tsx +2 -2
  220. package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.doc.mjs +14 -0
  221. package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +39 -0
  222. package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.doc.mjs +14 -0
  223. package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.tsx +44 -0
  224. package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -6
  225. package/templates/blocks/components/Stack/StackFillItem.tsx +2 -6
  226. package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
  227. package/templates/blocks/components/TabList/TabListTabsWithActions.tsx +2 -7
  228. package/templates/blocks/components/Table/TableRowStatusTable.doc.mjs +14 -0
  229. package/templates/blocks/components/Table/TableRowStatusTable.tsx +59 -0
  230. package/templates/blocks/components/Thumbnail/ThumbnailDisabled.tsx +6 -1
  231. package/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx +1 -0
  232. package/templates/blocks/components/Thumbnail/ThumbnailRemovable.tsx +1 -0
  233. package/templates/blocks/components/TypeaheadItem/TypeaheadItemShowcase.tsx +1 -1
  234. package/templates/pages/ai-chat/page.tsx +4 -4
  235. package/templates/pages/dashboard-portfolio/page.tsx +3 -11
  236. package/templates/pages/detail-page/page.tsx +5 -12
  237. package/templates/pages/documentation-design/page.tsx +1 -1
  238. package/templates/pages/messaging-shell/page.tsx +6 -8
  239. package/templates/pages/table-grouped/page.tsx +9 -14
  240. package/templates/pages/table-page/page.tsx +7 -9
  241. package/templates/pages/table-page-heatmap-status/page.tsx +5 -13
  242. package/{src/types → types}/api.contract.assert.ts +17 -8
  243. package/{src/types → types}/api.d.ts +110 -9
  244. package/{src/types → types}/base.d.ts +40 -4
  245. package/types/build.d.ts +53 -0
  246. package/types/codemod.d.ts +166 -0
  247. package/{src/types → types}/component.d.ts +1 -1
  248. package/{src/types → types}/discover.d.ts +1 -1
  249. package/{src/types → types}/docs.d.ts +1 -4
  250. package/{src/types → types}/hook.d.ts +1 -1
  251. package/{src/types → types}/index.d.ts +1 -0
  252. package/types/jscodeshift.d.ts +19 -0
  253. package/types/layout.d.ts +74 -0
  254. package/{src/types → types}/swizzle.d.ts +4 -0
  255. package/{src/types → types}/template-api.d.ts +4 -1
  256. package/types/theme.d.ts +53 -0
  257. package/types/upgrade.d.ts +108 -0
  258. package/utils/package-manager.mjs +178 -0
  259. package/utils/package-manager.test.mjs +220 -0
  260. package/{src/utils → utils}/path-safety.mjs +0 -18
  261. package/{src/utils → utils}/paths.mjs +4 -1
  262. package/{src/utils → utils}/update-check.mjs +5 -4
  263. package/{src/utils → utils}/update-check.test.mjs +3 -3
  264. package/docs/integration-authoring.md +0 -105
  265. package/src/commands/build.mjs +0 -196
  266. package/src/commands/init.mjs +0 -288
  267. package/src/commands/interactive-guard.test.mjs +0 -69
  268. package/src/commands/swizzle.mjs +0 -440
  269. package/src/commands/upgrade.test.mjs +0 -160
  270. package/src/types/codemod.d.ts +0 -81
  271. package/src/types/theme.d.ts +0 -23
  272. package/src/types/upgrade.d.ts +0 -64
  273. package/src/utils/interactive.mjs +0 -76
  274. package/src/utils/interactive.test.mjs +0 -70
  275. package/src/utils/package-manager.mjs +0 -74
  276. package/src/utils/package-manager.test.mjs +0 -113
  277. /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
  278. /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
  279. /package/{src/api → api/template}/template.test.mjs +0 -0
  280. /package/{src → authoring}/codemod.test.mjs +0 -0
  281. /package/{src → authoring}/config.mjs +0 -0
  282. /package/{src → authoring}/integration.mjs +0 -0
  283. /package/{src → authoring}/template.test.mjs +0 -0
  284. /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
  285. /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
  286. /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
  287. /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
  288. /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
  289. /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
  290. /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
  291. /package/{src → cli}/commands/component.test.mjs +0 -0
  292. /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
  293. /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
  294. /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
  295. /package/{src → cli}/commands/template.test.mjs +0 -0
  296. /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
  297. /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
  298. /package/{src → cli}/update-hint-commands.test.mjs +0 -0
  299. /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
  300. /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
  301. /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
  302. /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
  303. /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
  304. /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
  305. /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
  306. /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
  307. /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
  308. /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
  309. /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
  310. /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
  311. /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
  312. /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
  313. /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
  314. /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
  315. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
  316. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
  317. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
  318. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
  319. /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
  320. /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
  321. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
  322. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
  323. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
  324. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
  325. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
  326. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
  327. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
  328. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
  329. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
  330. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
  331. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
  332. /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
  333. /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
  334. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
  335. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
  336. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
  337. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
  338. /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
  339. /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
  340. /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
  341. /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
  342. /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
  343. /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
  344. /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
  345. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
  346. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
  347. /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
  348. /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
  349. /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
  350. /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
  351. /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
  352. /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
  353. /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
  354. /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
  355. /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
  356. /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
  357. /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
  358. /package/{src/lib → lib}/cli-error.test.mjs +0 -0
  359. /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
  360. /package/{src/lib → lib}/component-format.test.mjs +0 -0
  361. /package/{src/lib → lib}/component-loader.test.mjs +0 -0
  362. /package/{src/lib → lib}/config-cache.mjs +0 -0
  363. /package/{src/lib → lib}/config-cache.test.mjs +0 -0
  364. /package/{src/lib → lib}/config-schema.mjs +0 -0
  365. /package/{src/lib → lib}/error-codes.mjs +0 -0
  366. /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
  367. /package/{src/lib → lib}/module-loader.test.mjs +0 -0
  368. /package/{src/lib → lib}/node-version.mjs +0 -0
  369. /package/{src/lib → lib}/node-version.test.mjs +0 -0
  370. /package/{src/lib → lib}/parse.mjs +0 -0
  371. /package/{src/lib → lib}/site.mjs +0 -0
  372. /package/{src/lib → lib}/xle/browser.d.ts +0 -0
  373. /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
  374. /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
  375. /package/{src/schemas → schemas}/template-schema.mjs +0 -0
  376. /package/{src/types → types}/config.d.ts +0 -0
  377. /package/{src/types → types}/doc.d.ts +0 -0
  378. /package/{src/types → types}/doctor.d.ts +0 -0
  379. /package/{src/types → types}/error-codes.d.ts +0 -0
  380. /package/{src/types → types}/integration.d.ts +0 -0
  381. /package/{src/types → types}/manifest.d.ts +0 -0
  382. /package/{src/types → types}/search.d.ts +0 -0
  383. /package/{src/types → types}/template.d.ts +0 -0
  384. /package/{src/types → types}/validate-integration.d.ts +0 -0
  385. /package/{src/utils → utils}/github.mjs +0 -0
  386. /package/{src/utils → utils}/path-safety.test.mjs +0 -0
  387. /package/{src/utils → utils}/paths.test.mjs +0 -0
  388. /package/{src/utils → utils}/semver.mjs +0 -0
  389. /package/{src/utils → utils}/semver.test.mjs +0 -0
@@ -54,7 +54,7 @@ function scaffold(codemodFiles) {
54
54
  // from the vitest cwd (the repo root) instead.
55
55
  const codemodModulePath = path.resolve(
56
56
  process.cwd(),
57
- 'packages/cli/src/codemod.mjs',
57
+ 'packages/cli/authoring/codemod.mjs',
58
58
  );
59
59
  const codemodModuleUrl = pathToFileURL(codemodModulePath).href;
60
60
 
@@ -31,15 +31,15 @@ import {
31
31
  * Optional codemods (isOptional) are skipped unless explicitly requested via
32
32
  * `codemod` (matched against the codemod id).
33
33
  *
34
- * @param {Array<{version: string, codemods: Array<object>}>} versionGroups
34
+ * @param {Array<{version: string, codemods: Array<import('../types/codemod').CodemodEntry>}>} versionGroups
35
35
  * @param {object} options
36
36
  * @param {boolean} options.apply
37
37
  * @param {string} options.path source directory to scan
38
38
  * @param {string} [options.codemod] run only this codemod id
39
39
  * @param {Set<string>} [options.skipCodemods] codemod ids to exclude
40
- * @param {Function} options.jscodeshift
40
+ * @param {import('../types/codemod').JscodeshiftFactory} options.jscodeshift
41
41
  * @param {boolean} [options.silent]
42
- * @returns {{totalFilesChanged: number, totalTransformsApplied: number, writtenFiles: string[], errors: Array, skippedOptional: Array}}
42
+ * @returns {{totalFilesChanged: number, totalTransformsApplied: number, writtenFiles: string[], errors: Array<{file: string, codemod: string, error: string}>, skippedOptional: Array<import('../types/codemod').CodemodEntry>}}
43
43
  */
44
44
  export function runIntegrationCodemods(
45
45
  versionGroups,
@@ -49,12 +49,17 @@ export function runIntegrationCodemods(
49
49
 
50
50
  let totalFilesChanged = 0;
51
51
  let totalTransformsApplied = 0;
52
+ /** @type {string[]} */
52
53
  const writtenFiles = [];
54
+ /** @type {Array<{file: string, codemod: string, error: string}>} */
53
55
  const errors = [];
56
+ /** @type {Array<import('../types/codemod').CodemodEntry>} */
54
57
  const skippedOptional = [];
55
58
 
56
59
  // Flatten and split by type, preserving version ordering.
60
+ /** @type {Array<import('../types/codemod').CodemodEntry>} */
57
61
  const configEntries = [];
62
+ /** @type {Array<import('../types/codemod').CodemodEntry>} */
58
63
  const codeEntries = [];
59
64
  for (const {version, codemods} of versionGroups) {
60
65
  for (const entry of codemods) {
@@ -22,6 +22,7 @@ const registry = new Map([
22
22
  ['0.1.3', () => import('./transforms/v0.1.3/index.mjs')],
23
23
  ['0.1.5', () => import('./transforms/v0.1.5/index.mjs')],
24
24
  ['0.1.7', () => import('./transforms/v0.1.7/index.mjs')],
25
+ ['0.1.8', () => import('./transforms/v0.1.8/index.mjs')],
25
26
  ]);
26
27
 
27
28
  // Re-export from the shared utility so registry callers and other consumers
@@ -44,16 +45,18 @@ export const latestVersion = versions[versions.length - 1];
44
45
  *
45
46
  * @param {string} from - Current version (exclusive)
46
47
  * @param {string} to - Target version (inclusive)
47
- * @returns {Promise<Array<{version: string, transforms: Array<{name: string, module: Function}>}>>}
48
+ * @returns {Promise<Array<{version: string, transforms: Array<{name: string, transform: import('../types/codemod').CodemodTransform, meta: {title: string, description?: string}}>}>>}
48
49
  */
49
50
  export async function getTransformsBetween(from, to) {
50
51
  const applicable = versions.filter(
51
52
  v => semverCompare(v, from) > 0 && semverCompare(v, to) <= 0,
52
53
  );
54
+ /** @type {Array<{version: string, transforms: Array<{name: string, transform: import('../types/codemod').CodemodTransform, meta: {title: string, description?: string}}>}>} */
53
55
  const results = [];
54
56
 
55
57
  for (const version of applicable) {
56
58
  const loader = registry.get(version);
59
+ if (!loader) continue;
57
60
  const manifest = await loader();
58
61
  results.push({
59
62
  version,
@@ -29,7 +29,7 @@
29
29
 
30
30
  import * as fs from 'node:fs';
31
31
  import * as path from 'node:path';
32
- import * as p from '@clack/prompts';
32
+ import * as p from '../lib/term-log.mjs';
33
33
  import {findConfigPath} from '../lib/project.mjs';
34
34
  import {fixDirectiveCorruption, validateOutput} from './runner.mjs';
35
35
 
@@ -49,7 +49,9 @@ const PARSEABLE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs'];
49
49
  * @returns {string[]}
50
50
  */
51
51
  export function findSourceFiles(dir) {
52
+ /** @type {string[]} */
52
53
  const results = [];
54
+ /** @param {string} currentDir */
53
55
  function walk(currentDir) {
54
56
  let entries;
55
57
  try {
@@ -74,6 +76,7 @@ export function findSourceFiles(dir) {
74
76
  /**
75
77
  * No-op log surface for silent (`--json`) mode.
76
78
  * @param {boolean} silent
79
+ * @returns {import('../types/codemod').CliLog}
77
80
  */
78
81
  export function makeLog(silent) {
79
82
  return silent
@@ -84,9 +87,9 @@ export function makeLog(silent) {
84
87
  /**
85
88
  * Apply a config codemod to the consumer's astryx.config.* file.
86
89
  *
87
- * @param {object} entry normalized codemod entry {id, codemod, package}
88
- * @param {{apply: boolean, log: object, jscodeshift: Function}} ctx
89
- * @returns {{filesChanged: number, writtenFiles: string[], errors: Array}}
90
+ * @param {import('../types/codemod').CodemodEntry} entry normalized codemod entry {id, codemod, package}
91
+ * @param {{apply: boolean, log: import('../types/codemod').CliLog, jscodeshift: import('../types/codemod').JscodeshiftFactory}} ctx
92
+ * @returns {import('../types/codemod').CodemodRunResult}
90
93
  */
91
94
  export function runConfigCodemod(entry, {apply, log, jscodeshift}) {
92
95
  const {codemod, id, package: pkg} = entry;
@@ -135,11 +138,12 @@ export function runConfigCodemod(entry, {apply, log, jscodeshift}) {
135
138
  errors: [],
136
139
  };
137
140
  } catch (err) {
138
- log.error(` ✗ ${relativePath} — ${err.message}`);
141
+ const message = /** @type {any} */ (err).message;
142
+ log.error(` ✗ ${relativePath} — ${message}`);
139
143
  return {
140
144
  filesChanged: 0,
141
145
  writtenFiles: [],
142
- errors: [{file: relativePath, codemod: name, error: err.message}],
146
+ errors: [{file: relativePath, codemod: name, error: message}],
143
147
  };
144
148
  }
145
149
  }
@@ -147,10 +151,10 @@ export function runConfigCodemod(entry, {apply, log, jscodeshift}) {
147
151
  /**
148
152
  * Apply a code codemod to discovered source files.
149
153
  *
150
- * @param {object} entry normalized codemod entry {id, codemod, package}
154
+ * @param {import('../types/codemod').CodemodEntry} entry normalized codemod entry {id, codemod, package}
151
155
  * @param {string[]} files
152
- * @param {{apply: boolean, log: object, jscodeshift: Function}} ctx
153
- * @returns {{filesChanged: number, writtenFiles: string[], errors: Array}}
156
+ * @param {{apply: boolean, log: import('../types/codemod').CliLog, jscodeshift: import('../types/codemod').JscodeshiftFactory}} ctx
157
+ * @returns {import('../types/codemod').CodemodRunResult}
154
158
  */
155
159
  export function runCodeCodemod(entry, files, {apply, log, jscodeshift}) {
156
160
  const {codemod, id, package: pkg} = entry;
@@ -158,7 +162,9 @@ export function runCodeCodemod(entry, files, {apply, log, jscodeshift}) {
158
162
  const extensions = new Set(codemod.fileExtensions ?? DEFAULT_CODE_EXTENSIONS);
159
163
 
160
164
  let filesChanged = 0;
165
+ /** @type {string[]} */
161
166
  const writtenFiles = [];
167
+ /** @type {Array<{file: string, codemod: string, error: string}>} */
162
168
  const errors = [];
163
169
 
164
170
  for (const filePath of files) {
@@ -198,8 +204,9 @@ export function runCodeCodemod(entry, files, {apply, log, jscodeshift}) {
198
204
  log.warn(` ~ ${relativePath} (would change)`);
199
205
  }
200
206
  } catch (err) {
201
- log.error(` ✗ ${relativePath} — ${err.message}`);
202
- errors.push({file: relativePath, codemod: name, error: err.message});
207
+ const message = /** @type {any} */ (err).message;
208
+ log.error(` ✗ ${relativePath} — ${message}`);
209
+ errors.push({file: relativePath, codemod: name, error: message});
203
210
  }
204
211
  }
205
212
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  import * as fs from 'node:fs';
12
12
  import * as path from 'node:path';
13
- import * as p from '@clack/prompts';
13
+ import * as p from '../lib/term-log.mjs';
14
14
  import {humanLog} from '../lib/json.mjs';
15
15
  import {runConfigCodemod} from './run-codemod.mjs';
16
16
 
@@ -51,6 +51,7 @@ export function fixDirectiveCorruption(code) {
51
51
  * @returns {string[]}
52
52
  */
53
53
  function findSourceFiles(dir) {
54
+ /** @type {string[]} */
54
55
  const results = [];
55
56
  const extensions = new Set([
56
57
  '.tsx',
@@ -65,6 +66,7 @@ function findSourceFiles(dir) {
65
66
  '.less',
66
67
  ]);
67
68
 
69
+ /** @param {string} currentDir */
68
70
  function walk(currentDir) {
69
71
  let entries;
70
72
  try {
@@ -96,8 +98,9 @@ function findSourceFiles(dir) {
96
98
  *
97
99
  * @param {string} result - The transformed source code
98
100
  * @param {string} source - The original source code
99
- * @param {Function} j - jscodeshift instance (with parser configured)
100
- * @returns {{ valid: boolean, reason?: string }}
101
+ * @param {import('../types/codemod').JscodeshiftFactory} j - jscodeshift instance (with parser configured)
102
+ * @param {{parse?: boolean}} [options]
103
+ * @returns {{ valid: true } | { valid: false, reason: string }}
101
104
  */
102
105
  export function validateOutput(result, source, j, {parse = true} = {}) {
103
106
  // Check 1: Re-parse the output — catches syntax-breaking corruption
@@ -105,9 +108,10 @@ export function validateOutput(result, source, j, {parse = true} = {}) {
105
108
  try {
106
109
  j(result);
107
110
  } catch (parseError) {
111
+ const message = /** @type {any} */ (parseError).message;
108
112
  return {
109
113
  valid: false,
110
- reason: `transform produced unparseable output: ${parseError.message}`,
114
+ reason: `transform produced unparseable output: ${message}`,
111
115
  };
112
116
  }
113
117
  }
@@ -147,9 +151,9 @@ export function validateOutput(result, source, j, {parse = true} = {}) {
147
151
  * with the same `(file, api) => string | null | undefined` contract used by
148
152
  * `createConfigCodemod`.
149
153
  *
150
- * @param {{name: string, transform: Function, meta: object, optional?: boolean}} transformEntry
154
+ * @param {{name: string, transform: import('../types/codemod').CodemodTransform, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, optional?: boolean}} transformEntry
151
155
  * @param {string} version
152
- * @returns {{id: string, type: 'code'|'config', codemod: object, package: string, version: string}}
156
+ * @returns {import('../types/codemod').CodemodEntry}
153
157
  */
154
158
  function toUnifiedEntry(transformEntry, version) {
155
159
  const {name, transform, meta, optional} = transformEntry;
@@ -171,20 +175,20 @@ function toUnifiedEntry(transformEntry, version) {
171
175
  /**
172
176
  * Run codemods against source files.
173
177
  *
174
- * @param {Array<{version: string, transforms: Array}>} versionManifests
178
+ * @param {Array<{version: string, transforms: Array<{name: string, transform: import('../types/codemod').CodemodTransform, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, optional?: boolean}>}>} versionManifests
175
179
  * @param {object} options
176
180
  * @param {boolean} options.apply - Write changes to disk
177
181
  * @param {string} options.path - Source directory to scan
178
182
  * @param {string|undefined} options.codemod - Run only this specific transform
179
183
  * @param {Set<string>} [options.skipCodemods] - Transform names to exclude
180
184
  * @param {boolean} [options.silent] - Suppress all human-facing output (for --json)
181
- * @returns {{totalFilesChanged: number, totalTransformsApplied: number, totalValidationBlocked: number, writtenFiles: string[], errors: Array, skippedOptional: Array}}
185
+ * @returns {Promise<{totalFilesChanged: number, totalTransformsApplied: number, totalValidationBlocked: number, writtenFiles: string[], errors: Array<{file: string, codemod: string, error: string}>, skippedOptional: Array<{name: string, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, version: string}>} | {ok: false, reason: string, resolvedPath: string}>}
182
186
  */
183
187
  export async function runCodemods(
184
188
  versionManifests,
185
189
  {apply, path: srcPath, codemod, skipCodemods, silent = false},
186
190
  ) {
187
- // No-op stub object so silent mode skips clack stdout entirely without
191
+ // No-op stub object so silent mode skips log output entirely without
188
192
  // littering the body with `if (!silent)` guards.
189
193
  const log = silent
190
194
  ? {step() {}, info() {}, success() {}, warn() {}, error() {}, message() {}}
@@ -208,11 +212,11 @@ export async function runCodemods(
208
212
  return {ok: false, reason: 'source_path_missing', resolvedPath};
209
213
  }
210
214
 
215
+ /** @type {string[]} */
211
216
  let files = [];
212
217
  if (sourcePathExists) {
213
218
  log.step(`Scanning ${resolvedPath} for source files...`);
214
219
  files = findSourceFiles(resolvedPath);
215
-
216
220
  if (files.length === 0) {
217
221
  log.warn('No source files found.');
218
222
  } else {
@@ -223,15 +227,20 @@ export async function runCodemods(
223
227
  }
224
228
 
225
229
  // Dynamically import jscodeshift
226
- const jscodeshift = (await import('jscodeshift')).default;
230
+ const jscodeshift =
231
+ /** @type {import('../types/codemod').JscodeshiftFactory} */ (
232
+ (await import('jscodeshift')).default
233
+ );
227
234
 
228
235
  let totalFilesChanged = 0;
229
236
  let totalTransformsApplied = 0;
230
237
  let totalValidationBlocked = 0;
238
+ /** @type {Array<{file: string, codemod: string, error: string}>} */
231
239
  const errors = [];
240
+ /** @type {string[]} */
232
241
  const writtenFiles = [];
242
+ /** @type {Array<{name: string, meta: {title: string, description?: string, fileExtensions?: string[], codemodType?: string}, version: string}>} */
233
243
  const skippedOptional = [];
234
-
235
244
  for (const {version, transforms} of versionManifests) {
236
245
  log.step(`Applying v${version} codemods...`);
237
246
 
@@ -333,8 +342,9 @@ export async function runCodemods(
333
342
  }
334
343
  }
335
344
  } catch (err) {
336
- log.error(` ✗ ${relativePath} — ${err.message}`);
337
- errors.push({file: relativePath, codemod: name, error: err.message});
345
+ const message = /** @type {any} */ (err).message;
346
+ log.error(` ✗ ${relativePath} — ${message}`);
347
+ errors.push({file: relativePath, codemod: name, error: message});
338
348
  }
339
349
  }
340
350
 
@@ -32,6 +32,11 @@ export const meta = {
32
32
  pr: '#966',
33
33
  };
34
34
 
35
+ /**
36
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
37
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
38
+ * @returns {string | null | undefined}
39
+ */
35
40
  export default function transformer(file, api) {
36
41
  const j = api.jscodeshift;
37
42
  const root = j(file.source);
@@ -40,7 +45,7 @@ export default function transformer(file, api) {
40
45
  // 1. Remove size JSX prop from target components
41
46
  root
42
47
  .find(j.JSXOpeningElement)
43
- .filter((path) => {
48
+ .filter((/** @type {any} */ path) => {
44
49
  const name = path.node.name;
45
50
  // Handle simple names like <XDSStatusDot>
46
51
  if (name.type === 'JSXIdentifier') {
@@ -48,10 +53,10 @@ export default function transformer(file, api) {
48
53
  }
49
54
  return false;
50
55
  })
51
- .forEach((path) => {
56
+ .forEach((/** @type {any} */ path) => {
52
57
  const attrs = path.node.attributes;
53
58
  const sizeIdx = attrs.findIndex(
54
- (attr) =>
59
+ (/** @type {any} */ attr) =>
55
60
  attr.type === 'JSXAttribute' &&
56
61
  attr.name &&
57
62
  attr.name.name === 'size',
@@ -63,7 +68,7 @@ export default function transformer(file, api) {
63
68
  });
64
69
 
65
70
  // 2. Remove size type imports (XDSStatusDotSize, XDSProgressBarSize)
66
- root.find(j.ImportDeclaration).forEach((path) => {
71
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
67
72
  const specifiers = path.node.specifiers;
68
73
  if (!specifiers) return;
69
74
 
@@ -50,6 +50,11 @@ export const meta = {
50
50
  pr: '#1321',
51
51
  };
52
52
 
53
+ /**
54
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
55
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
56
+ * @returns {string | null | undefined}
57
+ */
53
58
  export default function transformer(file, api) {
54
59
  const j = api.jscodeshift;
55
60
  const root = j(file.source);
@@ -61,7 +66,7 @@ export default function transformer(file, api) {
61
66
  // Uses direct body manipulation instead of jscodeshift's insertAfter(),
62
67
  // which has a known bug that corrupts 'use client' directives into
63
68
  // double semicolons ('use client';;).
64
- function insertAfterInBody(targetPath, newNode) {
69
+ function insertAfterInBody(/** @type {any} */ targetPath, /** @type {any} */ newNode) {
65
70
  const body = root.get().node.program.body;
66
71
  const targetIndex = body.indexOf(targetPath.node);
67
72
  if (targetIndex !== -1) {
@@ -69,14 +74,14 @@ export default function transformer(file, api) {
69
74
  } else {
70
75
  // Fallback: insert after all imports
71
76
  const lastImportIdx = body.findLastIndex(
72
- (n) => n.type === 'ImportDeclaration',
77
+ (/** @type {any} */ n) => n.type === 'ImportDeclaration',
73
78
  );
74
79
  body.splice(lastImportIdx + 1, 0, newNode);
75
80
  }
76
81
  }
77
82
 
78
83
  // ---- 1. JSX elements: convert icon-only XDSButton to XDSIconButton ----
79
- root.find(j.JSXOpeningElement).forEach((path) => {
84
+ root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
80
85
  const name = path.node.name;
81
86
  const componentName =
82
87
  name.type === 'JSXIdentifier' ? name.name : null;
@@ -85,13 +90,13 @@ export default function transformer(file, api) {
85
90
  const attrs = path.node.attributes;
86
91
 
87
92
  const hasIcon = attrs.some(
88
- (a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
93
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
89
94
  );
90
95
  const hasChildren = attrs.some(
91
- (a) => a.type === 'JSXAttribute' && a.name?.name === 'children',
96
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'children',
92
97
  );
93
98
  const hasIsIconOnly = attrs.some(
94
- (a) => a.type === 'JSXAttribute' && a.name?.name === 'isIconOnly',
99
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'isIconOnly',
95
100
  );
96
101
 
97
102
  if (!hasIcon || hasChildren || hasIsIconOnly) return;
@@ -101,7 +106,7 @@ export default function transformer(file, api) {
101
106
  const hasJSXChildren =
102
107
  parent.type === 'JSXElement' &&
103
108
  parent.children &&
104
- parent.children.some((child) => {
109
+ parent.children.some((/** @type {any} */ child) => {
105
110
  if (child.type === 'JSXText') return child.value.trim() !== '';
106
111
  return true;
107
112
  });
@@ -128,7 +133,7 @@ export default function transformer(file, api) {
128
133
  });
129
134
 
130
135
  // ---- 2. Remove redundant children that match label ----
131
- root.find(j.JSXElement).forEach((path) => {
136
+ root.find(j.JSXElement).forEach((/** @type {any} */ path) => {
132
137
  const opening = path.node.openingElement;
133
138
  const name = opening.name;
134
139
  const componentName =
@@ -137,13 +142,13 @@ export default function transformer(file, api) {
137
142
 
138
143
  const attrs = opening.attributes;
139
144
  const hasIcon = attrs.some(
140
- (a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
145
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'icon',
141
146
  );
142
147
  if (!hasIcon) return;
143
148
 
144
149
  // Get label value
145
150
  const labelAttr = attrs.find(
146
- (a) => a.type === 'JSXAttribute' && a.name?.name === 'label',
151
+ (/** @type {any} */ a) => a.type === 'JSXAttribute' && a.name?.name === 'label',
147
152
  );
148
153
  if (!labelAttr || !labelAttr.value) return;
149
154
 
@@ -177,7 +182,7 @@ export default function transformer(file, api) {
177
182
  });
178
183
 
179
184
  // ---- 3. Object literals: add isIconOnly to button config objects ----
180
- root.find(j.JSXOpeningElement).forEach((path) => {
185
+ root.find(j.JSXOpeningElement).forEach((/** @type {any} */ path) => {
181
186
  const name = path.node.name;
182
187
  const componentName =
183
188
  name.type === 'JSXIdentifier' ? name.name : null;
@@ -185,7 +190,7 @@ export default function transformer(file, api) {
185
190
 
186
191
  const attrs = path.node.attributes;
187
192
  const buttonAttr = attrs.find(
188
- (a) =>
193
+ (/** @type {any} */ a) =>
189
194
  a.type === 'JSXAttribute' &&
190
195
  a.name?.name === 'button' &&
191
196
  a.value?.type === 'JSXExpressionContainer' &&
@@ -197,13 +202,13 @@ export default function transformer(file, api) {
197
202
  const props = obj.properties;
198
203
 
199
204
  const hasIcon = props.some(
200
- (p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'icon',
205
+ (/** @type {any} */ p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'icon',
201
206
  );
202
207
  const hasChildren = props.some(
203
- (p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'children',
208
+ (/** @type {any} */ p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'children',
204
209
  );
205
210
  const hasIsIconOnly = props.some(
206
- (p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'isIconOnly',
211
+ (/** @type {any} */ p) => (p.type === 'Property' || p.type === 'ObjectProperty') && p.key?.name === 'isIconOnly',
207
212
  );
208
213
 
209
214
  if (hasIcon && !hasChildren && !hasIsIconOnly) {
@@ -222,7 +227,7 @@ export default function transformer(file, api) {
222
227
  hasRemainingXDSButton = true;
223
228
  });
224
229
  // Also check for XDSButton in type annotations (e.g. typeof XDSButton)
225
- root.find(j.Identifier, {name: 'XDSButton'}).forEach((path) => {
230
+ root.find(j.Identifier, {name: 'XDSButton'}).forEach((/** @type {any} */ path) => {
226
231
  // Skip JSX identifiers (already counted above) and import specifiers
227
232
  if (path.parent.node.type === 'JSXOpeningElement' ||
228
233
  path.parent.node.type === 'JSXClosingElement' ||
@@ -232,9 +237,9 @@ export default function transformer(file, api) {
232
237
 
233
238
  if (needsIconButtonImport) {
234
239
  let alreadyImported = false;
235
- root.find(j.ImportDeclaration).forEach((path) => {
240
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
236
241
  if (path.node.specifiers.some(
237
- (s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSIconButton',
242
+ (/** @type {any} */ s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSIconButton',
238
243
  )) {
239
244
  alreadyImported = true;
240
245
  }
@@ -244,13 +249,13 @@ export default function transformer(file, api) {
244
249
  // Handle @xds/core/Button import — may need splitting if it has
245
250
  // other specifiers (type imports, other components)
246
251
  if (!hasRemainingXDSButton) {
247
- root.find(j.ImportDeclaration).forEach((path) => {
252
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
248
253
  if (alreadyImported) return;
249
254
  const source = path.node.source.value;
250
255
  if (source !== '@xds/core/Button') return;
251
256
  const specs = path.node.specifiers;
252
257
  const btnIdx = specs.findIndex(
253
- (s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSButton',
258
+ (/** @type {any} */ s) => s.type === 'ImportSpecifier' && s.imported.name === 'XDSButton',
254
259
  );
255
260
  if (btnIdx === -1) return;
256
261
 
@@ -276,7 +281,7 @@ export default function transformer(file, api) {
276
281
 
277
282
  // For barrel imports, add the specifier
278
283
  if (!alreadyImported) {
279
- root.find(j.ImportDeclaration).forEach((path) => {
284
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
280
285
  if (alreadyImported) return;
281
286
  if (path.node.source.value === '@xds/core') {
282
287
  path.node.specifiers.push(
@@ -296,7 +301,7 @@ export default function transformer(file, api) {
296
301
 
297
302
  const xdsImports = root
298
303
  .find(j.ImportDeclaration)
299
- .filter((p) => p.node.source.value.startsWith('@xds/'));
304
+ .filter((/** @type {any} */ p) => p.node.source.value.startsWith('@xds/'));
300
305
 
301
306
  if (xdsImports.length > 0) {
302
307
  insertAfterInBody(xdsImports.at(-1), newImport);
@@ -23,6 +23,7 @@ export const meta = {
23
23
  pr: '#1503',
24
24
  };
25
25
 
26
+ /** @type {Record<string, string>} */
26
27
  const RENAMES = {
27
28
  checkCircle: 'success',
28
29
  xCircle: 'error',
@@ -31,13 +32,18 @@ const RENAMES = {
31
32
  /** Prop names that accept XDSIconName values */
32
33
  const ICON_PROPS = new Set(['icon', 'name', 'selectedIcon']);
33
34
 
35
+ /**
36
+ * @param {import('../../../types/codemod').AstryxCodemodFile} file
37
+ * @param {import('../../../types/codemod').CodemodTransformApi} api
38
+ * @returns {string | null | undefined}
39
+ */
34
40
  export default function transformer(file, api) {
35
41
  const j = api.jscodeshift;
36
42
  const root = j(file.source);
37
43
  let hasChanges = false;
38
44
 
39
45
  // Helper: rename a string literal node if it matches a deprecated name
40
- function renameStringLiteral(node) {
46
+ function renameStringLiteral(/** @type {any} */ node) {
41
47
  if (!node) return false;
42
48
  if (node.type === 'StringLiteral' || node.type === 'Literal') {
43
49
  const newName = RENAMES[node.value];
@@ -51,7 +57,8 @@ export default function transformer(file, api) {
51
57
  }
52
58
 
53
59
  // Helper: recursively rename deprecated icon strings inside an expression
54
- function renameInExpression(node) {
60
+ /** @returns {boolean} */
61
+ function renameInExpression(/** @type {any} */ node) {
55
62
  if (!node) return false;
56
63
  let changed = false;
57
64
  if (node.type === 'StringLiteral' || node.type === 'Literal') {
@@ -67,7 +74,7 @@ export default function transformer(file, api) {
67
74
  }
68
75
 
69
76
  // 1. JSX attributes: icon="checkCircle" or icon={cond ? 'checkCircle' : 'copy'}
70
- root.find(j.JSXAttribute).forEach((path) => {
77
+ root.find(j.JSXAttribute).forEach((/** @type {any} */ path) => {
71
78
  const attrName = path.node.name?.name;
72
79
  if (!ICON_PROPS.has(attrName)) return;
73
80
 
@@ -92,7 +99,7 @@ export default function transformer(file, api) {
92
99
 
93
100
  if (looksLikeIconRegistry) {
94
101
  const PropertyType = j.ObjectProperty ?? j.Property;
95
- root.find(PropertyType).forEach((path) => {
102
+ root.find(PropertyType).forEach((/** @type {any} */ path) => {
96
103
  const key = path.node.key;
97
104
  if (!key) return;
98
105
  const keyName =
@@ -110,7 +117,7 @@ export default function transformer(file, api) {
110
117
  // 3. String literals in objects with icon-related keys
111
118
  // e.g. { label: "TestX", href: "/pages/testx", icon: "checkCircle" }
112
119
  const PropertyType2 = j.ObjectProperty ?? j.Property;
113
- root.find(PropertyType2).forEach((path) => {
120
+ root.find(PropertyType2).forEach((/** @type {any} */ path) => {
114
121
  const key = path.node.key;
115
122
  const keyName = key?.type === 'Identifier' ? key.name : key?.value;
116
123
  if (!ICON_PROPS.has(keyName)) return;