@astryxdesign/cli 0.7.2-canary.6d4f178 → 0.7.2-canary.72db6f9

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 (276) hide show
  1. package/README.md +74 -73
  2. package/api/build/help/help.mjs +1 -1
  3. package/api/component/_adapter.d.mts +31 -0
  4. package/api/component/_adapter.mjs +116 -0
  5. package/api/component/component.mjs +60 -10
  6. package/api/component/doc-links.test.mjs +386 -0
  7. package/api/discover/_adapter.d.mts +119 -12
  8. package/api/discover/_adapter.mjs +449 -10
  9. package/api/discover/_adapter.test.mjs +599 -17
  10. package/api/discover/_catalog-view.d.mts +16 -5
  11. package/api/discover/_catalog-view.mjs +32 -8
  12. package/api/discover/detail/doc/doc.mjs +9 -1
  13. package/api/discover/discover.d.mts +11 -0
  14. package/api/discover/discover.doc.mjs +7 -6
  15. package/api/discover/discover.mjs +107 -19
  16. package/api/discover/discover.type.d.mts +18 -7
  17. package/api/discover/discover.type.mjs +15 -7
  18. package/api/discover/list/list.d.mts +4 -3
  19. package/api/discover/list/list.mjs +17 -10
  20. package/api/docs/_adapter.d.mts +74 -0
  21. package/api/docs/_adapter.mjs +550 -14
  22. package/api/docs/integration-tree.test.mjs +22 -0
  23. package/api/docs/integrationDocs.test.mjs +124 -0
  24. package/api/docs/list/list.mjs +12 -2
  25. package/api/doctor/doctor.mjs +27 -3
  26. package/api/doctor/doctor.test.mjs +43 -0
  27. package/api/doctor/theme-checks.mjs +1 -1
  28. package/api/doctor/theme-checks.test.mjs +136 -0
  29. package/api/gap-report/gap-report.d.mts +3 -0
  30. package/api/gap-report/gap-report.doc.mjs +11 -3
  31. package/api/gap-report/gap-report.mjs +152 -48
  32. package/api/gap-report/gap-report.test.mjs +233 -0
  33. package/api/gap-report/gap-report.type.d.mts +41 -0
  34. package/api/gap-report/gap-report.type.mjs +18 -0
  35. package/api/index.d.mts +2 -0
  36. package/api/index.mjs +2 -0
  37. package/api/init/run/run.mjs +2 -2
  38. package/api/integration/_adapter.d.mts +45 -0
  39. package/api/integration/_adapter.mjs +112 -0
  40. package/api/integration/add-contribution.mjs +1 -1
  41. package/api/integration/add-contribution.test.mjs +4 -2
  42. package/api/integration/authoring-checks.mjs +108 -4
  43. package/api/integration/authoring-checks.test.mjs +808 -0
  44. package/api/integration/authoring-checks.type.d.mts +143 -0
  45. package/api/integration/authoring-checks.type.mjs +74 -2
  46. package/api/integration/check/check.d.mts +96 -0
  47. package/api/integration/check/check.mjs +357 -0
  48. package/api/integration/check/check.test.mjs +489 -0
  49. package/api/integration/integration-check.type.d.mts +118 -0
  50. package/api/integration/integration-check.type.mjs +84 -0
  51. package/api/integration/integrationCheck.doc.d.mts +10 -0
  52. package/api/integration/integrationCheck.doc.mjs +73 -0
  53. package/api/integration/integrationComponentConflicts.doc.mjs +45 -6
  54. package/api/integration/integrationDocConflicts.doc.mjs +22 -5
  55. package/api/integration/pack-check.mjs +296 -7
  56. package/api/integration/pack-check.test.mjs +367 -0
  57. package/api/integration/validate-integration-fixes.test.mjs +67 -0
  58. package/api/integration/validate-integration.mjs +36 -3
  59. package/api/integration/validate-integration.test.mjs +88 -8
  60. package/api/integration/validate-integration.type.d.mts +8 -0
  61. package/api/integration/validate-integration.type.mjs +12 -1
  62. package/api/integration/validateIntegration.doc.mjs +19 -3
  63. package/api/search/search.d.mts +72 -12
  64. package/api/search/search.domain-priority.test.mjs +108 -18
  65. package/api/search/search.integration-check.test.mjs +24 -0
  66. package/api/search/search.mjs +503 -38
  67. package/api/search/search.test.mjs +139 -0
  68. package/api/theme/build/build.family.test.mjs +54 -6
  69. package/api/theme/build/build.mjs +114 -17
  70. package/api/theme/themeBuild.doc.mjs +4 -4
  71. package/api/upgrade/_adapter.d.mts +40 -2
  72. package/api/upgrade/_adapter.mjs +117 -4
  73. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  74. package/api/upgrade/run/run.mjs +30 -1
  75. package/api/upgrade/status/status.d.mts +21 -5
  76. package/api/upgrade/status/status.mjs +45 -8
  77. package/api/upgrade/upgrade.doc.mjs +5 -3
  78. package/api/upgrade/upgrade.type.d.mts +23 -0
  79. package/api/upgrade/upgrade.type.mjs +16 -1
  80. package/assets/codemods/runner.mjs +7 -1
  81. package/assets/discover/official-packages.json +367 -0
  82. package/assets/docs/README.md +10 -0
  83. package/assets/docs/author-a-theme.doc.mjs +3 -3
  84. package/assets/docs/browser-support.doc.mjs +1 -1
  85. package/assets/docs/getting-started.doc.mjs +3 -3
  86. package/assets/docs/styling-overview.doc.mjs +1 -1
  87. package/assets/docs/theme.doc.dense.mjs +1 -1
  88. package/assets/docs/theme.doc.mjs +2 -2
  89. package/assets/docs/theme.doc.zh.mjs +1 -1
  90. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  91. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  92. package/assets/docs/tree/add-a-topic.doc.mjs +11 -8
  93. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  94. package/assets/docs/tree/block-template.doc.mjs +8 -20
  95. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  96. package/assets/docs/tree/check-the-props.doc.mjs +201 -0
  97. package/assets/docs/tree/check-your-docs.doc.mjs +65 -7
  98. package/assets/docs/tree/checks.doc.mjs +25 -17
  99. package/assets/docs/tree/codemods.doc.mjs +4 -4
  100. package/assets/docs/tree/component-family.doc.mjs +3 -5
  101. package/assets/docs/tree/component-imports.doc.mjs +2 -2
  102. package/assets/docs/tree/components.doc.mjs +1 -1
  103. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +30 -21
  104. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  105. package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
  106. package/assets/docs/tree/docs.doc.mjs +3 -3
  107. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  108. package/assets/docs/tree/document-the-theme.doc.mjs +3 -3
  109. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  110. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  111. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  112. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  113. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  114. package/assets/docs/tree/integrations.doc.mjs +8 -0
  115. package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
  116. package/assets/docs/tree/layout.doc.mjs +6 -6
  117. package/assets/docs/tree/links.doc.mjs +6 -5
  118. package/assets/docs/tree/migration-setup.doc.mjs +3 -2
  119. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  120. package/assets/docs/tree/migration.doc.mjs +0 -1
  121. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  122. package/assets/docs/tree/page-template.doc.mjs +4 -8
  123. package/assets/docs/tree/publishing.doc.mjs +4 -4
  124. package/assets/docs/tree/quick-start.doc.mjs +38 -22
  125. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  126. package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
  127. package/assets/docs/tree/sections-and-placement.doc.mjs +6 -8
  128. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  129. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  130. package/assets/docs/tree/single-component.doc.mjs +14 -5
  131. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  132. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  133. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  134. package/assets/docs/tree/template-doc-overview.doc.mjs +5 -16
  135. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  136. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  137. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  138. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  139. package/assets/docs/tree/templates.doc.mjs +1 -1
  140. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  141. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  142. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  143. package/assets/docs/tree/troubleshooting.doc.mjs +8 -8
  144. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  145. package/assets/docs/tree/upgrading.doc.mjs +4 -4
  146. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  147. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  148. package/assets/docs/tree/versioning.doc.mjs +6 -6
  149. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
  150. package/assets/docs/use-a-theme.doc.mjs +2 -2
  151. package/assets/theme.template.ts +1 -1
  152. package/authoring/codemod/codemod.doc.mjs +7 -3
  153. package/authoring/config/config.doc.mjs +9 -6
  154. package/authoring/config/type.ts +4 -2
  155. package/authoring/discover/discover.doc.mjs +1 -1
  156. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  157. package/authoring/doctypes/command/command.doc.mjs +14 -12
  158. package/authoring/doctypes/component/component.doc.mjs +29 -26
  159. package/authoring/doctypes/component/type.ts +15 -5
  160. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  161. package/authoring/doctypes/function/function.doc.mjs +9 -8
  162. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  163. package/authoring/doctypes/hook/type.ts +4 -0
  164. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  165. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  166. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  167. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  168. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  169. package/authoring/doctypes/template/parse.d.mts +6 -2
  170. package/authoring/doctypes/template/parse.mjs +3 -1
  171. package/authoring/doctypes/template/template.doc.mjs +3 -3
  172. package/authoring/doctypes/template/type.ts +22 -0
  173. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  174. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  175. package/authoring/identity/identity.doc.mjs +3 -3
  176. package/authoring/index.d.ts +1 -0
  177. package/authoring/integration/integration.doc.mjs +12 -4
  178. package/authoring/integration/parse.test.mjs +10 -0
  179. package/authoring/integration/schema.d.mts +2 -0
  180. package/authoring/integration/schema.mjs +1 -0
  181. package/authoring/integration/type.ts +4 -0
  182. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  183. package/clients/cli/commands/build-theme.mjs +1 -1
  184. package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
  185. package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
  186. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  187. package/clients/cli/commands/discover.doc.mjs +1 -1
  188. package/clients/cli/commands/discover.mjs +144 -93
  189. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  190. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  191. package/clients/cli/commands/doctor-integration-components.doc.mjs +18 -4
  192. package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
  193. package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
  194. package/clients/cli/commands/doctor-integration.test.mjs +884 -0
  195. package/clients/cli/commands/doctor.mjs +281 -5
  196. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  197. package/clients/cli/commands/gap-report.mjs +24 -2
  198. package/clients/cli/commands/gap-report.test.mjs +79 -0
  199. package/clients/cli/commands/integration-authoring.test.mjs +46 -0
  200. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  201. package/clients/cli/commands/integration-check.test.mjs +411 -0
  202. package/clients/cli/commands/integration.doc.mjs +6 -2
  203. package/clients/cli/commands/integration.mjs +116 -5
  204. package/clients/cli/commands/json-contract.test.mjs +5 -1
  205. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  206. package/clients/cli/commands/swizzle.mjs +5 -3
  207. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  208. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  209. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  210. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  211. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  212. package/clients/cli/index.mjs +30 -5
  213. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  214. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  215. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  216. package/foundation/agent-docs/agent-docs.mjs +8 -6
  217. package/foundation/config/project.mjs +82 -0
  218. package/foundation/discovery/authoring-self-docs.mjs +2 -1
  219. package/foundation/discovery/component-discovery.d.mts +18 -0
  220. package/foundation/discovery/component-discovery.mjs +2 -2
  221. package/foundation/discovery/copied-passages.d.mts +216 -0
  222. package/foundation/discovery/copied-passages.mjs +720 -0
  223. package/foundation/discovery/copied-passages.test.mjs +124 -0
  224. package/foundation/discovery/doc-consistency.d.mts +34 -0
  225. package/foundation/discovery/doc-consistency.mjs +513 -0
  226. package/foundation/discovery/doc-consistency.test.mjs +347 -0
  227. package/foundation/discovery/doc-fluff.d.mts +112 -0
  228. package/foundation/discovery/doc-fluff.mjs +328 -0
  229. package/foundation/discovery/doc-fluff.test.mjs +142 -0
  230. package/foundation/discovery/doc-types.d.mts +157 -0
  231. package/foundation/discovery/doc-types.mjs +1231 -0
  232. package/foundation/discovery/doc-types.test.mjs +744 -0
  233. package/foundation/discovery/docs-discovery.d.mts +88 -0
  234. package/foundation/discovery/docs-discovery.mjs +83 -2
  235. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  236. package/foundation/discovery/integration-doc-files.mjs +231 -0
  237. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  238. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  239. package/foundation/discovery/package-tsconfig.mjs +228 -0
  240. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  241. package/foundation/discovery/project-typescript.d.mts +32 -0
  242. package/foundation/discovery/project-typescript.mjs +89 -0
  243. package/foundation/discovery/prop-drift.d.mts +297 -0
  244. package/foundation/discovery/prop-drift.mjs +2428 -0
  245. package/foundation/discovery/prop-drift.test.mjs +2337 -0
  246. package/foundation/discovery/stray-pointers.d.mts +52 -0
  247. package/foundation/discovery/stray-pointers.mjs +293 -0
  248. package/foundation/discovery/stray-pointers.test.mjs +86 -0
  249. package/foundation/discovery/type-match.d.mts +53 -0
  250. package/foundation/discovery/type-match.mjs +660 -0
  251. package/foundation/discovery/type-match.test.mjs +169 -0
  252. package/foundation/discovery/type-text.d.mts +68 -0
  253. package/foundation/discovery/type-text.mjs +658 -0
  254. package/foundation/discovery/type-text.test.mjs +196 -0
  255. package/foundation/discovery/unresolved-references.d.mts +62 -0
  256. package/foundation/discovery/unresolved-references.mjs +790 -0
  257. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  258. package/foundation/doc-compiler/doc-loads.test.mjs +26 -0
  259. package/foundation/doc-compiler/links.d.mts +41 -5
  260. package/foundation/doc-compiler/links.mjs +167 -28
  261. package/foundation/doc-compiler/links.test.mjs +97 -4
  262. package/foundation/doc-compiler/tree.mjs +30 -1
  263. package/foundation/doc-compiler/tree.test.mjs +7 -0
  264. package/foundation/env/package-manager.d.mts +32 -0
  265. package/foundation/env/package-manager.mjs +47 -0
  266. package/foundation/env/package-manager.test.mjs +194 -7
  267. package/foundation/fs/module-loader.d.mts +2 -1
  268. package/foundation/fs/module-loader.mjs +60 -4
  269. package/foundation/fs/module-loader.test.mjs +194 -0
  270. package/foundation/integrations/contribution-inventory.d.mts +11 -0
  271. package/foundation/integrations/contribution-inventory.mjs +50 -2
  272. package/foundation/integrations/issue.ts +6 -0
  273. package/foundation/integrations/validate-contributions.mjs +30 -1
  274. package/foundation/response/response-types.doc.mjs +15 -9
  275. package/package.json +11 -11
  276. package/scripts/postinstall.mjs +3 -3
@@ -17,8 +17,11 @@
17
17
  * foundation/discovery/docs-discovery, which the catalog comes from.
18
18
  */
19
19
 
20
+ import * as path from 'node:path';
20
21
  import {Project} from '../../foundation/config/project.mjs';
21
22
  import {DocsCatalog} from '../../foundation/discovery/docs-discovery.mjs';
23
+ import {checkDocTypes} from '../../foundation/discovery/doc-types.mjs';
24
+ import {integrationDocFiles} from '../../foundation/discovery/integration-doc-files.mjs';
22
25
  import {
23
26
  linkReferenceTopic,
24
27
  lowerReferenceTopic,
@@ -37,6 +40,7 @@ import {
37
40
  import {sortDiagnostics} from '../../foundation/doc-compiler/diagnostics.mjs';
38
41
  import {
39
42
  linkBlocks,
43
+ linkFields,
40
44
  parseLinkTarget,
41
45
  } from '../../foundation/doc-compiler/links.mjs';
42
46
  import {
@@ -53,6 +57,17 @@ import {
53
57
  selfDocSection,
54
58
  } from '../../foundation/discovery/authoring-self-docs.mjs';
55
59
  import {CLI_PROVIDER_ID} from '../../foundation/identity/providers.mjs';
60
+ import {
61
+ CORE_PACKAGE,
62
+ discoverOwnedComponents,
63
+ discoverValidIntegrationComponents,
64
+ } from '../../foundation/discovery/component-discovery.mjs';
65
+ import {loadComponentDoc} from '../../foundation/discovery/component-loader.mjs';
66
+ import {
67
+ discoverCoreTemplates,
68
+ discoverIntegrationTemplatesForOne,
69
+ } from '../../foundation/discovery/template-adapter.mjs';
70
+ import {findCoreDir} from '../../foundation/fs/paths.mjs';
56
71
  import {AstryxError} from '../error.mjs';
57
72
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
58
73
 
@@ -250,8 +265,16 @@ function linkTopic(catalog, entry, lang) {
250
265
  problems.push(...linked.problems);
251
266
  sections.push({...section, content: linked.content});
252
267
  }
268
+ // The topic's own text outside its sections, its description and
269
+ // summary, resolves against the topic's own provider.
270
+ const {resolve} = await linkerFor(providerOf(entry));
271
+ const fields = await linkFields(topicTextFields(raw.doc), resolve);
272
+ problems.push(...fields.problems);
253
273
  return {
254
- node: deepFreeze({...raw, doc: {...raw.doc, sections}}),
274
+ node: deepFreeze({
275
+ ...raw,
276
+ doc: {...raw.doc, ...fields.doc, sections},
277
+ }),
255
278
  problems,
256
279
  };
257
280
  })();
@@ -260,6 +283,82 @@ function linkTopic(catalog, entry, lang) {
260
283
  return linked;
261
284
  }
262
285
 
286
+ /**
287
+ * The text fields of a topic outside its sections: its description and
288
+ * summary, those it has.
289
+ * @param {any} doc
290
+ * @returns {{description?: string, summary?: string}}
291
+ */
292
+ function topicTextFields(doc) {
293
+ /** @type {{description?: string, summary?: string}} */
294
+ const fields = {};
295
+ if (typeof doc?.description === 'string')
296
+ fields.description = doc.description;
297
+ if (typeof doc?.summary === 'string') fields.summary = doc.summary;
298
+ return fields;
299
+ }
300
+
301
+ /**
302
+ * One line of a doc's text, such as a topic's or a tree node's summary, with
303
+ * every inline link resolved against the provider that wrote it (spec:AST-047
304
+ * FR9). A link that names no doc prints as written; doctor names it.
305
+ * @param {DocsCatalog} catalog
306
+ * @param {string} providerId the provider id of the doc the text sits in
307
+ * @param {string} text
308
+ * @returns {Promise<string>}
309
+ */
310
+ export async function linkDocText(catalog, providerId, text) {
311
+ if (typeof text !== 'string' || !text.includes('{@link')) return text;
312
+ let provider;
313
+ try {
314
+ provider = normalizeProviderId(providerId);
315
+ } catch {
316
+ return text;
317
+ }
318
+ const linked = await linkFields(
319
+ {description: text},
320
+ await linkResolver(catalog, provider),
321
+ );
322
+ return linked.doc.description ?? text;
323
+ }
324
+
325
+ /**
326
+ * A component doc with every inline link in its text fields resolved
327
+ * (spec:AST-047 FR9): its description, usage, best practices, and each prop's
328
+ * and example's description. Code fields are shown as written. A Core
329
+ * component's links resolve against the CLI's own docs provider; an
330
+ * integration's against that integration's.
331
+ * @template T
332
+ * @param {DocsCatalog} catalog
333
+ * @param {string} providerId the provider id the component's links resolve
334
+ * against
335
+ * @param {T} doc
336
+ * @returns {Promise<{doc: T, problems: LinkProblem[]}>}
337
+ */
338
+ export async function linkComponentDoc(catalog, providerId, doc) {
339
+ if (!JSON.stringify(doc ?? null).includes('{@link')) {
340
+ return {doc, problems: []};
341
+ }
342
+ return linkFields(
343
+ doc,
344
+ await linkResolver(catalog, normalizeProviderId(providerId)),
345
+ );
346
+ }
347
+
348
+ /**
349
+ * The provider id a component's doc links resolve against: the CLI's own for
350
+ * a Core component, else its owner package's (or the provider id its manifest
351
+ * declares).
352
+ * @param {string} ownerPackage
353
+ * @param {string} [providerId]
354
+ * @returns {string}
355
+ */
356
+ export function componentLinkProvider(ownerPackage, providerId) {
357
+ return ownerPackage === CORE_PACKAGE
358
+ ? CLI_PROVIDER_ID
359
+ : normalizeProviderId(providerId ?? ownerPackage);
360
+ }
361
+
263
362
  /** @type {WeakMap<DocsCatalog, Promise<DocsTree>>} */
264
363
  const treesByCatalog = new WeakMap();
265
364
 
@@ -333,12 +432,50 @@ async function buildProjectTree(catalog, fresh) {
333
432
  docs: [...cli.docs, ...added.flatMap(each => each.guides)],
334
433
  topics: await flatTopicInputs(catalog),
335
434
  });
435
+ // A summary is a doc's text too: each link in it reads as the command that
436
+ // opens its doc, wherever the tree's summaries print (spec:AST-047 FR9).
437
+ for (const node of result.nodes.values()) {
438
+ if (typeof node.summary === 'string' && node.summary.includes('{@link')) {
439
+ node.summary = await linkSummary(
440
+ catalog,
441
+ result,
442
+ node.providerId,
443
+ node.summary,
444
+ );
445
+ }
446
+ }
336
447
  return {
337
448
  ...result,
338
449
  diagnostics: sortDiagnostics([...cli.diagnostics, ...result.diagnostics]),
339
450
  };
340
451
  }
341
452
 
453
+ /**
454
+ * One summary with each inline link resolved to the command that opens its
455
+ * doc, against the provider that wrote it. A link that names no doc prints as
456
+ * written; doctor names it where it checks the doc's own fields.
457
+ * @param {DocsCatalog} catalog
458
+ * @param {DocsTree} tree
459
+ * @param {string} providerId
460
+ * @param {string} summary
461
+ * @returns {Promise<string>}
462
+ */
463
+ async function linkSummary(catalog, tree, providerId, summary) {
464
+ if (!summary.includes('{@link')) return summary;
465
+ let provider;
466
+ try {
467
+ provider = normalizeProviderId(providerId);
468
+ } catch {
469
+ return summary;
470
+ }
471
+ const find = docFinderOver(catalog, tree, provider, false);
472
+ const linked = await linkFields({summary}, async target => {
473
+ const found = await find(target);
474
+ return 'problem' in found ? found : found.link;
475
+ });
476
+ return linked.doc.summary;
477
+ }
478
+
342
479
  /** @type {WeakMap<DocsTree, Map<string, TreeNode>>} */
343
480
  const identitiesByTree = new WeakMap();
344
481
 
@@ -416,10 +553,34 @@ async function authoringDoc(catalog, kind, name) {
416
553
  * @returns {Promise<(target: string) => Promise<FoundDoc | {problem: string}>>}
417
554
  */
418
555
  async function docFinder(catalog, fromProvider) {
419
- const identities = identitiesOf(await projectTree(catalog));
556
+ return docFinderOver(catalog, await projectTree(catalog), fromProvider);
557
+ }
558
+
559
+ /**
560
+ * {@link docFinder} over a tree already built, so building the tree can
561
+ * resolve the links in its own summaries.
562
+ * @param {DocsCatalog} catalog
563
+ * @param {DocsTree} tree
564
+ * @param {string} fromProvider
565
+ * @param {boolean} [summaries] resolve the links in a found flat topic's
566
+ * summary; off while a summary is itself being resolved, so two summaries
567
+ * that link each other cannot loop
568
+ * @returns {(target: string) => Promise<FoundDoc | {problem: string}>}
569
+ */
570
+ function docFinderOver(catalog, tree, fromProvider, summaries = true) {
571
+ const identities = identitiesOf(tree);
420
572
  return async target => {
421
573
  const parsed = parseLinkTarget(target);
422
- if ('error' in parsed) return {problem: parsed.error};
574
+ if ('error' in parsed)
575
+ return {
576
+ problem: bareLinkHint(
577
+ parsed.error,
578
+ target,
579
+ catalog,
580
+ identities,
581
+ fromProvider,
582
+ ),
583
+ };
423
584
  let provider;
424
585
  try {
425
586
  provider = normalizeProviderId(parsed.provider ?? fromProvider);
@@ -428,7 +589,9 @@ async function docFinder(catalog, fromProvider) {
428
589
  problem: `"${target}" names "${parsed.provider}", which is not a provider id: an npm package name, or the \`providerId\` its manifest declares`,
429
590
  };
430
591
  }
431
- const node = identities.get(identityKey(provider, parsed.kind, parsed.name));
592
+ const node = identities.get(
593
+ identityKey(provider, parsed.kind, parsed.name),
594
+ );
432
595
  if (node) {
433
596
  return {
434
597
  link: {
@@ -477,6 +640,14 @@ async function docFinder(catalog, fromProvider) {
477
640
  const raw = await lowerRawTopic(catalog, entry);
478
641
  title = raw.doc.title ?? title;
479
642
  summary = raw.doc.description ?? summary;
643
+ if (summaries) {
644
+ summary = await linkSummary(
645
+ catalog,
646
+ tree,
647
+ providerOf(entry),
648
+ summary,
649
+ );
650
+ }
480
651
  } catch {
481
652
  // The topic budget check reports a topic that does not load; the
482
653
  // link still opens it.
@@ -495,10 +666,263 @@ async function docFinder(catalog, fromProvider) {
495
666
  };
496
667
  }
497
668
  }
669
+ if (CONTRIBUTED_KINDS.has(parsed.kind)) {
670
+ const link = await contributedDocLink(
671
+ catalog,
672
+ provider,
673
+ parsed.kind,
674
+ parsed.name,
675
+ );
676
+ if (link) {
677
+ // The summary is the target doc's own text, so its links resolve
678
+ // against the target's provider, never the linking doc's: a Core
679
+ // component's against the CLI's docs, like its other fields.
680
+ if (summaries && link.summary.includes('{@link')) {
681
+ link.summary = await linkSummary(
682
+ catalog,
683
+ tree,
684
+ provider === CORE_COMPONENT_PROVIDER ? CLI_PROVIDER_ID : provider,
685
+ link.summary,
686
+ );
687
+ }
688
+ return {link: {target, ...link}, kind: parsed.kind, typed: null};
689
+ }
690
+ }
691
+ const searchType =
692
+ parsed.kind === 'component'
693
+ ? 'component'
694
+ : parsed.kind === 'page' || parsed.kind === 'block'
695
+ ? 'template'
696
+ : 'doc';
697
+ return {
698
+ problem: `"${target}" names no doc. Find it with \`astryx search ${parsed.name} --type ${searchType}\`, then name it as \`[<provider>:]<kind>:<name>\`.`,
699
+ };
700
+ };
701
+ }
702
+
703
+ /**
704
+ * What a link written as a bare name (`{@link deploying}`) should say
705
+ * instead: the exact target to write when a topic or tree doc has that
706
+ * name, or that none does.
707
+ * @param {string} error the parse error
708
+ * @param {string} target the target as written
709
+ * @param {DocsCatalog} catalog
710
+ * @param {Map<string, any>} identities
711
+ * @param {string} fromProvider
712
+ * @returns {string}
713
+ */
714
+ function bareLinkHint(error, target, catalog, identities, fromProvider) {
715
+ const name = typeof target === 'string' ? target.trim() : '';
716
+ if (!name || name.includes(':') || /\s/.test(name)) return error;
717
+ /** @param {string} provider */
718
+ const normal = provider => {
719
+ try {
720
+ return normalizeProviderId(provider);
721
+ } catch {
722
+ return provider;
723
+ }
724
+ };
725
+ const from = normal(fromProvider);
726
+ /** @param {string} provider @param {string} kind @param {string} named */
727
+ const written = (provider, kind, named) =>
728
+ `{@link ${normal(provider) === from ? '' : `${provider}:`}${kind}:${named}}`;
729
+ const entry = catalog.resolve(name);
730
+ if (entry) {
731
+ return `${error}. "${name}" is a topic: write \`${written(entry.providerId ?? entry.package, 'generic', entry.name)}\`.`;
732
+ }
733
+ const node = [...identities.values()].find(
734
+ each => String(each.name).toLowerCase() === name.toLowerCase(),
735
+ );
736
+ if (node) {
737
+ return `${error}. "${name}" is a ${node.kind === 'generic' ? 'topic' : `${node.kind} doc`}: write \`${written(node.providerId, node.kind, node.name)}\`.`;
738
+ }
739
+ return `${error}, and no topic is named "${name}". Link a doc that exists, as \`{@link generic:<topic>}\` (\`astryx docs\` lists the topics), or remove the link.`;
740
+ }
741
+
742
+ /** The provider Core's components and templates belong to. */
743
+ const CORE_COMPONENT_PROVIDER = (() => {
744
+ try {
745
+ return normalizeProviderId(CORE_PACKAGE);
746
+ } catch {
747
+ return CORE_PACKAGE;
748
+ }
749
+ })();
750
+
751
+ /** The doc kinds no docs tree holds: components and templates. */
752
+ const CONTRIBUTED_KINDS = new Set(['component', 'page', 'block']);
753
+
754
+ /**
755
+ * The link to a component, page, or block doc (spec:AST-047 FR9). No docs tree
756
+ * holds these, so a link finds them among the component and template records
757
+ * the catalog carries, the ones `astryx component` and `astryx template` open,
758
+ * and reads as that command. A component is named by its export name, a
759
+ * template by its id; anything but Core's names its package.
760
+ * @param {DocsCatalog} catalog
761
+ * @param {string} provider normalized provider id
762
+ * @param {string} kind `component`, `page`, or `block`
763
+ * @param {string} name
764
+ * @returns {Promise<Omit<import('../../foundation/doc-compiler/links.mjs').DocLink, 'target'> | null>}
765
+ */
766
+ async function contributedDocLink(catalog, provider, kind, name) {
767
+ const contributions = await catalog.contributions();
768
+ if (!contributions) return null;
769
+ const sameProvider = (/** @type {string} */ providerId) => {
770
+ try {
771
+ return normalizeProviderId(providerId) === provider;
772
+ } catch {
773
+ return false;
774
+ }
775
+ };
776
+ if (kind === 'component') {
777
+ const record = contributions.components.find(
778
+ component =>
779
+ component.name === name && sameProvider(component.providerId),
780
+ );
781
+ if (!record) return null;
782
+ /** @type {any} */
783
+ let doc = null;
784
+ try {
785
+ doc = record.docPath ? await loadComponentDoc(record.docPath) : null;
786
+ } catch {
787
+ // The component checks report a doc that does not load; the link
788
+ // still opens the component.
789
+ }
790
+ const entry =
791
+ doc?.name === name
792
+ ? doc
793
+ : doc?.components?.find(
794
+ (/** @type {any} */ each) => each.name === name,
795
+ );
796
+ // Bare, Core's name opens Core's component unless another package ships
797
+ // the same name or replaces it (spec:AST-035 FR11); then the link selects
798
+ // Core, as it always selects any other package.
799
+ const selectPackage =
800
+ record.package !== CORE_PACKAGE ||
801
+ contributions.components.some(
802
+ other =>
803
+ other.package !== CORE_PACKAGE &&
804
+ (other.name === name || other.replaces === name),
805
+ );
498
806
  return {
499
- problem: `"${target}" names no doc. Find it with \`astryx search ${parsed.name} --type doc\`, then name it as \`[<provider>:]<kind>:<name>\`.`,
807
+ id: createDocId(provider, 'component', name),
808
+ route: null,
809
+ title: entry?.displayName ?? name,
810
+ summary: entry?.description ?? doc?.description ?? '',
811
+ command: `astryx component ${name}${selectPackage ? ` --package ${record.package}` : ''}`,
500
812
  };
813
+ }
814
+ const template = contributions.templates.find(
815
+ each =>
816
+ each.type === kind && each.id === name && sameProvider(each.providerId),
817
+ );
818
+ if (!template) return null;
819
+ // The same for a Core template: another package's template of its kind
820
+ // with its id, or one that replaces it, takes the bare id.
821
+ const selectPackage =
822
+ template.package !== CORE_PACKAGE ||
823
+ contributions.templates.some(
824
+ other =>
825
+ other.package !== CORE_PACKAGE &&
826
+ other.type === template.type &&
827
+ (other.id === name || other.replaces === name),
828
+ );
829
+ return {
830
+ id: createDocId(provider, template.type, name),
831
+ route: null,
832
+ title: template.displayName ?? template.name,
833
+ summary: template.description ?? '',
834
+ command: `astryx template ${name} --type ${template.type}${selectPackage ? ` --package ${template.package}` : ''}`,
835
+ };
836
+ }
837
+
838
+ /**
839
+ * The component and template docs one integration package's links can name:
840
+ * Core's and its own, as `doctor integration docs` checks it before any app
841
+ * configures it.
842
+ * @param {any} integration a loaded integration: its name, provider id, roots,
843
+ * and package directory
844
+ * @returns {Promise<import('../../foundation/discovery/docs-discovery.mjs').LinkableContributions>}
845
+ */
846
+ async function packageContributions(integration) {
847
+ const own = integration.providerId ?? integration.name;
848
+ /** @type {import('../../foundation/discovery/docs-discovery.mjs').LinkableComponent[]} */
849
+ const components = [];
850
+ const coreDir = findCoreDir(integration.__packageDir ?? process.cwd());
851
+ if (coreDir) {
852
+ try {
853
+ for (const record of discoverOwnedComponents(coreDir, [])) {
854
+ components.push({
855
+ providerId: CORE_PACKAGE,
856
+ package: CORE_PACKAGE,
857
+ name: record.name,
858
+ docPath: record.docPath,
859
+ });
860
+ }
861
+ } catch {
862
+ // The components check reports a Core it cannot read.
863
+ }
864
+ }
865
+ if (integration.components) {
866
+ try {
867
+ const {components: records} =
868
+ await discoverValidIntegrationComponents(integration);
869
+ for (const record of records) {
870
+ components.push({
871
+ providerId: own,
872
+ package: integration.name,
873
+ name: record.name,
874
+ docPath: record.docPath,
875
+ // Declared: this package alone cannot tell whether an app applies
876
+ // it, so a link to the Core name it names selects Core.
877
+ ...(typeof record.replaces === 'string'
878
+ ? {replaces: record.replaces}
879
+ : {}),
880
+ });
881
+ }
882
+ } catch {
883
+ // `validate` reports components that do not load.
884
+ }
885
+ }
886
+ /** @type {import('../../foundation/discovery/docs-discovery.mjs').LinkableTemplate[]} */
887
+ const templates = [];
888
+ /** @param {any} template @param {string} providerId @param {string} pkg */
889
+ const addTemplate = (template, providerId, pkg) => {
890
+ if (template.type !== 'page' && template.type !== 'block') return;
891
+ templates.push({
892
+ providerId,
893
+ package: pkg,
894
+ type: template.type,
895
+ id: template.dirName,
896
+ name: template.name,
897
+ ...(template.displayName == null
898
+ ? {}
899
+ : {displayName: template.displayName}),
900
+ ...(template.description == null
901
+ ? {}
902
+ : {description: template.description}),
903
+ ...(typeof template.replaces === 'string'
904
+ ? {replaces: template.replaces}
905
+ : {}),
906
+ });
501
907
  };
908
+ try {
909
+ for (const template of await discoverCoreTemplates()) {
910
+ addTemplate(template, CORE_PACKAGE, CORE_PACKAGE);
911
+ }
912
+ } catch {
913
+ // Core templates that do not load leave nothing to link to.
914
+ }
915
+ if (integration.templates) {
916
+ try {
917
+ const {templates: records} =
918
+ await discoverIntegrationTemplatesForOne(integration);
919
+ for (const template of records)
920
+ addTemplate(template, own, integration.name);
921
+ } catch {
922
+ // `validate` reports templates that do not load.
923
+ }
924
+ }
925
+ return {components, templates};
502
926
  }
503
927
 
504
928
  /**
@@ -654,7 +1078,7 @@ export async function docsLinkProblems(
654
1078
  for (const problem of found) {
655
1079
  if ((problem.include === true) !== references) continue;
656
1080
  problems.push(
657
- `${where}${problem.section ? ` \u00a7 ${problem.section}` : ''}: ${problem.message}`,
1081
+ `${where}${problem.section ? ` \u00a7 ${problem.section}` : ''}${problem.field ? ` (${problem.field})` : ''}: ${problem.message}`,
658
1082
  );
659
1083
  }
660
1084
  };
@@ -689,6 +1113,83 @@ export async function docsLinkProblems(
689
1113
  return problems;
690
1114
  }
691
1115
 
1116
+ /**
1117
+ * The catalog one integration package's docs and links read, as doctor checks
1118
+ * it before any app configures it: the CLI's topics, Core's and the package's
1119
+ * components and templates, and the package's own docs.
1120
+ * @param {any} integration
1121
+ * @param {{records: import('../../foundation/discovery/docs-discovery.mjs').DocsTopicRecord[], namespaces: import('../../foundation/doc-compiler/tree.mjs').TreeNamespaceInput[], guides: import('../../foundation/doc-compiler/tree.mjs').TreeDocInput[]} | null} discovered
1122
+ * @returns {DocsCatalog}
1123
+ */
1124
+ function packageCatalog(integration, discovered) {
1125
+ const catalog = DocsCatalog.fromBuiltins();
1126
+ catalog.setContributions(() => packageContributions(integration));
1127
+ if (discovered) {
1128
+ for (const record of discovered.records) catalog.add(record);
1129
+ catalog.addTreeInputs({
1130
+ namespaces: discovered.namespaces.map(input => ({...input, rank: 1})),
1131
+ guides: discovered.guides.map(input => ({...input, rank: 1})),
1132
+ });
1133
+ }
1134
+ return catalog;
1135
+ }
1136
+
1137
+ /**
1138
+ * What \`astryx doctor integration components\` checks of the links in one
1139
+ * integration's own component docs (spec:AST-047 FR9): each link in a
1140
+ * description, usage, best practice, or prop's or example's description that
1141
+ * names no doc. It prints as written, so each is a warning.
1142
+ * @param {any} integration a loaded integration
1143
+ * @param {Parameters<typeof packageCatalog>[1]} discovered the package's own
1144
+ * docs, which its components' links may name; null when it ships none
1145
+ * @returns {Promise<Array<{severity: 'warning', message: string}>>}
1146
+ */
1147
+ export async function packageComponentLinkProblems(integration, discovered) {
1148
+ const catalog = packageCatalog(integration, discovered);
1149
+ return (await componentLinkProblems(catalog, integration.name)).map(
1150
+ message => ({severity: /** @type {const} */ ('warning'), message}),
1151
+ );
1152
+ }
1153
+
1154
+ /**
1155
+ * Each link in a package's own component docs that names no doc. A family doc
1156
+ * that documents several components is read once.
1157
+ * @param {DocsCatalog} catalog
1158
+ * @param {string} owner the package whose component docs are read
1159
+ * @returns {Promise<string[]>}
1160
+ */
1161
+ async function componentLinkProblems(catalog, owner) {
1162
+ const contributions = await catalog.contributions();
1163
+ /** @type {string[]} */
1164
+ const problems = [];
1165
+ const seen = new Set();
1166
+ for (const record of contributions?.components ?? []) {
1167
+ if (record.package !== owner || !record.docPath) continue;
1168
+ if (seen.has(record.docPath)) continue;
1169
+ seen.add(record.docPath);
1170
+ /** @type {any} */
1171
+ let doc;
1172
+ try {
1173
+ doc = await loadComponentDoc(record.docPath);
1174
+ } catch {
1175
+ // The components check reports a doc that does not load.
1176
+ continue;
1177
+ }
1178
+ const linked = await linkComponentDoc(
1179
+ catalog,
1180
+ componentLinkProvider(record.package, record.providerId),
1181
+ doc,
1182
+ );
1183
+ const name = typeof doc?.name === 'string' ? doc.name : record.name;
1184
+ for (const problem of linked.problems) {
1185
+ problems.push(
1186
+ `component ${name}${problem.field ? ` (${problem.field})` : ''}: ${problem.message}`,
1187
+ );
1188
+ }
1189
+ }
1190
+ return problems;
1191
+ }
1192
+
692
1193
  /**
693
1194
  * What \`astryx doctor integration docs\` checks in one integration's docs: the
694
1195
  * docs tree they build beside the CLI's (namespaces, placements, routes) and
@@ -700,12 +1201,7 @@ export async function docsLinkProblems(
700
1201
  * @returns {Promise<Array<{severity: 'error' | 'warning', message: string}>>}
701
1202
  */
702
1203
  export async function packageDocsProblems(integration, discovered) {
703
- const catalog = DocsCatalog.fromBuiltins();
704
- for (const record of discovered.records) catalog.add(record);
705
- catalog.addTreeInputs({
706
- namespaces: discovered.namespaces.map(input => ({...input, rank: 1})),
707
- guides: discovered.guides.map(input => ({...input, rank: 1})),
708
- });
1204
+ const catalog = packageCatalog(integration, discovered);
709
1205
  const tree = await projectTree(catalog);
710
1206
  /** @type {Array<{severity: 'error' | 'warning', message: string}>} */
711
1207
  const problems = tree.diagnostics
@@ -794,6 +1290,7 @@ async function namespaceReferenceTarget(catalog, route, lang) {
794
1290
  */
795
1291
  export async function packageReferenceProblems(integration, discovered) {
796
1292
  const catalog = DocsCatalog.fromBuiltins();
1293
+ catalog.setContributions(() => packageContributions(integration));
797
1294
  for (const record of discovered.records) catalog.add(record);
798
1295
  catalog.addTreeInputs({
799
1296
  namespaces: discovered.namespaces.map(input => ({...input, rank: 1})),
@@ -927,7 +1424,8 @@ export async function topicLinks(catalog, entry) {
927
1424
  const tree = await projectTree(catalog);
928
1425
  const node = tree.get(entry.tree ? (entry.route ?? entry.name) : entry.name);
929
1426
  const placed =
930
- node && (entry.tree ? node.kind === 'generic' : node.ref?.flatTopic === entry.name);
1427
+ node &&
1428
+ (entry.tree ? node.kind === 'generic' : node.ref?.flatTopic === entry.name);
931
1429
  return placed ? placeLinks(tree, node) : {up: topicUp(entry)};
932
1430
  }
933
1431
 
@@ -950,7 +1448,8 @@ export async function resolveDocsArgument(topic, {cwd} = {}) {
950
1448
  const tree = await projectTree(catalog);
951
1449
  const owner = nameOwner(tree, catalog, topic);
952
1450
  if (owner == null) return {kind: 'unknown', catalog};
953
- if (owner.kind === 'topic') return {kind: 'topic', catalog, entry: owner.entry};
1451
+ if (owner.kind === 'topic')
1452
+ return {kind: 'topic', catalog, entry: owner.entry};
954
1453
  return treeArgument(catalog, tree, owner.node);
955
1454
  }
956
1455
 
@@ -1125,3 +1624,40 @@ export async function resolveTopicDocs(topic, options = {}) {
1125
1624
  const node = await lowerTopic(catalog, entry, effectiveLang);
1126
1625
  return {catalog, node, lang: effectiveLang, entry};
1127
1626
  }
1627
+
1628
+ /**
1629
+ * Each doc one integration package ships, checked against the published
1630
+ * authoring type for its kind with the project's own TypeScript (spec:AST-039
1631
+ * FR13). Without TypeScript the report says nothing was checked.
1632
+ * @param {any} integration a loaded integration
1633
+ * @param {string} cwd
1634
+ * @returns {Promise<import('../../foundation/discovery/doc-types.mjs').DocTypesReport & {fixtures?: number}>}
1635
+ */
1636
+ export async function integrationDocTypes(integration, cwd) {
1637
+ const packageDir = /** @type {{__packageDir?: string}} */ (integration)
1638
+ .__packageDir;
1639
+ const {files, unread, fixtures} = await integrationDocFiles(integration);
1640
+ const checked = await checkDocTypes(files, {
1641
+ packageDir: packageDir ?? cwd,
1642
+ resolveFrom: [cwd, packageDir],
1643
+ });
1644
+ // Test fixtures no reader serves don't ship as docs: only counted.
1645
+ const report =
1646
+ checked.status === 'checked' && fixtures > 0
1647
+ ? {...checked, fixtures}
1648
+ : checked;
1649
+ if (report.status !== 'checked' || unread.length === 0) return report;
1650
+ // A root its reader cannot read serves no doc; say so rather than skip it.
1651
+ const rel = (/** @type {string} */ file) =>
1652
+ path
1653
+ .relative(packageDir ?? cwd, file)
1654
+ .split(path.sep)
1655
+ .join('/') || '.';
1656
+ return {
1657
+ ...report,
1658
+ unchecked: [
1659
+ ...report.unchecked,
1660
+ ...unread.map(entry => ({doc: rel(entry.path), reason: entry.reason})),
1661
+ ].sort((a, b) => a.doc.localeCompare(b.doc)),
1662
+ };
1663
+ }