@astryxdesign/cli 0.7.17-canary.g2fb7c5b → 0.7.17-canary.g2ff1afc

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 (309) hide show
  1. package/README.md +5 -4
  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 +1 -1
  8. package/api/build/help/help.d.mts +15 -14
  9. package/api/build/help/help.mjs +62 -3
  10. package/api/component/detail/blocks/blocks.mjs +2 -1
  11. package/api/discover/_adapter.d.mts +57 -6
  12. package/api/discover/_adapter.mjs +270 -48
  13. package/api/discover/_catalog-view.d.mts +7 -0
  14. package/api/discover/_catalog-view.mjs +10 -1
  15. package/api/discover/detail/doc/doc.mjs +1 -1
  16. package/api/discover/discover.d.mts +24 -0
  17. package/api/discover/discover.mjs +146 -25
  18. package/api/discover/search/search.d.mts +22 -0
  19. package/api/discover/search/search.mjs +290 -70
  20. package/api/docs/_entry-names.mjs +4 -3
  21. package/api/doctor/_adapter.d.mts +40 -2
  22. package/api/doctor/_adapter.mjs +139 -17
  23. package/api/doctor/built-checks.d.mts +30 -3
  24. package/api/doctor/built-checks.mjs +132 -5
  25. package/api/doctor/doctor.d.mts +75 -6
  26. package/api/doctor/doctor.doc.mjs +2 -2
  27. package/api/doctor/doctor.mjs +404 -26
  28. package/api/doctor/doctor.type.d.mts +2 -1
  29. package/api/doctor/doctor.type.mjs +2 -1
  30. package/api/doctor/theme-checks.d.mts +19 -0
  31. package/api/doctor/theme-checks.mjs +56 -3
  32. package/api/icon/_adapter.mjs +3 -15
  33. package/api/icon/icon.doc.mjs +1 -1
  34. package/api/icon/search/search.d.mts +10 -0
  35. package/api/icon/search/search.mjs +19 -6
  36. package/api/init/_adapter.d.mts +14 -0
  37. package/api/init/_adapter.mjs +26 -4
  38. package/api/init/init.d.mts +1 -1
  39. package/api/init/init.doc.mjs +2 -2
  40. package/api/init/init.mjs +1 -1
  41. package/api/init/init.type.d.mts +5 -1
  42. package/api/init/init.type.mjs +2 -1
  43. package/api/init/run/run.d.mts +11 -1
  44. package/api/init/run/run.mjs +54 -4
  45. package/api/integration/_adapter.d.mts +5 -4
  46. package/api/integration/_adapter.mjs +7 -5
  47. package/api/integration/validate-integration.d.mts +1 -1
  48. package/api/integration/validate-integration.mjs +5 -1
  49. package/api/integration/validate-integration.type.d.mts +3 -1
  50. package/api/integration/validate-integration.type.mjs +3 -1
  51. package/api/integration/validateIntegration.doc.mjs +1 -1
  52. package/api/render/_adapter.d.mts +4 -2
  53. package/api/render/_adapter.mjs +53 -18
  54. package/api/render/render.doc.mjs +8 -5
  55. package/api/render/render.mjs +1 -1
  56. package/api/render/render.type.d.mts +2 -0
  57. package/api/render/render.type.mjs +2 -0
  58. package/api/search/ORDERING.md +1 -1
  59. package/api/search/_gather-docs.mjs +29 -2
  60. package/api/search/_gather-templates.mjs +2 -1
  61. package/api/search/_main-searcher.mjs +13 -0
  62. package/api/search/_order.d.mts +36 -1
  63. package/api/search/_order.mjs +141 -3
  64. package/api/template/list/list.mjs +2 -1
  65. package/api/template/show/show.mjs +2 -1
  66. package/api/template/skeleton/skeleton.mjs +2 -1
  67. package/api/template/template.doc.mjs +1 -1
  68. package/api/template/template.mjs +19 -1
  69. package/api/template/template.type.mjs +1 -1
  70. package/api/theme/_app-provider.d.mts +42 -0
  71. package/api/theme/_app-provider.mjs +61 -27
  72. package/api/theme/build/build.d.mts +0 -10
  73. package/api/theme/build/build.mjs +60 -77
  74. package/api/theme/build/input-fields.d.mts +9 -0
  75. package/api/theme/build/input-fields.mjs +155 -16
  76. package/api/theme/build/radius-values.d.mts +18 -0
  77. package/api/theme/build/radius-values.mjs +76 -0
  78. package/api/theme/build/typography-values.mjs +7 -23
  79. package/api/theme/build/written-values.d.mts +18 -0
  80. package/api/theme/build/written-values.mjs +107 -31
  81. package/api/theme/palette/generate/generator.mjs +24 -0
  82. package/api/theme/theme.type.d.mts +2 -1
  83. package/api/theme/theme.type.mjs +2 -1
  84. package/api/theme/themeBuild.doc.mjs +1 -1
  85. package/api/theme/themeEject.doc.mjs +1 -1
  86. package/api/theme-edit/_catalog.d.mts +40 -0
  87. package/api/theme-edit/_catalog.mjs +100 -22
  88. package/api/theme-edit/_check.mjs +213 -43
  89. package/api/theme-edit/_color.d.mts +14 -0
  90. package/api/theme-edit/_color.mjs +22 -0
  91. package/api/theme-edit/_compiler.mjs +52 -0
  92. package/api/theme-edit/_context.d.mts +20 -2
  93. package/api/theme-edit/_context.mjs +157 -29
  94. package/api/theme-edit/_edit.mjs +426 -58
  95. package/api/theme-edit/_how-question.d.mts +14 -0
  96. package/api/theme-edit/_how-question.mjs +1541 -127
  97. package/api/theme-edit/_how.mjs +43 -0
  98. package/api/theme-edit/_missed.mjs +107 -27
  99. package/api/theme-edit/_normal.d.mts +18 -4
  100. package/api/theme-edit/_normal.mjs +84 -3
  101. package/api/theme-edit/_palette.d.mts +9 -0
  102. package/api/theme-edit/_palette.mjs +158 -33
  103. package/api/theme-edit/_part-words.mjs +16 -3
  104. package/api/theme-edit/_parts.d.mts +8 -0
  105. package/api/theme-edit/_parts.mjs +109 -31
  106. package/api/theme-edit/_png.d.mts +24 -0
  107. package/api/theme-edit/_png.mjs +99 -0
  108. package/api/theme-edit/_preview-app.mjs +5 -3
  109. package/api/theme-edit/_preview.d.mts +44 -26
  110. package/api/theme-edit/_preview.mjs +255 -67
  111. package/api/theme-edit/_project.d.mts +4 -0
  112. package/api/theme-edit/_project.mjs +2 -0
  113. package/api/theme-edit/_settings.d.mts +116 -0
  114. package/api/theme-edit/_settings.mjs +1194 -58
  115. package/api/theme-edit/_tables.d.mts +16 -0
  116. package/api/theme-edit/_tables.mjs +34 -4
  117. package/api/theme-edit/theme-edit.type.d.mts +14 -2
  118. package/api/theme-edit/theme-edit.type.mjs +7 -5
  119. package/api/upgrade/_adapter.d.mts +5 -4
  120. package/api/upgrade/_adapter.mjs +7 -5
  121. package/assets/component-list.generated.json +1 -1
  122. package/assets/docs/tree/agent-guidance.doc.mjs +2 -1
  123. package/assets/docs/tree/checks.doc.mjs +2 -2
  124. package/assets/docs/tree/host-entry.doc.mjs +4 -0
  125. package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
  126. package/assets/docs/tree/icon-sets.doc.mjs +4 -4
  127. package/assets/docs/tree/problems.doc.mjs +2 -2
  128. package/assets/docs/tree/render-pages.doc.mjs +17 -3
  129. package/assets/docs/tree/share-a-page.doc.mjs +5 -5
  130. package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
  131. package/assets/docs/tree/versioning.doc.mjs +1 -1
  132. package/assets/docs/working-with-ai.doc.mjs +40 -5
  133. package/assets/docs-routes.generated.json +1 -1
  134. package/assets/docs.generated.json +2 -2
  135. package/assets/icons/installed-icon-set.doc.mjs +30 -0
  136. package/assets/search-catalog.generated.json +2 -2
  137. package/assets/self-audit.generated.json +1 -1
  138. package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
  139. package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
  140. package/assets/templates/components.generated.json +1 -1
  141. package/assets/templates/pages/ai-chat/page.tsx +6 -2
  142. package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
  143. package/assets/templates/pages/blank/page.tsx +4 -2
  144. package/assets/templates/pages/canvas-editor/page.tsx +3 -1
  145. package/assets/templates/pages/centered-hero/page.tsx +1 -1
  146. package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
  147. package/assets/templates/pages/classic-gallery/page.tsx +1 -1
  148. package/assets/templates/pages/contact-form/page.tsx +2 -2
  149. package/assets/templates/pages/course-detail/page.tsx +1 -1
  150. package/assets/templates/pages/detail-page/page.tsx +22 -5
  151. package/assets/templates/pages/documentation/page.tsx +4 -2
  152. package/assets/templates/pages/documentation-design/page.tsx +5 -2
  153. package/assets/templates/pages/documentation-technical/page.tsx +4 -2
  154. package/assets/templates/pages/editor/page.tsx +28 -9
  155. package/assets/templates/pages/file-explorer/page.tsx +3 -1
  156. package/assets/templates/pages/form-two-column/page.tsx +1 -1
  157. package/assets/templates/pages/form-wizard/page.tsx +1 -1
  158. package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
  159. package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
  160. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  161. package/assets/templates/pages/gallery-hero/page.tsx +1 -1
  162. package/assets/templates/pages/ide/page.tsx +7 -2
  163. package/assets/templates/pages/kanban-board/page.tsx +10 -4
  164. package/assets/templates/pages/library/page.tsx +31 -61
  165. package/assets/templates/pages/login/page.tsx +4 -2
  166. package/assets/templates/pages/login-card/page.tsx +4 -2
  167. package/assets/templates/pages/login-split/page.tsx +3 -2
  168. package/assets/templates/pages/login-sso/page.tsx +4 -4
  169. package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
  170. package/assets/templates/pages/payment-form/page.tsx +1 -1
  171. package/assets/templates/pages/product-detail/page.tsx +16 -4
  172. package/assets/templates/pages/product-gallery/page.tsx +1 -1
  173. package/assets/templates/pages/settings/page.tsx +10 -4
  174. package/assets/templates/pages/settings-dialog/page.tsx +5 -6
  175. package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
  176. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  177. package/assets/templates/pages/table/page.tsx +2 -2
  178. package/assets/templates/pages/table-filter/page.tsx +21 -6
  179. package/assets/templates/pages/theme-showcase/page.tsx +3 -2
  180. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
  181. package/assets/templates/themes/butter/butterTheme.ts +197 -4
  182. package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
  183. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
  184. package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
  185. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
  186. package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
  187. package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
  188. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
  189. package/assets/templates/themes/stone/stoneTheme.ts +69 -0
  190. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
  191. package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
  192. package/authoring/config/config.doc.mjs +1 -1
  193. package/authoring/config/type.ts +4 -3
  194. package/authoring/discover/parse.d.mts +2 -2
  195. package/authoring/discover/parse.mjs +52 -38
  196. package/authoring/discover/type.ts +2 -1
  197. package/authoring/doctypes/_schema.d.mts +3 -3
  198. package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
  199. package/clients/cli/build-id.generated.json +1 -1
  200. package/clients/cli/commands/build.mjs +12 -6
  201. package/clients/cli/commands/component.mjs +6 -2
  202. package/clients/cli/commands/discover.doc.mjs +2 -2
  203. package/clients/cli/commands/discover.mjs +16 -2
  204. package/clients/cli/commands/docs.doc.mjs +11 -9
  205. package/clients/cli/commands/docs.mjs +50 -21
  206. package/clients/cli/commands/experimental/icon.mjs +329 -276
  207. package/clients/cli/commands/experimental/render.mjs +16 -1
  208. package/clients/cli/commands/experimental/theme.mjs +42 -17
  209. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  210. package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
  211. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
  212. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
  213. package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
  214. package/clients/cli/commands/experimental-render.doc.mjs +3 -3
  215. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
  216. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  217. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  218. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  219. package/clients/cli/commands/init.doc.mjs +36 -24
  220. package/clients/cli/commands/mcp.doc.mjs +53 -0
  221. package/clients/cli/commands/mcp.mjs +51 -0
  222. package/clients/cli/commands/search.mjs +46 -9
  223. package/clients/cli/commands/template.mjs +3 -2
  224. package/clients/cli/commands/theme.mjs +10 -0
  225. package/clients/cli/commands.generated.json +1 -1
  226. package/clients/cli/formatters/index.mjs +15 -0
  227. package/clients/cli/index.mjs +14 -6
  228. package/clients/cli/lib/define-command.mjs +82 -4
  229. package/clients/cli/lib/json-shim.mjs +61 -4
  230. package/clients/cli/lib/manifest.mjs +9 -1
  231. package/clients/cli/lib/mcp-server.mjs +286 -0
  232. package/clients/cli/lib/mcp-tools.mjs +405 -0
  233. package/clients/cli/lib/other-cli-words.mjs +99 -0
  234. package/clients/cli/lib/stray-option.mjs +27 -1
  235. package/clients/cli/lib/unknown-command.mjs +326 -11
  236. package/clients/cli/manifest.generated.json +1 -1
  237. package/foundation/agent-docs/agent-docs.d.mts +12 -1
  238. package/foundation/agent-docs/agent-docs.mjs +32 -4
  239. package/foundation/config/project.d.mts +5 -4
  240. package/foundation/config/project.mjs +27 -12
  241. package/foundation/discovery/icon-imports.d.mts +66 -0
  242. package/foundation/discovery/icon-imports.mjs +225 -0
  243. package/foundation/discovery/icon-ranking.d.mts +12 -2
  244. package/foundation/discovery/icon-ranking.mjs +197 -10
  245. package/foundation/discovery/icon-set-checks.mjs +2 -1
  246. package/foundation/discovery/icon-set-discovery.d.mts +2 -0
  247. package/foundation/discovery/icon-set-discovery.mjs +3 -0
  248. package/foundation/discovery/icon-set-writer.d.mts +2 -11
  249. package/foundation/discovery/icon-set-writer.mjs +3 -29
  250. package/foundation/discovery/name-roots.d.mts +5 -0
  251. package/foundation/discovery/name-roots.mjs +11 -0
  252. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  253. package/foundation/discovery/runner-allowlist.mjs +2 -0
  254. package/foundation/discovery/runner-commands.mjs +1 -0
  255. package/foundation/discovery/template-adapter.d.mts +1 -1
  256. package/foundation/discovery/template-destination.d.mts +14 -6
  257. package/foundation/discovery/template-destination.mjs +42 -8
  258. package/foundation/discovery/template-icons.d.mts +45 -2
  259. package/foundation/discovery/template-icons.mjs +16 -10
  260. package/foundation/discovery/template-needs.d.mts +20 -0
  261. package/foundation/discovery/template-needs.mjs +76 -7
  262. package/foundation/discovery/theme-discovery.d.mts +8 -0
  263. package/foundation/discovery/theme-discovery.mjs +9 -0
  264. package/foundation/env/project-scope.d.mts +9 -0
  265. package/foundation/env/project-scope.mjs +28 -2
  266. package/foundation/fs/gather-cache.mjs +5 -1
  267. package/foundation/fs/module-loader.d.mts +3 -1
  268. package/foundation/fs/module-loader.mjs +85 -5
  269. package/foundation/integrations/icon-features.d.mts +63 -0
  270. package/foundation/integrations/icon-features.mjs +54 -0
  271. package/foundation/integrations/validate-contributions.d.mts +9 -3
  272. package/foundation/integrations/validate-contributions.mjs +40 -13
  273. package/foundation/release/cache.d.mts +13 -1
  274. package/foundation/release/cache.mjs +94 -14
  275. package/foundation/render/client-bundle.d.mts +112 -0
  276. package/foundation/render/client-bundle.mjs +537 -0
  277. package/foundation/render/cut-short.d.mts +7 -1
  278. package/foundation/render/cut-short.mjs +46 -6
  279. package/foundation/render/embedded-imports.d.mts +4 -3
  280. package/foundation/render/embedded-imports.mjs +13 -8
  281. package/foundation/render/esbuild-dependency.d.mts +14 -0
  282. package/foundation/render/esbuild-dependency.mjs +41 -0
  283. package/foundation/render/file-header.mjs +5 -4
  284. package/foundation/render/page-worker.mjs +355 -81
  285. package/foundation/render/picture-chrome.mjs +54 -29
  286. package/foundation/render/picture-playwright.mjs +78 -42
  287. package/foundation/render/picture-window.d.mts +33 -0
  288. package/foundation/render/picture-window.mjs +78 -0
  289. package/foundation/render/render-page.d.mts +55 -4
  290. package/foundation/render/render-page.mjs +194 -28
  291. package/foundation/render/restore-folder.d.mts +13 -0
  292. package/foundation/render/restore-folder.mjs +30 -0
  293. package/foundation/render/served-packages.d.mts +2 -1
  294. package/foundation/render/served-packages.mjs +5 -3
  295. package/foundation/render/ts-paths.d.mts +11 -0
  296. package/foundation/render/ts-paths.mjs +27 -2
  297. package/foundation/render/value-uses.d.mts +43 -0
  298. package/foundation/render/value-uses.mjs +110 -0
  299. package/foundation/response/error-codes.d.mts +2 -1
  300. package/foundation/response/error-codes.doc.mjs +7 -1
  301. package/foundation/response/error-codes.mjs +10 -2
  302. package/foundation/response/response-types.doc.mjs +7 -7
  303. package/foundation/runtime/package-root.d.mts +8 -0
  304. package/foundation/runtime/package-root.mjs +20 -0
  305. package/foundation/suggest/other-command.d.mts +11 -0
  306. package/foundation/suggest/other-command.mjs +1 -1
  307. package/foundation/text/icon-id.d.mts +20 -0
  308. package/foundation/text/icon-id.mjs +40 -0
  309. package/package.json +7 -6
package/README.md CHANGED
@@ -111,6 +111,7 @@ Every run reads one base: Core, or an installed integration whose manifest decla
111
111
  | `hook` | List hooks or print hook docs | `same` |
112
112
  | `init` | Initialize the design system in your project | `own` |
113
113
  | `integration` | Author and verify an Astryx integration package | by subcommand |
114
+ | `mcp` | For AI tools that cannot run commands: serve every astryx command as an MCP tool, over stdio | `same` |
114
115
  | `search` | Search components, hooks, docs, templates, and themes in one ranked list | `same` |
115
116
  | `swizzle` | Copy component source for customization | `refuse` |
116
117
  | `template` | List, show, or scaffold page and block templates | `same` |
@@ -480,7 +481,7 @@ Every response has a `type` discriminant. The full set is below (generated from
480
481
 
481
482
  | Type | What `data` carries |
482
483
  | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
483
- | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, what changed in each (`docsChanges`: `{path, change, from, to}`), any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
484
+ | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, `agentDocsStatus` (`missing` \| `stale` \| `current`: the agent docs before the write; null when agent docs were not installed or the write failed), what changed in each (`docsChanges`: `{path, change, from, to}`), any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted (false outside a project, and when `agentDocsStatus` was `current`). |
484
485
  | `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |
485
486
  | `init.user` | The computer-level agent text receipt — returned when --user is set: `data.files`, one `{path, action, reason?}` per path acted on, the skill file first and then each link to its folder (action `written` \| `linked` \| `unchanged` \| `removed` \| `absent` \| `kept`; `reason` only on `kept`: `edited` when a person changed the text, `not-astryx` when Astryx did not write it), `data.command` (the command the text names), and `data.warnings`. |
486
487
  | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
@@ -491,8 +492,8 @@ Every response has a `type` discriminant. The full set is below (generated from
491
492
  | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |
492
493
  | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category, isReady}); each block names the package that owns it, and the envelope's package names the component's owner. |
493
494
  | `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?, replacedPackage?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
494
- | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). A topic or guide that took another's place carries replaces and replacedPackage, the package whose topic or guide it replaced. |
495
- | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there); replaces and replacedPackage when the topic or guide took another's place. |
495
+ | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic; in text, a read of a topic whose whole text is 16 KB or less, --full, or --dense), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). A topic or guide that took another's place carries replaces and replacedPackage, the package whose topic or guide it replaced. |
496
+ | `docs.index` | One topic's section index, the text read of a topic whose whole text is over 16 KB (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there); replaces and replacedPackage when the topic or guide took another's place. |
496
497
  | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |
497
498
  | `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package, and a guide an integration replaced its replaces and replacedPackage) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
498
499
  | `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
@@ -512,7 +513,7 @@ Every response has a `type` discriminant. The full set is below (generated from
512
513
  | `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
513
514
  | `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media), and demoContentReplaced (how many Astryx docs-only demo content elements were replaced with a Text placeholder for your own content), and isReady (false when the template's doc sets isReady: false). |
514
515
  | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description, the components it composes, and isReady. The envelope's package names the npm package that owns the template. |
515
- | `template.copy` | A scaffold receipt: template id, output directory (relative to the project; absolute for a scratch copy in the system temp folder), written file name, file count, givenPath (optional; 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), and isReady. The envelope's package names the npm package that owns the template. |
516
+ | `template.copy` | A scaffold receipt: template id, output directory (relative to the project; absolute for a scratch copy in the system temp folder), written file name, file count, givenPath (optional; 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), and isReady. The envelope's package names the npm package that owns the template. |
516
517
  | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
517
518
  | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is the run's active base: @astryxdesign/core in a run on Core. |
518
519
  | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
@@ -141,6 +141,31 @@ export function pageDestination(id: string, cwd: string): string | null;
141
141
  * @returns {string | null}
142
142
  */
143
143
  export function buildCoreContentDir(cwd: string): string | null;
144
+ /**
145
+ * The provider the app passes its theme to instead of `<Theme>`, as
146
+ * `theme add` names it: the one an installed package declares, when it takes
147
+ * a theme object. `line` is its opening tag, built as the `theme add`
148
+ * receipt builds it.
149
+ * @typedef {{export: string, from: string, line: string}} ThemeProvider
150
+ */
151
+ /**
152
+ * @typedef {({state: 'wired', modulePath: string, hasModes: boolean}
153
+ * | {state: 'installed', slug: string, hasModes: boolean}
154
+ * | {state: 'none', slug: string, package: string})
155
+ * & {provider: ThemeProvider | null}} AppThemeWiring
156
+ */
157
+ /**
158
+ * How the project at `cwd` wires its theme, read the way `theme add` reads
159
+ * it: `wired` when `theme add` has written the generated module, `installed`
160
+ * when a theme it can add is installed but not added, and otherwise the
161
+ * starter theme. `hasModes` says the module records a theme's one color mode,
162
+ * or will once `theme add` adds the installed theme, read from its built
163
+ * module as `theme add` reads it. `provider` is set when an installed package
164
+ * names the provider that takes the theme.
165
+ * @param {string} cwd
166
+ * @returns {Promise<AppThemeWiring>}
167
+ */
168
+ export function appThemeWiring(cwd: string): Promise<AppThemeWiring>;
144
169
  export { withListingCache } from "../../foundation/fs/listing-cache.mjs";
145
170
  /**
146
171
  * A page template the kit can recommend starting from.
@@ -238,3 +263,29 @@ export type BlockTemplate = {
238
263
  */
239
264
  isReady: boolean;
240
265
  };
266
+ /**
267
+ * The provider the app passes its theme to instead of `<Theme>`, as
268
+ * `theme add` names it: the one an installed package declares, when it takes
269
+ * a theme object. `line` is its opening tag, built as the `theme add`
270
+ * receipt builds it.
271
+ */
272
+ export type ThemeProvider = {
273
+ export: string;
274
+ from: string;
275
+ line: string;
276
+ };
277
+ export type AppThemeWiring = ({
278
+ state: "wired";
279
+ modulePath: string;
280
+ hasModes: boolean;
281
+ } | {
282
+ state: "installed";
283
+ slug: string;
284
+ hasModes: boolean;
285
+ } | {
286
+ state: "none";
287
+ slug: string;
288
+ package: string;
289
+ }) & {
290
+ provider: ThemeProvider | null;
291
+ };
@@ -7,20 +7,24 @@
7
7
  *
8
8
  * @input Template and component discovery for `cwd` — the CLI's own templates
9
9
  * and Core's components, plus any that the project's configured integrations
10
- * contribute.
10
+ * contribute; the project's generated theme module and installed theme
11
+ * packages.
11
12
  * @output Ready page templates as `{name, displayName, description, category,
12
13
  * keywords, command}`, where `command` is the `astryx template` command that
13
14
  * selects exactly that template; blocks as search names them; components as
14
15
  * `{name, keywords}`; the kit's matcher weights, the root's classifier
15
16
  * weights, and the block picker's weights; `keptBlockCatalog`, which keeps
16
- * the picker's per-block vectors beside the kept search catalog.
17
+ * the picker's per-block vectors beside the kept search catalog; and
18
+ * `appThemeWiring`, how the project wires its theme.
17
19
  * @position Beside build.mjs (api/build/). The kit leaf reads templates and
18
20
  * components only through here, because a subject's `_adapter.mjs` is its
19
21
  * only environment access. This adds no discovery of its own: templates come
20
- * from the template subject's, components from search's.
22
+ * from the template subject's, components from search's, themes from the
23
+ * theme subject's.
21
24
  */
22
25
 
23
26
  import fs from 'node:fs';
27
+ import {renderTokens} from '../../foundation/doc-compiler/links.mjs';
24
28
  import path from 'node:path';
25
29
  import {fileURLToPath} from 'node:url';
26
30
 
@@ -33,6 +37,21 @@ import {extractComponents} from '../../foundation/discovery/template-adapter.mjs
33
37
  import {templateDestination} from '../../foundation/discovery/template-destination.mjs';
34
38
  import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
35
39
  import {isWordModel} from './kit/word-model.mjs';
40
+ import {
41
+ listAvailableThemeState,
42
+ themeOwnerInstalled,
43
+ } from '../theme/_adapter.mjs';
44
+ import {providerLine, providersOf} from '../theme/_app-provider.mjs';
45
+ import {
46
+ ThemeImportError,
47
+ resolveThemeImports,
48
+ } from '../../foundation/discovery/theme-imports.mjs';
49
+ import {
50
+ ThemeStateError,
51
+ readThemeState,
52
+ } from '../../foundation/config/theme-state.mjs';
53
+ import {STARTER_THEME} from '../../foundation/discovery/theme-discovery.mjs';
54
+ import {AstryxError} from '../error.mjs';
36
55
 
37
56
  /**
38
57
  * Runs one build with a single directory listing per path: the kit resolves
@@ -116,7 +135,7 @@ export async function loadTemplates(cwd) {
116
135
  displayName: t.displayName || t.name,
117
136
  category: t.category || '',
118
137
  keywords: t.keywords ?? [],
119
- description: t.description || '',
138
+ description: renderTokens(t.description || ''),
120
139
  }));
121
140
  const pages = templates
122
141
  .filter(t => t.type === 'page' && t.isReady !== false)
@@ -125,7 +144,7 @@ export async function loadTemplates(cwd) {
125
144
  {
126
145
  name: t.dirName,
127
146
  displayName: t.displayName || t.name,
128
- description: t.description || '',
147
+ description: renderTokens(t.description || ''),
129
148
  package: t.package ?? '@astryxdesign/core',
130
149
  category: t.category || '',
131
150
  keywords: t.keywords ?? [],
@@ -145,7 +164,7 @@ export async function loadTemplates(cwd) {
145
164
  name: t.dirName,
146
165
  package: t.package ?? '@astryxdesign/core',
147
166
  displayName: t.name,
148
- description: t.description || '',
167
+ description: renderTokens(t.description || ''),
149
168
  command: `astryx template ${t.replaces ?? t.dirName} --type block`,
150
169
  isReady: t.isReady !== false,
151
170
  }));
@@ -414,3 +433,100 @@ function withComponents(entry, filePath) {
414
433
  })
415
434
  );
416
435
  }
436
+
437
+ /**
438
+ * The provider the app passes its theme to instead of `<Theme>`, as
439
+ * `theme add` names it: the one an installed package declares, when it takes
440
+ * a theme object. `line` is its opening tag, built as the `theme add`
441
+ * receipt builds it.
442
+ * @typedef {{export: string, from: string, line: string}} ThemeProvider
443
+ */
444
+
445
+ /**
446
+ * @typedef {({state: 'wired', modulePath: string, hasModes: boolean}
447
+ * | {state: 'installed', slug: string, hasModes: boolean}
448
+ * | {state: 'none', slug: string, package: string})
449
+ * & {provider: ThemeProvider | null}} AppThemeWiring
450
+ */
451
+
452
+ /**
453
+ * How the project at `cwd` wires its theme, read the way `theme add` reads
454
+ * it: `wired` when `theme add` has written the generated module, `installed`
455
+ * when a theme it can add is installed but not added, and otherwise the
456
+ * starter theme. `hasModes` says the module records a theme's one color mode,
457
+ * or will once `theme add` adds the installed theme, read from its built
458
+ * module as `theme add` reads it. `provider` is set when an installed package
459
+ * names the provider that takes the theme.
460
+ * @param {string} cwd
461
+ * @returns {Promise<AppThemeWiring>}
462
+ */
463
+ export async function appThemeWiring(cwd) {
464
+ /** @type {ThemeProvider | null} */
465
+ let starterProvider = null;
466
+ try {
467
+ const {themes} = await listAvailableThemeState(cwd);
468
+ const {taking} = providersOf(themes);
469
+ /** @param {boolean} oneMode @returns {ThemeProvider | null} */
470
+ const provide = oneMode =>
471
+ taking?.provider.themeProp
472
+ ? {
473
+ export: taking.provider.export,
474
+ from: taking.provider.from,
475
+ line: providerLine(taking.provider, oneMode),
476
+ }
477
+ : null;
478
+ starterProvider = provide(false);
479
+ const state = readThemeState(cwd);
480
+ const source = state.module.expectedOriginal;
481
+ if (state.configured && source) {
482
+ const hasModes = /\bexport const themeModes\b/u.test(
483
+ source.toString('utf-8'),
484
+ );
485
+ return {
486
+ state: 'wired',
487
+ modulePath: state.module.path,
488
+ hasModes,
489
+ provider: provide(hasModes),
490
+ };
491
+ }
492
+ const installed = themes.find(theme =>
493
+ themeOwnerInstalled(theme, state.projectDir),
494
+ );
495
+ if (installed) {
496
+ const hasModes = oneColorModeOf(installed, cwd);
497
+ return {
498
+ state: 'installed',
499
+ slug: installed.slug,
500
+ hasModes,
501
+ provider: provide(hasModes),
502
+ };
503
+ }
504
+ } catch (error) {
505
+ // Outside a project, or with theme state the theme commands refuse, the
506
+ // playbook names the starter theme; those commands report the problem.
507
+ if (!(error instanceof ThemeStateError || error instanceof AstryxError))
508
+ throw error;
509
+ }
510
+ return {
511
+ state: 'none',
512
+ slug: STARTER_THEME.slug,
513
+ package: STARTER_THEME.package,
514
+ provider: starterProvider,
515
+ };
516
+ }
517
+
518
+ /**
519
+ * Whether `theme add` records one color mode for a theme: its built module
520
+ * exports one. A theme whose built module cannot be resolved has none here;
521
+ * `theme add` reports that problem.
522
+ * @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
523
+ * @param {string} cwd
524
+ */
525
+ function oneColorModeOf(theme, cwd) {
526
+ try {
527
+ return resolveThemeImports(theme, {cwd}).mode != null;
528
+ } catch (error) {
529
+ if (error instanceof ThemeImportError) return false;
530
+ throw error;
531
+ }
532
+ }
@@ -40,7 +40,7 @@ export const doc = {
40
40
  name: 'options.cwd',
41
41
  type: 'string',
42
42
  description:
43
- 'Directory to resolve @astryxdesign/core and templates from.',
43
+ 'Directory to resolve @astryxdesign/core and templates from, and whose theme wiring the playbook names.',
44
44
  default: 'process.cwd()',
45
45
  },
46
46
  {