@astryxdesign/cli 0.6.3-canary.1f30d4e → 0.6.3-canary.1ffe66d

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 (181) hide show
  1. package/README.md +19 -17
  2. package/api/component/_adapter.d.mts +6 -12
  3. package/api/component/_adapter.mjs +20 -10
  4. package/api/component/component.mjs +60 -12
  5. package/api/component/list/list.mjs +3 -2
  6. package/api/docs/_adapter.d.mts +209 -28
  7. package/api/docs/_adapter.mjs +667 -35
  8. package/api/docs/detail/detail.mjs +11 -3
  9. package/api/docs/detail/section/section.mjs +20 -3
  10. package/api/docs/docs.d.mts +5 -3
  11. package/api/docs/docs.doc.mjs +35 -15
  12. package/api/docs/docs.mjs +44 -8
  13. package/api/docs/docs.test.mjs +158 -4
  14. package/api/docs/docs.type.d.mts +165 -2
  15. package/api/docs/docs.type.mjs +101 -3
  16. package/api/docs/index/index.mjs +11 -3
  17. package/api/docs/index/index.test.mjs +1 -1
  18. package/api/docs/integration-tree.test.mjs +547 -0
  19. package/api/docs/integrationDocs.test.mjs +14 -14
  20. package/api/docs/list/list.mjs +25 -5
  21. package/api/docs/node/node.d.mts +43 -0
  22. package/api/docs/node/node.mjs +192 -0
  23. package/api/doctor/doctor.d.mts +30 -2
  24. package/api/doctor/doctor.mjs +146 -7
  25. package/api/doctor/doctor.test.mjs +89 -1
  26. package/api/index.d.mts +1 -1
  27. package/api/index.mjs +1 -0
  28. package/api/init/init.doc.mjs +1 -1
  29. package/api/integration/add-contribution.d.mts +2 -1
  30. package/api/integration/add-contribution.mjs +107 -5
  31. package/api/integration/add-contribution.test.mjs +137 -0
  32. package/api/integration/authoring-checks.mjs +125 -28
  33. package/api/integration/authoring-checks.test.mjs +171 -3
  34. package/api/integration/authoring-checks.type.mjs +6 -1
  35. package/api/integration/integration-authoring.type.d.mts +2 -0
  36. package/api/integration/integration-authoring.type.mjs +2 -0
  37. package/api/integration/integrationAdd.doc.mjs +6 -0
  38. package/api/integration/integrationAddDoc.doc.mjs +7 -1
  39. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  40. package/api/integration/integrationPackCheck.doc.mjs +1 -1
  41. package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
  42. package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
  43. package/api/integration/pack-check.mjs +34 -0
  44. package/api/integration/pack-check.test.mjs +121 -0
  45. package/api/integration/pack-check.type.d.mts +26 -2
  46. package/api/integration/pack-check.type.mjs +14 -1
  47. package/api/integration/template-conflict-compatibility.test.mjs +73 -0
  48. package/api/integration/validate-integration.test.mjs +3 -3
  49. package/api/integration/validateIntegration.doc.mjs +1 -1
  50. package/api/json/index.ts +2 -0
  51. package/api/layout/_adapter.mjs +20 -5
  52. package/api/search/search.d.mts +26 -1
  53. package/api/search/search.doc.mjs +4 -3
  54. package/api/search/search.mjs +308 -29
  55. package/api/search/search.test.mjs +91 -2
  56. package/api/search/search.type.d.mts +13 -1
  57. package/api/search/search.type.mjs +4 -1
  58. package/api/template/list/list.mjs +1 -0
  59. package/api/template/template-integration.test.mjs +1022 -3
  60. package/api/template/template.doc.mjs +27 -7
  61. package/api/template/template.mjs +45 -8
  62. package/api/template/template.type.d.mts +6 -8
  63. package/api/template/template.type.mjs +3 -2
  64. package/api/theme/template/template.test.mjs +5 -0
  65. package/api/theme/themeTemplate.doc.mjs +1 -1
  66. package/assets/docs/getting-started.doc.mjs +2 -2
  67. package/assets/docs/principles.doc.mjs +6 -6
  68. package/assets/docs/styling-libraries.doc.mjs +2 -2
  69. package/assets/docs/styling.doc.mjs +4 -4
  70. package/assets/docs/theme.doc.mjs +3 -3
  71. package/assets/docs/tokens.doc.mjs +1 -1
  72. package/assets/docs/tree/api.doc.mjs +30 -0
  73. package/assets/docs/tree/cli.doc.mjs +23 -0
  74. package/assets/docs/tree/commands.doc.mjs +25 -0
  75. package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
  76. package/assets/docs/tree/integrations.test.mjs +62 -0
  77. package/assets/docs/tree/writing-docs.doc.mjs +286 -0
  78. package/authoring/debug/parse.d.mts +3 -3
  79. package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
  80. package/authoring/doctypes/base/type.ts +6 -5
  81. package/authoring/doctypes/command/command.doc.mjs +1 -1
  82. package/authoring/doctypes/command/type.ts +2 -2
  83. package/authoring/doctypes/enum/enum.doc.mjs +1 -1
  84. package/authoring/doctypes/enum/type.ts +1 -1
  85. package/authoring/doctypes/function/function.doc.mjs +3 -2
  86. package/authoring/doctypes/function/type.ts +3 -2
  87. package/authoring/doctypes/namespace/namespace.doc.mjs +5 -9
  88. package/authoring/doctypes/reference/reference.doc.mjs +3 -3
  89. package/authoring/doctypes/reference/type.ts +3 -0
  90. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  91. package/authoring/doctypes/schema/type.ts +1 -1
  92. package/authoring/doctypes/template/parse.d.mts +2 -0
  93. package/authoring/doctypes/template/parse.mjs +4 -0
  94. package/authoring/doctypes/template/parse.test.mjs +18 -0
  95. package/authoring/doctypes/template/template.doc.mjs +6 -0
  96. package/authoring/doctypes/template/type.ts +8 -0
  97. package/authoring/identity/identity.doc.mjs +2 -2
  98. package/authoring/integration/type.ts +1 -1
  99. package/clients/cli/commands/build-theme.mjs +1 -1
  100. package/clients/cli/commands/build.mjs +5 -2
  101. package/clients/cli/commands/component/index.mjs +1 -1
  102. package/clients/cli/commands/component-ownership.test.mjs +3 -3
  103. package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
  104. package/clients/cli/commands/discover.mjs +1 -1
  105. package/clients/cli/commands/docs.doc.mjs +20 -8
  106. package/clients/cli/commands/docs.mjs +175 -18
  107. package/clients/cli/commands/docs.test.mjs +114 -7
  108. package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
  109. package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
  110. package/clients/cli/commands/doctor-integration.test.mjs +75 -1
  111. package/clients/cli/commands/doctor.mjs +53 -16
  112. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  113. package/clients/cli/commands/integration.mjs +1 -0
  114. package/clients/cli/commands/search.mjs +11 -2
  115. package/clients/cli/commands/setup-nudge.test.mjs +6 -0
  116. package/clients/cli/commands/template.doc.mjs +23 -6
  117. package/clients/cli/commands/template.mjs +4 -91
  118. package/clients/cli/commands/text-json-parity.test.mjs +2 -1
  119. package/clients/cli/index.mjs +8 -0
  120. package/clients/cli/lib/manifest.mjs +9 -2
  121. package/foundation/agent-docs/agent-docs.mjs +1 -0
  122. package/foundation/agent-docs/agent-docs.test.mjs +10 -1
  123. package/foundation/config/project.d.mts +12 -11
  124. package/foundation/config/project.mjs +73 -59
  125. package/foundation/config/project.test.mjs +141 -5
  126. package/foundation/discovery/authoring-self-docs.test.mjs +17 -7
  127. package/foundation/discovery/cli-self-docs.d.mts +40 -34
  128. package/foundation/discovery/cli-self-docs.mjs +91 -115
  129. package/foundation/discovery/cli-self-docs.test.mjs +104 -166
  130. package/foundation/discovery/component-discovery.d.mts +38 -0
  131. package/foundation/discovery/component-discovery.mjs +48 -0
  132. package/foundation/discovery/docs-discovery.d.mts +105 -8
  133. package/foundation/discovery/docs-discovery.mjs +177 -13
  134. package/foundation/discovery/docs-discovery.test.mjs +56 -17
  135. package/foundation/discovery/docs-output-budget.d.mts +2 -2
  136. package/foundation/discovery/docs-output-budget.mjs +1 -1
  137. package/foundation/discovery/docs-section-key.d.mts +9 -2
  138. package/foundation/discovery/docs-section-key.mjs +15 -1
  139. package/foundation/discovery/template-adapter.d.mts +92 -6
  140. package/foundation/discovery/template-adapter.mjs +453 -17
  141. package/foundation/discovery/template-adapter.test.mjs +42 -0
  142. package/foundation/discovery/template-conflict-release.d.mts +13 -0
  143. package/foundation/discovery/template-conflict-release.mjs +40 -0
  144. package/foundation/discovery/template-conflict-release.test.mjs +40 -0
  145. package/foundation/doc-compiler/bundle.mjs +61 -1
  146. package/foundation/doc-compiler/bundle.test.mjs +21 -10
  147. package/foundation/doc-compiler/compile.d.mts +113 -132
  148. package/foundation/doc-compiler/compile.mjs +52 -6
  149. package/foundation/doc-compiler/diagnostics.mjs +28 -0
  150. package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
  151. package/foundation/doc-compiler/inputs.d.mts +2 -2
  152. package/foundation/doc-compiler/inputs.mjs +6 -1
  153. package/foundation/doc-compiler/ir.mjs +7 -0
  154. package/foundation/doc-compiler/lenses.d.mts +3 -2
  155. package/foundation/doc-compiler/lenses.mjs +2 -1
  156. package/foundation/doc-compiler/links.d.mts +135 -0
  157. package/foundation/doc-compiler/links.mjs +253 -0
  158. package/foundation/doc-compiler/links.test.mjs +139 -0
  159. package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
  160. package/foundation/doc-compiler/read.d.mts +3 -2
  161. package/foundation/doc-compiler/read.mjs +6 -1
  162. package/foundation/doc-compiler/tree.d.mts +288 -0
  163. package/foundation/doc-compiler/tree.mjs +876 -0
  164. package/foundation/doc-compiler/tree.test.mjs +598 -0
  165. package/foundation/integrations/autolink.test.mjs +1 -1
  166. package/foundation/integrations/cli-requirement.d.mts +45 -0
  167. package/foundation/integrations/cli-requirement.mjs +154 -0
  168. package/foundation/integrations/cli-requirement.test.mjs +109 -0
  169. package/foundation/integrations/contribution-inventory.d.mts +2 -1
  170. package/foundation/integrations/contribution-inventory.mjs +10 -4
  171. package/foundation/integrations/contribution-inventory.test.mjs +19 -0
  172. package/foundation/integrations/integration-warnings.d.mts +9 -2
  173. package/foundation/integrations/integration-warnings.mjs +51 -26
  174. package/foundation/integrations/integration-warnings.test.mjs +74 -1
  175. package/foundation/integrations/validate-contributions.mjs +25 -27
  176. package/foundation/response/response-types.doc.d.mts +5 -1
  177. package/foundation/response/response-types.doc.mjs +18 -9
  178. package/foundation/xle/expand.mjs +1 -1
  179. package/foundation/xle/xle.test.mjs +13 -0
  180. package/package.json +9 -9
  181. package/assets/docs/cli.doc.mjs +0 -15
@@ -6,6 +6,7 @@ import * as path from 'node:path';
6
6
  import {Project, DEFAULT_ISSUES_URL, findConfigPath} from './project.mjs';
7
7
  import {InMemoryConfigCache} from './config-cache.mjs';
8
8
  import * as componentDiscovery from '../discovery/component-discovery.mjs';
9
+ import {discoverCoreTemplates} from '../discovery/template-adapter.mjs';
9
10
 
10
11
  let tmpDir;
11
12
  let originalCwd;
@@ -21,6 +22,9 @@ function scaffold({
21
22
  issuesUrl,
22
23
  withComponents = true,
23
24
  withTemplates = true,
25
+ templateId = 'hero',
26
+ templateType = 'block',
27
+ templateReplaces = null,
24
28
  withCodemods = true,
25
29
  brokenComponent = false,
26
30
  brokenCodemod = false,
@@ -65,7 +69,7 @@ function scaffold({
65
69
  fs.mkdirSync(compDir, {recursive: true});
66
70
  fs.writeFileSync(
67
71
  path.join(compDir, 'Widget.doc.mjs'),
68
- `export const docs = { name: 'Widget', usage: {description: 'A widget'} };\n`,
72
+ `export const docs = { name: 'Widget', usage: {description: 'A widget'}, props: [] };\n`,
69
73
  );
70
74
  if (!brokenComponent) {
71
75
  fs.writeFileSync(
@@ -80,12 +84,12 @@ function scaffold({
80
84
  const tDir = path.join(pkgDir, 'templates');
81
85
  fs.mkdirSync(tDir, {recursive: true});
82
86
  fs.writeFileSync(
83
- path.join(tDir, 'hero.doc.mjs'),
84
- `export default { type: 'block', name: 'Hero', description: 'A hero' };\n`,
87
+ path.join(tDir, `${templateId}.doc.mjs`),
88
+ `export default { type: '${templateType}', name: 'Fixture template', description: 'A fixture template'${templateReplaces == null ? '' : `, replaces: ${JSON.stringify(templateReplaces)}`} };\n`,
85
89
  );
86
90
  fs.writeFileSync(
87
- path.join(tDir, 'hero.tsx'),
88
- `export default function Hero() { return null; }\n`,
91
+ path.join(tDir, `${templateId}.tsx`),
92
+ `export default function FixtureTemplate() { return null; }\n`,
89
93
  );
90
94
  }
91
95
 
@@ -324,6 +328,91 @@ describe('Project discovery', () => {
324
328
  expect(hero.type).toBe('block');
325
329
  });
326
330
 
331
+ it('templates() projects a valid integration replacement instead of its Core target', async () => {
332
+ const corePage = (await discoverCoreTemplates()).find(
333
+ template => template.type === 'page',
334
+ );
335
+ expect(corePage).toBeDefined();
336
+ scaffold({
337
+ templateId: 'acme-app-shell',
338
+ templateType: 'page',
339
+ templateReplaces: corePage.dirName,
340
+ });
341
+ const project = await Project.load(tmpDir);
342
+
343
+ const templates = await project.templates();
344
+
345
+ expect(
346
+ templates.find(template => template.dirName === 'acme-app-shell'),
347
+ ).toMatchObject({
348
+ package: '@acme/widgets',
349
+ replaces: corePage.dirName,
350
+ });
351
+ expect(
352
+ templates.find(
353
+ template =>
354
+ template.dirName === corePage.dirName &&
355
+ template.package !== '@acme/widgets',
356
+ ),
357
+ ).toBeUndefined();
358
+ expect(await project.issues()).toEqual([]);
359
+ });
360
+
361
+ it('reports replacement issues regardless of discovery call order without hiding other contributions', async () => {
362
+ scaffold({
363
+ templateReplaces: 'missing-core-template',
364
+ });
365
+
366
+ const componentsFirst = await Project.load(tmpDir);
367
+ expect(
368
+ (await componentsFirst.components()).some(
369
+ component => component.package === '@acme/widgets',
370
+ ),
371
+ ).toBe(true);
372
+ expect(await componentsFirst.issues()).toEqual(
373
+ expect.arrayContaining([
374
+ expect.objectContaining({
375
+ code: 'missing_template_replacement_target',
376
+ package: '@acme/widgets',
377
+ }),
378
+ ]),
379
+ );
380
+
381
+ const issuesFirst = await Project.load(tmpDir, {fresh: true});
382
+ expect(await issuesFirst.issues()).toEqual(
383
+ expect.arrayContaining([
384
+ expect.objectContaining({
385
+ code: 'missing_template_replacement_target',
386
+ package: '@acme/widgets',
387
+ }),
388
+ ]),
389
+ );
390
+ expect(
391
+ (await issuesFirst.components()).some(
392
+ component => component.package === '@acme/widgets',
393
+ ),
394
+ ).toBe(true);
395
+ const ownTemplate = (await issuesFirst.templates()).find(
396
+ template =>
397
+ template.package === '@acme/widgets' && template.dirName === 'hero',
398
+ );
399
+ expect(ownTemplate).toBeDefined();
400
+ expect(ownTemplate).not.toHaveProperty('replaces');
401
+
402
+ const sharedCache = new InMemoryConfigCache();
403
+ const warm = await Project.load(tmpDir, {cache: sharedCache});
404
+ await warm.templates();
405
+ const cached = await Project.load(tmpDir, {cache: sharedCache});
406
+ expect(await cached.issues()).toEqual(
407
+ expect.arrayContaining([
408
+ expect.objectContaining({
409
+ code: 'missing_template_replacement_target',
410
+ package: '@acme/widgets',
411
+ }),
412
+ ]),
413
+ );
414
+ });
415
+
327
416
  it('codemods() returns core registry groups + integration groups', async () => {
328
417
  scaffold();
329
418
  const project = await Project.load(tmpDir);
@@ -468,6 +557,53 @@ describe('Project issues (skip + warn)', () => {
468
557
  expect(issues.some(i => i.package === '@acme/widgets')).toBe(true);
469
558
  });
470
559
 
560
+ it('keeps valid contribution kinds and siblings when others are broken', async () => {
561
+ const pkgDir = scaffold({brokenComponent: true});
562
+ fs.writeFileSync(
563
+ path.join(pkgDir, 'templates', 'broken.template.mjs'),
564
+ `export default {type: 'block', name: 'Broken', description: 'Missing source'};\n`,
565
+ );
566
+ fs.writeFileSync(
567
+ path.join(pkgDir, 'components', 'ValidWidget.doc.mjs'),
568
+ `export default {type: 'component', name: 'ValidWidget', props: []};\n`,
569
+ );
570
+ fs.writeFileSync(
571
+ path.join(pkgDir, 'components', 'ValidWidget.tsx'),
572
+ `export function ValidWidget() { return null; }\n`,
573
+ );
574
+ const project = await Project.load(tmpDir);
575
+
576
+ const templates = await project.templates();
577
+ const components = await project.components();
578
+ const issues = await project.issues();
579
+
580
+ expect(
581
+ templates.find(
582
+ template =>
583
+ template.dirName === 'hero' && template.package === '@acme/widgets',
584
+ ),
585
+ ).toBeDefined();
586
+ expect(
587
+ components.find(
588
+ component =>
589
+ component.name === 'ValidWidget' &&
590
+ component.package === '@acme/widgets',
591
+ ),
592
+ ).toBeDefined();
593
+ expect(
594
+ components.find(
595
+ component =>
596
+ component.name === 'Widget' && component.package === '@acme/widgets',
597
+ ),
598
+ ).toBeUndefined();
599
+ expect(issues).toEqual(
600
+ expect.arrayContaining([
601
+ expect.objectContaining({code: 'invalid_component'}),
602
+ expect.objectContaining({code: 'invalid_template'}),
603
+ ]),
604
+ );
605
+ });
606
+
471
607
  it('does not throw when an integration codemod is broken', async () => {
472
608
  scaffold({brokenCodemod: true});
473
609
  const project = await Project.load(tmpDir);
@@ -60,17 +60,25 @@ describe('authoring self-docs', () => {
60
60
  );
61
61
  });
62
62
 
63
- describe('what the authoring docs say about the unbuilt docs graph', () => {
64
- it('marks exactly the fields topic loading rejects as not read yet', () => {
63
+ describe('what the authoring docs say about the docs tree', () => {
64
+ it('marks exactly the fields the docs tree does not read yet', () => {
65
65
  const notReadYet = graphFieldsDoc.fields
66
66
  .filter(field => /Not read yet/.test(field.description))
67
67
  .map(field => field.name);
68
- expect(notReadYet.sort()).toEqual([...GRAPH_ONLY_FIELDS].sort());
68
+ // The tree reads `placement` for every guide (spec:AST-046); the other
69
+ // graph fields are still refused by every topic reader.
70
+ expect(notReadYet.sort()).toEqual(
71
+ GRAPH_ONLY_FIELDS.filter(field => field !== 'placement').sort(),
72
+ );
69
73
  for (const field of graphFieldsDoc.fields) {
70
- if (notReadYet.includes(field.name)) {
74
+ if (GRAPH_ONLY_FIELDS.includes(field.name)) {
71
75
  expect(field.description).toMatch(/fails to load/);
72
76
  }
73
77
  }
78
+ const placement = graphFieldsDoc.fields.find(f => f.name === 'placement');
79
+ expect(placement.description).toMatch(
80
+ /Read for every guide, the CLI's and each integration's/,
81
+ );
74
82
  expect(graphFieldsDoc.description).toMatch(/not built yet/);
75
83
  });
76
84
 
@@ -85,8 +93,10 @@ describe('what the authoring docs say about the unbuilt docs graph', () => {
85
93
  }
86
94
  });
87
95
 
88
- it('says namespace docs are not loaded yet', () => {
89
- expect(namespaceDoc.description).toMatch(/Not loaded yet/);
96
+ it('says where namespace docs live: the CLI tree, and each integration', () => {
97
+ expect(namespaceDoc.description).toMatch(
98
+ /an integration ships its own in its docs directory/,
99
+ );
90
100
  expect(
91
101
  problemsInTopic({
92
102
  ...namespaceDoc.examples?.[0],
@@ -94,7 +104,7 @@ describe('what the authoring docs say about the unbuilt docs graph', () => {
94
104
  name: 'x',
95
105
  }),
96
106
  ).toEqual([
97
- '"x" is a namespace doc. Only the docs graph reads namespace docs, and it is not built yet; remove this file from the docs directory.',
107
+ '"x" is a namespace doc, which the docs tree reads, not the topic list. The CLI keeps its own in assets/docs/tree; an integration ships its namespace docs in its docs directory.',
98
108
  ]);
99
109
  });
100
110
  });
@@ -27,46 +27,45 @@ export function loadCliSelfDocs(sources?: string[], root?: string): Promise<{
27
27
  }[];
28
28
  }>;
29
29
  /**
30
- * A name as a section-key segment: lowercase words joined by hyphens.
31
- * `integrationPackCheck` and `integration pack` both read naturally.
32
- * @param {string} name
33
- * @returns {string}
30
+ * What cross-links need: the loaded function docs by name, the command names,
31
+ * and the route the docs tree gave a doc, if it gave one.
32
+ * @typedef {object} CliDocIndex
33
+ * @property {Map<string, any>} functions
34
+ * @property {Set<string>} commands
35
+ * @property {(kind: string, name: string) => string | null} route
34
36
  */
35
- export function keySegment(name: string): string;
36
37
  /**
37
- * The section key a doc is read by in `astryx docs cli`, or null when its
38
- * namespace is not one of the topic's.
39
- * @param {any} doc
40
- * @returns {string | null}
41
- */
42
- export function cliSectionKey(doc: any): string | null;
43
- /**
44
- * The `cli` topic: one section per doc whose namespace is `cli/…`.
45
- * @param {any[]} docs every loaded CLI doc; the ones in other namespaces are
46
- * left out
47
- * @returns {import('../../authoring/doctypes/reference/type').ReferenceDoc}
38
+ * @param {any[]} docs every loaded CLI typed doc
39
+ * @param {(kind: string, name: string) => string | null} [route]
40
+ * @returns {CliDocIndex}
48
41
  */
49
- export function buildCliReferenceDoc(docs: any[]): import("../../authoring/doctypes/reference/type").ReferenceDoc;
42
+ export function cliDocIndex(docs: any[], route?: (kind: string, name: string) => string | null): CliDocIndex;
50
43
  /**
51
- * The `cli` topic from every CLI doc that loads. One that fails is left out
52
- * here and reported by {@link auditCliSelfDocs}.
53
- * @returns {Promise<import('../../authoring/doctypes/reference/type').ReferenceDoc>}
44
+ * What `astryx docs <route>` prints for one CLI typed doc: its title and the
45
+ * blocks of its content, with cross-links to the routes the tree gave.
46
+ * @param {any} doc
47
+ * @param {CliDocIndex} index
48
+ * @returns {{id: string, title: string, content: any[]}}
54
49
  */
55
- export function buildCliTopic(): Promise<import("../../authoring/doctypes/reference/type").ReferenceDoc>;
50
+ export function cliDocSection(doc: any, index: CliDocIndex): {
51
+ id: string;
52
+ title: string;
53
+ content: any[];
54
+ };
56
55
  /**
57
- * What stands between a CLI doc and a reader: a missing namespace, one no
58
- * topic reads, one that disagrees with the authoring topic's list, a doc that
59
- * fails to load, and a `cli` section that clashes or is too large.
56
+ * What stands between a CLI doc and a reader: a missing namespace, one nothing
57
+ * reads, one that disagrees with the authoring topic's list, a doc that fails
58
+ * to load, and a tree leaf too large for one read. Whether the tree gives
59
+ * every `cli/...` doc a route is the docs-tree check's job.
60
60
  * @param {{root?: string, sources?: string[], budget?: number, authoringSources?: string[]}} [options]
61
61
  * @returns {Promise<{
62
62
  * docs: number,
63
- * sections: number,
63
+ * tree: number,
64
64
  * authoring: number,
65
65
  * missing: string[],
66
66
  * unknown: {source: string, namespace: string}[],
67
67
  * misfiled: {source: string, message: string}[],
68
68
  * failed: {source: string, error: string}[],
69
- * keyProblems: string[],
70
69
  * oversized: {key: string, title: string, bytes: number}[],
71
70
  * }>}
72
71
  */
@@ -77,7 +76,7 @@ export function auditCliSelfDocs({ root, sources, budget, authoringSources, }?:
77
76
  authoringSources?: string[];
78
77
  }): Promise<{
79
78
  docs: number;
80
- sections: number;
79
+ tree: number;
81
80
  authoring: number;
82
81
  missing: string[];
83
82
  unknown: {
@@ -92,7 +91,6 @@ export function auditCliSelfDocs({ root, sources, budget, authoringSources, }?:
92
91
  source: string;
93
92
  error: string;
94
93
  }[];
95
- keyProblems: string[];
96
94
  oversized: {
97
95
  key: string;
98
96
  title: string;
@@ -102,12 +100,20 @@ export function auditCliSelfDocs({ root, sources, budget, authoringSources, }?:
102
100
  /** The directories, relative to the CLI root, that hold the CLI's own docs. */
103
101
  export const CLI_SELF_DOC_DIRS: string[];
104
102
  /**
105
- * Every namespace a CLI doc may declare, and the topic that reads it. A doc in
106
- * a `cli/` namespace is the section `<key prefix>-<name>` of `astryx docs cli`;
107
- * a doc in `authoring` is a section of `astryx docs authoring`.
108
- * @type {Record<string, {topic: string, keyPrefix?: string}>}
103
+ * Every namespace a CLI doc may declare, and what reads it. The docs tree
104
+ * adopts `cli/commands` (under `cli/commands`) and `cli/api` (under
105
+ * `cli/api/<kind>s`); `astryx docs authoring` reads `authoring` from its list.
106
+ * @type {Record<string, {reader: 'tree' | 'authoring'}>}
109
107
  */
110
108
  export const CLI_DOC_NAMESPACES: Record<string, {
111
- topic: string;
112
- keyPrefix?: string;
109
+ reader: "tree" | "authoring";
113
110
  }>;
111
+ /**
112
+ * What cross-links need: the loaded function docs by name, the command names,
113
+ * and the route the docs tree gave a doc, if it gave one.
114
+ */
115
+ export type CliDocIndex = {
116
+ functions: Map<string, any>;
117
+ commands: Set<string>;
118
+ route: (kind: string, name: string) => string | null;
119
+ };