@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
@@ -289,6 +289,45 @@ function removeStylesheetHooks() {
289
289
  }
290
290
  }
291
291
 
292
+ /**
293
+ * The file Node could not load, from its refusal of an unknown extension
294
+ * (a native import), or from a syntax error in a file that is no JavaScript
295
+ * (jiti's synchronous require, which reads the file as a script and names it
296
+ * on the first line of the stack). Null for any other error.
297
+ * @param {unknown} error
298
+ * @returns {string | null}
299
+ */
300
+ function unloadableFile(error) {
301
+ const e = /** @type {any} */ (error);
302
+ if (e?.code === 'ERR_UNKNOWN_FILE_EXTENSION')
303
+ return /\bfor (.+)$/.exec(String(e.message))?.[1] ?? null;
304
+ if (e instanceof SyntaxError)
305
+ return /^(.+):\d+$/.exec(String(e.stack).split('\n')[0])?.[1] ?? null;
306
+ return null;
307
+ }
308
+
309
+ /**
310
+ * On a Node without module hooks, the refusal for a stylesheet or an asset a
311
+ * theme module imports: it names the file and the Node that loads it. Null
312
+ * for any other error.
313
+ * @param {unknown} error
314
+ * @returns {Error | null}
315
+ */
316
+ function needsModuleHooks(error) {
317
+ const file = unloadableFile(error);
318
+ if (!file || !(STYLESHEET_FILE.test(file) || ASSET_FILE.test(file)))
319
+ return null;
320
+ const relative = path.relative(process.cwd(), file);
321
+ const shown =
322
+ relative && !relative.startsWith('..') && !path.isAbsolute(relative)
323
+ ? relative
324
+ : file;
325
+ return new Error(
326
+ `it imports ${shown}, and loading a theme that imports a stylesheet or asset needs Node 22.15 or later, or 23.5 or later (this is Node ${process.versions.node}). Nothing was written.`,
327
+ {cause: error},
328
+ );
329
+ }
330
+
292
331
  /**
293
332
  * Run a theme module load with every stylesheet that the theme's modules
294
333
  * import, at any depth, loaded as an empty module, and every asset they
@@ -304,7 +343,9 @@ function removeStylesheetHooks() {
304
343
  * there, so the caller can say what its outputs do not carry. Module loads
305
344
  * outside this call's async context do not change. The module hook is
306
345
  * installed for the first overlapping load and removed after the last. A
307
- * Node without module hooks (before 22.15) runs the load unchanged.
346
+ * Node without module hooks (before 22.15, or 23.0 to 23.4) runs the load
347
+ * unchanged, and a stylesheet or asset it meets refuses the load, naming
348
+ * that Node.
308
349
  * @template T
309
350
  * @param {() => Promise<T>} load
310
351
  * @param {{unbuilt?: Set<string>, imported?: Set<string>}} [options]
@@ -316,7 +357,13 @@ export async function withEmptyStylesheets(load, options = {}) {
316
357
  // running never keeps the command from exiting, and an exit it calls
317
358
  // while loading is a refused load, never the command's own exit.
318
359
  const guarded = () => withStdoutOnStderr(() => withThemeModuleGuards(load));
319
- if (typeof registerHooks !== 'function') return await guarded();
360
+ if (typeof registerHooks !== 'function') {
361
+ try {
362
+ return await guarded();
363
+ } catch (error) {
364
+ throw needsModuleHooks(error) ?? error;
365
+ }
366
+ }
320
367
  stylesheetHooks ??= registerHooks({
321
368
  resolve: resolveUnbuiltStylesheet,
322
369
  load: loadStylesheetAsEmptyModule,
@@ -344,6 +391,11 @@ let exitGuards = 0;
344
391
  /** @type {typeof process.exit | null} */
345
392
  let realExit = null;
346
393
  let guardsInstalled = false;
394
+ /**
395
+ * The last exception a theme module's microtask threw, with its load.
396
+ * @type {{error: unknown, load: GuardedLoad} | null}
397
+ */
398
+ let microtaskThrow = null;
347
399
  /** Callbacks of a module load running now, each holding the stdout gate. */
348
400
  const deferredGates = new Set();
349
401
  /**
@@ -563,12 +615,31 @@ function installThemeModuleGuards() {
563
615
  // One thrown while the module still loads (from a microtask it queued)
564
616
  // refuses that load with it, as a throw from its top level does.
565
617
  tellThemeModuleCallbacks(error => {
566
- const load = guardedLoad.getStore();
618
+ const thrown = microtaskThrow?.error === error ? microtaskThrow : null;
619
+ microtaskThrow = null;
620
+ const load = guardedLoad.getStore() ?? thrown?.load;
567
621
  if (!load) return null;
568
622
  if (load.done) return 'after';
569
623
  load.fail(error);
570
624
  return 'during';
571
625
  });
626
+ // Before Node 24, an exception from a microtask reaches 'uncaughtException'
627
+ // outside the async context that queued it. A microtask a theme module
628
+ // queues keeps its load, so its exception is told as the module's.
629
+ const queue = globalThis.queueMicrotask;
630
+ globalThis.queueMicrotask = function (callback) {
631
+ const load = guardedLoad.getStore();
632
+ if (!load || typeof callback !== 'function')
633
+ return queue.call(globalThis, callback);
634
+ return queue.call(globalThis, () => {
635
+ try {
636
+ callback();
637
+ } catch (error) {
638
+ microtaskThrow = {error, load};
639
+ throw error;
640
+ }
641
+ });
642
+ };
572
643
  // A global Node defines as replaceable (an accessor, such as `Buffer`)
573
644
  // that a theme module assigns while it loads is put back when the load
574
645
  // ends: its value as it was is read only when the module assigns it.
@@ -667,9 +738,14 @@ async function withThemeModuleGuards(load) {
667
738
  holdExit();
668
739
  /** @type {(error: unknown) => void} */
669
740
  let fail = () => {};
741
+ /** The first refusal, held where the race below cannot lose it. */
742
+ const failure = /** @type {{error?: {value: unknown}}} */ ({});
670
743
  /** @type {Promise<never>} */
671
744
  const failed = new Promise((_resolve, reject) => {
672
- fail = reject;
745
+ fail = error => {
746
+ failure.error ??= {value: error};
747
+ reject(error);
748
+ };
673
749
  });
674
750
  // Read only through the race below; a failure after it settled is moot.
675
751
  failed.catch(() => {});
@@ -698,11 +774,15 @@ async function withThemeModuleGuards(load) {
698
774
  // Node empties its loop with the load still waiting: refused, not exit 13.
699
775
  process.once('beforeExit', drained);
700
776
  try {
701
- return await Promise.race([
777
+ const loaded = await Promise.race([
702
778
  guardedLoad.run(store, load),
703
779
  unsettled,
704
780
  failed,
705
781
  ]);
782
+ // A load that settles in the same microtask checkpoint as a microtask it
783
+ // queued wins the race before that microtask's exception refuses it.
784
+ if (failure.error) throw failure.error.value;
785
+ return loaded;
706
786
  } finally {
707
787
  process.removeListener('beforeExit', drained);
708
788
  process.exitCode = exitCode;
@@ -6,7 +6,8 @@
6
6
  *
7
7
  * @input An operation run inside `recordReads(seen, fn)`.
8
8
  * @output `seen` gets every file whose content the operation read through fs
9
- * or imported as a doc module (`recordContentRead`), and every folder it
9
+ * (synchronously or with promises.readFile) or imported as a doc module
10
+ * (`recordContentRead`), and every folder it
10
11
  * listed or probed, each with its state when first read; an exact run
11
12
  * records each probed path by what the call returned instead.
12
13
  * `unchangedSince(seen)` says whether all are still in that state.
@@ -126,10 +127,11 @@ const RECORDED = [
126
127
  'realpathSync',
127
128
  'accessSync',
128
129
  'openSync',
130
+ 'readFile',
129
131
  ];
130
132
 
131
133
  /** The reads that see a file's content, so the file itself is checked. */
132
- const CONTENT_READS = new Set(['readFileSync', 'openSync']);
134
+ const CONTENT_READS = new Set(['readFileSync', 'openSync', 'readFile']);
133
135
 
134
136
  /**
135
137
  * What an existence check of a present path records: only that it is there,
@@ -247,7 +249,9 @@ function installRecorder() {
247
249
  if (recording) return;
248
250
  recording = true;
249
251
  for (const name of RECORDED) {
250
- const original = fs[name];
252
+ // Older Node releases read native ES modules through the promise API.
253
+ const api = name === 'readFile' ? fs.promises : fs;
254
+ const original = api[name];
251
255
  if (typeof original !== 'function') continue;
252
256
  const kind = readKind(name);
253
257
  /**
@@ -283,9 +287,9 @@ function installRecorder() {
283
287
  return answer;
284
288
  };
285
289
  Object.assign(wrapped, original);
286
- fs[name] = wrapped;
290
+ api[name] = wrapped;
287
291
  }
288
- // ESM imports of node:fs see the wrapped functions too.
292
+ // ESM imports of node:fs and node:fs/promises see the wrapped functions too.
289
293
  syncBuiltinESMExports();
290
294
  }
291
295
 
@@ -0,0 +1,18 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @file The npm package names of Astryx's built-in providers, as plain
6
+ * strings. It imports nothing, so a module that needs only a name loads no
7
+ * identity code.
8
+ * @input Stable npm package names owned by Astryx.
9
+ * @output CORE_PACKAGE_NAME and CLI_PACKAGE_NAME.
10
+ * @position foundation/identity — the one definition of these names: read by
11
+ * ./providers.mjs, which brands them, by the bases, which name Core by its
12
+ * package, and by the release facts (foundation/release/project.mjs), which
13
+ * pass them on.
14
+ */
15
+ /** Core's package name. */
16
+ export const CORE_PACKAGE_NAME: "@astryxdesign/core";
17
+ /** The CLI's package name. */
18
+ export const CLI_PACKAGE_NAME: "@astryxdesign/cli";
@@ -0,0 +1,19 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The npm package names of Astryx's built-in providers, as plain
5
+ * strings. It imports nothing, so a module that needs only a name loads no
6
+ * identity code.
7
+ * @input Stable npm package names owned by Astryx.
8
+ * @output CORE_PACKAGE_NAME and CLI_PACKAGE_NAME.
9
+ * @position foundation/identity — the one definition of these names: read by
10
+ * ./providers.mjs, which brands them, by the bases, which name Core by its
11
+ * package, and by the release facts (foundation/release/project.mjs), which
12
+ * pass them on.
13
+ */
14
+
15
+ /** Core's package name. */
16
+ export const CORE_PACKAGE_NAME = '@astryxdesign/core';
17
+
18
+ /** The CLI's package name. */
19
+ export const CLI_PACKAGE_NAME = '@astryxdesign/cli';
@@ -7,10 +7,11 @@
7
7
  * @position foundation/identity — built-in provider identity boundary.
8
8
  */
9
9
 
10
+ import {CLI_PACKAGE_NAME, CORE_PACKAGE_NAME} from './package-names.mjs';
10
11
  import {normalizeProviderId} from './provider-identity.mjs';
11
12
 
12
13
  /** Core owns built-in components and templates. */
13
- export const CORE_PROVIDER_ID = normalizeProviderId('@astryxdesign/core');
14
+ export const CORE_PROVIDER_ID = normalizeProviderId(CORE_PACKAGE_NAME);
14
15
 
15
16
  /** The CLI owns built-in topic docs and CLI-authored contributions. */
16
- export const CLI_PROVIDER_ID = normalizeProviderId('@astryxdesign/cli');
17
+ export const CLI_PROVIDER_ID = normalizeProviderId(CLI_PACKAGE_NAME);
@@ -0,0 +1,63 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * @typedef {object} IconFeatureGate
6
+ * @property {boolean} on whether every icon surface reads icon sets
7
+ * @property {'released' | 'iconSet' | 'pack' | null} reason why they are on:
8
+ * the release switch, the project's `experimental.iconSet`, or an installed
9
+ * icon-set package; null when off
10
+ */
11
+ /**
12
+ * Whether icon features are on in a project, and why. They are on when the
13
+ * release switch is on, when astryx.config sets `experimental.iconSet`, or
14
+ * when an installed integration declares an `experimental.iconSets` root.
15
+ * The package being authored in the current folder (`__local`) is not
16
+ * installed: its own sets turn nothing on there.
17
+ * A project that cannot be read has them off, unless they are released.
18
+ * @param {{config?: {experimental?: {iconSet?: unknown}}, loadedIntegrations?: ReadonlyArray<{iconSets?: unknown, __local?: unknown, __loadError?: unknown, __providerConflict?: unknown} | null | undefined>} | null | undefined} project
19
+ * @returns {IconFeatureGate}
20
+ */
21
+ export function iconFeatureGate(project: {
22
+ config?: {
23
+ experimental?: {
24
+ iconSet?: unknown;
25
+ };
26
+ };
27
+ loadedIntegrations?: ReadonlyArray<{
28
+ iconSets?: unknown;
29
+ __local?: unknown;
30
+ __loadError?: unknown;
31
+ __providerConflict?: unknown;
32
+ } | null | undefined>;
33
+ } | null | undefined): IconFeatureGate;
34
+ /**
35
+ * @file The one gate every icon surface reads: whether icon features are on
36
+ * in a project.
37
+ * @input A loaded project's config and loaded integrations.
38
+ * @output `iconFeatureGate(project)`: on, and why, or off.
39
+ * `ICON_FEATURES_RELEASED`: the release switch.
40
+ * @position Read by foundation/config/project.mjs (`iconSets()`, the
41
+ * integration checks, and the docs catalog), and by discover, doctor,
42
+ * integration validate, and upgrade. While the switch is off, a
43
+ * project with no icon-set package and no `experimental.iconSet` reads no
44
+ * icon feature, so its output stays as it is without them.
45
+ */
46
+ /**
47
+ * The release switch. While it is false, icon features are on only in a
48
+ * project that installs an icon-set package or sets `experimental.iconSet`.
49
+ * Set it to true to turn them on in every project.
50
+ */
51
+ export const ICON_FEATURES_RELEASED: false;
52
+ export type IconFeatureGate = {
53
+ /**
54
+ * whether every icon surface reads icon sets
55
+ */
56
+ on: boolean;
57
+ /**
58
+ * why they are on:
59
+ * the release switch, the project's `experimental.iconSet`, or an installed
60
+ * icon-set package; null when off
61
+ */
62
+ reason: "released" | "iconSet" | "pack" | null;
63
+ };
@@ -0,0 +1,54 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The one gate every icon surface reads: whether icon features are on
5
+ * in a project.
6
+ * @input A loaded project's config and loaded integrations.
7
+ * @output `iconFeatureGate(project)`: on, and why, or off.
8
+ * `ICON_FEATURES_RELEASED`: the release switch.
9
+ * @position Read by foundation/config/project.mjs (`iconSets()`, the
10
+ * integration checks, and the docs catalog), and by discover, doctor,
11
+ * integration validate, and upgrade. While the switch is off, a
12
+ * project with no icon-set package and no `experimental.iconSet` reads no
13
+ * icon feature, so its output stays as it is without them.
14
+ */
15
+
16
+ /**
17
+ * The release switch. While it is false, icon features are on only in a
18
+ * project that installs an icon-set package or sets `experimental.iconSet`.
19
+ * Set it to true to turn them on in every project.
20
+ */
21
+ export const ICON_FEATURES_RELEASED = false;
22
+
23
+ /**
24
+ * @typedef {object} IconFeatureGate
25
+ * @property {boolean} on whether every icon surface reads icon sets
26
+ * @property {'released' | 'iconSet' | 'pack' | null} reason why they are on:
27
+ * the release switch, the project's `experimental.iconSet`, or an installed
28
+ * icon-set package; null when off
29
+ */
30
+
31
+ /**
32
+ * Whether icon features are on in a project, and why. They are on when the
33
+ * release switch is on, when astryx.config sets `experimental.iconSet`, or
34
+ * when an installed integration declares an `experimental.iconSets` root.
35
+ * The package being authored in the current folder (`__local`) is not
36
+ * installed: its own sets turn nothing on there.
37
+ * A project that cannot be read has them off, unless they are released.
38
+ * @param {{config?: {experimental?: {iconSet?: unknown}}, loadedIntegrations?: ReadonlyArray<{iconSets?: unknown, __local?: unknown, __loadError?: unknown, __providerConflict?: unknown} | null | undefined>} | null | undefined} project
39
+ * @returns {IconFeatureGate}
40
+ */
41
+ export function iconFeatureGate(project) {
42
+ if (ICON_FEATURES_RELEASED) return {on: true, reason: 'released'};
43
+ if (project?.config?.experimental?.iconSet) {
44
+ return {on: true, reason: 'iconSet'};
45
+ }
46
+ const packInstalled = (project?.loadedIntegrations ?? []).some(
47
+ integration =>
48
+ Boolean(integration?.iconSets) &&
49
+ !integration?.__local &&
50
+ !integration?.__loadError &&
51
+ !integration?.__providerConflict,
52
+ );
53
+ return packInstalled ? {on: true, reason: 'pack'} : {on: false, reason: null};
54
+ }
@@ -37,7 +37,7 @@ export function markProviderConflicts(integrations: LoadedIntegration[]): Loaded
37
37
  * @param {string} file absolute manifest path
38
38
  * @param {string} [label] used in error messages
39
39
  * @param {{fresh?: boolean}} [options]
40
- * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string}>}
40
+ * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string, installGuidanceError?: string}>}
41
41
  */
42
42
  export function loadManifest(file: string, label?: string, { fresh }?: {
43
43
  fresh?: boolean;
@@ -56,6 +56,7 @@ export function loadManifest(file: string, label?: string, { fresh }?: {
56
56
  discoverError?: string;
57
57
  agentDocsError?: string;
58
58
  cliCommandError?: string;
59
+ installGuidanceError?: string;
59
60
  }>;
60
61
  /**
61
62
  * Load and validate a manifest module's default export against the integration
@@ -175,6 +176,17 @@ export type LoadedIntegration = {
175
176
  * ignored; the rest of the manifest still contributes
176
177
  */
177
178
  __cliCommandError?: string | undefined;
179
+ /**
180
+ * how an app that uses this package
181
+ * adds a dependency; read by `installGuidanceFor` in
182
+ * foundation/env/cli-command.mjs
183
+ */
184
+ installGuidance?: string | undefined;
185
+ /**
186
+ * why a declared
187
+ * `installGuidance` was ignored; the rest of the manifest still contributes
188
+ */
189
+ __installGuidanceError?: string | undefined;
178
190
  /**
179
191
  * contribution-specific validation
180
192
  * failure; other manifest contributions remain available
@@ -28,6 +28,7 @@ import {normalizeProviderId} from '../identity/provider-identity.mjs';
28
28
  import {
29
29
  parseAgentDocsField,
30
30
  parseCliCommandField,
31
+ parseInstallGuidanceField,
31
32
  parseIntegrationBase,
32
33
  unknownIntegrationKeys,
33
34
  ignoredIntegrationFields,
@@ -71,6 +72,11 @@ import {unknownCapabilityKeys} from '../bases/steps.mjs';
71
72
  * CLI with; read by the picker in foundation/env (see cli-command.mjs)
72
73
  * @property {string} [__cliCommandError] why a declared `cliCommand` was
73
74
  * ignored; the rest of the manifest still contributes
75
+ * @property {string} [installGuidance] how an app that uses this package
76
+ * adds a dependency; read by `installGuidanceFor` in
77
+ * foundation/env/cli-command.mjs
78
+ * @property {string} [__installGuidanceError] why a declared
79
+ * `installGuidance` was ignored; the rest of the manifest still contributes
74
80
  * @property {string} [__agentDocsError] contribution-specific validation
75
81
  * failure; other manifest contributions remain available
76
82
  * @property {string} __spec
@@ -116,7 +122,6 @@ import {unknownCapabilityKeys} from '../bases/steps.mjs';
116
122
  * @property {string} [__discoverError] isolated discover-source validation error.
117
123
  */
118
124
 
119
-
120
125
  /**
121
126
  * Normalize a package-owned provider ID without rejecting legacy unnamed local
122
127
  * packages at this compatibility boundary.
@@ -161,7 +166,6 @@ export function markProviderConflicts(integrations) {
161
166
  ).integrations;
162
167
  }
163
168
 
164
-
165
169
  /**
166
170
  * Parse the optional named gap-report handler without making it part of the
167
171
  * default manifest schema. A malformed handler is isolated from every other
@@ -196,7 +200,9 @@ function parseGapReportHandlerExport(value, label) {
196
200
  function parseDiscoverSourceExport(value, label) {
197
201
  if (value === undefined) return {};
198
202
  try {
199
- return {source: parseDiscoverSource(value, `${label} named export "discover"`)};
203
+ return {
204
+ source: parseDiscoverSource(value, `${label} named export "discover"`),
205
+ };
200
206
  } catch (error) {
201
207
  return {error: error instanceof Error ? error.message : String(error)};
202
208
  }
@@ -218,7 +224,7 @@ function parseDiscoverSourceExport(value, label) {
218
224
  * @param {string} file absolute manifest path
219
225
  * @param {string} [label] used in error messages
220
226
  * @param {{fresh?: boolean}} [options]
221
- * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string}>}
227
+ * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string, installGuidanceError?: string}>}
222
228
  */
223
229
  export async function loadManifest(
224
230
  file,
@@ -227,7 +233,8 @@ export async function loadManifest(
227
233
  ) {
228
234
  const mod = await importUserModule(file, {fresh});
229
235
  const raw = mod?.default;
230
- if (raw === undefined) throw new Error(noDefaultExportMessage(file, label, mod));
236
+ if (raw === undefined)
237
+ throw new Error(noDefaultExportMessage(file, label, mod));
231
238
  const baseManifest = parseIntegrationBase(raw, label);
232
239
  const gapReport = parseGapReportHandlerExport(mod?.gapReport, label);
233
240
  const discover = parseDiscoverSourceExport(mod?.discover, label);
@@ -273,13 +280,36 @@ export async function loadManifest(
273
280
  }
274
281
  }
275
282
 
283
+ /** @type {string | undefined} */
284
+ let installGuidance;
285
+ /** @type {string | undefined} */
286
+ let installGuidanceError;
287
+ const rawInstallGuidance =
288
+ raw != null && typeof raw === 'object' && !Array.isArray(raw)
289
+ ? /** @type {{installGuidance?: unknown}} */ (raw).installGuidance
290
+ : undefined;
291
+ if (rawInstallGuidance !== undefined) {
292
+ try {
293
+ installGuidance = parseInstallGuidanceField(
294
+ rawInstallGuidance,
295
+ `${label} field "installGuidance"`,
296
+ );
297
+ } catch (err) {
298
+ installGuidanceError = err instanceof Error ? err.message : String(err);
299
+ }
300
+ }
301
+
276
302
  return {
277
303
  manifest: {
278
304
  ...baseManifest,
279
305
  ...(agentDocs == null ? {} : {agentDocs}),
280
306
  ...(cliCommand == null ? {} : {cliCommand}),
307
+ ...(installGuidance == null ? {} : {installGuidance}),
281
308
  },
282
- unknownKeys: [...unknownIntegrationKeys(raw), ...unknownCapabilityKeys(raw)],
309
+ unknownKeys: [
310
+ ...unknownIntegrationKeys(raw),
311
+ ...unknownCapabilityKeys(raw),
312
+ ],
283
313
  ignoredFields: ignoredIntegrationFields(raw),
284
314
  declaredKeys:
285
315
  raw != null && typeof raw === 'object' ? Object.keys(raw) : [],
@@ -295,6 +325,7 @@ export async function loadManifest(
295
325
  discoverError: discover.error,
296
326
  agentDocsError,
297
327
  cliCommandError,
328
+ installGuidanceError,
298
329
  };
299
330
  }
300
331
 
@@ -466,6 +497,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
466
497
  let agentDocsError;
467
498
  /** @type {string | undefined} */
468
499
  let cliCommandError;
500
+ /** @type {string | undefined} */
501
+ let installGuidanceError;
469
502
  try {
470
503
  ({
471
504
  manifest,
@@ -479,6 +512,7 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
479
512
  discoverError,
480
513
  agentDocsError,
481
514
  cliCommandError,
515
+ installGuidanceError,
482
516
  } = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
483
517
  } catch (err) {
484
518
  return {
@@ -520,8 +554,10 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
520
554
  logo: manifest.logo,
521
555
  agentDocs: manifest.agentDocs,
522
556
  cliCommand: manifest.cliCommand,
557
+ installGuidance: manifest.installGuidance,
523
558
  base: manifest.base,
524
559
  __cliCommandError: cliCommandError,
560
+ __installGuidanceError: installGuidanceError,
525
561
  __agentDocsError: agentDocsError,
526
562
  __unknownKeys: unknownKeys,
527
563
  __ignoredFields: ignoredFields,
@@ -594,6 +630,8 @@ export async function loadIntegrations(
594
630
  let agentDocsError;
595
631
  /** @type {string | undefined} */
596
632
  let cliCommandError;
633
+ /** @type {string | undefined} */
634
+ let installGuidanceError;
597
635
  try {
598
636
  ({
599
637
  manifest,
@@ -607,6 +645,7 @@ export async function loadIntegrations(
607
645
  discoverError,
608
646
  agentDocsError,
609
647
  cliCommandError,
648
+ installGuidanceError,
610
649
  } = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
611
650
  } catch (err) {
612
651
  // A manifest that throws on import or fails schema validation must NOT take
@@ -655,8 +694,10 @@ export async function loadIntegrations(
655
694
  logo: manifest.logo,
656
695
  agentDocs: manifest.agentDocs,
657
696
  cliCommand: manifest.cliCommand,
697
+ installGuidance: manifest.installGuidance,
658
698
  base: manifest.base,
659
699
  __cliCommandError: cliCommandError,
700
+ __installGuidanceError: installGuidanceError,
660
701
  __agentDocsError: agentDocsError,
661
702
  __unknownKeys: unknownKeys,
662
703
  __ignoredFields: ignoredFields,
@@ -26,6 +26,27 @@ export function npmPackedPaths(base: string): {
26
26
  } | {
27
27
  error: string;
28
28
  };
29
+ /**
30
+ * Run `npm pack --json` with `args` in `cwd`. npm writes one JSON entry per packed file, so a
31
+ * package of tens of thousands of files prints megabytes: its stdout and
32
+ * stderr go to files, not to an in-memory pipe, so no buffer limit stops it.
33
+ * @param {{command: string, prefix: string[]}} npm how to start npm (npmCommand)
34
+ * @param {string} cwd
35
+ * @param {string[]} args the arguments after `pack --json`
36
+ * @param {{timeout: number}} options
37
+ * @returns {{error?: Error, status: number | null, stdout: string, stderr: string}}
38
+ */
39
+ export function runNpmPackJson(npm: {
40
+ command: string;
41
+ prefix: string[];
42
+ }, cwd: string, args: string[], { timeout }: {
43
+ timeout: number;
44
+ }): {
45
+ error?: Error;
46
+ status: number | null;
47
+ stdout: string;
48
+ stderr: string;
49
+ };
29
50
  /**
30
51
  * The ignore files npm reads for one path in a package with no `files`
31
52
  * field: in the root and each folder down to the path's own, `.npmignore`,
@@ -11,7 +11,8 @@
11
11
  * `files`), or cannot be asked.
12
12
  * @position foundation/integrations; read by the template-asset and logo
13
13
  * checks (validate-contributions.mjs) and the shipped-import check
14
- * (shipped-imports.mjs). Inside `withListingCache` (one validation) npm is
14
+ * (shipped-imports.mjs); `integration verify` packs through
15
+ * `runNpmPackJson` too. Inside `withListingCache` (one validation) npm is
15
16
  * asked once per package folder, however many checks ask, and its list is
16
17
  * kept between runs while nothing it depends on has changed.
17
18
  */
@@ -236,6 +237,41 @@ function readNpmrcFiles(folder, npm) {
236
237
  }
237
238
  }
238
239
 
240
+ /**
241
+ * Run `npm pack --json` with `args` in `cwd`. npm writes one JSON entry per packed file, so a
242
+ * package of tens of thousands of files prints megabytes: its stdout and
243
+ * stderr go to files, not to an in-memory pipe, so no buffer limit stops it.
244
+ * @param {{command: string, prefix: string[]}} npm how to start npm (npmCommand)
245
+ * @param {string} cwd
246
+ * @param {string[]} args the arguments after `pack --json`
247
+ * @param {{timeout: number}} options
248
+ * @returns {{error?: Error, status: number | null, stdout: string, stderr: string}}
249
+ */
250
+ export function runNpmPackJson(npm, cwd, args, {timeout}) {
251
+ const outputDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-npm-pack-'));
252
+ const stdoutFile = path.join(outputDir, 'stdout.json');
253
+ const stderrFile = path.join(outputDir, 'stderr.txt');
254
+ const stdoutFd = fs.openSync(stdoutFile, 'w');
255
+ const stderrFd = fs.openSync(stderrFile, 'w');
256
+ try {
257
+ const result = spawnSync(
258
+ npm.command,
259
+ [...npm.prefix, 'pack', '--json', ...args],
260
+ {cwd, shell: false, timeout, stdio: ['ignore', stdoutFd, stderrFd]},
261
+ );
262
+ return {
263
+ error: result.error,
264
+ status: result.status,
265
+ stdout: fs.readFileSync(stdoutFile, 'utf-8'),
266
+ stderr: fs.readFileSync(stderrFile, 'utf-8'),
267
+ };
268
+ } finally {
269
+ fs.closeSync(stdoutFd);
270
+ fs.closeSync(stderrFd);
271
+ fs.rmSync(outputDir, {recursive: true, force: true});
272
+ }
273
+ }
274
+
239
275
  /**
240
276
  * What npm answers for the package in `base` (npmPackedPaths).
241
277
  * @param {string} base
@@ -243,24 +279,11 @@ function readNpmrcFiles(folder, npm) {
243
279
  * @returns {{paths: Set<string>} | {error: string}}
244
280
  */
245
281
  function askNpm(base, npm) {
246
- const result = spawnSync(
247
- npm.command,
248
- [
249
- ...npm.prefix,
250
- 'pack',
251
- '--dry-run',
252
- '--json',
253
- '--ignore-scripts',
254
- '--silent',
255
- ],
256
- {
257
- cwd: base,
258
- encoding: 'utf-8',
259
- shell: false,
260
- timeout: 60_000,
261
- // One line per packed file: room for a very large package.
262
- maxBuffer: 256 * 1024 * 1024,
263
- },
282
+ const result = runNpmPackJson(
283
+ npm,
284
+ base,
285
+ ['--dry-run', '--ignore-scripts', '--silent'],
286
+ {timeout: 60_000},
264
287
  );
265
288
  if (result.error) return {error: `npm did not run (${result.error.message})`};
266
289
  if (result.status !== 0) {