@astryxdesign/cli 0.7.0-canary.450c68d → 0.7.0-canary.4ec1f4e
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 +30 -33
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.test.mjs +28 -0
- package/api/doctor/theme-checks.mjs +10 -10
- package/api/doctor/theme-checks.test.mjs +5 -4
- package/api/gap-report/gap-report.doc.mjs +1 -1
- package/api/gap-report/gap-report.mjs +15 -0
- package/api/gap-report/gap-report.test.mjs +1 -1
- package/api/index.d.mts +0 -2
- package/api/index.mjs +0 -2
- package/api/init/init.doc.mjs +5 -1
- package/api/init/init.mjs +22 -0
- package/api/init/init.type.d.mts +4 -1
- package/api/init/init.type.mjs +1 -1
- package/api/init/remove/remove.mjs +8 -3
- package/api/init/remove/remove.test.mjs +12 -0
- package/api/init/run/run.d.mts +1 -1
- package/api/init/run/run.mjs +3 -3
- package/api/integration/validate-integration.d.mts +4 -0
- package/api/integration/validate-integration.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/index.ts +0 -1
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.mjs +1 -1
- package/api/search/search.test.mjs +1 -1
- package/api/search/search.type.d.mts +1 -1
- package/api/search/search.type.mjs +1 -1
- package/api/template/template-integration.test.mjs +37 -100
- package/api/template/template.doc.mjs +5 -1
- package/api/template/template.mjs +45 -0
- package/api/theme/_adapter.mjs +3 -3
- package/api/theme/add/add.d.mts +11 -5
- package/api/theme/add/add.mjs +19 -192
- package/api/theme/add/add.test.mjs +68 -258
- package/api/theme/add/add.types.test.mjs +0 -1
- package/api/theme/build/build.d.mts +3 -3
- package/api/theme/build/build.mjs +22 -36
- package/api/theme/build/build.test.mjs +11 -24
- package/api/theme/eject/eject.copy-compat.test.mjs +168 -0
- package/api/theme/integration-themes.test.mjs +3 -3
- package/api/theme/remove/remove.test.mjs +1 -1
- package/api/theme/targets/targets.test.mjs +0 -4
- package/api/theme/template/template.mjs +1 -1
- package/api/theme/theme.type.d.mts +1 -30
- package/api/theme/theme.type.mjs +3 -13
- package/api/theme/themeAdd.doc.mjs +19 -27
- package/api/theme/themeTargets.doc.mjs +3 -4
- package/api/theme/themeTemplate.doc.mjs +1 -1
- package/api/theme/use/use.test.mjs +1 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.mjs +19 -0
- package/assets/codemods/transforms/next/README.md +15 -17
- package/assets/codemods/transforms/next/__tests__/migrate-deprecated-theme-surface.test.mjs +322 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-deprecated-theme-surface-v0.6-data.mjs +229 -0
- package/assets/codemods/transforms/next/migrate-deprecated-theme-surface.mjs +624 -0
- package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +38 -18
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +2 -2
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/fonts-and-assets.doc.mjs +3 -3
- package/assets/docs/tree/styling-advanced.doc.mjs +21 -14
- package/assets/docs/tree/themes.doc.mjs +1 -1
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +2 -2
- package/assets/docs/tree/versioning.doc.mjs +1 -4
- package/assets/docs/use-a-theme.doc.mjs +16 -16
- package/authoring/debug/type.ts +2 -2
- package/authoring/doctypes/base/type.ts +0 -9
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/command-result-coverage.test.mjs +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +4 -0
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +35 -8
- package/clients/cli/commands/build-theme.mjs +31 -67
- package/clients/cli/commands/build-theme.registry.test.mjs +0 -10
- package/clients/cli/commands/debug-result-summary.test.mjs +0 -16
- package/clients/cli/commands/discover.mjs +2 -1
- package/clients/cli/commands/doctor.mjs +5 -2
- package/clients/cli/commands/empty-argument.test.mjs +16 -0
- package/clients/cli/commands/gap-report.doc.mjs +1 -1
- package/clients/cli/commands/gap-report.test.mjs +2 -2
- package/clients/cli/commands/init.doc.mjs +4 -4
- package/clients/cli/commands/init.flag-help.test.mjs +7 -10
- package/clients/cli/commands/init.next-steps.test.mjs +1 -1
- package/clients/cli/commands/option-pair-refusals.test.mjs +37 -0
- package/clients/cli/commands/search.test.mjs +1 -1
- package/clients/cli/commands/swizzle.mjs +4 -1
- package/clients/cli/commands/template.doc.mjs +3 -3
- package/clients/cli/commands/template.flag-help.test.mjs +18 -11
- package/clients/cli/commands/template.mjs +7 -1
- package/clients/cli/commands/text-json-parity.test.mjs +0 -17
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +142 -49
- package/clients/cli/commands/theme-add.doc.mjs +10 -17
- package/clients/cli/commands/theme-list.behavior.test.mjs +2 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +8 -6
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +2 -2
- package/clients/cli/commands/upgrade.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.flag-help.test.mjs +7 -11
- package/clients/cli/commands/validate-nothing-exits-nonzero.test.mjs +67 -0
- package/clients/cli/index.mjs +0 -4
- package/clients/cli/lib/cli-error.mjs +19 -0
- package/clients/cli/lib/component-format.mjs +111 -57
- package/clients/cli/lib/component-format.test.mjs +28 -39
- package/clients/cli/lib/doc-text-ascii.test.mjs +5 -2
- package/clients/cli/lib/exit-codes.test.mjs +0 -7
- package/clients/cli/lib/json-shim.test.mjs +0 -24
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +6 -1
- package/foundation/agent-docs/app-theme-workflow.test.mjs +3 -0
- package/foundation/config/theme-state.mjs +3 -3
- package/foundation/debug/debug-fields.test.mjs +13 -35
- package/foundation/debug/event.mjs +13 -78
- package/foundation/debug/privacy-contract.test.mjs +20 -12
- package/foundation/debug/redact.d.mts +2 -2
- package/foundation/debug/redact.mjs +2 -2
- package/foundation/discovery/theme-imports.mjs +1 -1
- package/foundation/discovery/theming-targets.d.mts +1 -20
- package/foundation/discovery/theming-targets.mjs +1 -38
- package/foundation/discovery/theming-targets.test.mjs +9 -175
- package/foundation/doc-compiler/doc-loads.test.mjs +0 -12
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +11 -30
- package/foundation/response/response-types.doc.test.mjs +36 -14
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/xle/browser.d.mts +2 -2
- package/foundation/xle/browser.mjs +2 -2
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/print.mjs +1 -1
- package/package.json +9 -9
- package/api/layout/_adapter.d.mts +0 -34
- package/api/layout/_adapter.mjs +0 -148
- package/api/layout/check/check.d.mts +0 -17
- package/api/layout/check/check.mjs +0 -41
- package/api/layout/expand/expand.d.mts +0 -23
- package/api/layout/expand/expand.mjs +0 -161
- package/api/layout/expand/expand.path-safety.test.mjs +0 -53
- package/api/layout/expand/expand.receipt.test.mjs +0 -74
- package/api/layout/grammar/grammar.d.mts +0 -14
- package/api/layout/grammar/grammar.mjs +0 -88
- package/api/layout/layout.d.mts +0 -6
- package/api/layout/layout.mjs +0 -17
- package/api/layout/layout.test.mjs +0 -297
- package/api/layout/layout.type.d.mts +0 -90
- package/api/layout/layout.type.mjs +0 -104
- package/api/layout/layoutCheck.doc.d.mts +0 -11
- package/api/layout/layoutCheck.doc.mjs +0 -85
- package/api/layout/layoutExpand.doc.d.mts +0 -11
- package/api/layout/layoutExpand.doc.mjs +0 -107
- package/api/layout/layoutGrammar.doc.d.mts +0 -11
- package/api/layout/layoutGrammar.doc.mjs +0 -57
- package/api/theme/add/add.binary.test.mjs +0 -157
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/add/add.staging.test.mjs +0 -83
- package/clients/cli/commands/layout-check.doc.mjs +0 -67
- package/clients/cli/commands/layout-expand.doc.mjs +0 -87
- package/clients/cli/commands/layout-grammar.doc.mjs +0 -32
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +0 -140
- package/clients/cli/commands/layout.doc.mjs +0 -36
- package/clients/cli/commands/layout.error-codes.test.mjs +0 -66
- package/clients/cli/commands/layout.exit-parity.test.mjs +0 -41
- package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
- package/clients/cli/commands/layout.mjs +0 -327
- package/clients/cli/commands/layout.path-help.test.mjs +0 -33
- package/clients/cli/commands/layout.stdin-cap.test.mjs +0 -47
- package/clients/cli/commands/layout.text-fields.test.mjs +0 -39
|
@@ -202,18 +202,6 @@ const RUNNERS = {
|
|
|
202
202
|
'import ./integration.doc.mjs',
|
|
203
203
|
],
|
|
204
204
|
},
|
|
205
|
-
'clients/cli/commands/layout.mjs': {
|
|
206
|
-
runs: SELF_DOCS,
|
|
207
|
-
sites: [
|
|
208
|
-
'import ../../../api/layout/layoutCheck.doc.mjs',
|
|
209
|
-
'import ../../../api/layout/layoutExpand.doc.mjs',
|
|
210
|
-
'import ../../../api/layout/layoutGrammar.doc.mjs',
|
|
211
|
-
'import ./layout-check.doc.mjs',
|
|
212
|
-
'import ./layout-expand.doc.mjs',
|
|
213
|
-
'import ./layout-grammar.doc.mjs',
|
|
214
|
-
'import ./layout.doc.mjs',
|
|
215
|
-
],
|
|
216
|
-
},
|
|
217
205
|
'clients/cli/commands/search.mjs': {
|
|
218
206
|
runs: SELF_DOCS,
|
|
219
207
|
sites: [
|
|
@@ -36,7 +36,7 @@ export const doc = {
|
|
|
36
36
|
{
|
|
37
37
|
value: 'ERR_INVALID_OPTION',
|
|
38
38
|
description:
|
|
39
|
-
'An unknown option was passed, --json was given to a command without JSON output
|
|
39
|
+
'An unknown option was passed, --json was given to a command without JSON output.',
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
value: 'ERR_INVALID_ARGUMENT',
|
|
@@ -30,7 +30,7 @@ export const doc = {
|
|
|
30
30
|
{
|
|
31
31
|
value: 'init.remove',
|
|
32
32
|
description:
|
|
33
|
-
'
|
|
33
|
+
'The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove.',
|
|
34
34
|
},
|
|
35
35
|
// component
|
|
36
36
|
{
|
|
@@ -50,11 +50,13 @@ export const doc = {
|
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
value: 'component.detail.props',
|
|
53
|
-
description:
|
|
53
|
+
description:
|
|
54
|
+
"Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component.",
|
|
54
55
|
},
|
|
55
56
|
{
|
|
56
57
|
value: 'component.detail.source',
|
|
57
|
-
description:
|
|
58
|
+
description:
|
|
59
|
+
"One component's source file, as {component, source}. The envelope's package names the npm package that owns the component.",
|
|
58
60
|
},
|
|
59
61
|
{
|
|
60
62
|
value: 'component.detail.showcase',
|
|
@@ -86,7 +88,7 @@ export const doc = {
|
|
|
86
88
|
{
|
|
87
89
|
value: 'docs.detail.section',
|
|
88
90
|
description:
|
|
89
|
-
|
|
91
|
+
"One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section.",
|
|
90
92
|
},
|
|
91
93
|
{
|
|
92
94
|
value: 'docs.node',
|
|
@@ -161,7 +163,7 @@ export const doc = {
|
|
|
161
163
|
{
|
|
162
164
|
value: 'swizzle.copy',
|
|
163
165
|
description:
|
|
164
|
-
|
|
166
|
+
"An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package.",
|
|
165
167
|
},
|
|
166
168
|
|
|
167
169
|
// gap reports
|
|
@@ -194,7 +196,7 @@ export const doc = {
|
|
|
194
196
|
{
|
|
195
197
|
value: 'template.copy',
|
|
196
198
|
description:
|
|
197
|
-
|
|
199
|
+
"A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing). The envelope's package names the npm package that owns the template.",
|
|
198
200
|
},
|
|
199
201
|
|
|
200
202
|
{
|
|
@@ -207,7 +209,7 @@ export const doc = {
|
|
|
207
209
|
{
|
|
208
210
|
value: 'hook.list',
|
|
209
211
|
description:
|
|
210
|
-
|
|
212
|
+
"The hook catalog grouped by category: `detail` (the level: names | compact | full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks.",
|
|
211
213
|
},
|
|
212
214
|
{
|
|
213
215
|
value: 'hook.detail',
|
|
@@ -241,11 +243,6 @@ export const doc = {
|
|
|
241
243
|
description:
|
|
242
244
|
'Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries.',
|
|
243
245
|
},
|
|
244
|
-
{
|
|
245
|
-
value: 'theme.add',
|
|
246
|
-
description:
|
|
247
|
-
'The released source-copy receipt: slug, displayName, maintained flag, owner package, outputDir, source entry, exportName, and files. Its additive meta.deprecations entry names DEP-0005 and the source-fork/import replacements.',
|
|
248
|
-
},
|
|
249
246
|
{
|
|
250
247
|
value: 'theme.app',
|
|
251
248
|
description:
|
|
@@ -264,7 +261,7 @@ export const doc = {
|
|
|
264
261
|
{
|
|
265
262
|
value: 'theme.targets',
|
|
266
263
|
description:
|
|
267
|
-
'The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states
|
|
264
|
+
'The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys.',
|
|
268
265
|
},
|
|
269
266
|
{
|
|
270
267
|
value: 'theme.palette.generate',
|
|
@@ -335,7 +332,7 @@ export const doc = {
|
|
|
335
332
|
{
|
|
336
333
|
value: 'integration.validate',
|
|
337
334
|
description:
|
|
338
|
-
'The validation result: validated (false when no
|
|
335
|
+
'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}.',
|
|
339
336
|
},
|
|
340
337
|
{
|
|
341
338
|
value: 'integration.template-conflicts',
|
|
@@ -353,21 +350,5 @@ export const doc = {
|
|
|
353
350
|
'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
|
|
354
351
|
},
|
|
355
352
|
|
|
356
|
-
// layout (XLE/XLO)
|
|
357
|
-
{
|
|
358
|
-
value: 'layout.expand',
|
|
359
|
-
description:
|
|
360
|
-
'The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, written (the output path, or null when nothing was written), and demoMediaReplaced (count of demo media placeholders). Carries `meta.deprecations` with DEP-0006 and its replacement commands.',
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
value: 'layout.check',
|
|
364
|
-
description:
|
|
365
|
-
'The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline). Carries `meta.deprecations` with DEP-0006 and its replacement commands.',
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
value: 'layout.grammar',
|
|
369
|
-
description:
|
|
370
|
-
"The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry. Carries `meta.deprecations` with DEP-0006 and its replacement commands.",
|
|
371
|
-
},
|
|
372
353
|
],
|
|
373
354
|
};
|
|
@@ -14,7 +14,8 @@ import {doc} from './response-types.doc.mjs';
|
|
|
14
14
|
import {runCli} from '../../test-utils/run-cli.mjs';
|
|
15
15
|
|
|
16
16
|
/** @param {string} type */
|
|
17
|
-
const describedAs =
|
|
17
|
+
const describedAs = type =>
|
|
18
|
+
doc.members.find(m => m.value === type)?.description ?? '';
|
|
18
19
|
|
|
19
20
|
/** @param {string} text @param {string} field */
|
|
20
21
|
const names = (text, field) => new RegExp(`(^|\\W)${field}(\\W|$)`).test(text);
|
|
@@ -27,7 +28,7 @@ const names = (text, field) => new RegExp(`(^|\\W)${field}(\\W|$)`).test(text);
|
|
|
27
28
|
function fieldsOf(value, depth = 2) {
|
|
28
29
|
const out = new Set();
|
|
29
30
|
const visit = (/** @type {unknown} */ v, /** @type {number} */ d) => {
|
|
30
|
-
if (Array.isArray(v)) return v.forEach(
|
|
31
|
+
if (Array.isArray(v)) return v.forEach(item => visit(item, d));
|
|
31
32
|
if (!v || typeof v !== 'object' || d < 0) return;
|
|
32
33
|
for (const [key, child] of Object.entries(v)) {
|
|
33
34
|
out.add(key);
|
|
@@ -40,7 +41,10 @@ function fieldsOf(value, depth = 2) {
|
|
|
40
41
|
|
|
41
42
|
/** @param {string[]} args @param {string} [cwd] */
|
|
42
43
|
async function data(args, cwd) {
|
|
43
|
-
const {status, stdout} = await runCli(
|
|
44
|
+
const {status, stdout} = await runCli(
|
|
45
|
+
['--json', ...args],
|
|
46
|
+
cwd ? {cwd} : undefined,
|
|
47
|
+
);
|
|
44
48
|
expect(status, stdout).toBe(0);
|
|
45
49
|
return JSON.parse(stdout);
|
|
46
50
|
}
|
|
@@ -48,7 +52,7 @@ async function data(args, cwd) {
|
|
|
48
52
|
/** @param {string} type @param {Iterable<string>} fields */
|
|
49
53
|
function expectNamed(type, fields) {
|
|
50
54
|
const text = describedAs(type);
|
|
51
|
-
const missing = [...fields].filter(
|
|
55
|
+
const missing = [...fields].filter(f => !names(text, f));
|
|
52
56
|
expect(missing, `${type} omits`).toEqual([]);
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -99,8 +103,13 @@ describe('response-types EnumDoc names every field', () => {
|
|
|
99
103
|
it('search, across component, hook, template, and doc results', async () => {
|
|
100
104
|
const mixed = await data(['search', 'dashboard', '--limit', '50']);
|
|
101
105
|
const docsOnly = await data(['search', 'tokens', '--type', 'doc']);
|
|
102
|
-
expect(new Set(mixed.data.results.map(
|
|
103
|
-
|
|
106
|
+
expect(new Set(mixed.data.results.map(r => r.domain))).toContain(
|
|
107
|
+
'template',
|
|
108
|
+
);
|
|
109
|
+
expectNamed(
|
|
110
|
+
'search',
|
|
111
|
+
new Set([...fieldsOf(mixed.data), ...fieldsOf(docsOnly.data)]),
|
|
112
|
+
);
|
|
104
113
|
});
|
|
105
114
|
|
|
106
115
|
it('build.kit, including the hint a thin kit carries', async () => {
|
|
@@ -112,25 +121,38 @@ describe('response-types EnumDoc names every field', () => {
|
|
|
112
121
|
expectNamed('build.kit', fields);
|
|
113
122
|
});
|
|
114
123
|
|
|
115
|
-
it('theme.targets
|
|
124
|
+
it('theme.targets', async () => {
|
|
116
125
|
const res = await data(['theme', 'targets']);
|
|
117
|
-
|
|
118
|
-
expect(fields).toContain('deprecatedFor');
|
|
119
|
-
expectNamed('theme.targets', fields);
|
|
126
|
+
expectNamed('theme.targets', fieldsOf(res.data));
|
|
120
127
|
});
|
|
121
128
|
|
|
122
129
|
it('gap-report.file, including each delivery', async () => {
|
|
123
|
-
const res = await data([
|
|
130
|
+
const res = await data([
|
|
131
|
+
'gap-report',
|
|
132
|
+
'Button',
|
|
133
|
+
'--category',
|
|
134
|
+
'docs_gap',
|
|
135
|
+
'--reason',
|
|
136
|
+
'probe',
|
|
137
|
+
]);
|
|
124
138
|
expect(res.type).toBe('gap-report.file');
|
|
125
139
|
expect(res.data.deliveries.length).toBeGreaterThan(0);
|
|
126
140
|
expectNamed('gap-report.file', fieldsOf(res.data));
|
|
127
141
|
});
|
|
128
142
|
|
|
129
143
|
it('theme.build, including notices', async () => {
|
|
130
|
-
const cwd = fs.mkdtempSync(
|
|
131
|
-
|
|
144
|
+
const cwd = fs.mkdtempSync(
|
|
145
|
+
path.join(os.tmpdir(), 'astryx-response-types-'),
|
|
146
|
+
);
|
|
147
|
+
fs.writeFileSync(
|
|
148
|
+
path.join(cwd, 'package.json'),
|
|
149
|
+
'{"name":"app","version":"1.0.0"}',
|
|
150
|
+
);
|
|
132
151
|
await data(['theme', 'template', 'starter.ts'], cwd);
|
|
133
|
-
const res = await data(
|
|
152
|
+
const res = await data(
|
|
153
|
+
['theme', 'build', 'starter.ts', '--out', 'starter.css'],
|
|
154
|
+
cwd,
|
|
155
|
+
);
|
|
134
156
|
expect(res.type).toBe('theme.build');
|
|
135
157
|
expectNamed('theme.build', fieldsOf(res.data));
|
|
136
158
|
});
|
|
@@ -166,7 +166,7 @@ export const doc = {
|
|
|
166
166
|
text:
|
|
167
167
|
'The process exit code is part of the contract too. Exit 0 means success, ' +
|
|
168
168
|
'and every error envelope exits 1. Some commands also exit 1 with a success ' +
|
|
169
|
-
'envelope when what they report failed: a failed check (
|
|
169
|
+
'envelope when what they report failed: a failed check (doctor ' +
|
|
170
170
|
'and its integration subcommands, integration verify, theme build ' +
|
|
171
171
|
'--check), a gap report that was not delivered, an upgrade left incomplete, ' +
|
|
172
172
|
'or init agent docs refused for a path outside the project. Read the ' +
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Validate an expression and return both canonical surfaces — the browser
|
|
6
|
-
* twin of
|
|
6
|
+
* browser twin of the XLE validator. Never throws on invalid input; returns the errors.
|
|
7
7
|
*
|
|
8
8
|
* @param {string} expression
|
|
9
9
|
* @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
|
|
@@ -19,7 +19,7 @@ export function checkExpression(expression: string, registry: import("./xle-ast"
|
|
|
19
19
|
loose?: boolean | undefined;
|
|
20
20
|
}): import("./browser").CheckResult;
|
|
21
21
|
/**
|
|
22
|
-
* Validate + expand to TSX — the browser twin of
|
|
22
|
+
* Validate + expand to TSX — the browser twin of the XLE expander.
|
|
23
23
|
* Returns either {code, ...} or {errors} (never writes files).
|
|
24
24
|
*
|
|
25
25
|
* @param {string} expression
|
|
@@ -45,7 +45,7 @@ function formatIssue(issue) {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Validate an expression and return both canonical surfaces — the browser
|
|
48
|
-
* twin of
|
|
48
|
+
* browser twin of the XLE validator. Never throws on invalid input; returns the errors.
|
|
49
49
|
*
|
|
50
50
|
* @param {string} expression
|
|
51
51
|
* @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
|
|
@@ -85,7 +85,7 @@ export function checkExpression(expression, registry, opts = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Validate + expand to TSX — the browser twin of
|
|
88
|
+
* Validate + expand to TSX — the browser twin of the XLE expander.
|
|
89
89
|
* Returns either {code, ...} or {errors} (never writes files).
|
|
90
90
|
*
|
|
91
91
|
* @param {string} expression
|
|
@@ -751,7 +751,7 @@ export function expand(doc, registry, options = {}) {
|
|
|
751
751
|
: [];
|
|
752
752
|
|
|
753
753
|
const code = [
|
|
754
|
-
`// Generated by
|
|
754
|
+
`// Generated by the Astryx XLE expander — this file is the artifact; edit freely.`,
|
|
755
755
|
...importLines,
|
|
756
756
|
...blockSection,
|
|
757
757
|
'',
|
package/foundation/xle/print.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file XLE canonical printers — AST → compact (XLE) or outline (XLO) text.
|
|
5
5
|
*
|
|
6
|
-
* Used by
|
|
6
|
+
* Used by the XLE validator so either party (agent or human)
|
|
7
7
|
* can request the other surface, and by round-trip conformance tests.
|
|
8
8
|
* Printing is best-effort canonical: spelling variants the lexer
|
|
9
9
|
* normalized are emitted in canonical form.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.0-canary.
|
|
3
|
+
"version": "0.7.0-canary.4ec1f4e",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"zod": "^4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@astryxdesign/charts": "0.7.0-canary.
|
|
105
|
-
"@astryxdesign/core": "0.7.0-canary.
|
|
106
|
-
"@astryxdesign/lab": "0.7.0-canary.
|
|
107
|
-
"@astryxdesign/theme-neutral": "0.7.0-canary.
|
|
104
|
+
"@astryxdesign/charts": "0.7.0-canary.4ec1f4e",
|
|
105
|
+
"@astryxdesign/core": "0.7.0-canary.4ec1f4e",
|
|
106
|
+
"@astryxdesign/lab": "0.7.0-canary.4ec1f4e",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.7.0-canary.4ec1f4e"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "0.7.0-canary.
|
|
125
|
-
"@astryxdesign/core": "0.7.0-canary.
|
|
126
|
-
"@astryxdesign/lab": "0.7.0-canary.
|
|
127
|
-
"@astryxdesign/theme-neutral": "0.7.0-canary.
|
|
124
|
+
"@astryxdesign/charts": "0.7.0-canary.4ec1f4e",
|
|
125
|
+
"@astryxdesign/core": "0.7.0-canary.4ec1f4e",
|
|
126
|
+
"@astryxdesign/lab": "0.7.0-canary.4ec1f4e",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.7.0-canary.4ec1f4e",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/** @param {import('../../foundation/xle/xle-ast').RawIssue} issue */
|
|
5
|
-
export function formatIssue(issue: import("../../foundation/xle/xle-ast").RawIssue): string;
|
|
6
|
-
/**
|
|
7
|
-
* Parse + validate, throwing structured XDSErrors on failure.
|
|
8
|
-
* Returns {doc, registry, blocks, warnings}.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} expression
|
|
11
|
-
* @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
|
|
12
|
-
*/
|
|
13
|
-
export function analyze(expression: string, { form, loose, cwd }?: {
|
|
14
|
-
form?: "compact" | "outline" | "auto";
|
|
15
|
-
loose?: boolean;
|
|
16
|
-
cwd?: string;
|
|
17
|
-
}): Promise<{
|
|
18
|
-
doc: import("../../foundation/xle/xle-ast").XLEDoc;
|
|
19
|
-
registry: import("../../foundation/xle/xle-ast").Registry;
|
|
20
|
-
blocks: LayoutBlock[];
|
|
21
|
-
errors: import("../../foundation/xle/xle-ast").RawIssue[];
|
|
22
|
-
warnings: import("../../foundation/xle/xle-ast").RawIssue[];
|
|
23
|
-
}>;
|
|
24
|
-
export type LayoutBlock = {
|
|
25
|
-
dirName: string;
|
|
26
|
-
name: string;
|
|
27
|
-
kind: "template" | "component";
|
|
28
|
-
type?: string | undefined;
|
|
29
|
-
description?: string | undefined;
|
|
30
|
-
category?: string | undefined;
|
|
31
|
-
importPath?: string | undefined;
|
|
32
|
-
filePath?: string | undefined;
|
|
33
|
-
isDefault?: boolean | undefined;
|
|
34
|
-
};
|
package/api/layout/_adapter.mjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Shared analysis layer for the `layout` command's expand/check leaves.
|
|
5
|
-
*
|
|
6
|
-
* Loads the block catalog (template blocks + app-registered components), builds
|
|
7
|
-
* the branch registry, and parses+validates a layout expression into a doc +
|
|
8
|
-
* issues. Both the expand and check leaves sit on `analyze`; neither parses or
|
|
9
|
-
* validates directly. (The grammar leaf needs none of this — it only reads the
|
|
10
|
-
* registry alias table.)
|
|
11
|
-
*
|
|
12
|
-
* @input expression string (+ options)
|
|
13
|
-
* @output analyze() -> {doc, registry, blocks, errors, warnings}; formatIssue()
|
|
14
|
-
* @position api — shared core over lib/xle; leaves in expand/ + check/ project it
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import {AstryxError} from '../error.mjs';
|
|
18
|
-
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
19
|
-
import {parse, XLEParseError} from '../../foundation/xle/parse.mjs';
|
|
20
|
-
import {validate} from '../../foundation/xle/validate.mjs';
|
|
21
|
-
import {buildRegistry} from '../../foundation/xle/registry.mjs';
|
|
22
|
-
import {discoverTemplates} from '../template/template.mjs';
|
|
23
|
-
import {Project} from '../../foundation/config/project.mjs';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @typedef {object} LayoutBlock
|
|
27
|
-
* @property {string} dirName
|
|
28
|
-
* @property {string} name
|
|
29
|
-
* @property {'template'|'component'} kind
|
|
30
|
-
* @property {string} [type]
|
|
31
|
-
* @property {string} [description]
|
|
32
|
-
* @property {string} [category]
|
|
33
|
-
* @property {string} [importPath]
|
|
34
|
-
* @property {string} [filePath]
|
|
35
|
-
* @property {boolean} [isDefault]
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The catalog a `{hint}` can resolve to: template blocks (spliced inline) plus
|
|
40
|
-
* any app-registered local components from astryx.config.mjs
|
|
41
|
-
* `experimental.xle.components` (imported by name). App components are how XLE
|
|
42
|
-
* reaches domain pieces — the KpiCard/chart/drawer set that the
|
|
43
|
-
* @astryxdesign/core registry can't see.
|
|
44
|
-
*
|
|
45
|
-
* @param {string} cwd
|
|
46
|
-
* @returns {Promise<LayoutBlock[]>}
|
|
47
|
-
*/
|
|
48
|
-
async function loadBlocks(cwd) {
|
|
49
|
-
/** @type {LayoutBlock[]} */
|
|
50
|
-
const blocks = [];
|
|
51
|
-
try {
|
|
52
|
-
const all = await discoverTemplates(cwd);
|
|
53
|
-
const templates = all.filter(template => template.type === 'block');
|
|
54
|
-
/** @type {Map<string, import('../../foundation/discovery/template-adapter.mjs').DiscoveredTemplate>} */
|
|
55
|
-
const byId = new Map();
|
|
56
|
-
// Exact ids are the fallback. Active replacement aliases override them in a
|
|
57
|
-
// second pass, matching template() regardless of discovery/display order.
|
|
58
|
-
for (const template of templates) byId.set(template.dirName, template);
|
|
59
|
-
for (const template of templates) {
|
|
60
|
-
if (template.replaces != null) byId.set(template.replaces, template);
|
|
61
|
-
}
|
|
62
|
-
for (const [id, template] of byId) {
|
|
63
|
-
blocks.push({...template, dirName: id, kind: 'template'});
|
|
64
|
-
}
|
|
65
|
-
} catch {
|
|
66
|
-
// discovery is best-effort
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const project = await Project.load(cwd);
|
|
70
|
-
/** @type {Record<string, {from?: string, description?: string, default?: boolean}>} */
|
|
71
|
-
const components = project.config.experimental?.xle?.components ?? {};
|
|
72
|
-
for (const [name, spec] of Object.entries(components)) {
|
|
73
|
-
const importPath = spec.from;
|
|
74
|
-
if (!importPath) continue;
|
|
75
|
-
blocks.push({
|
|
76
|
-
type: 'block',
|
|
77
|
-
kind: 'component',
|
|
78
|
-
dirName: name,
|
|
79
|
-
name,
|
|
80
|
-
description: spec.description ?? '',
|
|
81
|
-
category: 'app',
|
|
82
|
-
importPath,
|
|
83
|
-
isDefault: Boolean(spec.default),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
} catch {
|
|
87
|
-
// config is optional
|
|
88
|
-
}
|
|
89
|
-
return blocks;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** @param {import('../../foundation/xle/xle-ast').RawIssue} issue */
|
|
93
|
-
export function formatIssue(issue) {
|
|
94
|
-
const where = issue.line != null ? `line ${issue.line}: ` : '';
|
|
95
|
-
return `${where}${issue.message}`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Parse + validate, throwing structured XDSErrors on failure.
|
|
100
|
-
* Returns {doc, registry, blocks, warnings}.
|
|
101
|
-
*
|
|
102
|
-
* @param {string} expression
|
|
103
|
-
* @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
|
|
104
|
-
*/
|
|
105
|
-
export async function analyze(
|
|
106
|
-
expression,
|
|
107
|
-
{form = 'auto', loose = false, cwd = process.cwd()} = {},
|
|
108
|
-
) {
|
|
109
|
-
// Validate inputs in the API (not just the CLI): an empty expression or an
|
|
110
|
-
// unknown --form must error, not silently parse as an empty/compact layout.
|
|
111
|
-
if (typeof expression !== 'string' || expression.trim() === '') {
|
|
112
|
-
throw new AstryxError(
|
|
113
|
-
'Layout expression is empty.',
|
|
114
|
-
undefined,
|
|
115
|
-
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
if (form !== 'compact' && form !== 'outline' && form !== 'auto') {
|
|
119
|
-
throw new AstryxError(
|
|
120
|
-
`Invalid form "${form}". Must be one of: compact, outline, auto.`,
|
|
121
|
-
undefined,
|
|
122
|
-
ERROR_CODES.ERR_INVALID_OPTION,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
const registry =
|
|
126
|
-
/** @type {import('../../foundation/xle/xle-ast').Registry} */ (
|
|
127
|
-
/** @type {unknown} */ (await buildRegistry({cwd}))
|
|
128
|
-
);
|
|
129
|
-
const blocks = await loadBlocks(cwd);
|
|
130
|
-
|
|
131
|
-
/** @type {import('../../foundation/xle/xle-ast').XLEDoc} */
|
|
132
|
-
let doc;
|
|
133
|
-
try {
|
|
134
|
-
doc = parse(expression, {form});
|
|
135
|
-
} catch (e) {
|
|
136
|
-
if (e instanceof XLEParseError) {
|
|
137
|
-
throw new AstryxError(
|
|
138
|
-
`Layout expression syntax error at line ${e.line}, col ${e.col}: ${e.message}`,
|
|
139
|
-
undefined,
|
|
140
|
-
ERROR_CODES.ERR_LAYOUT_PARSE,
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
throw e;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const {errors, warnings} = validate(doc, registry, blocks, {loose});
|
|
147
|
-
return {doc, registry, blocks, errors, warnings};
|
|
148
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
6
|
-
* `astryx layout check "<expr>" [--form compact|outline]`
|
|
7
|
-
* Validates without expanding; echoes both canonical surfaces.
|
|
8
|
-
*
|
|
9
|
-
* @param {string} expression
|
|
10
|
-
* @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
|
|
11
|
-
* @returns {Promise<import('../layout.type.mjs').LayoutCheckResponse>}
|
|
12
|
-
*/
|
|
13
|
-
export function layoutCheck(expression: string, options?: {
|
|
14
|
-
form?: "compact" | "outline" | "auto";
|
|
15
|
-
loose?: boolean;
|
|
16
|
-
cwd?: string;
|
|
17
|
-
}): Promise<import("../layout.type.mjs").LayoutCheckResponse>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file `astryx layout check` leaf — validate a layout expression without
|
|
5
|
-
* expanding, echoing both canonical surfaces (compact + outline). Resolution +
|
|
6
|
-
* validation come from ../_adapter.mjs (analyze); this leaf projects the
|
|
7
|
-
* `layout.check` envelope.
|
|
8
|
-
*
|
|
9
|
-
* @input expression string (+ options)
|
|
10
|
-
* @output {type:'layout.check', data}
|
|
11
|
-
* @position api — leaf over ../_adapter.mjs + lib/xle/print
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import {toCompact, toOutline} from '../../../foundation/xle/print.mjs';
|
|
15
|
-
import {analyze, formatIssue} from '../_adapter.mjs';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
19
|
-
* `astryx layout check "<expr>" [--form compact|outline]`
|
|
20
|
-
* Validates without expanding; echoes both canonical surfaces.
|
|
21
|
-
*
|
|
22
|
-
* @param {string} expression
|
|
23
|
-
* @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
|
|
24
|
-
* @returns {Promise<import('../layout.type.mjs').LayoutCheckResponse>}
|
|
25
|
-
*/
|
|
26
|
-
export async function layoutCheck(expression, options = {}) {
|
|
27
|
-
const {form = 'auto', loose = false, cwd = process.cwd()} = options;
|
|
28
|
-
const {doc, errors, warnings} = await analyze(expression, {form, loose, cwd});
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
type: 'layout.check',
|
|
32
|
-
data: {
|
|
33
|
-
valid: errors.length === 0,
|
|
34
|
-
form: doc.form,
|
|
35
|
-
errors: errors.map(e => ({...e, formatted: formatIssue(e)})),
|
|
36
|
-
warnings: warnings.map(formatIssue),
|
|
37
|
-
compact: toCompact(doc),
|
|
38
|
-
outline: toOutline(doc),
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated DEP-0006: Use `build`, `template`, and `docs layout` instead. Removal in CLN-0006.
|
|
6
|
-
* `astryx layout expand "<expr>" [path]`
|
|
7
|
-
*
|
|
8
|
-
* @param {string} expression
|
|
9
|
-
* @param {object} [options]
|
|
10
|
-
* @param {string} [options.targetPath] - write TSX here (validated against cwd)
|
|
11
|
-
* @param {'compact'|'outline'|'auto'} [options.form]
|
|
12
|
-
* @param {boolean} [options.loose] - downgrade unknown {hints} to TODO warnings
|
|
13
|
-
* @param {string} [options.name] - generated component name
|
|
14
|
-
* @param {string} [options.cwd]
|
|
15
|
-
* @returns {Promise<import('../layout.type.mjs').LayoutExpandResponse>}
|
|
16
|
-
*/
|
|
17
|
-
export function layoutExpand(expression: string, options?: {
|
|
18
|
-
targetPath?: string | undefined;
|
|
19
|
-
form?: "compact" | "auto" | "outline" | undefined;
|
|
20
|
-
loose?: boolean | undefined;
|
|
21
|
-
name?: string | undefined;
|
|
22
|
-
cwd?: string | undefined;
|
|
23
|
-
}): Promise<import("../layout.type.mjs").LayoutExpandResponse>;
|