@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.
- package/README.md +19 -17
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.mjs +60 -12
- package/api/component/list/list.mjs +3 -2
- package/api/docs/_adapter.d.mts +209 -28
- package/api/docs/_adapter.mjs +667 -35
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +20 -3
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +35 -15
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +165 -2
- package/api/docs/docs.type.mjs +101 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +547 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +25 -5
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/doctor/doctor.d.mts +30 -2
- package/api/doctor/doctor.mjs +146 -7
- package/api/doctor/doctor.test.mjs +89 -1
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +1 -1
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +107 -5
- package/api/integration/add-contribution.test.mjs +137 -0
- package/api/integration/authoring-checks.mjs +125 -28
- package/api/integration/authoring-checks.test.mjs +171 -3
- package/api/integration/authoring-checks.type.mjs +6 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddDoc.doc.mjs +7 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationPackCheck.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +121 -0
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/template-conflict-compatibility.test.mjs +73 -0
- package/api/integration/validate-integration.test.mjs +3 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/index.ts +2 -0
- package/api/layout/_adapter.mjs +20 -5
- package/api/search/search.d.mts +26 -1
- package/api/search/search.doc.mjs +4 -3
- package/api/search/search.mjs +308 -29
- package/api/search/search.test.mjs +91 -2
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/template/list/list.mjs +1 -0
- package/api/template/template-integration.test.mjs +1022 -3
- package/api/template/template.doc.mjs +27 -7
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- package/api/theme/template/template.test.mjs +5 -0
- package/api/theme/themeTemplate.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +2 -2
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +3 -3
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/namespace/namespace.doc.mjs +5 -9
- package/authoring/doctypes/reference/reference.doc.mjs +3 -3
- package/authoring/doctypes/reference/type.ts +3 -0
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -1
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +8 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build.mjs +5 -2
- package/clients/cli/commands/component/index.mjs +1 -1
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
- package/clients/cli/commands/discover.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +20 -8
- package/clients/cli/commands/docs.mjs +175 -18
- package/clients/cli/commands/docs.test.mjs +114 -7
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
- package/clients/cli/commands/doctor-integration.test.mjs +75 -1
- package/clients/cli/commands/doctor.mjs +53 -16
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/search.mjs +11 -2
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/template.doc.mjs +23 -6
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/text-json-parity.test.mjs +2 -1
- package/clients/cli/index.mjs +8 -0
- package/clients/cli/lib/manifest.mjs +9 -2
- package/foundation/agent-docs/agent-docs.mjs +1 -0
- package/foundation/agent-docs/agent-docs.test.mjs +10 -1
- package/foundation/config/project.d.mts +12 -11
- package/foundation/config/project.mjs +73 -59
- package/foundation/config/project.test.mjs +141 -5
- package/foundation/discovery/authoring-self-docs.test.mjs +17 -7
- package/foundation/discovery/cli-self-docs.d.mts +40 -34
- package/foundation/discovery/cli-self-docs.mjs +91 -115
- package/foundation/discovery/cli-self-docs.test.mjs +104 -166
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -0
- package/foundation/discovery/docs-discovery.d.mts +105 -8
- package/foundation/discovery/docs-discovery.mjs +177 -13
- package/foundation/discovery/docs-discovery.test.mjs +56 -17
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +9 -2
- package/foundation/discovery/docs-section-key.mjs +15 -1
- package/foundation/discovery/template-adapter.d.mts +92 -6
- package/foundation/discovery/template-adapter.mjs +453 -17
- package/foundation/discovery/template-adapter.test.mjs +42 -0
- package/foundation/discovery/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -0
- package/foundation/doc-compiler/bundle.mjs +61 -1
- package/foundation/doc-compiler/bundle.test.mjs +21 -10
- package/foundation/doc-compiler/compile.d.mts +113 -132
- package/foundation/doc-compiler/compile.mjs +52 -6
- package/foundation/doc-compiler/diagnostics.mjs +28 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
- package/foundation/doc-compiler/inputs.d.mts +2 -2
- package/foundation/doc-compiler/inputs.mjs +6 -1
- package/foundation/doc-compiler/ir.mjs +7 -0
- package/foundation/doc-compiler/lenses.d.mts +3 -2
- package/foundation/doc-compiler/lenses.mjs +2 -1
- package/foundation/doc-compiler/links.d.mts +135 -0
- package/foundation/doc-compiler/links.mjs +253 -0
- package/foundation/doc-compiler/links.test.mjs +139 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
- package/foundation/doc-compiler/read.d.mts +3 -2
- package/foundation/doc-compiler/read.mjs +6 -1
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +109 -0
- package/foundation/integrations/contribution-inventory.d.mts +2 -1
- package/foundation/integrations/contribution-inventory.mjs +10 -4
- package/foundation/integrations/contribution-inventory.test.mjs +19 -0
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/validate-contributions.mjs +25 -27
- package/foundation/response/response-types.doc.d.mts +5 -1
- package/foundation/response/response-types.doc.mjs +18 -9
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +9 -9
- 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,
|
|
84
|
-
`export default { type: '
|
|
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,
|
|
88
|
-
`export default function
|
|
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
|
|
64
|
-
it('marks exactly the fields
|
|
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
|
-
|
|
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 (
|
|
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
|
|
89
|
-
expect(namespaceDoc.description).toMatch(
|
|
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
|
|
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
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
-
* @
|
|
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
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
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
|
|
42
|
+
export function cliDocIndex(docs: any[], route?: (kind: string, name: string) => string | null): CliDocIndex;
|
|
50
43
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
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
|
|
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
|
|
58
|
-
*
|
|
59
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @type {Record<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
|
-
|
|
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
|
+
};
|