@astryxdesign/cli 0.7.2-canary.b06a093 → 0.7.2-canary.b40ba52

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 (289) hide show
  1. package/README.md +20 -19
  2. package/api/build/help/help.mjs +1 -1
  3. package/api/component/_adapter.d.mts +41 -1
  4. package/api/component/_adapter.mjs +93 -7
  5. package/api/component/component.mjs +22 -5
  6. package/api/component/component.test.mjs +420 -167
  7. package/api/component/integration-export-name.test.mjs +644 -0
  8. package/api/component/list/list.mjs +42 -4
  9. package/api/discover/_adapter.d.mts +119 -12
  10. package/api/discover/_adapter.mjs +449 -10
  11. package/api/discover/_adapter.test.mjs +599 -17
  12. package/api/discover/_catalog-view.d.mts +16 -5
  13. package/api/discover/_catalog-view.mjs +32 -8
  14. package/api/discover/discover.d.mts +11 -0
  15. package/api/discover/discover.doc.mjs +7 -6
  16. package/api/discover/discover.mjs +107 -19
  17. package/api/discover/discover.type.d.mts +18 -7
  18. package/api/discover/discover.type.mjs +15 -7
  19. package/api/discover/list/list.d.mts +4 -3
  20. package/api/discover/list/list.mjs +17 -10
  21. package/api/docs/_adapter.d.mts +11 -0
  22. package/api/docs/_adapter.mjs +244 -1
  23. package/api/docs/integrationDocs.test.mjs +124 -0
  24. package/api/doctor/doctor.mjs +27 -3
  25. package/api/doctor/doctor.test.mjs +43 -0
  26. package/api/doctor/theme-checks.mjs +1 -1
  27. package/api/doctor/theme-checks.test.mjs +136 -0
  28. package/api/gap-report/gap-report.d.mts +3 -0
  29. package/api/gap-report/gap-report.doc.mjs +11 -3
  30. package/api/gap-report/gap-report.mjs +219 -52
  31. package/api/gap-report/gap-report.test.mjs +233 -0
  32. package/api/gap-report/gap-report.type.d.mts +41 -0
  33. package/api/gap-report/gap-report.type.mjs +18 -0
  34. package/api/index.d.mts +2 -0
  35. package/api/index.mjs +2 -0
  36. package/api/init/run/run.mjs +2 -2
  37. package/api/integration/_adapter.d.mts +12 -0
  38. package/api/integration/_adapter.mjs +54 -0
  39. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  40. package/api/integration/add-contribution.mjs +8 -4
  41. package/api/integration/add-contribution.test.mjs +4 -2
  42. package/api/integration/authoring-checks.mjs +11 -2
  43. package/api/integration/authoring-checks.test.mjs +39 -0
  44. package/api/integration/authoring-checks.type.d.mts +9 -0
  45. package/api/integration/authoring-checks.type.mjs +14 -1
  46. package/api/integration/check/check.d.mts +96 -0
  47. package/api/integration/check/check.mjs +357 -0
  48. package/api/integration/check/check.test.mjs +489 -0
  49. package/api/integration/integration-check.type.d.mts +118 -0
  50. package/api/integration/integration-check.type.mjs +84 -0
  51. package/api/integration/integrationCheck.doc.d.mts +10 -0
  52. package/api/integration/integrationCheck.doc.mjs +73 -0
  53. package/api/integration/integrationComponentConflicts.doc.mjs +43 -6
  54. package/api/integration/pack-check.mjs +353 -114
  55. package/api/integration/pack-check.test.mjs +700 -0
  56. package/api/integration/validate-integration.mjs +8 -0
  57. package/api/integration/validate-integration.test.mjs +11 -0
  58. package/api/integration/validate-integration.type.d.mts +8 -0
  59. package/api/integration/validate-integration.type.mjs +12 -1
  60. package/api/integration/validateIntegration.doc.mjs +19 -3
  61. package/api/search/search.d.mts +81 -12
  62. package/api/search/search.domain-priority.test.mjs +108 -18
  63. package/api/search/search.integration-check.test.mjs +24 -0
  64. package/api/search/search.mjs +609 -53
  65. package/api/search/search.test.mjs +175 -0
  66. package/api/swizzle/copy/copy.mjs +28 -14
  67. package/api/template/template.test.mjs +120 -3
  68. package/api/theme/build/build.family.test.mjs +64 -0
  69. package/api/theme/build/build.mjs +180 -24
  70. package/api/theme/themeBuild.doc.mjs +4 -4
  71. package/api/upgrade/_adapter.d.mts +40 -2
  72. package/api/upgrade/_adapter.mjs +117 -4
  73. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  74. package/api/upgrade/run/run.mjs +30 -1
  75. package/api/upgrade/status/status.d.mts +21 -5
  76. package/api/upgrade/status/status.mjs +45 -8
  77. package/api/upgrade/upgrade.doc.mjs +5 -3
  78. package/api/upgrade/upgrade.type.d.mts +23 -0
  79. package/api/upgrade/upgrade.type.mjs +16 -1
  80. package/assets/codemods/runner.mjs +7 -1
  81. package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
  82. package/assets/codemods/transforms/next/index.mjs +11 -1
  83. package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
  84. package/assets/discover/official-packages.json +367 -0
  85. package/assets/docs/README.md +10 -0
  86. package/assets/docs/author-a-theme.doc.mjs +1 -1
  87. package/assets/docs/getting-started.doc.mjs +3 -3
  88. package/assets/docs/styling-overview.doc.mjs +1 -1
  89. package/assets/docs/theme.doc.dense.mjs +1 -1
  90. package/assets/docs/theme.doc.mjs +1 -1
  91. package/assets/docs/theme.doc.zh.mjs +1 -1
  92. package/assets/docs/tree/add-a-component.doc.mjs +11 -1
  93. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  94. package/assets/docs/tree/add-a-topic.doc.mjs +10 -7
  95. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  96. package/assets/docs/tree/block-template.doc.mjs +8 -20
  97. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  98. package/assets/docs/tree/check-the-props.doc.mjs +196 -0
  99. package/assets/docs/tree/check-your-docs.doc.mjs +51 -5
  100. package/assets/docs/tree/checks.doc.mjs +24 -16
  101. package/assets/docs/tree/codemods.doc.mjs +4 -4
  102. package/assets/docs/tree/component-family.doc.mjs +8 -6
  103. package/assets/docs/tree/component-imports.doc.mjs +10 -2
  104. package/assets/docs/tree/components.doc.mjs +1 -1
  105. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -16
  106. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  107. package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
  108. package/assets/docs/tree/docs.doc.mjs +3 -3
  109. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  110. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  111. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  112. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  113. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  114. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  115. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  116. package/assets/docs/tree/integrations.doc.mjs +8 -0
  117. package/assets/docs/tree/links.doc.mjs +6 -5
  118. package/assets/docs/tree/migration-setup.doc.mjs +1 -0
  119. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  120. package/assets/docs/tree/migration.doc.mjs +0 -1
  121. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  122. package/assets/docs/tree/page-template.doc.mjs +4 -8
  123. package/assets/docs/tree/publishing.doc.mjs +1 -1
  124. package/assets/docs/tree/quick-start.doc.mjs +37 -21
  125. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  126. package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
  127. package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
  128. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  129. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  130. package/assets/docs/tree/single-component.doc.mjs +15 -6
  131. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  132. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  133. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  134. package/assets/docs/tree/template-doc-overview.doc.mjs +4 -15
  135. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  136. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  137. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  138. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  139. package/assets/docs/tree/templates.doc.mjs +1 -1
  140. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  141. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  142. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  143. package/assets/docs/tree/troubleshooting.doc.mjs +13 -5
  144. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  145. package/assets/docs/tree/upgrading.doc.mjs +3 -3
  146. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  147. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  148. package/assets/docs/tree/versioning.doc.mjs +7 -6
  149. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
  150. package/assets/docs/use-a-theme.doc.mjs +2 -2
  151. package/assets/docs/working-with-ai.doc.mjs +43 -4
  152. package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
  153. package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
  154. package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
  155. package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
  156. package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
  157. package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
  158. package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
  159. package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
  160. package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
  161. package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
  162. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
  163. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
  164. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
  165. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
  166. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
  167. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
  168. package/assets/templates/pages/detail-page/page.tsx +3 -3
  169. package/assets/templates/pages/table-inbox/page.tsx +10 -8
  170. package/assets/theme.template.ts +1 -1
  171. package/authoring/codemod/codemod.doc.mjs +7 -3
  172. package/authoring/config/config.doc.mjs +9 -6
  173. package/authoring/config/type.ts +4 -2
  174. package/authoring/discover/discover.doc.mjs +1 -1
  175. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  176. package/authoring/doctypes/base/type.ts +6 -0
  177. package/authoring/doctypes/command/command.doc.mjs +14 -12
  178. package/authoring/doctypes/component/component.doc.mjs +31 -28
  179. package/authoring/doctypes/component/type.ts +13 -8
  180. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  181. package/authoring/doctypes/function/function.doc.mjs +9 -8
  182. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  183. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  184. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  185. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  186. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  187. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  188. package/authoring/doctypes/template/parse.d.mts +6 -2
  189. package/authoring/doctypes/template/parse.mjs +3 -1
  190. package/authoring/doctypes/template/template.doc.mjs +3 -3
  191. package/authoring/doctypes/template/type.ts +22 -0
  192. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  193. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  194. package/authoring/identity/identity.doc.mjs +3 -3
  195. package/authoring/index.d.ts +1 -0
  196. package/authoring/integration/integration.doc.mjs +12 -4
  197. package/authoring/integration/parse.test.mjs +10 -0
  198. package/authoring/integration/schema.d.mts +2 -0
  199. package/authoring/integration/schema.mjs +1 -0
  200. package/authoring/integration/type.ts +4 -0
  201. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  202. package/clients/cli/commands/build-theme.mjs +1 -1
  203. package/clients/cli/commands/build-theme.path-safety.test.mjs +224 -6
  204. package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
  205. package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
  206. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  207. package/clients/cli/commands/discover.doc.mjs +1 -1
  208. package/clients/cli/commands/discover.mjs +144 -93
  209. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  210. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  211. package/clients/cli/commands/doctor-integration-components.doc.mjs +17 -4
  212. package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
  213. package/clients/cli/commands/doctor-integration.test.mjs +837 -0
  214. package/clients/cli/commands/doctor.mjs +190 -0
  215. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  216. package/clients/cli/commands/gap-report.mjs +24 -2
  217. package/clients/cli/commands/gap-report.test.mjs +79 -0
  218. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  219. package/clients/cli/commands/integration-check.test.mjs +284 -0
  220. package/clients/cli/commands/integration.doc.mjs +6 -2
  221. package/clients/cli/commands/integration.mjs +106 -1
  222. package/clients/cli/commands/json-contract.test.mjs +5 -1
  223. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  224. package/clients/cli/commands/swizzle.mjs +5 -3
  225. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  226. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  227. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  228. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  229. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  230. package/clients/cli/index.mjs +30 -5
  231. package/clients/cli/lib/component-format.mjs +5 -1
  232. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  233. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  234. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  235. package/foundation/agent-docs/agent-docs.mjs +8 -6
  236. package/foundation/config/project.mjs +82 -0
  237. package/foundation/discovery/authoring-self-docs.mjs +2 -1
  238. package/foundation/discovery/component-discovery.d.mts +190 -10
  239. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  240. package/foundation/discovery/component-discovery.mjs +864 -56
  241. package/foundation/discovery/component-discovery.test.mjs +96 -0
  242. package/foundation/discovery/component-replacement.mjs +18 -0
  243. package/foundation/discovery/component-replacement.test.mjs +40 -0
  244. package/foundation/discovery/doc-types.d.mts +157 -0
  245. package/foundation/discovery/doc-types.mjs +1224 -0
  246. package/foundation/discovery/doc-types.test.mjs +700 -0
  247. package/foundation/discovery/docs-discovery.d.mts +81 -0
  248. package/foundation/discovery/docs-discovery.mjs +57 -0
  249. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  250. package/foundation/discovery/integration-doc-files.mjs +231 -0
  251. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  252. package/foundation/discovery/module-exports.d.mts +27 -0
  253. package/foundation/discovery/module-exports.mjs +356 -31
  254. package/foundation/discovery/module-exports.test.mjs +172 -0
  255. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  256. package/foundation/discovery/package-tsconfig.mjs +228 -0
  257. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  258. package/foundation/discovery/project-typescript.d.mts +32 -0
  259. package/foundation/discovery/project-typescript.mjs +89 -0
  260. package/foundation/discovery/prop-drift.d.mts +278 -0
  261. package/foundation/discovery/prop-drift.mjs +2263 -0
  262. package/foundation/discovery/prop-drift.test.mjs +2272 -0
  263. package/foundation/discovery/template-adapter.mjs +74 -5
  264. package/foundation/discovery/type-match.d.mts +53 -0
  265. package/foundation/discovery/type-match.mjs +660 -0
  266. package/foundation/discovery/type-match.test.mjs +169 -0
  267. package/foundation/discovery/type-text.d.mts +68 -0
  268. package/foundation/discovery/type-text.mjs +658 -0
  269. package/foundation/discovery/type-text.test.mjs +196 -0
  270. package/foundation/discovery/unresolved-references.d.mts +62 -0
  271. package/foundation/discovery/unresolved-references.mjs +790 -0
  272. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  273. package/foundation/doc-compiler/doc-loads.test.mjs +15 -1
  274. package/foundation/doc-compiler/inputs.mjs +23 -0
  275. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  276. package/foundation/doc-compiler/links.d.mts +9 -5
  277. package/foundation/doc-compiler/links.mjs +4 -2
  278. package/foundation/env/package-manager.d.mts +32 -0
  279. package/foundation/env/package-manager.mjs +47 -0
  280. package/foundation/env/package-manager.test.mjs +194 -7
  281. package/foundation/fs/module-loader.d.mts +2 -1
  282. package/foundation/fs/module-loader.mjs +60 -4
  283. package/foundation/fs/module-loader.test.mjs +194 -0
  284. package/foundation/integrations/contribution-inventory.mjs +6 -1
  285. package/foundation/response/response-types.doc.mjs +13 -7
  286. package/foundation/xle/registry.mjs +4 -0
  287. package/foundation/xle/registry.test.mjs +28 -0
  288. package/package.json +10 -10
  289. package/scripts/postinstall.mjs +3 -3
@@ -9,6 +9,7 @@ import {pathToFileURL} from 'node:url';
9
9
  import {z} from 'zod';
10
10
  import {
11
11
  findPresentFiles,
12
+ importThemeArtifact,
12
13
  importUserModule,
13
14
  loadModuleWithParser,
14
15
  } from './module-loader.mjs';
@@ -155,6 +156,199 @@ process.stdout.write(JSON.stringify({first: first.default?.answer, fresh: fresh.
155
156
  });
156
157
  });
157
158
 
159
+ describe('importThemeArtifact', () => {
160
+ const STYLESHEET_RAN = '__astryxThemeArtifactStylesheetRan';
161
+
162
+ /** @param {string} file @param {string} content */
163
+ function write(file, content) {
164
+ const target = path.join(tmpDir, file);
165
+ fs.mkdirSync(path.dirname(target), {recursive: true});
166
+ fs.writeFileSync(target, content);
167
+ }
168
+
169
+ beforeEach(() => {
170
+ write('package.json', JSON.stringify({type: 'module'}));
171
+ write(
172
+ 'ocean.css',
173
+ '[data-astryx-theme="ocean"] { --color-text: black; }\n',
174
+ );
175
+ });
176
+
177
+ afterEach(() => {
178
+ Reflect.deleteProperty(globalThis, STYLESHEET_RAN);
179
+ });
180
+
181
+ it('loads a built module that imports its stylesheet, without running the stylesheet', async () => {
182
+ // Valid JavaScript, so running this stylesheet would leave a trace.
183
+ write('ran.css', `globalThis.${STYLESHEET_RAN} = true;\n`);
184
+ write(
185
+ 'ocean.js',
186
+ "import './ocean.css';\nimport './ran.css';\nexport const oceanTheme = {name: 'ocean'};\n",
187
+ );
188
+
189
+ const mod = await importThemeArtifact('./ocean.js', tmpDir);
190
+
191
+ expect(mod.oceanTheme).toEqual({name: 'ocean'});
192
+ expect(Reflect.get(globalThis, STYLESHEET_RAN)).toBeUndefined();
193
+ });
194
+
195
+ it('loads a CommonJS built module that requires its stylesheet', async () => {
196
+ write('commonjs/package.json', JSON.stringify({type: 'commonjs'}));
197
+ write(
198
+ 'commonjs/ocean.css',
199
+ '[data-astryx-theme="ocean"] { --color-text: black; }\n',
200
+ );
201
+ write(
202
+ 'commonjs/ocean.js',
203
+ "require('./ocean.css');\nexports.oceanTheme = {name: 'ocean'};\n",
204
+ );
205
+
206
+ const mod = await importThemeArtifact('./commonjs/ocean.js', tmpDir);
207
+
208
+ expect(mod.oceanTheme).toEqual({name: 'ocean'});
209
+ });
210
+
211
+ it('loads stylesheets imported by a nested module, through a package export, and dynamically', async () => {
212
+ const packageDir = 'node_modules/@acme/themes';
213
+ write(
214
+ `${packageDir}/package.json`,
215
+ JSON.stringify({
216
+ name: '@acme/themes',
217
+ type: 'module',
218
+ exports: {
219
+ './themes/ocean': './dist/ocean.js',
220
+ './themes/ocean.css': './dist/ocean.css',
221
+ },
222
+ }),
223
+ );
224
+ write(
225
+ `${packageDir}/dist/ocean.css`,
226
+ '[data-astryx-theme="ocean"] { --color-text: black; }\n',
227
+ );
228
+ write(
229
+ `${packageDir}/dist/tokens.js`,
230
+ "import '@acme/themes/themes/ocean.css';\nexport const tokens = {};\n",
231
+ );
232
+ write(
233
+ `${packageDir}/dist/ocean.js`,
234
+ "import {tokens} from './tokens.js';\nawait import('./ocean.css');\nexport const oceanTheme = {name: 'ocean', tokens};\n",
235
+ );
236
+
237
+ const mod = await importThemeArtifact('@acme/themes/themes/ocean', tmpDir);
238
+
239
+ expect(mod.oceanTheme).toEqual({name: 'ocean', tokens: {}});
240
+ });
241
+
242
+ it('still resolves an extensionless import to its directory index beside a same-named stylesheet', async () => {
243
+ write('ocean/index.js', "export const oceanTheme = {name: 'ocean'};\n");
244
+ write(
245
+ 'entry.js',
246
+ "import './ocean.css';\nexport {oceanTheme} from './ocean';\n",
247
+ );
248
+
249
+ const mod = await importThemeArtifact('./entry.js', tmpDir);
250
+
251
+ expect(mod.oceanTheme).toEqual({name: 'ocean'});
252
+ });
253
+
254
+ it('loads a module whose import ends in .css but names a JavaScript file', async () => {
255
+ write('tokens.css.js', "export const vars = {accent: 'blue'};\n");
256
+ write(
257
+ 'ocean.js',
258
+ "import './ocean.css';\nimport {vars} from './tokens.css';\nexport const oceanTheme = {name: 'ocean', vars};\n",
259
+ );
260
+
261
+ const mod = await importThemeArtifact('./ocean.js', tmpDir);
262
+
263
+ expect(mod.oceanTheme).toEqual({name: 'ocean', vars: {accent: 'blue'}});
264
+ });
265
+
266
+ it.each([
267
+ ['a missing file', "import './fonts.css';\n", /fonts\.css/],
268
+ [
269
+ 'a package that is not installed',
270
+ "import '@acme/missing-fonts/inter.css';\n",
271
+ /@acme\/missing-fonts\/inter\.css/,
272
+ ],
273
+ ])(
274
+ 'still rejects a stylesheet import of %s',
275
+ async (_label, stylesheetImport, expected) => {
276
+ write(
277
+ 'ocean.js',
278
+ `import './ocean.css';\n${stylesheetImport}export const oceanTheme = {name: 'ocean'};\n`,
279
+ );
280
+
281
+ await expect(importThemeArtifact('./ocean.js', tmpDir)).rejects.toThrow(
282
+ expected,
283
+ );
284
+ },
285
+ );
286
+
287
+ it('still rejects a theme module path that names a stylesheet', async () => {
288
+ await expect(importThemeArtifact('./ocean.css', tmpDir)).rejects.toThrow(
289
+ /Unknown file extension "\.css"/,
290
+ );
291
+ });
292
+
293
+ it('still rejects a stylesheet import that its package does not export', async () => {
294
+ const packageDir = 'node_modules/@acme/themes';
295
+ write(
296
+ `${packageDir}/package.json`,
297
+ JSON.stringify({
298
+ name: '@acme/themes',
299
+ type: 'module',
300
+ exports: {'./themes/ocean': './dist/ocean.js'},
301
+ }),
302
+ );
303
+ write(
304
+ `${packageDir}/dist/ocean.css`,
305
+ '[data-astryx-theme="ocean"] { --color-text: black; }\n',
306
+ );
307
+ write(
308
+ `${packageDir}/dist/ocean.js`,
309
+ "import '@acme/themes/themes/ocean.css';\nexport const oceanTheme = {name: 'ocean'};\n",
310
+ );
311
+
312
+ await expect(
313
+ importThemeArtifact('@acme/themes/themes/ocean', tmpDir),
314
+ ).rejects.toThrow(/not defined by "exports"/);
315
+ });
316
+
317
+ it.each([
318
+ [
319
+ 'a missing dependency',
320
+ "import './missing.js';\nexport const oceanTheme = {name: 'ocean'};\n",
321
+ /missing\.js/,
322
+ ],
323
+ [
324
+ 'a syntax error in a module it imports',
325
+ "import './broken.js';\nexport const oceanTheme = {name: 'ocean'};\n",
326
+ /ParseError/,
327
+ ],
328
+ [
329
+ 'a throwing module',
330
+ "throw new Error('broken theme module');\n",
331
+ /broken theme module/,
332
+ ],
333
+ [
334
+ 'an asset that is not a stylesheet',
335
+ "import './logo.svg';\nexport const oceanTheme = {name: 'ocean'};\n",
336
+ /Unknown file extension "\.svg"/,
337
+ ],
338
+ ])(
339
+ 'still rejects a built module that imports its stylesheet and has %s',
340
+ async (_label, rest, expected) => {
341
+ write('logo.svg', '<svg xmlns="http://www.w3.org/2000/svg"/>\n');
342
+ write('broken.js', 'export const broken = ;\n');
343
+ write('ocean.js', `import './ocean.css';\n${rest}`);
344
+
345
+ await expect(importThemeArtifact('./ocean.js', tmpDir)).rejects.toThrow(
346
+ expected,
347
+ );
348
+ },
349
+ );
350
+ });
351
+
158
352
  describe('loadModuleWithParser', () => {
159
353
  // Temp module files live under a repo-local dir (not /tmp): Vite's dynamic
160
354
  // import blocks /tmp, so we mirror the existing repo-local temp pattern.
@@ -248,11 +248,16 @@ export async function collectIdentities(loaded) {
248
248
  if (loaded.components && fs.existsSync(loaded.components)) {
249
249
  try {
250
250
  const records = discoverIntegrationComponents(loaded) ?? [];
251
+ // A family doc backs several records: load it, and report it, once.
252
+ const loads = new Map();
251
253
  for (const record of records) {
254
+ const first = !loads.has(record.docPath);
255
+ if (first) loads.set(record.docPath, loadComponentDoc(record.docPath));
252
256
  try {
253
- await loadComponentDoc(record.docPath);
257
+ await loads.get(record.docPath);
254
258
  identities.components.push(record.name);
255
259
  } catch (err) {
260
+ if (!first) continue;
256
261
  errors.push({
257
262
  kind: 'components',
258
263
  message: `${path.relative(loaded.components, record.docPath)}: ${
@@ -112,7 +112,7 @@ export const doc = {
112
112
  {
113
113
  value: 'discover.list',
114
114
  description:
115
- 'The integrations the project loads (name, category, components, version, a list per other kind they add, and latest when a source knows it); with a discover source, meta.available lists what the project could add and meta.sources reports each source; when empty it carries meta.configured to tell "nothing configured" from "nothing discovered".',
115
+ 'What the project has, the integrations it loads and the official packages it declares, official packages first (name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered".',
116
116
  },
117
117
  {
118
118
  value: 'discover.detail',
@@ -169,12 +169,13 @@ export const doc = {
169
169
  // gap reports
170
170
  {
171
171
  value: 'gap-report.categories',
172
- description: 'The fixed gap category values and human-readable labels.',
172
+ description:
173
+ 'The fixed gap category values and human-readable labels; when a loaded integration names its own issues URL, meta.destinations lists every destination ({to, default, issuesUrl}) and meta.ask tells an agent to ask the person.',
173
174
  },
174
175
  {
175
176
  value: 'gap-report.file',
176
177
  description:
177
- 'An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project | integration | fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals.',
178
+ 'An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project | integration | fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals; without --to, when a loaded integration names its own issues URL, destinations and ask as on gap-report.categories.',
178
179
  },
179
180
 
180
181
  // template
@@ -283,12 +284,12 @@ export const doc = {
283
284
  {
284
285
  value: 'upgrade.status',
285
286
  description:
286
- 'A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary.',
287
+ 'A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. no_codemods and config_fixable carry cliBehindCore ({cliVersion, command}) when the installed Core is newer than the CLI, which then has no codemods for the releases after its own version.',
287
288
  },
288
289
  {
289
290
  value: 'upgrade.run',
290
291
  description:
291
- 'The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors.',
292
+ 'The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. When the installed Core is newer than the CLI, it also carries cliBehindCore ({cliVersion, command}): codemods for the releases after cliVersion did not run.',
292
293
  },
293
294
 
294
295
  // manifest
@@ -332,7 +333,7 @@ export const doc = {
332
333
  {
333
334
  value: 'integration.validate',
334
335
  description:
335
- 'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}.',
336
+ 'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}. When the manifest loads, docTypes checks each doc against its published authoring type: status (checked | skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked).',
336
337
  },
337
338
  {
338
339
  value: 'integration.template-conflicts',
@@ -342,12 +343,17 @@ export const doc = {
342
343
  {
343
344
  value: 'integration.component-conflicts',
344
345
  description:
345
- 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command.',
346
+ 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked | skipped), reason, typescript, components, typesCompared, typesSkipped, findings (all warnings), unchecked, typesNotCompared, and propsNotChecked.',
346
347
  },
347
348
  {
348
349
  value: 'integration.doc-conflicts',
349
350
  description:
350
351
  'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
351
352
  },
353
+ {
354
+ value: 'integration.check',
355
+ description:
356
+ 'Every source check of an integration package in one result: validated (false when no integration manifest was found, so nothing was checked), the package name and version, strict, and checks, one entry per check (validate, components, templates, docs), each with check, errors, warnings, skipped, failed, and response, the envelope that check returns on its own. The totals are errors, warnings, and skipped; unchecked counts what the checks could not compare. With --strict, failures lists each warning and each piece of skipped work again as an error, in the issue format the checks use; it is empty without --strict. failed decides the exit code.',
357
+ },
352
358
  ],
353
359
  };
@@ -20,6 +20,7 @@ import path from 'node:path';
20
20
  import {findCoreDir} from '../fs/paths.mjs';
21
21
  import {
22
22
  discoverComponents,
23
+ familyMember,
23
24
  findComponentReadme,
24
25
  resolveImportPath,
25
26
  } from '../discovery/component-discovery.mjs';
@@ -126,6 +127,9 @@ export async function buildRegistry({cwd = process.cwd()} = {}) {
126
127
  } catch {
127
128
  continue; // a malformed doc must not take down the whole language
128
129
  }
130
+ // A member documented in its family's doc (VStack in Stack's doc) is
131
+ // registered by the family's own folder, with every other member.
132
+ if (familyMember(docs, dirName)) continue;
129
133
  const importPath = resolveImportPath(coreDir, dirName);
130
134
 
131
135
  const register = (/** @type {string} */ rawName, /** @type {import('./xle-ast').DocProp[]} */ props) => {
@@ -0,0 +1,28 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The layout-language registry over the real @astryxdesign/core tree:
5
+ * the import path it emits for each component.
6
+ */
7
+
8
+ import {describe, it, expect} from 'vitest';
9
+ import * as path from 'node:path';
10
+ import {fileURLToPath} from 'node:url';
11
+ import {buildRegistry} from './registry.mjs';
12
+
13
+ const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..');
14
+
15
+ describe('buildRegistry import paths', () => {
16
+ it('keeps the Stack family on the paths it registers from Stack\'s folder', async () => {
17
+ // HStack and VStack are listed components whose docs live in Stack's doc.
18
+ // Listing them must not let their folders re-register the family under
19
+ // their own paths: a member's folder registers nothing, Stack's does.
20
+ const {components} = await buildRegistry({cwd: REPO});
21
+ const importOf = (/** @type {string} */ name) => components.get(name)?.importPath;
22
+ for (const name of ['Stack', 'StackItem', 'HStack', 'VStack']) {
23
+ expect(importOf(name), name).toBe('@astryxdesign/core/Stack');
24
+ }
25
+ expect(importOf('Heading')).toBe('@astryxdesign/core/Heading');
26
+ expect(importOf('Text')).toBe('@astryxdesign/core/Text');
27
+ }, 120_000);
28
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.2-canary.b06a093",
3
+ "version": "0.7.2-canary.b40ba52",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -96,15 +96,15 @@
96
96
  "jscodeshift": "^17.3.0",
97
97
  "node-diff3": "3.2.1",
98
98
  "postcss": "^8.5.23",
99
- "postcss-selector-parser": "^7.1.5",
99
+ "postcss-selector-parser": "^7.1.6",
100
100
  "recast": "0.23.21",
101
101
  "zod": "^4.4.3"
102
102
  },
103
103
  "peerDependencies": {
104
- "@astryxdesign/charts": "0.7.2-canary.b06a093",
105
- "@astryxdesign/core": "0.7.2-canary.b06a093",
106
- "@astryxdesign/lab": "0.7.2-canary.b06a093",
107
- "@astryxdesign/theme-neutral": "0.7.2-canary.b06a093"
104
+ "@astryxdesign/charts": "0.7.2-canary.b40ba52",
105
+ "@astryxdesign/core": "0.7.2-canary.b40ba52",
106
+ "@astryxdesign/lab": "0.7.2-canary.b40ba52",
107
+ "@astryxdesign/theme-neutral": "0.7.2-canary.b40ba52"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.7.2-canary.b06a093",
125
- "@astryxdesign/core": "0.7.2-canary.b06a093",
126
- "@astryxdesign/lab": "0.7.2-canary.b06a093",
127
- "@astryxdesign/theme-neutral": "0.7.2-canary.b06a093",
124
+ "@astryxdesign/charts": "0.7.2-canary.b40ba52",
125
+ "@astryxdesign/core": "0.7.2-canary.b40ba52",
126
+ "@astryxdesign/lab": "0.7.2-canary.b40ba52",
127
+ "@astryxdesign/theme-neutral": "0.7.2-canary.b40ba52",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",
@@ -7,7 +7,7 @@
7
7
  * installed as a project dependency and the project hasn't run init yet, print a
8
8
  * one-line next-step so agents/humans discover it.
9
9
  *
10
- * Reuses the ONE setup check (isAstryxInitialized) from the dependency-free leaf
10
+ * Reuses the ONE setup check (isAstryxPromptInReach) from the dependency-free leaf
11
11
  * ../foundation/agent-docs/agent-doc-state.mjs — node builtins only, so it is
12
12
  * genuinely safe to load at install time (importing agent-docs.mjs would drag in
13
13
  * the full CLI module graph). Non-interactive, never fails the install, and
@@ -41,10 +41,10 @@ async function projectIsSetUp(root) {
41
41
  // Dep-free leaf (node builtins only) — safe to load mid-install. NOT
42
42
  // agent-docs.mjs, whose static graph (component discovery, package-manager
43
43
  // detection, …) isn't guaranteed importable yet during this postinstall.
44
- const {isAstryxInitialized} = await import(
44
+ const {isAstryxPromptInReach} = await import(
45
45
  '../foundation/agent-docs/agent-doc-state.mjs'
46
46
  );
47
- return isAstryxInitialized(root);
47
+ return isAstryxPromptInReach(root);
48
48
  } catch {
49
49
  return false; // best-effort — if the check can't load, fall through and nudge
50
50
  }