@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.a00065f

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 (466) hide show
  1. package/README.md +106 -73
  2. package/api/blog/blog.doc.mjs +1 -0
  3. package/api/build/build.doc.mjs +4 -3
  4. package/api/build/build.test.mjs +14 -3
  5. package/api/build/build.type.d.mts +36 -2
  6. package/api/build/build.type.mjs +25 -4
  7. package/api/build/help/help.d.mts +8 -5
  8. package/api/build/help/help.mjs +56 -6
  9. package/api/component/component.doc.mjs +13 -3
  10. package/api/component/component.mjs +31 -2
  11. package/api/component/component.test.mjs +38 -0
  12. package/api/component/component.type.d.mts +22 -11
  13. package/api/component/component.type.mjs +32 -24
  14. package/api/component/detail/blocks/blocks.d.mts +2 -1
  15. package/api/component/detail/blocks/blocks.mjs +4 -3
  16. package/api/component/list/list.d.mts +0 -5
  17. package/api/component/list/list.mjs +37 -9
  18. package/api/discover/discover.doc.mjs +2 -1
  19. package/api/discover/discover.type.d.mts +4 -4
  20. package/api/discover/discover.type.mjs +10 -10
  21. package/api/docs/_adapter.d.mts +28 -30
  22. package/api/docs/_adapter.mjs +73 -135
  23. package/api/docs/compiled-topics.test.mjs +78 -0
  24. package/api/docs/detail/detail.d.mts +0 -15
  25. package/api/docs/detail/detail.mjs +14 -78
  26. package/api/docs/detail/section/section.mjs +22 -18
  27. package/api/docs/detail/section/section.test.mjs +4 -3
  28. package/api/docs/docs.doc.mjs +1 -0
  29. package/api/docs/docs.type.d.mts +4 -4
  30. package/api/docs/docs.type.mjs +10 -10
  31. package/api/docs/index/index.mjs +6 -5
  32. package/api/docs/list/list.mjs +3 -7
  33. package/api/doctor/doctor.d.mts +25 -3
  34. package/api/doctor/doctor.doc.mjs +1 -0
  35. package/api/doctor/doctor.mjs +186 -18
  36. package/api/doctor/doctor.test.mjs +326 -1
  37. package/api/gap-report/gap-report.doc.mjs +8 -4
  38. package/api/hook/_adapter.mjs +19 -5
  39. package/api/hook/hook.doc.mjs +1 -0
  40. package/api/hook/hook.type.d.mts +3 -3
  41. package/api/hook/hook.type.mjs +11 -11
  42. package/api/hook/list/list.d.mts +1 -1
  43. package/api/hook/list/list.mjs +69 -17
  44. package/api/init/init.doc.mjs +5 -0
  45. package/api/init/init.test.mjs +41 -1
  46. package/api/init/remove/remove.mjs +1 -1
  47. package/api/init/run/run.mjs +20 -10
  48. package/api/integration/add-contribution.component-names.test.mjs +120 -0
  49. package/api/integration/add-contribution.mjs +23 -10
  50. package/api/integration/add-contribution.test.mjs +121 -7
  51. package/api/integration/add-theme.mjs +34 -64
  52. package/api/integration/add-theme.test.mjs +105 -21
  53. package/api/integration/authoring-checks.test.mjs +8 -4
  54. package/api/integration/integration-block-exports.test.mjs +10 -6
  55. package/api/integration/integrationAdd.doc.mjs +8 -4
  56. package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
  57. package/api/integration/integrationAddCodemod.doc.mjs +1 -0
  58. package/api/integration/integrationAddComponent.doc.mjs +2 -1
  59. package/api/integration/integrationAddDoc.doc.mjs +1 -0
  60. package/api/integration/integrationAddTemplate.doc.mjs +1 -0
  61. package/api/integration/integrationAddTheme.doc.mjs +6 -5
  62. package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
  63. package/api/integration/integrationDocConflicts.doc.mjs +1 -0
  64. package/api/integration/integrationPackCheck.doc.mjs +1 -0
  65. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
  66. package/api/integration/pack-check.mjs +49 -7
  67. package/api/integration/pack-check.test.mjs +266 -47
  68. package/api/integration/summarizeIssues.doc.mjs +1 -0
  69. package/api/integration/validate-integration-fixes.test.mjs +1389 -0
  70. package/api/integration/validate-integration.mjs +52 -102
  71. package/api/integration/validate-integration.test.mjs +176 -23
  72. package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
  73. package/api/integration/validateIntegration.doc.mjs +2 -1
  74. package/api/json/assertResponse.doc.mjs +1 -0
  75. package/api/json/envelope-types.test.mjs +76 -0
  76. package/api/json/isError.doc.mjs +1 -0
  77. package/api/json/parseResponse.doc.mjs +3 -2
  78. package/api/layout/expand/expand.mjs +7 -5
  79. package/api/layout/expand/expand.path-safety.test.mjs +53 -0
  80. package/api/layout/grammar/grammar.mjs +2 -1
  81. package/api/layout/layoutCheck.doc.mjs +1 -0
  82. package/api/layout/layoutExpand.doc.mjs +2 -1
  83. package/api/layout/layoutGrammar.doc.mjs +1 -0
  84. package/api/search/search-return-type.test.mjs +54 -0
  85. package/api/search/search.d.mts +2 -9
  86. package/api/search/search.doc.mjs +6 -1
  87. package/api/search/search.mjs +31 -14
  88. package/api/search/search.test.mjs +34 -0
  89. package/api/search/search.type.d.mts +1 -1
  90. package/api/search/search.type.mjs +1 -1
  91. package/api/swizzle/copy/copy.mjs +28 -11
  92. package/api/swizzle/swizzle.doc.mjs +2 -1
  93. package/api/swizzle/swizzle.type.d.mts +2 -2
  94. package/api/swizzle/swizzle.type.mjs +2 -2
  95. package/api/template/copy/copy.mjs +17 -23
  96. package/api/template/copy/copy.test.mjs +17 -0
  97. package/api/template/template-suffix.test.mjs +41 -21
  98. package/api/template/template.doc.mjs +3 -1
  99. package/api/template/template.type.d.mts +5 -5
  100. package/api/template/template.type.mjs +12 -12
  101. package/api/theme/_adapter.d.mts +2 -3
  102. package/api/theme/_adapter.mjs +4 -5
  103. package/api/theme/add/add.binary.test.mjs +84 -0
  104. package/api/theme/add/add.mjs +20 -3
  105. package/api/theme/add/add.staging.test.mjs +66 -0
  106. package/api/theme/add/add.test.mjs +14 -1
  107. package/api/theme/build/build.mjs +133 -42
  108. package/api/theme/build/build.public-component-vars.test.mjs +1 -1
  109. package/api/theme/build/build.receipt-doc.test.mjs +111 -0
  110. package/api/theme/build/build.test.mjs +127 -0
  111. package/api/theme/build/font-warning.mjs +3 -3
  112. package/api/theme/build/font-warning.test.mjs +5 -2
  113. package/api/theme/generateTonalPalette.doc.mjs +1 -0
  114. package/api/theme/integration-themes.test.mjs +39 -28
  115. package/api/theme/list/list.test.mjs +19 -20
  116. package/api/theme/listThemes.doc.mjs +6 -5
  117. package/api/theme/palette/generate/generate.mjs +8 -3
  118. package/api/theme/palette/generate/generate.test.mjs +96 -0
  119. package/api/theme/palette/generate/generator.d.mts +10 -13
  120. package/api/theme/palette/generate/generator.mjs +15 -4
  121. package/api/theme/palette/generate/generator.test.mjs +10 -0
  122. package/api/theme/template/template.mjs +11 -2
  123. package/api/theme/template/template.test.mjs +15 -0
  124. package/api/theme/theme.type.d.mts +170 -11
  125. package/api/theme/theme.type.mjs +94 -27
  126. package/api/theme/themeAdd.doc.mjs +4 -3
  127. package/api/theme/themeBuild.doc.mjs +8 -4
  128. package/api/theme/themeList.doc.mjs +6 -3
  129. package/api/theme/themeListAvailable.doc.mjs +5 -3
  130. package/api/theme/themePaletteGenerate.doc.mjs +1 -0
  131. package/api/theme/themeTargets.doc.mjs +1 -0
  132. package/api/theme/themeTemplate.doc.mjs +5 -1
  133. package/api/upgrade/_adapter.d.mts +12 -3
  134. package/api/upgrade/_adapter.mjs +108 -70
  135. package/api/upgrade/list/list.mjs +2 -1
  136. package/api/upgrade/list/list.test.mjs +73 -0
  137. package/api/upgrade/provider-agreement.test.mjs +152 -0
  138. package/api/upgrade/run/run.mjs +1 -0
  139. package/api/upgrade/status/status.mjs +2 -2
  140. package/api/upgrade/upgrade.doc.mjs +3 -1
  141. package/api/upgrade/upgrade.type.d.mts +8 -4
  142. package/api/upgrade/upgrade.type.mjs +11 -10
  143. package/assets/codemods/integration-discovery.mjs +48 -4
  144. package/assets/codemods/integration-discovery.test.mjs +73 -0
  145. package/assets/codemods/runner.mjs +115 -5
  146. package/assets/codemods/term-log.mjs +32 -8
  147. package/assets/codemods/term-log.test.mjs +19 -1
  148. package/assets/codemods/transform-prop.mjs +109 -0
  149. package/assets/codemods/transform-prop.test.mjs +95 -0
  150. package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +216 -0
  151. package/assets/codemods/transforms/next/index.mjs +11 -1
  152. package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
  153. package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
  154. package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
  155. package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
  156. package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
  157. package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
  158. package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
  159. package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
  160. package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
  161. package/assets/docs/cli-integrations.doc.mjs +26 -30
  162. package/assets/docs/cli.doc.mjs +15 -0
  163. package/assets/docs/styling-libraries.doc.mjs +1 -1
  164. package/assets/docs/theme.doc.mjs +1 -1
  165. package/assets/docs/working-with-ai.doc.mjs +1 -1
  166. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
  167. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
  168. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
  169. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
  170. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
  171. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
  172. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
  173. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
  174. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
  175. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
  176. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
  177. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
  178. package/assets/templates/pages/table-tree/page.tsx +1704 -0
  179. package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
  180. package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
  181. package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
  182. package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
  183. package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
  184. package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
  185. package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
  186. package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
  187. package/authoring/_shared/contract.ts +22 -0
  188. package/authoring/codemod/codemod.doc.mjs +7 -2
  189. package/authoring/codemod/parse.d.mts +8 -8
  190. package/authoring/codemod/parse.mjs +8 -6
  191. package/authoring/config/config.doc.mjs +2 -2
  192. package/authoring/config/debug-composition.test.mjs +92 -0
  193. package/authoring/config/parse.d.mts +13 -13
  194. package/authoring/config/parse.mjs +8 -8
  195. package/authoring/config/type.ts +18 -6
  196. package/authoring/debug/debug.doc.d.mts +11 -0
  197. package/authoring/debug/debug.doc.mjs +182 -0
  198. package/authoring/debug/parse.d.mts +4 -4
  199. package/authoring/debug/parse.mjs +3 -3
  200. package/authoring/doctypes/_schema.d.mts +121 -11
  201. package/authoring/doctypes/_schema.mjs +144 -13
  202. package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
  203. package/authoring/doctypes/base/type.ts +8 -4
  204. package/authoring/doctypes/command/command.doc.mjs +4 -3
  205. package/authoring/doctypes/command/parse.d.mts +2 -2
  206. package/authoring/doctypes/command/parse.mjs +1 -1
  207. package/authoring/doctypes/command/type.ts +3 -3
  208. package/authoring/doctypes/component/component.doc.mjs +5 -2
  209. package/authoring/doctypes/component/parse.d.mts +2 -2
  210. package/authoring/doctypes/component/parse.mjs +1 -1
  211. package/authoring/doctypes/component/type.ts +3 -3
  212. package/authoring/doctypes/doctypes-new.test.mjs +48 -6
  213. package/authoring/doctypes/enum/enum.doc.mjs +1 -1
  214. package/authoring/doctypes/enum/parse.d.mts +2 -2
  215. package/authoring/doctypes/enum/parse.mjs +1 -1
  216. package/authoring/doctypes/enum/type.ts +2 -2
  217. package/authoring/doctypes/function/function.doc.mjs +5 -1
  218. package/authoring/doctypes/function/parse.d.mts +2 -2
  219. package/authoring/doctypes/function/parse.mjs +1 -1
  220. package/authoring/doctypes/function/type.ts +2 -2
  221. package/authoring/doctypes/hook/hook.doc.mjs +4 -0
  222. package/authoring/doctypes/hook/parse.d.mts +2 -2
  223. package/authoring/doctypes/hook/parse.mjs +1 -1
  224. package/authoring/doctypes/hook/type.ts +3 -3
  225. package/authoring/doctypes/legacy.d.mts +6 -6
  226. package/authoring/doctypes/legacy.mjs +3 -3
  227. package/authoring/doctypes/load-contract.test.mjs +208 -0
  228. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
  229. package/authoring/doctypes/namespace/parse.d.mts +2 -2
  230. package/authoring/doctypes/namespace/parse.mjs +1 -1
  231. package/authoring/doctypes/namespace/type.ts +2 -2
  232. package/authoring/doctypes/parse.d.mts +22 -20
  233. package/authoring/doctypes/parse.mjs +16 -12
  234. package/authoring/doctypes/reference/parse.d.mts +2 -2
  235. package/authoring/doctypes/reference/parse.mjs +1 -1
  236. package/authoring/doctypes/reference/reference.doc.mjs +7 -3
  237. package/authoring/doctypes/reference/type.ts +3 -3
  238. package/authoring/doctypes/schema/parse.d.mts +2 -2
  239. package/authoring/doctypes/schema/parse.mjs +1 -1
  240. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  241. package/authoring/doctypes/schema/type.ts +3 -4
  242. package/authoring/doctypes/template/parse.d.mts +92 -1
  243. package/authoring/doctypes/template/parse.mjs +33 -1
  244. package/authoring/doctypes/template/template.doc.mjs +7 -3
  245. package/authoring/doctypes/template/type.ts +4 -1
  246. package/authoring/doctypes/theme/parse.d.mts +35 -0
  247. package/authoring/doctypes/theme/parse.mjs +76 -0
  248. package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
  249. package/authoring/doctypes/theme/theme.doc.mjs +79 -0
  250. package/authoring/doctypes/theme/type.ts +42 -0
  251. package/authoring/doctypes/types.ts +12 -11
  252. package/authoring/gap-report/gap-report.doc.d.mts +12 -0
  253. package/authoring/gap-report/gap-report.doc.mjs +183 -0
  254. package/authoring/gap-report/parse.d.mts +9 -9
  255. package/authoring/gap-report/parse.mjs +6 -6
  256. package/authoring/gap-report/type.ts +1 -1
  257. package/authoring/identity/identity.doc.mjs +3 -2
  258. package/authoring/identity/type.ts +10 -10
  259. package/authoring/index.d.mts +1 -0
  260. package/authoring/index.d.ts +21 -19
  261. package/authoring/index.mjs +2 -1
  262. package/authoring/integration/integration.doc.mjs +2 -2
  263. package/authoring/integration/parse.d.mts +2 -2
  264. package/authoring/integration/parse.mjs +1 -1
  265. package/authoring/integration/schema.d.mts +4 -4
  266. package/authoring/integration/schema.mjs +3 -3
  267. package/authoring/integration/type.ts +4 -10
  268. package/clients/cli/__tests__/cliManifest.test.ts +27 -29
  269. package/clients/cli/command-load-failure.test.mjs +83 -0
  270. package/clients/cli/commands/blog.doc.mjs +1 -1
  271. package/clients/cli/commands/blog.mjs +23 -8
  272. package/clients/cli/commands/blog.test.mjs +42 -1
  273. package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
  274. package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
  275. package/clients/cli/commands/build-theme.mjs +5 -5
  276. package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
  277. package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
  278. package/clients/cli/commands/build.doc.mjs +5 -2
  279. package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
  280. package/clients/cli/commands/build.mjs +32 -47
  281. package/clients/cli/commands/build.playbook.test.mjs +75 -0
  282. package/clients/cli/commands/build.text-fields.test.mjs +40 -0
  283. package/clients/cli/commands/component/index.mjs +2 -7
  284. package/clients/cli/commands/component-package.test.mjs +46 -0
  285. package/clients/cli/commands/component-resolution.test.mjs +21 -0
  286. package/clients/cli/commands/component.doc.mjs +1 -1
  287. package/clients/cli/commands/component.test.mjs +19 -0
  288. package/clients/cli/commands/detail-levels.test.mjs +2 -2
  289. package/clients/cli/commands/discover.broken-integration.test.mjs +48 -0
  290. package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
  291. package/clients/cli/commands/discover.doc.mjs +5 -3
  292. package/clients/cli/commands/discover.mjs +3 -3
  293. package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
  294. package/clients/cli/commands/docs.doc.mjs +1 -1
  295. package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
  296. package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
  297. package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
  298. package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
  299. package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
  300. package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
  301. package/clients/cli/commands/doctor-integration.test.mjs +15 -7
  302. package/clients/cli/commands/doctor.doc.mjs +1 -1
  303. package/clients/cli/commands/doctor.mjs +6 -16
  304. package/clients/cli/commands/doctor.test.mjs +42 -0
  305. package/clients/cli/commands/gap-report.doc.mjs +17 -6
  306. package/clients/cli/commands/gap-report.test.mjs +72 -0
  307. package/clients/cli/commands/hook/index.mjs +7 -17
  308. package/clients/cli/commands/hook.doc.mjs +1 -1
  309. package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
  310. package/clients/cli/commands/init.doc.mjs +20 -9
  311. package/clients/cli/commands/init.flag-help.test.mjs +153 -0
  312. package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
  313. package/clients/cli/commands/integration-add.doc.mjs +22 -6
  314. package/clients/cli/commands/integration-authoring.test.mjs +13 -9
  315. package/clients/cli/commands/integration-pack.doc.mjs +1 -1
  316. package/clients/cli/commands/integration-real-world.test.mjs +3 -9
  317. package/clients/cli/commands/integration.doc.mjs +1 -1
  318. package/clients/cli/commands/interactive-guard.test.mjs +101 -24
  319. package/clients/cli/commands/json-contract.test.mjs +33 -0
  320. package/clients/cli/commands/layout-check.doc.mjs +15 -4
  321. package/clients/cli/commands/layout-expand.doc.mjs +22 -5
  322. package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
  323. package/clients/cli/commands/layout.doc.mjs +3 -3
  324. package/clients/cli/commands/layout.mjs +21 -9
  325. package/clients/cli/commands/layout.path-help.test.mjs +33 -0
  326. package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
  327. package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
  328. package/clients/cli/commands/manifest.doc.mjs +1 -1
  329. package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
  330. package/clients/cli/commands/search.doc.mjs +7 -4
  331. package/clients/cli/commands/search.mjs +17 -7
  332. package/clients/cli/commands/search.test.mjs +75 -0
  333. package/clients/cli/commands/swizzle.doc.mjs +3 -2
  334. package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
  335. package/clients/cli/commands/template.doc.mjs +29 -7
  336. package/clients/cli/commands/template.flag-help.test.mjs +117 -0
  337. package/clients/cli/commands/template.path-help.test.mjs +40 -0
  338. package/clients/cli/commands/theme-add.doc.mjs +4 -3
  339. package/clients/cli/commands/theme-build.doc.mjs +8 -7
  340. package/clients/cli/commands/theme-list.doc.mjs +2 -2
  341. package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
  342. package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
  343. package/clients/cli/commands/theme-palette.doc.mjs +1 -1
  344. package/clients/cli/commands/theme-targets.doc.mjs +1 -1
  345. package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
  346. package/clients/cli/commands/theme-template.doc.mjs +2 -2
  347. package/clients/cli/commands/theme.doc.mjs +1 -1
  348. package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
  349. package/clients/cli/commands/upgrade.doc.mjs +18 -7
  350. package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
  351. package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
  352. package/clients/cli/index.mjs +13 -30
  353. package/clients/cli/latest-version-env.test.mjs +50 -0
  354. package/clients/cli/lib/cli-error.test.mjs +7 -0
  355. package/clients/cli/lib/component-format.mjs +9 -9
  356. package/clients/cli/lib/component-format.test.mjs +1 -1
  357. package/clients/cli/lib/define-command.mjs +32 -6
  358. package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
  359. package/clients/cli/lib/exit-codes.test.mjs +97 -0
  360. package/clients/cli/lib/hook-format.mjs +19 -10
  361. package/clients/cli/lib/json-shim.mjs +38 -2
  362. package/clients/cli/lib/json-shim.test.mjs +83 -0
  363. package/clients/cli/lib/manifest.d.ts +2 -0
  364. package/clients/cli/lib/manifest.mjs +22 -0
  365. package/clients/cli/lib/manifest.test.mjs +17 -0
  366. package/foundation/agent-docs/agent-docs.d.mts +4 -0
  367. package/foundation/agent-docs/agent-docs.mjs +69 -3
  368. package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
  369. package/foundation/config/integration-debug.test.mjs +28 -3
  370. package/foundation/config/project-themes.test.mjs +11 -19
  371. package/foundation/config/project.d.mts +8 -0
  372. package/foundation/config/project.mjs +173 -30
  373. package/foundation/config/project.test.mjs +129 -16
  374. package/foundation/discovery/authoring-self-docs.d.mts +6 -0
  375. package/foundation/discovery/authoring-self-docs.mjs +17 -7
  376. package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
  377. package/foundation/discovery/authoring-surface.d.mts +74 -0
  378. package/foundation/discovery/authoring-surface.mjs +525 -0
  379. package/foundation/discovery/authoring-surface.test.mjs +392 -0
  380. package/foundation/discovery/cli-self-docs.d.mts +113 -0
  381. package/foundation/discovery/cli-self-docs.mjs +514 -0
  382. package/foundation/discovery/cli-self-docs.test.mjs +437 -0
  383. package/foundation/discovery/component-loader.d.mts +35 -38
  384. package/foundation/discovery/component-loader.mjs +53 -222
  385. package/foundation/discovery/docs-discovery.d.mts +7 -2
  386. package/foundation/discovery/docs-discovery.mjs +24 -14
  387. package/foundation/discovery/docs-discovery.test.mjs +55 -16
  388. package/foundation/discovery/template-adapter.d.mts +21 -5
  389. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
  390. package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
  391. package/foundation/discovery/template-adapter.mjs +319 -65
  392. package/foundation/discovery/template-adapter.test.mjs +15 -0
  393. package/foundation/discovery/theme-discovery.d.mts +67 -7
  394. package/foundation/discovery/theme-discovery.mjs +916 -186
  395. package/foundation/discovery/theme-discovery.test.mjs +613 -219
  396. package/foundation/discovery/theming-targets.test.mjs +4 -0
  397. package/foundation/doc-compiler/bundle.d.mts +47 -0
  398. package/foundation/doc-compiler/bundle.mjs +218 -0
  399. package/foundation/doc-compiler/bundle.test.mjs +255 -0
  400. package/foundation/doc-compiler/compile.d.mts +362 -0
  401. package/foundation/doc-compiler/compile.mjs +511 -0
  402. package/foundation/doc-compiler/diagnostics.d.mts +126 -0
  403. package/foundation/doc-compiler/diagnostics.mjs +277 -0
  404. package/foundation/doc-compiler/doc-compiler.test.mjs +714 -0
  405. package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
  406. package/foundation/doc-compiler/import.d.mts +24 -0
  407. package/foundation/doc-compiler/import.mjs +59 -0
  408. package/foundation/doc-compiler/inputs.d.mts +102 -0
  409. package/foundation/doc-compiler/inputs.mjs +286 -0
  410. package/foundation/doc-compiler/inputs.test.mjs +299 -0
  411. package/foundation/doc-compiler/ir.d.mts +22 -0
  412. package/foundation/doc-compiler/ir.mjs +464 -0
  413. package/foundation/doc-compiler/lenses.d.mts +33 -0
  414. package/foundation/doc-compiler/lenses.mjs +127 -0
  415. package/foundation/doc-compiler/lower-doc.test.mjs +492 -0
  416. package/foundation/doc-compiler/overlays.d.mts +37 -0
  417. package/foundation/doc-compiler/overlays.mjs +206 -0
  418. package/foundation/doc-compiler/parse-readable.d.mts +9 -0
  419. package/foundation/doc-compiler/parse-readable.mjs +29 -0
  420. package/foundation/doc-compiler/read.d.mts +126 -0
  421. package/foundation/doc-compiler/read.mjs +320 -0
  422. package/foundation/doc-compiler/read.test.mjs +313 -0
  423. package/foundation/doc-compiler/source.d.mts +33 -0
  424. package/foundation/doc-compiler/source.mjs +128 -0
  425. package/foundation/fs/module-loader.d.mts +1 -0
  426. package/foundation/fs/module-loader.mjs +50 -1
  427. package/foundation/fs/module-loader.stdout.test.mjs +332 -0
  428. package/foundation/fs/path-safety.d.mts +3 -2
  429. package/foundation/fs/path-safety.mjs +49 -19
  430. package/foundation/fs/path-safety.test.mjs +50 -0
  431. package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
  432. package/foundation/integrations/autolink.d.mts +58 -1
  433. package/foundation/integrations/autolink.mjs +143 -52
  434. package/foundation/integrations/contribution-fixes.d.mts +145 -0
  435. package/foundation/integrations/contribution-fixes.mjs +1284 -0
  436. package/foundation/integrations/contribution-inventory.d.mts +1 -1
  437. package/foundation/integrations/contribution-inventory.mjs +17 -20
  438. package/foundation/integrations/contribution-inventory.test.mjs +67 -27
  439. package/foundation/integrations/integrations.d.mts +3 -0
  440. package/foundation/integrations/integrations.mjs +11 -97
  441. package/foundation/integrations/provider-ledger.test.mjs +275 -0
  442. package/foundation/integrations/provider-resolution.d.mts +152 -0
  443. package/foundation/integrations/provider-resolution.mjs +576 -0
  444. package/foundation/integrations/provider-resolution.test.mjs +369 -0
  445. package/foundation/integrations/theme-descriptor.d.mts +8 -0
  446. package/foundation/integrations/theme-descriptor.mjs +44 -0
  447. package/foundation/integrations/validate-contributions.mjs +104 -10
  448. package/foundation/response/base.d.ts +8 -4
  449. package/foundation/response/error-codes.doc.mjs +3 -4
  450. package/foundation/response/error-codes.mjs +2 -2
  451. package/foundation/response/error-codes.test.mjs +83 -0
  452. package/foundation/response/json-contract.test.mjs +11 -0
  453. package/foundation/response/json.d.mts +4 -2
  454. package/foundation/response/json.mjs +8 -10
  455. package/foundation/response/response-types.doc.mjs +11 -11
  456. package/foundation/response/response-types.doc.test.mjs +158 -0
  457. package/foundation/response/response.doc.mjs +1 -1
  458. package/foundation/text/string-utils.mjs +22 -10
  459. package/foundation/xle/expand.d.mts +2 -0
  460. package/foundation/xle/expand.mjs +3 -2
  461. package/foundation/xle/expand.test.mjs +54 -0
  462. package/package.json +9 -11
  463. package/assets/templates/themes/manifest.json +0 -95
  464. package/clients/cli/lib/update-check.mjs +0 -83
  465. package/clients/cli/lib/update-check.test.mjs +0 -137
  466. package/clients/cli/update-hint-commands.test.mjs +0 -54
@@ -0,0 +1,182 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file SchemaDoc for DebugEvent, the record of one CLI run.
5
+ * @input The DebugEvent type beside it (`type.ts`), which `parse.mjs` reads.
6
+ * @output The `debug-event` section of `astryx docs authoring`.
7
+ * @position packages/cli/authoring/debug — schema documentation
8
+ */
9
+
10
+ /** @type {import('@astryxdesign/cli/authoring').SchemaDoc} */
11
+ export const doc = {
12
+ type: 'schema',
13
+ name: 'debug-event',
14
+ displayName: 'DebugEvent',
15
+ namespace: 'authoring',
16
+ description:
17
+ 'One recorded CLI run: what a `debug` handler receives, whether it is set in astryx.config or exported by an integration manifest. There is exactly one event per run, and every field is present by the time a handler sees it.',
18
+ appliesTo: 'The argument of a `debug` handler',
19
+ fields: [
20
+ {
21
+ name: 'schemaVersion',
22
+ type: 'DebugSchemaVersion',
23
+ description:
24
+ 'Version of the recorded shape: 1, 2, or 3. A field that changes meaning gets a new version, so switch on this.',
25
+ required: true,
26
+ },
27
+ {
28
+ name: 'id',
29
+ type: 'string',
30
+ description: 'Unique per run. Deduplicate on it.',
31
+ required: true,
32
+ },
33
+ {
34
+ name: 'startedAt',
35
+ type: 'string',
36
+ description: 'When the run started, as ISO 8601.',
37
+ required: true,
38
+ },
39
+ {
40
+ name: 'endedAt',
41
+ type: 'string',
42
+ description: 'When the run ended, as ISO 8601.',
43
+ required: true,
44
+ },
45
+ {
46
+ name: 'durationMs',
47
+ type: 'number',
48
+ description: 'How long the run took, in milliseconds.',
49
+ required: true,
50
+ },
51
+ {
52
+ name: 'command',
53
+ type: 'string',
54
+ description:
55
+ 'The full command name. Empty when astryx ran without a command.',
56
+ required: true,
57
+ example: "'theme build'",
58
+ },
59
+ {
60
+ name: 'commandPath',
61
+ type: 'string[]',
62
+ description: 'The command name split into segments.',
63
+ required: true,
64
+ example: "['theme', 'build']",
65
+ },
66
+ {
67
+ name: 'argv',
68
+ type: 'string[]',
69
+ description: 'The arguments after the binary, scrubbed.',
70
+ required: true,
71
+ },
72
+ {
73
+ name: 'args',
74
+ type: 'Record<string, unknown>',
75
+ description: 'Positional arguments, keyed by their declared names.',
76
+ required: true,
77
+ },
78
+ {
79
+ name: 'options',
80
+ type: 'Record<string, unknown>',
81
+ description: 'The command options, as the CLI resolved them.',
82
+ required: true,
83
+ },
84
+ {
85
+ name: 'optionSources',
86
+ type: 'Record<string, DebugOptionSource>',
87
+ description:
88
+ "Where each option value came from: 'cli', 'default', 'env', 'config', or 'implied'. The keys match `options`.",
89
+ required: true,
90
+ },
91
+ {
92
+ name: 'globalOptions',
93
+ type: 'Record<string, unknown>',
94
+ description: 'The root flags, such as --json, --detail, and --lang.',
95
+ required: true,
96
+ },
97
+ {
98
+ name: 'outcome',
99
+ type: 'DebugOutcome',
100
+ description:
101
+ "How the run ended: 'ok', 'error', 'parse-error', 'fatal', 'rejected', or 'incomplete'.",
102
+ required: true,
103
+ },
104
+ {
105
+ name: 'exitCode',
106
+ type: 'number',
107
+ description:
108
+ 'The process exit code. When a signal ended the run, 128 plus the signal number.',
109
+ required: true,
110
+ },
111
+ {
112
+ name: 'signal',
113
+ type: 'string',
114
+ description:
115
+ "The signal that ended the run, such as 'SIGINT'. Null otherwise.",
116
+ required: true,
117
+ },
118
+ {
119
+ name: 'error',
120
+ type: 'DebugEventError',
121
+ description:
122
+ 'The failure: `name`, `message`, `code`, and `stack`. Branch on `code`, never on `message`. Null when nothing failed.',
123
+ required: true,
124
+ },
125
+ {
126
+ name: 'output',
127
+ type: 'DebugEventOutput',
128
+ description:
129
+ 'What the run answered with: JSON mode, the envelope types, the result count and kind, and the stdout and stderr it printed, scrubbed and cut at the capture limit.',
130
+ required: true,
131
+ },
132
+ {
133
+ name: 'env',
134
+ type: 'DebugEventEnv',
135
+ description:
136
+ 'Runtime facts: the CLI and Node versions, platform, CI, package manager, and whether a person, an AI agent, or automation ran the command. It never holds a hostname, a user name, or a raw session ID.',
137
+ required: true,
138
+ },
139
+ {
140
+ name: 'project',
141
+ type: 'DebugEventProject',
142
+ description:
143
+ 'The project the command ran in, as flags and counts. It never holds package names.',
144
+ required: true,
145
+ },
146
+ {
147
+ name: 'redacted',
148
+ type: 'boolean',
149
+ description:
150
+ 'Whether the values in the record were scrubbed. It is true on every event a handler receives. When it is false, treat the log as sensitive.',
151
+ required: true,
152
+ },
153
+ ],
154
+ examples: [
155
+ {
156
+ label: 'Keep a local log of the runs that failed',
157
+ code:
158
+ "import {appendFileSync} from 'node:fs';\n\n" +
159
+ 'export default {\n' +
160
+ ' debug: event => {\n' +
161
+ " if (event.outcome !== 'ok') {\n" +
162
+ " appendFileSync('failed-runs.ndjson', JSON.stringify(event) + '\\n');\n" +
163
+ ' }\n' +
164
+ ' },\n' +
165
+ '};',
166
+ },
167
+ ],
168
+ notes: [
169
+ {
170
+ type: 'prose',
171
+ text: 'The shape only grows: fields are added, never removed or given a new meaning. When a meaning must change, `schemaVersion` gets a new value. In version 3, a null `output.resultKind` means the run never reached an answer, so do not count it together with a version 1 or 2 null.',
172
+ },
173
+ {
174
+ type: 'prose',
175
+ text: 'The handler runs synchronously as the process exits, so a promise it returns is never awaited. It gets a copy of the event, and anything it throws is ignored.',
176
+ },
177
+ {
178
+ type: 'prose',
179
+ text: 'Import DebugEventOutput, DebugEventEnv, DebugEventProject, and DebugEventError from @astryxdesign/cli/authoring for the fields of `output`, `env`, `project`, and `error`.',
180
+ },
181
+ ],
182
+ };
@@ -7,8 +7,8 @@
7
7
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck —
8
8
  * so a field added to the recorder without being published here breaks CI.
9
9
  *
10
- * @typedef {import('../_shared/contract').Expect<
11
- * import('../_shared/contract').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
10
+ * @typedef {import('../_shared/contract.js').Expect<
11
+ * import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
12
12
  * >} _DebugEventDriftLock
13
13
  */
14
14
  /**
@@ -29,8 +29,8 @@ export function parseDebugEvent(input: unknown, label?: string): DebugEvent;
29
29
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck —
30
30
  * so a field added to the recorder without being published here breaks CI.
31
31
  */
32
- export type _DebugEventDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>>;
33
- export type DebugEvent = import("./type").DebugEvent;
32
+ export type _DebugEventDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>>;
33
+ export type DebugEvent = import("./type.js").DebugEvent;
34
34
  import { z } from 'zod';
35
35
  declare const eventSchema: z.ZodObject<{
36
36
  schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
@@ -22,7 +22,7 @@
22
22
  import {z} from 'zod';
23
23
  import {formatZodError} from '../_shared/errors.mjs';
24
24
 
25
- /** @typedef {import('./type').DebugEvent} DebugEvent */
25
+ /** @typedef {import('./type.js').DebugEvent} DebugEvent */
26
26
 
27
27
  const outcomeSchema = z.enum([
28
28
  'ok',
@@ -169,8 +169,8 @@ const eventSchema = z
169
169
  * `Expect<false>` fails the `tsconfig.authoring-contract.json` typecheck —
170
170
  * so a field added to the recorder without being published here breaks CI.
171
171
  *
172
- * @typedef {import('../_shared/contract').Expect<
173
- * import('../_shared/contract').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
172
+ * @typedef {import('../_shared/contract.js').Expect<
173
+ * import('../_shared/contract.js').MutuallyAssignable<z.infer<typeof eventSchema>, DebugEvent>
174
174
  * >} _DebugEventDriftLock
175
175
  */
176
176
 
@@ -91,7 +91,12 @@ export const ReferenceContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
91
  full: "full";
92
92
  }>>;
93
93
  }, z.core.$strict>], "type">;
94
- /** New-format stamped component doc (`type: 'component'`). */
94
+ /**
95
+ * New-format stamped component doc (`type: 'component'`): one component's
96
+ * `props`, or the `components` a group doc documents together. These are the
97
+ * shapes the published ComponentDoc type allows, and the ones an unstamped doc
98
+ * may already take.
99
+ */
95
100
  export const ComponentDocKindSchema: z.ZodObject<{
96
101
  type: z.ZodLiteral<"component">;
97
102
  theming: z.ZodOptional<z.ZodUnknown>;
@@ -119,13 +124,16 @@ export const ComponentDocKindSchema: z.ZodObject<{
119
124
  public: "public";
120
125
  internal: "internal";
121
126
  }>>;
122
- props: z.ZodArray<z.ZodObject<{
127
+ props: z.ZodOptional<z.ZodArray<z.ZodObject<{
123
128
  name: z.ZodString;
124
129
  type: z.ZodString;
125
130
  description: z.ZodString;
126
131
  default: z.ZodOptional<z.ZodString>;
127
132
  required: z.ZodOptional<z.ZodBoolean>;
128
- }, z.core.$loose>>;
133
+ }, z.core.$loose>>>;
134
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
135
+ name: z.ZodString;
136
+ }, z.core.$loose>>>;
129
137
  }, z.core.$loose>;
130
138
  /** New-format stamped function doc (`type: 'function'`). */
131
139
  export const FunctionDocKindSchema: z.ZodObject<{
@@ -165,6 +173,26 @@ export const FunctionDocKindSchema: z.ZodObject<{
165
173
  internal: "internal";
166
174
  }>>;
167
175
  }, z.core.$loose>;
176
+ /**
177
+ * A stamped function doc as it loads: as with components, `displayName` may be
178
+ * missing and `usage` passes through unchecked.
179
+ *
180
+ * @typedef {Omit<FunctionDoc, 'type' | 'displayName' | 'usage'>
181
+ * & {type: 'function', displayName?: string, usage?: unknown}} LoadedFunctionDoc
182
+ */
183
+ /**
184
+ * @typedef {import('../_shared/contract.js').Expect<
185
+ * import('../_shared/contract.js').MutuallyAssignable<
186
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof FunctionDocKindSchema>>,
187
+ * import('../_shared/contract.js').NamedFields<LoadedFunctionDoc>
188
+ * >
189
+ * >} _FunctionDocDriftLock
190
+ */
191
+ /**
192
+ * Every HookDoc is a FunctionDoc, so the one function schema covers both.
193
+ *
194
+ * @typedef {import('../_shared/contract.js').Expect<[HookDoc] extends [FunctionDoc] ? true : false>} _HookDocIsFunctionDocLock
195
+ */
168
196
  /**
169
197
  * Stamped generic reference/topic doc (`type: 'generic'`). `title` and
170
198
  * `sections` stay optional at this parser boundary for docs produced by the
@@ -289,7 +317,7 @@ export const SchemaDocKindSchema: z.ZodObject<{
289
317
  description: z.ZodString;
290
318
  namespace: z.ZodOptional<z.ZodString>;
291
319
  appliesTo: z.ZodOptional<z.ZodString>;
292
- fields: z.ZodArray<z.ZodType<import("./schema/type").SchemaFieldDoc, any, z.core.$ZodTypeInternals<import("./schema/type").SchemaFieldDoc, any>>>;
320
+ fields: z.ZodArray<z.ZodType<import("./schema/type.js").SchemaFieldDoc, any, z.core.$ZodTypeInternals<import("./schema/type.js").SchemaFieldDoc, any>>>;
293
321
  examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
294
322
  label: z.ZodOptional<z.ZodString>;
295
323
  code: z.ZodString;
@@ -370,6 +398,14 @@ export const SchemaDocKindSchema: z.ZodObject<{
370
398
  internal: "internal";
371
399
  }>>;
372
400
  }, z.core.$loose>;
401
+ /**
402
+ * @typedef {import('../_shared/contract.js').Expect<
403
+ * import('../_shared/contract.js').MutuallyAssignable<
404
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof SchemaDocKindSchema>>,
405
+ * import('../_shared/contract.js').NamedFields<SchemaDoc & {type: 'schema'}>
406
+ * >
407
+ * >} _SchemaDocDriftLock
408
+ */
373
409
  /** New stamped command doc (`type: 'command'`). */
374
410
  export const CommandDocKindSchema: z.ZodObject<{
375
411
  type: z.ZodLiteral<"command">;
@@ -481,6 +517,14 @@ export const CommandDocKindSchema: z.ZodObject<{
481
517
  internal: "internal";
482
518
  }>>;
483
519
  }, z.core.$loose>;
520
+ /**
521
+ * @typedef {import('../_shared/contract.js').Expect<
522
+ * import('../_shared/contract.js').MutuallyAssignable<
523
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof CommandDocKindSchema>>,
524
+ * import('../_shared/contract.js').NamedFields<CommandDoc & {type: 'command'}>
525
+ * >
526
+ * >} _CommandDocDriftLock
527
+ */
484
528
  /** New stamped enum doc (`type: 'enum'`). */
485
529
  export const EnumDocKindSchema: z.ZodObject<{
486
530
  type: z.ZodLiteral<"enum">;
@@ -885,13 +929,79 @@ export const LegacyDocSchema: z.ZodUnion<readonly [z.ZodObject<{
885
929
  extends: z.ZodOptional<z.ZodString>;
886
930
  tokenCategory: z.ZodOptional<z.ZodString>;
887
931
  }, z.core.$loose>]>;
888
- export type AuthoredDocGraphFieldsType = import("./base/type").AuthoredDocGraphFields;
889
- export type AuthoredDocKind = import("./base/type").AuthoredDocKind;
890
- export type NamespaceDoc = import("./namespace/type").NamespaceDoc;
891
- export type ReferenceContentBlock = import("./reference/type").ReferenceContentBlock;
892
- export type _AuthoredDocGraphDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof _AuthoredDocGraphSchema>, AuthoredDocGraphFieldsType>>;
893
- export type _ReferenceContentBlockDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof ReferenceContentBlockSchema>, ReferenceContentBlock>>;
894
- export type _NamespaceDocDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").Equal<z.infer<typeof NamespaceDocKindSchema>, NamespaceDoc>>;
932
+ export type AuthoredDocGraphFieldsType = import("./base/type.js").AuthoredDocGraphFields;
933
+ export type AuthoredDocKind = import("./base/type.js").AuthoredDocKind;
934
+ export type NamespaceDoc = import("./namespace/type.js").NamespaceDoc;
935
+ export type ReferenceContentBlock = import("./reference/type.js").ReferenceContentBlock;
936
+ export type ReferenceDoc = import("./reference/type.js").ReferenceDoc;
937
+ export type SingleComponentDoc = import("./component/type.js").SingleComponentDoc;
938
+ export type ComponentPropDoc = import("./base/type.js").ComponentPropDoc;
939
+ export type HookDoc = import("./hook/type.js").HookDoc;
940
+ export type FunctionDoc = import("./function/type.js").FunctionDoc;
941
+ export type SchemaDoc = import("./schema/type.js").SchemaDoc;
942
+ export type CommandDoc = import("./command/type.js").CommandDoc;
943
+ export type EnumDoc = import("./enum/type.js").EnumDoc;
944
+ export type _AuthoredDocKindDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof AuthoredDocKindSchema>, AuthoredDocKind>>;
945
+ export type _AuthoredDocGraphDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof _AuthoredDocGraphSchema>, AuthoredDocGraphFieldsType>>;
946
+ export type _ReferenceContentBlockDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof ReferenceContentBlockSchema>, ReferenceContentBlock>>;
947
+ /**
948
+ * A stamped component doc as it loads. The loader accepts what the unstamped
949
+ * format always accepted, so stamping an existing doc never breaks it:
950
+ * `displayName` may be missing, `category` is any string, `usage`, `theming`,
951
+ * `playground` and `examples` pass through unchecked, and a doc has `props`,
952
+ * `components`, or both; each `components` entry needs only a `name`. Every
953
+ * other field matches the published type.
954
+ */
955
+ export type LoadedComponentDoc = Omit<SingleComponentDoc, "type" | "displayName" | "category" | "usage" | "theming" | "examples" | "playground" | "props"> & {
956
+ type: "component";
957
+ displayName?: string;
958
+ category?: string;
959
+ usage?: unknown;
960
+ theming?: unknown;
961
+ examples?: unknown[];
962
+ playground?: unknown;
963
+ props?: ComponentPropDoc[];
964
+ components?: Array<{
965
+ name: string;
966
+ }>;
967
+ };
968
+ export type _ComponentDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof ComponentDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedComponentDoc>>>;
969
+ /**
970
+ * A stamped function doc as it loads: as with components, `displayName` may be
971
+ * missing and `usage` passes through unchecked.
972
+ */
973
+ export type LoadedFunctionDoc = Omit<FunctionDoc, "type" | "displayName" | "usage"> & {
974
+ type: "function";
975
+ displayName?: string;
976
+ usage?: unknown;
977
+ };
978
+ export type _FunctionDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof FunctionDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedFunctionDoc>>>;
979
+ /**
980
+ * Every HookDoc is a FunctionDoc, so the one function schema covers both.
981
+ */
982
+ export type _HookDocIsFunctionDocLock = import("../_shared/contract.js").Expect<[HookDoc] extends [FunctionDoc] ? true : false>;
983
+ /**
984
+ * A stamped generic doc as the load check accepts it. `title`, `description`
985
+ * and `sections` may be missing, as in docs the v0.3.0 factory-removal codemod
986
+ * produced; `parseReference` then fills them (title from `displayName` or
987
+ * `name`, an empty description, no sections), so its result is a full
988
+ * ReferenceDoc. Only a doc with a description and sections is a usable topic
989
+ * (see `problemsInTopic`).
990
+ */
991
+ export type LoadedReferenceDoc = Omit<ReferenceDoc, "type" | "title" | "description" | "sections"> & {
992
+ type: "generic";
993
+ } & Partial<Pick<ReferenceDoc, "title" | "description" | "sections">>;
994
+ export type _ReferenceDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof GenericDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedReferenceDoc>>>;
995
+ export type _SchemaDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof SchemaDocKindSchema>>, import("../_shared/contract.js").NamedFields<SchemaDoc & {
996
+ type: "schema";
997
+ }>>>;
998
+ export type _CommandDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof CommandDocKindSchema>>, import("../_shared/contract.js").NamedFields<CommandDoc & {
999
+ type: "command";
1000
+ }>>>;
1001
+ export type _EnumDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof EnumDocKindSchema>>, import("../_shared/contract.js").NamedFields<EnumDoc & {
1002
+ type: "enum";
1003
+ }>>>;
1004
+ export type _NamespaceDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof NamespaceDocKindSchema>, NamespaceDoc>>;
895
1005
  import { z } from 'zod';
896
1006
  declare const _AuthoredDocGraphSchema: z.ZodObject<{
897
1007
  placement: z.ZodOptional<z.ZodObject<{
@@ -11,10 +11,18 @@
11
11
 
12
12
  import {z} from 'zod';
13
13
 
14
- /** @typedef {import('./base/type').AuthoredDocGraphFields} AuthoredDocGraphFieldsType */
15
- /** @typedef {import('./base/type').AuthoredDocKind} AuthoredDocKind */
16
- /** @typedef {import('./namespace/type').NamespaceDoc} NamespaceDoc */
17
- /** @typedef {import('./reference/type').ReferenceContentBlock} ReferenceContentBlock */
14
+ /** @typedef {import('./base/type.js').AuthoredDocGraphFields} AuthoredDocGraphFieldsType */
15
+ /** @typedef {import('./base/type.js').AuthoredDocKind} AuthoredDocKind */
16
+ /** @typedef {import('./namespace/type.js').NamespaceDoc} NamespaceDoc */
17
+ /** @typedef {import('./reference/type.js').ReferenceContentBlock} ReferenceContentBlock */
18
+ /** @typedef {import('./reference/type.js').ReferenceDoc} ReferenceDoc */
19
+ /** @typedef {import('./component/type.js').SingleComponentDoc} SingleComponentDoc */
20
+ /** @typedef {import('./base/type.js').ComponentPropDoc} ComponentPropDoc */
21
+ /** @typedef {import('./hook/type.js').HookDoc} HookDoc */
22
+ /** @typedef {import('./function/type.js').FunctionDoc} FunctionDoc */
23
+ /** @typedef {import('./schema/type.js').SchemaDoc} SchemaDoc */
24
+ /** @typedef {import('./command/type.js').CommandDoc} CommandDoc */
25
+ /** @typedef {import('./enum/type.js').EnumDoc} EnumDoc */
18
26
 
19
27
  const nonEmptyString = z.string().min(1);
20
28
 
@@ -31,6 +39,12 @@ export const AuthoredDocKindSchema = z.enum([
31
39
  'namespace',
32
40
  ]);
33
41
 
42
+ /**
43
+ * @typedef {import('../_shared/contract.js').Expect<
44
+ * import('../_shared/contract.js').Equal<z.infer<typeof AuthoredDocKindSchema>, AuthoredDocKind>
45
+ * >} _AuthoredDocKindDriftLock
46
+ */
47
+
34
48
  /** Shared optional graph fields for every authored doc kind. */
35
49
  export const AuthoredDocGraphFields = {
36
50
  placement: z
@@ -48,8 +62,8 @@ export const AuthoredDocGraphFields = {
48
62
  const _AuthoredDocGraphSchema = z.object(AuthoredDocGraphFields).strict();
49
63
 
50
64
  /**
51
- * @typedef {import('../_shared/contract').Expect<
52
- * import('../_shared/contract').MutuallyAssignable<
65
+ * @typedef {import('../_shared/contract.js').Expect<
66
+ * import('../_shared/contract.js').MutuallyAssignable<
53
67
  * z.infer<typeof _AuthoredDocGraphSchema>,
54
68
  * AuthoredDocGraphFieldsType
55
69
  * >
@@ -161,8 +175,8 @@ export const ReferenceContentBlockSchema = z.discriminatedUnion('type', [
161
175
  ]);
162
176
 
163
177
  /**
164
- * @typedef {import('../_shared/contract').Expect<
165
- * import('../_shared/contract').Equal<
178
+ * @typedef {import('../_shared/contract.js').Expect<
179
+ * import('../_shared/contract.js').Equal<
166
180
  * z.infer<typeof ReferenceContentBlockSchema>,
167
181
  * ReferenceContentBlock
168
182
  * >
@@ -245,11 +259,58 @@ const ComponentBaseSchema = z
245
259
  })
246
260
  .passthrough();
247
261
 
248
- /** New-format stamped component doc (`type: 'component'`). */
262
+ /**
263
+ * One entry in a group doc's `components`: a full ComponentEntry or a
264
+ * name-only ComponentRef. Readers look every entry up by `name`, so that much
265
+ * is checked here; the rest passes through, as on an unstamped doc.
266
+ */
267
+ const ComponentGroupEntrySchema = z
268
+ .object({name: z.string().min(1, 'component name is required')})
269
+ .passthrough();
270
+
271
+ /**
272
+ * New-format stamped component doc (`type: 'component'`): one component's
273
+ * `props`, or the `components` a group doc documents together. These are the
274
+ * shapes the published ComponentDoc type allows, and the ones an unstamped doc
275
+ * may already take.
276
+ */
249
277
  export const ComponentDocKindSchema = ComponentBaseSchema.extend({
250
- props: z.array(PropSchema),
278
+ props: z.array(PropSchema).optional(),
279
+ components: z.array(ComponentGroupEntrySchema).optional(),
280
+ }).superRefine((doc, context) => {
281
+ if (doc.props == null && doc.components == null) {
282
+ context.addIssue({
283
+ code: 'custom',
284
+ path: ['props'],
285
+ message:
286
+ 'expected the props array, or `components` for a doc that groups several components',
287
+ });
288
+ }
251
289
  });
252
290
 
291
+ /**
292
+ * A stamped component doc as it loads. The loader accepts what the unstamped
293
+ * format always accepted, so stamping an existing doc never breaks it:
294
+ * `displayName` may be missing, `category` is any string, `usage`, `theming`,
295
+ * `playground` and `examples` pass through unchecked, and a doc has `props`,
296
+ * `components`, or both; each `components` entry needs only a `name`. Every
297
+ * other field matches the published type.
298
+ *
299
+ * @typedef {Omit<SingleComponentDoc,
300
+ * 'type' | 'displayName' | 'category' | 'usage' | 'theming' | 'examples' | 'playground' | 'props'>
301
+ * & {type: 'component', displayName?: string, category?: string, usage?: unknown,
302
+ * theming?: unknown, examples?: unknown[], playground?: unknown,
303
+ * props?: ComponentPropDoc[], components?: Array<{name: string}>}} LoadedComponentDoc
304
+ */
305
+ /**
306
+ * @typedef {import('../_shared/contract.js').Expect<
307
+ * import('../_shared/contract.js').MutuallyAssignable<
308
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof ComponentDocKindSchema>>,
309
+ * import('../_shared/contract.js').NamedFields<LoadedComponentDoc>
310
+ * >
311
+ * >} _ComponentDocDriftLock
312
+ */
313
+
253
314
  /** Return entry for generalized function docs. */
254
315
  const FunctionReturnSchema = z
255
316
  .object({
@@ -269,6 +330,28 @@ export const FunctionDocKindSchema = z
269
330
  })
270
331
  .passthrough();
271
332
 
333
+ /**
334
+ * A stamped function doc as it loads: as with components, `displayName` may be
335
+ * missing and `usage` passes through unchecked.
336
+ *
337
+ * @typedef {Omit<FunctionDoc, 'type' | 'displayName' | 'usage'>
338
+ * & {type: 'function', displayName?: string, usage?: unknown}} LoadedFunctionDoc
339
+ */
340
+ /**
341
+ * @typedef {import('../_shared/contract.js').Expect<
342
+ * import('../_shared/contract.js').MutuallyAssignable<
343
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof FunctionDocKindSchema>>,
344
+ * import('../_shared/contract.js').NamedFields<LoadedFunctionDoc>
345
+ * >
346
+ * >} _FunctionDocDriftLock
347
+ */
348
+
349
+ /**
350
+ * Every HookDoc is a FunctionDoc, so the one function schema covers both.
351
+ *
352
+ * @typedef {import('../_shared/contract.js').Expect<[HookDoc] extends [FunctionDoc] ? true : false>} _HookDocIsFunctionDocLock
353
+ */
354
+
272
355
  /**
273
356
  * Stamped generic reference/topic doc (`type: 'generic'`). `title` and
274
357
  * `sections` stay optional at this parser boundary for docs produced by the
@@ -308,9 +391,30 @@ export const GenericDocKindSchema = z
308
391
  });
309
392
  });
310
393
 
394
+ /**
395
+ * A stamped generic doc as the load check accepts it. `title`, `description`
396
+ * and `sections` may be missing, as in docs the v0.3.0 factory-removal codemod
397
+ * produced; `parseReference` then fills them (title from `displayName` or
398
+ * `name`, an empty description, no sections), so its result is a full
399
+ * ReferenceDoc. Only a doc with a description and sections is a usable topic
400
+ * (see `problemsInTopic`).
401
+ *
402
+ * @typedef {Omit<ReferenceDoc, 'type' | 'title' | 'description' | 'sections'>
403
+ * & {type: 'generic'}
404
+ * & Partial<Pick<ReferenceDoc, 'title' | 'description' | 'sections'>>} LoadedReferenceDoc
405
+ */
406
+ /**
407
+ * @typedef {import('../_shared/contract.js').Expect<
408
+ * import('../_shared/contract.js').MutuallyAssignable<
409
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof GenericDocKindSchema>>,
410
+ * import('../_shared/contract.js').NamedFields<LoadedReferenceDoc>
411
+ * >
412
+ * >} _ReferenceDocDriftLock
413
+ */
414
+
311
415
  /** Recursive field descriptor for a SchemaDoc. */
312
416
  const SchemaFieldSchema =
313
- /** @type {import('zod').ZodType<import('./schema/type').SchemaFieldDoc>} */ (
417
+ /** @type {import('zod').ZodType<import('./schema/type.js').SchemaFieldDoc>} */ (
314
418
  z.lazy(() =>
315
419
  z
316
420
  .object({
@@ -351,6 +455,15 @@ export const SchemaDocKindSchema = z
351
455
  })
352
456
  .passthrough();
353
457
 
458
+ /**
459
+ * @typedef {import('../_shared/contract.js').Expect<
460
+ * import('../_shared/contract.js').MutuallyAssignable<
461
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof SchemaDocKindSchema>>,
462
+ * import('../_shared/contract.js').NamedFields<SchemaDoc & {type: 'schema'}>
463
+ * >
464
+ * >} _SchemaDocDriftLock
465
+ */
466
+
354
467
  /** New stamped command doc (`type: 'command'`). */
355
468
  export const CommandDocKindSchema = z
356
469
  .object({
@@ -411,6 +524,15 @@ export const CommandDocKindSchema = z
411
524
  })
412
525
  .passthrough();
413
526
 
527
+ /**
528
+ * @typedef {import('../_shared/contract.js').Expect<
529
+ * import('../_shared/contract.js').MutuallyAssignable<
530
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof CommandDocKindSchema>>,
531
+ * import('../_shared/contract.js').NamedFields<CommandDoc & {type: 'command'}>
532
+ * >
533
+ * >} _CommandDocDriftLock
534
+ */
535
+
414
536
  /** New stamped enum doc (`type: 'enum'`). */
415
537
  export const EnumDocKindSchema = z
416
538
  .object({
@@ -432,6 +554,15 @@ export const EnumDocKindSchema = z
432
554
  })
433
555
  .passthrough();
434
556
 
557
+ /**
558
+ * @typedef {import('../_shared/contract.js').Expect<
559
+ * import('../_shared/contract.js').MutuallyAssignable<
560
+ * import('../_shared/contract.js').NamedFields<z.infer<typeof EnumDocKindSchema>>,
561
+ * import('../_shared/contract.js').NamedFields<EnumDoc & {type: 'enum'}>
562
+ * >
563
+ * >} _EnumDocDriftLock
564
+ */
565
+
435
566
  const NamespaceSlotSchema = z
436
567
  .object({
437
568
  title: nonEmptyString,
@@ -514,8 +645,8 @@ export const NamespaceDocKindSchema = z
514
645
  });
515
646
 
516
647
  /**
517
- * @typedef {import('../_shared/contract').Expect<
518
- * import('../_shared/contract').Equal<
648
+ * @typedef {import('../_shared/contract.js').Expect<
649
+ * import('../_shared/contract.js').Equal<
519
650
  * z.infer<typeof NamespaceDocKindSchema>,
520
651
  * NamespaceDoc
521
652
  * >