@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/** @typedef {import('../types
|
|
4
|
+
/** @typedef {import('../types').ReferenceDoc} ReferenceDoc */
|
|
5
5
|
/**
|
|
6
6
|
* Validate an unknown value as a stamped reference/topic doc, or throw.
|
|
7
7
|
*
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* @returns {ReferenceDoc}
|
|
11
11
|
*/
|
|
12
12
|
export function parseReference(input: unknown, label?: string): ReferenceDoc;
|
|
13
|
-
export type ReferenceDoc = import("../types
|
|
13
|
+
export type ReferenceDoc = import("../types").ReferenceDoc;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import {GenericDocKindSchema} from '../_schema.mjs';
|
|
10
10
|
import {formatZodError} from '../../_shared/errors.mjs';
|
|
11
11
|
|
|
12
|
-
/** @typedef {import('../types
|
|
12
|
+
/** @typedef {import('../types').ReferenceDoc} ReferenceDoc */
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Validate an unknown value as a stamped reference/topic doc, or throw.
|
|
@@ -23,11 +23,8 @@ export function parseReference(input, label = 'reference doc') {
|
|
|
23
23
|
if (!result.success) {
|
|
24
24
|
throw new Error(formatZodError(label, result.error));
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
description: doc.description ?? '',
|
|
31
|
-
sections: doc.sections ?? [],
|
|
32
|
-
});
|
|
26
|
+
// The schema is permissive (it also accepts legacy generic docs), so it is
|
|
27
|
+
// deliberately looser than the rich public type; cast through unknown at this
|
|
28
|
+
// validated boundary.
|
|
29
|
+
return /** @type {ReferenceDoc} */ (/** @type {unknown} */ (result.data));
|
|
33
30
|
}
|
|
@@ -55,7 +55,7 @@ export const doc = {
|
|
|
55
55
|
name: 'replaces',
|
|
56
56
|
type: 'string',
|
|
57
57
|
description:
|
|
58
|
-
|
|
58
|
+
"Name of an existing topic this doc takes the place of. Authored by an integration that serves its own guide instead of the built-in one: on a doc of the same name it swaps the content, and on a doc of another name it also leaves the old name as an alias so `astryx docs <old>` still resolves. Exclusive with `extends`.",
|
|
59
59
|
example: "'getting-started'",
|
|
60
60
|
},
|
|
61
61
|
{
|
|
@@ -72,12 +72,6 @@ export const doc = {
|
|
|
72
72
|
'Ordered sections that make up the doc. Each becomes an h2 in full output and can be retrieved via `astryx docs <topic> <section>`.',
|
|
73
73
|
required: true,
|
|
74
74
|
fields: [
|
|
75
|
-
{
|
|
76
|
-
name: 'sections[].id',
|
|
77
|
-
type: 'string',
|
|
78
|
-
description:
|
|
79
|
-
'Stable section anchor. New docs should set this instead of relying on a mutable title.',
|
|
80
|
-
},
|
|
81
75
|
{
|
|
82
76
|
name: 'sections[].title',
|
|
83
77
|
type: 'string',
|
|
@@ -95,7 +89,7 @@ export const doc = {
|
|
|
95
89
|
name: 'sections[].content',
|
|
96
90
|
type: 'ReferenceContentBlock[]',
|
|
97
91
|
description:
|
|
98
|
-
'Ordered content blocks
|
|
92
|
+
'Ordered content blocks. Mix prose, code, tables, and lists freely.',
|
|
99
93
|
required: true,
|
|
100
94
|
},
|
|
101
95
|
{
|
|
@@ -140,11 +134,7 @@ export const docs = {
|
|
|
140
134
|
notes: [
|
|
141
135
|
{
|
|
142
136
|
type: 'prose',
|
|
143
|
-
text: '
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
type: 'prose',
|
|
147
|
-
text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, a discriminated union. workflow, collection, and reference are declared for the docs graph: they parse, but topic loading rejects them until the docs graph ships. choice, callout, and checklist remain invalid. The same union is reused by the `notes` field on SchemaDoc and CommandDoc.',
|
|
137
|
+
text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, a discriminated union. New block types can be added without breaking existing docs. The same union is reused by the `notes` field on SchemaDoc and CommandDoc.',
|
|
148
138
|
},
|
|
149
139
|
{
|
|
150
140
|
type: 'code',
|
|
@@ -156,10 +146,7 @@ export const docs = {
|
|
|
156
146
|
| { type: 'code'; lang: string; code: string; label?: string }
|
|
157
147
|
| { type: 'table'; headers: string[]; rows: string[][] }
|
|
158
148
|
| { type: 'list'; style: 'ordered' | 'unordered' | 'do' | 'dont'; items: string[] }
|
|
159
|
-
| { type: 'token-ref'; topic: string; section: string }
|
|
160
|
-
| { type: 'workflow'; title?: string; steps: WorkflowStep[] }
|
|
161
|
-
| { type: 'collection'; source: {slot: string}; presentation?: 'list' | 'cards' | 'compact'; whenEmpty?: 'show' | 'omit' }
|
|
162
|
-
| { type: 'reference'; target: string; projection?: {fields?: string[]; sections?: string[]} };`,
|
|
149
|
+
| { type: 'token-ref'; topic: string; section: string };`,
|
|
163
150
|
},
|
|
164
151
|
{
|
|
165
152
|
type: 'prose',
|
|
@@ -4,48 +4,10 @@
|
|
|
4
4
|
* @file Reference/topic doc types.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {AuthoredDocGraphFields} from '../base/type.js';
|
|
8
|
-
|
|
9
|
-
/** One step in a renderer-neutral workflow. */
|
|
10
|
-
export interface WorkflowStep {
|
|
11
|
-
title: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
/** Stable doc references that supply detail for this step. */
|
|
14
|
-
references?: string[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Ordered procedural guidance. */
|
|
18
|
-
export interface WorkflowDocBlock {
|
|
19
|
-
type: 'workflow';
|
|
20
|
-
title?: string;
|
|
21
|
-
steps: WorkflowStep[];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** A generated view over docs placed in one namespace slot. */
|
|
25
|
-
export interface CollectionDocBlock {
|
|
26
|
-
type: 'collection';
|
|
27
|
-
title?: string;
|
|
28
|
-
source: {slot: string};
|
|
29
|
-
presentation?: 'list' | 'cards' | 'compact';
|
|
30
|
-
whenEmpty?: 'show' | 'omit';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** A bounded projection of one canonical doc. */
|
|
34
|
-
export interface ReferenceDocBlock {
|
|
35
|
-
type: 'reference';
|
|
36
|
-
target: string;
|
|
37
|
-
projection?: {
|
|
38
|
-
fields?: string[];
|
|
39
|
-
sections?: string[];
|
|
40
|
-
};
|
|
41
|
-
presentation?: 'summary' | 'compact' | 'full';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
7
|
/**
|
|
45
|
-
* A content block within a reference doc section
|
|
46
|
-
* Ordered
|
|
47
|
-
*
|
|
48
|
-
* reader boundary until that renderer is available.
|
|
8
|
+
* A content block within a reference doc section.
|
|
9
|
+
* Ordered array of these makes up a section's content.
|
|
10
|
+
* New block types can be added without breaking existing docs.
|
|
49
11
|
*
|
|
50
12
|
* @example
|
|
51
13
|
* ```
|
|
@@ -55,9 +17,6 @@ export interface ReferenceDocBlock {
|
|
|
55
17
|
* { type: 'table', headers: ['Token', 'Value'], rows: [['--spacing-4', '16px']] }
|
|
56
18
|
* { type: 'list', style: 'do', items: ['Use semantic tokens'] }
|
|
57
19
|
* { type: 'token-ref', topic: 'tokens', section: 'Color Tokens' }
|
|
58
|
-
* { type: 'workflow', steps: [{title: 'Validate', references: ['command:doctor']}] }
|
|
59
|
-
* { type: 'collection', source: {slot: 'guides'}, presentation: 'cards' }
|
|
60
|
-
* { type: 'reference', target: 'schema:integration', projection: {fields: ['docs']} }
|
|
61
20
|
* ```
|
|
62
21
|
*/
|
|
63
22
|
export type ReferenceContentBlock =
|
|
@@ -80,10 +39,7 @@ export type ReferenceContentBlock =
|
|
|
80
39
|
topic: string;
|
|
81
40
|
/** Section title to pull from that topic. e.g. `'Color Tokens'` */
|
|
82
41
|
section: string;
|
|
83
|
-
}
|
|
84
|
-
| WorkflowDocBlock
|
|
85
|
-
| CollectionDocBlock
|
|
86
|
-
| ReferenceDocBlock;
|
|
42
|
+
};
|
|
87
43
|
|
|
88
44
|
/**
|
|
89
45
|
* A reference documentation file (.doc.mjs).
|
|
@@ -98,7 +54,7 @@ export type ReferenceContentBlock =
|
|
|
98
54
|
* /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} *\/
|
|
99
55
|
* export const docs = { ... };
|
|
100
56
|
*/
|
|
101
|
-
export interface ReferenceDoc
|
|
57
|
+
export interface ReferenceDoc {
|
|
102
58
|
/** Doc-kind discriminant for the stamped default-export format
|
|
103
59
|
* (`export default { type: 'generic', ... }`). Optional: legacy
|
|
104
60
|
* `export const docs = {...}` docs omit it. The value stays `'generic'`
|
|
@@ -139,8 +95,6 @@ export interface ReferenceDoc extends AuthoredDocGraphFields {
|
|
|
139
95
|
* and can be individually retrieved via `astryx docs <topic> <section>`.
|
|
140
96
|
*/
|
|
141
97
|
export interface ReferenceSection {
|
|
142
|
-
/** Stable section anchor. New docs should set this instead of relying on title. */
|
|
143
|
-
id?: string;
|
|
144
98
|
/** Section title, e.g. "Spacing Tokens", "Light/Dark Mode" */
|
|
145
99
|
title: string;
|
|
146
100
|
/** Navigation category ('guide' | 'foundations'). Mirrors the parent doc's
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in authoring/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/** @typedef {import('../types
|
|
4
|
+
/** @typedef {import('../types').SchemaDoc} SchemaDoc */
|
|
5
5
|
/**
|
|
6
6
|
* Validate an unknown value as a stamped schema doc, or throw.
|
|
7
7
|
*
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* @returns {SchemaDoc}
|
|
11
11
|
*/
|
|
12
12
|
export function parseSchema(input: unknown, label?: string): SchemaDoc;
|
|
13
|
-
export type SchemaDoc = import("../types
|
|
13
|
+
export type SchemaDoc = import("../types").SchemaDoc;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import {SchemaDocKindSchema} from '../_schema.mjs';
|
|
9
9
|
import {formatZodError} from '../../_shared/errors.mjs';
|
|
10
10
|
|
|
11
|
-
/** @typedef {import('../types
|
|
11
|
+
/** @typedef {import('../types').SchemaDoc} SchemaDoc */
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Validate an unknown value as a stamped schema doc, or throw.
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* response envelope). Colocated as a `.doc.mjs` next to the schema it describes.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
import type {ReferenceContentBlock} from '../reference/type.js';
|
|
9
|
+
import type {ReferenceContentBlock} from '../reference/type';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* One documented field of a schema. Object fields nest via `fields`, so a whole
|
|
@@ -38,7 +37,7 @@ export interface SchemaFieldDoc {
|
|
|
38
37
|
* /\*\* @type {import('@astryxdesign/cli/authoring').SchemaDoc} \*\/
|
|
39
38
|
* export const doc = { type: 'schema', name: 'config', ... };
|
|
40
39
|
*/
|
|
41
|
-
export interface SchemaDoc
|
|
40
|
+
export interface SchemaDoc {
|
|
42
41
|
/** Doc-kind discriminant. */
|
|
43
42
|
type?: 'schema';
|
|
44
43
|
/** URL-safe identifier, used as the docs slug within its namespace. */
|
|
@@ -11,95 +11,4 @@
|
|
|
11
11
|
* @returns {TemplateDoc}
|
|
12
12
|
*/
|
|
13
13
|
export function parseTemplate(input: unknown, label?: string): TemplateDoc;
|
|
14
|
-
export type TemplateDoc = import("../types
|
|
15
|
-
export type PageTemplateDoc = import("./type.js").PageTemplateDoc;
|
|
16
|
-
export type BlockTemplateDoc = import("./type.js").BlockTemplateDoc;
|
|
17
|
-
/**
|
|
18
|
-
* Templates as they load. Integration templates already published omit
|
|
19
|
-
* `displayName` and `aspectRatio` and group themselves under their own
|
|
20
|
-
* `category`, so the loader accepts those (template discovery falls back to an
|
|
21
|
-
* aspect ratio of 1). The published types keep asking authors for all three.
|
|
22
|
-
*/
|
|
23
|
-
export type LoadedPageTemplateDoc = Omit<PageTemplateDoc, "displayName" | "category"> & {
|
|
24
|
-
displayName?: string;
|
|
25
|
-
category?: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Templates as they load. Integration templates already published omit
|
|
29
|
-
* `displayName` and `aspectRatio` and group themselves under their own
|
|
30
|
-
* `category`, so the loader accepts those (template discovery falls back to an
|
|
31
|
-
* aspect ratio of 1). The published types keep asking authors for all three.
|
|
32
|
-
*/
|
|
33
|
-
export type LoadedBlockTemplateDoc = Omit<BlockTemplateDoc, "displayName" | "aspectRatio" | "category"> & {
|
|
34
|
-
displayName?: string;
|
|
35
|
-
aspectRatio?: number;
|
|
36
|
-
category?: string;
|
|
37
|
-
};
|
|
38
|
-
export type _PageTemplateDocDriftLock = import("../../_shared/contract.js").Expect<import("../../_shared/contract.js").MutuallyAssignable<import("../../_shared/contract.js").NamedFields<z.infer<typeof pageTemplateSchema>>, import("../../_shared/contract.js").NamedFields<LoadedPageTemplateDoc>>>;
|
|
39
|
-
export type _BlockTemplateDocDriftLock = import("../../_shared/contract.js").Expect<import("../../_shared/contract.js").MutuallyAssignable<import("../../_shared/contract.js").NamedFields<z.infer<typeof blockTemplateSchema>>, import("../../_shared/contract.js").NamedFields<LoadedBlockTemplateDoc>>>;
|
|
40
|
-
import { z } from 'zod';
|
|
41
|
-
declare const pageTemplateSchema: z.ZodObject<{
|
|
42
|
-
type: z.ZodLiteral<"page">;
|
|
43
|
-
name: z.ZodString;
|
|
44
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
45
|
-
description: z.ZodOptional<z.ZodString>;
|
|
46
|
-
category: z.ZodOptional<z.ZodString>;
|
|
47
|
-
componentsUsed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
-
preview: z.ZodOptional<z.ZodObject<{
|
|
49
|
-
image: z.ZodOptional<z.ZodString>;
|
|
50
|
-
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.core.$strict>>;
|
|
52
|
-
isReady: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
-
scaffold: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
-
isHiddenFromOverview: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
registry: z.ZodOptional<z.ZodObject<{
|
|
56
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
57
|
-
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
-
}, z.core.$strict>>;
|
|
59
|
-
placement: z.ZodOptional<z.ZodObject<{
|
|
60
|
-
parent: z.ZodString;
|
|
61
|
-
slot: z.ZodOptional<z.ZodString>;
|
|
62
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
63
|
-
}, z.core.$strict>>;
|
|
64
|
-
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
-
audience: z.ZodOptional<z.ZodEnum<{
|
|
66
|
-
public: "public";
|
|
67
|
-
internal: "internal";
|
|
68
|
-
}>>;
|
|
69
|
-
}, z.core.$strict>;
|
|
70
|
-
declare const blockTemplateSchema: z.ZodObject<{
|
|
71
|
-
type: z.ZodLiteral<"block">;
|
|
72
|
-
exampleFor: z.ZodOptional<z.ZodString>;
|
|
73
|
-
alsoExampleFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
-
alsoShowcaseFor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
75
|
-
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
76
|
-
scale: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
isShowcase: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
-
name: z.ZodString;
|
|
79
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
80
|
-
description: z.ZodOptional<z.ZodString>;
|
|
81
|
-
category: z.ZodOptional<z.ZodString>;
|
|
82
|
-
componentsUsed: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
-
preview: z.ZodOptional<z.ZodObject<{
|
|
84
|
-
image: z.ZodOptional<z.ZodString>;
|
|
85
|
-
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
86
|
-
}, z.core.$strict>>;
|
|
87
|
-
isReady: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
-
scaffold: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
-
isHiddenFromOverview: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
-
registry: z.ZodOptional<z.ZodObject<{
|
|
91
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
92
|
-
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
|
-
}, z.core.$strict>>;
|
|
94
|
-
placement: z.ZodOptional<z.ZodObject<{
|
|
95
|
-
parent: z.ZodString;
|
|
96
|
-
slot: z.ZodOptional<z.ZodString>;
|
|
97
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
98
|
-
}, z.core.$strict>>;
|
|
99
|
-
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
-
audience: z.ZodOptional<z.ZodEnum<{
|
|
101
|
-
public: "public";
|
|
102
|
-
internal: "internal";
|
|
103
|
-
}>>;
|
|
104
|
-
}, z.core.$strict>;
|
|
105
|
-
export {};
|
|
14
|
+
export type TemplateDoc = import("../types").TemplateDoc;
|
|
@@ -9,12 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import {z} from 'zod';
|
|
12
|
-
import {AuthoredDocGraphFields} from '../_schema.mjs';
|
|
13
12
|
import {formatZodError} from '../../_shared/errors.mjs';
|
|
14
13
|
|
|
15
|
-
/** @typedef {import('../types
|
|
16
|
-
/** @typedef {import('./type.js').PageTemplateDoc} PageTemplateDoc */
|
|
17
|
-
/** @typedef {import('./type.js').BlockTemplateDoc} BlockTemplateDoc */
|
|
14
|
+
/** @typedef {import('../types').TemplateDoc} TemplateDoc */
|
|
18
15
|
|
|
19
16
|
const previewSchema = z
|
|
20
17
|
.object({
|
|
@@ -40,10 +37,9 @@ const registryIdentitySchema = z
|
|
|
40
37
|
.strict();
|
|
41
38
|
|
|
42
39
|
const baseTemplateFields = {
|
|
43
|
-
...AuthoredDocGraphFields,
|
|
44
40
|
name: z.string().min(1, 'name is required'),
|
|
45
41
|
displayName: z.string().min(1).optional(),
|
|
46
|
-
description: z.string().min(1, 'description is required')
|
|
42
|
+
description: z.string().min(1, 'description is required'),
|
|
47
43
|
category: z.string().optional(),
|
|
48
44
|
componentsUsed: z.array(z.string()).optional(),
|
|
49
45
|
preview: previewSchema.optional(),
|
|
@@ -69,36 +65,6 @@ const blockTemplateSchema = z
|
|
|
69
65
|
})
|
|
70
66
|
.strict();
|
|
71
67
|
|
|
72
|
-
/**
|
|
73
|
-
* Templates as they load. Integration templates already published omit
|
|
74
|
-
* `displayName` and `aspectRatio` and group themselves under their own
|
|
75
|
-
* `category`, so the loader accepts those (template discovery falls back to an
|
|
76
|
-
* aspect ratio of 1). The published types keep asking authors for all three.
|
|
77
|
-
*
|
|
78
|
-
* @typedef {Omit<PageTemplateDoc, 'displayName' | 'category'>
|
|
79
|
-
* & {displayName?: string, category?: string}} LoadedPageTemplateDoc
|
|
80
|
-
* @typedef {Omit<BlockTemplateDoc, 'displayName' | 'aspectRatio' | 'category'>
|
|
81
|
-
* & {displayName?: string, aspectRatio?: number, category?: string}} LoadedBlockTemplateDoc
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @typedef {import('../../_shared/contract.js').Expect<
|
|
86
|
-
* import('../../_shared/contract.js').MutuallyAssignable<
|
|
87
|
-
* import('../../_shared/contract.js').NamedFields<z.infer<typeof pageTemplateSchema>>,
|
|
88
|
-
* import('../../_shared/contract.js').NamedFields<LoadedPageTemplateDoc>
|
|
89
|
-
* >
|
|
90
|
-
* >} _PageTemplateDocDriftLock
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @typedef {import('../../_shared/contract.js').Expect<
|
|
95
|
-
* import('../../_shared/contract.js').MutuallyAssignable<
|
|
96
|
-
* import('../../_shared/contract.js').NamedFields<z.infer<typeof blockTemplateSchema>>,
|
|
97
|
-
* import('../../_shared/contract.js').NamedFields<LoadedBlockTemplateDoc>
|
|
98
|
-
* >
|
|
99
|
-
* >} _BlockTemplateDocDriftLock
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
68
|
const templateEnvelopeSchema = z
|
|
103
69
|
.discriminatedUnion('type', [pageTemplateSchema, blockTemplateSchema])
|
|
104
70
|
.superRefine((template, context) => {
|
|
@@ -112,14 +112,8 @@ describe('parseTemplate (load boundary)', () => {
|
|
|
112
112
|
expect(reason({type: 'page', description: 'x'})).toContain('name');
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
it('
|
|
116
|
-
expect(
|
|
117
|
-
type: 'page',
|
|
118
|
-
name: 'x',
|
|
119
|
-
});
|
|
120
|
-
expect(reason({type: 'page', name: 'x', description: ''})).toContain(
|
|
121
|
-
'description',
|
|
122
|
-
);
|
|
115
|
+
it('rejects a missing description', () => {
|
|
116
|
+
expect(reason({type: 'page', name: 'x'})).toContain('description');
|
|
123
117
|
});
|
|
124
118
|
|
|
125
119
|
it('rejects an empty-string name', () => {
|
|
@@ -148,10 +148,6 @@ export const doc = {
|
|
|
148
148
|
},
|
|
149
149
|
],
|
|
150
150
|
notes: [
|
|
151
|
-
{
|
|
152
|
-
type: 'prose',
|
|
153
|
-
text: 'When it loads, a template may leave out `displayName` and `aspectRatio` and use its own `category`, as integration templates already published do; a block with no `aspectRatio` previews at 1. Write to the type anyway; it is the contract.',
|
|
154
|
-
},
|
|
155
151
|
{
|
|
156
152
|
type: 'prose',
|
|
157
153
|
text: "TemplateDoc is a discriminated union keyed by `type`. Set `type: 'page'` for a full page template. Set `type: 'block'` for an editable composition; add `exampleFor` only when one component owns the example.",
|
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
* @file Template doc types.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
AuthoredDocGraphFields,
|
|
9
|
-
RegistryDocIdentity,
|
|
10
|
-
} from '../base/type.js';
|
|
7
|
+
import type {RegistryDocIdentity} from '../base/type';
|
|
11
8
|
|
|
12
|
-
export interface BaseTemplateDoc
|
|
9
|
+
export interface BaseTemplateDoc {
|
|
13
10
|
/** Identifier name for the template. For block templates this matches
|
|
14
11
|
* the React component import name (e.g. `"ChatMessageMetadata"`); for
|
|
15
12
|
* page templates it's a human-readable label that doubles as the
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
* behind `@astryxdesign/cli/authoring`.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export type * from './base/type
|
|
11
|
-
export type * from './component/type
|
|
12
|
-
export type * from './hook/type
|
|
13
|
-
export type * from './function/type
|
|
14
|
-
export type * from './reference/type
|
|
15
|
-
export type * from './
|
|
16
|
-
export type * from './
|
|
17
|
-
export type * from './
|
|
18
|
-
export type * from './
|
|
19
|
-
export type * from './enum/type.js';
|
|
10
|
+
export type * from './base/type';
|
|
11
|
+
export type * from './component/type';
|
|
12
|
+
export type * from './hook/type';
|
|
13
|
+
export type * from './function/type';
|
|
14
|
+
export type * from './reference/type';
|
|
15
|
+
export type * from './template/type';
|
|
16
|
+
export type * from './schema/type';
|
|
17
|
+
export type * from './command/type';
|
|
18
|
+
export type * from './enum/type';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @typedef {import('../_shared/contract
|
|
6
|
-
* import('../_shared/contract
|
|
5
|
+
* @typedef {import('../_shared/contract').Expect<
|
|
6
|
+
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
7
7
|
* >} _GapReportReceiptDriftLock
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -25,23 +25,23 @@ export function parseGapReportHandler(input: unknown, label?: string): GapReport
|
|
|
25
25
|
* @returns {GapReportHandlerReceipt | null}
|
|
26
26
|
*/
|
|
27
27
|
export function parseGapReportReceipt(input: unknown): GapReportHandlerReceipt | null;
|
|
28
|
-
export type _GapReportReceiptDriftLock = import("../_shared/contract
|
|
29
|
-
export type GapReportHandler = import("./type
|
|
30
|
-
export type GapReportHandlerReceipt = import("./type
|
|
28
|
+
export type _GapReportReceiptDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>>;
|
|
29
|
+
export type GapReportHandler = import("./type").GapReportHandler;
|
|
30
|
+
export type GapReportHandlerReceipt = import("./type").GapReportHandlerReceipt;
|
|
31
31
|
/**
|
|
32
32
|
* Compile-time drift-lock: the sealed schema must infer EXACTLY the public
|
|
33
33
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
34
34
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
35
35
|
*/
|
|
36
|
-
export type _GapReportHandlerDriftLock = import("../_shared/contract
|
|
36
|
+
export type _GapReportHandlerDriftLock = import("../_shared/contract").Expect<import("../_shared/contract").MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>>;
|
|
37
37
|
import { z } from 'zod';
|
|
38
38
|
/**
|
|
39
39
|
* Compile-time drift-lock: the sealed schema must infer EXACTLY the public
|
|
40
40
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
41
41
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
42
42
|
*
|
|
43
|
-
* @typedef {import('../_shared/contract
|
|
44
|
-
* import('../_shared/contract
|
|
43
|
+
* @typedef {import('../_shared/contract').Expect<
|
|
44
|
+
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
45
45
|
* >} _GapReportHandlerDriftLock
|
|
46
46
|
*/
|
|
47
47
|
declare const receiptSchema: z.ZodObject<{
|
|
@@ -55,9 +55,9 @@ declare const receiptSchema: z.ZodObject<{
|
|
|
55
55
|
}, z.core.$strict>;
|
|
56
56
|
declare const handlerSchema: z.ZodObject<{
|
|
57
57
|
audience: z.ZodEnum<{
|
|
58
|
-
public: "public";
|
|
59
58
|
internal: "internal";
|
|
59
|
+
public: "public";
|
|
60
60
|
}>;
|
|
61
|
-
handle: z.ZodType<(report: import("./type
|
|
61
|
+
handle: z.ZodType<(report: import("./type").GapReport, context: import("./type").GapReportHandlerContext) => import("./type").GapReportHandlerReceipt | Promise<import("./type").GapReportHandlerReceipt>, any, z.core.$ZodTypeInternals<(report: import("./type").GapReport, context: import("./type").GapReportHandlerContext) => import("./type").GapReportHandlerReceipt | Promise<import("./type").GapReportHandlerReceipt>, any>>;
|
|
62
62
|
}, z.core.$strict>;
|
|
63
63
|
export {};
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
import {z} from 'zod';
|
|
14
14
|
import {formatZodError} from '../_shared/errors.mjs';
|
|
15
15
|
|
|
16
|
-
/** @typedef {import('./type
|
|
17
|
-
/** @typedef {import('./type
|
|
16
|
+
/** @typedef {import('./type').GapReportHandler} GapReportHandler */
|
|
17
|
+
/** @typedef {import('./type').GapReportHandlerReceipt} GapReportHandlerReceipt */
|
|
18
18
|
|
|
19
19
|
// Typed z.custom so z.infer reproduces the real function type, matching the
|
|
20
20
|
// pattern used by the debug handler and post-codemod hook parsers.
|
|
@@ -36,8 +36,8 @@ const handlerSchema = z
|
|
|
36
36
|
* {@link GapReportHandler} type. If they drift, `MutuallyAssignable` becomes
|
|
37
37
|
* `false` and `Expect<false>` fails `tsconfig.authoring-contract.json`.
|
|
38
38
|
*
|
|
39
|
-
* @typedef {import('../_shared/contract
|
|
40
|
-
* import('../_shared/contract
|
|
39
|
+
* @typedef {import('../_shared/contract').Expect<
|
|
40
|
+
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof handlerSchema>, GapReportHandler>
|
|
41
41
|
* >} _GapReportHandlerDriftLock
|
|
42
42
|
*/
|
|
43
43
|
|
|
@@ -50,8 +50,8 @@ const receiptSchema = z
|
|
|
50
50
|
.strict();
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* @typedef {import('../_shared/contract
|
|
54
|
-
* import('../_shared/contract
|
|
53
|
+
* @typedef {import('../_shared/contract').Expect<
|
|
54
|
+
* import('../_shared/contract').MutuallyAssignable<z.infer<typeof receiptSchema>, GapReportHandlerReceipt>
|
|
55
55
|
* >} _GapReportReceiptDriftLock
|
|
56
56
|
*/
|
|
57
57
|
|
package/authoring/index.d.mts
CHANGED
|
@@ -14,6 +14,5 @@ export { parseTemplate } from "./doctypes/template/parse.mjs";
|
|
|
14
14
|
export { parseSchema } from "./doctypes/schema/parse.mjs";
|
|
15
15
|
export { parseCommand } from "./doctypes/command/parse.mjs";
|
|
16
16
|
export { parseEnum } from "./doctypes/enum/parse.mjs";
|
|
17
|
-
export { parseNamespace } from "./doctypes/namespace/parse.mjs";
|
|
18
17
|
export { parseLegacyDoc } from "./doctypes/legacy.mjs";
|
|
19
18
|
export { parseGapReportHandler, parseGapReportReceipt } from "./gap-report/parse.mjs";
|