@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
@@ -11,9 +11,28 @@
11
11
  * @param {import('./search.type.mjs').SearchResponse} lexical every lexical match
12
12
  * @param {string} query
13
13
  * @param {number} limit
14
+ * @param {Map<string, string>} [families] each family member's
15
+ * `domain:name`, mapped to the family its doc lists it in
14
16
  * @returns {import('./search.type.mjs').SearchResponse}
15
17
  */
16
- export function orderMatches(table: EntryTable, order: number[], lexical: import("./search.type.mjs").SearchResponse, query: string, limit: number): import("./search.type.mjs").SearchResponse;
18
+ export function orderMatches(table: EntryTable, order: number[], lexical: import("./search.type.mjs").SearchResponse, query: string, limit: number, families?: Map<string, string>): import("./search.type.mjs").SearchResponse;
19
+ /**
20
+ * The first result's tie goes to the match whose own name holds more query
21
+ * words. Among matches of one domain that the lexical ranker scored the same
22
+ * as the first result, and that matched the same query words (the terms
23
+ * their reasons list), the match whose name words hold more of the query's
24
+ * words than the first result's name moves first. A first result whose
25
+ * reason lists no terms keeps its place: it matched the whole query, or the
26
+ * query holds its title. A part of the first result never takes its place
27
+ * this way: rootsFirst decides between a family's root and its parts. Only
28
+ * the first place changes, and nothing crosses a block or a domain.
29
+ * @param {Item[]} ranked
30
+ * @param {string} query
31
+ * @param {(item: Item) => string} blockOf
32
+ * @param {Map<string, string>} [families]
33
+ * @returns {Item[]}
34
+ */
35
+ export function tieByOwnName(ranked: Item[], query: string, blockOf: (item: Item) => string, families?: Map<string, string>): Item[];
17
36
  /**
18
37
  * An integration's matches that the lexical ranker scored the same keep its
19
38
  * order among themselves: they have no cards, so the learned order would only
@@ -22,6 +41,22 @@ export function orderMatches(table: EntryTable, order: number[], lexical: import
22
41
  * @returns {Item[]}
23
42
  */
24
43
  export function integrationTies(items: Item[]): Item[];
44
+ /**
45
+ * A family's root leads a part of its own family in their run (same band,
46
+ * same domain) when the part adds nothing the reader asked for: the root
47
+ * answers every query word the part answers, and no query word is a word of
48
+ * the part's name, in any plural or stem form, that does not start a word
49
+ * of the root's name. `tabs` puts TabList before its Tab; a query holding
50
+ * "item" keeps ListItem before List, since "item" is only the part's. The
51
+ * root moves just ahead of the part; nothing else moves, and nothing crosses
52
+ * a run.
53
+ * @param {Item[]} ranked
54
+ * @param {Map<string, string>} families each member's `domain:name`, mapped
55
+ * to its family's name
56
+ * @param {string} query
57
+ * @returns {Item[]}
58
+ */
59
+ export function rootsFirst(ranked: Item[], families: Map<string, string>, query: string): Item[];
25
60
  export function bandOf(score: number): number;
26
61
  export type EntryTable = import("./_entries.mjs").EntryTable;
27
62
  export type Item = {
@@ -13,12 +13,18 @@
13
13
  * query of one or two words, the matches on every word keep their lexical
14
14
  * order; and an integration's matches that scored the same keep theirs.
15
15
  * Below the first result, a block of one domain is ordered by fit (tiesByFit): a part of the first result, then rarer matched
16
- * words, then the lexical order.
16
+ * words, then the lexical order. Before that, a family's root leads a part of
17
+ * its own family in their run when the part answers no query word the root
18
+ * does not and the query names nothing that only the part is (rootsFirst).
19
+ * Then, among matches tied with the first result on score and on the query
20
+ * words they matched, the one whose own name holds more query words leads
21
+ * (tieByOwnName).
17
22
  */
18
23
 
19
24
  import {entryOf} from './_entries.mjs';
20
- import {fold, nameWords, words} from './_query-words.mjs';
25
+ import {fold, nameWords, queryWords, words} from './_query-words.mjs';
21
26
  import {searchedComponentsOf} from './_result.mjs';
27
+ import {sameWord} from './_words.mjs';
22
28
 
23
29
  /** @typedef {import('./_entries.mjs').EntryTable} EntryTable */
24
30
 
@@ -48,9 +54,11 @@ export const bandOf = score => {
48
54
  * @param {import('./search.type.mjs').SearchResponse} lexical every lexical match
49
55
  * @param {string} query
50
56
  * @param {number} limit
57
+ * @param {Map<string, string>} [families] each family member's
58
+ * `domain:name`, mapped to the family its doc lists it in
51
59
  * @returns {import('./search.type.mjs').SearchResponse}
52
60
  */
53
- export function orderMatches(table, order, lexical, query, limit) {
61
+ export function orderMatches(table, order, lexical, query, limit, families) {
54
62
  const all = lexical.data.results;
55
63
  /** @type {Map<number, number>} */
56
64
  const place = new Map(order.map((k, i) => [k, i]));
@@ -105,6 +113,10 @@ export function orderMatches(table, order, lexical, query, limit) {
105
113
  ranked = keepLexical(ranked, it => (it.res.score ?? 0) >= FULL_COVERAGE);
106
114
  }
107
115
  ranked = integrationTies(ranked);
116
+ if (families) ranked = rootsFirst(ranked, families, query);
117
+ if (ranked.length > 1 && !named(ranked[0])) {
118
+ ranked = tieByOwnName(ranked, query, blockOf, families);
119
+ }
108
120
  // Each whole tie is ordered by fit before the limit, so every limit shows
109
121
  // the top of one answer.
110
122
  const shown = tiesByFit(ranked, table, blockOf).slice(0, limit);
@@ -186,6 +198,76 @@ function tiesByFit(ranked, table, blockOf) {
186
198
  return out;
187
199
  }
188
200
 
201
+ /**
202
+ * The first result's tie goes to the match whose own name holds more query
203
+ * words. Among matches of one domain that the lexical ranker scored the same
204
+ * as the first result, and that matched the same query words (the terms
205
+ * their reasons list), the match whose name words hold more of the query's
206
+ * words than the first result's name moves first. A first result whose
207
+ * reason lists no terms keeps its place: it matched the whole query, or the
208
+ * query holds its title. A part of the first result never takes its place
209
+ * this way: rootsFirst decides between a family's root and its parts. Only
210
+ * the first place changes, and nothing crosses a block or a domain.
211
+ * @param {Item[]} ranked
212
+ * @param {string} query
213
+ * @param {(item: Item) => string} blockOf
214
+ * @param {Map<string, string>} [families]
215
+ * @returns {Item[]}
216
+ */
217
+ export function tieByOwnName(ranked, query, blockOf, families) {
218
+ const first = ranked[0];
219
+ const terms = first ? answered(first) : null;
220
+ if (!terms || ranked.length < 2) return ranked;
221
+ const asked = new Set(queryWords(query));
222
+ /** @param {Item} it */
223
+ const inName = it => {
224
+ const own = new Set(nameWords(String(it.res.name ?? '')).map(fold));
225
+ let n = 0;
226
+ for (const w of asked) if (own.has(w)) n++;
227
+ return n;
228
+ };
229
+ /** @param {Set<string> | null} other */
230
+ const same = other =>
231
+ other !== null &&
232
+ other.size === terms.size &&
233
+ [...other].every(w => terms.has(w));
234
+ let best = 0;
235
+ let most = inName(first);
236
+ for (let j = 1; j < ranked.length; j++) {
237
+ const it = ranked[j];
238
+ if (blockOf(it) !== blockOf(first)) break;
239
+ if (it.res.domain !== first.res.domain || partOf(it, first, families)) {
240
+ continue;
241
+ }
242
+ if (!same(answered(it))) continue;
243
+ const n = inName(it);
244
+ if (n > most) {
245
+ best = j;
246
+ most = n;
247
+ }
248
+ }
249
+ if (best === 0) return ranked;
250
+ const out = [...ranked];
251
+ out.unshift(...out.splice(best, 1));
252
+ return out;
253
+ }
254
+
255
+ /**
256
+ * Whether a match is a part of another: its doc lists it in the other's
257
+ * family, or its name words start with the other's whole name words.
258
+ * @param {Item} it
259
+ * @param {Item} of
260
+ * @param {Map<string, string>} [families]
261
+ */
262
+ function partOf(it, of, families) {
263
+ if (families?.get(`${it.res.domain}:${it.res.name}`) === of.res.name) {
264
+ return true;
265
+ }
266
+ const root = nameWords(String(of.res.name ?? '')).map(fold);
267
+ const name = nameWords(String(it.res.name ?? '')).map(fold);
268
+ return name.length > root.length && root.every((w, n) => name[n] === w);
269
+ }
270
+
189
271
  /**
190
272
  * The matches `pick` selects keep the places they hold, filled in lexical
191
273
  * order.
@@ -229,3 +311,59 @@ export function integrationTies(items) {
229
311
  }
230
312
  return out;
231
313
  }
314
+
315
+ /**
316
+ * The query words a match answered: the terms its reason lists, folded, or
317
+ * null when it answered the whole query (a name, keyword, or title hit).
318
+ * @param {Item} it
319
+ * @returns {Set<string> | null}
320
+ */
321
+ function answered(it) {
322
+ const m = /^matches \d+\/\d+ terms: (.*)$/.exec(it.res.reason ?? '');
323
+ return m ? new Set(m[1].split(', ').map(fold)) : null;
324
+ }
325
+
326
+ /**
327
+ * A family's root leads a part of its own family in their run (same band,
328
+ * same domain) when the part adds nothing the reader asked for: the root
329
+ * answers every query word the part answers, and no query word is a word of
330
+ * the part's name, in any plural or stem form, that does not start a word
331
+ * of the root's name. `tabs` puts TabList before its Tab; a query holding
332
+ * "item" keeps ListItem before List, since "item" is only the part's. The
333
+ * root moves just ahead of the part; nothing else moves, and nothing crosses
334
+ * a run.
335
+ * @param {Item[]} ranked
336
+ * @param {Map<string, string>} families each member's `domain:name`, mapped
337
+ * to its family's name
338
+ * @param {string} query
339
+ * @returns {Item[]}
340
+ */
341
+ export function rootsFirst(ranked, families, query) {
342
+ const asked = nameWords(query);
343
+ const out = [...ranked];
344
+ for (let a = 0; a < out.length; a++) {
345
+ const part = out[a];
346
+ const family = families.get(`${part.res.domain}:${part.res.name}`);
347
+ if (!family) continue;
348
+ const b = out.findIndex(
349
+ (it, n) =>
350
+ n > a &&
351
+ it.band === part.band &&
352
+ it.res.domain === part.res.domain &&
353
+ it.res.name === family,
354
+ );
355
+ if (b < 0) continue;
356
+ const ofPart = answered(part);
357
+ const ofRoot = answered(out[b]);
358
+ if (ofRoot && (!ofPart || [...ofPart].some(w => !ofRoot.has(w)))) continue;
359
+ const rootWords = nameWords(family);
360
+ const own = nameWords(String(part.res.name)).filter(
361
+ w => !rootWords.some(r => r.startsWith(w)),
362
+ );
363
+ // A query word is a part word in any plural or stem form, as search
364
+ // reads words: `statuses` is the Status in FieldStatus.
365
+ if (own.some(w => asked.some(q => sameWord(q, w)))) continue;
366
+ out.splice(a, 0, ...out.splice(b, 1));
367
+ }
368
+ return out;
369
+ }
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import {CORE_PACKAGE, resolveCore} from '../_adapter.mjs';
12
+ import {runBase} from '../../../foundation/bases/resolve.mjs';
12
13
 
13
14
  /**
14
15
  * List swizzlable components discoverable from `cwd`'s @astryxdesign/core.
@@ -17,5 +18,11 @@ import {CORE_PACKAGE, resolveCore} from '../_adapter.mjs';
17
18
  */
18
19
  export function swizzleList(cwd = process.cwd()) {
19
20
  const {components} = resolveCore(cwd);
20
- return {type: 'swizzle.list', package: CORE_PACKAGE, data: components};
21
+ // The list names the run's base, the package its items come from.
22
+ const run = runBase(cwd);
23
+ return {
24
+ type: 'swizzle.list',
25
+ package: run.ok ? run.base.name : CORE_PACKAGE,
26
+ data: components,
27
+ };
21
28
  }
@@ -7,7 +7,7 @@
7
7
  export type SwizzleListResponse = {
8
8
  type: "swizzle.list";
9
9
  /**
10
- * `@astryxdesign/core`, the package the listed components come from.
10
+ * The run's base: `@astryxdesign/core`, or the active base when it is not Core.
11
11
  */
12
12
  package: string;
13
13
  data: string[];
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @typedef {object} SwizzleListResponse
13
13
  * @property {'swizzle.list'} type
14
- * @property {string} package `@astryxdesign/core`, the package the listed components come from.
14
+ * @property {string} package The run's base: `@astryxdesign/core`, or the active base when it is not Core.
15
15
  * @property {string[]} data
16
16
  */
17
17
 
@@ -164,10 +164,8 @@ export function templateCopy(
164
164
 
165
165
  // Analyze what the template needs that the project lacks: external packages
166
166
  // and the StyleX compiler. Derived from the source's own imports.
167
- const {notes, missingPackages, installCommand} = analyzeTemplateNeeds(
168
- outputSource,
169
- cwd,
170
- );
167
+ const {notes, missingPackages, installCommand, installGuidance} =
168
+ analyzeTemplateNeeds(outputSource, cwd);
171
169
  const missing = missingPackages;
172
170
 
173
171
  const relOutput = scratch ? outputDir : path.relative(cwd, outputDir) || '.';
@@ -184,6 +182,7 @@ export function templateCopy(
184
182
  notes,
185
183
  missingPackages: missing,
186
184
  installCommand,
185
+ ...(installGuidance ? {installGuidance} : {}),
187
186
  ...(path.isAbsolute(targetPath) && !scratch
188
187
  ? {givenPath: targetPath}
189
188
  : {}),
@@ -12,6 +12,7 @@
12
12
  import {pkgOf} from '../../../foundation/discovery/template-adapter.mjs';
13
13
  import {AstryxError} from '../../error.mjs';
14
14
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
15
+ import {renderTokens} from '../../../foundation/doc-compiler/links.mjs';
15
16
 
16
17
  /**
17
18
  * Project a discovered template set into the `template.list` envelope.
@@ -50,7 +51,7 @@ export function templateList(templates, options = {}) {
50
51
  id: t.dirName,
51
52
  name: t.name,
52
53
  displayName: t.displayName,
53
- description: t.description,
54
+ description: renderTokens(t.description),
54
55
  type: t.type,
55
56
  package: pkgOf(t),
56
57
  replaces: t.replaces,
@@ -11,6 +11,7 @@
11
11
  import * as fs from 'node:fs';
12
12
  import {AstryxError} from '../../error.mjs';
13
13
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
14
+ import {renderTokens} from '../../../foundation/doc-compiler/links.mjs';
14
15
  import {
15
16
  componentsInSource,
16
17
  pkgOf,
@@ -54,7 +55,7 @@ export function templateShow(match, {iconSets = NO_ICON_SETS} = {}) {
54
55
  package: pkgOf(match),
55
56
  data: {
56
57
  template: match.dirName,
57
- description: match.description,
58
+ description: renderTokens(match.description),
58
59
  type: match.type,
59
60
  components: componentsInSource(source),
60
61
  source,
@@ -12,6 +12,7 @@
12
12
  import * as fs from 'node:fs';
13
13
  import {AstryxError} from '../../error.mjs';
14
14
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
15
+ import {renderTokens} from '../../../foundation/doc-compiler/links.mjs';
15
16
  import {
16
17
  componentsInSource,
17
18
  pkgOf,
@@ -257,7 +258,7 @@ export function templateSkeleton(match, templates) {
257
258
  package: pkgOf(match),
258
259
  data: {
259
260
  template: match.dirName,
260
- description: match.description,
261
+ description: renderTokens(match.description),
261
262
  components: componentsInSource(source),
262
263
  skeleton: extractSkeleton(source),
263
264
  isReady: match.isReady !== false,
@@ -125,7 +125,7 @@ export const doc = {
125
125
  {
126
126
  type: 'template.copy',
127
127
  description:
128
- 'A receipt after scaffolding the template into the project, or as a scratch copy in the system temp folder: the template id, output directory (relative to the project; absolute for a scratch copy), written file name, file count, `givenPath` — the absolute path as given, present only when it was inside the project, `demoMediaReplaced` — how many Astryx demo media references were replaced with placeholders, `demoContentReplaced` — how many Astryx docs-only demo content elements were replaced with a `<Text>` placeholder, `notes` — setup notes naming what the template needs that the project lacks (missing packages, missing StyleX compiler; empty when satisfied), `missingPackages` — external package names the template imports that are not in the project, and `installCommand` — a ready-to-run install command with the detected package manager and workspace version ranges (null when nothing is missing, or when several lockfiles leave the package manager undetermined; `missingPackages` still names the packages), and `isReady`.',
128
+ 'A receipt after scaffolding the template into the project, or as a scratch copy in the system temp folder: the template id, output directory (relative to the project; absolute for a scratch copy), written file name, file count, `givenPath` — the absolute path as given, present only when it was inside the project, `demoMediaReplaced` — how many Astryx demo media references were replaced with placeholders, `demoContentReplaced` — how many Astryx docs-only demo content elements were replaced with a `<Text>` placeholder, `notes` — setup notes naming what the template needs that the project lacks (missing packages, missing StyleX compiler; empty when satisfied), `missingPackages` — external package names the template imports that are not in the project, and `installCommand` — a ready-to-run install command with the detected package manager and workspace version ranges (null when nothing is missing, when several lockfiles leave the package manager undetermined, or when no `package.json` holds the folder, where an install would make the folder a project; `missingPackages` still names the packages), `installGuidance` — present only when a loaded integration gives `installGuidance`: how to add the missing packages in this project, followed instead of `installCommand`, and `isReady`.',
129
129
  },
130
130
  {
131
131
  type: 'template.cdn',
@@ -22,7 +22,11 @@ import {
22
22
  pkgOf,
23
23
  templateLookupIds,
24
24
  } from '../../foundation/discovery/template-adapter.mjs';
25
- import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
25
+ import {
26
+ docPackageManager,
27
+ quoteCommandArgument,
28
+ runWithDocPackageManager,
29
+ } from '../../foundation/env/package-manager.mjs';
26
30
  import {AstryxError} from '../error.mjs';
27
31
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
28
32
  import {orderByAffinity} from '../../foundation/text/suggest-order.mjs';
@@ -113,6 +117,20 @@ function eachAlone(mode, name, targetPath, packageFilter) {
113
117
  * @returns {Promise<{type: string, data: unknown}>}
114
118
  */
115
119
  export async function template(name, options = {}) {
120
+ // Doc `{@pm}` steps in a description render for the project the call
121
+ // names, as search's do.
122
+ return runWithDocPackageManager(
123
+ docPackageManager(options.cwd ?? process.cwd()),
124
+ () => templateRead(name, options),
125
+ );
126
+ }
127
+
128
+ /**
129
+ * The template call itself, inside its project's package-manager scope.
130
+ * @param {string | undefined} name
131
+ * @param {Parameters<typeof template>[1]} options
132
+ */
133
+ async function templateRead(name, options = {}) {
116
134
  const {
117
135
  list = false,
118
136
  skeleton = false,
@@ -113,6 +113,7 @@ export type TemplateCopyResponse = {
113
113
  notes: string[];
114
114
  missingPackages: string[];
115
115
  installCommand: string | null;
116
+ installGuidance?: string | undefined;
116
117
  givenPath?: string | undefined;
117
118
  icons?: TemplateIconsReport | undefined;
118
119
  isReady: boolean;
@@ -87,7 +87,8 @@
87
87
  * @property {number} data.demoContentReplaced Astryx docs-only demo content elements (such as a playing card's face in a motion example) replaced in the written file with a `<Text>Card content</Text>` placeholder. Put your own content there. 0 when the template carried none.
88
88
  * @property {string[]} data.notes Setup notes: what the template needs that the project lacks (missing packages, missing StyleX compiler). Each note is one actionable line. Empty when the template needs nothing the project lacks.
89
89
  * @property {string[]} data.missingPackages External package names the template imports that are not in the project's dependencies. Empty when none are missing.
90
- * @property {string | null} data.installCommand A ready-to-run install command for the missing packages, using the project's package manager and the CLI workspace's version ranges. Null when no packages are missing, or when several lockfiles leave the package manager undetermined; missingPackages still names the packages.
90
+ * @property {string | null} data.installCommand A ready-to-run install command for the missing packages, using the project's package manager and the CLI workspace's version ranges. Null when no packages are missing, when several lockfiles leave the package manager undetermined, or when no package.json holds the folder, where an install would make the folder a project; missingPackages still names the packages.
91
+ * @property {string} [data.installGuidance] How to add the missing packages in this project, from the `installGuidance` of a loaded integration; present only when one gives it, and then followed instead of installCommand.
91
92
  * @property {string} [data.givenPath] The absolute path as given, present only when it named a place inside the project root. The write is the same as for its relative path: `outputDir` for a folder, or `outputDir` and `fileName` for a file.
92
93
  * @property {TemplateIconsReport} [data.icons] Experimental, present only when the project sets `experimental.iconSet`: how the written file's icons follow the project's icon set, each icon `mapped` (source and target), a `placeholder`, or `kept`, the sets used with their licenses, and the icon-set state. It may change or be removed in a patch release.
93
94
  * @property {boolean} data.isReady Whether the template is ready, as its doc's `isReady` says (`true` when the doc leaves it out).
@@ -114,6 +114,7 @@ export function ejectThemeFiles(theme: import("../../foundation/discovery/theme-
114
114
  export function forkNeeds(outputDir: string, files: string[], cwd: string): {
115
115
  missingPackages: string[];
116
116
  installCommand: string | null;
117
+ installGuidance: string | null;
117
118
  };
118
119
  /**
119
120
  * Resolve an available theme by case-insensitive slug and optional owner package.
@@ -915,11 +915,9 @@ export function forkNeeds(outputDir, files, cwd) {
915
915
  }
916
916
  })
917
917
  .join('\n');
918
- const {missingPackages, installCommand} = analyzeTemplateNeeds(
919
- source,
920
- findPackageRoot(cwd) ?? path.resolve(cwd),
921
- );
922
- return {missingPackages, installCommand};
918
+ const {missingPackages, installCommand, installGuidance} =
919
+ analyzeTemplateNeeds(source, findPackageRoot(cwd) ?? path.resolve(cwd));
920
+ return {missingPackages, installCommand, installGuidance};
923
921
  }
924
922
 
925
923
  /** @param {unknown} error */
@@ -4,6 +4,47 @@
4
4
  /**
5
5
  * @typedef {{export: string, from: string, themeProp?: string, modeProp?: string}} AppProvider
6
6
  */
7
+ /**
8
+ * The providers installed packages name as the one that wires their themes,
9
+ * each once with the package that declares it, and the one the app passes
10
+ * its theme to: the only provider, when it takes a theme object
11
+ * (`themeProp`). With two, which one wires the app is not ours to say.
12
+ * @param {string} cwd
13
+ * @returns {Promise<{found: Array<{provider: AppProvider, owner: string}>, taking: {provider: AppProvider, owner: string} | null}>}
14
+ */
15
+ export function appProviders(cwd: string): Promise<{
16
+ found: Array<{
17
+ provider: AppProvider;
18
+ owner: string;
19
+ }>;
20
+ taking: {
21
+ provider: AppProvider;
22
+ owner: string;
23
+ } | null;
24
+ }>;
25
+ /**
26
+ * The provider's opening tag with the generated module's theme passed, and
27
+ * its mode when the provider takes one and the theme has one color mode.
28
+ * @param {AppProvider} provider a provider that takes the theme (`themeProp`)
29
+ * @param {boolean} oneMode the theme has one color mode
30
+ * @returns {string}
31
+ */
32
+ export function providerLine(provider: AppProvider, oneMode: boolean): string;
33
+ /**
34
+ * `appProviders` for themes already listed.
35
+ * @param {Awaited<ReturnType<typeof listAvailableThemeState>>['themes']} themes
36
+ * @returns {{found: Array<{provider: AppProvider, owner: string}>, taking: {provider: AppProvider, owner: string} | null}}
37
+ */
38
+ export function providersOf(themes: Awaited<ReturnType<typeof listAvailableThemeState>>["themes"]): {
39
+ found: Array<{
40
+ provider: AppProvider;
41
+ owner: string;
42
+ }>;
43
+ taking: {
44
+ provider: AppProvider;
45
+ owner: string;
46
+ } | null;
47
+ };
7
48
  /**
8
49
  * A receipt with its `appProvider` (theme.type.mjs ThemeAppResponse) when an
9
50
  * installed package names a provider and the receipt shows wiring.
@@ -29,3 +70,4 @@ export type AppProvider = {
29
70
  themeProp?: string;
30
71
  modeProp?: string;
31
72
  };
73
+ import { listAvailableThemeState } from './_adapter.mjs';
@@ -8,7 +8,8 @@
8
8
  *
9
9
  * Read from the packages' manifests, never from the app's source. The
10
10
  * receipt says how Themes nest and never says to replace a provider, which
11
- * may do more than theming. Shared by `theme add` and `theme remove`.
11
+ * may do more than theming. Shared by `theme add` and `theme remove`, and
12
+ * by `build`'s playbook, which names the same wiring.
12
13
  */
13
14
 
14
15
  import {listAvailableThemeState} from './_adapter.mjs';
@@ -17,6 +18,63 @@ import {listAvailableThemeState} from './_adapter.mjs';
17
18
  * @typedef {{export: string, from: string, themeProp?: string, modeProp?: string}} AppProvider
18
19
  */
19
20
 
21
+ /**
22
+ * The providers installed packages name as the one that wires their themes,
23
+ * each once with the package that declares it, and the one the app passes
24
+ * its theme to: the only provider, when it takes a theme object
25
+ * (`themeProp`). With two, which one wires the app is not ours to say.
26
+ * @param {string} cwd
27
+ * @returns {Promise<{found: Array<{provider: AppProvider, owner: string}>, taking: {provider: AppProvider, owner: string} | null}>}
28
+ */
29
+ export async function appProviders(cwd) {
30
+ const {themes} = await listAvailableThemeState(cwd);
31
+ return providersOf(themes);
32
+ }
33
+
34
+ /**
35
+ * The provider's opening tag with the generated module's theme passed, and
36
+ * its mode when the provider takes one and the theme has one color mode.
37
+ * @param {AppProvider} provider a provider that takes the theme (`themeProp`)
38
+ * @param {boolean} oneMode the theme has one color mode
39
+ * @returns {string}
40
+ */
41
+ export function providerLine(provider, oneMode) {
42
+ const mode =
43
+ oneMode && provider.modeProp
44
+ ? ` ${provider.modeProp}={themeModes[defaultThemeSlug]}`
45
+ : '';
46
+ return `<${provider.export} ${provider.themeProp}={themes[defaultThemeSlug]}${mode}>`;
47
+ }
48
+
49
+ /**
50
+ * `appProviders` for themes already listed.
51
+ * @param {Awaited<ReturnType<typeof listAvailableThemeState>>['themes']} themes
52
+ * @returns {{found: Array<{provider: AppProvider, owner: string}>, taking: {provider: AppProvider, owner: string} | null}}
53
+ */
54
+ export function providersOf(themes) {
55
+ /** @type {Map<string, {provider: AppProvider, owner: string}>} */
56
+ const byProvider = new Map();
57
+ for (const theme of themes)
58
+ if (theme.provider)
59
+ byProvider.set(`${theme.provider.export}\0${theme.provider.from}`, {
60
+ provider: {
61
+ export: theme.provider.export,
62
+ from: theme.provider.from,
63
+ ...(theme.provider.themeProp
64
+ ? {themeProp: theme.provider.themeProp}
65
+ : {}),
66
+ ...(theme.provider.themeProp && theme.provider.modeProp
67
+ ? {modeProp: theme.provider.modeProp}
68
+ : {}),
69
+ },
70
+ owner: String(theme.package ?? theme.provider.from),
71
+ });
72
+ const found = [...byProvider.values()];
73
+ const taking =
74
+ found.length === 1 && found[0].provider.themeProp ? found[0] : null;
75
+ return {found, taking};
76
+ }
77
+
20
78
  /**
21
79
  * A receipt with its `appProvider` (theme.type.mjs ThemeAppResponse) when an
22
80
  * installed package names a provider and the receipt shows wiring.
@@ -45,29 +103,7 @@ export async function withAppProvider(result, cwd) {
45
103
  ? 'modes'
46
104
  : null;
47
105
  if (!kind) return result;
48
- const {themes} = await listAvailableThemeState(cwd);
49
- /** Each provider once, with the package that declares it. @type {Map<string, {provider: AppProvider, owner: string}>} */
50
- const byProvider = new Map();
51
- for (const theme of themes)
52
- if (theme.provider)
53
- byProvider.set(`${theme.provider.export}\0${theme.provider.from}`, {
54
- provider: {
55
- export: theme.provider.export,
56
- from: theme.provider.from,
57
- ...(theme.provider.themeProp
58
- ? {themeProp: theme.provider.themeProp}
59
- : {}),
60
- ...(theme.provider.themeProp && theme.provider.modeProp
61
- ? {modeProp: theme.provider.modeProp}
62
- : {}),
63
- },
64
- owner: String(theme.package ?? theme.provider.from),
65
- });
66
- const found = [...byProvider.values()];
67
- // Only one applicable provider gets the provider form: with two, which
68
- // one wires the app is not ours to say.
69
- const taking =
70
- found.length === 1 && found[0].provider.themeProp ? found[0] : null;
106
+ const {found, taking} = await appProviders(cwd);
71
107
  if (!found.length || (kind !== 'first' && !taking)) return result;
72
108
  // The wiring passes a mode when the provider takes one and an added theme
73
109
  // has one color mode, as the Theme wiring does.
@@ -78,9 +114,7 @@ export async function withAppProvider(result, cwd) {
78
114
  ? Boolean(change.themeModes)
79
115
  : result.data.themes.some(t => t.mode);
80
116
  const modeProp = oneMode ? taking?.provider.modeProp : undefined;
81
- const line = taking
82
- ? `<${taking.provider.export} ${taking.provider.themeProp}={themes[defaultThemeSlug]}${modeProp ? ` ${modeProp}={themeModes[defaultThemeSlug]}` : ''}>`
83
- : null;
117
+ const line = taking ? providerLine(taking.provider, oneMode) : null;
84
118
  const name = taking?.provider.export;
85
119
  let wire;
86
120
  if (kind === 'first') {
@@ -253,16 +253,6 @@ export function oneColorMode(value: unknown): ["light"] | ["dark"] | null;
253
253
  * @returns {string | null}
254
254
  */
255
255
  export function missingThemePackage(error: unknown): string | null;
256
- /**
257
- * Whether the project that holds `from` maps `specifier` itself: the nearest
258
- * tsconfig.json or jsconfig.json names it in `compilerOptions.paths` (`@app/*`
259
- * maps `@app/c`), or its `baseUrl` holds the file (`lib/c`). The theme loader
260
- * maps neither, so such an import is a path alias, never a package.
261
- * @param {string} specifier
262
- * @param {string | null} from the importing module
263
- * @returns {boolean}
264
- */
265
- export function projectMapsImport(specifier: string, from: string | null): boolean;
266
256
  /**
267
257
  * The package an import specifier names, or undefined when it names none:
268
258
  * a relative or absolute path, a `#` subpath import, or a path alias such
@@ -536,8 +526,12 @@ export type ThemeBuildTrailer = {
536
526
  * `familyInterception` make the build a family member's plan.
537
527
  * `colorModes` is the one color mode a calling command knows the theme has
538
528
  * (the theme editor, from its settings), written into the built module.
529
+ * `ownsOutputs` says the caller made the folder the outputs go into and owns
530
+ * every file there named like one (the theme editor's theme folder), so a
531
+ * damaged or half-written output is replaced, never refused.
539
532
  */
540
533
  export type ThemeBuildHandOff = {
534
+ ownsOutputs?: boolean;
541
535
  prepareFamily?: boolean;
542
536
  familyLoader?: any;
543
537
  familyInterception?: any;