@astryxdesign/cli 0.6.3-canary.2bb99ed → 0.6.3-canary.2bdba84
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 +21 -19
- package/api/build/_adapter.d.mts +50 -0
- package/api/build/_adapter.mjs +60 -0
- package/api/build/build.doc.mjs +13 -7
- package/api/build/build.test.mjs +184 -6
- package/api/build/build.type.d.mts +57 -2
- package/api/build/build.type.mjs +30 -7
- package/api/build/help/help.d.mts +4 -0
- package/api/build/help/help.mjs +24 -11
- package/api/build/kit/kit.d.mts +4 -1
- package/api/build/kit/kit.mjs +165 -49
- package/api/build/kit/rank.d.mts +44 -0
- package/api/build/kit/rank.mjs +432 -0
- package/api/build/kit/rank.test.mjs +196 -0
- 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 +251 -28
- package/api/docs/_adapter.mjs +918 -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 +38 -17
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +181 -2
- package/api/docs/docs.type.mjs +117 -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 +555 -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/docs/reference-blocks.test.mjs +406 -0
- package/api/doctor/doctor.d.mts +30 -2
- package/api/doctor/doctor.mjs +150 -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 +138 -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 +59 -1
- package/api/search/search.doc.mjs +4 -3
- package/api/search/search.mjs +442 -71
- 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/table-floating-bulk-actions.test.mjs +66 -0
- package/api/template/template-integration.test.mjs +1072 -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/layout.doc.dense.mjs +2 -2
- package/assets/docs/layout.doc.mjs +1 -1
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +3 -3
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- 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/assets/docs/working-with-ai.doc.mjs +3 -3
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +72 -0
- package/authoring/doctypes/_schema.mjs +25 -1
- 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/load-contract.test.mjs +25 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +5 -9
- package/authoring/doctypes/reference/reference.doc.mjs +31 -4
- package/authoring/doctypes/reference/type.ts +23 -5
- 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.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build.doc.mjs +11 -6
- package/clients/cli/commands/build.mjs +105 -67
- package/clients/cli/commands/build.text-fields.test.mjs +41 -0
- 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 +177 -20
- 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.d.mts +3 -2
- package/foundation/agent-docs/agent-docs.mjs +13 -9
- package/foundation/agent-docs/agent-docs.test.mjs +19 -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.d.mts +12 -0
- package/foundation/discovery/authoring-self-docs.mjs +20 -8
- package/foundation/discovery/authoring-self-docs.test.mjs +24 -9
- 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 +109 -9
- package/foundation/discovery/docs-discovery.mjs +217 -19
- package/foundation/discovery/docs-discovery.test.mjs +96 -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 +8 -5
- package/foundation/doc-compiler/lenses.mjs +50 -4
- package/foundation/doc-compiler/links.d.mts +162 -0
- package/foundation/doc-compiler/links.mjs +294 -0
- package/foundation/doc-compiler/links.test.mjs +192 -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 +84 -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 +19 -10
- package/foundation/text/string-utils.d.mts +8 -0
- package/foundation/text/string-utils.mjs +18 -0
- 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
|
@@ -52,8 +52,8 @@ declare const eventSchema: z.ZodObject<{
|
|
|
52
52
|
}>>;
|
|
53
53
|
globalOptions: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
54
54
|
outcome: z.ZodEnum<{
|
|
55
|
-
ok: "ok";
|
|
56
55
|
error: "error";
|
|
56
|
+
ok: "ok";
|
|
57
57
|
"parse-error": "parse-error";
|
|
58
58
|
fatal: "fatal";
|
|
59
59
|
rejected: "rejected";
|
|
@@ -79,8 +79,8 @@ declare const eventSchema: z.ZodObject<{
|
|
|
79
79
|
component: "component";
|
|
80
80
|
command: "command";
|
|
81
81
|
hook: "hook";
|
|
82
|
-
doc: "doc";
|
|
83
82
|
template: "template";
|
|
83
|
+
doc: "doc";
|
|
84
84
|
integration: "integration";
|
|
85
85
|
migration: "migration";
|
|
86
86
|
mixed: "mixed";
|
|
@@ -106,10 +106,10 @@ declare const eventSchema: z.ZodObject<{
|
|
|
106
106
|
agentSessionIdHash: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
107
107
|
agentSessionIdSource: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
108
108
|
invocationSource: z.ZodDefault<z.ZodEnum<{
|
|
109
|
+
unknown: "unknown";
|
|
109
110
|
human: "human";
|
|
110
111
|
ai: "ai";
|
|
111
112
|
automation: "automation";
|
|
112
|
-
unknown: "unknown";
|
|
113
113
|
}>>;
|
|
114
114
|
oneOff: z.ZodBoolean;
|
|
115
115
|
packageManager: z.ZodNullable<z.ZodString>;
|
|
@@ -93,6 +93,52 @@ export const GraphContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
93
93
|
full: "full";
|
|
94
94
|
}>>;
|
|
95
95
|
}, z.core.$strict>], "type">;
|
|
96
|
+
/**
|
|
97
|
+
* A topic section's blocks: the stable union, plus a reference block, which a
|
|
98
|
+
* read inlines as the doc it includes.
|
|
99
|
+
*/
|
|
100
|
+
export const SectionContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"prose">;
|
|
102
|
+
text: z.ZodString;
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"heading">;
|
|
105
|
+
level: z.ZodUnion<readonly [z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
|
|
106
|
+
text: z.ZodString;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
type: z.ZodLiteral<"code">;
|
|
109
|
+
lang: z.ZodString;
|
|
110
|
+
code: z.ZodString;
|
|
111
|
+
label: z.ZodOptional<z.ZodString>;
|
|
112
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
113
|
+
type: z.ZodLiteral<"table">;
|
|
114
|
+
headers: z.ZodArray<z.ZodString>;
|
|
115
|
+
rows: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
116
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
117
|
+
type: z.ZodLiteral<"list">;
|
|
118
|
+
style: z.ZodEnum<{
|
|
119
|
+
ordered: "ordered";
|
|
120
|
+
unordered: "unordered";
|
|
121
|
+
do: "do";
|
|
122
|
+
dont: "dont";
|
|
123
|
+
}>;
|
|
124
|
+
items: z.ZodArray<z.ZodString>;
|
|
125
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"token-ref">;
|
|
127
|
+
topic: z.ZodString;
|
|
128
|
+
section: z.ZodString;
|
|
129
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"reference">;
|
|
131
|
+
target: z.ZodString;
|
|
132
|
+
projection: z.ZodOptional<z.ZodObject<{
|
|
133
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
134
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
presentation: z.ZodOptional<z.ZodEnum<{
|
|
137
|
+
compact: "compact";
|
|
138
|
+
summary: "summary";
|
|
139
|
+
full: "full";
|
|
140
|
+
}>>;
|
|
141
|
+
}, z.core.$strict>], "type">;
|
|
96
142
|
/** Namespace content accepts both stable reference blocks and graph-only blocks. */
|
|
97
143
|
export const NamespaceContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
98
144
|
type: z.ZodLiteral<"prose">;
|
|
@@ -303,6 +349,18 @@ export const GenericDocKindSchema: z.ZodObject<{
|
|
|
303
349
|
type: z.ZodLiteral<"token-ref">;
|
|
304
350
|
topic: z.ZodString;
|
|
305
351
|
section: z.ZodString;
|
|
352
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
353
|
+
type: z.ZodLiteral<"reference">;
|
|
354
|
+
target: z.ZodString;
|
|
355
|
+
projection: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
357
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
358
|
+
}, z.core.$strict>>;
|
|
359
|
+
presentation: z.ZodOptional<z.ZodEnum<{
|
|
360
|
+
compact: "compact";
|
|
361
|
+
summary: "summary";
|
|
362
|
+
full: "full";
|
|
363
|
+
}>>;
|
|
306
364
|
}, z.core.$strict>], "type">>;
|
|
307
365
|
previewType: z.ZodOptional<z.ZodEnum<{
|
|
308
366
|
swatch: "swatch";
|
|
@@ -840,6 +898,18 @@ export const LegacyDocSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
840
898
|
type: z.ZodLiteral<"token-ref">;
|
|
841
899
|
topic: z.ZodString;
|
|
842
900
|
section: z.ZodString;
|
|
901
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
902
|
+
type: z.ZodLiteral<"reference">;
|
|
903
|
+
target: z.ZodString;
|
|
904
|
+
projection: z.ZodOptional<z.ZodObject<{
|
|
905
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
906
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
907
|
+
}, z.core.$strict>>;
|
|
908
|
+
presentation: z.ZodOptional<z.ZodEnum<{
|
|
909
|
+
compact: "compact";
|
|
910
|
+
summary: "summary";
|
|
911
|
+
full: "full";
|
|
912
|
+
}>>;
|
|
843
913
|
}, z.core.$strict>], "type">>;
|
|
844
914
|
previewType: z.ZodOptional<z.ZodEnum<{
|
|
845
915
|
swatch: "swatch";
|
|
@@ -862,6 +932,7 @@ export type AuthoredDocKind = import("./base/type.js").AuthoredDocKind;
|
|
|
862
932
|
export type NamespaceDoc = import("./namespace/type.js").NamespaceDoc;
|
|
863
933
|
export type ReferenceContentBlock = import("./reference/type.js").ReferenceContentBlock;
|
|
864
934
|
export type GraphContentBlock = import("./reference/type.js").GraphContentBlock;
|
|
935
|
+
export type ReferenceSection = import("./reference/type.js").ReferenceSection;
|
|
865
936
|
export type ReferenceDoc = import("./reference/type.js").ReferenceDoc;
|
|
866
937
|
export type SingleComponentDoc = import("./component/type.js").SingleComponentDoc;
|
|
867
938
|
export type ComponentPropDoc = import("./base/type.js").ComponentPropDoc;
|
|
@@ -874,6 +945,7 @@ export type _AuthoredDocKindDriftLock = import("../_shared/contract.js").Expect<
|
|
|
874
945
|
export type _AuthoredDocGraphDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<z.infer<typeof _AuthoredDocGraphSchema>, AuthoredDocGraphFieldsType>>;
|
|
875
946
|
export type _ReferenceContentBlockDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof ReferenceContentBlockSchema>, ReferenceContentBlock>>;
|
|
876
947
|
export type _GraphContentBlockDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof GraphContentBlockSchema>, GraphContentBlock>>;
|
|
948
|
+
export type _SectionContentBlockDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").Equal<z.infer<typeof SectionContentBlockSchema>, ReferenceSection["content"][number]>>;
|
|
877
949
|
/**
|
|
878
950
|
* A stamped component doc as it loads. The loader accepts what the unstamped
|
|
879
951
|
* format always accepted, so stamping an existing doc never breaks it:
|
|
@@ -16,6 +16,7 @@ import {z} from 'zod';
|
|
|
16
16
|
/** @typedef {import('./namespace/type.js').NamespaceDoc} NamespaceDoc */
|
|
17
17
|
/** @typedef {import('./reference/type.js').ReferenceContentBlock} ReferenceContentBlock */
|
|
18
18
|
/** @typedef {import('./reference/type.js').GraphContentBlock} GraphContentBlock */
|
|
19
|
+
/** @typedef {import('./reference/type.js').ReferenceSection} ReferenceSection */
|
|
19
20
|
/** @typedef {import('./reference/type.js').ReferenceDoc} ReferenceDoc */
|
|
20
21
|
/** @typedef {import('./component/type.js').SingleComponentDoc} SingleComponentDoc */
|
|
21
22
|
/** @typedef {import('./base/type.js').ComponentPropDoc} ComponentPropDoc */
|
|
@@ -179,6 +180,20 @@ export const GraphContentBlockSchema = z.discriminatedUnion('type', [
|
|
|
179
180
|
ReferenceBlockSchema,
|
|
180
181
|
]);
|
|
181
182
|
|
|
183
|
+
/**
|
|
184
|
+
* A topic section's blocks: the stable union, plus a reference block, which a
|
|
185
|
+
* read inlines as the doc it includes.
|
|
186
|
+
*/
|
|
187
|
+
export const SectionContentBlockSchema = z.discriminatedUnion('type', [
|
|
188
|
+
ProseBlockSchema,
|
|
189
|
+
HeadingBlockSchema,
|
|
190
|
+
CodeBlockSchema,
|
|
191
|
+
TableBlockSchema,
|
|
192
|
+
ListBlockSchema,
|
|
193
|
+
TokenReferenceBlockSchema,
|
|
194
|
+
ReferenceBlockSchema,
|
|
195
|
+
]);
|
|
196
|
+
|
|
182
197
|
/** Namespace content accepts both stable reference blocks and graph-only blocks. */
|
|
183
198
|
export const NamespaceContentBlockSchema = z.discriminatedUnion('type', [
|
|
184
199
|
ProseBlockSchema,
|
|
@@ -210,12 +225,21 @@ export const NamespaceContentBlockSchema = z.discriminatedUnion('type', [
|
|
|
210
225
|
* >} _GraphContentBlockDriftLock
|
|
211
226
|
*/
|
|
212
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @typedef {import('../_shared/contract.js').Expect<
|
|
230
|
+
* import('../_shared/contract.js').Equal<
|
|
231
|
+
* z.infer<typeof SectionContentBlockSchema>,
|
|
232
|
+
* ReferenceSection['content'][number]
|
|
233
|
+
* >
|
|
234
|
+
* >} _SectionContentBlockDriftLock
|
|
235
|
+
*/
|
|
236
|
+
|
|
213
237
|
const ReferenceSectionSchema = z
|
|
214
238
|
.object({
|
|
215
239
|
id: nonEmptyString.optional(),
|
|
216
240
|
title: nonEmptyString,
|
|
217
241
|
category: z.string().optional(),
|
|
218
|
-
content: z.array(
|
|
242
|
+
content: z.array(SectionContentBlockSchema),
|
|
219
243
|
previewType: z
|
|
220
244
|
.enum([
|
|
221
245
|
'swatch',
|
|
@@ -12,25 +12,27 @@ export const doc = {
|
|
|
12
12
|
displayName: 'Authored doc graph fields',
|
|
13
13
|
namespace: 'authoring',
|
|
14
14
|
description:
|
|
15
|
-
|
|
15
|
+
"Placement, compatibility aliases, and audience: fields every authored doc kind declares for the docs tree. The docs tree reads `placement` for every guide, the CLI's and each integration's; aliases and audience are not built yet. A reference topic outside the docs tree that sets one fails to load, and other doc kinds accept them and ignore them.",
|
|
16
16
|
appliesTo: 'Every supported .doc.mjs object',
|
|
17
17
|
fields: [
|
|
18
18
|
{
|
|
19
19
|
name: 'placement',
|
|
20
20
|
type: 'DocPlacement',
|
|
21
21
|
description:
|
|
22
|
-
'
|
|
22
|
+
"Names the doc's one parent in the docs tree: a namespace of the same package, one of its slots, and an order. Read for every guide, the CLI's and each integration's: a guide with `placement` gets a route in the tree instead of a flat topic name, and cannot also `replaces` or `extends` a topic. In the CLI's own topic directory a topic that sets it fails to load: the CLI keeps its guides in its docs tree directory. Commands, API functions, schemas, and enums do not set it: the tree adopts each by its `namespace`.",
|
|
23
23
|
fields: [
|
|
24
24
|
{
|
|
25
25
|
name: 'placement.parent',
|
|
26
26
|
type: 'string',
|
|
27
|
-
description:
|
|
27
|
+
description:
|
|
28
|
+
'The parent namespace: `namespace:<name>` in the same package.',
|
|
28
29
|
required: true,
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
name: 'placement.slot',
|
|
32
33
|
type: 'string',
|
|
33
|
-
description:
|
|
34
|
+
description:
|
|
35
|
+
"A slot the parent namespace declares; it must accept this doc's kind. Optional when the parent has one slot.",
|
|
34
36
|
},
|
|
35
37
|
{
|
|
36
38
|
name: 'placement.order',
|
|
@@ -43,7 +45,7 @@ export const doc = {
|
|
|
43
45
|
name: 'aliases',
|
|
44
46
|
type: 'string[]',
|
|
45
47
|
description:
|
|
46
|
-
'Prior names or routes the docs
|
|
48
|
+
'Prior names or routes the docs tree will keep resolving to this doc, without creating another identity. Not read yet: a topic that sets it fails to load.',
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
51
|
name: 'audience',
|
|
@@ -31,14 +31,15 @@ export interface DocPlacement {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Tree metadata shared by every authored doc kind. The docs tree reads
|
|
35
|
+
* `placement` for every guide, the CLI's and each integration's
|
|
36
|
+
* (spec:AST-046); nothing reads `aliases` or `audience` yet. A reference topic
|
|
37
|
+
* outside the docs tree that sets one fails to load.
|
|
37
38
|
*/
|
|
38
39
|
export interface AuthoredDocGraphFields {
|
|
39
|
-
/**
|
|
40
|
+
/** The doc's one parent in the docs tree: a namespace of its own package. */
|
|
40
41
|
placement?: DocPlacement;
|
|
41
|
-
/** Prior routes or names the docs
|
|
42
|
+
/** Prior routes or names the docs tree will keep resolving. Not read yet. */
|
|
42
43
|
aliases?: string[];
|
|
43
44
|
/** Docs bundle audience; omit for public docs. Not read yet. */
|
|
44
45
|
audience?: DocAudience;
|
|
@@ -54,7 +54,7 @@ export const doc = {
|
|
|
54
54
|
name: 'namespace',
|
|
55
55
|
type: 'string',
|
|
56
56
|
description:
|
|
57
|
-
"
|
|
57
|
+
"Optional in the type, but every doc the CLI ships declares it. The group that reads this doc. The CLI's commands use 'cli/commands', which the docs tree adopts: each is the leaf `cli/commands/<name>`. Every command doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
name: 'aliases',
|
|
@@ -65,7 +65,7 @@ export interface CommandDoc extends AuthoredDocGraphFields {
|
|
|
65
65
|
summary: string;
|
|
66
66
|
/** Longer help body / when-to-use. */
|
|
67
67
|
description?: string;
|
|
68
|
-
/** The
|
|
68
|
+
/** The group that reads this doc. The CLI's commands use 'cli/commands', which the docs tree adopts: each is the leaf `cli/commands/<name>`. Every command doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
|
|
69
69
|
namespace?: string;
|
|
70
70
|
/** Alternate slugs that also resolve to this doc. */
|
|
71
71
|
aliases?: string[];
|
|
@@ -81,7 +81,7 @@ export interface CommandDoc extends AuthoredDocGraphFields {
|
|
|
81
81
|
examples?: CommandExampleDoc[];
|
|
82
82
|
/** Documented exit codes. */
|
|
83
83
|
exitCodes?: {code: number; when: string}[];
|
|
84
|
-
/** Related command names. */
|
|
84
|
+
/** Related command names; the CLI links each to its doc. */
|
|
85
85
|
related?: string[];
|
|
86
86
|
/** Freeform prose/notes. */
|
|
87
87
|
notes?: ReferenceContentBlock[];
|
|
@@ -49,7 +49,7 @@ export const doc = {
|
|
|
49
49
|
name: 'namespace',
|
|
50
50
|
type: 'string',
|
|
51
51
|
description:
|
|
52
|
-
"
|
|
52
|
+
"Optional in the type, but every doc the CLI ships declares it. The group that reads this doc. The CLI's enums use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/enums/<name>`. Every enum doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
name: 'aliases',
|
|
@@ -32,7 +32,7 @@ export interface EnumDoc extends AuthoredDocGraphFields {
|
|
|
32
32
|
displayName: string;
|
|
33
33
|
/** One-line summary shown in listings. */
|
|
34
34
|
description: string;
|
|
35
|
-
/** The
|
|
35
|
+
/** The group that reads this doc. The CLI's enums use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/enums/<name>`. Every enum doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
|
|
36
36
|
namespace?: string;
|
|
37
37
|
/** Alternate slugs that also resolve to this doc. */
|
|
38
38
|
aliases?: string[];
|
|
@@ -57,7 +57,7 @@ export const doc = {
|
|
|
57
57
|
name: 'namespace',
|
|
58
58
|
type: 'string',
|
|
59
59
|
description:
|
|
60
|
-
"
|
|
60
|
+
"Optional in the type, but every doc the CLI ships declares it. The group that reads this doc. The CLI's API functions use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/functions/<name>`. Every function doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
name: 'aliases',
|
|
@@ -201,7 +201,8 @@ export const doc = {
|
|
|
201
201
|
{
|
|
202
202
|
name: 'related',
|
|
203
203
|
type: 'string[]',
|
|
204
|
-
description:
|
|
204
|
+
description:
|
|
205
|
+
'Related function names; the CLI links each to its doc. Name the CLI command with `command`, not here.',
|
|
205
206
|
},
|
|
206
207
|
{
|
|
207
208
|
name: 'relatedComponents',
|
|
@@ -62,7 +62,7 @@ export interface FunctionDoc extends AuthoredDocGraphFields {
|
|
|
62
62
|
summary?: string;
|
|
63
63
|
/** Longer description. */
|
|
64
64
|
description?: string;
|
|
65
|
-
/** The
|
|
65
|
+
/** The group that reads this doc. The CLI's API functions use 'cli/api', which the docs tree adopts by kind: each is the leaf `cli/api/functions/<name>`. Every function doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
|
|
66
66
|
namespace?: string;
|
|
67
67
|
/** Alternate slugs that also resolve to this doc. */
|
|
68
68
|
aliases?: string[];
|
|
@@ -84,7 +84,8 @@ export interface FunctionDoc extends AuthoredDocGraphFields {
|
|
|
84
84
|
usage?: UsageDoc;
|
|
85
85
|
/** The CLI command that wraps this function, e.g. 'search'. */
|
|
86
86
|
command?: string;
|
|
87
|
-
/** Related function
|
|
87
|
+
/** Related function names; the CLI links each to its doc. Name the CLI
|
|
88
|
+
* command with `command`, not here. */
|
|
88
89
|
related?: string[];
|
|
89
90
|
/** Component names this is commonly used with (hooks). */
|
|
90
91
|
relatedComponents?: string[];
|
|
@@ -182,6 +182,31 @@ describe('unknown fields', () => {
|
|
|
182
182
|
);
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
+
it("are refused inside a section's reference block, which a section takes", () => {
|
|
186
|
+
const [section] = EXAMPLES.generic.sections;
|
|
187
|
+
const reference = {
|
|
188
|
+
type: 'reference',
|
|
189
|
+
target: '@astryxdesign/cli:schema:integration',
|
|
190
|
+
projection: {fields: ['docs']},
|
|
191
|
+
presentation: 'compact',
|
|
192
|
+
};
|
|
193
|
+
/** @param {object} block */
|
|
194
|
+
const withBlock = block =>
|
|
195
|
+
parseDoc(
|
|
196
|
+
{...EXAMPLES.generic, sections: [{...section, content: [block]}]},
|
|
197
|
+
'r.doc.mjs',
|
|
198
|
+
);
|
|
199
|
+
expect(() => withBlock(reference)).not.toThrow();
|
|
200
|
+
expect(() => withBlock({...reference, notAField: true})).toThrow();
|
|
201
|
+
expect(() =>
|
|
202
|
+
withBlock({...reference, projection: {fields: ['docs'], rows: []}}),
|
|
203
|
+
).toThrow();
|
|
204
|
+
// Workflow and collection blocks belong to a namespace doc.
|
|
205
|
+
expect(() =>
|
|
206
|
+
withBlock({type: 'collection', source: {slot: 'guides'}}),
|
|
207
|
+
).toThrow();
|
|
208
|
+
});
|
|
209
|
+
|
|
185
210
|
it('are refused inside sections and content blocks', () => {
|
|
186
211
|
const [section] = EXAMPLES.generic.sections;
|
|
187
212
|
expect(() =>
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
displayName: 'NamespaceDoc',
|
|
13
13
|
namespace: 'authoring',
|
|
14
14
|
description:
|
|
15
|
-
"Declares named
|
|
15
|
+
"Declares one level of the docs tree: named slots, and adoption rules for already-discovered docs. It never scans folders, lists its children, or copies child documents: a child names its parent with `placement`, or a namespace adopts a discovery group. `astryx docs <route>` lists each slot's children one level down. The CLI keeps its namespace docs in its docs tree directory; an integration ships its own in its docs directory, and they appear in `astryx docs` beside the CLI's.",
|
|
16
16
|
appliesTo: '<namespace>.doc.mjs',
|
|
17
17
|
fields: [
|
|
18
18
|
{
|
|
@@ -44,13 +44,13 @@ export const doc = {
|
|
|
44
44
|
name: 'placement',
|
|
45
45
|
type: 'DocPlacement',
|
|
46
46
|
description:
|
|
47
|
-
'Optional canonical parent
|
|
47
|
+
'Optional canonical parent: {parent, slot?, order?}. `parent` names a namespace of the same package as `namespace:<name>`. An invalid placement withdraws the namespace with a diagnostic; it never falls back.',
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
name: 'aliases',
|
|
51
51
|
type: 'string[]',
|
|
52
52
|
description:
|
|
53
|
-
'Prior names or routes the docs
|
|
53
|
+
'Prior names or routes the docs tree will keep resolving to this doc. Not read yet.',
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
name: 'audience',
|
|
@@ -80,7 +80,7 @@ export const doc = {
|
|
|
80
80
|
name: 'blocks',
|
|
81
81
|
type: '(ReferenceContentBlock | GraphContentBlock)[]',
|
|
82
82
|
description:
|
|
83
|
-
'Ordered layout content. Graph-only workflow, collection, and reference blocks are available here without widening the stable ReferenceContentBlock union used by existing topic renderers.',
|
|
83
|
+
'Ordered layout content for the namespace page. Graph-only workflow, collection, and reference blocks are available here without widening the stable ReferenceContentBlock union used by existing topic renderers. Not rendered yet: `astryx docs <route>` lists every slot and its children in order.',
|
|
84
84
|
},
|
|
85
85
|
],
|
|
86
86
|
examples: [
|
|
@@ -103,17 +103,13 @@ export const docs = {
|
|
|
103
103
|
source: {group: 'cli-commands', kinds: ['command']},
|
|
104
104
|
into: 'reference',
|
|
105
105
|
}],
|
|
106
|
-
blocks: [
|
|
107
|
-
{type: 'collection', source: {slot: 'guides'}, presentation: 'cards'},
|
|
108
|
-
{type: 'collection', source: {slot: 'reference'}, presentation: 'compact'},
|
|
109
|
-
],
|
|
110
106
|
};`,
|
|
111
107
|
},
|
|
112
108
|
],
|
|
113
109
|
notes: [
|
|
114
110
|
{
|
|
115
111
|
type: 'prose',
|
|
116
|
-
text: "
|
|
112
|
+
text: "The docs tree reads namespace docs from the CLI and from every configured integration. An integration's namespace doc is a top-level level of the tree, and its guides name it with `placement`; a doc can be placed only in a namespace of its own package. When two packages claim one route, the CLI's own docs win, then integrations in configured order, and `astryx doctor` names the loser.",
|
|
117
113
|
},
|
|
118
114
|
{
|
|
119
115
|
type: 'prose',
|
|
@@ -93,9 +93,9 @@ export const doc = {
|
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
name: 'sections[].content',
|
|
96
|
-
type: 'ReferenceContentBlock[]',
|
|
96
|
+
type: '(ReferenceContentBlock | ReferenceDocBlock)[]',
|
|
97
97
|
description:
|
|
98
|
-
|
|
98
|
+
"Ordered content blocks: prose, heading, code, table, list, token-ref, and reference. A `reference` block (`{type: 'reference', target, projection?, presentation?}`) includes another doc from its canonical source instead of a copy: a schema, command, function, or enum doc as `astryx docs` prints it, then the command that opens it. `projection.fields` keeps only those fields of a schema; `presentation` is `full` (the default), `compact` (no code blocks), or `summary` (only the doc's title, summary, and command). Any other doc shows as a summary. Graph-only workflow and collection blocks are available through GraphContentBlock on NamespaceDoc, without widening the stable ReferenceContentBlock union. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.",
|
|
99
99
|
required: true,
|
|
100
100
|
},
|
|
101
101
|
{
|
|
@@ -144,7 +144,27 @@ export const docs = {
|
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
type: 'prose',
|
|
147
|
-
text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref. Docs-graph-only workflow
|
|
147
|
+
text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref, plus the reference block (ReferenceDocBlock). A read inlines a reference block the way it inlines a token-ref, so `astryx docs`, in text and in `--json`, returns only the stable block kinds. Docs-graph-only workflow and collection blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc. Inside text, `{@link <target>}` links another doc by identity (`[<provider>:]<kind>:<name>`): the CLI prints the command that opens it, and `astryx doctor` warns on one that names no doc.',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'prose',
|
|
151
|
+
text: "A reference block includes content, where a link only points at it: `astryx doctor integration docs` fails when its target names no doc, when `projection.fields` names a field the schema does not have, or when the doc cannot take the projection or presentation it sets, and a read marks the missing content. A target without a provider names a doc of the package that wrote it, so an integration names the CLI's docs with the CLI's provider, as in `@astryxdesign/cli:schema:integration`.",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'code',
|
|
155
|
+
lang: 'js',
|
|
156
|
+
label: 'A section that includes two fields of the integration manifest',
|
|
157
|
+
code: `{
|
|
158
|
+
title: 'Point the manifest at your folders',
|
|
159
|
+
content: [
|
|
160
|
+
{type: 'prose', text: 'Add these fields to astryx.integration.mjs.'},
|
|
161
|
+
{
|
|
162
|
+
type: 'reference',
|
|
163
|
+
target: '@astryxdesign/cli:schema:integration',
|
|
164
|
+
projection: {fields: ['components', 'docs']},
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
}`,
|
|
148
168
|
},
|
|
149
169
|
{
|
|
150
170
|
type: 'code',
|
|
@@ -158,10 +178,17 @@ export const docs = {
|
|
|
158
178
|
| { type: 'list'; style: 'ordered' | 'unordered' | 'do' | 'dont'; items: string[] }
|
|
159
179
|
| { type: 'token-ref'; topic: string; section: string };
|
|
160
180
|
|
|
181
|
+
type ReferenceDocBlock = {
|
|
182
|
+
type: 'reference';
|
|
183
|
+
target: string;
|
|
184
|
+
projection?: { fields?: string[]; sections?: string[] };
|
|
185
|
+
presentation?: 'summary' | 'compact' | 'full';
|
|
186
|
+
};
|
|
187
|
+
|
|
161
188
|
type GraphContentBlock =
|
|
162
189
|
| { type: 'workflow'; title?: string; steps: WorkflowStep[] }
|
|
163
190
|
| { type: 'collection'; source: {slot: string}; presentation?: 'list' | 'cards' | 'compact'; whenEmpty?: 'show' | 'omit' }
|
|
164
|
-
|
|
|
191
|
+
| ReferenceDocBlock;`,
|
|
165
192
|
},
|
|
166
193
|
{
|
|
167
194
|
type: 'prose',
|
|
@@ -30,19 +30,32 @@ export interface CollectionDocBlock {
|
|
|
30
30
|
whenEmpty?: 'show' | 'omit';
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* A bounded projection of one canonical doc. In a namespace doc's `blocks` it
|
|
35
|
+
* is layout the docs tree renders later. In a topic section, a read includes
|
|
36
|
+
* the doc it names in place of the block: a schema, command, function, or
|
|
37
|
+
* enum doc as `astryx docs` prints it (`projection.fields` keeps only those
|
|
38
|
+
* fields of a schema), then the command that opens that doc. Any other doc
|
|
39
|
+
* shows its title and summary.
|
|
40
|
+
*/
|
|
34
41
|
export interface ReferenceDocBlock {
|
|
35
42
|
type: 'reference';
|
|
43
|
+
/** The doc it names, by identity: `[<provider>:]<kind>:<name>`. */
|
|
36
44
|
target: string;
|
|
37
45
|
projection?: {
|
|
38
46
|
fields?: string[];
|
|
39
47
|
sections?: string[];
|
|
40
48
|
};
|
|
49
|
+
/** `summary`: only the doc's title, summary, and the command that opens it.
|
|
50
|
+
* `compact`: the included doc without its code blocks. `full`, the default:
|
|
51
|
+
* the included doc. */
|
|
41
52
|
presentation?: 'summary' | 'compact' | 'full';
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
/** Graph-only content blocks
|
|
45
|
-
* {@link ReferenceContentBlock} union
|
|
55
|
+
/** Graph-only content blocks, for a namespace doc's `blocks`. These are
|
|
56
|
+
* additive and do not widen the stable {@link ReferenceContentBlock} union
|
|
57
|
+
* consumed by existing exhaustive renderers. A topic section accepts the
|
|
58
|
+
* `reference` block too, and a read inlines it as stable blocks. */
|
|
46
59
|
export type GraphContentBlock =
|
|
47
60
|
WorkflowDocBlock | CollectionDocBlock | ReferenceDocBlock;
|
|
48
61
|
|
|
@@ -60,9 +73,12 @@ export type GraphContentBlock =
|
|
|
60
73
|
* { type: 'table', headers: ['Token', 'Value'], rows: [['--spacing-4', '16px']] }
|
|
61
74
|
* { type: 'list', style: 'do', items: ['Use semantic tokens'] }
|
|
62
75
|
* { type: 'token-ref', topic: 'tokens', section: 'Color Tokens' }
|
|
76
|
+
* { type: 'prose', text: 'Check it with {@link command:doctor}.' }
|
|
63
77
|
* ```
|
|
64
78
|
*/
|
|
65
79
|
export type ReferenceContentBlock =
|
|
80
|
+
/** Text. `{@link [<provider>:]<kind>:<name>}` inside it links another doc
|
|
81
|
+
* by identity; `astryx docs` prints the command that opens that doc. */
|
|
66
82
|
| {type: 'prose'; text: string}
|
|
67
83
|
| {type: 'heading'; level: 3 | 4 | 5 | 6; text: string}
|
|
68
84
|
| {type: 'code'; lang: string; code: string; label?: string}
|
|
@@ -145,8 +161,10 @@ export interface ReferenceSection {
|
|
|
145
161
|
/** Navigation category ('guide' | 'foundations'). Mirrors the parent doc's
|
|
146
162
|
* category so sections can be grouped independently in the docsite nav. */
|
|
147
163
|
category?: string;
|
|
148
|
-
/** Ordered content blocks. Mix prose, code, tables, and lists freely.
|
|
149
|
-
|
|
164
|
+
/** Ordered content blocks. Mix prose, code, tables, and lists freely. A
|
|
165
|
+
* `reference` block includes another doc from its canonical source, so a
|
|
166
|
+
* guide never copies a schema's fields or a command's options. */
|
|
167
|
+
content: (ReferenceContentBlock | ReferenceDocBlock)[];
|
|
150
168
|
/** Preview type for token tables in this section. When set, the docsite
|
|
151
169
|
* renders a visual preview column using the token's computed CSS value
|
|
152
170
|
* from the current theme. Omit for non-token sections. */
|
|
@@ -49,7 +49,7 @@ export const doc = {
|
|
|
49
49
|
name: 'namespace',
|
|
50
50
|
type: 'string',
|
|
51
51
|
description:
|
|
52
|
-
"The
|
|
52
|
+
"The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads.",
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
name: 'aliases',
|
|
@@ -47,7 +47,7 @@ export interface SchemaDoc extends AuthoredDocGraphFields {
|
|
|
47
47
|
displayName: string;
|
|
48
48
|
/** One-line summary shown in listings. */
|
|
49
49
|
description: string;
|
|
50
|
-
/** The
|
|
50
|
+
/** The group that reads this doc: 'authoring' for a file an author writes (a section of `astryx docs authoring`), or 'cli/api' for a shape the CLI returns (the docs tree adopts it by kind, as the leaf `cli/api/schemas/<name>`). Every schema doc the CLI ships declares one, and `astryx doctor` fails on one that is missing or that nothing reads. */
|
|
51
51
|
namespace?: string;
|
|
52
52
|
/** Alternate slugs that also resolve to this doc (back-compat). */
|
|
53
53
|
aliases?: string[];
|
|
@@ -56,6 +56,7 @@ declare const pageTemplateSchema: z.ZodObject<{
|
|
|
56
56
|
slug: z.ZodOptional<z.ZodString>;
|
|
57
57
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
58
|
}, z.core.$strict>>;
|
|
59
|
+
replaces: z.ZodOptional<z.ZodString>;
|
|
59
60
|
placement: z.ZodOptional<z.ZodObject<{
|
|
60
61
|
parent: z.ZodString;
|
|
61
62
|
slot: z.ZodOptional<z.ZodString>;
|
|
@@ -91,6 +92,7 @@ declare const blockTemplateSchema: z.ZodObject<{
|
|
|
91
92
|
slug: z.ZodOptional<z.ZodString>;
|
|
92
93
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
94
|
}, z.core.$strict>>;
|
|
95
|
+
replaces: z.ZodOptional<z.ZodString>;
|
|
94
96
|
placement: z.ZodOptional<z.ZodObject<{
|
|
95
97
|
parent: z.ZodString;
|
|
96
98
|
slot: z.ZodOptional<z.ZodString>;
|
|
@@ -51,6 +51,10 @@ const baseTemplateFields = {
|
|
|
51
51
|
scaffold: z.boolean().optional(),
|
|
52
52
|
isHiddenFromOverview: z.boolean().optional(),
|
|
53
53
|
registry: registryIdentitySchema.optional(),
|
|
54
|
+
replaces: z
|
|
55
|
+
.string()
|
|
56
|
+
.min(1, 'replaces must name a Core template id')
|
|
57
|
+
.optional(),
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
const pageTemplateSchema = z
|
|
@@ -22,6 +22,24 @@ function reason(value, label = 'template') {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
describe('parseTemplate (load boundary)', () => {
|
|
25
|
+
it('accepts replaces on page and block templates', () => {
|
|
26
|
+
for (const type of ['page', 'block']) {
|
|
27
|
+
const parsed = parseTemplate({
|
|
28
|
+
type,
|
|
29
|
+
name: 'Acme shell',
|
|
30
|
+
description: 'Replaces a Core template.',
|
|
31
|
+
replaces: 'shell-side-nav',
|
|
32
|
+
});
|
|
33
|
+
expect(parsed.replaces).toBe('shell-side-nav');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('rejects an empty replaces', () => {
|
|
38
|
+
expect(reason({type: 'page', name: 'Acme shell', replaces: ''})).toMatch(
|
|
39
|
+
/replaces must name a Core template id/,
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
25
43
|
it('accepts a stamped page template', () => {
|
|
26
44
|
const parsed = parseTemplate({
|
|
27
45
|
type: 'page',
|