@astryxdesign/cli 0.6.3-canary.7ada42e → 0.6.3-canary.7ec7be0
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 +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- 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 +151 -8
- package/api/doctor/doctor.test.mjs +95 -7
- 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 +119 -117
- package/authoring/doctypes/_schema.mjs +54 -3
- package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/load-contract.test.mjs +26 -1
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.mjs +3 -2
- package/authoring/doctypes/reference/reference.doc.mjs +34 -5
- package/authoring/doctypes/reference/type.ts +28 -11
- 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/index.d.ts +1 -0
- 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 +183 -69
- package/clients/cli/commands/docs.test.mjs +120 -16
- 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/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 +25 -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 +223 -24
- package/foundation/discovery/docs-discovery.test.mjs +103 -27
- 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 +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- 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 +57 -10
- 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
|
@@ -17,15 +17,27 @@ export const doc = {
|
|
|
17
17
|
description:
|
|
18
18
|
'One entry point for the template family: with no name it lists the discovered ' +
|
|
19
19
|
"templates; with a name it returns that template's source, a layout skeleton, or " +
|
|
20
|
-
'scaffolds it into the project.
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
20
|
+
'scaffolds it into the project. A configured integration may replace a Core ' +
|
|
21
|
+
'template id for unqualified discovery and lookup; package selection still ' +
|
|
22
|
+
'addresses the Core original. Other duplicate ids remain ambiguous and can be ' +
|
|
23
|
+
'narrowed by type and/or package. The cdn option writes the annotated ' +
|
|
24
|
+
'no-build-step CDN starter page, which ships as an asset rather than as ' +
|
|
24
25
|
'a discovered template.',
|
|
25
26
|
importPath: '@astryxdesign/cli/api',
|
|
26
27
|
signature:
|
|
27
28
|
'template(name?: string, options?: TemplateOptions): Promise<TemplateListResponse | TemplateShowResponse | TemplateSkeletonResponse | TemplateCopyResponse | TemplateCdnResponse>',
|
|
28
|
-
keywords: [
|
|
29
|
+
keywords: [
|
|
30
|
+
'template',
|
|
31
|
+
'scaffold',
|
|
32
|
+
'page',
|
|
33
|
+
'block',
|
|
34
|
+
'skeleton',
|
|
35
|
+
'starter',
|
|
36
|
+
'cdn',
|
|
37
|
+
'esm',
|
|
38
|
+
'importmap',
|
|
39
|
+
'no-build',
|
|
40
|
+
],
|
|
29
41
|
params: [
|
|
30
42
|
{
|
|
31
43
|
name: 'name',
|
|
@@ -70,7 +82,7 @@ export const doc = {
|
|
|
70
82
|
name: 'options.package',
|
|
71
83
|
type: 'string',
|
|
72
84
|
description:
|
|
73
|
-
'Narrow lookups to templates from a specific owning package
|
|
85
|
+
'Narrow lookups to templates from a specific owning package. Without it, a valid integration replacement is selected for the Core id; use @astryxdesign/core to select the original.',
|
|
74
86
|
},
|
|
75
87
|
{
|
|
76
88
|
name: 'options.targetPath',
|
|
@@ -96,7 +108,7 @@ export const doc = {
|
|
|
96
108
|
{
|
|
97
109
|
type: 'template.list',
|
|
98
110
|
description:
|
|
99
|
-
'
|
|
111
|
+
'The effective templates (page + block); a valid integration replacement takes the place of its Core target and carries `replaces`. Pass `package` to list one package, including replaced Core originals.',
|
|
100
112
|
},
|
|
101
113
|
{
|
|
102
114
|
type: 'template.show',
|
|
@@ -143,7 +155,15 @@ export const doc = {
|
|
|
143
155
|
],
|
|
144
156
|
examples: [
|
|
145
157
|
{label: 'List templates', code: 'const {data} = await template();'},
|
|
158
|
+
{
|
|
159
|
+
label: 'List exact Core ids',
|
|
160
|
+
code: "await template(undefined, {list: true, package: '@astryxdesign/core'});",
|
|
161
|
+
},
|
|
146
162
|
{label: 'Show source', code: "await template('dashboard');"},
|
|
163
|
+
{
|
|
164
|
+
label: 'Select a replaced Core original',
|
|
165
|
+
code: "await template('shell-side-nav', {package: '@astryxdesign/core'});",
|
|
166
|
+
},
|
|
147
167
|
{
|
|
148
168
|
label: 'Layout skeleton',
|
|
149
169
|
code: "await template('dashboard', {skeleton: true});",
|
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
* ./list, ./show, ./skeleton, ./copy, ./cdn and shared discovery in foundation/discovery.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
discoverAll,
|
|
20
|
+
discoverAllResolved,
|
|
21
|
+
discoverAllUnresolved,
|
|
22
|
+
pkgOf,
|
|
23
|
+
templateLookupIds,
|
|
24
|
+
} from '../../foundation/discovery/template-adapter.mjs';
|
|
19
25
|
import {AstryxError} from '../error.mjs';
|
|
20
26
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
21
27
|
import {templateList} from './list/list.mjs';
|
|
@@ -88,18 +94,49 @@ export async function template(name, options = {}) {
|
|
|
88
94
|
});
|
|
89
95
|
}
|
|
90
96
|
|
|
91
|
-
const templates =
|
|
97
|
+
const templates =
|
|
98
|
+
packageFilter === '@astryxdesign/core'
|
|
99
|
+
? await discoverAllUnresolved(cwd)
|
|
100
|
+
: packageFilter
|
|
101
|
+
? await discoverAllResolved(cwd)
|
|
102
|
+
: await discoverAll(cwd);
|
|
92
103
|
|
|
93
104
|
if (list || (!name && !skeleton)) {
|
|
94
105
|
return templateList(templates, {type, package: packageFilter});
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
// Resolve `name` to a single template.
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (
|
|
108
|
+
// Resolve `name` to a single template. Without an explicit package, an active
|
|
109
|
+
// integration replacement owns the Core id it names. Package-qualified lookup
|
|
110
|
+
// stays exact, which keeps the original addressable as
|
|
111
|
+
// `--package @astryxdesign/core`.
|
|
112
|
+
let pool = templates;
|
|
113
|
+
if (type) pool = pool.filter(t => t.type === type);
|
|
114
|
+
if (packageFilter) pool = pool.filter(t => pkgOf(t) === packageFilter);
|
|
115
|
+
// With no name there is nothing to replace; `--skeleton` alone must still
|
|
116
|
+
// fail as an unknown template.
|
|
117
|
+
const replacements =
|
|
118
|
+
packageFilter || name == null ? [] : pool.filter(t => t.replaces === name);
|
|
119
|
+
let candidates = packageFilter
|
|
120
|
+
? pool.filter(t => t.dirName === (name ?? ''))
|
|
121
|
+
: replacements.length > 0
|
|
122
|
+
? replacements
|
|
123
|
+
: pool.filter(t => templateLookupIds(t).includes(name ?? ''));
|
|
124
|
+
|
|
125
|
+
// A rejected same-id declaration must not displace Core for the bare command,
|
|
126
|
+
// but a different-kind integration template remains reachable with --type.
|
|
127
|
+
if (!packageFilter && !type && candidates.length > 1) {
|
|
128
|
+
const core = candidates.filter(t => pkgOf(t) === '@astryxdesign/core');
|
|
129
|
+
const rejected = candidates.filter(t => pkgOf(t) !== '@astryxdesign/core');
|
|
130
|
+
if (
|
|
131
|
+
core.length === 1 &&
|
|
132
|
+
rejected.length === candidates.length - 1 &&
|
|
133
|
+
rejected.every(
|
|
134
|
+
t => t.replacementRejected && t.replacementTarget === (name ?? ''),
|
|
135
|
+
)
|
|
136
|
+
) {
|
|
137
|
+
candidates = core;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
103
140
|
|
|
104
141
|
if (name && candidates.length === 0) {
|
|
105
142
|
throw new AstryxError(
|
|
@@ -21,6 +21,10 @@ export type TemplateListEntry = {
|
|
|
21
21
|
* - Owning package; core (built-in) templates report '@astryxdesign/core'.
|
|
22
22
|
*/
|
|
23
23
|
package: string;
|
|
24
|
+
/**
|
|
25
|
+
* - Core template id this integration template replaces by default.
|
|
26
|
+
*/
|
|
27
|
+
replaces?: string | undefined;
|
|
24
28
|
/**
|
|
25
29
|
* - Optional grouping/category label.
|
|
26
30
|
*/
|
|
@@ -116,17 +120,11 @@ export type TemplateOptions = {
|
|
|
116
120
|
*/
|
|
117
121
|
cdn?: string | boolean | undefined;
|
|
118
122
|
/**
|
|
119
|
-
* Filter templates by kind: 'page' or 'block'.
|
|
123
|
+
* Filter templates by kind: 'page' or 'block'. Narrows both list and direct lookup.
|
|
120
124
|
*/
|
|
121
125
|
type?: "page" | "block" | undefined;
|
|
122
126
|
/**
|
|
123
|
-
* Narrow to templates from a specific package
|
|
127
|
+
* Narrow to templates from a specific package. Without it, a valid integration replacement is selected for the Core id;
|
|
124
128
|
*/
|
|
125
129
|
package?: string | undefined;
|
|
126
|
-
targetPath?: string | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* Overwrite an existing target file instead of erroring (ERR_FILE_EXISTS).
|
|
129
|
-
*/
|
|
130
|
-
overwrite?: boolean | undefined;
|
|
131
|
-
cwd?: string | undefined;
|
|
132
130
|
};
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* @property {string} description
|
|
32
32
|
* @property {'page' | 'block'} type
|
|
33
33
|
* @property {string} package - Owning package; core (built-in) templates report '@astryxdesign/core'.
|
|
34
|
+
* @property {string} [replaces] - Core template id this integration template replaces by default.
|
|
34
35
|
* @property {string} [category] - Optional grouping/category label.
|
|
35
36
|
* @property {string[]} [componentsUsed] - Component display names the template composes.
|
|
36
37
|
* @property {number} [aspectRatio] - Block preview width/height ratio.
|
|
@@ -93,8 +94,8 @@
|
|
|
93
94
|
* @property {boolean} [skeleton]
|
|
94
95
|
* @property {boolean} [show]
|
|
95
96
|
* @property {boolean | string} [cdn] Write the no-build-step CDN starter page instead of resolving a template. A string is used as the destination path.
|
|
96
|
-
* @property {'page' | 'block'} [type] Filter templates by kind: 'page' or 'block'.
|
|
97
|
-
* @property {string} [package] Narrow to templates from a specific package
|
|
97
|
+
* @property {'page' | 'block'} [type] Filter templates by kind: 'page' or 'block'. Narrows both list and direct lookup.
|
|
98
|
+
* @property {string} [package] Narrow to templates from a specific package. Without it, a valid integration replacement is selected for the Core id; @astryxdesign/core explicitly selects the original.
|
|
98
99
|
* @property {string} [targetPath]
|
|
99
100
|
* @property {boolean} [overwrite] Overwrite an existing target file instead of erroring (ERR_FILE_EXISTS).
|
|
100
101
|
* @property {string} [cwd]
|
|
@@ -13,6 +13,7 @@ import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
|
13
13
|
import * as fs from 'node:fs';
|
|
14
14
|
import * as path from 'node:path';
|
|
15
15
|
import * as os from 'node:os';
|
|
16
|
+
import {themeTemplate as publicThemeTemplate} from '../../index.mjs';
|
|
16
17
|
import {themeTemplate, THEME_TEMPLATE_DEFAULT_PATH} from './template.mjs';
|
|
17
18
|
import {isErrorCode} from '../../../foundation/response/error-codes.mjs';
|
|
18
19
|
|
|
@@ -25,6 +26,10 @@ afterEach(() => {
|
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
describe('themeTemplate()', () => {
|
|
29
|
+
it('is available through the public API entry point', () => {
|
|
30
|
+
expect(publicThemeTemplate).toBe(themeTemplate);
|
|
31
|
+
});
|
|
32
|
+
|
|
28
33
|
it('writes the template and returns a theme.template receipt', () => {
|
|
29
34
|
const res = themeTemplate({cwd: tmpDir});
|
|
30
35
|
|
|
@@ -24,7 +24,7 @@ export const doc = {
|
|
|
24
24
|
'`overwrite`, so it is safe to re-run.',
|
|
25
25
|
importPath: '@astryxdesign/cli/api',
|
|
26
26
|
signature:
|
|
27
|
-
'themeTemplate(options?: {targetPath?: string, overwrite?: boolean, cwd?: string}):
|
|
27
|
+
'themeTemplate(options?: {targetPath?: string, overwrite?: boolean, cwd?: string}): ThemeTemplateResponse',
|
|
28
28
|
keywords: ['theme', 'template', 'starter', 'defineTheme', 'scaffold', 'reference', 'tokens'],
|
|
29
29
|
params: [
|
|
30
30
|
{
|
|
@@ -98,11 +98,11 @@ export const docs = {
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
type: 'prose',
|
|
101
|
-
text: 'These stylesheets are cascade-layered: the reset loads in @layer reset and component styles in @layer astryx-base. If your project has existing global CSS, a legacy reset, or Tailwind, declare the layer order explicitly and assign every stylesheet to a layer deliberately: unlayered styles and later layers both override astryx-base regardless of specificity. See the Cascade Layer Safety section in
|
|
101
|
+
text: 'These stylesheets are cascade-layered: the reset loads in @layer reset and component styles in @layer astryx-base. If your project has existing global CSS, a legacy reset, or Tailwind, declare the layer order explicitly and assign every stylesheet to a layer deliberately: unlayered styles and later layers both override astryx-base regardless of specificity. See the Cascade Layer Safety section in {@link generic:migration} before building screens.',
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
type: 'prose',
|
|
105
|
-
text: 'Run
|
|
105
|
+
text: 'Run {@link generic:theme} for the full theming guide.',
|
|
106
106
|
},
|
|
107
107
|
],
|
|
108
108
|
},
|
|
@@ -25,7 +25,7 @@ export const docsDense = {
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
type: 'prose',
|
|
28
|
-
text: 'decides layout, not component APIs. npx astryx build "<idea>" =
|
|
28
|
+
text: 'decides layout, not component APIs. npx astryx build "<idea>" = the template to start from for your app type. npx astryx component <Name> = props.',
|
|
29
29
|
},
|
|
30
30
|
],
|
|
31
31
|
},
|
|
@@ -71,7 +71,7 @@ export const docsDense = {
|
|
|
71
71
|
null,
|
|
72
72
|
{
|
|
73
73
|
type: 'prose',
|
|
74
|
-
text: 'verify: you can state the reason in one sentence, and it still holds if the nav doubles. npx astryx build "<idea>" names the
|
|
74
|
+
text: 'verify: you can state the reason in one sentence, and it still holds if the nav doubles. npx astryx build "<idea>" names the template to start from; scaffold it and the pairing is wired up.',
|
|
75
75
|
},
|
|
76
76
|
// Best practices
|
|
77
77
|
null,
|
|
@@ -106,7 +106,7 @@ export const docs = {
|
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
type: 'prose',
|
|
109
|
-
text: 'Verify: you can state the reason in one sentence, and the choice still holds if the nav doubles in size. `npx astryx build "<idea>"` names the
|
|
109
|
+
text: 'Verify: you can state the reason in one sentence, and the choice still holds if the nav doubles in size. `npx astryx build "<idea>"` names the template to start from; scaffold it and the pairing is already wired up.',
|
|
110
110
|
},
|
|
111
111
|
|
|
112
112
|
{type: 'heading', level: 3, text: 'Best practices'},
|
|
@@ -39,10 +39,10 @@ export const docs = {
|
|
|
39
39
|
style: 'ordered',
|
|
40
40
|
items: [
|
|
41
41
|
'Use components for everything they cover',
|
|
42
|
-
'Page layout is frame-first: pick the shell and budget regions before writing content (see
|
|
42
|
+
'Page layout is frame-first: pick the shell and budget regions before writing content (see {@link generic:layout})',
|
|
43
43
|
'Dense data renders as rows (Table, List/Item), edge-to-edge with dividers; Card is for widgets, galleries, and settings groups',
|
|
44
|
-
'StyleX or Tailwind for custom styling; both are first-class (see
|
|
45
|
-
'Semantic tokens, not hardcoded values (see
|
|
44
|
+
'StyleX or Tailwind for custom styling; both are first-class (see {@link generic:styling})',
|
|
45
|
+
'Semantic tokens, not hardcoded values (see {@link generic:tokens})',
|
|
46
46
|
'CSS custom properties for colors, not hex values',
|
|
47
47
|
'Form inputs are controlled (value + onChange)',
|
|
48
48
|
'Use useLinkComponent() for navigation so consumers can plug in their framework router via LinkProvider',
|
|
@@ -60,7 +60,7 @@ export const docs = {
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
type: 'prose',
|
|
63
|
-
text: 'See
|
|
63
|
+
text: 'See {@link generic:styling} for the complete guide with examples.',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
66
|
},
|
|
@@ -76,7 +76,7 @@ export const docs = {
|
|
|
76
76
|
'Hardcoded colors (#fff). Use var(--color-*) or Tailwind semantic classes (text-primary, bg-surface)',
|
|
77
77
|
'Hardcoded spacing (16px). Use spacing tokens or Tailwind spacing utilities',
|
|
78
78
|
'Hardcoded <a> elements. Use useLinkComponent() so consumers can swap in their framework router via LinkProvider',
|
|
79
|
-
'Wrapping every list item or page section in a Card. Decide the frame first; dense data renders as rows (see
|
|
79
|
+
'Wrapping every list item or page section in a Card. Decide the frame first; dense data renders as rows (see {@link generic:layout})',
|
|
80
80
|
'Badge as decoration. Reserve Badge for counts and enumerated states; use StatusDot or Token for status',
|
|
81
81
|
'Inventing props. Read component docs first',
|
|
82
82
|
],
|
|
@@ -89,7 +89,7 @@ export const docs = {
|
|
|
89
89
|
content: [
|
|
90
90
|
{
|
|
91
91
|
type: 'prose',
|
|
92
|
-
text: 'The design system provides semantic design tokens for spacing, color, radius, shadow, typography, and size. Tokens adapt to the active theme and color mode. Run
|
|
92
|
+
text: 'The design system provides semantic design tokens for spacing, color, radius, shadow, typography, and size. Tokens adapt to the active theme and color mode. Run {@link generic:tokens} for the full reference with all values.',
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
},
|
|
@@ -24,7 +24,7 @@ export const docs = {
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
type: 'prose',
|
|
27
|
-
text: 'For available token names and values, run
|
|
27
|
+
text: 'For available token names and values, run {@link generic:tokens}. Focused references are also available with {@link generic:color}, {@link generic:spacing}, {@link generic:shape}, {@link generic:typography}, {@link generic:elevation}, and {@link generic:motion}.',
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
},
|
|
@@ -150,7 +150,7 @@ const styles = stylex.create({
|
|
|
150
150
|
content: [
|
|
151
151
|
{
|
|
152
152
|
type: 'prose',
|
|
153
|
-
text: 'The Tailwind v4 bridge at `@astryxdesign/core/tailwind-theme.css` maps Tailwind theme variables to system CSS variables with `@theme inline`, so utility classes like `text-primary`, `bg-surface`, `border-border`, `rounded-lg`, and `shadow-md` stay in sync with the active theme.',
|
|
153
|
+
text: 'The Tailwind v4 bridge at `@astryxdesign/core/tailwind-theme.css` maps Tailwind theme variables to system CSS variables with `@theme reference inline`, so utility classes like `text-primary`, `bg-surface`, `border-border`, `rounded-lg`, and `shadow-md` stay in sync with the active theme without emitting competing runtime declarations.',
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
type: 'code',
|
|
@@ -455,7 +455,7 @@ function RevenueChart({data}: {data: Array<{x: string; y: number}>}) {
|
|
|
455
455
|
'Import the reset/base CSS and a theme CSS file early enough for first paint. For production SSR, prefer built themes from `astryx theme build` or published `/built` theme imports plus `theme.css`.',
|
|
456
456
|
'Choose one owner for color mode. Theme uses `data-theme="light|dark"` and `color-scheme` to resolve `light-dark()` tokens.',
|
|
457
457
|
'Map the external library\'s semantic layer to system variables by intent, not by exact naming. For example, MUI `background.paper` maps to `--color-background-surface`.',
|
|
458
|
-
'Use
|
|
458
|
+
'Use {@link generic:tokens} and focused token docs when building mappings. Keep mappings small at first: text, surface/body/card/popover, border, accent, status, spacing, radius, typography, shadow.',
|
|
459
459
|
'Use token resolver APIs only for non-CSS APIs that need resolved values.',
|
|
460
460
|
],
|
|
461
461
|
},
|
|
@@ -30,7 +30,7 @@ export const docs = {
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
type: 'prose',
|
|
33
|
-
text: 'All approaches resolve to the same design tokens, so theming and dark mode work regardless of which you choose. For external styling libraries, run
|
|
33
|
+
text: 'All approaches resolve to the same design tokens, so theming and dark mode work regardless of which you choose. For external styling libraries, run {@link generic:styling-libraries}; it covers Tailwind, StyleX, Panda, Chakra, MUI, CSS-in-JS, CSS Modules, Sass, and `useTheme()` for non-CSS processing.',
|
|
34
34
|
},
|
|
35
35
|
],
|
|
36
36
|
},
|
|
@@ -118,7 +118,7 @@ const overrides = stylex.create({
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
type: 'prose',
|
|
121
|
-
text: 'The bridge is pure CSS with zero JS. Theme changes (dark mode, custom themes) apply automatically because the utilities reference the same CSS custom properties that components use. This is the paved Tailwind path; for other styling libraries that follow the same aliasing pattern, run
|
|
121
|
+
text: 'The bridge is pure CSS with zero JS. Theme changes (dark mode, custom themes) apply automatically because the utilities reference the same CSS custom properties that components use. This is the paved Tailwind path; for other styling libraries that follow the same aliasing pattern, run {@link generic:styling-libraries}.',
|
|
122
122
|
},
|
|
123
123
|
],
|
|
124
124
|
},
|
|
@@ -263,7 +263,7 @@ const overrides = stylex.create({
|
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
265
|
type: 'prose',
|
|
266
|
-
text: 'For systematic theming, use defineTheme component overrides instead of raw CSS selectors. defineTheme keeps the higher-level `prop:value` API (`variant:primary`, `size:sm`) and handles selector generation for you. Run
|
|
266
|
+
text: 'For systematic theming, use defineTheme component overrides instead of raw CSS selectors. defineTheme keeps the higher-level `prop:value` API (`variant:primary`, `size:sm`) and handles selector generation for you. Run {@link generic:theme} for the full theming guide.',
|
|
267
267
|
},
|
|
268
268
|
],
|
|
269
269
|
},
|
|
@@ -338,7 +338,7 @@ const styles = stylex.create({
|
|
|
338
338
|
},
|
|
339
339
|
{
|
|
340
340
|
type: 'prose',
|
|
341
|
-
text: 'See
|
|
341
|
+
text: 'See {@link generic:tokens} for the full token reference (all spacing, color, radius, shadow, and typography tokens with values). See {@link generic:theme} for how to override tokens via defineTheme.',
|
|
342
342
|
},
|
|
343
343
|
],
|
|
344
344
|
},
|
|
@@ -76,7 +76,7 @@ function App() {
|
|
|
76
76
|
[
|
|
77
77
|
'Neutral',
|
|
78
78
|
"import {neutralTheme} from '@astryxdesign/theme-neutral'",
|
|
79
|
-
'Muted, minimal aesthetic with
|
|
79
|
+
'Muted, minimal aesthetic with Figtree typography. A good starting point.',
|
|
80
80
|
],
|
|
81
81
|
[
|
|
82
82
|
'Butter',
|
|
@@ -391,7 +391,7 @@ const brandTheme = defineTheme({
|
|
|
391
391
|
content: [
|
|
392
392
|
{
|
|
393
393
|
type: 'prose',
|
|
394
|
-
text: 'The `components` field in defineTheme uses semantic component keys and style keys, not raw CSS selectors. Use `base` for all instances, `variant:value` or `stateName` for specific props/states, and let the theme pipeline choose the underlying selector. For raw external CSS escape hatches, prefer the data-attribute selector surface documented in
|
|
394
|
+
text: 'The `components` field in defineTheme uses semantic component keys and style keys, not raw CSS selectors. Use `base` for all instances, `variant:value` or `stateName` for specific props/states, and let the theme pipeline choose the underlying selector. For raw external CSS escape hatches, prefer the data-attribute selector surface documented in {@link generic:styling}.',
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
397
|
type: 'code',
|
|
@@ -572,7 +572,7 @@ import './themes/ocean.css';
|
|
|
572
572
|
},
|
|
573
573
|
{
|
|
574
574
|
type: 'prose',
|
|
575
|
-
text: "The build also warns when the theme names font families it does not load (webfonts like Fraunces) and prints the `<link>`/`@font-face` to add. The built CSS only sets font-family, so loading the font files stays the app's job. See
|
|
575
|
+
text: "The build also warns when the theme names font families it does not load (webfonts like Fraunces) and prints the `<link>`/`@font-face` to add. The built CSS only sets font-family, so loading the font files stays the app's job. See {@link generic:typography} for the full recipe.",
|
|
576
576
|
},
|
|
577
577
|
],
|
|
578
578
|
},
|
|
@@ -811,7 +811,7 @@ function ChartConfig() {
|
|
|
811
811
|
},
|
|
812
812
|
{
|
|
813
813
|
type: 'prose',
|
|
814
|
-
text: 'See
|
|
814
|
+
text: 'See {@link generic:styling-libraries} for styling-library interop and {@link generic:tokens} for the full token reference.',
|
|
815
815
|
},
|
|
816
816
|
],
|
|
817
817
|
},
|
|
@@ -1102,7 +1102,7 @@ export const docs = {
|
|
|
1102
1102
|
},
|
|
1103
1103
|
{
|
|
1104
1104
|
"type": "prose",
|
|
1105
|
-
"text": "See
|
|
1105
|
+
"text": "See {@link generic:styling} for how to apply tokens via xstyle, className, and compound component patterns. See {@link generic:theme} for overriding tokens with defineTheme."
|
|
1106
1106
|
}
|
|
1107
1107
|
]
|
|
1108
1108
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/api`: the programmatic API of `@astryxdesign/cli/api`.
|
|
5
|
+
*
|
|
6
|
+
* Adopts each function, schema, and enum doc whose `namespace` is `cli/api`,
|
|
7
|
+
* one generated level per kind: `cli/api/functions`, `cli/api/schemas`, and
|
|
8
|
+
* `cli/api/enums`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
12
|
+
export const docs = {
|
|
13
|
+
type: 'namespace',
|
|
14
|
+
name: 'api',
|
|
15
|
+
title: 'API',
|
|
16
|
+
summary:
|
|
17
|
+
'The programmatic API: functions, the JSON output envelope, error codes, and response types.',
|
|
18
|
+
keywords: ['api', 'functions', 'schemas', 'enums', 'json'],
|
|
19
|
+
placement: {parent: 'namespace:cli', slot: 'reference', order: 20},
|
|
20
|
+
slots: {
|
|
21
|
+
kinds: {title: 'Reference', accepts: {kinds: ['namespace']}},
|
|
22
|
+
},
|
|
23
|
+
adopts: [
|
|
24
|
+
{
|
|
25
|
+
source: {group: 'cli/api', kinds: ['function', 'schema', 'enum']},
|
|
26
|
+
into: 'kinds',
|
|
27
|
+
groupBy: 'kind',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli`: the top of the CLI's docs tree (spec:AST-046).
|
|
5
|
+
*
|
|
6
|
+
* A namespace declares a level and its slots. It never lists its children:
|
|
7
|
+
* a guide places itself here with `placement`, and the `commands` and `api`
|
|
8
|
+
* namespaces adopt the CLI's typed docs by the `namespace` group each declares.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
12
|
+
export const docs = {
|
|
13
|
+
type: 'namespace',
|
|
14
|
+
name: 'cli',
|
|
15
|
+
title: 'Astryx CLI',
|
|
16
|
+
summary:
|
|
17
|
+
'Commands, programmatic APIs, integration authoring, and output contracts.',
|
|
18
|
+
keywords: ['cli', 'commands', 'api', 'reference'],
|
|
19
|
+
slots: {
|
|
20
|
+
guides: {title: 'Guides', accepts: {kinds: ['generic', 'namespace']}},
|
|
21
|
+
reference: {title: 'Reference', accepts: {kinds: ['namespace']}},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/commands`: every command the CLI ships.
|
|
5
|
+
*
|
|
6
|
+
* Adopts each command doc whose `namespace` is `cli/commands`, so a new
|
|
7
|
+
* command appears here with no edit to this file.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
11
|
+
export const docs = {
|
|
12
|
+
type: 'namespace',
|
|
13
|
+
name: 'commands',
|
|
14
|
+
title: 'Commands',
|
|
15
|
+
summary:
|
|
16
|
+
'Every command and subcommand: usage, options, examples, and exit codes.',
|
|
17
|
+
keywords: ['commands', 'usage', 'options', 'flags'],
|
|
18
|
+
placement: {parent: 'namespace:cli', slot: 'reference', order: 10},
|
|
19
|
+
slots: {
|
|
20
|
+
commands: {title: 'Commands', accepts: {kinds: ['command']}},
|
|
21
|
+
},
|
|
22
|
+
adopts: [
|
|
23
|
+
{source: {group: 'cli/commands', kinds: ['command']}, into: 'commands'},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs cli/integrations`: the guide to building an integration
|
|
5
|
+
* package. It lives in the docs tree under the `cli` namespace (spec:AST-046),
|
|
6
|
+
* so its only route is `cli/integrations`.
|
|
7
|
+
*/
|
|
4
8
|
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
5
10
|
export const docs = {
|
|
6
|
-
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'integrations',
|
|
13
|
+
placement: {parent: 'namespace:cli', slot: 'guides', order: 10},
|
|
7
14
|
title: 'CLI Integrations',
|
|
8
15
|
category: 'guide',
|
|
9
16
|
description:
|
|
10
|
-
'
|
|
17
|
+
'Build an Astryx integration: an npm package that contributes components, templates, themes, docs, and upgrade codemods.',
|
|
11
18
|
|
|
12
19
|
sections: [
|
|
13
20
|
{
|
|
@@ -20,11 +27,11 @@ export const docs = {
|
|
|
20
27
|
},
|
|
21
28
|
{
|
|
22
29
|
type: 'prose',
|
|
23
|
-
text: 'The authoring CLI owns the integration file. The first `astryx integration add` creates `astryx.integration.mjs`; each later add declares its root only after writing a valid contribution behind it. Identity (name and version) still comes from package.json. For the consumer side, run
|
|
30
|
+
text: 'The authoring CLI owns the integration file. The first `astryx integration add` creates `astryx.integration.mjs`; each later add declares its root only after writing a valid contribution behind it. Identity (name and version) still comes from package.json. For the consumer side, run {@link generic:getting-started}.',
|
|
24
31
|
},
|
|
25
32
|
{
|
|
26
33
|
type: 'prose',
|
|
27
|
-
text: 'Every file an integration author writes is documented field by field in
|
|
34
|
+
text: 'Every file an integration author writes is documented field by field in {@link generic:authoring}: the manifest, astryx.config, codemods, identity, and each doc type. `npx astryx docs authoring --index` lists them, and `npx astryx docs authoring <key>` reads one.',
|
|
28
35
|
},
|
|
29
36
|
{
|
|
30
37
|
type: 'prose',
|
|
@@ -175,16 +182,37 @@ export const docs = {
|
|
|
175
182
|
},
|
|
176
183
|
{
|
|
177
184
|
type: 'prose',
|
|
178
|
-
text:
|
|
185
|
+
text: "A template id is its exact source-relative path with the metadata suffix removed; the display `name` is not its identity and may repeat. Run `astryx --json template --list --package @astryxdesign/core` and copy the Core entry's `id` exactly. To replace one, generate the source/metadata pair with `integration add template`, then set `replaces` in that template's own metadata to the exact Core id. The declaration lives on the template, as `replaces` does on a doc topic; the manifest only points at the templates root.",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'code',
|
|
189
|
+
lang: 'bash',
|
|
190
|
+
label: 'Create the integration template',
|
|
191
|
+
code: 'astryx integration add template acme-app-shell --type page',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: 'code',
|
|
195
|
+
lang: 'typescript',
|
|
196
|
+
label: 'Declare the replacement',
|
|
197
|
+
code: "// templates/acme-app-shell.doc.mjs\n/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */\nexport default {\n type: 'page',\n name: 'acme-app-shell',\n displayName: 'Acme App Shell',\n description: 'An app shell with Acme navigation.',\n replaces: 'shell-side-nav',\n};",
|
|
179
198
|
},
|
|
180
199
|
{
|
|
181
200
|
type: 'code',
|
|
182
201
|
lang: 'typescript',
|
|
183
|
-
|
|
202
|
+
label: 'Use product navigation in the replacement source',
|
|
203
|
+
code: "// templates/acme-app-shell.tsx\nimport {AppShell} from '@astryxdesign/core/AppShell';\nimport {Card} from '@astryxdesign/core/Card';\nimport {AcmeSideNav, AcmeTopNav} from '@acme/navigation';\n\nexport default function AcmeAppShell() {\n return (\n <AppShell\n sideNav={<AcmeSideNav />}\n topNav={<AcmeTopNav />}>\n <Card>Product content</Card>\n </AppShell>\n );\n}",
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
type: 'prose',
|
|
207
|
+
text: 'With that declaration, `astryx template shell-side-nav` selects `acme-app-shell`; template listing, search, build suggestions, and block-layout lookup use the same effective identity. `astryx template shell-side-nav --package @astryxdesign/core` still selects the original, and `astryx template acme-app-shell --package @acme/navigation` explicitly selects the integration template. In the `template.list` JSON response, a winning replacement entry carries `replaces` naming the Core id it supersedes, and the Core entry is omitted from the default listing. A page can replace only a Core page, and a block can replace only a Core block. Missing Core targets, type mismatches, a declaration on a template that cannot be used, and more than one replacement from one package fail closed: Core stays the default and `astryx doctor integration templates <package>` reports the error. If multiple explicitly configured packages each replace the target, the package configured later wins with a warning. An explicitly configured replacement always wins over an autolinked one. If only autolinked packages conflict, the package listed later in package.json dependencies wins with a warning; add the intended package to `astryx.config` to make the choice explicit. Without `replaces`, valid template selection keeps the existing package-aware ambiguity behavior; contribution failure isolation still follows the rules below.',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'prose',
|
|
211
|
+
text: "`replaces` is part of the strict template metadata object, so a CLI older than 0.7.0 rejects it: on those CLIs the package's templates and doc topics are withheld with one warning, while its components still load. Declare `@astryxdesign/cli >=0.7.0` when a package uses `replaces`.",
|
|
184
212
|
},
|
|
185
213
|
{
|
|
186
214
|
type: 'prose',
|
|
187
|
-
text: 'The CLI needs both files at consume time. `integration add` includes the templates root when package.json already has a files allowlist. It never creates an exports map, because doing that can make previously-open deep imports private; when a map already exists, it adds the generated source subpath without replacing author-owned entries. Use consumer-safe extensionless subpaths in the exports map (e.g. `"./templates/AcmeDashboard"` instead of `"./templates/AcmeDashboard.tsx"`), so consumers import without knowing the file extension. `integration pack --check` proves the source and metadata survive the tarball and verifies every component through the public import its metadata advertises.',
|
|
215
|
+
text: 'The CLI needs both files at consume time. `integration add` includes the templates root when package.json already has a files allowlist. It never creates an exports map, because doing that can make previously-open deep imports private; when a map already exists, it adds the generated source subpath without replacing author-owned entries. Use consumer-safe extensionless subpaths in the exports map (e.g. `"./templates/AcmeDashboard"` instead of `"./templates/AcmeDashboard.tsx"`), so consumers import without knowing the file extension. `integration pack --check` proves the source and metadata, including `replaces`, survive the tarball and verifies every component through the public import its metadata advertises.',
|
|
188
216
|
},
|
|
189
217
|
],
|
|
190
218
|
},
|
|
@@ -426,7 +454,7 @@ export const docs = {
|
|
|
426
454
|
},
|
|
427
455
|
{
|
|
428
456
|
type: 'prose',
|
|
429
|
-
text:
|
|
457
|
+
text: "Discovery is resilient. A manifest that fails to load is skipped because none of its roots are trustworthy. An error in one contribution kind is reported without hiding the integration's other valid kinds. Invalid template and component files are omitted without hiding valid siblings; other kinds keep their existing all-or-nothing behavior. Everyday commands keep working with the remaining valid contributions, warnings go to stderr, and `--json` stdout stays clean.",
|
|
430
458
|
},
|
|
431
459
|
{
|
|
432
460
|
type: 'prose',
|