@astryxdesign/cli 0.6.4-canary.f0355e3 → 0.6.5
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/CHANGELOG.md +56 -0
- package/README.md +10 -6
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/json/index.ts +1 -0
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.mjs +1 -1
- package/api/upgrade/run/run.mjs +1 -1
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/type.ts +2 -2
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/text-json-parity.test.mjs +17 -0
- package/clients/cli/index.mjs +4 -0
- package/clients/cli/lib/exit-codes.test.mjs +8 -1
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +8 -0
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +12 -0
- package/foundation/response/response-types.doc.mjs +17 -0
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
|
@@ -102,6 +102,9 @@ export const RESPONSE_TYPES = {
|
|
|
102
102
|
'doctor integration templates': ['integration.template-conflicts'],
|
|
103
103
|
'doctor integration components': ['integration.component-conflicts'],
|
|
104
104
|
'doctor integration docs': ['integration.doc-conflicts'],
|
|
105
|
+
'layout expand': ['layout.expand'],
|
|
106
|
+
'layout check': ['layout.check'],
|
|
107
|
+
'layout grammar': ['layout.grammar'],
|
|
105
108
|
};
|
|
106
109
|
|
|
107
110
|
/**
|
|
@@ -190,6 +193,11 @@ const EXAMPLES = {
|
|
|
190
193
|
'astryx doctor integration docs @acme/widgets --json',
|
|
191
194
|
],
|
|
192
195
|
init: ['astryx init', 'astryx init --all --json'],
|
|
196
|
+
'layout expand': [
|
|
197
|
+
`astryx layout expand 'V[g6] > C{card-callout}*4' ./src/Page.tsx`,
|
|
198
|
+
],
|
|
199
|
+
'layout check': [`astryx layout check 'A[cp6] > L > LC > S[p6]' --json`],
|
|
200
|
+
'layout grammar': ['astryx layout grammar'],
|
|
193
201
|
};
|
|
194
202
|
|
|
195
203
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @file Shared template discovery + IO.
|
|
5
5
|
*
|
|
6
6
|
* Owns everything the template leaves (list/show/skeleton/copy) AND other
|
|
7
|
-
* commands (component, search, init, discover, Doctor integration)
|
|
7
|
+
* commands (component, layout, search, init, discover, Doctor integration)
|
|
8
8
|
* share: template discovery across core/external/integration sources, the
|
|
9
9
|
* template-spec loaders, and the cross-command helpers (stripTemplateAssetRefs,
|
|
10
10
|
* findShowcase, findRelatedBlocks, extractComponents, listTemplates). The
|
|
@@ -192,6 +192,18 @@ const RUNNERS = {
|
|
|
192
192
|
'import ./integration.doc.mjs',
|
|
193
193
|
],
|
|
194
194
|
},
|
|
195
|
+
'clients/cli/commands/layout.mjs': {
|
|
196
|
+
runs: SELF_DOCS,
|
|
197
|
+
sites: [
|
|
198
|
+
'import ../../../api/layout/layoutCheck.doc.mjs',
|
|
199
|
+
'import ../../../api/layout/layoutExpand.doc.mjs',
|
|
200
|
+
'import ../../../api/layout/layoutGrammar.doc.mjs',
|
|
201
|
+
'import ./layout-check.doc.mjs',
|
|
202
|
+
'import ./layout-expand.doc.mjs',
|
|
203
|
+
'import ./layout-grammar.doc.mjs',
|
|
204
|
+
'import ./layout.doc.mjs',
|
|
205
|
+
],
|
|
206
|
+
},
|
|
195
207
|
'clients/cli/commands/search.mjs': {
|
|
196
208
|
runs: SELF_DOCS,
|
|
197
209
|
sites: [
|
|
@@ -337,5 +337,22 @@ export const doc = {
|
|
|
337
337
|
description:
|
|
338
338
|
'The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
|
|
339
339
|
},
|
|
340
|
+
|
|
341
|
+
// layout (XLE/XLO)
|
|
342
|
+
{
|
|
343
|
+
value: 'layout.expand',
|
|
344
|
+
description:
|
|
345
|
+
'The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written).',
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
value: 'layout.check',
|
|
349
|
+
description:
|
|
350
|
+
'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).',
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
value: 'layout.grammar',
|
|
354
|
+
description:
|
|
355
|
+
"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.",
|
|
356
|
+
},
|
|
340
357
|
],
|
|
341
358
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Validate an expression and return both canonical surfaces
|
|
6
|
-
* invalid input; returns the errors.
|
|
5
|
+
* Validate an expression and return both canonical surfaces — the browser
|
|
6
|
+
* twin of `layout check`. 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
|
|
22
|
+
* Validate + expand to TSX — the browser twin of `layout expand`.
|
|
23
23
|
* Returns either {code, ...} or {errors} (never writes files).
|
|
24
24
|
*
|
|
25
25
|
* @param {string} expression
|
|
@@ -44,8 +44,8 @@ function formatIssue(issue) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Validate an expression and return both canonical surfaces
|
|
48
|
-
* invalid input; returns the errors.
|
|
47
|
+
* Validate an expression and return both canonical surfaces — the browser
|
|
48
|
+
* twin of `layout check`. 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
|
|
88
|
+
* Validate + expand to TSX — the browser twin of `layout expand`.
|
|
89
89
|
* Returns either {code, ...} or {errors} (never writes files).
|
|
90
90
|
*
|
|
91
91
|
* @param {string} expression
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @input validated doc (nodes carry .bound) + registry
|
|
15
15
|
* @output expand() → {code, componentsUsed, states, todos}
|
|
16
|
-
* @position lib/xle — last stage;
|
|
16
|
+
* @position lib/xle — last stage; api/layout.mjs orchestrates
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import {PAYLOAD_PROPS} from './validate.mjs';
|
|
@@ -751,7 +751,7 @@ export function expand(doc, registry, options = {}) {
|
|
|
751
751
|
: [];
|
|
752
752
|
|
|
753
753
|
const code = [
|
|
754
|
-
`// Generated by
|
|
754
|
+
`// Generated by \`astryx layout expand\` — this file is the artifact; edit freely.`,
|
|
755
755
|
...importLines,
|
|
756
756
|
...blockSection,
|
|
757
757
|
'',
|
package/foundation/xle/parse.mjs
CHANGED
|
@@ -302,7 +302,7 @@ function parseAttrToken(token, line) {
|
|
|
302
302
|
* Guard against unbounded recursion in the compact parser. A layout tree this
|
|
303
303
|
* deep is never hand-authored; without the cap the recursive descent blows the
|
|
304
304
|
* JS call stack and surfaces a raw RangeError (→ ERR_UNKNOWN, no line/col)
|
|
305
|
-
* instead of a located
|
|
305
|
+
* instead of a located ERR_LAYOUT_PARSE. The counter is module-level so it
|
|
306
306
|
* spans group / attribute sub-streams; each parse entry point resets it.
|
|
307
307
|
*/
|
|
308
308
|
const MAX_COMPACT_DEPTH = 512;
|
package/foundation/xle/print.mjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file XLE canonical printers — AST → compact (XLE) or outline (XLO) text.
|
|
5
5
|
*
|
|
6
|
-
* Used by `
|
|
7
|
-
* other surface, and by round-trip conformance tests.
|
|
6
|
+
* Used by `astryx layout check --form …` so either party (agent or human)
|
|
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.
|
|
10
10
|
*
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* @input block TSX source (splice) or a name+importPath (import)
|
|
20
20
|
* @output prepareSpliceModule / parseImportStatements + import-merge helpers
|
|
21
|
-
* @position lib/xle — used by expand.mjs; sources gathered
|
|
21
|
+
* @position lib/xle — used by expand.mjs; sources gathered in api/layout.mjs
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
const IMPORT_RE =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
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": "
|
|
105
|
-
"@astryxdesign/core": "
|
|
106
|
-
"@astryxdesign/lab": "
|
|
107
|
-
"@astryxdesign/theme-neutral": "
|
|
104
|
+
"@astryxdesign/charts": "*",
|
|
105
|
+
"@astryxdesign/core": "*",
|
|
106
|
+
"@astryxdesign/lab": "*",
|
|
107
|
+
"@astryxdesign/theme-neutral": "*"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "
|
|
125
|
-
"@astryxdesign/core": "
|
|
126
|
-
"@astryxdesign/lab": "
|
|
127
|
-
"@astryxdesign/theme-neutral": "
|
|
124
|
+
"@astryxdesign/charts": "*",
|
|
125
|
+
"@astryxdesign/core": "*",
|
|
126
|
+
"@astryxdesign/lab": "*",
|
|
127
|
+
"@astryxdesign/theme-neutral": "*",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|