@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69

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 (426) hide show
  1. package/README.md +64 -63
  2. package/api/build/_adapter.d.mts +51 -0
  3. package/api/build/_adapter.mjs +122 -6
  4. package/api/build/build.doc.mjs +1 -1
  5. package/api/build/build.mjs +23 -14
  6. package/api/build/build.type.d.mts +1 -1
  7. package/api/build/build.type.mjs +3 -3
  8. package/api/build/help/help.d.mts +15 -14
  9. package/api/build/help/help.mjs +62 -3
  10. package/api/build/kit/answer.mjs +2 -3
  11. package/api/build/kit/signals.d.mts +10 -0
  12. package/api/build/kit/signals.mjs +15 -2
  13. package/api/component/detail/blocks/blocks.mjs +2 -1
  14. package/api/discover/_adapter.d.mts +57 -6
  15. package/api/discover/_adapter.mjs +278 -49
  16. package/api/discover/_catalog-view.d.mts +7 -0
  17. package/api/discover/_catalog-view.mjs +10 -1
  18. package/api/discover/detail/detail.d.mts +3 -2
  19. package/api/discover/detail/detail.mjs +3 -2
  20. package/api/discover/detail/doc/doc.mjs +1 -1
  21. package/api/discover/discover.d.mts +24 -0
  22. package/api/discover/discover.doc.mjs +1 -1
  23. package/api/discover/discover.mjs +146 -25
  24. package/api/discover/discover.type.d.mts +6 -4
  25. package/api/discover/discover.type.mjs +6 -4
  26. package/api/discover/search/search.d.mts +22 -0
  27. package/api/discover/search/search.mjs +290 -70
  28. package/api/docs/_entry-names.mjs +4 -3
  29. package/api/doctor/_adapter.d.mts +43 -3
  30. package/api/doctor/_adapter.mjs +142 -18
  31. package/api/doctor/built-checks.d.mts +30 -3
  32. package/api/doctor/built-checks.mjs +132 -5
  33. package/api/doctor/doctor.d.mts +93 -6
  34. package/api/doctor/doctor.doc.mjs +2 -2
  35. package/api/doctor/doctor.mjs +524 -33
  36. package/api/doctor/doctor.type.d.mts +2 -1
  37. package/api/doctor/doctor.type.mjs +2 -1
  38. package/api/doctor/theme-checks.d.mts +19 -0
  39. package/api/doctor/theme-checks.mjs +74 -6
  40. package/api/hook/hook.type.d.mts +1 -1
  41. package/api/hook/hook.type.mjs +1 -1
  42. package/api/hook/list/list.mjs +11 -7
  43. package/api/icon/_adapter.d.mts +2 -1
  44. package/api/icon/_adapter.mjs +10 -15
  45. package/api/icon/_records.d.mts +3 -1
  46. package/api/icon/_records.mjs +30 -3
  47. package/api/icon/exportIconIndex.doc.mjs +1 -1
  48. package/api/icon/icon.doc.mjs +3 -3
  49. package/api/icon/icon.type.d.mts +32 -1
  50. package/api/icon/icon.type.mjs +19 -3
  51. package/api/icon/list/list.mjs +4 -1
  52. package/api/icon/rankIconIndex.doc.mjs +1 -1
  53. package/api/icon/search/icon-index.mjs +18 -8
  54. package/api/icon/search/search.d.mts +26 -3
  55. package/api/icon/search/search.mjs +155 -9
  56. package/api/init/_adapter.d.mts +14 -0
  57. package/api/init/_adapter.mjs +26 -4
  58. package/api/init/init.d.mts +1 -1
  59. package/api/init/init.doc.mjs +2 -2
  60. package/api/init/init.mjs +1 -1
  61. package/api/init/init.type.d.mts +29 -1
  62. package/api/init/init.type.mjs +14 -1
  63. package/api/init/run/run.d.mts +11 -1
  64. package/api/init/run/run.mjs +84 -5
  65. package/api/integration/_adapter.d.mts +5 -4
  66. package/api/integration/_adapter.mjs +7 -5
  67. package/api/integration/integrationCheck.doc.mjs +1 -1
  68. package/api/integration/pack-check.mjs +8 -9
  69. package/api/integration/validate-integration.d.mts +1 -1
  70. package/api/integration/validate-integration.mjs +26 -24
  71. package/api/integration/validate-integration.type.d.mts +5 -2
  72. package/api/integration/validate-integration.type.mjs +5 -2
  73. package/api/integration/validateIntegration.doc.mjs +1 -1
  74. package/api/render/_adapter.d.mts +4 -2
  75. package/api/render/_adapter.mjs +62 -21
  76. package/api/render/render.doc.mjs +8 -5
  77. package/api/render/render.mjs +1 -1
  78. package/api/render/render.type.d.mts +2 -0
  79. package/api/render/render.type.mjs +2 -0
  80. package/api/search/ORDERING.md +2 -2
  81. package/api/search/_candidate-score.d.mts +3 -0
  82. package/api/search/_candidate-score.mjs +36 -3
  83. package/api/search/_gather-docs.mjs +29 -2
  84. package/api/search/_gather-templates.mjs +2 -1
  85. package/api/search/_main-searcher.mjs +13 -0
  86. package/api/search/_named-keywords.d.mts +2 -1
  87. package/api/search/_named-keywords.mjs +48 -6
  88. package/api/search/_order.d.mts +36 -1
  89. package/api/search/_order.mjs +141 -3
  90. package/api/swizzle/list/list.mjs +8 -1
  91. package/api/swizzle/swizzle.type.d.mts +1 -1
  92. package/api/swizzle/swizzle.type.mjs +1 -1
  93. package/api/template/copy/copy.mjs +3 -4
  94. package/api/template/list/list.mjs +2 -1
  95. package/api/template/show/show.mjs +2 -1
  96. package/api/template/skeleton/skeleton.mjs +2 -1
  97. package/api/template/template.doc.mjs +1 -1
  98. package/api/template/template.mjs +19 -1
  99. package/api/template/template.type.d.mts +1 -0
  100. package/api/template/template.type.mjs +2 -1
  101. package/api/theme/_adapter.d.mts +1 -0
  102. package/api/theme/_adapter.mjs +3 -5
  103. package/api/theme/_app-provider.d.mts +42 -0
  104. package/api/theme/_app-provider.mjs +61 -27
  105. package/api/theme/build/build.d.mts +4 -10
  106. package/api/theme/build/build.mjs +165 -116
  107. package/api/theme/build/input-fields.d.mts +9 -0
  108. package/api/theme/build/input-fields.mjs +155 -16
  109. package/api/theme/build/radius-values.d.mts +18 -0
  110. package/api/theme/build/radius-values.mjs +76 -0
  111. package/api/theme/build/typography-values.mjs +7 -23
  112. package/api/theme/build/written-values.d.mts +18 -0
  113. package/api/theme/build/written-values.mjs +107 -31
  114. package/api/theme/eject/eject.mjs +6 -1
  115. package/api/theme/palette/generate/generator.mjs +24 -0
  116. package/api/theme/theme.type.d.mts +4 -2
  117. package/api/theme/theme.type.mjs +3 -2
  118. package/api/theme/themeBuild.doc.mjs +2 -2
  119. package/api/theme/themeEject.doc.mjs +1 -1
  120. package/api/theme-edit/_catalog.d.mts +40 -0
  121. package/api/theme-edit/_catalog.mjs +100 -22
  122. package/api/theme-edit/_check.mjs +213 -43
  123. package/api/theme-edit/_color.d.mts +14 -0
  124. package/api/theme-edit/_color.mjs +22 -0
  125. package/api/theme-edit/_compiler.mjs +52 -0
  126. package/api/theme-edit/_context.d.mts +20 -2
  127. package/api/theme-edit/_context.mjs +157 -29
  128. package/api/theme-edit/_edit.mjs +426 -58
  129. package/api/theme-edit/_how-question.d.mts +14 -0
  130. package/api/theme-edit/_how-question.mjs +1541 -127
  131. package/api/theme-edit/_how.mjs +43 -0
  132. package/api/theme-edit/_missed.mjs +107 -27
  133. package/api/theme-edit/_normal.d.mts +18 -4
  134. package/api/theme-edit/_normal.mjs +84 -3
  135. package/api/theme-edit/_palette.d.mts +9 -0
  136. package/api/theme-edit/_palette.mjs +158 -33
  137. package/api/theme-edit/_part-words.mjs +16 -3
  138. package/api/theme-edit/_parts.d.mts +8 -0
  139. package/api/theme-edit/_parts.mjs +120 -36
  140. package/api/theme-edit/_png.d.mts +24 -0
  141. package/api/theme-edit/_png.mjs +99 -0
  142. package/api/theme-edit/_preview-app.d.mts +16 -0
  143. package/api/theme-edit/_preview-app.mjs +52 -18
  144. package/api/theme-edit/_preview.d.mts +44 -26
  145. package/api/theme-edit/_preview.mjs +255 -67
  146. package/api/theme-edit/_project.d.mts +12 -1
  147. package/api/theme-edit/_project.mjs +16 -1
  148. package/api/theme-edit/_settings.d.mts +116 -0
  149. package/api/theme-edit/_settings.mjs +1197 -58
  150. package/api/theme-edit/_tables.d.mts +16 -0
  151. package/api/theme-edit/_tables.mjs +34 -4
  152. package/api/theme-edit/theme-edit.type.d.mts +15 -2
  153. package/api/theme-edit/theme-edit.type.mjs +8 -6
  154. package/api/upgrade/_adapter.d.mts +46 -7
  155. package/api/upgrade/_adapter.mjs +110 -15
  156. package/api/upgrade/registry/registry.d.mts +6 -3
  157. package/api/upgrade/registry/registry.mjs +21 -6
  158. package/api/upgrade/run/run.mjs +23 -11
  159. package/api/upgrade/upgrade.doc.mjs +4 -3
  160. package/assets/component-list.generated.json +1 -1
  161. package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
  162. package/assets/docs/tree/checks.doc.mjs +2 -2
  163. package/assets/docs/tree/host-entry.doc.mjs +4 -0
  164. package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
  165. package/assets/docs/tree/icon-sets.doc.mjs +6 -6
  166. package/assets/docs/tree/problems.doc.mjs +3 -3
  167. package/assets/docs/tree/render-pages.doc.mjs +17 -3
  168. package/assets/docs/tree/share-a-page.doc.mjs +5 -5
  169. package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
  170. package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
  171. package/assets/docs/tree/updates.doc.mjs +1 -1
  172. package/assets/docs/tree/versioning.doc.mjs +1 -1
  173. package/assets/docs/working-with-ai.doc.mjs +40 -5
  174. package/assets/docs-routes.generated.json +1 -1
  175. package/assets/docs.generated.json +2 -2
  176. package/assets/icons/installed-icon-set.doc.mjs +30 -0
  177. package/assets/search-catalog.generated.json +2 -2
  178. package/assets/self-audit.generated.json +1 -1
  179. package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
  180. package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
  181. package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
  182. package/assets/templates/components.generated.json +1 -1
  183. package/assets/templates/pages/ai-chat/page.tsx +6 -2
  184. package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
  185. package/assets/templates/pages/blank/page.tsx +4 -2
  186. package/assets/templates/pages/canvas-editor/page.tsx +3 -1
  187. package/assets/templates/pages/centered-hero/page.tsx +1 -1
  188. package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
  189. package/assets/templates/pages/classic-gallery/page.tsx +1 -1
  190. package/assets/templates/pages/contact-form/page.tsx +2 -2
  191. package/assets/templates/pages/course-detail/page.tsx +1 -1
  192. package/assets/templates/pages/dashboard/page.tsx +24 -8
  193. package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
  194. package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
  195. package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
  196. package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
  197. package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
  198. package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
  199. package/assets/templates/pages/detail-page/page.tsx +22 -5
  200. package/assets/templates/pages/documentation/page.tsx +4 -2
  201. package/assets/templates/pages/documentation-design/page.tsx +5 -2
  202. package/assets/templates/pages/documentation-technical/page.tsx +4 -2
  203. package/assets/templates/pages/editor/page.tsx +28 -9
  204. package/assets/templates/pages/file-explorer/page.tsx +3 -1
  205. package/assets/templates/pages/form-two-column/page.tsx +1 -1
  206. package/assets/templates/pages/form-wizard/page.tsx +1 -1
  207. package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
  208. package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
  209. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  210. package/assets/templates/pages/gallery-hero/page.tsx +1 -1
  211. package/assets/templates/pages/ide/page.tsx +7 -2
  212. package/assets/templates/pages/kanban-board/page.tsx +10 -4
  213. package/assets/templates/pages/library/page.tsx +31 -61
  214. package/assets/templates/pages/login/page.tsx +4 -2
  215. package/assets/templates/pages/login-card/page.tsx +4 -2
  216. package/assets/templates/pages/login-split/page.tsx +3 -2
  217. package/assets/templates/pages/login-sso/page.tsx +4 -4
  218. package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
  219. package/assets/templates/pages/payment-form/page.tsx +1 -1
  220. package/assets/templates/pages/product-detail/page.tsx +16 -4
  221. package/assets/templates/pages/product-gallery/page.tsx +1 -1
  222. package/assets/templates/pages/settings/page.tsx +10 -4
  223. package/assets/templates/pages/settings-dialog/page.tsx +5 -6
  224. package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
  225. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  226. package/assets/templates/pages/table/page.tsx +2 -2
  227. package/assets/templates/pages/table-filter/page.tsx +21 -6
  228. package/assets/templates/pages/table-grouped/page.tsx +23 -2
  229. package/assets/templates/pages/table-inbox/page.tsx +82 -32
  230. package/assets/templates/pages/theme-showcase/page.tsx +3 -2
  231. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
  232. package/assets/templates/themes/butter/butterTheme.ts +197 -4
  233. package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
  234. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
  235. package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
  236. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
  237. package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
  238. package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
  239. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
  240. package/assets/templates/themes/stone/stoneTheme.ts +69 -0
  241. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
  242. package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
  243. package/authoring/codemod/parse.d.mts +0 -36
  244. package/authoring/codemod/parse.mjs +62 -41
  245. package/authoring/config/config.doc.mjs +1 -1
  246. package/authoring/config/parse.d.mts +0 -47
  247. package/authoring/config/parse.mjs +128 -103
  248. package/authoring/config/type.ts +4 -3
  249. package/authoring/debug/parse.d.mts +2 -2
  250. package/authoring/discover/parse.d.mts +2 -2
  251. package/authoring/discover/parse.mjs +52 -38
  252. package/authoring/discover/type.ts +2 -1
  253. package/authoring/doctypes/_schema.d.mts +834 -950
  254. package/authoring/doctypes/_schema.mjs +863 -825
  255. package/authoring/doctypes/command/parse.mjs +2 -2
  256. package/authoring/doctypes/component/parse.mjs +2 -2
  257. package/authoring/doctypes/enum/parse.mjs +2 -2
  258. package/authoring/doctypes/hook/parse.mjs +2 -2
  259. package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
  260. package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
  261. package/authoring/doctypes/icon-definition/parse.mjs +59 -43
  262. package/authoring/doctypes/icon-set/parse.d.mts +0 -75
  263. package/authoring/doctypes/icon-set/parse.mjs +239 -210
  264. package/authoring/doctypes/legacy.mjs +3 -3
  265. package/authoring/doctypes/namespace/parse.mjs +2 -2
  266. package/authoring/doctypes/reference/parse.mjs +2 -2
  267. package/authoring/doctypes/schema/parse.mjs +2 -2
  268. package/authoring/doctypes/template/parse.d.mts +0 -101
  269. package/authoring/doctypes/template/parse.mjs +131 -106
  270. package/authoring/doctypes/theme/parse.d.mts +0 -23
  271. package/authoring/doctypes/theme/parse.mjs +52 -36
  272. package/authoring/gap-report/parse.d.mts +1 -1
  273. package/authoring/integration/integration.doc.mjs +8 -0
  274. package/authoring/integration/schema.d.mts +14 -3
  275. package/authoring/integration/schema.mjs +20 -2
  276. package/authoring/integration/type.ts +14 -0
  277. package/clients/cli/build-id.generated.json +1 -1
  278. package/clients/cli/commands/build.mjs +27 -13
  279. package/clients/cli/commands/component.mjs +14 -3
  280. package/clients/cli/commands/discover.doc.mjs +2 -2
  281. package/clients/cli/commands/discover.mjs +20 -3
  282. package/clients/cli/commands/docs.doc.mjs +11 -9
  283. package/clients/cli/commands/docs.mjs +50 -21
  284. package/clients/cli/commands/experimental/icon.mjs +330 -227
  285. package/clients/cli/commands/experimental/render.mjs +16 -1
  286. package/clients/cli/commands/experimental/theme.mjs +42 -17
  287. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  288. package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
  289. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
  290. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
  291. package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
  292. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  293. package/clients/cli/commands/experimental-render.doc.mjs +3 -3
  294. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
  295. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
  296. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  297. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  298. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  299. package/clients/cli/commands/init.doc.mjs +36 -24
  300. package/clients/cli/commands/integration-check.doc.mjs +1 -1
  301. package/clients/cli/commands/mcp.doc.mjs +53 -0
  302. package/clients/cli/commands/mcp.mjs +51 -0
  303. package/clients/cli/commands/search.mjs +46 -9
  304. package/clients/cli/commands/template.mjs +3 -2
  305. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  306. package/clients/cli/commands/theme.mjs +12 -2
  307. package/clients/cli/commands/upgrade.doc.mjs +3 -2
  308. package/clients/cli/commands.generated.json +1 -1
  309. package/clients/cli/formatters/index.mjs +52 -6
  310. package/clients/cli/index.mjs +23 -17
  311. package/clients/cli/lib/base-gate.mjs +37 -5
  312. package/clients/cli/lib/define-command.mjs +82 -4
  313. package/clients/cli/lib/json-shim.mjs +61 -4
  314. package/clients/cli/lib/manifest.mjs +9 -1
  315. package/clients/cli/lib/mcp-server.mjs +286 -0
  316. package/clients/cli/lib/mcp-tools.mjs +405 -0
  317. package/clients/cli/lib/other-cli-words.mjs +99 -0
  318. package/clients/cli/lib/stray-option.mjs +27 -1
  319. package/clients/cli/lib/unknown-command.mjs +326 -11
  320. package/clients/cli/manifest.generated.json +1 -1
  321. package/clients/cli/run.mjs +1 -1
  322. package/foundation/agent-docs/agent-docs.d.mts +49 -1
  323. package/foundation/agent-docs/agent-docs.mjs +108 -7
  324. package/foundation/agent-docs/computer-agent-text.mjs +1 -1
  325. package/foundation/bases/core.d.mts +1 -1
  326. package/foundation/bases/core.mjs +3 -3
  327. package/foundation/bases/resolve.d.mts +4 -8
  328. package/foundation/bases/resolve.mjs +15 -21
  329. package/foundation/bases/state.d.mts +15 -9
  330. package/foundation/bases/state.mjs +33 -6
  331. package/foundation/config/project.d.mts +5 -4
  332. package/foundation/config/project.mjs +33 -17
  333. package/foundation/discovery/component-discovery.mjs +15 -28
  334. package/foundation/discovery/icon-imports.d.mts +66 -0
  335. package/foundation/discovery/icon-imports.mjs +225 -0
  336. package/foundation/discovery/icon-ranking.d.mts +12 -2
  337. package/foundation/discovery/icon-ranking.mjs +197 -10
  338. package/foundation/discovery/icon-set-checks.mjs +2 -1
  339. package/foundation/discovery/icon-set-discovery.d.mts +28 -0
  340. package/foundation/discovery/icon-set-discovery.mjs +42 -0
  341. package/foundation/discovery/icon-set-writer.d.mts +2 -11
  342. package/foundation/discovery/icon-set-writer.mjs +3 -29
  343. package/foundation/discovery/module-exports.d.mts +1 -1
  344. package/foundation/discovery/module-exports.mjs +136 -33
  345. package/foundation/discovery/name-roots.d.mts +5 -0
  346. package/foundation/discovery/name-roots.mjs +11 -0
  347. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  348. package/foundation/discovery/runner-allowlist.mjs +2 -0
  349. package/foundation/discovery/runner-commands.mjs +1 -0
  350. package/foundation/discovery/template-adapter.d.mts +1 -1
  351. package/foundation/discovery/template-destination.d.mts +14 -6
  352. package/foundation/discovery/template-destination.mjs +42 -8
  353. package/foundation/discovery/template-icons.d.mts +45 -2
  354. package/foundation/discovery/template-icons.mjs +26 -54
  355. package/foundation/discovery/template-needs.d.mts +28 -2
  356. package/foundation/discovery/template-needs.mjs +92 -11
  357. package/foundation/discovery/theme-discovery.d.mts +8 -0
  358. package/foundation/discovery/theme-discovery.mjs +23 -6
  359. package/foundation/discovery/theme-imports.mjs +2 -4
  360. package/foundation/doc-compiler/parse-readable.mjs +4 -3
  361. package/foundation/doc-compiler/stored-docs.d.mts +13 -0
  362. package/foundation/doc-compiler/stored-docs.mjs +74 -3
  363. package/foundation/env/cli-command.d.mts +68 -10
  364. package/foundation/env/cli-command.mjs +116 -22
  365. package/foundation/env/project-scope.d.mts +9 -0
  366. package/foundation/env/project-scope.mjs +28 -2
  367. package/foundation/fs/gather-cache.d.mts +23 -0
  368. package/foundation/fs/gather-cache.mjs +94 -2
  369. package/foundation/fs/module-loader.d.mts +3 -1
  370. package/foundation/fs/module-loader.mjs +85 -5
  371. package/foundation/fs/read-record.mjs +9 -5
  372. package/foundation/identity/package-names.d.mts +18 -0
  373. package/foundation/identity/package-names.mjs +19 -0
  374. package/foundation/identity/providers.mjs +3 -2
  375. package/foundation/integrations/icon-features.d.mts +63 -0
  376. package/foundation/integrations/icon-features.mjs +54 -0
  377. package/foundation/integrations/integrations.d.mts +13 -1
  378. package/foundation/integrations/integrations.mjs +47 -6
  379. package/foundation/integrations/pack-state.d.mts +21 -0
  380. package/foundation/integrations/pack-state.mjs +42 -19
  381. package/foundation/integrations/validate-contributions.d.mts +11 -3
  382. package/foundation/integrations/validate-contributions.mjs +51 -13
  383. package/foundation/release/cache.d.mts +13 -1
  384. package/foundation/release/cache.mjs +94 -14
  385. package/foundation/release/notices.d.mts +15 -0
  386. package/foundation/release/notices.mjs +111 -7
  387. package/foundation/release/project.d.mts +3 -4
  388. package/foundation/release/project.mjs +5 -6
  389. package/foundation/render/client-bundle.d.mts +126 -0
  390. package/foundation/render/client-bundle.mjs +565 -0
  391. package/foundation/render/cut-short.d.mts +7 -1
  392. package/foundation/render/cut-short.mjs +46 -6
  393. package/foundation/render/embedded-imports.d.mts +4 -3
  394. package/foundation/render/embedded-imports.mjs +13 -8
  395. package/foundation/render/esbuild-dependency.d.mts +14 -0
  396. package/foundation/render/esbuild-dependency.mjs +41 -0
  397. package/foundation/render/file-header.mjs +5 -4
  398. package/foundation/render/page-worker.mjs +562 -86
  399. package/foundation/render/picture-chrome.mjs +54 -29
  400. package/foundation/render/picture-playwright.mjs +78 -42
  401. package/foundation/render/picture-window.d.mts +33 -0
  402. package/foundation/render/picture-window.mjs +78 -0
  403. package/foundation/render/render-page.d.mts +55 -4
  404. package/foundation/render/render-page.mjs +199 -28
  405. package/foundation/render/restore-folder.d.mts +13 -0
  406. package/foundation/render/restore-folder.mjs +30 -0
  407. package/foundation/render/served-packages.d.mts +2 -1
  408. package/foundation/render/served-packages.mjs +5 -3
  409. package/foundation/render/ts-paths.d.mts +11 -0
  410. package/foundation/render/ts-paths.mjs +27 -2
  411. package/foundation/render/value-uses.d.mts +43 -0
  412. package/foundation/render/value-uses.mjs +110 -0
  413. package/foundation/response/error-codes.d.mts +2 -1
  414. package/foundation/response/error-codes.doc.mjs +7 -1
  415. package/foundation/response/error-codes.mjs +10 -2
  416. package/foundation/response/response-types.doc.mjs +12 -12
  417. package/foundation/runtime/package-root.d.mts +8 -0
  418. package/foundation/runtime/package-root.mjs +20 -0
  419. package/foundation/suggest/other-command.d.mts +11 -0
  420. package/foundation/suggest/other-command.mjs +1 -1
  421. package/foundation/text/icon-id.d.mts +20 -0
  422. package/foundation/text/icon-id.mjs +40 -0
  423. package/foundation/text/icon-set-next.d.mts +25 -0
  424. package/foundation/text/icon-set-next.mjs +29 -0
  425. package/foundation/xle/browser.d.mts +2 -2
  426. package/package.json +7 -6
@@ -55,7 +55,9 @@ import {
55
55
  } from '../../foundation/env/package-manager.mjs';
56
56
  import {
57
57
  chooseDeclaredCliCommand,
58
+ chooseDeclaredValue,
58
59
  declaredCliCommandsOf,
60
+ declaredValuesOf,
59
61
  } from '../../foundation/env/cli-command.mjs';
60
62
  import {
61
63
  findConfigPath,
@@ -88,6 +90,8 @@ import {
88
90
  import {
89
91
  checkAppThemes,
90
92
  checkThemes,
93
+ moduleSpecifiers,
94
+ stringValues,
91
95
  themeImportWiring,
92
96
  withProviderWiring,
93
97
  } from './theme-checks.mjs';
@@ -109,10 +113,14 @@ import {
109
113
  computerAgentTextState,
110
114
  installCommandFor,
111
115
  insideProjectElsewhere,
116
+ packageInstallCommand,
117
+ packageInstallStep,
112
118
  projectCoreVersion,
113
119
  projectHasOwnCli,
114
120
  computerIntegrationsOutside,
121
+ findIconImports,
115
122
  findIconPlaceholders,
123
+ iconFeatureGate,
116
124
  iconUseCommand,
117
125
  placeholderFixes,
118
126
  unlistedIconSets,
@@ -126,9 +134,15 @@ import {
126
134
  isLocalThemeOwner,
127
135
  readThemeState,
128
136
  builtTargetOf,
137
+ listProjectSourceFiles,
138
+ readTextFile,
139
+ doctorStylesheetImports,
140
+ doctorStylesheetAtRules,
141
+ builtProjectRoot,
129
142
  } from './_adapter.mjs';
130
- import {checkBuilt} from './built-checks.mjs';
143
+ import {checkBuilt, linksCoreStylesheet} from './built-checks.mjs';
131
144
  import {coreOnlyDocNames} from '../../foundation/bases/core-docs.mjs';
145
+ import {coreBase} from '../../foundation/bases/core.mjs';
132
146
  import {
133
147
  CLI_PROVIDER_ID,
134
148
  CORE_PROVIDER_ID,
@@ -152,6 +166,8 @@ import {
152
166
  * @property {string} cwd - Directory to diagnose.
153
167
  * @property {string} nodeVersion - Running Node version.
154
168
  * @property {string|null} coreDir - Resolved core package directory, or null.
169
+ * @property {import('../../foundation/bases/resolve.mjs').ActiveBase} [base]
170
+ * The base the project's run reads; Core when absent.
155
171
  * @property {boolean} [ownCli] - Whether the project installs its own CLI;
156
172
  * false means the copy that started the run answered it (spec AST-081 FR2).
157
173
  * @property {string[]} [addedThemePackages] - Packages of the project's added
@@ -179,12 +195,17 @@ import {
179
195
  * @property {Error|null} [configError] - Error thrown while resolving the config
180
196
  * path (e.g. multiple config files present), surfaced by checkConfig as a FAIL.
181
197
  * @property {{sets: Array<{name: string, package: string}>, withdrawn: Array<{name: string, package: string, reason: string}>, choice: {status: 'selected'|'none'|'ambiguous'|'missing'|'withdrawn', reason: string, configured?: string, set?: {name: string, package: string, data: {variants?: string[]}}, variant?: string, backups?: Array<{selector: string, status: 'selected'|'ambiguous'|'missing'|'withdrawn', reason: string}>, order?: Array<{name: string, package: string}>}}|null} [iconSets]
182
- * The project's icon sets (AST-084 FR17), or null when they could not be read.
198
+ * The project's icon sets (AST-084 FR17), or null when they could not be
199
+ * read or the icon feature gate is off.
183
200
  * Experimental: may change or be removed in a patch release.
184
201
  * @property {Array<{file: string, local: string, meanings: string[] | null, uses: number}>|null} [iconPlaceholders]
185
202
  * Each file in the project's own source that uses the placeholder component
186
- * the CLI writes for a missing icon, read only in a project that sets
187
- * `experimental.iconSet`; null otherwise.
203
+ * the CLI writes for a missing icon, read only where the icon feature gate
204
+ * is on; null otherwise.
205
+ * Experimental: may change or be removed in a patch release.
206
+ * @property {Array<{file: string, imports: Array<{line: number, module: string, export: string, why: 'unlisted'|'earlier'|'unresolved', set: string|null, definitions: string[], replacement: {set: string, module: string, export: string}|null}>}>|null} [iconImports]
207
+ * Each file in the project's own source with icon imports that do not
208
+ * match its icon sets, read only when the placeholders are; null otherwise.
188
209
  * Experimental: may change or be removed in a patch release.
189
210
  * @property {string|null} [projectError] - Why the CLI could not load the
190
211
  * project from its config, when it could not. Checks that need the loaded
@@ -325,6 +346,34 @@ export function checkNodeVersion(ctx) {
325
346
  };
326
347
  }
327
348
 
349
+ /**
350
+ * An install step as fix text: the line in backticks, then its note.
351
+ * @param {{line: string, note: string | null}} step
352
+ */
353
+ function stepText({line, note}) {
354
+ return note ? `\`${line}\` (${note})` : `\`${line}\``;
355
+ }
356
+
357
+ /**
358
+ * The fix text for peers to install: the project's integration guidance when
359
+ * it gives one, followed by the versions the peers need, else one install
360
+ * command with each range.
361
+ * @param {string} cwd
362
+ * @param {string[]} names every peer to install, by name
363
+ * @param {string[]} targets the same peers, each with its range when it has one
364
+ * @returns {string}
365
+ */
366
+ function peerInstallText(cwd, names, targets) {
367
+ const {installGuidance} = packageInstallCommand(names, cwd);
368
+ if (installGuidance) {
369
+ const versioned = targets.filter(t => !names.includes(t));
370
+ return versioned.length
371
+ ? `\`${installGuidance}\`, at these versions: ${versioned.join(', ')}`
372
+ : `\`${installGuidance}\``;
373
+ }
374
+ return stepText(packageInstallStep(targets, cwd));
375
+ }
376
+
328
377
  /**
329
378
  * Check 2 — @astryxdesign/core is installed and resolvable from the project.
330
379
  * @param {DoctorContext} ctx
@@ -351,11 +400,257 @@ export function checkCoreInstalled(ctx) {
351
400
  : {
352
401
  fix: install
353
402
  ? `Install the project's dependencies: \`${install}\`.`
354
- : 'Install the design system: `npm install @astryxdesign/core` (or yarn/pnpm/bun).',
403
+ : `Install the design system: ${stepText(packageInstallStep(['@astryxdesign/core'], ctx.cwd))}.`,
355
404
  }),
356
405
  };
357
406
  }
358
407
 
408
+ /** Core's component styles, the stylesheet an Astryx app imports once. */
409
+ const CORE_STYLESHEET = '@astryxdesign/core/astryx.css';
410
+
411
+ /** Config files a build that compiles Core from source names its plugin in. */
412
+ const SOURCE_BUILD_CONFIGS = [
413
+ {stem: 'next.config', plugin: 'withAstryx()'},
414
+ {stem: 'vite.config', plugin: 'astryxStylex()'},
415
+ ];
416
+
417
+ /** The extensions those config files take. */
418
+ const CONFIG_EXTENSIONS = ['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'];
419
+
420
+ /** The PostCSS config files PostCSS reads in JSON. */
421
+ const POSTCSS_JSON_CONFIGS = ['.postcssrc', '.postcssrc.json'];
422
+
423
+ /** @param {string} name */
424
+ function namesBuildPackage(name) {
425
+ return (
426
+ name === '@astryxdesign/build' || name.startsWith('@astryxdesign/build/')
427
+ );
428
+ }
429
+
430
+ /**
431
+ * Every string in a JSON value, object keys included.
432
+ * @param {unknown} value
433
+ * @returns {string[]}
434
+ */
435
+ function jsonStrings(value) {
436
+ if (typeof value === 'string') return [value];
437
+ if (Array.isArray(value)) return value.flatMap(jsonStrings);
438
+ if (value && typeof value === 'object') {
439
+ return Object.entries(value).flatMap(([key, child]) => [
440
+ key,
441
+ ...jsonStrings(child),
442
+ ]);
443
+ }
444
+ return [];
445
+ }
446
+
447
+ /**
448
+ * The PostCSS config file that loads a plugin of `@astryxdesign/build`, which
449
+ * compiles Core's styles into the stylesheet's `@stylex;` rule, or null. A
450
+ * JavaScript or TypeScript config names it as a string (an import, a
451
+ * `require()` or a `plugins` key); a JSON config, or `package.json`'s
452
+ * `postcss` field, as a key or a value.
453
+ * @param {string} root
454
+ * @returns {string | null}
455
+ */
456
+ function postcssConfigLoadingBuild(root) {
457
+ for (const extension of CONFIG_EXTENSIONS) {
458
+ const name = `postcss.config${extension}`;
459
+ for (const config of [name, `.postcssrc${extension}`]) {
460
+ let source;
461
+ try {
462
+ source = readTextFile(path.join(root, config));
463
+ } catch {
464
+ continue;
465
+ }
466
+ if (!source.includes('@astryxdesign/build')) continue;
467
+ try {
468
+ if ([...stringValues(source)].some(namesBuildPackage)) return config;
469
+ } catch {
470
+ // A config that does not parse names no plugin.
471
+ }
472
+ }
473
+ }
474
+ for (const config of [...POSTCSS_JSON_CONFIGS, 'package.json']) {
475
+ let value;
476
+ try {
477
+ value = JSON.parse(readTextFile(path.join(root, config)));
478
+ } catch {
479
+ continue;
480
+ }
481
+ const postcss = config === 'package.json' ? value?.postcss : value;
482
+ if (jsonStrings(postcss).some(namesBuildPackage)) return config;
483
+ }
484
+ return null;
485
+ }
486
+
487
+ /**
488
+ * How an app compiles Core's styles from its source with
489
+ * `@astryxdesign/build`, so it loads no `astryx.css`: a `next.config` or
490
+ * `vite.config` that imports the build's plugin (`withAstryx()`,
491
+ * `astryxStylex()`), a stylesheet with the `@astryx;` rule the Next.js
492
+ * PostCSS plugin writes the compiled rules into, or one with the `@stylex;`
493
+ * rule while the PostCSS config loads the build's plugin. An `@stylex;` rule
494
+ * alone is the app's own StyleX, which still needs Core's prebuilt styles.
495
+ * Null when it does none of these.
496
+ * @param {string} root
497
+ * @returns {string | null}
498
+ */
499
+ export function sourceBuildSetup(root) {
500
+ for (const {stem, plugin} of SOURCE_BUILD_CONFIGS) {
501
+ for (const extension of CONFIG_EXTENSIONS) {
502
+ const file = path.join(root, `${stem}${extension}`);
503
+ let source;
504
+ try {
505
+ source = readTextFile(file);
506
+ } catch {
507
+ continue;
508
+ }
509
+ if (!source.includes('@astryxdesign/build')) continue;
510
+ try {
511
+ if (
512
+ [...moduleSpecifiers(source)].some(
513
+ specifier =>
514
+ specifier === '@astryxdesign/build' ||
515
+ specifier.startsWith('@astryxdesign/build/'),
516
+ )
517
+ ) {
518
+ return `${plugin} in ${stem}${extension}`;
519
+ }
520
+ } catch {
521
+ // A config that does not parse names no plugin.
522
+ }
523
+ }
524
+ }
525
+ for (const file of listProjectSourceFiles(root, '', {stylesheets: true})) {
526
+ if (!file.endsWith('.css')) continue;
527
+ let css;
528
+ try {
529
+ css = readTextFile(file);
530
+ } catch {
531
+ continue;
532
+ }
533
+ if (!/@(?:astryx|stylex)\s*;/iu.test(css)) continue;
534
+ const rules = doctorStylesheetAtRules(css);
535
+ const where = path.relative(root, file) || file;
536
+ if (rules.has('astryx')) return `the \`@astryx;\` rule in ${where}`;
537
+ if (rules.has('stylex')) {
538
+ const config = postcssConfigLoadingBuild(root);
539
+ if (config) {
540
+ return `the \`@stylex;\` rule in ${where}, with @astryxdesign/build in ${config}`;
541
+ }
542
+ }
543
+ }
544
+ return null;
545
+ }
546
+
547
+ /**
548
+ * {@link sourceBuildSetup} for a project folder, or null without one.
549
+ * @param {string | null} root
550
+ * @returns {string | null}
551
+ */
552
+ function sourceBuildOf(root) {
553
+ return root ? sourceBuildSetup(root) : null;
554
+ }
555
+
556
+ /**
557
+ * The first project file that loads Core's component styles: a stylesheet
558
+ * that `@import`s them, a module that imports them, or a page that links
559
+ * them. Each is read as a syntax tree or its tags, so comments never count.
560
+ * @param {string} root
561
+ * @returns {{file: string | null, unparsed: number}}
562
+ */
563
+ function coreStylesheetLoad(root) {
564
+ let unparsed = 0;
565
+ for (const file of listProjectSourceFiles(root, '', {
566
+ stylesheets: true,
567
+ pages: true,
568
+ })) {
569
+ let source;
570
+ try {
571
+ source = readTextFile(file);
572
+ } catch {
573
+ continue;
574
+ }
575
+ if (!source.includes('astryx.css')) continue;
576
+ if (file.endsWith('.css')) {
577
+ if (doctorStylesheetImports(source).has(CORE_STYLESHEET)) {
578
+ return {file, unparsed};
579
+ }
580
+ continue;
581
+ }
582
+ if (/\.html?$/u.test(file)) {
583
+ if (linksCoreStylesheet(source)) return {file, unparsed};
584
+ continue;
585
+ }
586
+ try {
587
+ if (moduleSpecifiers(source).has(CORE_STYLESHEET)) {
588
+ return {file, unparsed};
589
+ }
590
+ } catch {
591
+ unparsed += 1;
592
+ }
593
+ }
594
+ return {file: null, unparsed};
595
+ }
596
+
597
+ /**
598
+ * The app loads Core's component styles. Without them, Astryx components
599
+ * render unstyled, and nothing else fails: the build passes and the page
600
+ * loads. An app that loads none but compiles Core's styles from source is
601
+ * not checked. Read from the project's own source, stylesheets and pages,
602
+ * never run.
603
+ * @param {DoctorContext} ctx
604
+ * @returns {DoctorCheck | null}
605
+ */
606
+ export function checkCoreStylesheets(ctx) {
607
+ if (!ctx.coreDir) return null;
608
+ const root = projectRootOf(ctx);
609
+ const label = "Core's component styles loaded";
610
+ const {file, unparsed} = coreStylesheetLoad(root);
611
+ if (file) {
612
+ return {
613
+ id: 'core-stylesheets',
614
+ label,
615
+ status: 'pass',
616
+ message: `${path.relative(root, file) || file} loads ${CORE_STYLESHEET}, Core's component styles.`,
617
+ };
618
+ }
619
+ const setup = sourceBuildSetup(root);
620
+ if (setup) {
621
+ return {
622
+ id: 'core-stylesheets',
623
+ label,
624
+ status: 'info',
625
+ message: `Not checked: this app compiles Core's styles from source (${setup}), so it does not need ${CORE_STYLESHEET}.`,
626
+ };
627
+ }
628
+ return {
629
+ id: 'core-stylesheets',
630
+ label,
631
+ status: 'warn',
632
+ message: `Found nothing in project source, stylesheets or pages that imports or links ${CORE_STYLESHEET}, Core's component styles. Without them, Astryx components render unstyled.${unparsed ? ` ${unparsed} source file(s) that name it could not be parsed.` : ''}`,
633
+ fix: "Import Core's stylesheets once, in the app's global stylesheet: `@import '@astryxdesign/core/reset.css';` then `@import '@astryxdesign/core/astryx.css';`. Or import both in the app's entry module, reset.css first.",
634
+ };
635
+ }
636
+
637
+ /**
638
+ * The active base is installed and resolvable, in a project whose base is
639
+ * not Core. A project on Core has {@link checkCoreInstalled} instead.
640
+ * @param {DoctorContext} ctx
641
+ * @returns {DoctorCheck | null}
642
+ */
643
+ export function checkBaseInstalled(ctx) {
644
+ if (ctx.base == null || ctx.base.core) return null;
645
+ const {name, version} = ctx.base;
646
+ return {
647
+ id: 'base-installed',
648
+ label: `${name} installed`,
649
+ status: 'pass',
650
+ message: `${name}, the active base, resolved${version ? ` (v${version})` : ''}.`,
651
+ };
652
+ }
653
+
359
654
  /**
360
655
  * Check 3 — installed @astryxdesign/core is in step with @astryxdesign/cli (major/minor drift).
361
656
  * @param {DoctorContext} ctx
@@ -645,8 +940,8 @@ export function checkImplicitIntegrations(ctx) {
645
940
  'themes',
646
941
  'docs',
647
942
  'codemods',
648
- // An experimental root counts only in a project that opts in.
649
- ...(ctx.iconSets?.choice?.configured ? ['iconSets'] : []),
943
+ // An experimental root counts only where icon features are on.
944
+ ...(ctx.iconSets ? ['iconSets'] : []),
650
945
  ].filter(root => integration[/** @type {'components'} */ (root)]);
651
946
  const missing = declared.filter(root => {
652
947
  const dir = integration[/** @type {'components'} */ (root)];
@@ -998,7 +1293,14 @@ export function checkPeerDeps(ctx) {
998
1293
  label: '@astryxdesign/core peer dependencies',
999
1294
  status: 'warn',
1000
1295
  message: `Peer dependency issues — ${problems.join('; ')}.`,
1001
- fix: `Install compatible peers: \`npm install ${targets.join(' ')}\`.`,
1296
+ fix: `Install compatible peers: ${peerInstallText(
1297
+ ctx.cwd,
1298
+ [
1299
+ ...missing.map(spec => spec.replace(/^(@?[^@]+)@.*$/, '$1')),
1300
+ ...mismatched.map(m => m.name),
1301
+ ],
1302
+ targets,
1303
+ )}.`,
1002
1304
  };
1003
1305
  }
1004
1306
 
@@ -1133,8 +1435,8 @@ export function checkIntegrationCoreRange(ctx) {
1133
1435
  * withdrawn (with why), or that two packages ship under one name; and when
1134
1436
  * more than one set is installed and the list leaves one out. Warns for each
1135
1437
  * other installed set that was withdrawn, with why.
1136
- * Icon sets are experimental (spec:AST-017 FR27): only a project that sets
1137
- * `experimental.iconSet` gets the check, so every other report is unchanged.
1438
+ * Icon sets are experimental (spec:AST-017 FR27): only a project where the
1439
+ * icon feature gate is on gets the check, so every other report is unchanged.
1138
1440
  * @param {DoctorContext} ctx
1139
1441
  * @returns {DoctorCheck | null}
1140
1442
  */
@@ -1144,12 +1446,16 @@ export function checkIconSets(ctx) {
1144
1446
  const label = 'Icon sets';
1145
1447
  if (state == null) return null;
1146
1448
  const {sets, withdrawn, choice} = state;
1147
- // Only a project that opts in with `experimental.iconSet` gets the check.
1148
- if (!choice.configured) return null;
1149
- const list = [
1150
- {selector: choice.configured, status: choice.status, reason: choice.reason},
1151
- ...(choice.backups ?? []),
1152
- ];
1449
+ const list = choice.configured
1450
+ ? [
1451
+ {
1452
+ selector: choice.configured,
1453
+ status: choice.status,
1454
+ reason: choice.reason,
1455
+ },
1456
+ ...(choice.backups ?? []),
1457
+ ]
1458
+ : [];
1153
1459
  const installFix =
1154
1460
  'Install the package that ships the set, or remove it from experimental.iconSet in astryx.config (`astryx experimental icon --list` names the installed sets).';
1155
1461
  const missing = list.filter(each => each.status === 'missing');
@@ -1191,8 +1497,8 @@ export function checkIconSets(ctx) {
1191
1497
  status: 'fail',
1192
1498
  message:
1193
1499
  declared.length === 0
1194
- ? `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured} declares no variants: it draws one look.`
1195
- : `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured} declares no such variant. Its variants: ${declared.join(', ')}.`,
1500
+ ? `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured ?? choice.set.name} declares no variants: it draws one look.`
1501
+ : `experimental.iconVariant names "${choice.variant}", but the main set ${choice.configured ?? choice.set.name} declares no such variant. Its variants: ${declared.join(', ')}.`,
1196
1502
  fix:
1197
1503
  declared.length === 0
1198
1504
  ? `Remove experimental.iconVariant: run \`${iconUseCommandOf(choice)}\`.`
@@ -1243,22 +1549,36 @@ export function checkIconSets(ctx) {
1243
1549
  */
1244
1550
  function iconUseCommandOf(choice, variant) {
1245
1551
  return iconUseCommand(
1246
- /** @type {string} */ (choice.configured),
1552
+ /** @type {string} */ (choice.configured ?? choice.set?.name),
1247
1553
  (choice.backups ?? []).map(each => each.selector),
1248
1554
  variant,
1249
1555
  );
1250
1556
  }
1251
1557
 
1558
+ /**
1559
+ * The main set the placeholder fixes name: the one `experimental.iconSet`
1560
+ * names, else the only installed set; null when no main set is decided or
1561
+ * icon features are off. The placeholder check, and the source scan it
1562
+ * reads, run only when there is one.
1563
+ * @param {DoctorContext['iconSets']} iconSets
1564
+ * @returns {string | null}
1565
+ */
1566
+ export function placeholderMainSet(iconSets) {
1567
+ return iconSets?.choice.configured ?? iconSets?.choice.set?.name ?? null;
1568
+ }
1569
+
1252
1570
  /**
1253
1571
  * The placeholder component for a missing icon, still in the project's own
1254
1572
  * source (AST-084): each file and the meanings it stands for, with the commands that give each a
1255
- * real icon. Only a project that sets `experimental.iconSet` gets the check.
1573
+ * real icon. Only a project where the icon feature gate is on, and whose
1574
+ * main set is decided, gets the check.
1256
1575
  * @param {DoctorContext} ctx
1257
1576
  * @returns {DoctorCheck | null}
1258
1577
  */
1259
1578
  export function checkIconPlaceholders(ctx) {
1260
1579
  const choice = ctx.iconSets?.choice;
1261
- if (!choice?.configured || ctx.iconPlaceholders == null) return null;
1580
+ const main = placeholderMainSet(ctx.iconSets);
1581
+ if (!choice || !main || ctx.iconPlaceholders == null) return null;
1262
1582
  const id = 'icon-placeholders';
1263
1583
  const label = 'Placeholder icons';
1264
1584
  const found = ctx.iconPlaceholders;
@@ -1270,7 +1590,6 @@ export function checkIconPlaceholders(ctx) {
1270
1590
  message: 'No copied code uses the placeholder for a missing icon.',
1271
1591
  };
1272
1592
  }
1273
- const main = choice.configured;
1274
1593
  const meanings = [
1275
1594
  ...new Set(found.flatMap(each => each.meanings ?? [])),
1276
1595
  ].sort();
@@ -1296,6 +1615,114 @@ export function checkIconPlaceholders(ctx) {
1296
1615
  };
1297
1616
  }
1298
1617
 
1618
+ /**
1619
+ * The icon imports in the project's own source that do not match its icon
1620
+ * sets (AST-084): each file and import, with the icon of the list that draws
1621
+ * the same meaning. An import from a set the list leaves out, or from a set
1622
+ * later in the list than one that draws the same meaning, still renders, so
1623
+ * the check warns, as for a placeholder. An icon-named import of a package
1624
+ * that does not resolve and that package.json does not declare (a set the
1625
+ * project uninstalled) breaks the build, so the check fails, as `icon-sets`
1626
+ * fails for a set the list names that is not installed. Only a project where
1627
+ * the icon feature gate is on, and whose main set is decided, gets the check.
1628
+ * @param {DoctorContext} ctx
1629
+ * @returns {DoctorCheck | null}
1630
+ */
1631
+ export function checkIconImports(ctx) {
1632
+ const choice = ctx.iconSets?.choice;
1633
+ const main = choice?.configured ?? choice?.set?.name;
1634
+ if (!choice || !main || ctx.iconImports == null) return null;
1635
+ const id = 'icon-imports';
1636
+ const label = 'Icon imports';
1637
+ const found = ctx.iconImports;
1638
+ if (found.length === 0) {
1639
+ return {
1640
+ id,
1641
+ label,
1642
+ status: 'pass',
1643
+ message:
1644
+ 'Every icon import in your code comes from the set your list picks for it.',
1645
+ };
1646
+ }
1647
+ const missing = found.flatMap(({file, imports}) =>
1648
+ imports
1649
+ .filter(each => each.why === 'unresolved')
1650
+ .map(each => ({file, ...each})),
1651
+ );
1652
+ const other = found.flatMap(({file, imports}) =>
1653
+ imports
1654
+ .filter(each => each.why !== 'unresolved')
1655
+ .map(each => ({file, ...each})),
1656
+ );
1657
+ /**
1658
+ * Each file once, its imports grouped by the module they come from and the
1659
+ * module that replaces them: `file (from → to: Old → New, …; from: Old
1660
+ * (why), …)`.
1661
+ * @param {typeof other} rows
1662
+ */
1663
+ const byFile = rows => {
1664
+ /** @type {Map<string, Map<string, string[]>>} */
1665
+ const files = new Map();
1666
+ for (const row of rows) {
1667
+ const groups = files.get(row.file) ?? new Map();
1668
+ const group = row.replacement
1669
+ ? `${row.module} → ${row.replacement.module}`
1670
+ : row.module;
1671
+ const names = groups.get(group) ?? [];
1672
+ const name = row.replacement
1673
+ ? `${row.export} → ${row.replacement.export}`
1674
+ : row.why === 'unresolved'
1675
+ ? row.export
1676
+ : `${row.export} (${row.definitions.length > 0 ? `no set in your list has "${row.definitions.join('", "')}"` : 'its set maps it to no Astryx meaning'})`;
1677
+ if (!names.includes(name)) names.push(name);
1678
+ groups.set(group, names);
1679
+ files.set(row.file, groups);
1680
+ }
1681
+ return [...files]
1682
+ .map(
1683
+ ([file, groups]) =>
1684
+ `${file} (${[...groups]
1685
+ .map(([group, names]) => `${group}: ${names.join(', ')}`)
1686
+ .join('; ')})`,
1687
+ )
1688
+ .join(', ');
1689
+ };
1690
+ /** @param {number} n @param {string} what */
1691
+ const count = (n, what) => `${n} ${what}${n === 1 ? '' : 's'}`;
1692
+ /** @param {typeof other} rows */
1693
+ const fileCount = rows => new Set(rows.map(row => row.file)).size;
1694
+ const parts = [];
1695
+ if (missing.length > 0) {
1696
+ parts.push(
1697
+ `${count(missing.length, 'icon import')} in ${count(fileCount(missing), 'file')} name a package that is not installed, so the build fails: ${byFile(missing)}.`,
1698
+ );
1699
+ }
1700
+ if (other.length > 0) {
1701
+ const sets = [...new Set(other.map(row => row.set))].join(', ');
1702
+ parts.push(
1703
+ `${count(other.length, 'icon import')} in ${count(fileCount(other), 'file')} come from ${sets}, not the set your list (experimental.iconSet) picks for that meaning: ${byFile(other)}.`,
1704
+ );
1705
+ }
1706
+ const fixes = [];
1707
+ if (missing.length > 0) {
1708
+ fixes.push(
1709
+ 'Replace each import of a package that is not installed with the icon `astryx experimental icon <meaning>` prints; or install that package again, and doctor names the icon of your list that draws the same meaning.',
1710
+ );
1711
+ }
1712
+ if (other.length > 0) {
1713
+ fixes.push(
1714
+ `Import each icon named after → from the module named after →. An icon with no → needs a set in your list that has its meaning, or your own choice of icon: \`${iconUseCommand(main, [...(choice.backups ?? []).map(each => each.selector), '<set>'], choice.variant)}\`.`,
1715
+ );
1716
+ }
1717
+ return {
1718
+ id,
1719
+ label,
1720
+ status: missing.length > 0 ? 'fail' : 'warn',
1721
+ message: parts.join(' '),
1722
+ fix: fixes.join(' '),
1723
+ };
1724
+ }
1725
+
1299
1726
  /**
1300
1727
  * Check 10 — report the detected package manager, and say so when the project's
1301
1728
  * own declaration disagrees with what is on disk.
@@ -1868,6 +2295,46 @@ export function checkCliCommand(ctx) {
1868
2295
  };
1869
2296
  }
1870
2297
 
2298
+ /**
2299
+ * Install guidance: whether the loaded integrations agree on how this app
2300
+ * adds a dependency. Left out when none gives any.
2301
+ * @param {DoctorContext} ctx
2302
+ * @returns {DoctorCheck | null}
2303
+ */
2304
+ export function checkInstallGuidance(ctx) {
2305
+ const id = 'install-guidance';
2306
+ const label = 'Install guidance';
2307
+ const {
2308
+ value: guidance,
2309
+ conflict,
2310
+ declared,
2311
+ } = chooseDeclaredValue(
2312
+ declaredValuesOf(ctx.integrations ?? [], 'installGuidance'),
2313
+ );
2314
+ if (conflict) {
2315
+ const claims = declared
2316
+ .map(entry => `${entry.package} (\`${entry.value}\`)`)
2317
+ .join(', ');
2318
+ return {
2319
+ id,
2320
+ label,
2321
+ status: 'warn',
2322
+ message: `Loaded integrations give different install guidance: ${claims}. Neither is used, so install steps use the package manager's command.`,
2323
+ fix: 'Remove the integration that does not belong here, or have every package give the same `installGuidance` in its astryx.integration manifest.',
2324
+ };
2325
+ }
2326
+ if (guidance) {
2327
+ const packages = declared.map(entry => entry.package).join(', ');
2328
+ return {
2329
+ id,
2330
+ label,
2331
+ status: 'pass',
2332
+ message: `Install steps follow the installGuidance of ${packages}: \`${guidance}\`.`,
2333
+ };
2334
+ }
2335
+ return null;
2336
+ }
2337
+
1871
2338
  /* ── outside a project: the computer ─────────────────────────────────── */
1872
2339
 
1873
2340
  /**
@@ -2366,7 +2833,7 @@ export function checkGatherCache() {
2366
2833
  id: 'gather-cache',
2367
2834
  label: 'Kept catalog cache',
2368
2835
  status: 'info',
2369
- message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, the component list, integrations' theme records, what theme build checks a theme against in Core's component docs, the JavaScript theme build compiles from a theme's local TypeScript or JSX modules, what theme build finds when it checks a theme's pseudo-class keys and token names, the lookup commands' not-found hint's name summaries, npm's list of the files an integration package packs, the CLI's own docs tree, and doctor's docs checks and theme-wiring scan) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, the installed CLI's own files judged by its build id and folder (an upgrade, a reinstall or a copy in another folder changes them; in-place edits aren't supported), and deleting the folder clears it. A lookup command's not-found path may also create the folder, for its name index, and so may an integration package's \`integration check\` of itself, for npm's list. On Linux, when a debug handler is set, runs also keep the locale and time zone here. The folder holds at most ${summary.limitBytes / (1024 * 1024)} MB, dropping oldest entries first, as does the transpile cache in ${summary.jitiDir}, which keeps every copy written, or read where the file system records reads, in the last day.`,
2836
+ message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, the component list, integrations' theme records, what theme build checks a theme against in Core's component docs, the JavaScript theme build compiles from a theme's local TypeScript or JSX modules, what theme build finds when it checks a theme's pseudo-class keys and token names, the lookup commands' not-found hint's name summaries, npm's list of the files an integration package packs, the CLI's own docs tree, discover's record of the integrations a project loads and what each adds, and what it searches in its sources' saved copies, which search's discover line reads, and doctor's docs checks and theme-wiring scan) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, the installed CLI's own files judged by its build id and folder (an upgrade, a reinstall or a copy in another folder changes them; in-place edits aren't supported), and deleting the folder clears it. A lookup command's not-found path may also create the folder, for its name index, and so may an integration package's \`integration check\` of itself, for npm's list. On Linux, when a debug handler is set, runs also keep the locale and time zone here. The folder holds at most ${summary.limitBytes / (1024 * 1024)} MB, dropping oldest entries first, as does the transpile cache in ${summary.jitiDir}, which keeps every copy written, or read where the file system records reads, in the last day.`,
2370
2837
  };
2371
2838
  }
2372
2839
 
@@ -2379,6 +2846,8 @@ export function checkGatherCache() {
2379
2846
  export const SYNC_CHECKS = [
2380
2847
  checkNodeVersion,
2381
2848
  checkCoreInstalled,
2849
+ checkCoreStylesheets,
2850
+ checkBaseInstalled,
2382
2851
  checkVersionAlignment,
2383
2852
  checkImplicitIntegrations,
2384
2853
  checkConfiguredIntegrations,
@@ -2387,13 +2856,28 @@ export const SYNC_CHECKS = [
2387
2856
  checkIntegrationCoreRange,
2388
2857
  checkIconSets,
2389
2858
  checkIconPlaceholders,
2859
+ checkIconImports,
2390
2860
  checkAgentDocs,
2391
2861
  checkPeerDeps,
2392
2862
  checkPackageManager,
2393
2863
  checkCliCommand,
2864
+ checkInstallGuidance,
2394
2865
  checkGatherCache,
2395
2866
  ];
2396
2867
 
2868
+ /**
2869
+ * The checks that read Core. A project whose base is not Core reads no Core,
2870
+ * so they are left out of it, with the `themes` check, which counts Core's
2871
+ * theme packages.
2872
+ * @type {ReadonlySet<(ctx: DoctorContext) => DoctorCheck | null>}
2873
+ */
2874
+ const CORE_CHECKS = new Set([
2875
+ checkCoreInstalled,
2876
+ checkCoreStylesheets,
2877
+ checkVersionAlignment,
2878
+ checkPeerDeps,
2879
+ ]);
2880
+
2397
2881
  /**
2398
2882
  * Run all diagnostic checks and return a structured report.
2399
2883
  *
@@ -2414,6 +2898,7 @@ export async function runChecks(options = {}) {
2414
2898
  ...checkBuilt(built, {
2415
2899
  cwd,
2416
2900
  packages: builtIntegrationPackages(built, cwd),
2901
+ sourceBuild: sourceBuildOf(builtProjectRoot(built, cwd)),
2417
2902
  }),
2418
2903
  ];
2419
2904
  const summary = {pass: 0, warn: 0, fail: 0, info: 0};
@@ -2453,7 +2938,7 @@ export async function runChecks(options = {}) {
2453
2938
  let configuredIntegrations = null;
2454
2939
  /** @type {string|null} */
2455
2940
  let projectError = null;
2456
- /** @type {DoctorContext['iconSets']} */
2941
+ /** @type {Awaited<ReturnType<import('../../foundation/config/project.mjs').Project['iconSets']>> | null} */
2457
2942
  let iconSets = null;
2458
2943
  /** @type {import('../../foundation/config/project.mjs').Project | null} */
2459
2944
  let project = null;
@@ -2551,7 +3036,9 @@ export async function runChecks(options = {}) {
2551
3036
  docsCatalogError = err instanceof Error ? err.message : String(err);
2552
3037
  }
2553
3038
  try {
2554
- iconSets = await project.iconSets();
3039
+ iconSets = iconFeatureGate(project).on
3040
+ ? await project.iconSets()
3041
+ : null;
2555
3042
  } catch {
2556
3043
  iconSets = null;
2557
3044
  }
@@ -2584,7 +3071,10 @@ export async function runChecks(options = {}) {
2584
3071
  iconSets,
2585
3072
  // Set after the docs checks, below.
2586
3073
  iconPlaceholders: null,
3074
+ iconImports: null,
3075
+ base: project?.base.ok ? project.base.base : coreBase(),
2587
3076
  };
3077
+ const readsCore = ctx.base?.core !== false;
2588
3078
 
2589
3079
  // The checks that read only files, each kept while every file it read is
2590
3080
  // unchanged; the Core the project loads is part of what they read. They
@@ -2601,10 +3091,13 @@ export async function runChecks(options = {}) {
2601
3091
  checkDocsProgressiveDisclosure(ctx),
2602
3092
  ),
2603
3093
  ];
2604
- // Only a project that names an icon set scans its source for placeholders.
2605
- if (iconSets?.choice.configured) {
3094
+ // Only a project where icon features are on and a main set is decided
3095
+ // scans its source for placeholders: no other project gets the check.
3096
+ if (iconSets && placeholderMainSet(iconSets)) {
2606
3097
  try {
2607
- ctx.iconPlaceholders = findIconPlaceholders(findPackageRoot(cwd) ?? cwd);
3098
+ const projectDir = findPackageRoot(cwd) ?? cwd;
3099
+ ctx.iconPlaceholders = findIconPlaceholders(projectDir);
3100
+ ctx.iconImports = findIconImports(projectDir, iconSets);
2608
3101
  } catch {
2609
3102
  // A scan that fails leaves the icon facts unknown.
2610
3103
  ctx.iconSets = null;
@@ -2616,7 +3109,7 @@ export async function runChecks(options = {}) {
2616
3109
  // Run the theme checks and config check after the environment checks. The
2617
3110
  // released `themes` check keeps its place, ahead of the app-theme checks.
2618
3111
  for (const fn of SYNC_CHECKS) {
2619
- const check = fn(ctx);
3112
+ const check = readsCore || !CORE_CHECKS.has(fn) ? fn(ctx) : null;
2620
3113
  if (check) checks.push(check);
2621
3114
  if (fn === checkVersionAlignment) {
2622
3115
  const appThemeChecks = await checkAppThemes(cwd);
@@ -2628,10 +3121,8 @@ export async function runChecks(options = {}) {
2628
3121
  () => themeImportWiring(cwd),
2629
3122
  THEME_WIRING_CODEC,
2630
3123
  );
2631
- checks.push(
2632
- checkThemes(cwd, appThemeChecks, wiring),
2633
- ...withProviderWiring(appThemeChecks, wiring),
2634
- );
3124
+ if (readsCore) checks.push(checkThemes(cwd, appThemeChecks, wiring));
3125
+ checks.push(...withProviderWiring(appThemeChecks, wiring));
2635
3126
  checks.push(await checkConfig(ctx));
2636
3127
  }
2637
3128
  }