@astryxdesign/cli 0.6.3-canary.db4e378 → 0.6.3-canary.db52d98

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 (397) hide show
  1. package/README.md +38 -15
  2. package/api/blog/blog.doc.mjs +1 -0
  3. package/api/build/_adapter.d.mts +50 -0
  4. package/api/build/_adapter.mjs +60 -0
  5. package/api/build/build.doc.mjs +14 -7
  6. package/api/build/build.test.mjs +184 -6
  7. package/api/build/build.type.d.mts +57 -2
  8. package/api/build/build.type.mjs +30 -7
  9. package/api/build/help/help.d.mts +4 -0
  10. package/api/build/help/help.mjs +24 -11
  11. package/api/build/kit/kit.d.mts +4 -1
  12. package/api/build/kit/kit.mjs +165 -49
  13. package/api/build/kit/rank.d.mts +44 -0
  14. package/api/build/kit/rank.mjs +432 -0
  15. package/api/build/kit/rank.test.mjs +196 -0
  16. package/api/component/_adapter.d.mts +6 -12
  17. package/api/component/_adapter.mjs +20 -10
  18. package/api/component/component.doc.mjs +1 -0
  19. package/api/component/component.mjs +60 -12
  20. package/api/component/list/list.mjs +3 -2
  21. package/api/discover/discover.doc.mjs +1 -0
  22. package/api/docs/_adapter.d.mts +252 -34
  23. package/api/docs/_adapter.mjs +923 -132
  24. package/api/docs/detail/detail.mjs +11 -3
  25. package/api/docs/detail/section/section.mjs +24 -13
  26. package/api/docs/detail/section/section.test.mjs +15 -6
  27. package/api/docs/docs.d.mts +5 -3
  28. package/api/docs/docs.doc.mjs +39 -17
  29. package/api/docs/docs.mjs +44 -8
  30. package/api/docs/docs.test.mjs +158 -4
  31. package/api/docs/docs.type.d.mts +181 -2
  32. package/api/docs/docs.type.mjs +117 -3
  33. package/api/docs/index/index.mjs +11 -3
  34. package/api/docs/index/index.test.mjs +1 -1
  35. package/api/docs/integration-tree.test.mjs +555 -0
  36. package/api/docs/integrationDocs.test.mjs +14 -14
  37. package/api/docs/list/list.mjs +28 -12
  38. package/api/docs/node/node.d.mts +43 -0
  39. package/api/docs/node/node.mjs +192 -0
  40. package/api/docs/reference-blocks.test.mjs +406 -0
  41. package/api/doctor/doctor.d.mts +54 -4
  42. package/api/doctor/doctor.doc.mjs +1 -0
  43. package/api/doctor/doctor.mjs +331 -16
  44. package/api/doctor/doctor.test.mjs +420 -7
  45. package/api/gap-report/gap-report.doc.mjs +1 -0
  46. package/api/hook/_adapter.mjs +19 -5
  47. package/api/hook/hook.doc.mjs +1 -0
  48. package/api/hook/list/list.d.mts +1 -1
  49. package/api/hook/list/list.mjs +69 -17
  50. package/api/index.d.mts +1 -1
  51. package/api/index.mjs +1 -0
  52. package/api/init/init.doc.mjs +2 -1
  53. package/api/integration/add-contribution.d.mts +2 -1
  54. package/api/integration/add-contribution.mjs +114 -12
  55. package/api/integration/add-contribution.test.mjs +174 -3
  56. package/api/integration/add-theme.mjs +34 -64
  57. package/api/integration/add-theme.test.mjs +105 -21
  58. package/api/integration/authoring-checks.mjs +138 -28
  59. package/api/integration/authoring-checks.test.mjs +179 -7
  60. package/api/integration/authoring-checks.type.mjs +6 -1
  61. package/api/integration/integration-authoring.type.d.mts +2 -0
  62. package/api/integration/integration-authoring.type.mjs +2 -0
  63. package/api/integration/integration-block-exports.test.mjs +10 -6
  64. package/api/integration/integrationAdd.doc.mjs +7 -0
  65. package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
  66. package/api/integration/integrationAddCodemod.doc.mjs +1 -0
  67. package/api/integration/integrationAddComponent.doc.mjs +1 -0
  68. package/api/integration/integrationAddDoc.doc.mjs +8 -1
  69. package/api/integration/integrationAddTemplate.doc.mjs +1 -0
  70. package/api/integration/integrationAddTheme.doc.mjs +6 -5
  71. package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
  72. package/api/integration/integrationDocConflicts.doc.mjs +2 -1
  73. package/api/integration/integrationPackCheck.doc.mjs +2 -1
  74. package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
  75. package/api/integration/integrationTemplateConflicts.doc.mjs +4 -0
  76. package/api/integration/pack-check.mjs +34 -0
  77. package/api/integration/pack-check.test.mjs +138 -47
  78. package/api/integration/pack-check.type.d.mts +26 -2
  79. package/api/integration/pack-check.type.mjs +14 -1
  80. package/api/integration/summarizeIssues.doc.mjs +1 -0
  81. package/api/integration/template-conflict-compatibility.test.mjs +73 -0
  82. package/api/integration/validate-integration-fixes.test.mjs +1389 -0
  83. package/api/integration/validate-integration.mjs +50 -102
  84. package/api/integration/validate-integration.test.mjs +88 -26
  85. package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
  86. package/api/integration/validateIntegration.doc.mjs +2 -1
  87. package/api/json/assertResponse.doc.mjs +1 -0
  88. package/api/json/index.ts +2 -0
  89. package/api/json/isError.doc.mjs +1 -0
  90. package/api/json/parseResponse.doc.mjs +1 -0
  91. package/api/layout/_adapter.mjs +20 -5
  92. package/api/layout/layoutCheck.doc.mjs +1 -0
  93. package/api/layout/layoutExpand.doc.mjs +1 -0
  94. package/api/layout/layoutGrammar.doc.mjs +1 -0
  95. package/api/search/search.d.mts +59 -1
  96. package/api/search/search.doc.mjs +5 -3
  97. package/api/search/search.mjs +458 -77
  98. package/api/search/search.test.mjs +91 -2
  99. package/api/search/search.type.d.mts +13 -1
  100. package/api/search/search.type.mjs +4 -1
  101. package/api/swizzle/swizzle.doc.mjs +1 -0
  102. package/api/template/list/list.mjs +1 -0
  103. package/api/template/table-floating-bulk-actions.test.mjs +66 -0
  104. package/api/template/template-integration.test.mjs +1072 -3
  105. package/api/template/template-suffix.test.mjs +41 -21
  106. package/api/template/template.doc.mjs +28 -7
  107. package/api/template/template.mjs +45 -8
  108. package/api/template/template.type.d.mts +6 -8
  109. package/api/template/template.type.mjs +3 -2
  110. package/api/theme/_adapter.d.mts +2 -3
  111. package/api/theme/_adapter.mjs +4 -5
  112. package/api/theme/add/add.binary.test.mjs +10 -17
  113. package/api/theme/add/add.test.mjs +14 -1
  114. package/api/theme/generateTonalPalette.doc.mjs +1 -0
  115. package/api/theme/integration-themes.test.mjs +39 -28
  116. package/api/theme/list/list.test.mjs +19 -20
  117. package/api/theme/listThemes.doc.mjs +6 -5
  118. package/api/theme/template/template.test.mjs +5 -0
  119. package/api/theme/themeAdd.doc.mjs +4 -3
  120. package/api/theme/themeBuild.doc.mjs +1 -0
  121. package/api/theme/themeList.doc.mjs +6 -3
  122. package/api/theme/themeListAvailable.doc.mjs +5 -3
  123. package/api/theme/themePaletteGenerate.doc.mjs +1 -0
  124. package/api/theme/themeTargets.doc.mjs +1 -0
  125. package/api/theme/themeTemplate.doc.mjs +2 -1
  126. package/api/upgrade/_adapter.d.mts +32 -5
  127. package/api/upgrade/_adapter.mjs +97 -69
  128. package/api/upgrade/provider-agreement.test.mjs +152 -0
  129. package/api/upgrade/run/run.mjs +356 -59
  130. package/api/upgrade/upgrade.doc.mjs +6 -1
  131. package/api/upgrade/upgrade.type.d.mts +34 -0
  132. package/api/upgrade/upgrade.type.mjs +15 -0
  133. package/assets/codemods/__tests__/runner.test.mjs +330 -8
  134. package/assets/codemods/integration-discovery.mjs +8 -2
  135. package/assets/codemods/integration-discovery.test.mjs +15 -0
  136. package/assets/codemods/integration-runner.mjs +56 -4
  137. package/assets/codemods/integration-runner.protection.test.mjs +153 -0
  138. package/assets/codemods/run-codemod.mjs +177 -34
  139. package/assets/codemods/runner.mjs +350 -102
  140. package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
  141. package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
  142. package/assets/codemods/transforms/next/index.mjs +19 -1
  143. package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
  144. package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
  145. package/assets/docs/getting-started.doc.mjs +2 -2
  146. package/assets/docs/layout.doc.dense.mjs +2 -2
  147. package/assets/docs/layout.doc.mjs +1 -1
  148. package/assets/docs/principles.doc.mjs +6 -6
  149. package/assets/docs/styling-libraries.doc.mjs +3 -3
  150. package/assets/docs/styling.doc.mjs +4 -4
  151. package/assets/docs/theme.doc.mjs +5 -5
  152. package/assets/docs/tokens.doc.mjs +1 -1
  153. package/assets/docs/tree/api.doc.mjs +30 -0
  154. package/assets/docs/tree/cli.doc.mjs +23 -0
  155. package/assets/docs/tree/commands.doc.mjs +25 -0
  156. package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +66 -38
  157. package/assets/docs/tree/integrations.test.mjs +62 -0
  158. package/assets/docs/tree/writing-docs.doc.mjs +286 -0
  159. package/assets/docs/working-with-ai.doc.mjs +3 -3
  160. package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
  161. package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
  162. package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
  163. package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
  164. package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
  165. package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
  166. package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
  167. package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
  168. package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
  169. package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
  170. package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
  171. package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
  172. package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
  173. package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
  174. package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
  175. package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
  176. package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
  177. package/authoring/codemod/codemod.doc.mjs +1 -1
  178. package/authoring/codemod/type.ts +12 -0
  179. package/authoring/config/config.doc.mjs +1 -1
  180. package/authoring/debug/debug.doc.d.mts +11 -0
  181. package/authoring/debug/debug.doc.mjs +182 -0
  182. package/authoring/debug/parse.d.mts +3 -3
  183. package/authoring/doctypes/_schema.d.mts +119 -117
  184. package/authoring/doctypes/_schema.mjs +54 -3
  185. package/authoring/doctypes/base/graph-fields.doc.mjs +8 -6
  186. package/authoring/doctypes/base/type.ts +6 -5
  187. package/authoring/doctypes/command/command.doc.mjs +1 -1
  188. package/authoring/doctypes/command/type.ts +2 -2
  189. package/authoring/doctypes/component/type.ts +2 -2
  190. package/authoring/doctypes/doctypes-new.test.mjs +48 -6
  191. package/authoring/doctypes/enum/enum.doc.mjs +1 -1
  192. package/authoring/doctypes/enum/type.ts +1 -1
  193. package/authoring/doctypes/function/function.doc.mjs +3 -2
  194. package/authoring/doctypes/function/type.ts +3 -2
  195. package/authoring/doctypes/hook/type.ts +2 -2
  196. package/authoring/doctypes/load-contract.test.mjs +28 -2
  197. package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
  198. package/authoring/doctypes/namespace/parse.test.mjs +23 -25
  199. package/authoring/doctypes/namespace/type.ts +5 -2
  200. package/authoring/doctypes/parse.d.mts +4 -2
  201. package/authoring/doctypes/parse.mjs +10 -5
  202. package/authoring/doctypes/reference/reference.doc.mjs +35 -6
  203. package/authoring/doctypes/reference/type.ts +30 -13
  204. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  205. package/authoring/doctypes/schema/type.ts +1 -2
  206. package/authoring/doctypes/template/parse.d.mts +2 -0
  207. package/authoring/doctypes/template/parse.mjs +4 -0
  208. package/authoring/doctypes/template/parse.test.mjs +18 -0
  209. package/authoring/doctypes/template/template.doc.mjs +9 -3
  210. package/authoring/doctypes/template/type.ts +8 -0
  211. package/authoring/doctypes/theme/parse.d.mts +35 -0
  212. package/authoring/doctypes/theme/parse.mjs +76 -0
  213. package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
  214. package/authoring/doctypes/theme/theme.doc.mjs +79 -0
  215. package/authoring/doctypes/theme/type.ts +42 -0
  216. package/authoring/doctypes/types.ts +2 -1
  217. package/authoring/gap-report/gap-report.doc.d.mts +12 -0
  218. package/authoring/gap-report/gap-report.doc.mjs +183 -0
  219. package/authoring/identity/identity.doc.mjs +2 -2
  220. package/authoring/index.d.mts +1 -0
  221. package/authoring/index.d.ts +7 -4
  222. package/authoring/index.mjs +2 -1
  223. package/authoring/integration/integration.doc.mjs +2 -2
  224. package/authoring/integration/type.ts +4 -10
  225. package/clients/cli/__tests__/cliManifest.test.ts +27 -29
  226. package/clients/cli/commands/blog.doc.mjs +1 -1
  227. package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
  228. package/clients/cli/commands/build-theme.mjs +11 -45
  229. package/clients/cli/commands/build.doc.mjs +12 -7
  230. package/clients/cli/commands/build.mjs +105 -67
  231. package/clients/cli/commands/build.text-fields.test.mjs +41 -0
  232. package/clients/cli/commands/component/index.mjs +1 -1
  233. package/clients/cli/commands/component-ownership.test.mjs +3 -3
  234. package/clients/cli/commands/component.doc.mjs +1 -1
  235. package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
  236. package/clients/cli/commands/discover.doc.mjs +1 -1
  237. package/clients/cli/commands/discover.mjs +1 -1
  238. package/clients/cli/commands/docs.doc.mjs +21 -9
  239. package/clients/cli/commands/docs.mjs +184 -70
  240. package/clients/cli/commands/docs.test.mjs +120 -16
  241. package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
  242. package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -3
  243. package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
  244. package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
  245. package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
  246. package/clients/cli/commands/doctor-integration.test.mjs +90 -8
  247. package/clients/cli/commands/doctor.doc.mjs +1 -1
  248. package/clients/cli/commands/doctor.mjs +53 -16
  249. package/clients/cli/commands/gap-report.doc.mjs +1 -1
  250. package/clients/cli/commands/hook.doc.mjs +1 -1
  251. package/clients/cli/commands/init.doc.mjs +1 -1
  252. package/clients/cli/commands/integration-add.controls.test.mjs +1 -1
  253. package/clients/cli/commands/integration-add.doc.mjs +11 -1
  254. package/clients/cli/commands/integration-pack.doc.mjs +1 -1
  255. package/clients/cli/commands/integration-real-world.test.mjs +3 -9
  256. package/clients/cli/commands/integration.doc.mjs +1 -1
  257. package/clients/cli/commands/integration.mjs +1 -0
  258. package/clients/cli/commands/layout-check.doc.mjs +1 -1
  259. package/clients/cli/commands/layout-expand.doc.mjs +1 -1
  260. package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
  261. package/clients/cli/commands/layout.doc.mjs +1 -1
  262. package/clients/cli/commands/manifest.doc.mjs +1 -1
  263. package/clients/cli/commands/search.doc.mjs +1 -1
  264. package/clients/cli/commands/search.mjs +11 -2
  265. package/clients/cli/commands/setup-nudge.test.mjs +6 -0
  266. package/clients/cli/commands/swizzle.doc.mjs +1 -1
  267. package/clients/cli/commands/template.doc.mjs +24 -7
  268. package/clients/cli/commands/template.mjs +4 -91
  269. package/clients/cli/commands/text-json-parity.test.mjs +719 -0
  270. package/clients/cli/commands/theme-add.doc.mjs +2 -2
  271. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  272. package/clients/cli/commands/theme-list.doc.mjs +2 -2
  273. package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
  274. package/clients/cli/commands/theme-palette.doc.mjs +1 -1
  275. package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
  276. package/clients/cli/commands/theme-targets.doc.mjs +1 -1
  277. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  278. package/clients/cli/commands/theme.doc.mjs +1 -1
  279. package/clients/cli/commands/upgrade.doc.mjs +3 -2
  280. package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
  281. package/clients/cli/commands/upgrade.mjs +29 -7
  282. package/clients/cli/formatters/index.mjs +2 -0
  283. package/clients/cli/formatters/index.test.mjs +6 -0
  284. package/clients/cli/index.mjs +8 -0
  285. package/clients/cli/lib/hook-format.mjs +14 -5
  286. package/clients/cli/lib/manifest.mjs +9 -2
  287. package/foundation/agent-docs/agent-docs.d.mts +3 -2
  288. package/foundation/agent-docs/agent-docs.mjs +13 -9
  289. package/foundation/agent-docs/agent-docs.test.mjs +19 -1
  290. package/foundation/config/project-themes.test.mjs +11 -19
  291. package/foundation/config/project.d.mts +20 -11
  292. package/foundation/config/project.mjs +123 -80
  293. package/foundation/config/project.test.mjs +144 -21
  294. package/foundation/discovery/authoring-self-docs.d.mts +18 -0
  295. package/foundation/discovery/authoring-self-docs.mjs +37 -15
  296. package/foundation/discovery/authoring-self-docs.test.mjs +25 -9
  297. package/foundation/discovery/authoring-surface.d.mts +74 -0
  298. package/foundation/discovery/authoring-surface.mjs +525 -0
  299. package/foundation/discovery/authoring-surface.test.mjs +392 -0
  300. package/foundation/discovery/cli-self-docs.d.mts +119 -0
  301. package/foundation/discovery/cli-self-docs.mjs +490 -0
  302. package/foundation/discovery/cli-self-docs.test.mjs +375 -0
  303. package/foundation/discovery/component-discovery.d.mts +38 -0
  304. package/foundation/discovery/component-discovery.mjs +48 -0
  305. package/foundation/discovery/component-loader.d.mts +35 -38
  306. package/foundation/discovery/component-loader.mjs +53 -222
  307. package/foundation/discovery/docs-discovery.d.mts +112 -11
  308. package/foundation/discovery/docs-discovery.mjs +231 -36
  309. package/foundation/discovery/docs-discovery.test.mjs +111 -32
  310. package/foundation/discovery/docs-output-budget.d.mts +2 -2
  311. package/foundation/discovery/docs-output-budget.mjs +1 -1
  312. package/foundation/discovery/docs-section-key.d.mts +28 -10
  313. package/foundation/discovery/docs-section-key.mjs +134 -33
  314. package/foundation/discovery/docs-section-key.test.mjs +41 -19
  315. package/foundation/discovery/template-adapter.d.mts +99 -6
  316. package/foundation/discovery/template-adapter.mjs +480 -57
  317. package/foundation/discovery/template-adapter.test.mjs +57 -0
  318. package/foundation/discovery/template-conflict-release.d.mts +13 -0
  319. package/foundation/discovery/template-conflict-release.mjs +40 -0
  320. package/foundation/discovery/template-conflict-release.test.mjs +40 -0
  321. package/foundation/discovery/theme-discovery.d.mts +67 -7
  322. package/foundation/discovery/theme-discovery.mjs +916 -186
  323. package/foundation/discovery/theme-discovery.test.mjs +613 -219
  324. package/foundation/doc-compiler/bundle.d.mts +47 -0
  325. package/foundation/doc-compiler/bundle.mjs +278 -0
  326. package/foundation/doc-compiler/bundle.test.mjs +266 -0
  327. package/foundation/doc-compiler/compile.d.mts +220 -39
  328. package/foundation/doc-compiler/compile.mjs +311 -15
  329. package/foundation/doc-compiler/diagnostics.d.mts +126 -0
  330. package/foundation/doc-compiler/diagnostics.mjs +305 -0
  331. package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
  332. package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
  333. package/foundation/doc-compiler/import.d.mts +24 -0
  334. package/foundation/doc-compiler/import.mjs +59 -0
  335. package/foundation/doc-compiler/inputs.d.mts +102 -0
  336. package/foundation/doc-compiler/inputs.mjs +291 -0
  337. package/foundation/doc-compiler/inputs.test.mjs +299 -0
  338. package/foundation/doc-compiler/ir.d.mts +13 -0
  339. package/foundation/doc-compiler/ir.mjs +196 -12
  340. package/foundation/doc-compiler/lenses.d.mts +8 -5
  341. package/foundation/doc-compiler/lenses.mjs +50 -4
  342. package/foundation/doc-compiler/links.d.mts +162 -0
  343. package/foundation/doc-compiler/links.mjs +294 -0
  344. package/foundation/doc-compiler/links.test.mjs +192 -0
  345. package/foundation/doc-compiler/lower-doc.test.mjs +495 -0
  346. package/foundation/doc-compiler/overlays.d.mts +37 -0
  347. package/foundation/doc-compiler/overlays.mjs +206 -0
  348. package/foundation/doc-compiler/parse-readable.d.mts +9 -0
  349. package/foundation/doc-compiler/parse-readable.mjs +29 -0
  350. package/foundation/doc-compiler/read.d.mts +127 -0
  351. package/foundation/doc-compiler/read.mjs +325 -0
  352. package/foundation/doc-compiler/read.test.mjs +313 -0
  353. package/foundation/doc-compiler/source.d.mts +33 -0
  354. package/foundation/doc-compiler/source.mjs +128 -0
  355. package/foundation/doc-compiler/tree.d.mts +288 -0
  356. package/foundation/doc-compiler/tree.mjs +876 -0
  357. package/foundation/doc-compiler/tree.test.mjs +598 -0
  358. package/foundation/fs/file-protection.d.mts +33 -0
  359. package/foundation/fs/file-protection.mjs +825 -0
  360. package/foundation/fs/file-protection.test.mjs +250 -0
  361. package/foundation/integrations/autolink.d.mts +58 -1
  362. package/foundation/integrations/autolink.mjs +143 -57
  363. package/foundation/integrations/autolink.test.mjs +1 -1
  364. package/foundation/integrations/cli-requirement.d.mts +45 -0
  365. package/foundation/integrations/cli-requirement.mjs +154 -0
  366. package/foundation/integrations/cli-requirement.test.mjs +84 -0
  367. package/foundation/integrations/contribution-fixes.d.mts +145 -0
  368. package/foundation/integrations/contribution-fixes.mjs +1284 -0
  369. package/foundation/integrations/contribution-inventory.d.mts +3 -2
  370. package/foundation/integrations/contribution-inventory.mjs +27 -24
  371. package/foundation/integrations/contribution-inventory.test.mjs +86 -27
  372. package/foundation/integrations/integration-warnings.d.mts +9 -2
  373. package/foundation/integrations/integration-warnings.mjs +51 -26
  374. package/foundation/integrations/integration-warnings.test.mjs +74 -1
  375. package/foundation/integrations/integrations.d.mts +3 -0
  376. package/foundation/integrations/integrations.mjs +11 -97
  377. package/foundation/integrations/provider-ledger.test.mjs +275 -0
  378. package/foundation/integrations/provider-resolution.d.mts +152 -0
  379. package/foundation/integrations/provider-resolution.mjs +576 -0
  380. package/foundation/integrations/provider-resolution.test.mjs +369 -0
  381. package/foundation/integrations/theme-descriptor.d.mts +8 -0
  382. package/foundation/integrations/theme-descriptor.mjs +44 -0
  383. package/foundation/integrations/validate-contributions.mjs +121 -29
  384. package/foundation/response/error-codes.d.mts +3 -1
  385. package/foundation/response/error-codes.d.ts +2 -0
  386. package/foundation/response/error-codes.doc.mjs +12 -2
  387. package/foundation/response/error-codes.mjs +7 -1
  388. package/foundation/response/error-codes.test.mjs +55 -11
  389. package/foundation/response/response-types.doc.d.mts +5 -1
  390. package/foundation/response/response-types.doc.mjs +20 -11
  391. package/foundation/response/response.doc.mjs +1 -1
  392. package/foundation/text/string-utils.d.mts +8 -0
  393. package/foundation/text/string-utils.mjs +40 -10
  394. package/foundation/xle/expand.mjs +1 -1
  395. package/foundation/xle/xle.test.mjs +13 -0
  396. package/package.json +10 -9
  397. package/assets/templates/themes/manifest.json +0 -95
@@ -23,10 +23,10 @@ import type {
23
23
  * Standalone hooks (e.g. useMediaQuery, useFocusTrap, useOverflow) get
24
24
  * their own {hookName}.doc.mjs file and use this type.
25
25
  *
26
- * Every hook .doc.mjs must export a single `docs` constant:
26
+ * Every new hook .doc.mjs default-exports a stamped object:
27
27
  *
28
28
  * /\*\* @type {import('@astryxdesign/cli/authoring').HookDoc} \*\/
29
- * export const docs = { ... };
29
+ * export default { type: 'function', ... };
30
30
  */
31
31
  export interface HookDoc extends AuthoredDocGraphFields {
32
32
  /** Doc-kind discriminant for the stamped default-export format
@@ -49,7 +49,7 @@ const EXAMPLES = Object.fromEntries(
49
49
 
50
50
  describe('load check vs published type', () => {
51
51
  it('locks every doc kind', () => {
52
- const source = ['_schema.mjs', 'template/parse.mjs']
52
+ const source = ['_schema.mjs', 'template/parse.mjs', 'theme/parse.mjs']
53
53
  .map(file => fs.readFileSync(path.join(HERE, file), 'utf8'))
54
54
  .join('\n');
55
55
  expect(Object.keys(LOCKS).sort()).toEqual([...KINDS].sort());
@@ -57,6 +57,7 @@ describe('load check vs published type', () => {
57
57
  ...Object.values(LOCKS),
58
58
  '_AuthoredDocKindDriftLock',
59
59
  '_HookDocIsFunctionDocLock',
60
+ '_ThemeDocDriftLock',
60
61
  ];
61
62
  for (const lock of locks) {
62
63
  expect(source, `${lock} is missing`).toMatch(
@@ -70,7 +71,7 @@ describe('load check vs published type', () => {
70
71
  expect(() => parseDoc(EXAMPLES[kind], `${kind}.doc.mjs`)).not.toThrow();
71
72
  }
72
73
  expect(() => parseDoc({type: 'widget', name: 'x'}, 'x.doc.mjs')).toThrow(
73
- /unsupported type "widget"/,
74
+ /x\.doc\.mjs is invalid/u,
74
75
  );
75
76
  });
76
77
  });
@@ -181,6 +182,31 @@ describe('unknown fields', () => {
181
182
  );
182
183
  });
183
184
 
185
+ it("are refused inside a section's reference block, which a section takes", () => {
186
+ const [section] = EXAMPLES.generic.sections;
187
+ const reference = {
188
+ type: 'reference',
189
+ target: '@astryxdesign/cli:schema:integration',
190
+ projection: {fields: ['docs']},
191
+ presentation: 'compact',
192
+ };
193
+ /** @param {object} block */
194
+ const withBlock = block =>
195
+ parseDoc(
196
+ {...EXAMPLES.generic, sections: [{...section, content: [block]}]},
197
+ 'r.doc.mjs',
198
+ );
199
+ expect(() => withBlock(reference)).not.toThrow();
200
+ expect(() => withBlock({...reference, notAField: true})).toThrow();
201
+ expect(() =>
202
+ withBlock({...reference, projection: {fields: ['docs'], rows: []}}),
203
+ ).toThrow();
204
+ // Workflow and collection blocks belong to a namespace doc.
205
+ expect(() =>
206
+ withBlock({type: 'collection', source: {slot: 'guides'}}),
207
+ ).toThrow();
208
+ });
209
+
184
210
  it('are refused inside sections and content blocks', () => {
185
211
  const [section] = EXAMPLES.generic.sections;
186
212
  expect(() =>
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'NamespaceDoc',
13
13
  namespace: 'authoring',
14
14
  description:
15
- "Declares named navigation slots and renderer-neutral layout blocks for already-discovered docs. It never scans folders or copies child documents. Not loaded yet: only the docs graph reads namespace docs, and it is not built, so keep them out of an integration's docs directory for now.",
15
+ "Declares one level of the docs tree: named slots, and adoption rules for already-discovered docs. It never scans folders, lists its children, or copies child documents: a child names its parent with `placement`, or a namespace adopts a discovery group. `astryx docs <route>` lists each slot's children one level down. The CLI keeps its namespace docs in its docs tree directory; an integration ships its own in its docs directory, and they appear in `astryx docs` beside the CLI's.",
16
16
  appliesTo: '<namespace>.doc.mjs',
17
17
  fields: [
18
18
  {
@@ -44,13 +44,13 @@ export const doc = {
44
44
  name: 'placement',
45
45
  type: 'DocPlacement',
46
46
  description:
47
- 'Optional canonical parent request: {parent, slot?, order?}. Invalid explicit placement will fail compilation instead of falling back.',
47
+ 'Optional canonical parent: {parent, slot?, order?}. `parent` names a namespace of the same package as `namespace:<name>`. An invalid placement withdraws the namespace with a diagnostic; it never falls back.',
48
48
  },
49
49
  {
50
50
  name: 'aliases',
51
51
  type: 'string[]',
52
52
  description:
53
- 'Prior names or routes the docs graph will keep resolving to this doc.',
53
+ 'Prior names or routes the docs tree will keep resolving to this doc. Not read yet.',
54
54
  },
55
55
  {
56
56
  name: 'audience',
@@ -78,9 +78,9 @@ export const doc = {
78
78
  },
79
79
  {
80
80
  name: 'blocks',
81
- type: 'ReferenceContentBlock[]',
81
+ type: '(ReferenceContentBlock | GraphContentBlock)[]',
82
82
  description:
83
- 'Ordered layout content. V1 adds only workflow, collection, and reference to the existing prose, heading, code, table, list, and token-ref blocks.',
83
+ 'Ordered layout content for the namespace page. Graph-only workflow, collection, and reference blocks are available here without widening the stable ReferenceContentBlock union used by existing topic renderers. Not rendered yet: `astryx docs <route>` lists every slot and its children in order.',
84
84
  },
85
85
  ],
86
86
  examples: [
@@ -103,17 +103,13 @@ export const docs = {
103
103
  source: {group: 'cli-commands', kinds: ['command']},
104
104
  into: 'reference',
105
105
  }],
106
- blocks: [
107
- {type: 'collection', source: {slot: 'guides'}, presentation: 'cards'},
108
- {type: 'collection', source: {slot: 'reference'}, presentation: 'compact'},
109
- ],
110
106
  };`,
111
107
  },
112
108
  ],
113
109
  notes: [
114
110
  {
115
111
  type: 'prose',
116
- text: "Namespace docs are not loaded yet. Only the docs graph reads them, and it is not built. A namespace doc in an integration's docs directory fails to load as a topic, and with it every topic that package contributes, until the file is removed.",
112
+ text: "The docs tree reads namespace docs from the CLI and from every configured integration. An integration's namespace doc is a top-level level of the tree, and its guides name it with `placement`; a doc can be placed only in a namespace of its own package. When two packages claim one route, the CLI's own docs win, then integrations in configured order, and `astryx doctor` names the loser.",
117
113
  },
118
114
  {
119
115
  type: 'prose',
@@ -134,32 +134,30 @@ describe('NamespaceDoc', () => {
134
134
  });
135
135
  });
136
136
 
137
- describe('semantic blocks in existing docs', () => {
138
- it('accepts workflow, collection, and reference in a ReferenceDoc section', () => {
139
- const parsed = parseReference({
140
- type: 'generic',
141
- name: 'publishing',
142
- title: 'Publishing',
143
- description: 'Publish an integration.',
144
- sections: [
145
- {
146
- id: 'start',
147
- title: 'Start',
148
- content: namespaceDoc.blocks,
149
- },
150
- ],
151
- });
152
- expect(parsed.sections[0].id).toBe('start');
153
- expect(parsed.sections[0].content.map(block => block.type)).toEqual([
154
- 'workflow',
155
- 'collection',
156
- 'reference',
157
- ]);
137
+ describe('semantic graph blocks', () => {
138
+ it('keeps graph-only blocks out of the stable ReferenceDoc section union', () => {
139
+ expect(() =>
140
+ parseReference({
141
+ type: 'generic',
142
+ name: 'publishing',
143
+ title: 'Publishing',
144
+ description: 'Publish an integration.',
145
+ sections: [
146
+ {
147
+ id: 'start',
148
+ title: 'Start',
149
+ content: namespaceDoc.blocks,
150
+ },
151
+ ],
152
+ }),
153
+ ).toThrow(/Invalid discriminator value/u);
158
154
  });
159
155
 
160
- it('rejects an unknown stamped doc kind instead of treating it as legacy', () => {
161
- expect(() => parseDoc({type: 'choice', name: 'x', props: []})).toThrow(
162
- /unsupported type "choice"/u,
163
- );
156
+ it('keeps shape-sniffing an unknown stamp for 0.6.x compatibility', () => {
157
+ expect(parseDoc({type: 'choice', name: 'x', props: []})).toMatchObject({
158
+ type: 'choice',
159
+ name: 'x',
160
+ props: [],
161
+ });
164
162
  });
165
163
  });
@@ -7,7 +7,10 @@
7
7
  */
8
8
 
9
9
  import type {AuthoredDocGraphFields, AuthoredDocKind} from '../base/type.js';
10
- import type {ReferenceContentBlock} from '../reference/type.js';
10
+ import type {
11
+ GraphContentBlock,
12
+ ReferenceContentBlock,
13
+ } from '../reference/type.js';
11
14
 
12
15
  /** Which providers may contribute appearances to a namespace slot. */
13
16
  export type NamespaceProviderScope = 'same' | 'configured';
@@ -67,5 +70,5 @@ export interface NamespaceDoc extends AuthoredDocGraphFields {
67
70
  /** Optional source-adoption rules for otherwise-unplaced docs. */
68
71
  adopts?: NamespaceAdoptionRule[];
69
72
  /** Ordered renderer-neutral content and collection blocks. */
70
- blocks?: ReferenceContentBlock[];
73
+ blocks?: (ReferenceContentBlock | GraphContentBlock)[];
71
74
  }
@@ -10,6 +10,7 @@
10
10
  /** @typedef {import('./types.js').CommandDoc} CommandDoc */
11
11
  /** @typedef {import('./types.js').EnumDoc} EnumDoc */
12
12
  /** @typedef {import('./types.js').NamespaceDoc} NamespaceDoc */
13
+ /** @typedef {import('./types.js').ThemeDoc} ThemeDoc */
13
14
  /**
14
15
  * Validate an unknown loaded doc value into its typed shape, or throw.
15
16
  * Dispatches on the stamped `type`; unstamped docs fall back to
@@ -18,9 +19,9 @@
18
19
  *
19
20
  * @param {unknown} input
20
21
  * @param {string} [label]
21
- * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc}
22
+ * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc | ThemeDoc}
22
23
  */
23
- export function parseDoc(input: unknown, label?: string): ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc;
24
+ export function parseDoc(input: unknown, label?: string): ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc | ThemeDoc;
24
25
  export type ComponentDoc = import("./types.js").ComponentDoc;
25
26
  export type HookDoc = import("./types.js").HookDoc;
26
27
  export type FunctionDoc = import("./types.js").FunctionDoc;
@@ -30,3 +31,4 @@ export type SchemaDoc = import("./types.js").SchemaDoc;
30
31
  export type CommandDoc = import("./types.js").CommandDoc;
31
32
  export type EnumDoc = import("./types.js").EnumDoc;
32
33
  export type NamespaceDoc = import("./types.js").NamespaceDoc;
34
+ export type ThemeDoc = import("./types.js").ThemeDoc;
@@ -4,8 +4,8 @@
4
4
  * @file The doc load boundary. `parseDoc` validates an unknown loaded doc value
5
5
  * into its typed shape (or throws a readable error), dispatching on the stamped
6
6
  * `type` and falling back to legacy shape-sniffing for unstamped docs. Its
7
- * acceptance set matches the old permissive `ComponentDocSchema` exactly, so
8
- * every existing `.doc.*` keeps loading unchanged.
7
+ * acceptance set preserves the old permissive `ComponentDocSchema` while new
8
+ * stamped kinds, including `theme`, use their sealed parser.
9
9
  */
10
10
 
11
11
  import {parseComponent} from './component/parse.mjs';
@@ -16,6 +16,7 @@ import {parseSchema} from './schema/parse.mjs';
16
16
  import {parseCommand} from './command/parse.mjs';
17
17
  import {parseEnum} from './enum/parse.mjs';
18
18
  import {parseNamespace} from './namespace/parse.mjs';
19
+ import {parseTheme} from './theme/parse.mjs';
19
20
  import {parseLegacyDoc} from './legacy.mjs';
20
21
 
21
22
  /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
@@ -27,6 +28,7 @@ import {parseLegacyDoc} from './legacy.mjs';
27
28
  /** @typedef {import('./types.js').CommandDoc} CommandDoc */
28
29
  /** @typedef {import('./types.js').EnumDoc} EnumDoc */
29
30
  /** @typedef {import('./types.js').NamespaceDoc} NamespaceDoc */
31
+ /** @typedef {import('./types.js').ThemeDoc} ThemeDoc */
30
32
 
31
33
  /**
32
34
  * Validate an unknown loaded doc value into its typed shape, or throw.
@@ -36,7 +38,7 @@ import {parseLegacyDoc} from './legacy.mjs';
36
38
  *
37
39
  * @param {unknown} input
38
40
  * @param {string} [label]
39
- * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc}
41
+ * @returns {ComponentDoc | HookDoc | FunctionDoc | ReferenceDoc | TemplateDoc | SchemaDoc | CommandDoc | EnumDoc | NamespaceDoc | ThemeDoc}
40
42
  */
41
43
  export function parseDoc(input, label = 'doc') {
42
44
  const type =
@@ -62,9 +64,12 @@ export function parseDoc(input, label = 'doc') {
62
64
  return parseEnum(input, label);
63
65
  case 'namespace':
64
66
  return parseNamespace(input, label);
67
+ case 'theme':
68
+ return parseTheme(input, label);
65
69
  case undefined:
66
- return parseLegacyDoc(input, label);
67
70
  default:
68
- throw new Error(`${label} has unsupported type ${JSON.stringify(type)}.`);
71
+ // 0.6.x shape-sniffed unknown stamps. Keep accepting them through the
72
+ // patch compatibility window; canonical writers emit a known stamp.
73
+ return parseLegacyDoc(input, label);
69
74
  }
70
75
  }
@@ -62,7 +62,7 @@ export const doc = {
62
62
  name: 'extends',
63
63
  type: 'string',
64
64
  description:
65
- 'Name of an existing topic this doc merges onto, section by section: a section whose title matches one in the base replaces it, a section the base does not have is appended. For correcting or adding to a topic rather than owning it. Exclusive with `replaces`.',
65
+ "Name of an existing topic this doc merges onto, section by section: a section whose title matches one in the base replaces it, a section the base does not have is appended. The topic keeps the base's title and description. For correcting or adding to a topic rather than owning it. Exclusive with `replaces`.",
66
66
  example: "'theme'",
67
67
  },
68
68
  {
@@ -93,9 +93,9 @@ export const doc = {
93
93
  },
94
94
  {
95
95
  name: 'sections[].content',
96
- type: 'ReferenceContentBlock[]',
96
+ type: '(ReferenceContentBlock | ReferenceDocBlock)[]',
97
97
  description:
98
- 'Ordered content blocks: prose, heading, code, table, list, and token-ref. workflow, collection, and reference are declared for the docs graph and parse, but a topic that uses one fails to load until the docs graph ships.',
98
+ "Ordered content blocks: prose, heading, code, table, list, token-ref, and reference. A `reference` block (`{type: 'reference', target, projection?, presentation?}`) includes another doc from its canonical source instead of a copy: a schema, command, function, or enum doc as `astryx docs` prints it, then the command that opens it. `projection.fields` keeps only those fields of a schema; `presentation` is `full` (the default), `compact` (no code blocks), or `summary` (only the doc's title, summary, and command). Any other doc shows as a summary. Graph-only workflow and collection blocks are available through GraphContentBlock on NamespaceDoc, without widening the stable ReferenceContentBlock union. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.",
99
99
  required: true,
100
100
  },
101
101
  {
@@ -144,7 +144,27 @@ export const docs = {
144
144
  },
145
145
  {
146
146
  type: 'prose',
147
- text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, a discriminated union. workflow, collection, and reference are declared for the docs graph: they parse, but topic loading rejects them until the docs graph ships. choice, callout, and checklist remain invalid. The same union is reused by the `notes` field on SchemaDoc and CommandDoc.',
147
+ text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref, plus the reference block (ReferenceDocBlock). A read inlines a reference block the way it inlines a token-ref, so `astryx docs`, in text and in `--json`, returns only the stable block kinds. Docs-graph-only workflow and collection blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.',
148
+ },
149
+ {
150
+ type: 'prose',
151
+ text: "A reference block includes content, where a link only points at it: `astryx doctor integration docs` fails when its target names no doc, when `projection.fields` names a field the schema does not have, or when the doc cannot take the projection or presentation it sets, and a read marks the missing content. A target without a provider names a doc of the package that wrote it, so an integration names the CLI's docs with the CLI's provider, as in `@astryxdesign/cli:schema:integration`.",
152
+ },
153
+ {
154
+ type: 'code',
155
+ lang: 'js',
156
+ label: 'A section that includes two fields of the integration manifest',
157
+ code: `{
158
+ title: 'Point the manifest at your folders',
159
+ content: [
160
+ {type: 'prose', text: 'Add these fields to astryx.integration.mjs.'},
161
+ {
162
+ type: 'reference',
163
+ target: '@astryxdesign/cli:schema:integration',
164
+ projection: {fields: ['components', 'docs']},
165
+ },
166
+ ],
167
+ }`,
148
168
  },
149
169
  {
150
170
  type: 'code',
@@ -156,10 +176,19 @@ export const docs = {
156
176
  | { type: 'code'; lang: string; code: string; label?: string }
157
177
  | { type: 'table'; headers: string[]; rows: string[][] }
158
178
  | { type: 'list'; style: 'ordered' | 'unordered' | 'do' | 'dont'; items: string[] }
159
- | { type: 'token-ref'; topic: string; section: string }
179
+ | { type: 'token-ref'; topic: string; section: string };
180
+
181
+ type ReferenceDocBlock = {
182
+ type: 'reference';
183
+ target: string;
184
+ projection?: { fields?: string[]; sections?: string[] };
185
+ presentation?: 'summary' | 'compact' | 'full';
186
+ };
187
+
188
+ type GraphContentBlock =
160
189
  | { type: 'workflow'; title?: string; steps: WorkflowStep[] }
161
190
  | { type: 'collection'; source: {slot: string}; presentation?: 'list' | 'cards' | 'compact'; whenEmpty?: 'show' | 'omit' }
162
- | { type: 'reference'; target: string; projection?: {fields?: string[]; sections?: string[]} };`,
191
+ | ReferenceDocBlock;`,
163
192
  },
164
193
  {
165
194
  type: 'prose',
@@ -30,19 +30,37 @@ export interface CollectionDocBlock {
30
30
  whenEmpty?: 'show' | 'omit';
31
31
  }
32
32
 
33
- /** A bounded projection of one canonical doc. */
33
+ /**
34
+ * A bounded projection of one canonical doc. In a namespace doc's `blocks` it
35
+ * is layout the docs tree renders later. In a topic section, a read includes
36
+ * the doc it names in place of the block: a schema, command, function, or
37
+ * enum doc as `astryx docs` prints it (`projection.fields` keeps only those
38
+ * fields of a schema), then the command that opens that doc. Any other doc
39
+ * shows its title and summary.
40
+ */
34
41
  export interface ReferenceDocBlock {
35
42
  type: 'reference';
43
+ /** The doc it names, by identity: `[<provider>:]<kind>:<name>`. */
36
44
  target: string;
37
45
  projection?: {
38
46
  fields?: string[];
39
47
  sections?: string[];
40
48
  };
49
+ /** `summary`: only the doc's title, summary, and the command that opens it.
50
+ * `compact`: the included doc without its code blocks. `full`, the default:
51
+ * the included doc. */
41
52
  presentation?: 'summary' | 'compact' | 'full';
42
53
  }
43
54
 
55
+ /** Graph-only content blocks, for a namespace doc's `blocks`. These are
56
+ * additive and do not widen the stable {@link ReferenceContentBlock} union
57
+ * consumed by existing exhaustive renderers. A topic section accepts the
58
+ * `reference` block too, and a read inlines it as stable blocks. */
59
+ export type GraphContentBlock =
60
+ WorkflowDocBlock | CollectionDocBlock | ReferenceDocBlock;
61
+
44
62
  /**
45
- * A content block within a reference doc section or namespace.
63
+ * A content block within a reference doc section.
46
64
  * Ordered arrays of these blocks form renderer-neutral documentation content.
47
65
  * A new semantic kind must ship with every renderer or fail visibly at a legacy
48
66
  * reader boundary until that renderer is available.
@@ -55,12 +73,12 @@ export interface ReferenceDocBlock {
55
73
  * { type: 'table', headers: ['Token', 'Value'], rows: [['--spacing-4', '16px']] }
56
74
  * { type: 'list', style: 'do', items: ['Use semantic tokens'] }
57
75
  * { type: 'token-ref', topic: 'tokens', section: 'Color Tokens' }
58
- * { type: 'workflow', steps: [{title: 'Validate', references: ['command:doctor']}] }
59
- * { type: 'collection', source: {slot: 'guides'}, presentation: 'cards' }
60
- * { type: 'reference', target: 'schema:integration', projection: {fields: ['docs']} }
76
+ * { type: 'prose', text: 'Check it with {@link command:doctor}.' }
61
77
  * ```
62
78
  */
63
79
  export type ReferenceContentBlock =
80
+ /** Text. `{@link [<provider>:]<kind>:<name>}` inside it links another doc
81
+ * by identity; `astryx docs` prints the command that opens that doc. */
64
82
  | {type: 'prose'; text: string}
65
83
  | {type: 'heading'; level: 3 | 4 | 5 | 6; text: string}
66
84
  | {type: 'code'; lang: string; code: string; label?: string}
@@ -80,10 +98,7 @@ export type ReferenceContentBlock =
80
98
  topic: string;
81
99
  /** Section title to pull from that topic. e.g. `'Color Tokens'` */
82
100
  section: string;
83
- }
84
- | WorkflowDocBlock
85
- | CollectionDocBlock
86
- | ReferenceDocBlock;
101
+ };
87
102
 
88
103
  /**
89
104
  * A reference documentation file (.doc.mjs).
@@ -93,10 +108,10 @@ export type ReferenceContentBlock =
93
108
  * they aren't tied to a specific component — just drop a .doc.mjs file
94
109
  * in the docs/ directory and it shows up in `astryx docs`.
95
110
  *
96
- * Every reference .doc.mjs must export a single `docs` constant:
111
+ * Every new reference .doc.mjs default-exports a stamped object:
97
112
  *
98
113
  * /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} *\/
99
- * export const docs = { ... };
114
+ * export default { type: 'generic', ... };
100
115
  */
101
116
  export interface ReferenceDoc extends AuthoredDocGraphFields {
102
117
  /** Doc-kind discriminant for the stamped default-export format
@@ -146,8 +161,10 @@ export interface ReferenceSection {
146
161
  /** Navigation category ('guide' | 'foundations'). Mirrors the parent doc's
147
162
  * category so sections can be grouped independently in the docsite nav. */
148
163
  category?: string;
149
- /** Ordered content blocks. Mix prose, code, tables, and lists freely. */
150
- content: ReferenceContentBlock[];
164
+ /** Ordered content blocks. Mix prose, code, tables, and lists freely. A
165
+ * `reference` block includes another doc from its canonical source, so a
166
+ * guide never copies a schema's fields or a command's options. */
167
+ content: (ReferenceContentBlock | ReferenceDocBlock)[];
151
168
  /** Preview type for token tables in this section. When set, the docsite
152
169
  * renders a visual preview column using the token's computed CSS value
153
170
  * from the current theme. Omit for non-token sections. */
@@ -49,7 +49,7 @@ export const doc = {
49
49
  name: 'namespace',
50
50
  type: 'string',
51
51
  description:
52
- "Docs namespace path (e.g. 'cli' | 'authoring'). Defaults are applied by the docs index; set explicitly to place the schema.",
52
+ "The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
53
53
  },
54
54
  {
55
55
  name: 'aliases',
@@ -47,8 +47,7 @@ export interface SchemaDoc extends AuthoredDocGraphFields {
47
47
  displayName: string;
48
48
  /** One-line summary shown in listings. */
49
49
  description: string;
50
- /** Docs namespace path (e.g. 'cli' | 'authoring'). Defaults are applied by
51
- * the docs index; set explicitly to place the schema. */
50
+ /** The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
52
51
  namespace?: string;
53
52
  /** Alternate slugs that also resolve to this doc (back-compat). */
54
53
  aliases?: string[];
@@ -56,6 +56,7 @@ declare const pageTemplateSchema: z.ZodObject<{
56
56
  slug: z.ZodOptional<z.ZodString>;
57
57
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
58
  }, z.core.$strict>>;
59
+ replaces: z.ZodOptional<z.ZodString>;
59
60
  placement: z.ZodOptional<z.ZodObject<{
60
61
  parent: z.ZodString;
61
62
  slot: z.ZodOptional<z.ZodString>;
@@ -91,6 +92,7 @@ declare const blockTemplateSchema: z.ZodObject<{
91
92
  slug: z.ZodOptional<z.ZodString>;
92
93
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
94
  }, z.core.$strict>>;
95
+ replaces: z.ZodOptional<z.ZodString>;
94
96
  placement: z.ZodOptional<z.ZodObject<{
95
97
  parent: z.ZodString;
96
98
  slot: z.ZodOptional<z.ZodString>;
@@ -51,6 +51,10 @@ const baseTemplateFields = {
51
51
  scaffold: z.boolean().optional(),
52
52
  isHiddenFromOverview: z.boolean().optional(),
53
53
  registry: registryIdentitySchema.optional(),
54
+ replaces: z
55
+ .string()
56
+ .min(1, 'replaces must name a Core template id')
57
+ .optional(),
54
58
  };
55
59
 
56
60
  const pageTemplateSchema = z
@@ -22,6 +22,24 @@ function reason(value, label = 'template') {
22
22
  }
23
23
 
24
24
  describe('parseTemplate (load boundary)', () => {
25
+ it('accepts replaces on page and block templates', () => {
26
+ for (const type of ['page', 'block']) {
27
+ const parsed = parseTemplate({
28
+ type,
29
+ name: 'Acme shell',
30
+ description: 'Replaces a Core template.',
31
+ replaces: 'shell-side-nav',
32
+ });
33
+ expect(parsed.replaces).toBe('shell-side-nav');
34
+ }
35
+ });
36
+
37
+ it('rejects an empty replaces', () => {
38
+ expect(reason({type: 'page', name: 'Acme shell', replaces: ''})).toMatch(
39
+ /replaces must name a Core template id/,
40
+ );
41
+ });
42
+
25
43
  it('accepts a stamped page template', () => {
26
44
  const parsed = parseTemplate({
27
45
  type: 'page',
@@ -18,7 +18,7 @@ export const doc = {
18
18
  "(type: 'page') for full page templates and BlockTemplateDoc (type: 'block') for " +
19
19
  'editable compositions. A block can stand alone or use `exampleFor` to attach ' +
20
20
  'to one component; `isShowcase` requires that component ownership.',
21
- appliesTo: '<Name>.template.mjs',
21
+ appliesTo: '<Name>.doc.mjs',
22
22
  fields: [
23
23
  {
24
24
  name: 'type',
@@ -52,6 +52,12 @@ export const doc = {
52
52
  type: 'string',
53
53
  description: 'One-sentence description of what the template provides.',
54
54
  },
55
+ {
56
+ name: 'replaces',
57
+ type: 'string',
58
+ description:
59
+ "Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field and withhold the package's templates and doc topics.",
60
+ },
55
61
  {
56
62
  name: 'isReady',
57
63
  type: 'boolean',
@@ -123,7 +129,7 @@ export const doc = {
123
129
  {
124
130
  label: 'Page template',
125
131
  code: `/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
126
- export const doc = {
132
+ export default {
127
133
  type: 'page',
128
134
  name: 'Dashboard',
129
135
  displayName: 'Dashboard',
@@ -135,7 +141,7 @@ export const doc = {
135
141
  {
136
142
  label: 'Block template (component example)',
137
143
  code: `/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
138
- export const doc = {
144
+ export default {
139
145
  type: 'block',
140
146
  name: 'ButtonGroupExample',
141
147
  displayName: 'Button Group Example',
@@ -28,6 +28,14 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
28
28
 
29
29
  /** Optional stable slug override and prior aliases for registry output. */
30
30
  registry?: RegistryDocIdentity;
31
+
32
+ /** Integration templates only: the exact id of the Core template this one
33
+ * replaces for unqualified lookup (find it with
34
+ * `astryx --json template --list --package @astryxdesign/core`). The Core
35
+ * original stays selectable with `--package @astryxdesign/core`. Needs
36
+ * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field and
37
+ * withhold the package's templates and doc topics. */
38
+ replaces?: string;
31
39
  /** Whether this template is ready for use. Templates with
32
40
  * isReady: false show as "(WIP)" in the gallery and CLI. */
33
41
  isReady?: boolean;
@@ -0,0 +1,35 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Compile-time drift lock: the sealed schema must infer exactly ThemeDoc.
6
+ *
7
+ * @typedef {import('../../_shared/contract.js').Expect<
8
+ * import('../../_shared/contract.js').Equal<
9
+ * z.infer<typeof themeDocSchema>,
10
+ * ThemeDoc
11
+ * >
12
+ * >} _ThemeDocDriftLock
13
+ */
14
+ /**
15
+ * Validate an unknown value as a theme descriptor, or throw.
16
+ *
17
+ * @param {unknown} input
18
+ * @param {string} [label]
19
+ * @returns {ThemeDoc}
20
+ */
21
+ export function parseTheme(input: unknown, label?: string): ThemeDoc;
22
+ /**
23
+ * Compile-time drift lock: the sealed schema must infer exactly ThemeDoc.
24
+ */
25
+ export type _ThemeDocDriftLock = import("../../_shared/contract.js").Expect<import("../../_shared/contract.js").Equal<z.infer<typeof themeDocSchema>, ThemeDoc>>;
26
+ export type ThemeDoc = import("./type.js").ThemeDoc;
27
+ import { z } from 'zod';
28
+ declare const themeDocSchema: z.ZodObject<{
29
+ type: z.ZodLiteral<"theme">;
30
+ name: z.ZodString;
31
+ displayName: z.ZodString;
32
+ description: z.ZodString;
33
+ maintained: z.ZodBoolean;
34
+ }, z.core.$strict>;
35
+ export {};