@astryxdesign/cli 0.7.16 → 0.7.17-canary.g335a172

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 (339) hide show
  1. package/README.md +76 -86
  2. package/api/build/_adapter.d.mts +12 -0
  3. package/api/build/_adapter.mjs +51 -34
  4. package/api/build/blocks/blocks.d.mts +7 -5
  5. package/api/build/blocks/blocks.mjs +113 -26
  6. package/api/build/build.doc.mjs +4 -3
  7. package/api/build/build.type.d.mts +2 -2
  8. package/api/build/build.type.mjs +3 -3
  9. package/api/build/kit/kind.d.mts +2 -1
  10. package/api/build/kit/kind.mjs +199 -10
  11. package/api/build/kit/kit.mjs +6 -4
  12. package/api/build/kit/rank.mjs +69 -16
  13. package/api/build/kit/start.d.mts +5 -4
  14. package/api/build/kit/start.mjs +12 -8
  15. package/api/build/kit/weights.d.mts +16 -3
  16. package/api/build/kit/weights.json +1 -1
  17. package/api/build/kit/weights.mjs +251 -35
  18. package/api/build/kit/word-model.d.mts +23 -0
  19. package/api/build/kit/word-model.mjs +46 -0
  20. package/api/build/kit/words.d.mts +48 -0
  21. package/api/build/kit/words.mjs +90 -1
  22. package/api/component/__fixtures__/resolutions/modules.txt +4 -5
  23. package/api/component/list/list.d.mts +1 -1
  24. package/api/component/list/list.mjs +48 -6
  25. package/api/discover/_adapter.d.mts +1 -1
  26. package/api/discover/search/search.mjs +3 -2
  27. package/api/docs/_adapter.d.mts +26 -2
  28. package/api/docs/_adapter.mjs +219 -6
  29. package/api/docs/docs.d.mts +3 -0
  30. package/api/docs/docs.doc.mjs +7 -1
  31. package/api/docs/docs.mjs +12 -0
  32. package/api/docs/docs.type.d.mts +5 -0
  33. package/api/docs/docs.type.mjs +2 -0
  34. package/api/docs/node/node.mjs +1 -1
  35. package/api/doctor/_adapter.d.mts +27 -5
  36. package/api/doctor/_adapter.mjs +83 -10
  37. package/api/doctor/built-checks.mjs +40 -14
  38. package/api/doctor/doctor.d.mts +4 -3
  39. package/api/doctor/doctor.mjs +14 -7
  40. package/api/doctor/theme-checks.mjs +121 -17
  41. package/api/icon/_records.mjs +2 -1
  42. package/api/index.d.mts +2 -0
  43. package/api/index.mjs +2 -0
  44. package/api/integration/_adapter.d.mts +44 -0
  45. package/api/integration/_adapter.mjs +77 -1
  46. package/api/integration/authoring-checks.mjs +6 -6
  47. package/api/integration/example-scope.d.mts +14 -0
  48. package/api/integration/example-scope.mjs +44 -0
  49. package/api/integration/example-scope.type.d.mts +29 -0
  50. package/api/integration/example-scope.type.mjs +25 -0
  51. package/api/integration/integrationExampleScope.doc.d.mts +11 -0
  52. package/api/integration/integrationExampleScope.doc.mjs +59 -0
  53. package/api/integration/validate-integration.mjs +19 -1
  54. package/api/integration/validate-integration.type.d.mts +9 -0
  55. package/api/integration/validate-integration.type.mjs +1 -1
  56. package/api/integration/validateIntegration.doc.mjs +1 -1
  57. package/api/render/_adapter.mjs +591 -195
  58. package/api/render/render.doc.mjs +11 -3
  59. package/api/render/render.type.d.mts +52 -0
  60. package/api/render/render.type.mjs +31 -1
  61. package/api/search/ORDERING.md +1 -1
  62. package/api/search/_candidate-score.mjs +51 -32
  63. package/api/search/_fit-order.mjs +3 -3
  64. package/api/search/_gather-components.d.mts +3 -2
  65. package/api/search/_gather-components.mjs +12 -3
  66. package/api/search/_lexical.d.mts +5 -0
  67. package/api/search/_lexical.mjs +8 -2
  68. package/api/search/_result.d.mts +11 -9
  69. package/api/search/_result.mjs +4 -4
  70. package/api/search/_score.d.mts +6 -1
  71. package/api/search/_score.mjs +15 -3
  72. package/api/search/search-index.mjs +7 -1
  73. package/api/search/search.d.mts +1 -1
  74. package/api/theme/_adapter.mjs +12 -1
  75. package/api/theme/build/build.d.mts +60 -0
  76. package/api/theme/build/build.mjs +210 -54
  77. package/api/theme/build/font-warning.d.mts +8 -0
  78. package/api/theme/build/font-warning.mjs +19 -0
  79. package/api/theme/theme.type.d.mts +10 -0
  80. package/api/theme/theme.type.mjs +7 -1
  81. package/api/theme-edit/_adapter.d.mts +55 -0
  82. package/api/theme-edit/_adapter.mjs +673 -42
  83. package/api/theme-edit/_check.d.mts +28 -22
  84. package/api/theme-edit/_check.mjs +1858 -312
  85. package/api/theme-edit/_color.d.mts +10 -0
  86. package/api/theme-edit/_color.mjs +49 -1
  87. package/api/theme-edit/_compiler.mjs +9 -0
  88. package/api/theme-edit/_context.mjs +60 -3
  89. package/api/theme-edit/_css.mjs +21 -1
  90. package/api/theme-edit/_edit.d.mts +22 -0
  91. package/api/theme-edit/_edit.mjs +1533 -92
  92. package/api/theme-edit/_how-commands.d.mts +57 -0
  93. package/api/theme-edit/_how-commands.mjs +587 -1
  94. package/api/theme-edit/_how-question.d.mts +78 -0
  95. package/api/theme-edit/_how-question.mjs +4716 -235
  96. package/api/theme-edit/_how.mjs +134 -8
  97. package/api/theme-edit/_marks.d.mts +31 -5
  98. package/api/theme-edit/_marks.mjs +57 -5
  99. package/api/theme-edit/_normal.d.mts +219 -0
  100. package/api/theme-edit/_normal.mjs +1041 -0
  101. package/api/theme-edit/_palette.mjs +10 -4
  102. package/api/theme-edit/_parts.d.mts +8 -0
  103. package/api/theme-edit/_parts.mjs +103 -2
  104. package/api/theme-edit/_playwright-picture.d.mts +4 -0
  105. package/api/theme-edit/_playwright-picture.mjs +34 -0
  106. package/api/theme-edit/_preview-app.d.mts +7 -1
  107. package/api/theme-edit/_preview-app.mjs +394 -74
  108. package/api/theme-edit/_preview.d.mts +69 -8
  109. package/api/theme-edit/_preview.mjs +531 -108
  110. package/api/theme-edit/_settings.d.mts +243 -6
  111. package/api/theme-edit/_settings.mjs +2415 -147
  112. package/api/theme-edit/_tables.d.mts +6 -0
  113. package/api/theme-edit/_tables.mjs +44 -1
  114. package/api/theme-edit/_vet.d.mts +18 -0
  115. package/api/theme-edit/_vet.mjs +32 -0
  116. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  117. package/api/theme-edit/theme-edit.type.mjs +4 -1
  118. package/api/theme-edit/themeEditHow.doc.mjs +1 -1
  119. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  120. package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
  121. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
  122. package/api/upgrade/run/run.mjs +4 -3
  123. package/assets/codemods/integration-discovery.mjs +2 -1
  124. package/assets/codemods/run-codemod.mjs +87 -7
  125. package/assets/codemods/transforms/next/index.mjs +11 -1
  126. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
  127. package/assets/component-list.generated.json +1 -0
  128. package/assets/docs/author-a-theme.doc.mjs +1 -0
  129. package/assets/docs/theme.doc.dense.mjs +2 -2
  130. package/assets/docs/theme.doc.mjs +1 -1
  131. package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
  132. package/assets/docs/tree/checks.doc.mjs +1 -1
  133. package/assets/docs/tree/cli-command.doc.mjs +2 -3
  134. package/assets/docs/tree/render-pages.doc.mjs +44 -3
  135. package/assets/docs/tree/single-component.doc.mjs +4 -0
  136. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  137. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  138. package/assets/docs/use-a-theme.doc.mjs +1 -1
  139. package/assets/docs.generated.json +2 -2
  140. package/assets/self-audit.generated.json +1 -1
  141. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
  142. package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
  143. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
  144. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
  145. package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
  146. package/assets/templates/components.generated.json +1 -1
  147. package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
  148. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
  149. package/assets/templates/pages/blank/template.doc.mjs +1 -1
  150. package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
  151. package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
  152. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
  153. package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
  154. package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
  155. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
  156. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
  157. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
  158. package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
  159. package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
  160. package/assets/templates/pages/documentation/template.doc.mjs +4 -1
  161. package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
  162. package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
  163. package/assets/templates/pages/editor/template.doc.mjs +2 -8
  164. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
  165. package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
  166. package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
  167. package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
  168. package/assets/templates/pages/ide/page.tsx +24 -2
  169. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
  170. package/assets/templates/pages/library/template.doc.mjs +4 -1
  171. package/assets/templates/pages/login/template.doc.mjs +2 -1
  172. package/assets/templates/pages/login-card/template.doc.mjs +2 -1
  173. package/assets/templates/pages/login-split/template.doc.mjs +2 -1
  174. package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
  175. package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
  176. package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
  177. package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
  178. package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
  179. package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
  180. package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
  181. package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
  182. package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
  183. package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
  184. package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
  185. package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
  186. package/assets/templates/pages/table-page/template.doc.mjs +5 -4
  187. package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
  188. package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
  189. package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
  190. package/assets/theme.template.ts +6 -0
  191. package/authoring/debug/parse.d.mts +3 -3
  192. package/authoring/doctypes/_schema.d.mts +3 -3
  193. package/authoring/doctypes/command/command.doc.mjs +1 -1
  194. package/authoring/doctypes/component/categories.d.mts +37 -0
  195. package/authoring/doctypes/component/categories.mjs +54 -0
  196. package/authoring/doctypes/template/template.doc.mjs +1 -1
  197. package/authoring/doctypes/template/type.ts +9 -0
  198. package/authoring/example/example.doc.d.mts +12 -0
  199. package/authoring/example/example.doc.mjs +69 -0
  200. package/authoring/example/preview.d.mts +92 -0
  201. package/authoring/example/preview.mjs +994 -0
  202. package/authoring/example/type.ts +102 -0
  203. package/authoring/index.d.mts +1 -0
  204. package/authoring/index.d.ts +12 -0
  205. package/authoring/index.mjs +3 -1
  206. package/clients/cli/bin/astryx.mjs +6 -9
  207. package/clients/cli/build-id.generated.json +1 -1
  208. package/clients/cli/commands/component.doc.mjs +1 -1
  209. package/clients/cli/commands/component.mjs +22 -3
  210. package/clients/cli/commands/docs.doc.mjs +7 -1
  211. package/clients/cli/commands/docs.mjs +3 -1
  212. package/clients/cli/commands/doctor.mjs +32 -14
  213. package/clients/cli/commands/experimental/render.mjs +42 -1
  214. package/clients/cli/commands/experimental/theme.mjs +145 -16
  215. package/clients/cli/commands/experimental-render.doc.mjs +2 -2
  216. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  217. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
  218. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
  219. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  220. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  221. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  222. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  223. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  224. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  225. package/clients/cli/commands/search.doc.mjs +2 -1
  226. package/clients/cli/commands/search.mjs +6 -1
  227. package/clients/cli/commands/template.mjs +4 -2
  228. package/clients/cli/commands/theme-build.doc.mjs +5 -1
  229. package/clients/cli/commands/theme.doc.mjs +1 -1
  230. package/clients/cli/commands/theme.mjs +183 -6
  231. package/clients/cli/commands/upgrade.mjs +42 -7
  232. package/clients/cli/index.mjs +1 -1
  233. package/clients/cli/lib/cli-error.mjs +2 -1
  234. package/clients/cli/lib/component-format.mjs +205 -98
  235. package/clients/cli/lib/hook-format.mjs +9 -19
  236. package/clients/cli/lib/json-shim.mjs +77 -21
  237. package/clients/cli/lib/manifest.mjs +3 -2
  238. package/clients/cli/manifest.generated.json +1 -1
  239. package/foundation/agent-docs/agent-docs.mjs +1 -1
  240. package/foundation/config/theme-state.d.mts +13 -1
  241. package/foundation/config/theme-state.mjs +47 -7
  242. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  243. package/foundation/discovery/component-discovery.d.mts +11 -0
  244. package/foundation/discovery/component-discovery.mjs +56 -8
  245. package/foundation/discovery/component-replacement.mjs +130 -1
  246. package/foundation/discovery/copied-passages.mjs +2 -1
  247. package/foundation/discovery/doc-types.mjs +4 -3
  248. package/foundation/discovery/entry-name-files.d.mts +43 -0
  249. package/foundation/discovery/entry-name-files.mjs +264 -0
  250. package/foundation/discovery/hook-discovery.d.mts +8 -2
  251. package/foundation/discovery/hook-discovery.mjs +22 -8
  252. package/foundation/discovery/icon-definition-discovery.mjs +2 -1
  253. package/foundation/discovery/icon-set-checks.mjs +2 -1
  254. package/foundation/discovery/icon-set-discovery.mjs +2 -1
  255. package/foundation/discovery/integration-doc-files.mjs +2 -1
  256. package/foundation/discovery/package-exports.d.mts +10 -0
  257. package/foundation/discovery/package-exports.mjs +56 -3
  258. package/foundation/discovery/prop-drift.mjs +9 -9
  259. package/foundation/discovery/runner-allowlist.d.mts +1 -0
  260. package/foundation/discovery/runner-allowlist.mjs +2 -0
  261. package/foundation/discovery/stored-component-list.d.mts +43 -0
  262. package/foundation/discovery/stored-component-list.mjs +90 -0
  263. package/foundation/discovery/stored-self-audit.d.mts +26 -10
  264. package/foundation/discovery/stored-self-audit.mjs +38 -18
  265. package/foundation/discovery/template-adapter.d.mts +52 -0
  266. package/foundation/discovery/template-adapter.mjs +176 -12
  267. package/foundation/discovery/template-icons.mjs +2 -1
  268. package/foundation/discovery/theme-discovery.mjs +3 -2
  269. package/foundation/discovery/theme-imports.d.mts +14 -0
  270. package/foundation/discovery/theme-imports.mjs +43 -1
  271. package/foundation/discovery/theming-targets.mjs +3 -2
  272. package/foundation/doc-compiler/import.mjs +7 -1
  273. package/foundation/doc-compiler/inputs.mjs +3 -2
  274. package/foundation/doc-compiler/parse-readable.mjs +4 -1
  275. package/foundation/doc-compiler/stored-docs.d.mts +22 -0
  276. package/foundation/doc-compiler/stored-docs.mjs +49 -0
  277. package/foundation/env/semver.mjs +3 -1
  278. package/foundation/fonts/font-stylesheet.d.mts +31 -0
  279. package/foundation/fonts/font-stylesheet.mjs +115 -0
  280. package/foundation/fs/cache-eviction.d.mts +21 -0
  281. package/foundation/fs/cache-eviction.mjs +73 -0
  282. package/foundation/fs/file-protection.mjs +4 -3
  283. package/foundation/fs/gather-cache.d.mts +25 -4
  284. package/foundation/fs/gather-cache.mjs +164 -55
  285. package/foundation/fs/jiti-cache.d.mts +19 -1
  286. package/foundation/fs/jiti-cache.mjs +130 -6
  287. package/foundation/fs/kept-tree.d.mts +60 -0
  288. package/foundation/fs/kept-tree.mjs +154 -0
  289. package/foundation/fs/listing-cache.d.mts +7 -0
  290. package/foundation/fs/listing-cache.mjs +10 -0
  291. package/foundation/fs/module-loader.d.mts +24 -2
  292. package/foundation/fs/module-loader.mjs +94 -21
  293. package/foundation/fs/paths.d.mts +18 -0
  294. package/foundation/fs/paths.mjs +15 -2
  295. package/foundation/identity/provider-identity.d.mts +6 -0
  296. package/foundation/identity/provider-identity.mjs +10 -1
  297. package/foundation/integrations/contribution-inventory.mjs +4 -3
  298. package/foundation/integrations/example-code.d.mts +63 -0
  299. package/foundation/integrations/example-code.mjs +416 -0
  300. package/foundation/integrations/public-imports.d.mts +9 -0
  301. package/foundation/integrations/public-imports.mjs +3 -2
  302. package/foundation/integrations/validate-contributions.mjs +17 -45
  303. package/foundation/render/embedded-files.d.mts +6 -0
  304. package/foundation/render/embedded-files.mjs +25 -5
  305. package/foundation/render/embedded-imports.d.mts +39 -7
  306. package/foundation/render/embedded-imports.mjs +66 -27
  307. package/foundation/render/file-header.d.mts +66 -0
  308. package/foundation/render/file-header.mjs +118 -0
  309. package/foundation/render/host-answer.d.mts +18 -0
  310. package/foundation/render/host-answer.mjs +46 -0
  311. package/foundation/render/host-exit.d.mts +1 -0
  312. package/foundation/render/host-exit.mjs +6 -1
  313. package/foundation/render/html-reader.d.mts +55 -2
  314. package/foundation/render/html-reader.mjs +145 -26
  315. package/foundation/render/markup-edits.d.mts +57 -0
  316. package/foundation/render/markup-edits.mjs +182 -0
  317. package/foundation/render/page-host.mjs +29 -12
  318. package/foundation/render/page-worker.mjs +121 -13
  319. package/foundation/render/rebuild.mjs +2 -1
  320. package/foundation/render/render-page.d.mts +35 -3
  321. package/foundation/render/render-page.mjs +316 -42
  322. package/foundation/render/source-block.d.mts +85 -6
  323. package/foundation/render/source-block.mjs +211 -20
  324. package/foundation/render/ts-paths.d.mts +69 -6
  325. package/foundation/render/ts-paths.mjs +326 -40
  326. package/foundation/response/error-codes.d.mts +3 -1
  327. package/foundation/response/error-codes.d.ts +1 -0
  328. package/foundation/response/error-codes.doc.mjs +12 -1
  329. package/foundation/response/error-codes.mjs +11 -1
  330. package/foundation/response/response-types.doc.mjs +2 -2
  331. package/foundation/text/compare-text.d.mts +14 -0
  332. package/foundation/text/compare-text.mjs +68 -0
  333. package/foundation/text/string-utils.d.mts +3 -2
  334. package/foundation/text/string-utils.mjs +18 -4
  335. package/foundation/text/suggest-order.d.mts +9 -0
  336. package/foundation/text/suggest-order.mjs +15 -1
  337. package/foundation/xle/expand.mjs +2 -1
  338. package/host/index.mjs +8 -6
  339. package/package.json +7 -6
@@ -22,7 +22,9 @@ import {
22
22
  resolveImportPath,
23
23
  resolveIntegrationImportPath,
24
24
  } from '../../../foundation/discovery/component-discovery.mjs';
25
- import {discoverExternalPackages} from '../../../foundation/fs/paths.mjs';
25
+ import {EXACT_CODEC} from '../../../foundation/fs/exact-codec.mjs';
26
+ import {persistedGather} from '../../../foundation/fs/gather-cache.mjs';
27
+ import {CLI_ROOT, discoverExternalPackages, realDir} from '../../../foundation/fs/paths.mjs';
26
28
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
27
29
  import {AstryxError} from '../../error.mjs';
28
30
  import {
@@ -31,6 +33,7 @@ import {
31
33
  loadIntegrationsSafely,
32
34
  withOwnership,
33
35
  } from '../_adapter.mjs';
36
+ import {compareText} from '../../../foundation/text/compare-text.mjs';
34
37
 
35
38
  /**
36
39
  * @typedef {import('../component.type.mjs').ComponentListResponse} ComponentListResponse
@@ -162,10 +165,49 @@ async function replacementEntry(replacement, detail, {zh, dense, lang}) {
162
165
  * @param {string|null} opts.lang
163
166
  * @returns {Promise<ComponentListResponse>}
164
167
  */
165
- export async function componentList(
166
- coreDir,
167
- {cwd, category, detail, zh, dense, lang},
168
- ) {
168
+ export async function componentList(coreDir, opts) {
169
+ const {cwd, category, detail, zh, dense, lang} = opts;
170
+ // A function of the files it reads (Core's component folders and docs, the
171
+ // integrations and their docs), which the kept gather stamps: a later run
172
+ // with every one unchanged reads the list back.
173
+ return /** @type {ComponentListResponse} */ (
174
+ await persistedGather(
175
+ [
176
+ 'component-list',
177
+ realDir(cwd),
178
+ coreDir,
179
+ CLI_ROOT,
180
+ category ?? null,
181
+ detail,
182
+ zh,
183
+ dense,
184
+ lang,
185
+ ],
186
+ () => componentListNow(coreDir, opts),
187
+ COMPONENT_LIST_CODEC,
188
+ )
189
+ );
190
+ }
191
+
192
+ /** The component list, kept exactly, with the envelope's shape. */
193
+ const COMPONENT_LIST_CODEC = {
194
+ ...EXACT_CODEC,
195
+ valid: (/** @type {any} */ value) =>
196
+ value != null &&
197
+ value.type === 'component.list' &&
198
+ value.data != null &&
199
+ typeof value.data.detail === 'string' &&
200
+ value.data.components != null &&
201
+ typeof value.data.components === 'object',
202
+ };
203
+
204
+ /**
205
+ * componentList, worked out now.
206
+ * @param {string} coreDir
207
+ * @param {Parameters<typeof componentList>[1]} options
208
+ * @returns {Promise<ComponentListResponse>}
209
+ */
210
+ async function componentListNow(coreDir, {cwd, category, detail, zh, dense, lang}) {
169
211
  const components = discoverComponents(coreDir);
170
212
  // An active integration replacement takes its Core component's slot in
171
213
  // every list view (spec:AST-035 FR11); the Core original stays reachable
@@ -429,7 +471,7 @@ export async function componentList(
429
471
  });
430
472
  }
431
473
  for (const [key, members] of byGroup) {
432
- members.sort((a, b) => a.name.localeCompare(b.name));
474
+ members.sort((a, b) => compareText(a.name, b.name));
433
475
  listData[key] = members;
434
476
  }
435
477
  }
@@ -216,7 +216,7 @@ export const OFFICIAL_LIST_FILE: string;
216
216
  */
217
217
  export const EXPERIMENTAL_KINDS: readonly ["icon-set"];
218
218
  /** The item kinds every project reads: the catalog kinds, less experimental ones. */
219
- export const STABLE_KINDS: ("template" | "component" | "doc" | "theme" | "codemod" | "agent-doc" | "icon-set")[];
219
+ export const STABLE_KINDS: ("component" | "template" | "doc" | "theme" | "codemod" | "agent-doc" | "icon-set")[];
220
220
  /** The list and detail entry fields for each item kind, in display order. */
221
221
  export const KIND_FIELDS: readonly [readonly ["component", "components"], readonly ["template", "templates"], readonly ["doc", "docs"], readonly ["theme", "themes"], readonly ["codemod", "codemods"], readonly ["agent-doc", "agentDocs"], readonly ["icon-set", "iconSets"]];
222
222
  export type ScannedPackage = import("./_package-scanner.mjs").ScannedPackage;
@@ -24,6 +24,7 @@ import {levenshteinDistance} from '../../../foundation/text/string-utils.mjs';
24
24
  import {AstryxError} from '../../error.mjs';
25
25
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
26
26
  import {DISCOVER_KINDS} from '../../../authoring/discover/parse.mjs';
27
+ import {compareText} from '../../../foundation/text/compare-text.mjs';
27
28
 
28
29
  /**
29
30
  * @typedef {import('../_package-scanner.mjs').ScannedPackage} ScannedPackage
@@ -131,8 +132,8 @@ export async function search(packages, query, opts) {
131
132
  a.score - b.score ||
132
133
  Number(b.item.installed) - Number(a.item.installed) ||
133
134
  KIND_ORDER.indexOf(a.item.kind) - KIND_ORDER.indexOf(b.item.kind) ||
134
- a.item.package.localeCompare(b.item.package) ||
135
- a.item.name.localeCompare(b.item.name),
135
+ compareText(a.item.package, b.item.package) ||
136
+ compareText(a.item.name, b.item.name),
136
137
  );
137
138
 
138
139
  if (ranked.length > 0) {
@@ -366,12 +366,36 @@ export function routeOwner(tree: DocsTree, entry: import("../../foundation/disco
366
366
  * Otherwise it suggests the docs the argument names in another spelling, or
367
367
  * failing that the topics and top-level namespaces, closest first and cut
368
368
  * where the matches get weaker (every one of them when none shares a word
369
- * with the argument).
369
+ * with the argument). When the argument is the name of a component, hook or
370
+ * template, the command that reads that entry comes first and takes the last
371
+ * suggestion's place, so the list keeps its length; when no suggested doc
372
+ * shares a word with the argument, that command is the only suggestion.
370
373
  * @param {unknown} topic
371
374
  * @param {DocsCatalog} catalog
375
+ * @param {{cwd?: string}} [options]
372
376
  * @returns {Promise<AstryxError>}
373
377
  */
374
- export function unknownTopicError(topic: unknown, catalog: DocsCatalog): Promise<AstryxError>;
378
+ export function unknownTopicError(topic: unknown, catalog: DocsCatalog, { cwd }?: {
379
+ cwd?: string;
380
+ }): Promise<AstryxError>;
381
+ /**
382
+ * The command that reads the component, hook or template a docs argument
383
+ * names, or null. Only an exact name counts, in any case and with or without
384
+ * spaces and hyphens; a hook also answers to its name without `use`. A
385
+ * component wins over a hook, and a hook over a template. A route never names
386
+ * one of them.
387
+ * @param {string} topic
388
+ * @param {{components?: string[], hooks?: string[], templates?: string[]}} names
389
+ * @returns {{name: string, reason: string} | null}
390
+ */
391
+ export function entryCommand(topic: string, { components, hooks, templates }: {
392
+ components?: string[];
393
+ hooks?: string[];
394
+ templates?: string[];
395
+ }): {
396
+ name: string;
397
+ reason: string;
398
+ } | null;
375
399
  /**
376
400
  * A sentence naming the packages whose docs did not load, or nothing: a doc
377
401
  * that fails to load withdraws its package's docs, so a reader who cannot
@@ -68,23 +68,46 @@ import {
68
68
  import {CLI_PROVIDER_ID} from '../../foundation/identity/providers.mjs';
69
69
  import {
70
70
  CORE_PACKAGE,
71
+ discoverComponentNamesWhere,
72
+ discoverIntegrationComponents,
71
73
  discoverOwnedComponents,
72
74
  discoverValidIntegrationComponents,
73
75
  } from '../../foundation/discovery/component-discovery.mjs';
74
76
  import {loadComponentDoc} from '../../foundation/discovery/component-loader.mjs';
75
77
  import {
78
+ coreFilesNaming,
79
+ foldEntryName,
80
+ integrationsFilesNaming,
81
+ } from '../../foundation/discovery/entry-name-files.mjs';
82
+ import {getAllHookNames} from '../../foundation/discovery/hook-discovery.mjs';
83
+ import {
84
+ coreTemplateIds,
76
85
  discoverCoreTemplates,
77
86
  discoverIntegrationTemplatesForOne,
87
+ integrationsMayReplaceTemplate,
88
+ listTemplates,
89
+ templateFilesNaming,
78
90
  } from '../../foundation/discovery/template-adapter.mjs';
79
91
  import {findCoreDir} from '../../foundation/fs/paths.mjs';
80
92
  import {reusedWhileUnchanged} from '../../foundation/fs/read-record.mjs';
81
93
  import {AstryxError} from '../error.mjs';
82
94
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
83
- import {orderRouteSuggestions} from '../../foundation/text/suggest-order.mjs';
95
+ import {
96
+ carriesTypedWord,
97
+ orderRouteSuggestions,
98
+ } from '../../foundation/text/suggest-order.mjs';
84
99
  import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
100
+ import {compareText} from '../../foundation/text/compare-text.mjs';
85
101
 
86
102
  export {OVERLAY_LANGUAGES, overlayLanguages};
87
103
 
104
+ /**
105
+ * The project each loaded catalog came from, so a later step of the same read
106
+ * does not load the project again.
107
+ * @type {WeakMap<DocsCatalog, Project>}
108
+ */
109
+ const projectOfCatalog = new WeakMap();
110
+
88
111
  /**
89
112
  * The project's topics: the built-in ones plus whatever the configured
90
113
  * integrations contribute.
@@ -101,7 +124,9 @@ export {OVERLAY_LANGUAGES, overlayLanguages};
101
124
  export async function loadDocsCatalog(cwd = process.cwd()) {
102
125
  try {
103
126
  const project = await Project.load(cwd);
104
- return await project.docs();
127
+ const catalog = await project.docs();
128
+ projectOfCatalog.set(catalog, project);
129
+ return catalog;
105
130
  } catch {
106
131
  return DocsCatalog.fromBuiltins();
107
132
  }
@@ -1932,12 +1957,16 @@ function movedRoute(topic, tree) {
1932
1957
  * Otherwise it suggests the docs the argument names in another spelling, or
1933
1958
  * failing that the topics and top-level namespaces, closest first and cut
1934
1959
  * where the matches get weaker (every one of them when none shares a word
1935
- * with the argument).
1960
+ * with the argument). When the argument is the name of a component, hook or
1961
+ * template, the command that reads that entry comes first and takes the last
1962
+ * suggestion's place, so the list keeps its length; when no suggested doc
1963
+ * shares a word with the argument, that command is the only suggestion.
1936
1964
  * @param {unknown} topic
1937
1965
  * @param {DocsCatalog} catalog
1966
+ * @param {{cwd?: string}} [options]
1938
1967
  * @returns {Promise<AstryxError>}
1939
1968
  */
1940
- export async function unknownTopicError(topic, catalog) {
1969
+ export async function unknownTopicError(topic, catalog, {cwd} = {}) {
1941
1970
  const tree = await projectTree(catalog);
1942
1971
  /** @type {Array<{name: string, reason: string}>} */
1943
1972
  let suggestions = [];
@@ -1975,7 +2004,10 @@ export async function unknownTopicError(topic, catalog) {
1975
2004
  )
1976
2005
  .map(node => ({name: node.route, reason: node.summary}));
1977
2006
  }
2007
+ // Every topic and namespace: the list a name no doc shares a word with gets.
2008
+ let everyDoc = false;
1978
2009
  if (suggestions.length === 0) {
2010
+ everyDoc = true;
1979
2011
  suggestions = [
1980
2012
  ...tree
1981
2013
  .roots()
@@ -2001,6 +2033,16 @@ export async function unknownTopicError(topic, catalog) {
2001
2033
  ERROR_CODES.ERR_UNKNOWN_TOPIC,
2002
2034
  );
2003
2035
  }
2036
+ const elsewhere =
2037
+ suggestions.length > 0 ? await entryElsewhere(topic, catalog, cwd) : null;
2038
+ if (elsewhere) {
2039
+ const sharesAWord =
2040
+ !everyDoc ||
2041
+ suggestions.some(entry => carriesTypedWord(String(topic), entry.name));
2042
+ suggestions = sharesAWord
2043
+ ? [elsewhere, ...suggestions.slice(0, -1)]
2044
+ : [elsewhere];
2045
+ }
2004
2046
  return new AstryxError(
2005
2047
  `Unknown topic "${String(topic)}"${notLoaded(catalog)}`,
2006
2048
  suggestions,
@@ -2008,6 +2050,177 @@ export async function unknownTopicError(topic, catalog) {
2008
2050
  );
2009
2051
  }
2010
2052
 
2053
+ /**
2054
+ * The command that reads the component, hook or template a docs argument
2055
+ * names, or null. Only an exact name counts, in any case and with or without
2056
+ * spaces and hyphens; a hook also answers to its name without `use`. A
2057
+ * component wins over a hook, and a hook over a template. A route never names
2058
+ * one of them.
2059
+ * @param {string} topic
2060
+ * @param {{components?: string[], hooks?: string[], templates?: string[]}} names
2061
+ * @returns {{name: string, reason: string} | null}
2062
+ */
2063
+ export function entryCommand(
2064
+ topic,
2065
+ {components = [], hooks = [], templates = []},
2066
+ ) {
2067
+ if (topic.includes('/')) return null;
2068
+ const wanted = foldEntryName(topic);
2069
+ if (wanted === '') return null;
2070
+ const component = components.find(name => foldEntryName(name) === wanted);
2071
+ if (component) {
2072
+ return {
2073
+ name: `astryx component ${component}`,
2074
+ reason: 'a component, not a docs topic',
2075
+ };
2076
+ }
2077
+ const hook = hooks.find(name => {
2078
+ const folded = foldEntryName(name);
2079
+ return folded === wanted || folded === `use${wanted}`;
2080
+ });
2081
+ if (hook) {
2082
+ return {name: `astryx hook ${hook}`, reason: 'a hook, not a docs topic'};
2083
+ }
2084
+ const template = templates.find(name => foldEntryName(name) === wanted);
2085
+ if (template) {
2086
+ return {
2087
+ name: `astryx template ${template}`,
2088
+ reason: 'a template, not a docs topic',
2089
+ };
2090
+ }
2091
+ return null;
2092
+ }
2093
+
2094
+ /**
2095
+ * {@link entryCommand} over the names the project's catalogs hold. File names
2096
+ * and doc text say first which catalogs can hold the argument; a catalog is
2097
+ * asked only then, only for the names that fold to the argument, and only
2098
+ * when the one before it has no match. So a name no file carries reads no doc.
2099
+ * A check that fails gives no hint.
2100
+ * @param {unknown} topic
2101
+ * @param {DocsCatalog} catalog the catalog the read used; its project is
2102
+ * reused
2103
+ * @param {string} [cwd]
2104
+ * @returns {Promise<{name: string, reason: string} | null>}
2105
+ */
2106
+ async function entryElsewhere(topic, catalog, cwd = process.cwd()) {
2107
+ if (typeof topic !== 'string' || topic.includes('/')) return null;
2108
+ const wanted = foldEntryName(topic);
2109
+ if (wanted === '') return null;
2110
+ let project = projectOfCatalog.get(catalog);
2111
+ try {
2112
+ project ??= await Project.load(cwd);
2113
+ } catch {
2114
+ return null;
2115
+ }
2116
+ const coreDir = project.coreDir();
2117
+ const integrations = project.loadedIntegrations;
2118
+ /** @param {string} name */
2119
+ const isWanted = name => foldEntryName(name) === wanted;
2120
+ /** @param {string} name */
2121
+ const isWantedHook = name =>
2122
+ isWanted(name) || foldEntryName(name) === `use${wanted}`;
2123
+ /** @type {{component: boolean, hook: boolean, componentTops?: Set<string>, hookTops?: Set<string>}} */
2124
+ let inCore = {component: false, hook: false};
2125
+ try {
2126
+ if (coreDir) inCore = coreFilesNaming(coreDir, wanted);
2127
+ } catch {
2128
+ inCore = {component: true, hook: true};
2129
+ }
2130
+ /** @type {Array<() => Promise<{components?: string[], hooks?: string[], templates?: string[]}>>} */
2131
+ const catalogs = [
2132
+ async () => ({
2133
+ components:
2134
+ coreDir && inCore.component
2135
+ ? discoverComponentNamesWhere(coreDir, isWanted, inCore.componentTops)
2136
+ : [],
2137
+ }),
2138
+ async () => ({
2139
+ components: await integrationComponentNames(
2140
+ integrations,
2141
+ wanted,
2142
+ isWanted,
2143
+ ),
2144
+ }),
2145
+ async () => ({
2146
+ hooks:
2147
+ coreDir && inCore.hook
2148
+ ? getAllHookNames(coreDir, isWantedHook, inCore.hookTops)
2149
+ : [],
2150
+ }),
2151
+ async () => ({
2152
+ templates: await templateNames(project, integrations, wanted),
2153
+ }),
2154
+ ];
2155
+ for (const load of catalogs) {
2156
+ let names;
2157
+ try {
2158
+ names = await load();
2159
+ } catch {
2160
+ continue;
2161
+ }
2162
+ const found = entryCommand(topic, names);
2163
+ if (found) return found;
2164
+ }
2165
+ return null;
2166
+ }
2167
+
2168
+ /**
2169
+ * The names `isWanted` accepts among the valid components of the loaded
2170
+ * integrations, in project order. Only an integration whose files can carry
2171
+ * the name is read, and it loads its docs only when it lists such a name.
2172
+ * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} integrations
2173
+ * @param {string} wanted the folded name
2174
+ * @param {(name: string) => boolean} isWanted
2175
+ * @returns {Promise<string[]>}
2176
+ */
2177
+ async function integrationComponentNames(integrations, wanted, isWanted) {
2178
+ const naming = integrationsFilesNaming(
2179
+ integrations.map(integration => integration.components),
2180
+ wanted,
2181
+ );
2182
+ for (const [at, integration] of integrations.entries()) {
2183
+ if (!naming[at]) continue;
2184
+ if (!discoverIntegrationComponents(integration).some(r => isWanted(r.name)))
2185
+ continue;
2186
+ const {components} = await discoverValidIntegrationComponents(integration);
2187
+ const names = components.map(r => r.name).filter(isWanted);
2188
+ if (names.length > 0) return names;
2189
+ }
2190
+ return [];
2191
+ }
2192
+
2193
+ /**
2194
+ * The template ids that fold to `wanted`, as the project's template list
2195
+ * holds them. Core's ids come from file names. The whole list loads only when
2196
+ * an integration ships a template doc with such an id, when more than one
2197
+ * Core id folds to it (the list decides their order), or when one does and
2198
+ * an integration template may replace it.
2199
+ * @param {Project} project
2200
+ * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} integrations
2201
+ * @param {string} wanted the folded name
2202
+ * @returns {Promise<string[]>}
2203
+ */
2204
+ async function templateNames(project, integrations, wanted) {
2205
+ /** @param {string} name */
2206
+ const isWanted = name => foldEntryName(name) === wanted;
2207
+ const {blocks, listed} = templateFilesNaming(integrations, wanted);
2208
+ const core = blocks
2209
+ ? coreTemplateIds(isWanted)
2210
+ : listTemplates().filter(isWanted);
2211
+ if (
2212
+ !listed &&
2213
+ core.length < 2 &&
2214
+ (core.length === 0 || !integrationsMayReplaceTemplate(integrations))
2215
+ ) {
2216
+ return core;
2217
+ }
2218
+ return /** @type {Array<{dirName?: unknown}>} */ (await project.templates())
2219
+ .map(record => record.dirName)
2220
+ .filter(name => typeof name === 'string')
2221
+ .filter(isWanted);
2222
+ }
2223
+
2011
2224
  /**
2012
2225
  * A sentence naming the packages whose docs did not load, or nothing: a doc
2013
2226
  * that fails to load withdraws its package's docs, so a reader who cannot
@@ -2041,7 +2254,7 @@ export async function resolveTopicDocs(topic, options = {}, loaded) {
2041
2254
  undefined,
2042
2255
  ERROR_CODES.ERR_UNKNOWN_TOPIC,
2043
2256
  )
2044
- : await unknownTopicError(topic, found.catalog);
2257
+ : await unknownTopicError(topic, found.catalog, {cwd});
2045
2258
  }
2046
2259
  const {catalog, entry} = found;
2047
2260
  const node = await lowerTopic(catalog, entry, effectiveLang);
@@ -2081,6 +2294,6 @@ export async function integrationDocTypes(integration, cwd) {
2081
2294
  unchecked: [
2082
2295
  ...report.unchecked,
2083
2296
  ...unread.map(entry => ({doc: rel(entry.path), reason: entry.reason})),
2084
- ].sort((a, b) => a.doc.localeCompare(b.doc)),
2297
+ ].sort((a, b) => compareText(a.doc, b.doc)),
2085
2298
  };
2086
2299
  }
@@ -8,6 +8,8 @@
8
8
  * @param {string} [options.lang]
9
9
  * @param {boolean} [options.zh]
10
10
  * @param {boolean} [options.dense]
11
+ * @param {boolean} [options.list] return the topic list, the same as giving
12
+ * no topic; docs() refuses a topic or section beside it
11
13
  * @param {boolean} [options.index] return the topic's section index instead of
12
14
  * the whole doc
13
15
  * @param {number | 'all'} [options.depth] how many levels below a docs-tree
@@ -27,6 +29,7 @@ export function docs(topic?: string, section?: string, options?: {
27
29
  lang?: string | undefined;
28
30
  zh?: boolean | undefined;
29
31
  dense?: boolean | undefined;
32
+ list?: boolean | undefined;
30
33
  index?: boolean | undefined;
31
34
  depth?: number | "all" | undefined;
32
35
  detail?: "compact" | "full" | "brief" | undefined;
@@ -78,6 +78,12 @@ export const doc = {
78
78
  description:
79
79
  'Return the token-efficient dense doc variant. It is written to be read whole, so it returns the whole doc.',
80
80
  },
81
+ {
82
+ name: 'options.list',
83
+ type: 'boolean',
84
+ description:
85
+ 'Return the topic list, the same as giving no topic. It takes no topic or section.',
86
+ },
81
87
  {
82
88
  name: 'options.index',
83
89
  type: 'boolean',
@@ -133,7 +139,7 @@ export const doc = {
133
139
  throws: [
134
140
  {
135
141
  code: 'ERR_INVALID_ARGUMENT',
136
- when: "depth is not a whole number of levels or 'all'",
142
+ when: "depth is not a whole number of levels or 'all', or list is set with a topic or section",
137
143
  },
138
144
  {
139
145
  code: 'ERR_INVALID_DETAIL',
package/api/docs/docs.mjs CHANGED
@@ -13,6 +13,9 @@
13
13
  * docs(route) -> node -> docs.node
14
14
  * docs(route, undefined, {depth: 2}) -> node -> docs.node, two levels
15
15
  *
16
+ * `list` names the list read. It is the same as no topic, so docs() refuses
17
+ * a topic or section beside it instead of dropping it.
18
+ *
16
19
  * A topic read returns the whole doc, as it always has; `index` returns its
17
20
  * sections, so a reader can open one by its key (spec:AST-047). The CLI's text
18
21
  * view lists the sections by default. A route names a node
@@ -114,6 +117,8 @@ function depthRead(options) {
114
117
  * @param {string} [options.lang]
115
118
  * @param {boolean} [options.zh]
116
119
  * @param {boolean} [options.dense]
120
+ * @param {boolean} [options.list] return the topic list, the same as giving
121
+ * no topic; docs() refuses a topic or section beside it
117
122
  * @param {boolean} [options.index] return the topic's section index instead of
118
123
  * the whole doc
119
124
  * @param {number | 'all'} [options.depth] how many levels below a docs-tree
@@ -148,6 +153,13 @@ export async function docs(topic, section, options = {}) {
148
153
  */
149
154
  async function docsRead(topic, section, options = {}) {
150
155
  const read = depthRead(options);
156
+ if (options.list && (topic || section)) {
157
+ throw new AstryxError(
158
+ 'Ask for the topic list or one topic, not both: --list takes no topic or section.',
159
+ undefined,
160
+ ERROR_CODES.ERR_INVALID_ARGUMENT,
161
+ );
162
+ }
151
163
  if (!topic) return list(options);
152
164
  const found = await resolveDocsArgument(topic, options);
153
165
  if (found.kind === 'node') {
@@ -376,6 +376,11 @@ export type DocsOptions = {
376
376
  lang?: string | undefined;
377
377
  zh?: boolean | undefined;
378
378
  dense?: boolean | undefined;
379
+ /**
380
+ * return the topic list, the same as giving no
381
+ * topic; docs() refuses a topic or section beside it
382
+ */
383
+ list?: boolean | undefined;
379
384
  /**
380
385
  * return a topic's section index instead of its
381
386
  * whole doc
@@ -245,6 +245,8 @@
245
245
  * @property {string} [lang]
246
246
  * @property {boolean} [zh]
247
247
  * @property {boolean} [dense]
248
+ * @property {boolean} [list] return the topic list, the same as giving no
249
+ * topic; docs() refuses a topic or section beside it
248
250
  * @property {boolean} [index] return a topic's section index instead of its
249
251
  * whole doc
250
252
  * @property {number | 'all'} [depth] how many levels below a docs-tree
@@ -295,7 +295,7 @@ export function typedEdges(tree, node) {
295
295
  export async function node(route, options = {}) {
296
296
  const found = await resolveDocsArgument(route, options);
297
297
  if (found.kind !== 'node')
298
- throw await unknownTopicError(route, found.catalog);
298
+ throw await unknownTopicError(route, found.catalog, options);
299
299
  return {
300
300
  type: 'docs.node',
301
301
  // The docs tree names each node's npm package as its provider.
@@ -5,19 +5,26 @@
5
5
  * A doctor check that reads only files, kept between runs through the kept
6
6
  * gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
7
7
  * folder, module and environment variable it read unchanged reads the check
8
- * back. Only the docs checks go through here; a check that depends on the
9
- * time, the network or anything else the stamps do not see never does.
8
+ * back. Only the docs checks and the theme-wiring scan go through here; a
9
+ * check that depends on the time, the network or anything else the stamps do
10
+ * not see never does.
10
11
  * @template T
11
12
  * @param {{name: string, cwd: string, coreDir: string | null}} where - The
12
13
  * check, the project folder, and the Core folder the project loads.
13
14
  * @param {() => Promise<T>} check
15
+ * @param {{encode: (value: any) => any, decode: (stored: any) => any, valid?: (value: any) => boolean}} [codec]
16
+ * How the value is kept: a check record unless given.
14
17
  * @returns {Promise<T>}
15
18
  */
16
19
  export function keptFileCheck<T>({ name, cwd, coreDir }: {
17
20
  name: string;
18
21
  cwd: string;
19
22
  coreDir: string | null;
20
- }, check: () => Promise<T>): Promise<T>;
23
+ }, check: () => Promise<T>, codec?: {
24
+ encode: (value: any) => any;
25
+ decode: (stored: any) => any;
26
+ valid?: (value: any) => boolean;
27
+ }): Promise<T>;
21
28
  /**
22
29
  * Package written to the generated app record for one discovered theme.
23
30
  * @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
@@ -88,6 +95,16 @@ export function doctorElementPropOrigins(file: string, element: Parameters<typeo
88
95
  * @returns {Set<string>}
89
96
  */
90
97
  export function doctorStylesheetImports(css: string): Set<string>;
98
+ /**
99
+ * The file a local stylesheet `@import` names, from the stylesheet that
100
+ * imports it: a relative path, or a package's file as Node resolves it
101
+ * (`@fontsource/inter/index.css`). Null for a URL (http, https, `//`) or an
102
+ * import that does not resolve.
103
+ * @param {string} specifier
104
+ * @param {string} fromFile
105
+ * @returns {string | null}
106
+ */
107
+ export function doctorStylesheetImportFile(specifier: string, fromFile: string): string | null;
91
108
  /**
92
109
  * The `@astryxdesign/core` range a package's peerDependencies declare, and
93
110
  * whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
@@ -284,7 +301,13 @@ export function builtIntegrationPackages(target: string, cwd: string): string[];
284
301
  export { placeholderFixes } from "../../foundation/discovery/template-icons.mjs";
285
302
  export { installCommandFor as packageInstallCommand } from "../../foundation/discovery/template-needs.mjs";
286
303
  export { resolveRecordedTheme } from "../theme/theme.mjs";
304
+ export { themeIdentifier } from "../theme/_fork.mjs";
287
305
  export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
306
+ export namespace THEME_WIRING_CODEC {
307
+ function encode(value: any): any;
308
+ function decode(value: any): any;
309
+ function valid(value: any): any;
310
+ }
288
311
  export const SOURCE_EXTENSIONS: Set<string>;
289
312
  export { displayHomePath };
290
313
  /** `doctor --built` reads at most this many files, of at most this size. */
@@ -299,6 +322,5 @@ import { stateLockHolder } from '../../foundation/release/global-state.mjs';
299
322
  import { displayHomePath } from '../../foundation/agent-docs/computer-agent-text.mjs';
300
323
  export { iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
301
324
  export { isLocalThemeOwner, planThemeAppWrite, readThemeState, resolveThemeModule } from "../../foundation/config/theme-state.mjs";
302
- export { GENERATED_MARKER, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
303
- export { APP_COPY_MARK, EDITOR_GENERATED_MARK } from "../theme-edit/_marks.mjs";
325
+ export { fileMark, generatedSourceCommand, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
304
326
  export { AUTHORING_AUDIT, authoringAudit, authoringAuditData } from "./_authoring-audit.mjs";