@astryxdesign/cli 0.6.3-canary.f22695a → 0.6.3
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 +1 -2
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +2 -2
- package/api/component/component.type.d.mts +6 -6
- package/api/component/component.type.mjs +19 -19
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +24 -37
- package/api/docs/_adapter.mjs +83 -169
- package/api/docs/detail/detail.mjs +63 -14
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +20 -44
- package/api/docs/detail/section/section.test.mjs +0 -41
- package/api/docs/docs.d.mts +2 -7
- package/api/docs/docs.doc.mjs +10 -27
- package/api/docs/docs.mjs +9 -16
- package/api/docs/docs.test.mjs +0 -6
- package/api/docs/docs.type.d.mts +3 -40
- package/api/docs/docs.type.mjs +8 -36
- package/api/docs/integrationDocs.test.mjs +0 -106
- package/api/doctor/doctor.d.mts +0 -48
- package/api/doctor/doctor.mjs +0 -232
- package/api/doctor/doctor.test.mjs +0 -196
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +1 -1
- package/api/integration/add-contribution.mjs +3 -5
- package/api/integration/add-contribution.test.mjs +4 -4
- package/api/integration/integration-authoring.type.d.mts +1 -1
- package/api/integration/pack-check.mjs +7 -49
- package/api/integration/pack-check.test.mjs +0 -249
- package/api/search/search.d.mts +1 -1
- package/api/search/search.mjs +5 -5
- package/api/search/search.type.d.mts +2 -2
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/template.d.mts +1 -1
- package/api/template/template.type.d.mts +6 -6
- package/api/template/template.type.mjs +12 -12
- package/api/theme/build/build.mjs +6 -20
- package/api/theme/build/build.test.mjs +0 -127
- package/api/theme/palette/generate/generate.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +13 -10
- package/api/theme/palette/generate/generator.mjs +3 -7
- package/api/theme/theme.type.d.mts +11 -170
- package/api/theme/theme.type.mjs +27 -94
- package/api/upgrade/_adapter.mjs +5 -71
- package/api/upgrade/upgrade.doc.mjs +3 -4
- package/api/upgrade/upgrade.type.d.mts +5 -5
- package/api/upgrade/upgrade.type.mjs +11 -11
- package/assets/codemods/integration-discovery.mjs +2 -40
- package/assets/codemods/integration-discovery.test.mjs +0 -58
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +5 -27
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +5 -20
- package/assets/docs/README.md +0 -9
- package/assets/docs/cli-integrations.doc.mjs +15 -86
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +3 -19
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +65 -383
- package/authoring/_shared/contract.ts +0 -22
- package/authoring/codemod/codemod.doc.mjs +1 -6
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +6 -8
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +3 -3
- package/authoring/debug/parse.d.mts +5 -5
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +23 -788
- package/authoring/doctypes/_schema.mjs +39 -492
- package/authoring/doctypes/base/type.ts +0 -40
- package/authoring/doctypes/command/command.doc.mjs +2 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -3
- package/authoring/doctypes/component/component.doc.mjs +3 -6
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +3 -4
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -3
- package/authoring/doctypes/function/function.doc.mjs +0 -4
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +2 -6
- package/authoring/doctypes/hook/hook.doc.mjs +0 -4
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +2 -3
- package/authoring/doctypes/legacy.d.mts +6 -8
- package/authoring/doctypes/legacy.mjs +4 -5
- package/authoring/doctypes/parse.d.mts +18 -20
- package/authoring/doctypes/parse.mjs +10 -16
- package/authoring/doctypes/parse.test.mjs +3 -77
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +5 -8
- package/authoring/doctypes/reference/reference.doc.mjs +4 -17
- package/authoring/doctypes/reference/type.ts +5 -51
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +2 -3
- package/authoring/doctypes/template/parse.d.mts +1 -92
- package/authoring/doctypes/template/parse.mjs +2 -36
- package/authoring/doctypes/template/parse.test.mjs +2 -8
- package/authoring/doctypes/template/template.doc.mjs +0 -4
- package/authoring/doctypes/template/type.ts +2 -5
- package/authoring/doctypes/types.ts +9 -10
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +17 -49
- package/authoring/index.mjs +0 -1
- package/authoring/integration/integration.doc.mjs +6 -13
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +1 -10
- package/authoring/integration/schema.d.mts +4 -6
- package/authoring/integration/schema.mjs +3 -9
- package/authoring/integration/type.ts +6 -23
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/commands/docs.doc.mjs +3 -13
- package/clients/cli/commands/docs.mjs +21 -121
- package/clients/cli/commands/docs.test.mjs +0 -88
- package/clients/cli/commands/integration-authoring.test.mjs +9 -13
- package/clients/cli/commands/theme-palette-generate.doc.mjs +4 -8
- package/clients/cli/commands/upgrade.doc.mjs +2 -2
- package/clients/cli/formatters/index.mjs +1 -162
- package/clients/cli/formatters/index.test.mjs +0 -91
- package/clients/cli/lib/manifest.mjs +2 -7
- package/foundation/config/project.mjs +6 -21
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +1 -2
- package/foundation/discovery/docs-discovery.d.mts +4 -11
- package/foundation/discovery/docs-discovery.mjs +88 -208
- package/foundation/discovery/docs-discovery.test.mjs +13 -279
- package/foundation/discovery/template-adapter.mjs +1 -2
- package/foundation/integrations/autolink.mjs +5 -12
- package/foundation/integrations/integration-warnings.mjs +0 -6
- package/foundation/integrations/integrations.d.mts +2 -46
- package/foundation/integrations/integrations.mjs +8 -167
- package/foundation/integrations/integrations.test.mjs +1 -384
- package/foundation/integrations/validate-contributions.d.mts +0 -2
- package/foundation/integrations/validate-contributions.mjs +0 -10
- package/foundation/response/json-contract.test.mjs +17 -46
- package/foundation/response/response-types.doc.mjs +1 -6
- package/package.json +11 -9
- package/api/docs/compiled-topics.test.mjs +0 -78
- package/api/docs/index/index.d.mts +0 -18
- package/api/docs/index/index.mjs +0 -32
- package/api/docs/index/index.test.mjs +0 -62
- package/api/upgrade/project-context.test.mjs +0 -272
- package/assets/docs/authoring.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerFormats.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerFormats.tsx +0 -34
- package/assets/templates/blocks/components/Timer/TimerInline.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerInline.tsx +0 -14
- package/assets/templates/blocks/components/Timer/TimerShowcase.doc.mjs +0 -13
- package/assets/templates/blocks/components/Timer/TimerShowcase.tsx +0 -47
- package/assets/templates/blocks/components/Timer/TimerTypography.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerTypography.tsx +0 -31
- package/authoring/doctypes/base/graph-fields.doc.d.mts +0 -9
- package/authoring/doctypes/base/graph-fields.doc.mjs +0 -62
- package/authoring/doctypes/load-contract.test.mjs +0 -207
- package/authoring/doctypes/namespace/namespace.doc.d.mts +0 -9
- package/authoring/doctypes/namespace/namespace.doc.mjs +0 -132
- package/authoring/doctypes/namespace/parse.d.mts +0 -12
- package/authoring/doctypes/namespace/parse.mjs +0 -25
- package/authoring/doctypes/namespace/parse.test.mjs +0 -165
- package/authoring/doctypes/namespace/type.ts +0 -71
- package/authoring/identity/identity.doc.d.mts +0 -9
- package/authoring/identity/identity.doc.mjs +0 -61
- package/authoring/identity/type.ts +0 -132
- package/foundation/discovery/authoring-self-docs.d.mts +0 -69
- package/foundation/discovery/authoring-self-docs.mjs +0 -214
- package/foundation/discovery/authoring-self-docs.test.mjs +0 -154
- package/foundation/discovery/docs-output-budget.d.mts +0 -28
- package/foundation/discovery/docs-output-budget.mjs +0 -50
- package/foundation/discovery/docs-section-key.d.mts +0 -98
- package/foundation/discovery/docs-section-key.mjs +0 -221
- package/foundation/discovery/docs-section-key.test.mjs +0 -224
- package/foundation/doc-compiler/compile.d.mts +0 -162
- package/foundation/doc-compiler/compile.mjs +0 -262
- package/foundation/doc-compiler/doc-compiler.test.mjs +0 -687
- package/foundation/doc-compiler/ir.d.mts +0 -9
- package/foundation/doc-compiler/ir.mjs +0 -287
- package/foundation/doc-compiler/lenses.d.mts +0 -33
- package/foundation/doc-compiler/lenses.mjs +0 -127
- package/foundation/identity/provider-identity.d.mts +0 -90
- package/foundation/identity/provider-identity.mjs +0 -320
- package/foundation/identity/provider-identity.test.mjs +0 -254
- package/foundation/identity/providers.d.mts +0 -7
- package/foundation/identity/providers.mjs +0 -16
- package/foundation/integrations/provider-conflicts.test.mjs +0 -125
package/api/docs/docs.doc.mjs
CHANGED
|
@@ -13,20 +13,18 @@ export const doc = {
|
|
|
13
13
|
name: 'docs',
|
|
14
14
|
displayName: 'docs()',
|
|
15
15
|
summary:
|
|
16
|
-
'Read the reference docs: list every topic, one topic
|
|
16
|
+
'Read the reference docs: list every topic, one topic, or a single section of a topic.',
|
|
17
17
|
description:
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'part of its title (an ambiguous query is refused). Token-ref blocks are ' +
|
|
23
|
-
'inlined in every read. The topic set is the CLI\'s own docs plus the ' +
|
|
18
|
+
'Routes on its arguments: no topic lists every reference-doc topic; a topic ' +
|
|
19
|
+
'returns that full ReferenceDoc (with token-ref blocks inlined); a topic ' +
|
|
20
|
+
'plus a section returns the first section whose title contains the ' +
|
|
21
|
+
'(case-insensitive) query. The topic set is the CLI\'s own docs plus the ' +
|
|
24
22
|
'ones the project\'s configured integrations contribute, including any ' +
|
|
25
23
|
'topic an integration replaces or extends, so it depends on the cwd. ' +
|
|
26
24
|
'Overlay options select localized or dense variants.',
|
|
27
25
|
importPath: '@astryxdesign/cli/api',
|
|
28
26
|
signature:
|
|
29
|
-
'docs(topic?: string, section?: string, options?: DocsOptions): Promise<DocsListResponse |
|
|
27
|
+
'docs(topic?: string, section?: string, options?: DocsOptions): Promise<DocsListResponse | DocsDetailResponse | DocsDetailSectionResponse>',
|
|
30
28
|
keywords: [
|
|
31
29
|
'docs',
|
|
32
30
|
'documentation',
|
|
@@ -48,7 +46,7 @@ export const doc = {
|
|
|
48
46
|
name: 'section',
|
|
49
47
|
type: 'string',
|
|
50
48
|
description:
|
|
51
|
-
|
|
49
|
+
'Section within the topic to return; matches the first section title that contains this (case-insensitive).',
|
|
52
50
|
},
|
|
53
51
|
{
|
|
54
52
|
name: 'options.lang',
|
|
@@ -65,12 +63,6 @@ export const doc = {
|
|
|
65
63
|
type: 'boolean',
|
|
66
64
|
description: 'Return the token-efficient dense doc variant.',
|
|
67
65
|
},
|
|
68
|
-
{
|
|
69
|
-
name: 'options.index',
|
|
70
|
-
type: 'boolean',
|
|
71
|
-
description:
|
|
72
|
-
"Return the topic's section index (each section's key, title, and summary) instead of the whole doc.",
|
|
73
|
-
},
|
|
74
66
|
{
|
|
75
67
|
name: 'options.cwd',
|
|
76
68
|
type: 'string',
|
|
@@ -89,15 +81,10 @@ export const doc = {
|
|
|
89
81
|
description:
|
|
90
82
|
"One topic's full ReferenceDoc, with token-ref blocks inlined.",
|
|
91
83
|
},
|
|
92
|
-
{
|
|
93
|
-
type: 'docs.index',
|
|
94
|
-
description:
|
|
95
|
-
"One topic's section index (index: true): {name, title, description, sections: [{id, title, summary}]}.",
|
|
96
|
-
},
|
|
97
84
|
{
|
|
98
85
|
type: 'docs.detail.section',
|
|
99
86
|
description:
|
|
100
|
-
'
|
|
87
|
+
'A single ReferenceSection of the topic: the first whose title contains the section query.',
|
|
101
88
|
},
|
|
102
89
|
],
|
|
103
90
|
throws: [
|
|
@@ -107,17 +94,13 @@ export const doc = {
|
|
|
107
94
|
},
|
|
108
95
|
{
|
|
109
96
|
code: 'ERR_UNKNOWN_SECTION',
|
|
110
|
-
when: 'a section is requested but is empty
|
|
97
|
+
when: 'a section is requested but is empty or matches no section title in the topic',
|
|
111
98
|
},
|
|
112
99
|
],
|
|
113
100
|
examples: [
|
|
114
101
|
{label: 'List topics', code: 'const r = await docs();'},
|
|
115
102
|
{label: 'Load a topic', code: "await docs('principles');"},
|
|
116
|
-
{
|
|
117
|
-
label: "A topic's sections",
|
|
118
|
-
code: "await docs('principles', undefined, {index: true});",
|
|
119
|
-
},
|
|
120
|
-
{label: 'One section by key', code: "await docs('tokens', 'spacing');"},
|
|
103
|
+
{label: 'One section', code: "await docs('tokens', 'spacing');"},
|
|
121
104
|
],
|
|
122
105
|
command: 'docs',
|
|
123
106
|
related: ['search', 'component', 'hook', 'template'],
|
package/api/docs/docs.mjs
CHANGED
|
@@ -3,27 +3,24 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Programmatic API for the docs command.
|
|
5
5
|
*
|
|
6
|
-
* Dispatcher + barrel. `docs()` routes by argument shape into one of
|
|
6
|
+
* Dispatcher + barrel. `docs()` routes by argument shape into one of three
|
|
7
7
|
* leaves, each projecting into a single { type, data } envelope:
|
|
8
8
|
*
|
|
9
|
-
* docs()
|
|
10
|
-
* docs(topic)
|
|
11
|
-
* docs(topic,
|
|
12
|
-
* docs(topic, section) -> section -> docs.detail.section
|
|
9
|
+
* docs() -> list -> docs.list
|
|
10
|
+
* docs(topic) -> detail -> docs.detail
|
|
11
|
+
* docs(topic, section) -> section -> docs.detail.section
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* _adapter.mjs.
|
|
13
|
+
* The leaves live in list/, detail/, and detail/section/; the discovery,
|
|
14
|
+
* overlay loading, and topic resolution they share sit in _adapter.mjs. This
|
|
15
|
+
* module keeps the same `docs` export (and re-exports the leaves) so
|
|
16
|
+
* api/index.mjs and the CLI consumer import from here unchanged.
|
|
19
17
|
*/
|
|
20
18
|
|
|
21
19
|
import {list} from './list/list.mjs';
|
|
22
|
-
import {index} from './index/index.mjs';
|
|
23
20
|
import {detail} from './detail/detail.mjs';
|
|
24
21
|
import {section as sectionLeaf} from './detail/section/section.mjs';
|
|
25
22
|
|
|
26
|
-
export {list,
|
|
23
|
+
export {list, detail, sectionLeaf as section};
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
26
|
* @param {string} [topic]
|
|
@@ -32,12 +29,9 @@ export {list, index, detail, sectionLeaf as section};
|
|
|
32
29
|
* @param {string} [options.lang]
|
|
33
30
|
* @param {boolean} [options.zh]
|
|
34
31
|
* @param {boolean} [options.dense]
|
|
35
|
-
* @param {boolean} [options.index] return the topic's section index instead of
|
|
36
|
-
* the whole doc
|
|
37
32
|
* @param {string} [options.cwd]
|
|
38
33
|
* @returns {Promise<
|
|
39
34
|
* import('./docs.type.mjs').DocsListResponse |
|
|
40
|
-
* import('./docs.type.mjs').DocsIndexResponse |
|
|
41
35
|
* import('./docs.type.mjs').DocsDetailResponse |
|
|
42
36
|
* import('./docs.type.mjs').DocsDetailSectionResponse
|
|
43
37
|
* >}
|
|
@@ -45,6 +39,5 @@ export {list, index, detail, sectionLeaf as section};
|
|
|
45
39
|
export async function docs(topic, section, options = {}) {
|
|
46
40
|
if (!topic) return list(options);
|
|
47
41
|
if (section) return sectionLeaf(topic, section, options);
|
|
48
|
-
if (options.index) return index(topic, options);
|
|
49
42
|
return detail(topic, options);
|
|
50
43
|
}
|
package/api/docs/docs.test.mjs
CHANGED
|
@@ -33,12 +33,6 @@ describe('docs() dispatcher routing', () => {
|
|
|
33
33
|
expect(r.type).toBe('docs.detail');
|
|
34
34
|
}, SLOW);
|
|
35
35
|
|
|
36
|
-
it('topic + index -> docs.index', async () => {
|
|
37
|
-
const {data} = await docs();
|
|
38
|
-
const r = await docs(data[0].topic, undefined, {index: true});
|
|
39
|
-
expect(r.type).toBe('docs.index');
|
|
40
|
-
}, SLOW);
|
|
41
|
-
|
|
42
36
|
it('topic + section -> docs.detail.section', async () => {
|
|
43
37
|
const {data} = await docs();
|
|
44
38
|
let routed = null;
|
package/api/docs/docs.type.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* xds --json docs
|
|
6
6
|
*/
|
|
7
7
|
export type DocsListResponse = {
|
|
8
8
|
type: "docs.list";
|
|
@@ -23,46 +23,14 @@ export type DocsListEntry = {
|
|
|
23
23
|
replaces?: string | undefined;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
export type DocsIndexResponse = {
|
|
29
|
-
type: "docs.index";
|
|
30
|
-
data: DocsIndex;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* astryx --json docs <topic>
|
|
26
|
+
* xds --json docs <topic>
|
|
34
27
|
*/
|
|
35
28
|
export type DocsDetailResponse = {
|
|
36
29
|
type: "docs.detail";
|
|
37
30
|
data: import("@astryxdesign/cli/authoring").ReferenceDoc;
|
|
38
31
|
};
|
|
39
32
|
/**
|
|
40
|
-
*
|
|
41
|
-
* is read by.
|
|
42
|
-
*/
|
|
43
|
-
export type DocsIndex = {
|
|
44
|
-
/**
|
|
45
|
-
* the topic
|
|
46
|
-
*/
|
|
47
|
-
name: string;
|
|
48
|
-
title: string;
|
|
49
|
-
description: string;
|
|
50
|
-
sections: DocsIndexSection[];
|
|
51
|
-
};
|
|
52
|
-
export type DocsIndexSection = {
|
|
53
|
-
/**
|
|
54
|
-
* stable key; pass it as the section argument
|
|
55
|
-
*/
|
|
56
|
-
id: string;
|
|
57
|
-
title: string;
|
|
58
|
-
/**
|
|
59
|
-
* the section's first line of text, at most 240
|
|
60
|
-
* characters
|
|
61
|
-
*/
|
|
62
|
-
summary: string;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* astryx --json docs <topic> <section>
|
|
33
|
+
* xds --json docs <topic> <section>
|
|
66
34
|
*/
|
|
67
35
|
export type DocsDetailSectionResponse = {
|
|
68
36
|
type: "docs.detail.section";
|
|
@@ -75,11 +43,6 @@ export type DocsOptions = {
|
|
|
75
43
|
lang?: string | undefined;
|
|
76
44
|
zh?: boolean | undefined;
|
|
77
45
|
dense?: boolean | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* return a topic's section index instead of its
|
|
80
|
-
* whole doc
|
|
81
|
-
*/
|
|
82
|
-
index?: boolean | undefined;
|
|
83
46
|
/**
|
|
84
47
|
* project directory whose configured integrations
|
|
85
48
|
* contribute topics; defaults to process.cwd()
|
package/api/docs/docs.type.mjs
CHANGED
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
* @file Colocated types for the `docs` command — source of truth for the docs
|
|
5
5
|
* command JSON responses. `types/docs.d.ts` re-exports these.
|
|
6
6
|
*
|
|
7
|
-
* Invocation
|
|
7
|
+
* Invocation -> type discriminator
|
|
8
8
|
* ------------------------------------------------------------
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* (unknown topic/section) -> CLIError
|
|
9
|
+
* xds --json docs -> docs.list
|
|
10
|
+
* xds --json docs <topic> -> docs.detail
|
|
11
|
+
* xds --json docs <topic> <section> -> docs.detail.section
|
|
12
|
+
* (unknown topic/section) -> CLIError
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
16
|
+
* xds --json docs
|
|
18
17
|
* @typedef {object} DocsListResponse
|
|
19
18
|
* @property {'docs.list'} type
|
|
20
19
|
* @property {DocsListEntry[]} data
|
|
@@ -31,39 +30,14 @@
|
|
|
31
30
|
*/
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @typedef {object} DocsIndexResponse
|
|
36
|
-
* @property {'docs.index'} type
|
|
37
|
-
* @property {DocsIndex} data
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* astryx --json docs <topic>
|
|
33
|
+
* xds --json docs <topic>
|
|
42
34
|
* @typedef {object} DocsDetailResponse
|
|
43
35
|
* @property {'docs.detail'} type
|
|
44
36
|
* @property {import('@astryxdesign/cli/authoring').ReferenceDoc} data
|
|
45
37
|
*/
|
|
46
38
|
|
|
47
39
|
/**
|
|
48
|
-
*
|
|
49
|
-
* is read by.
|
|
50
|
-
* @typedef {object} DocsIndex
|
|
51
|
-
* @property {string} name the topic
|
|
52
|
-
* @property {string} title
|
|
53
|
-
* @property {string} description
|
|
54
|
-
* @property {DocsIndexSection[]} sections
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @typedef {object} DocsIndexSection
|
|
59
|
-
* @property {string} id stable key; pass it as the section argument
|
|
60
|
-
* @property {string} title
|
|
61
|
-
* @property {string} summary the section's first line of text, at most 240
|
|
62
|
-
* characters
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* astryx --json docs <topic> <section>
|
|
40
|
+
* xds --json docs <topic> <section>
|
|
67
41
|
* @typedef {object} DocsDetailSectionResponse
|
|
68
42
|
* @property {'docs.detail.section'} type
|
|
69
43
|
* @property {import('@astryxdesign/cli/authoring').ReferenceSection} data
|
|
@@ -75,8 +49,6 @@
|
|
|
75
49
|
* @property {string} [lang]
|
|
76
50
|
* @property {boolean} [zh]
|
|
77
51
|
* @property {boolean} [dense]
|
|
78
|
-
* @property {boolean} [index] return a topic's section index instead of its
|
|
79
|
-
* whole doc
|
|
80
52
|
* @property {string} [cwd] project directory whose configured integrations
|
|
81
53
|
* contribute topics; defaults to process.cwd()
|
|
82
54
|
*/
|
|
@@ -177,112 +177,6 @@ describe('integration-contributed topics', () => {
|
|
|
177
177
|
expect(extended.data.sections.length).toBe(builtin.data.sections.length + 1);
|
|
178
178
|
}, SLOW);
|
|
179
179
|
|
|
180
|
-
it('migrates a real built-in section to a stable ID without duplicating it', async () => {
|
|
181
|
-
const builtin = await docs('theme');
|
|
182
|
-
// Readers see a key on every section; the migration case is one whose
|
|
183
|
-
// source authors no id.
|
|
184
|
-
const {docs: authored} = await import('../../assets/docs/theme.doc.mjs');
|
|
185
|
-
const target = authored.sections.find(section => section.id == null);
|
|
186
|
-
expect(target).toBeDefined();
|
|
187
|
-
scaffold({
|
|
188
|
-
'theme-internal.doc.mjs': topic({
|
|
189
|
-
name: 'theme-internal',
|
|
190
|
-
extends: 'theme',
|
|
191
|
-
sections: [
|
|
192
|
-
{
|
|
193
|
-
id: 'acme-theme-setup',
|
|
194
|
-
title: target.title,
|
|
195
|
-
content: [{type: 'prose', text: 'Use the Acme theme.'}],
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
}),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
const extended = await docs('theme', undefined, {cwd: tmpDir});
|
|
202
|
-
expect(extended.data.sections).toHaveLength(builtin.data.sections.length);
|
|
203
|
-
const matches = extended.data.sections.filter(
|
|
204
|
-
section => section.title === target.title,
|
|
205
|
-
);
|
|
206
|
-
expect(matches).toEqual([
|
|
207
|
-
expect.objectContaining({
|
|
208
|
-
id: 'acme-theme-setup',
|
|
209
|
-
content: [{type: 'prose', text: 'Use the Acme theme.'}],
|
|
210
|
-
}),
|
|
211
|
-
]);
|
|
212
|
-
}, SLOW);
|
|
213
|
-
|
|
214
|
-
it('replaces a real built-in section by the key its index shows', async () => {
|
|
215
|
-
const index = await docs('theme', undefined, {index: true});
|
|
216
|
-
const target = index.data.sections[0];
|
|
217
|
-
scaffold({
|
|
218
|
-
'theme-internal.doc.mjs': topic({
|
|
219
|
-
name: 'theme-internal',
|
|
220
|
-
extends: 'theme',
|
|
221
|
-
sections: [
|
|
222
|
-
{
|
|
223
|
-
id: target.id,
|
|
224
|
-
title: `${target.title} with Acme`,
|
|
225
|
-
content: [{type: 'prose', text: 'Acme first.'}],
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
}),
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
const extended = await docs('theme', undefined, {cwd: tmpDir});
|
|
232
|
-
expect(extended.data.sections).toHaveLength(index.data.sections.length);
|
|
233
|
-
expect(extended.data.sections.filter(s => s.id === target.id)).toEqual([
|
|
234
|
-
expect.objectContaining({content: [{type: 'prose', text: 'Acme first.'}]}),
|
|
235
|
-
]);
|
|
236
|
-
const read = await docs('theme', target.id, {cwd: tmpDir});
|
|
237
|
-
expect(read.data.title).toBe(`${target.title} with Acme`);
|
|
238
|
-
}, SLOW);
|
|
239
|
-
|
|
240
|
-
it.each(['zh', 'dense'])(
|
|
241
|
-
'replaces translated real sections by their authored titles under --%s',
|
|
242
|
-
async lang => {
|
|
243
|
-
const english = await docs('theme');
|
|
244
|
-
const englishTitles = english.data.sections.map(section => section.title);
|
|
245
|
-
expect(englishTitles).toEqual(
|
|
246
|
-
expect.arrayContaining(['Quick Start', 'Theme Props']),
|
|
247
|
-
);
|
|
248
|
-
scaffold({
|
|
249
|
-
'theme-internal.doc.mjs': topic({
|
|
250
|
-
name: 'theme-internal',
|
|
251
|
-
extends: 'theme',
|
|
252
|
-
sections: [
|
|
253
|
-
{
|
|
254
|
-
id: 'acme-quick-start',
|
|
255
|
-
title: 'Quick Start',
|
|
256
|
-
content: [{type: 'prose', text: 'Acme quick start.'}],
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
title: 'Theme Props',
|
|
260
|
-
content: [{type: 'prose', text: 'Acme props.'}],
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
}),
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
const base = await docs('theme', undefined, {lang});
|
|
267
|
-
expect(base.data.sections.map(section => section.title)).not.toEqual(
|
|
268
|
-
englishTitles,
|
|
269
|
-
);
|
|
270
|
-
const extended = await docs('theme', undefined, {cwd: tmpDir, lang});
|
|
271
|
-
expect(extended.data.sections).toHaveLength(base.data.sections.length);
|
|
272
|
-
expect(
|
|
273
|
-
extended.data.sections.filter(
|
|
274
|
-
section => section.id === 'acme-quick-start',
|
|
275
|
-
),
|
|
276
|
-
).toHaveLength(1);
|
|
277
|
-
expect(
|
|
278
|
-
extended.data.sections.filter(
|
|
279
|
-
section => section.content[0]?.text === 'Acme props.',
|
|
280
|
-
),
|
|
281
|
-
).toHaveLength(1);
|
|
282
|
-
},
|
|
283
|
-
SLOW,
|
|
284
|
-
);
|
|
285
|
-
|
|
286
180
|
it('offers the contributed topics as suggestions on an unknown one', async () => {
|
|
287
181
|
scaffold({'deploying.doc.mjs': topic()});
|
|
288
182
|
await expect(docs('nope-not-a-topic', undefined, {cwd: tmpDir})).rejects.toBeInstanceOf(
|
package/api/doctor/doctor.d.mts
CHANGED
|
@@ -84,36 +84,6 @@ export function checkPeerDeps(ctx: DoctorContext): DoctorCheck;
|
|
|
84
84
|
* @returns {DoctorCheck}
|
|
85
85
|
*/
|
|
86
86
|
export function checkPackageManager(ctx: DoctorContext): DoctorCheck;
|
|
87
|
-
/**
|
|
88
|
-
* Check 6b — every contributing integration owns its provider identity.
|
|
89
|
-
*
|
|
90
|
-
* Artifact and document IDs are provider-scoped, so a package that claims a
|
|
91
|
-
* provider ID an earlier-loaded package already holds is loaded inert: its
|
|
92
|
-
* components, templates, themes, docs, and codemods are withdrawn while the
|
|
93
|
-
* earlier package keeps contributing. That can be a deliberate transition
|
|
94
|
-
* (a renamed package installed beside its predecessor), so it warns rather
|
|
95
|
-
* than fails, but it is never allowed to happen quietly.
|
|
96
|
-
*
|
|
97
|
-
* @param {DoctorContext} ctx
|
|
98
|
-
* @returns {DoctorCheck}
|
|
99
|
-
*/
|
|
100
|
-
export function checkProviderIdentity(ctx: DoctorContext): DoctorCheck;
|
|
101
|
-
/**
|
|
102
|
-
* Every authoring self-doc is reachable from `astryx docs authoring`, loads,
|
|
103
|
-
* and fits in one read. The audit is imported here, inside the try, so a
|
|
104
|
-
* malformed self-doc is reported rather than taking Doctor down.
|
|
105
|
-
* @param {DoctorContext} [_ctx]
|
|
106
|
-
* @returns {Promise<DoctorCheck>}
|
|
107
|
-
*/
|
|
108
|
-
export function checkAuthoringDocs(_ctx?: DoctorContext): Promise<DoctorCheck>;
|
|
109
|
-
/**
|
|
110
|
-
* Every topic reads progressively, in every language it ships: it loads, its
|
|
111
|
-
* section index and each of its sections fit in one read, and no contributed
|
|
112
|
-
* doc is invalid.
|
|
113
|
-
* @param {DoctorContext | Partial<DoctorContext>} ctx
|
|
114
|
-
* @returns {Promise<DoctorCheck>}
|
|
115
|
-
*/
|
|
116
|
-
export function checkDocsProgressiveDisclosure(ctx: DoctorContext | Partial<DoctorContext>): Promise<DoctorCheck>;
|
|
117
87
|
/**
|
|
118
88
|
* Run all diagnostic checks and return a structured report.
|
|
119
89
|
*
|
|
@@ -199,27 +169,9 @@ export type DoctorContext = {
|
|
|
199
169
|
* read at all.
|
|
200
170
|
*/
|
|
201
171
|
integrations?: import("../../foundation/integrations/integrations.mjs").LoadedIntegration[] | null | undefined;
|
|
202
|
-
/**
|
|
203
|
-
* - The topics a docs read sees.
|
|
204
|
-
*/
|
|
205
|
-
docsCatalog?: DocsCatalog | null | undefined;
|
|
206
|
-
/**
|
|
207
|
-
* `invalid_doc` issues from the project's contributed docs.
|
|
208
|
-
*/
|
|
209
|
-
docsCatalogIssues?: {
|
|
210
|
-
package?: string;
|
|
211
|
-
code: string;
|
|
212
|
-
message: string;
|
|
213
|
-
}[] | undefined;
|
|
214
|
-
/**
|
|
215
|
-
* - Why the project's docs catalog
|
|
216
|
-
* could not be built, when it could not.
|
|
217
|
-
*/
|
|
218
|
-
docsCatalogError?: string | null | undefined;
|
|
219
172
|
/**
|
|
220
173
|
* - Error thrown while resolving the config
|
|
221
174
|
* path (e.g. multiple config files present), surfaced by checkConfig as a FAIL.
|
|
222
175
|
*/
|
|
223
176
|
configError?: Error | null | undefined;
|
|
224
177
|
};
|
|
225
|
-
import { DocsCatalog } from '../../foundation/discovery/docs-discovery.mjs';
|