@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
@@ -54,7 +54,8 @@ export type DoctorOptions = {
54
54
  /**
55
55
  * A finished build to check for Astryx use: a
56
56
  * project folder, a build output folder, or one built file. Adds the
57
- * `built-astryx-usage` and `built-astryx-purity` checks.
57
+ * `built-astryx-usage`, `built-astryx-styles` (when the output uses
58
+ * Astryx) and `built-astryx-purity` checks.
58
59
  */
59
60
  built?: string | undefined;
60
61
  };
@@ -46,7 +46,8 @@
46
46
  * @property {string} [cwd]
47
47
  * @property {string} [built] A finished build to check for Astryx use: a
48
48
  * project folder, a build output folder, or one built file. Adds the
49
- * `built-astryx-usage` and `built-astryx-purity` checks.
49
+ * `built-astryx-usage`, `built-astryx-styles` (when the output uses
50
+ * Astryx) and `built-astryx-purity` checks.
50
51
  */
51
52
 
52
53
  export {};
@@ -1,6 +1,25 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * The string values a source file holds, object keys included, read from its
6
+ * syntax tree, so a commented-out copy never counts. A config names a plugin
7
+ * package this way (`plugins: {'@acme/postcss': {}}`).
8
+ * @param {string} source
9
+ * @returns {Set<string>}
10
+ */
11
+ export function stringValues(source: string): Set<string>;
12
+ /**
13
+ * The module specifiers a source file imports, re-exports, or loads with
14
+ * `import()` or `require()`, read from its syntax tree, so a commented-out
15
+ * or quoted copy never counts.
16
+ * @param {string} source
17
+ * @param {{runtimeOnly?: boolean}} [options] - skip type-only imports and
18
+ * re-exports, which the build erases
19
+ */
20
+ export function moduleSpecifiers(source: string, options?: {
21
+ runtimeOnly?: boolean;
22
+ }): Set<any>;
4
23
  /**
5
24
  * The themes the app wires itself, without a generated theme module or a
6
25
  * package.json `astryx.theme`. A theme is wired when the app's own source
@@ -11,6 +11,7 @@ import * as path from 'node:path';
11
11
  import {babelParse as parse} from '../../foundation/runtime/lazy-dependencies.mjs';
12
12
  import {postcss} from '../../foundation/runtime/lazy-dependencies.mjs';
13
13
  import {
14
+ addMatchingCore,
14
15
  collectUnloadedFonts,
15
16
  fontPackagesInstallLine,
16
17
  discoverDoctorThemes,
@@ -44,6 +45,7 @@ import {
44
45
  dependencyInstallFor,
45
46
  coreAddCommand,
46
47
  packageInstallCommand,
48
+ packageInstallStep,
47
49
  themeBuild,
48
50
  themeRecordOwner,
49
51
  themeShippedImportFindings,
@@ -126,8 +128,21 @@ function refreshThemeCommand(projectDir, run, available, slug, owner) {
126
128
  ? null
127
129
  : dependencyInstallFor(projectDir, owner);
128
130
  if (install) return install;
129
- const selector = theme?.package ?? owner;
130
- return `npm install ${owner}@latest; ${run} theme add ${slug} --package ${selector}`;
131
+ // The package is added the way the project adds it, at the release its
132
+ // Core peer needs, then the theme again; by its owner only when another
133
+ // package owns the same slug. The recorded owner counts even when it is
134
+ // not installed, so a bundled theme with the same slug still needs it.
135
+ const owners = new Set([
136
+ owner,
137
+ ...available
138
+ .filter(candidate => candidate.slug === slug)
139
+ .map(themeRecordOwner),
140
+ ]);
141
+ const add =
142
+ owners.size > 1
143
+ ? `${run} theme add ${slug} --package ${owner}`
144
+ : `${run} theme add ${slug}`;
145
+ return `${addMatchingCore(projectDir, owner)}; ${add}`;
131
146
  }
132
147
  const source = theme
133
148
  ? relative(projectDir, path.join(theme.sourceDir, theme.entry))
@@ -167,11 +182,36 @@ function walkAst(value, visit) {
167
182
  }
168
183
 
169
184
  /**
185
+ * The string values a source file holds, object keys included, read from its
186
+ * syntax tree, so a commented-out copy never counts. A config names a plugin
187
+ * package this way (`plugins: {'@acme/postcss': {}}`).
188
+ * @param {string} source
189
+ * @returns {Set<string>}
190
+ */
191
+ export function stringValues(source) {
192
+ const values = new Set();
193
+ walkAst(parseModule(source), node => {
194
+ if (node.type === 'StringLiteral') values.add(node.value);
195
+ if (
196
+ node.type === 'TemplateLiteral' &&
197
+ node.expressions?.length === 0 &&
198
+ typeof node.quasis?.[0]?.value?.cooked === 'string'
199
+ ) {
200
+ values.add(node.quasis[0].value.cooked);
201
+ }
202
+ });
203
+ return values;
204
+ }
205
+
206
+ /**
207
+ * The module specifiers a source file imports, re-exports, or loads with
208
+ * `import()` or `require()`, read from its syntax tree, so a commented-out
209
+ * or quoted copy never counts.
170
210
  * @param {string} source
171
211
  * @param {{runtimeOnly?: boolean}} [options] - skip type-only imports and
172
212
  * re-exports, which the build erases
173
213
  */
174
- function moduleSpecifiers(source, options = {}) {
214
+ export function moduleSpecifiers(source, options = {}) {
175
215
  const values = new Set();
176
216
  walkAst(parseModule(source), node => {
177
217
  if (
@@ -992,6 +1032,19 @@ export async function themeImportWiring(cwd) {
992
1032
  };
993
1033
  }
994
1034
 
1035
+ /**
1036
+ * The fix line for a project with no installed theme: the install guidance
1037
+ * its integrations give, else the install command in the project's package
1038
+ * manager, or `npm install` with a note when its lockfiles disagree.
1039
+ * @param {string} cwd
1040
+ * @param {string} run the CLI invocation stem
1041
+ * @returns {string}
1042
+ */
1043
+ function themeInstallFix(cwd, run) {
1044
+ const {line, note} = packageInstallStep(['@astryxdesign/theme-neutral'], cwd);
1045
+ return `Install a theme, e.g. \`${line}\`${note ? ` (${note})` : ''}, then add it to the app with \`${run} theme add neutral\`.`;
1046
+ }
1047
+
995
1048
  /**
996
1049
  * The pass message's list of themes wired by import, each with the file that
997
1050
  * imports it.
@@ -1126,7 +1179,7 @@ export function checkThemes(
1126
1179
  label,
1127
1180
  status: 'warn',
1128
1181
  message: 'No @astryxdesign/theme-* packages are installed.',
1129
- fix: `Install a theme, e.g. \`npm install @astryxdesign/theme-neutral\`, then add it to the app with \`${run} theme add neutral\`.`,
1182
+ fix: themeInstallFix(cwd, run),
1130
1183
  };
1131
1184
  }
1132
1185
  const names = packages.join(', ');
@@ -1347,7 +1400,21 @@ export async function checkAppThemes(cwd) {
1347
1400
  unshippedImports.push({
1348
1401
  slug,
1349
1402
  owner,
1350
- message: `Theme "${slug}" from ${owner}: its built module loads, but ${unshipped.some(finding => finding.code === 'relative_import_not_shipped') ? 'it or its stylesheet names a file the package does not ship' : 'it imports TypeScript source'}, so an app's bundler cannot build it: ${unshipped.map(finding => finding.message).join(' ')}`,
1403
+ // Each cause the findings hold is named: a theme can have both.
1404
+ message: `Theme "${slug}" from ${owner}: its built module loads, but ${[
1405
+ ...(unshipped.some(
1406
+ finding => finding.code === 'relative_import_not_shipped',
1407
+ )
1408
+ ? ['it or its stylesheet names a file the package does not ship']
1409
+ : []),
1410
+ ...(unshipped.some(
1411
+ finding => finding.code === 'built_module_imports_typescript',
1412
+ )
1413
+ ? ['it imports TypeScript source']
1414
+ : []),
1415
+ ].join(
1416
+ ', and ',
1417
+ )}, so an app's bundler cannot build it: ${unshipped.map(finding => finding.message).join(' ')}`,
1351
1418
  });
1352
1419
  }
1353
1420
  resolved.push(resolvedTheme);
@@ -1677,7 +1744,8 @@ export async function checkAppThemes(cwd) {
1677
1744
  '; ',
1678
1745
  )}.${stale.length > 0 ? ` Local theme outputs are also missing or stale: ${stale.join(', ')}.` : ''}${refused.length > 0 ? ` Not checked (a private theme variable; see theme-private-variables): ${refused.join(', ')}.` : ''}`,
1679
1746
  fix: [
1680
- install?.installCommand ??
1747
+ install?.installGuidance ??
1748
+ install?.installCommand ??
1681
1749
  install?.noCommandReason ??
1682
1750
  `Install ${packages.join(', ')}.`,
1683
1751
  ...refresh,
@@ -16,7 +16,7 @@ export type HookParamDoc = import("@astryxdesign/cli/authoring").HookParamDoc;
16
16
  export type HookListResponse = {
17
17
  type: "hook.list";
18
18
  /**
19
- * `@astryxdesign/core`, the only package that ships hooks.
19
+ * The run's base: `@astryxdesign/core`, or the active base when it is not Core.
20
20
  */
21
21
  package: string;
22
22
  data: HookListData;
@@ -39,7 +39,7 @@
39
39
  *
40
40
  * @typedef {object} HookListResponse
41
41
  * @property {'hook.list'} type
42
- * @property {string} package `@astryxdesign/core`, the only package that ships hooks.
42
+ * @property {string} package The run's base: `@astryxdesign/core`, or the active base when it is not Core.
43
43
  * @property {HookListData} data
44
44
  */
45
45
 
@@ -9,7 +9,7 @@
9
9
  * identical to the flat command's list branch.
10
10
  *
11
11
  * @input { cwd, category?, detail, zh, lang }
12
- * @output HookListResponse ({ type: 'hook.list', package: CORE_PACKAGE, data: { detail, components } })
12
+ * @output HookListResponse ({ type: 'hook.list', package: <the run's base>, data: { detail, components } })
13
13
  * @position api/hook/list/list.mjs — dispatched from ../hook.mjs
14
14
  */
15
15
 
@@ -21,6 +21,7 @@ import {loadDocs} from '../../../foundation/discovery/component-loader.mjs';
21
21
  import {AstryxError} from '../../error.mjs';
22
22
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
23
23
  import {CORE_PACKAGE, resolveCoreDir} from '../_adapter.mjs';
24
+ import {runBase} from '../../../foundation/bases/resolve.mjs';
24
25
 
25
26
  /**
26
27
  * @param {object} [options]
@@ -40,6 +41,9 @@ export async function list({
40
41
  } = {}) {
41
42
  const coreDir = resolveCoreDir(cwd);
42
43
  const hooks = discoverHooks(coreDir);
44
+ // The list names the run's base, the package its items come from.
45
+ const run = runBase(cwd);
46
+ const pkg = run.ok ? run.base.name : CORE_PACKAGE;
43
47
 
44
48
  if (category) {
45
49
  const match = Object.entries(hooks).find(
@@ -82,7 +86,7 @@ export async function list({
82
86
  }
83
87
  }
84
88
  return {
85
- type: 'hook.list', package: CORE_PACKAGE,
89
+ type: 'hook.list', package: pkg,
86
90
  data: {detail: 'compact', components: {[match[0]]: entries}},
87
91
  };
88
92
  }
@@ -111,14 +115,14 @@ export async function list({
111
115
  }
112
116
  }
113
117
  return {
114
- type: 'hook.list', package: CORE_PACKAGE,
118
+ type: 'hook.list', package: pkg,
115
119
  data: {detail: 'full', components: {[match[0]]: entries}},
116
120
  };
117
121
  }
118
122
 
119
123
  // Default: names only
120
124
  return {
121
- type: 'hook.list', package: CORE_PACKAGE,
125
+ type: 'hook.list', package: pkg,
122
126
  data: {detail: 'names', components: {[match[0]]: match[1]}},
123
127
  };
124
128
  }
@@ -155,7 +159,7 @@ export async function list({
155
159
  }
156
160
  }
157
161
  }
158
- return {type: 'hook.list', package: CORE_PACKAGE, data: {detail: 'compact', components: result}};
162
+ return {type: 'hook.list', package: pkg, data: {detail: 'compact', components: result}};
159
163
  }
160
164
 
161
165
  if (detail === 'full') {
@@ -186,9 +190,9 @@ export async function list({
186
190
  }
187
191
  }
188
192
  }
189
- return {type: 'hook.list', package: CORE_PACKAGE, data: {detail: 'full', components: result}};
193
+ return {type: 'hook.list', package: pkg, data: {detail: 'full', components: result}};
190
194
  }
191
195
 
192
196
  // Default: names only
193
- return {type: 'hook.list', package: CORE_PACKAGE, data: {detail: 'names', components: hooks}};
197
+ return {type: 'hook.list', package: pkg, data: {detail: 'names', components: hooks}};
194
198
  }
@@ -66,8 +66,9 @@ export { lookThemeMap } from "../../foundation/discovery/icon-set-theme-maps.mjs
66
66
  export { exportValueKind } from "../../foundation/discovery/module-exports.mjs";
67
67
  export { templateIconMeanings } from "../../foundation/discovery/template-icon-meanings.mjs";
68
68
  export { iconRecord, importLine, leadingReading, matchIcon, answeringMatches, rankIcons, scoreIcon } from "../../foundation/discovery/icon-ranking.mjs";
69
- export { iconSetKey, ICON_USE_ORDER_COMMAND, iconSetLook, iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
69
+ export { iconSetKey, ICON_USE_ORDER_COMMAND, iconLookExport, iconSetLook, iconUseCommand, missingIconLook, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
70
70
  export { setConfigString, setConfigValues } from "../../foundation/config/config-writer.mjs";
71
71
  export { assertIconExport, checkNewDefinition, definitionNameFromInput, definitionFile, findLocalIconSet, writeDefinitionFile, iconIdOf, closestNames, libraryIcons, mappableDefinitions, resolveIconSource, generatedModulePath, generatedNamesOf, generatedOrigins, iconModulePackage, sameIconModule, iconExportName, iconNaming, modulePrefix, moduleNaming, iconNamingWithoutLook, splitLook, setModuleNote, variantExportName, writeGeneratedIcons, writeIconSetData, definitionNameOf, iconIdIn, iconsWithWord, localSourceNote, THEME_MAP_NAME } from "../../foundation/discovery/icon-set-writer.mjs";
72
+ export { ICON_SET_GUIDE_COMMAND, ICON_USE_COMMAND, noIconSetNext } from "../../foundation/text/icon-set-next.mjs";
72
73
  export { addIconDefinition, addIconSet } from "./_authoring.mjs";
73
74
  export { checkVariantLook, drawnLooks } from "./_default-look.mjs";
@@ -20,7 +20,7 @@ import {
20
20
  allOrNothing,
21
21
  } from '../../foundation/discovery/icon-set-writer.mjs';
22
22
  import {PathSafetyError} from '../../foundation/fs/path-safety.mjs';
23
- import {isOutsideProject} from '../../foundation/env/project-scope.mjs';
23
+ import {isOutsideAnyPackage} from '../../foundation/env/project-scope.mjs';
24
24
  import {projectIconSetCliWarning} from '../../foundation/integrations/cli-requirement.mjs';
25
25
  import {findLocalIconSet} from '../../foundation/discovery/icon-set-writer.mjs';
26
26
  import {
@@ -46,8 +46,10 @@ export {
46
46
  export {lookThemeMap} from '../../foundation/discovery/icon-set-theme-maps.mjs';
47
47
  export {
48
48
  ICON_USE_ORDER_COMMAND,
49
+ iconLookExport,
49
50
  iconSetLook,
50
51
  iconUseCommand,
52
+ missingIconLook,
51
53
  unlistedIconSets,
52
54
  } from '../../foundation/discovery/icon-set-discovery.mjs';
53
55
  export {
@@ -85,6 +87,11 @@ export {
85
87
  } from '../../foundation/discovery/icon-set-writer.mjs';
86
88
  export {exportValueKind} from '../../foundation/discovery/module-exports.mjs';
87
89
  export {templateIconMeanings} from '../../foundation/discovery/template-icon-meanings.mjs';
90
+ export {
91
+ ICON_SET_GUIDE_COMMAND,
92
+ ICON_USE_COMMAND,
93
+ noIconSetNext,
94
+ } from '../../foundation/text/icon-set-next.mjs';
88
95
  export {addIconDefinition, addIconSet} from './_authoring.mjs';
89
96
  export {checkVariantLook, drawnLooks} from './_default-look.mjs';
90
97
 
@@ -97,9 +104,8 @@ export {checkVariantLook, drawnLooks} from './_default-look.mjs';
97
104
  * @param {string} where what to run it in
98
105
  */
99
106
  export function refuseOutsideProject(cwd, command, where) {
100
- // A folder with a package.json at or above it is a package being authored,
101
- // even before it declares Astryx; that package's own checks answer there.
102
- if (!isOutsideProject(cwd) || hasPackageJsonAbove(cwd)) return;
107
+ // A package being authored answers with its own checks.
108
+ if (!isOutsideAnyPackage(cwd)) return;
103
109
  throw new AstryxError(
104
110
  `astryx ${command} works only in a project. Run it in ${where}.`,
105
111
  [],
@@ -107,17 +113,6 @@ export function refuseOutsideProject(cwd, command, where) {
107
113
  );
108
114
  }
109
115
 
110
- /**
111
- * Is there a package.json in `dir` or a folder above it?
112
- * @param {string} dir
113
- */
114
- function hasPackageJsonAbove(dir) {
115
- for (let at = path.resolve(dir); ; at = path.dirname(at)) {
116
- if (fs.existsSync(path.join(at, 'package.json'))) return true;
117
- if (path.dirname(at) === at) return false;
118
- }
119
- }
120
-
121
116
  /**
122
117
  * Run one authoring command so its writes are all or nothing, turning its
123
118
  * errors into AstryxErrors.
@@ -33,7 +33,9 @@ export function withdrawnReason(withdrawn: Array<{
33
33
  * The one error every icon entry point gives for a set selector that names
34
34
  * no valid installed set (AST-084 FR17): withdrawn, with its reason, when it
35
35
  * names an installed set that was withdrawn; else not installed. Both are
36
- * `ERR_NOT_FOUND`, with the closest valid sets as suggestions.
36
+ * `ERR_NOT_FOUND`, with the closest valid sets as suggestions. With no set
37
+ * installed at all, it says so and how to get one; with only withdrawn sets,
38
+ * it points at `--list`, which says why each is withdrawn.
37
39
  * @param {Array<{name: string, package: string}>} sets the valid sets
38
40
  * @param {Array<{name: string, package: string, reason: string}>} withdrawn
39
41
  * @param {string} selector
@@ -24,6 +24,7 @@ export {
24
24
  rankIcons,
25
25
  scoreIcon,
26
26
  } from './_adapter.mjs';
27
+ import {ICON_SET_GUIDE_COMMAND, ICON_USE_COMMAND} from './_adapter.mjs';
27
28
 
28
29
  /** @typedef {import('../../foundation/discovery/icon-set-discovery.mjs').DiscoveredIconSet} DiscoveredIconSet */
29
30
  /** @typedef {import('../../authoring/doctypes/icon-set/type').IconSetIcon} IconSetIcon */
@@ -61,16 +62,42 @@ export function withdrawnReason(withdrawn, selector) {
61
62
  * The one error every icon entry point gives for a set selector that names
62
63
  * no valid installed set (AST-084 FR17): withdrawn, with its reason, when it
63
64
  * names an installed set that was withdrawn; else not installed. Both are
64
- * `ERR_NOT_FOUND`, with the closest valid sets as suggestions.
65
+ * `ERR_NOT_FOUND`, with the closest valid sets as suggestions. With no set
66
+ * installed at all, it says so and how to get one; with only withdrawn sets,
67
+ * it points at `--list`, which says why each is withdrawn.
65
68
  * @param {Array<{name: string, package: string}>} sets the valid sets
66
69
  * @param {Array<{name: string, package: string, reason: string}>} withdrawn
67
70
  * @param {string} selector
68
71
  * @returns {AstryxError}
69
72
  */
70
73
  export function unusableSet(sets, withdrawn, selector) {
74
+ const reason = withdrawnReason(withdrawn, selector);
75
+ if (reason == null && sets.length === 0) {
76
+ return withdrawn.length === 0
77
+ ? new AstryxError(
78
+ `No icon set named "${selector}": no icon set is installed.`,
79
+ [
80
+ {
81
+ name: ICON_USE_COMMAND,
82
+ reason: 'after you install a package that ships an icon set',
83
+ },
84
+ {name: ICON_SET_GUIDE_COMMAND, reason: 'make your own icon set'},
85
+ ],
86
+ ERROR_CODES.ERR_NOT_FOUND,
87
+ )
88
+ : new AstryxError(
89
+ `No installed icon set named "${selector}"`,
90
+ [
91
+ {
92
+ name: 'astryx experimental icon --list',
93
+ reason: 'why each installed set is withdrawn',
94
+ },
95
+ ],
96
+ ERROR_CODES.ERR_NOT_FOUND,
97
+ );
98
+ }
71
99
  return new AstryxError(
72
- withdrawnReason(withdrawn, selector) ??
73
- `No installed icon set named "${selector}"`,
100
+ reason ?? `No installed icon set named "${selector}"`,
74
101
  closest(
75
102
  selector,
76
103
  sets.flatMap(each => [each.name, `${each.package}/${each.name}`]),
@@ -17,7 +17,7 @@ export const doc = {
17
17
  summary:
18
18
  'The icon sets icon() searches in a folder, as plain JSON to store and rank later with rankIconIndex().',
19
19
  description:
20
- "Reads the icon sets `icon()` would search in `cwd` and returns them as `{version, sets, withdrawn}`. Reading them loads each installed package's integration manifest, which runs that package's code, so a catalog that lists packages it must not load makes the index where loading is safe (a folder with those packages installed), stores it, and ranks it with {@link function:rankIconIndex}. With `package`, the index keeps only the sets that package ships, for a catalog that stores one index per package. Paths into the folder are left out, so an index reads the same wherever it was made. The sets are the ranker's input, not a stable shape: an index is ranked only by the CLI version that made it. Experimental: it may change or be removed in a patch release.",
20
+ "Reads the icon sets `icon()` would search in `cwd` and returns them as `{version, sets, withdrawn}`. Reading them loads each installed package's integration manifest, which runs that package's code, so a catalog that lists packages it must not load makes the index where loading is safe (a folder with those packages installed), stores it, and ranks it with {@link function:rankIconIndex}. With `package`, the index keeps only the sets that package ships, for a catalog that stores one index per package. Paths into the folder are left out, so an index reads the same wherever it was made. A set in the list of the folder's project carries the look that project picks (`look`), so its matches draw that look as `icon()` draws it there. The sets are the ranker's input, not a stable shape: an index is ranked only by the CLI version that made it. Experimental: it may change or be removed in a patch release.",
21
21
  importPath: '@astryxdesign/cli/api',
22
22
  signature:
23
23
  'exportIconIndex(options?: {cwd?: string, package?: string}): Promise<IconIndex>',
@@ -16,7 +16,7 @@ export const doc = {
16
16
  summary:
17
17
  'Find an icon by meaning in the installed icon sets, read one icon, or list the sets.',
18
18
  description:
19
- "Reads every installed icon set's data file, never the icon modules. With words it ranks icons by meaning: an icon definition the set's `map` names the icon for, then exact matches on its id or words, then a word that starts with the query, then partial matches; equal scores keep the project's set first, then integration load order; within a set, a whole-id name match before an id-part one and a meaning match by its tag position; then id order. With `<set>/<id>` it reads one icon with every variant's import line. With `list` it lists the installed sets, how many icon definitions each one's `map` covers (built-in and all of Astryx's) and its own definitions, and any set withdrawn and why. Experimental: it may change or be removed in a patch release.",
19
+ "Reads every installed icon set's data file, never the icon modules. With words it ranks icons by meaning: an icon definition the set's `map` names the icon for, then exact matches on its id or words, then a word that starts with the query, then partial matches, and for a query of several words that none of those answer, the icons that carry some of its words, rarer words counting more within a set. A word written as an export name (`SearchIcon`) also reads as its words, and the reading with the better match answers. Equal scores keep the project's set first, then integration load order; within a set, a whole-id name match before an id-part one and a meaning match by its tag position; then id order. With `<set>/<id>` it reads one icon with every variant's import line. With `list` it lists the installed sets, how many icon definitions each one's `map` covers (built-in and all of Astryx's) and its own definitions, and any set withdrawn and why. Experimental: it may change or be removed in a patch release.",
20
20
  importPath: '@astryxdesign/cli/api',
21
21
  signature:
22
22
  'icon(query?: string, options?: IconOptions): Promise<IconSearchResponse | IconDetailResponse | IconListResponse>',
@@ -69,7 +69,7 @@ export const doc = {
69
69
  {
70
70
  type: 'icon.search',
71
71
  description:
72
- 'The query, how many icons matched, and the ranked matches, each with its set, id, package, module, export, import line, words, filled names, variants, reason, and score. No match is an empty list.',
72
+ "The query, how many icons matched, and the ranked matches, each with its set, id, package, module, export, import line, words, filled names, variants, reason, and score. No match is an empty list. When the project picks a look (`experimental.iconVariant`), a match from a set in the project's list has the module, export, and import of that look; one whose icon lacks the look keeps its own and names both looks in `look` ({asked, used}). With no icon set installed, `reason` says so, `definitions` lists the Astryx icon definitions that match ({name, builtIn, description}), built-in ones first, since Core draws those by name, and `next` says how to get a set.",
73
73
  },
74
74
  {
75
75
  type: 'icon.detail',
@@ -89,7 +89,7 @@ export const doc = {
89
89
  {
90
90
  type: 'icon.list',
91
91
  description:
92
- "The project's icon-set state, each installed set with its package, license, icon count, default variant, declared variants, and the icon definitions its `map` covers, and each withdrawn set with its reason.",
92
+ "The project's icon-set state, each installed set with its package, license, icon count, default variant, declared variants, and the icon definitions its `map` covers, and each withdrawn set with its reason. `next` is present when two or more sets are installed and none is the main set, with the command that chooses one, or when no set is installed, with how to get one.",
93
93
  },
94
94
  ],
95
95
  throws: [
@@ -75,11 +75,35 @@ export type IconRecord = {
75
75
  variants: IconVariantEntry[];
76
76
  };
77
77
  /**
78
- * One ranked icon match.
78
+ * One ranked icon match. When the project picks a look and the match's set
79
+ * is in its list, `module`, `export`, and `import` draw that look; `look`
80
+ * is present when the icon does not have it.
79
81
  */
80
82
  export type IconMatchEntry = IconRecord & {
81
83
  reason: string;
82
84
  score: number;
85
+ look?: {
86
+ asked: string;
87
+ used: string | null;
88
+ };
89
+ };
90
+ /**
91
+ * One Astryx icon definition that matches a query when no icon set is
92
+ * installed.
93
+ */
94
+ export type IconSearchDefinition = {
95
+ /**
96
+ * - The definition's name.
97
+ */
98
+ name: string;
99
+ /**
100
+ * - Core draws it by name with no icon set.
101
+ */
102
+ builtIn: boolean;
103
+ /**
104
+ * - What the definition means.
105
+ */
106
+ description: string;
83
107
  };
84
108
  /**
85
109
  * `astryx --json experimental icon <words>`.
@@ -90,6 +114,9 @@ export type IconSearchResponse = {
90
114
  query: string;
91
115
  matchCount: number;
92
116
  matches: IconMatchEntry[];
117
+ reason?: string | undefined;
118
+ definitions?: IconSearchDefinition[] | undefined;
119
+ next?: string | undefined;
93
120
  };
94
121
  };
95
122
  /**
@@ -683,6 +710,10 @@ export type IconIndexSet = {
683
710
  definitions: Array<{
684
711
  doc: Record<string, unknown>;
685
712
  }>;
713
+ /**
714
+ * - The look the folder's project draws the set in (`experimental.iconVariant`), when the set is in its list.
715
+ */
716
+ look?: string | undefined;
686
717
  };
687
718
  /**
688
719
  * The icon sets `icon` searches in a folder, as `exportIconIndex()` returns
@@ -45,9 +45,21 @@
45
45
  */
46
46
 
47
47
  /**
48
- * One ranked icon match.
48
+ * One ranked icon match. When the project picks a look and the match's set
49
+ * is in its list, `module`, `export`, and `import` draw that look; `look`
50
+ * is present when the icon does not have it.
49
51
  * @experimental May change or be removed in a patch release.
50
- * @typedef {IconRecord & {reason: string, score: number}} IconMatchEntry
52
+ * @typedef {IconRecord & {reason: string, score: number, look?: {asked: string, used: string | null}}} IconMatchEntry
53
+ */
54
+
55
+ /**
56
+ * One Astryx icon definition that matches a query when no icon set is
57
+ * installed.
58
+ * @experimental May change or be removed in a patch release.
59
+ * @typedef {object} IconSearchDefinition
60
+ * @property {string} name - The definition's name.
61
+ * @property {boolean} builtIn - Core draws it by name with no icon set.
62
+ * @property {string} description - What the definition means.
51
63
  */
52
64
 
53
65
  /**
@@ -59,6 +71,9 @@
59
71
  * @property {string} data.query
60
72
  * @property {number} data.matchCount - Every match, before `limit`.
61
73
  * @property {IconMatchEntry[]} data.matches - The ranked matches, at most `limit`.
74
+ * @property {string} [data.reason] - Present when no icon set is installed: why nothing matches.
75
+ * @property {IconSearchDefinition[]} [data.definitions] - Present when no icon set is installed: the Astryx icon definitions that match, built-in ones first, at most `limit`.
76
+ * @property {string} [data.next] - Present when no icon set is installed: how to get one.
62
77
  */
63
78
 
64
79
  /**
@@ -119,7 +134,7 @@
119
134
  * @property {string[]} data.order - The project's list as `<package>/<set>`: the main set, then each backup that resolves; empty when no main set is selected.
120
135
  * @property {string | null} data.variant - The look the project's icons draw, as `experimental.iconVariant` names it; null when it names none.
121
136
  * @property {Array<{iconSet: string, status: 'selected' | 'ambiguous' | 'missing' | 'withdrawn', reason: string}>} data.backups - Each backup the list names, and whether it resolves.
122
- * @property {string} [data.next] - Present when two or more sets are installed and none is the main set: the command that chooses the order.
137
+ * @property {string} [data.next] - Present when two or more sets are installed and none is the main set: the command that chooses the order; or when no set is installed: how to get one.
123
138
  * @property {IconSetEntry[]} data.sets - Installed sets in list order: the main set, its backups, then the rest.
124
139
  * @property {IconWithdrawnEntry[]} data.withdrawn - Sets found but withdrawn.
125
140
  */
@@ -399,6 +414,7 @@
399
414
  * @property {string} package - The integration package that ships the set.
400
415
  * @property {import('../../authoring/doctypes/icon-set/type').IconSetData} data - The set's data file.
401
416
  * @property {Array<{doc: Record<string, unknown>}>} definitions - The set's own icon definitions.
417
+ * @property {string} [look] - The look the folder's project draws the set in (`experimental.iconVariant`), when the set is in its list.
402
418
  */
403
419
 
404
420
  /**
@@ -12,6 +12,7 @@
12
12
  import {
13
13
  astryxIconDefinitions,
14
14
  ICON_USE_ORDER_COMMAND,
15
+ noIconSetNext,
15
16
  iconSetKey,
16
17
  iconSetLook,
17
18
  loadIconSets,
@@ -47,7 +48,9 @@ export async function iconList({cwd}) {
47
48
  ? {
48
49
  next: `${sets.length} icon sets are installed and none is your main set: run \`${ICON_USE_ORDER_COMMAND}\`.`,
49
50
  }
50
- : {}),
51
+ : sets.length === 0 && withdrawn.length === 0
52
+ ? {next: noIconSetNext()}
53
+ : {}),
51
54
  sets: sets.map(set => {
52
55
  const rank = order.indexOf(set);
53
56
  const mapped = new Set(Object.keys(set.data.map ?? {}));
@@ -17,7 +17,7 @@ export const doc = {
17
17
  summary:
18
18
  "Ranks stored icon indexes with icon()'s own ranking: an index made in one folder answers as icon() does there.",
19
19
  description:
20
- "Ranks the sets of every index together, with the same ranking as {@link function:icon}. An index made with `exportIconIndex()` in one folder answers a word search exactly as `icon(query)` does in that folder: the same matches, order, scores, and `matchCount`. A `<set>/<id>` query, which `icon()` reads as one icon, is refused. Indexes made in separate folders are ranked as one list, in the order they are given: equal scores keep that order, as `icon()` keeps a project's set order. An index holds no project choice, so no set leads unless its index comes first. `set` keeps one set, by name or `<package>/<set>`, with the errors `icon()` gives. Every index must come from this CLI's version, because the sets' shape is the ranker's input. Experimental: it may change or be removed in a patch release.",
20
+ "Ranks the sets of every index together, with the same ranking as {@link function:icon}. An index made with `exportIconIndex()` in one folder answers a word search exactly as `icon(query)` does in that folder: the same matches, order, scores, and `matchCount`. A `<set>/<id>` query, which `icon()` reads as one icon, is refused. Indexes made in separate folders are ranked as one list, in the order they are given: equal scores keep that order, as `icon()` keeps a project's set order. An index holds no project order, so no set leads unless its index comes first; each set draws the look its index carries. `set` keeps one set, by name or `<package>/<set>`, with the errors `icon()` gives. Every index must come from this CLI's version, because the sets' shape is the ranker's input. Experimental: it may change or be removed in a patch release.",
21
21
  importPath: '@astryxdesign/cli/api',
22
22
  signature:
23
23
  'rankIconIndex(query: string, indexes: IconIndex | IconIndex[], options?: {set?: string, limit?: number}): Promise<IconSearchResponse>',