@astryxdesign/cli 0.1.0 → 0.1.1-canary.13763f6

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 (141) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +117 -75
  3. package/bin/astryx.mjs +22 -7
  4. package/docs/getting-started.doc.mjs +11 -11
  5. package/docs/icons.doc.mjs +1 -1
  6. package/docs/migration.doc.mjs +2 -2
  7. package/docs/shape.doc.mjs +1 -1
  8. package/docs/styling.doc.mjs +3 -4
  9. package/docs/theme.doc.dense.mjs +2 -2
  10. package/docs/theme.doc.mjs +14 -0
  11. package/docs/theme.doc.zh.mjs +2 -2
  12. package/docs/working-with-ai.doc.mjs +4 -4
  13. package/package.json +8 -8
  14. package/src/api/doctor.mjs +3 -3
  15. package/src/api/search.mjs +207 -13
  16. package/src/api/template.mjs +62 -11
  17. package/src/api/template.test.mjs +2 -0
  18. package/src/codemods/__tests__/registry.test.mjs +1 -0
  19. package/src/codemods/registry.mjs +1 -0
  20. package/src/codemods/runner.mjs +105 -51
  21. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-config-surfaces.test.mjs +116 -0
  22. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +51 -0
  23. package/src/codemods/transforms/v0.1.0/index.mjs +28 -0
  24. package/src/codemods/transforms/v0.1.0/migrate-xds-config-surfaces.mjs +230 -0
  25. package/src/codemods/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +84 -0
  26. package/src/commands/agent-docs.mjs +119 -66
  27. package/src/commands/agent-docs.path-safety.test.mjs +1 -1
  28. package/src/commands/agent-docs.test.mjs +87 -31
  29. package/src/commands/build-theme.import-path.test.mjs +1 -1
  30. package/src/commands/build-theme.path-safety.test.mjs +1 -1
  31. package/src/commands/build-theme.prose.test.mjs +1 -1
  32. package/src/commands/build.mjs +196 -0
  33. package/src/commands/component-package.test.mjs +1 -1
  34. package/src/commands/component.test.mjs +1 -1
  35. package/src/commands/docs.test.mjs +1 -1
  36. package/src/commands/doctor.test.mjs +1 -1
  37. package/src/commands/external-showcase.test.mjs +1 -1
  38. package/src/commands/init.mjs +10 -2
  39. package/src/commands/interactive-guard.test.mjs +1 -1
  40. package/src/commands/json-contract.test.mjs +10 -3
  41. package/src/commands/swizzle-gap-safety.test.mjs +1 -1
  42. package/src/commands/swizzle.path-safety.test.mjs +1 -1
  43. package/src/commands/template.path-safety.test.mjs +1 -1
  44. package/src/commands/template.test.mjs +1 -1
  45. package/src/commands/upgrade.mjs +353 -169
  46. package/src/commands/upgrade.test.mjs +41 -27
  47. package/src/index.mjs +1 -0
  48. package/src/lib/config.mjs +12 -0
  49. package/src/lib/config.test.mjs +42 -0
  50. package/src/lib/error-codes.mjs +3 -0
  51. package/src/types/error-codes.d.ts +1 -0
  52. package/src/utils/interactive.mjs +1 -1
  53. package/src/utils/interactive.test.mjs +2 -0
  54. package/src/utils/package-manager.mjs +1 -1
  55. package/src/utils/package-manager.test.mjs +1 -1
  56. package/src/utils/path-safety.test.mjs +1 -1
  57. package/src/utils/paths.test.mjs +8 -8
  58. package/src/utils/update-check.mjs +4 -26
  59. package/src/utils/update-check.test.mjs +2 -64
  60. package/templates/blocks/components/AppShell/AppShellContentOnly.tsx +1 -9
  61. package/templates/blocks/components/AppShell/AppShellShowcase.tsx +1 -10
  62. package/templates/blocks/components/AppShell/AppShellSideNavOnly.tsx +1 -9
  63. package/templates/blocks/components/AppShell/AppShellTopNavOnly.tsx +1 -9
  64. package/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.tsx +1 -9
  65. package/templates/blocks/components/AppShell/AppShellWithBanner.tsx +1 -9
  66. package/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx +12 -19
  67. package/templates/blocks/components/Banner/BannerShowcase.tsx +1 -8
  68. package/templates/blocks/components/Blockquote/BlockquoteShowcase.tsx +1 -8
  69. package/templates/blocks/components/Carousel/CarouselShowcase.tsx +2 -12
  70. package/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.tsx +6 -9
  71. package/templates/blocks/components/ChatLayout/ChatLayoutPanelChat.tsx +10 -12
  72. package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +1 -9
  73. package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -9
  74. package/templates/blocks/components/ChatMessageList/ChatMessageListShowcase.tsx +1 -9
  75. package/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +1 -8
  76. package/templates/blocks/components/ChatSendButton/ChatSendButtonInComposer.tsx +1 -8
  77. package/templates/blocks/components/Citation/CitationInlineText.tsx +4 -4
  78. package/templates/blocks/components/Code/CodeInlineInParagraph.tsx +1 -8
  79. package/templates/blocks/components/CodeBlock/CodeBlockBashCommand.tsx +1 -1
  80. package/templates/blocks/components/CodeBlock/CodeBlockJSONConfig.tsx +1 -1
  81. package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +9 -12
  82. package/templates/blocks/components/ContextMenu/ContextMenuShowcase.tsx +13 -15
  83. package/templates/blocks/components/Divider/DividerShowcase.tsx +1 -8
  84. package/templates/blocks/components/Divider/DividerVertical.tsx +7 -9
  85. package/templates/blocks/components/Field/FieldShowcase.tsx +1 -8
  86. package/templates/blocks/components/FormLayout/FormLayoutHorizontal.tsx +1 -6
  87. package/templates/blocks/components/Grid/GridResponsiveAutoFit.tsx +1 -9
  88. package/templates/blocks/components/HoverCard/HoverCardInlineTextHoverCard.tsx +4 -6
  89. package/templates/blocks/components/HoverCard/HoverCardInteractiveContent.tsx +1 -6
  90. package/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.tsx +2 -8
  91. package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -8
  92. package/templates/blocks/components/MoreMenu/MoreMenuInToolbar.tsx +2 -12
  93. package/templates/blocks/components/OverflowList/OverflowListOverflowBadges.tsx +8 -11
  94. package/templates/blocks/components/OverflowList/OverflowListOverflowDropdownActions.tsx +9 -12
  95. package/templates/blocks/components/Overlay/OverlayBottomStrip.tsx +4 -17
  96. package/templates/blocks/components/Overlay/OverlayHoverReveal.tsx +15 -16
  97. package/templates/blocks/components/Overlay/OverlayShowcase.tsx +5 -21
  98. package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -14
  99. package/templates/blocks/components/Pagination/PaginationPageSize.tsx +12 -14
  100. package/templates/blocks/components/Pagination/PaginationVariants.tsx +1 -8
  101. package/templates/blocks/components/Pagination/PaginationWithTable.tsx +2 -14
  102. package/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -6
  103. package/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -7
  104. package/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -6
  105. package/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -6
  106. package/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -6
  107. package/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -7
  108. package/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -6
  109. package/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -9
  110. package/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +1 -10
  111. package/templates/blocks/components/Toolbar/ToolbarSizes.tsx +1 -8
  112. package/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -8
  113. package/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +1 -10
  114. package/templates/blocks/components/Toolbar/ToolbarWithTabs.tsx +8 -11
  115. package/templates/pages/ai-chat/page.tsx +71 -64
  116. package/templates/pages/ai-chat-landing/page.tsx +8 -12
  117. package/templates/pages/centered-hero/page.tsx +13 -15
  118. package/templates/pages/classic-gallery/page.tsx +27 -34
  119. package/templates/pages/detail-page/page.tsx +18 -18
  120. package/templates/pages/documentation/page.tsx +42 -58
  121. package/templates/pages/documentation-design/page.tsx +82 -60
  122. package/templates/pages/documentation-technical/page.tsx +101 -60
  123. package/templates/pages/editor/page.tsx +42 -54
  124. package/templates/pages/file-explorer/page.tsx +13 -16
  125. package/templates/pages/form-two-column/page.tsx +13 -17
  126. package/templates/pages/gallery-hero/page.tsx +13 -15
  127. package/templates/pages/ide/page.tsx +188 -264
  128. package/templates/pages/library/page.tsx +16 -23
  129. package/templates/pages/login/page.tsx +14 -18
  130. package/templates/pages/login-card/page.tsx +14 -18
  131. package/templates/pages/login-split/page.tsx +50 -48
  132. package/templates/pages/login-sso/page.tsx +9 -13
  133. package/templates/pages/mixed-gallery/page.tsx +51 -45
  134. package/templates/pages/payment-form/page.tsx +56 -70
  135. package/templates/pages/product-detail/page.tsx +27 -33
  136. package/templates/pages/product-gallery/page.tsx +7 -13
  137. package/templates/pages/settings-dialog/page.tsx +35 -43
  138. package/templates/pages/settings-sidebar/page.tsx +39 -47
  139. package/templates/pages/side-gallery/page.tsx +6 -9
  140. package/templates/pages/table-grouped/page.tsx +11 -15
  141. package/templates/pages/theme-showcase/page.tsx +33 -37
package/CHANGELOG.md CHANGED
@@ -1,5 +1,71 @@
1
1
  # @xds/cli
2
2
 
3
+ # 0.1.1
4
+
5
+ #### New Features
6
+
7
+ - Add `astryx build` command for page composition, with natural-language search ranking.
8
+ `build "<idea>"` returns a composition kit — the closest page template, the
9
+ blocks that cover parts, and components to fill gaps, plus a Compose suggestion.
10
+ `build` with no args prints the how-to-build playbook. The shared search ranking
11
+ now handles oblique natural-language queries via tokenization + stopwords, a
12
+ synonym/intent map, light stemming, and page-template keyword enrichment.
13
+ - Make generated agent docs build-first and restructure `init` output.
14
+ The generated `CLAUDE.md` now leads with the `build` workflow (search reframed as
15
+ a neutral universal find), and includes a required-CSS setup note
16
+ (`reset.css` + `astryx.css`) so components never render unstyled. `init` now
17
+ points agents at `astryx build`/`astryx search` instead of dumping page-template
18
+ names.
19
+ - Improve `astryx build` output into a complete composition kit.
20
+ `build "<idea>"` now returns an agent-ready kit grouped by role: a START line
21
+ (scaffold vs compose), the closest PAGE template, an always-on FRAME (page
22
+ shell) and FOUNDATION (layout/typography/action primitives), idea-specific
23
+ BLOCKS and DOMAIN COMPONENTS (with a relevance floor to cut noise), and a SETUP
24
+ reminder. The always-on FRAME/FOUNDATION groups fix low recall of the
25
+ structural primitives every page needs but that never keyword-match an idea
26
+ (measured: component recall 15% to 71% on an agent-grounded eval).
27
+ - Densify agent docs + tailor styling guidance to the project's configured system
28
+ Tightened the generated `CLAUDE.md`/`AGENTS.md` block from ~48 lines to ~26
29
+ (the per-topic `docs` dump collapsed to one line, `build`/`search`/`component`
30
+ no longer duplicated between workflow and reference, run-prefix stated once,
31
+ filler prose removed) — same information, far denser.
32
+
33
+ #### Fixes
34
+
35
+ - `npx astryx` now works when the CLI is installed as a real npm package.
36
+ The bin imported its `../src/*` modules relative to the invoked path, so running
37
+ through the `node_modules/.bin/astryx` symlink made them resolve outside the
38
+ package (`ERR_MODULE_NOT_FOUND: .../node_modules/src/...`) on Node versions that
39
+ don't realpath the bin entry. It now resolves siblings via the bin's real path
40
+ (realpath of `import.meta.url`), working whether invoked via symlink, copy, or
41
+ Windows shim. Also fixes the non-interactive `init`/`theme` error to say
42
+ `astryx <command>` instead of the stale `xds <command>`.
43
+ - Add a v0.1.0 upgrade codemod that migrates legacy `@xds/*` module specifiers and config surfaces to the Astryx v0.1.0 names.
44
+ [breaking] Remove legacy `astryx.versionFile` update-hint support from package.json.
45
+
46
+ #### Documentation
47
+
48
+ - Add npm install step to the Theme System guide
49
+ The Quick Start section jumped straight to `import {neutralTheme} from '@astryxdesign/theme-neutral'`, which fails with `Cannot find module` for anyone who hasn't already installed the theme package. Prepend a one-line preamble + `npm install` code block, and add a short prose note above the Available Themes table pointing at the install command pattern. Reported in #3082.
50
+
51
+ #### Other Changes
52
+
53
+ - StyleX compiler wired → `xstyle` / StyleX token imports
54
+ - Tailwind → utility classes backed by `@astryxdesign/core/tailwind-theme.css`
55
+ - neither → `style`/`className` with `var(--token)` design tokens, plus an
56
+ explicit note NOT to use `xstyle`/utilities (they would not compile)
57
+
58
+ #### Contributors
59
+
60
+ Thanks to everyone who contributed to this release:
61
+
62
+ - @ejhammond
63
+ - @joeyfarina
64
+ - @josephfarina
65
+ - @nynexman4464
66
+
67
+ ---
68
+
3
69
  # 0.1.0
4
70
 
5
71
  #### Breaking Changes
@@ -71,9 +137,11 @@
71
137
  - import {neutralTheme} from '@astryxdesign/theme-neutral/built';
72
138
  - <Theme theme={defaultTheme}>...</Theme>
73
139
  - <Theme theme={neutralTheme}>...</Theme>
140
+
74
141
  ```
75
142
 
76
143
  ```
144
+
77
145
  - Remove the internal `drop-xds-meta-prefix` codemod from the OSS repo (#2970)
78
146
  This codemod has been moved to its own package's tooling, where it belongs. It was registered as an optional, version-independent transform and is not part of any standard upgrade path, so removing it does not affect the public `0.0.13 → 0.0.15` migration.
79
147
  - Rename the npm package scope from `@xds/*` to `@astryxdesign/*`
package/README.md CHANGED
@@ -11,7 +11,7 @@ npx astryx docs migration
11
11
  npx astryx template --list
12
12
  ```
13
13
 
14
- ### Finding things: `astryx search`
14
+ ## Finding things: `astryx search`
15
15
 
16
16
  When you don't know whether what you need is a component, a hook, a docs topic,
17
17
  or a template, search across all of them at once. Results are ranked by
@@ -50,20 +50,20 @@ Options:
50
50
 
51
51
  ## Commands
52
52
 
53
- | Command | Description |
54
- | ------------- | --------------------------------------------------------------------------------------- |
53
+ | Command | Description |
54
+ | ------------- | ---------------------------------------------------------------------------------------------------- |
55
55
  | `init` | Initialize the design system in your project: installs packages, sets up theming, adds AI agent docs |
56
- | `component` | List components or print detailed docs, props, usage examples, and source |
57
- | `search` | Find components, hooks, docs, and templates in one ranked, cross-domain result set |
58
- | `docs` | Print reference documentation (tokens, theme, color, typography, spacing, etc.) |
59
- | `template` | Inject page or block templates into your project |
60
- | `hook` | List hooks and print hook documentation |
61
- | `swizzle` | Copy component source into your project for deep customization |
62
- | `upgrade` | Run codemods to migrate between versions |
63
- | `theme build` | Compile a defineTheme file to production CSS and JS |
64
- | `discover` | Discover external packages and components |
65
- | `gap-report` | Report a gap when a component doesn't meet your needs |
66
- | `doctor` | Diagnose your XDS setup and report problems with fixes (CI-friendly via exit code) |
56
+ | `component` | List components or print detailed docs, props, usage examples, and source |
57
+ | `search` | Find components, hooks, docs, and templates in one ranked, cross-domain result set |
58
+ | `docs` | Print reference documentation (tokens, theme, color, typography, spacing, etc.) |
59
+ | `template` | Inject page or block templates into your project |
60
+ | `hook` | List hooks and print hook documentation |
61
+ | `swizzle` | Copy component source into your project for deep customization |
62
+ | `upgrade` | Run codemods to migrate between versions |
63
+ | `theme build` | Compile a defineTheme file to production CSS and JS |
64
+ | `discover` | Discover external packages and components |
65
+ | `gap-report` | Report a gap when a component doesn't meet your needs |
66
+ | `doctor` | Diagnose your XDS setup and report problems with fixes (CI-friendly via exit code) |
67
67
 
68
68
  ### Global options
69
69
 
@@ -122,46 +122,46 @@ if (isError(result)) {
122
122
 
123
123
  ### Error codes
124
124
 
125
- | Code | Meaning |
126
- | --- | --- |
127
- | `ERR_UNKNOWN` | Generic fallback for any error without a more specific code. |
128
- | `ERR_UNKNOWN_COMMAND` | A top-level command name was not recognized (e.g. `astryx bogus`). |
129
- | `ERR_UNKNOWN_SUBCOMMAND` | A subcommand under a group was not recognized (e.g. `astryx theme bogus`). |
130
- | `ERR_INVALID_OPTION` | An unknown flag was passed, or `--json` was used on a command that doesn't support it. |
131
- | `ERR_INVALID_ARGUMENT` | An option/argument value was rejected, or required flags were missing. |
132
- | `ERR_MISSING_ARGUMENT` | A required positional argument was omitted (e.g. `astryx theme build` with no file). |
133
- | `ERR_INVALID_LANG` | `--lang` was given a value outside its choices (`en`, `zh`, `dense`). |
134
- | `ERR_INVALID_DETAIL` | `--detail` was given a value outside its choices (`full`, `compact`, `brief`). |
135
- | `ERR_NODE_VERSION` | The running Node.js version is below the supported minimum. |
136
- | `ERR_CORE_NOT_FOUND` | `@astryxdesign/core` could not be located (not installed / not in a monorepo). |
137
- | `ERR_UNKNOWN_COMPONENT` | No component matched the requested name. |
138
- | `ERR_UNKNOWN_HOOK` | No hook matched the requested name. |
139
- | `ERR_UNKNOWN_TOPIC` | No docs topic matched the requested name. |
140
- | `ERR_UNKNOWN_SECTION` | A docs topic exists but the requested section within it does not. |
141
- | `ERR_UNKNOWN_CATEGORY` | A `--category` filter value did not match any known category. |
142
- | `ERR_UNKNOWN_TEMPLATE` | No template matched the requested name. |
143
- | `ERR_UNKNOWN_PACKAGE` | No package matched the requested name (discover). |
144
- | `ERR_UNKNOWN_AGENT` | An unrecognized `--agent` value was passed (agent docs / init). |
145
- | `ERR_UNKNOWN_FEATURE` | An unrecognized `--features` value was passed to `init`. |
146
- | `ERR_UNKNOWN_CODEMOD` | A `--codemod` value did not match any registered codemod (upgrade). |
147
- | `ERR_NOT_FOUND` | A discover/lookup query matched nothing in any package. |
148
- | `ERR_NO_DOC` | A component exists but has no typed `.doc.mjs` file. |
149
- | `ERR_NO_SHOWCASE` | No showcase exists for the requested component. |
150
- | `ERR_NO_SOURCE` | No source file could be located for the component/template. |
151
- | `ERR_INVALID_DOC` | A component's docs failed validation (malformed `.doc.mjs`). |
152
- | `ERR_FILE_NOT_FOUND` | A required input file did not exist. |
153
- | `ERR_FILE_EXISTS` | Refused to overwrite an existing file in non-interactive mode. |
154
- | `ERR_PATH_TRAVERSAL` | A path escaped its allowed root, or a name contained traversal markers. |
155
- | `ERR_WRITE_FAILED` | Writing output files failed (and was rolled back). |
156
- | `ERR_THEME_INVALID` | A theme definition was missing a required property (e.g. `name`). |
157
- | `ERR_THEME_LOAD` | A theme file could not be loaded / parsed into a `defineTheme` result. |
158
- | `ERR_TEMPLATE_CONFIG` | `template.get` is not configured in `astryx.config.mjs` (fetch-by-id). |
159
- | `ERR_TEMPLATE_GET` | A configured `template.get` threw or returned an invalid value. |
160
- | `ERR_VERSION_DETECT` | The current `@astryxdesign/core` version could not be detected. |
161
- | `ERR_INVALID_VERSION` | A `--from`/`--to` value was not a valid semver string. |
162
- | `ERR_DEP_MISSING` | A required external dependency (e.g. jscodeshift) is missing. |
163
- | `ERR_GH_CLI` | GitHub CLI (`gh`) is not installed or not authenticated. |
164
- | `ERR_GAP_REPORT_FAILED` | Filing a gap report failed (disabled, or the integration errored). |
125
+ | Code | Meaning |
126
+ | ------------------------ | -------------------------------------------------------------------------------------- |
127
+ | `ERR_UNKNOWN` | Generic fallback for any error without a more specific code. |
128
+ | `ERR_UNKNOWN_COMMAND` | A top-level command name was not recognized (e.g. `astryx bogus`). |
129
+ | `ERR_UNKNOWN_SUBCOMMAND` | A subcommand under a group was not recognized (e.g. `astryx theme bogus`). |
130
+ | `ERR_INVALID_OPTION` | An unknown flag was passed, or `--json` was used on a command that doesn't support it. |
131
+ | `ERR_INVALID_ARGUMENT` | An option/argument value was rejected, or required flags were missing. |
132
+ | `ERR_MISSING_ARGUMENT` | A required positional argument was omitted (e.g. `astryx theme build` with no file). |
133
+ | `ERR_INVALID_LANG` | `--lang` was given a value outside its choices (`en`, `zh`, `dense`). |
134
+ | `ERR_INVALID_DETAIL` | `--detail` was given a value outside its choices (`full`, `compact`, `brief`). |
135
+ | `ERR_NODE_VERSION` | The running Node.js version is below the supported minimum. |
136
+ | `ERR_CORE_NOT_FOUND` | `@astryxdesign/core` could not be located (not installed / not in a monorepo). |
137
+ | `ERR_UNKNOWN_COMPONENT` | No component matched the requested name. |
138
+ | `ERR_UNKNOWN_HOOK` | No hook matched the requested name. |
139
+ | `ERR_UNKNOWN_TOPIC` | No docs topic matched the requested name. |
140
+ | `ERR_UNKNOWN_SECTION` | A docs topic exists but the requested section within it does not. |
141
+ | `ERR_UNKNOWN_CATEGORY` | A `--category` filter value did not match any known category. |
142
+ | `ERR_UNKNOWN_TEMPLATE` | No template matched the requested name. |
143
+ | `ERR_UNKNOWN_PACKAGE` | No package matched the requested name (discover). |
144
+ | `ERR_UNKNOWN_AGENT` | An unrecognized `--agent` value was passed (agent docs / init). |
145
+ | `ERR_UNKNOWN_FEATURE` | An unrecognized `--features` value was passed to `init`. |
146
+ | `ERR_UNKNOWN_CODEMOD` | A `--codemod` value did not match any registered codemod (upgrade). |
147
+ | `ERR_NOT_FOUND` | A discover/lookup query matched nothing in any package. |
148
+ | `ERR_NO_DOC` | A component exists but has no typed `.doc.mjs` file. |
149
+ | `ERR_NO_SHOWCASE` | No showcase exists for the requested component. |
150
+ | `ERR_NO_SOURCE` | No source file could be located for the component/template. |
151
+ | `ERR_INVALID_DOC` | A component's docs failed validation (malformed `.doc.mjs`). |
152
+ | `ERR_FILE_NOT_FOUND` | A required input file did not exist. |
153
+ | `ERR_FILE_EXISTS` | Refused to overwrite an existing file in non-interactive mode. |
154
+ | `ERR_PATH_TRAVERSAL` | A path escaped its allowed root, or a name contained traversal markers. |
155
+ | `ERR_WRITE_FAILED` | Writing output files failed (and was rolled back). |
156
+ | `ERR_THEME_INVALID` | A theme definition was missing a required property (e.g. `name`). |
157
+ | `ERR_THEME_LOAD` | A theme file could not be loaded / parsed into a `defineTheme` result. |
158
+ | `ERR_TEMPLATE_CONFIG` | `template.get` is not configured in `astryx.config.mjs` (fetch-by-id). |
159
+ | `ERR_TEMPLATE_GET` | A configured `template.get` threw or returned an invalid value. |
160
+ | `ERR_VERSION_DETECT` | The current `@astryxdesign/core` version could not be detected. |
161
+ | `ERR_INVALID_VERSION` | A `--from`/`--to` value was not a valid semver string. |
162
+ | `ERR_DEP_MISSING` | A required external dependency (e.g. jscodeshift) is missing. |
163
+ | `ERR_GH_CLI` | GitHub CLI (`gh`) is not installed or not authenticated. |
164
+ | `ERR_GAP_REPORT_FAILED` | Filing a gap report failed (disabled, or the integration errored). |
165
165
 
166
166
  ## Capability manifest (agent discovery)
167
167
 
@@ -186,25 +186,59 @@ Shape:
186
186
  "version": "0.0.14",
187
187
  "description": "Design system CLI — components, themes, and tooling",
188
188
  "globalOptions": [
189
- {"flag": "--json", "type": "boolean", "description": "Output as typed JSON…"},
190
- {"flag": "--lang <locale>", "type": "enum", "choices": ["en", "zh", "dense"]},
191
- {"flag": "--detail <level>", "type": "enum", "choices": ["full", "compact", "brief"], "default": "full"}
189
+ {
190
+ "flag": "--json",
191
+ "type": "boolean",
192
+ "description": "Output as typed JSON…",
193
+ },
194
+ {
195
+ "flag": "--lang <locale>",
196
+ "type": "enum",
197
+ "choices": ["en", "zh", "dense"],
198
+ },
199
+ {
200
+ "flag": "--detail <level>",
201
+ "type": "enum",
202
+ "choices": ["full", "compact", "brief"],
203
+ "default": "full",
204
+ },
192
205
  ],
193
206
  "commands": [
194
207
  {
195
208
  "name": "component",
196
209
  "description": "List components or print component docs",
197
- "arguments": [{"name": "name", "required": false, "variadic": false, "description": ""}],
198
- "options": [{"flag": "--props", "type": "boolean", "description": "Print only the props table"}],
210
+ "arguments": [
211
+ {
212
+ "name": "name",
213
+ "required": false,
214
+ "variadic": false,
215
+ "description": "",
216
+ },
217
+ ],
218
+ "options": [
219
+ {
220
+ "flag": "--props",
221
+ "type": "boolean",
222
+ "description": "Print only the props table",
223
+ },
224
+ ],
199
225
  "json": true,
200
- "responseTypes": ["component.list", "component.detail", "component.detail.props", "…"],
201
- "examples": ["astryx component Button --props --json"]
202
- }
226
+ "responseTypes": [
227
+ "component.list",
228
+ "component.detail",
229
+ "component.detail.props",
230
+ "…",
231
+ ],
232
+ "examples": ["astryx component Button --props --json"],
233
+ },
203
234
  // …one entry per command; subcommands (e.g. `theme build`) nest under `subcommands`
204
235
  ],
205
236
  "jsonSupported": ["component", "docs", "…"],
206
- "responseTypes": {"component": ["component.list", "…"], "theme build": ["theme.build"]}
207
- }
237
+ "responseTypes": {
238
+ "component": ["component.list", "…"],
239
+ "theme build": ["theme.build"],
240
+ },
241
+ },
208
242
  }
209
243
  ```
210
244
 
@@ -225,7 +259,15 @@ For the standalone manifest envelope (`type: "manifest"`), use `astryx manifest
225
259
  The same logic that powers `xds --json` is available as importable, type-safe functions:
226
260
 
227
261
  ```typescript
228
- import {component, docs, discover, template, hook, search, AstryxError} from '@astryxdesign/cli/api';
262
+ import {
263
+ component,
264
+ docs,
265
+ discover,
266
+ template,
267
+ hook,
268
+ search,
269
+ AstryxError,
270
+ } from '@astryxdesign/cli/api';
229
271
 
230
272
  // Same result as: xds --json component Button
231
273
  const btn = await component('Button');
@@ -359,16 +401,16 @@ No failures — but review the ⚠ warnings above when you can.
359
401
 
360
402
  ### Checks
361
403
 
362
- | Check | Status it can return | What it verifies |
363
- | -------------------- | -------------------- | ----------------------------------------------------------- |
364
- | Node.js version | pass / fail | Running Node meets the CLI's minimum |
365
- | @astryxdesign/core installed | pass / fail | `@astryxdesign/core` is resolvable from the project |
366
- | Version alignment | pass / warn / info | Installed `@astryxdesign/core` is in step with `@astryxdesign/cli` |
367
- | Theme packages | pass / warn | An `@astryxdesign/theme-*` package is installed and a theme is wired |
368
- | astryx.config.mjs | pass / fail / info | Config (if present) loads cleanly with a valid shape |
369
- | AI agent docs | pass / warn / info | Agent docs exist and contain the XDS section markers |
370
- | Peer dependencies | pass / warn / info | `@astryxdesign/core`'s peer deps (react, …) are installed |
371
- | Package manager | info | Reports the detected package manager |
404
+ | Check | Status it can return | What it verifies |
405
+ | ---------------------------- | -------------------- | -------------------------------------------------------------------- |
406
+ | Node.js version | pass / fail | Running Node meets the CLI's minimum |
407
+ | @astryxdesign/core installed | pass / fail | `@astryxdesign/core` is resolvable from the project |
408
+ | Version alignment | pass / warn / info | Installed `@astryxdesign/core` is in step with `@astryxdesign/cli` |
409
+ | Theme packages | pass / warn | An `@astryxdesign/theme-*` package is installed and a theme is wired |
410
+ | astryx.config.mjs | pass / fail / info | Config (if present) loads cleanly with a valid shape |
411
+ | AI agent docs | pass / warn / info | Agent docs exist and contain the XDS section markers |
412
+ | Peer dependencies | pass / warn / info | `@astryxdesign/core`'s peer deps (react, …) are installed |
413
+ | Package manager | info | Reports the detected package manager |
372
414
 
373
415
  ### CI gate
374
416
 
package/bin/astryx.mjs CHANGED
@@ -12,10 +12,25 @@
12
12
  //
13
13
  // `node-version.mjs` is intentionally dependency-free so it loads on the
14
14
  // unsupported runtimes this guard protects against.
15
- import {
16
- isNodeVersionSupported,
17
- unsupportedNodeMessage,
18
- } from '../src/lib/node-version.mjs';
15
+ //
16
+ // Sibling `src/` modules are resolved by this bin's REAL path. When the CLI is
17
+ // installed as a package, `npx astryx` runs this file through the
18
+ // `node_modules/.bin/astryx` symlink, and some Node versions resolve relative
19
+ // specifiers from the symlink's directory (→ `node_modules/src/...`) rather
20
+ // than the real package — breaking bare `../src/...` imports with a cryptic
21
+ // ERR_MODULE_NOT_FOUND. realpath-ing `import.meta.url` makes these imports
22
+ // resolve correctly however the bin is invoked (symlink, copy, or Windows
23
+ // shim). Uses only built-ins, so the version gate below still runs first.
24
+ import {fileURLToPath, pathToFileURL} from 'node:url';
25
+ import {realpathSync} from 'node:fs';
26
+ import {dirname, join} from 'node:path';
27
+
28
+ const binDir = dirname(realpathSync(fileURLToPath(import.meta.url)));
29
+ const importSrc = rel =>
30
+ import(pathToFileURL(join(binDir, '..', 'src', rel)).href);
31
+
32
+ const {isNodeVersionSupported, unsupportedNodeMessage} =
33
+ await importSrc('lib/node-version.mjs');
19
34
 
20
35
  if (!isNodeVersionSupported(process.versions.node)) {
21
36
  const msg = unsupportedNodeMessage(process.versions.node);
@@ -39,9 +54,9 @@ if (!isNodeVersionSupported(process.versions.node)) {
39
54
 
40
55
  // Imports that transitively load `styleText` must happen AFTER the gate above,
41
56
  // so they are dynamically imported here rather than at the top of the module.
42
- const {program} = await import('../src/index.mjs');
43
- const {isJsonMode, toErrorEnvelope} = await import('../src/lib/json.mjs');
44
- const {handleCommanderError} = await import('../src/lib/json-shim.mjs');
57
+ const {program} = await importSrc('index.mjs');
58
+ const {isJsonMode, toErrorEnvelope} = await importSrc('lib/json.mjs');
59
+ const {handleCommanderError} = await importSrc('lib/json-shim.mjs');
45
60
 
46
61
  /**
47
62
  * Top-level error boundary (contract guarantee #4): an uncaught throw must
@@ -88,7 +88,7 @@ import {VStack} from '@astryxdesign/core/Layout';
88
88
  export default function Page() {
89
89
  return (
90
90
  <VStack gap={2}>
91
- <Button label="Hello XDS" onClick={() => alert('Hi!')} />
91
+ <Button label="Hello Astryx" onClick={() => alert('Hi!')} />
92
92
  </VStack>
93
93
  );
94
94
  }`,
@@ -96,11 +96,11 @@ export default function Page() {
96
96
  ],
97
97
  },
98
98
  {
99
- title: 'Customize with xstyle',
99
+ title: 'Customize with StyleX',
100
100
  content: [
101
101
  {
102
102
  type: 'prose',
103
- text: 'Every component accepts an `xstyle` prop for StyleX style overrides created via `stylex.create()`.',
103
+ text: 'Astryx components support various styling solutions, from plain CSS and `className` to Tailwind and CSS-in-JS. See the [styling docs](/docs/styling) for the full guide. Astryx also has a deep integration with [StyleX](https://stylexjs.com/), an atomic CSS-in-JS library: create styles with `stylex.create()` and pass them to components with the `xstyle` prop.',
104
104
  },
105
105
  {
106
106
  type: 'code',
@@ -127,19 +127,19 @@ const overrides = stylex.create({
127
127
  type: 'table',
128
128
  headers: ['Example', 'Stack', 'Path'],
129
129
  rows: [
130
- ['Next.js', 'Next.js + theme CSS', 'apps/example-nextjs'],
131
- ['Next.js + StyleX', 'Next.js + StyleX for custom styles', 'apps/example-nextjs-stylex'],
132
- ['Next.js + Tailwind', 'Next.js + Tailwind bridge', 'apps/example-nextjs-tailwind'],
133
- ['Next.js Source', 'Next.js importing from source', 'apps/example-nextjs-source'],
134
- ['Vite', 'Vite', 'apps/example-vite'],
130
+ ['Next.js', 'Next.js + theme CSS', '[apps/example-nextjs](https://github.com/facebook/astryx/tree/main/apps/example-nextjs)'],
131
+ ['Next.js + StyleX', 'Next.js + StyleX for custom styles', '[apps/example-nextjs-stylex](https://github.com/facebook/astryx/tree/main/apps/example-nextjs-stylex)'],
132
+ ['Next.js + Tailwind', 'Next.js + Tailwind bridge', '[apps/example-nextjs-tailwind](https://github.com/facebook/astryx/tree/main/apps/example-nextjs-tailwind)'],
133
+ ['Next.js Source', 'Next.js importing from source', '[apps/example-nextjs-source](https://github.com/facebook/astryx/tree/main/apps/example-nextjs-source)'],
134
+ ['Vite', 'Vite', '[apps/example-vite](https://github.com/facebook/astryx/tree/main/apps/example-vite)'],
135
135
  ],
136
136
  },
137
137
  {
138
138
  type: 'code',
139
139
  lang: 'bash',
140
140
  label: 'Clone and run an example',
141
- code: `git clone https://github.com/facebookexperimental/xds.git
142
- cd xds/apps/example-nextjs
141
+ code: `git clone https://github.com/facebook/astryx.git
142
+ cd astryx/apps/example-nextjs
143
143
  pnpm install
144
144
  pnpm dev`,
145
145
  },
@@ -157,7 +157,7 @@ pnpm dev`,
157
157
  lang: 'json',
158
158
  label: 'package.json',
159
159
  code: `"scripts": {
160
- "xds": "node node_modules/@astryxdesign/cli/bin/astryx.mjs"
160
+ "astryx": "node node_modules/@astryxdesign/cli/bin/astryx.mjs"
161
161
  }`,
162
162
  },
163
163
  {
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file Icons reference doc: semantic icon names available in XDS
4
+ * @file Icons reference doc: semantic icon names available in Astryx
5
5
  */
6
6
 
7
7
  /** @type {import('../../core/src/docs-types').ReferenceDoc} */
@@ -234,7 +234,7 @@ export function AppRoot({children}: {children: React.ReactNode}) {
234
234
  type: 'code',
235
235
  lang: 'text',
236
236
  label: 'Paste this into your AI',
237
- code: `We are migrating this existing Tailwind/shadcn app to XDS incrementally.
237
+ code: `We are migrating this existing Tailwind/shadcn app to Astryx incrementally.
238
238
 
239
239
  First run:
240
240
  - npx astryx docs migration --dense
@@ -242,7 +242,7 @@ First run:
242
242
  - npx astryx docs styling --dense
243
243
  - npx astryx template AppShellTopNavWithSideNav --skeleton
244
244
 
245
- Then migrate one route or shell surface at a time. Keep business logic and routing intact. Replace shadcn/Radix/Tailwind primitives with XDS components, remove hardcoded colors, verify light and dark mode, and take screenshots before moving to the next surface.`,
245
+ Then migrate one route or shell surface at a time. Keep business logic and routing intact. Replace shadcn/Radix/Tailwind primitives with Astryx components, remove hardcoded colors, verify light and dark mode, and take screenshots before moving to the next surface.`,
246
246
  },
247
247
  ],
248
248
  },
@@ -44,7 +44,7 @@ export const docs = {
44
44
  type: 'code',
45
45
  lang: 'css',
46
46
  label: 'Concentric radius formula',
47
- code: `/* Automatic in XDS Card */
47
+ code: `/* Automatic in Astryx Card */
48
48
  --card-concentric-radius: max(0px, calc(var(--_card-radius) - var(--card-padding)));`,
49
49
  },
50
50
  ],
@@ -22,9 +22,8 @@ export const docs = {
22
22
  type: 'table',
23
23
  headers: ['Approach', 'Use for', 'Example'],
24
24
  rows: [
25
- ['xstyle prop', 'Overriding a specific component', 'xstyle={styles.override}'],
25
+ ['StyleX', 'Component-specific overrides, reusable styles, pseudo-classes, and typed tokens', 'const styles = stylex.create(...); <Button xstyle={styles.save} />'],
26
26
  ['Tailwind utilities', 'Layout, wrappers, and utility styling', 'className="flex gap-3 p-4"'],
27
- ['stylex.create', 'Reusable styles, pseudo-classes, typed tokens', 'stylex.create({ card: { ... } })'],
28
27
  ['className', 'Integrating with external CSS or Tailwind on components', 'className="my-card shadow-lg"'],
29
28
  ['Styling-library token aliases', 'Keeping Panda, Chakra, MUI, Emotion, styled-components, UnoCSS, CSS Modules, or Sass in sync with the system', "colors.surface = 'var(--color-background-surface)'"],
30
29
  ],
@@ -232,7 +231,7 @@ const overrides = stylex.create({
232
231
  content: [
233
232
  {
234
233
  type: 'prose',
235
- text: 'When external CSS needs to target an XDS component by prop or state, combine the stable component class with reflected data attributes. The component class identifies the component (`.astryx-button`, `.astryx-card`); data attributes identify the axis and value (`data-variant`, `data-size`, `data-level`, etc.). This is the preferred selector surface for new CSS because it is explicit and collision-resistant.',
234
+ text: 'When external CSS needs to target an Astryx component by prop or state, combine the stable component class with reflected data attributes. The component class identifies the component (`.astryx-button`, `.astryx-card`); data attributes identify the axis and value (`data-variant`, `data-size`, `data-level`, etc.). This is the preferred selector surface for new CSS because it is explicit and collision-resistant.',
236
235
  },
237
236
  {
238
237
  type: 'code',
@@ -274,7 +273,7 @@ const overrides = stylex.create({
274
273
  content: [
275
274
  {
276
275
  type: 'prose',
277
- text: 'XDS still emits legacy bare prop/state classes such as `.primary`, `.sm`, `.level-2`, and `.checked` for compatibility with existing apps and built themes. Do not write new CSS against these bare classes. The stable base component classes (`.astryx-button`, `.astryx-card`, etc.) are not deprecated; only the unprefixed prop/state classes are the legacy surface.',
276
+ text: 'Astryx still emits legacy bare prop/state classes such as `.primary`, `.sm`, `.level-2`, and `.checked` for compatibility with existing apps and built themes. Do not write new CSS against these bare classes. The stable base component classes (`.astryx-button`, `.astryx-card`, etc.) are not deprecated; only the unprefixed prop/state classes are the legacy surface.',
278
277
  },
279
278
  {
280
279
  type: 'code',
@@ -5,8 +5,8 @@
5
5
  export const docsDense = {
6
6
  description: 'Theme provider, custom themes, light/dark, component overrides',
7
7
  sections: [
8
- { title: 'Quick Start', content: [null, null, { type: 'prose', text: 'default import = runtime injection. /built import = pre-compiled CSS (pair with theme.css).' }] },
9
- { title: 'Themes', content: [null, { type: 'prose', text: 'published: neutral (start here), butter, chocolate, gothic (dark-only), matcha, stone, y2k. @astryxdesign/theme-{name} = source (runtime). @astryxdesign/theme-{name}/built = optimized (+ theme.css).' }] },
8
+ { title: 'Quick Start', content: [null, null, null, null, { type: 'prose', text: 'default import = runtime injection. /built import = pre-compiled CSS (pair with theme.css).' }] },
9
+ { title: 'Themes', content: [null, null, { type: 'prose', text: 'published: neutral (start here), butter, chocolate, gothic (dark-only), matcha, stone, y2k. @astryxdesign/theme-{name} = source (runtime). @astryxdesign/theme-{name}/built = optimized (+ theme.css).' }] },
10
10
  { title: 'Props', content: [null] },
11
11
  { title: 'Custom Theme', content: [{ type: 'prose', text: 'CLI wizard or manual defineTheme. only override tokens that differ.' }, null] },
12
12
  { title: 'defineTheme', content: [{ type: 'prose', text: 'scale configs (color, typography, radius, motion) + explicit token overrides + component overrides. color derives full palette from accent hex via HCT.' }, null, null] },
@@ -14,6 +14,12 @@ export const docs = {
14
14
  title: 'Quick Start',
15
15
  category: 'guide',
16
16
  content: [
17
+ {
18
+ type: 'code',
19
+ lang: 'bash',
20
+ label: 'Install a theme package',
21
+ code: 'npm install @astryxdesign/theme-neutral',
22
+ },
17
23
  {
18
24
  type: 'code',
19
25
  lang: 'tsx',
@@ -45,6 +51,10 @@ function App() {
45
51
  );
46
52
  }`,
47
53
  },
54
+ {
55
+ type: 'prose',
56
+ text: 'Each theme ships as its own npm package. Install the one you want, then wrap your app in `<Theme>` — the same pattern works for every theme; just swap the package and import name.',
57
+ },
48
58
  {
49
59
  type: 'prose',
50
60
  text: 'The default import uses runtime style injection, which works everywhere with no build step. The `/built` import skips injection and relies on the pre-compiled CSS file for better performance and SSR support.',
@@ -55,6 +65,10 @@ function App() {
55
65
  title: 'Available Themes',
56
66
  category: 'guide',
57
67
  content: [
68
+ {
69
+ type: 'prose',
70
+ text: 'Install the theme package you want with `npm install @astryxdesign/theme-{name}`, then import its theme object as shown below.',
71
+ },
58
72
  {
59
73
  type: 'table',
60
74
  headers: ['Theme', 'Import', 'Description'],
@@ -5,8 +5,8 @@
5
5
  export const docsZh = {
6
6
  description: 'Theme 提供者、自定义主题、亮/暗模式和组件样式覆盖。',
7
7
  sections: [
8
- { title: '快速开始', content: [null, null, { type: 'prose', text: '默认导入使用运行时样式注入。/built 导入使用预编译 CSS(需配合 theme.css)。' }] },
9
- { title: '可用主题', content: [null, { type: 'prose', text: '已发布主题:neutral(推荐起点)、butter、chocolate、gothic(仅暗色)、matcha、stone、y2k。@astryxdesign/theme-{name} = 源码版(运行时注入)。@astryxdesign/theme-{name}/built = 优化版(配合 theme.css)。' }] },
8
+ { title: '快速开始', content: [null, null, null, null, { type: 'prose', text: '默认导入使用运行时样式注入。/built 导入使用预编译 CSS(需配合 theme.css)。' }] },
9
+ { title: '可用主题', content: [null, null, { type: 'prose', text: '已发布主题:neutral(推荐起点)、butter、chocolate、gothic(仅暗色)、matcha、stone、y2k。@astryxdesign/theme-{name} = 源码版(运行时注入)。@astryxdesign/theme-{name}/built = 优化版(配合 theme.css)。' }] },
10
10
  { title: 'Theme 属性', content: [null] },
11
11
  { title: '创建自定义主题', content: [{ type: 'prose', text: '使用 CLI 向导(推荐)或手动 defineTheme。只覆盖与默认值不同的令牌。' }, null] },
12
12
  { title: 'defineTheme', content: [{ type: 'prose', text: '支持比例配置(typography、radius、motion)+ 显式令牌覆盖 + 组件覆盖。' }, null, null] },
@@ -34,7 +34,7 @@ export const docs = {
34
34
  type: 'code',
35
35
  lang: 'text',
36
36
  label: 'Paste this into your AI',
37
- code: 'Install @astryxdesign/cli and run `npx astryx agent-docs` to set up your XDS context. Read the generated file.',
37
+ code: 'Install @astryxdesign/cli and run `npx astryx agent-docs` to set up your Astryx context. Read the generated file.',
38
38
  },
39
39
  {
40
40
  type: 'prose',
@@ -103,7 +103,7 @@ npx astryx agent-docs --agent-docs-path ~/.cursor/rules/xds.mdc`,
103
103
  type: 'code',
104
104
  lang: 'text',
105
105
  label: 'Paste this into your AI',
106
- code: `Before writing any XDS code, check your knowledge:
106
+ code: `Before writing any Astryx code, check your knowledge:
107
107
 
108
108
  1. What is the correct import path for Button?
109
109
  2. How do you make an Dialog non-dismissible?
@@ -165,7 +165,7 @@ npx astryx docs tokens --dense`,
165
165
  content: [
166
166
  {
167
167
  type: 'prose',
168
- text: 'XDS ships a Model Context Protocol (MCP) server that any MCP-compatible AI tool can connect to. Instead of manually pasting CLI output, the AI can query the XDS design system directly, searching for components, reading full documentation, and pulling code examples on demand.',
168
+ text: 'Astryx ships a Model Context Protocol (MCP) server that any MCP-compatible AI tool can connect to. Instead of manually pasting CLI output, the AI can query the Astryx design system directly, searching for components, reading full documentation, and pulling code examples on demand.',
169
169
  },
170
170
  {
171
171
  type: 'prose',
@@ -183,7 +183,7 @@ npx astryx docs tokens --dense`,
183
183
  "mcpServers": {
184
184
  "xds": {
185
185
  "type": "url",
186
- "url": "https://astryx.meta.com/mcp"
186
+ "url": "https://astryx.atmeta.com/mcp"
187
187
  }
188
188
  }
189
189
  }`,