@astryxdesign/cli 0.7.14 → 0.7.15-canary.g061b2fa
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 +63 -63
- package/api/build/_adapter.d.mts +4 -0
- package/api/build/_adapter.mjs +28 -2
- package/api/build/blocks/blocks.d.mts +10 -1
- package/api/build/blocks/blocks.mjs +84 -7
- package/api/build/build.mjs +6 -1
- package/api/build/tree.d.mts +4 -0
- package/api/build/tree.mjs +9 -2
- package/api/doctor/_adapter.d.mts +3 -1
- package/api/doctor/_adapter.mjs +14 -1
- package/api/doctor/_authoring-audit.d.mts +42 -0
- package/api/doctor/_authoring-audit.mjs +106 -0
- package/api/doctor/doctor.d.mts +7 -0
- package/api/doctor/doctor.mjs +24 -39
- package/api/doctor/theme-checks.mjs +56 -21
- package/api/integration/validate-integration.mjs +17 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_adapter.mjs +124 -3
- package/api/search/_candidate-score.mjs +63 -9
- package/api/search/_entries.d.mts +10 -0
- package/api/search/_entries.mjs +68 -1
- package/api/search/_gather-templates.d.mts +11 -0
- package/api/search/_gather-templates.mjs +22 -2
- package/api/search/_words.mjs +26 -6
- package/api/swizzle/copy/copy.mjs +1 -1
- package/api/theme/_adapter.d.mts +17 -1
- package/api/theme/_adapter.mjs +185 -40
- package/api/theme/build/build.d.mts +29 -1
- package/api/theme/build/build.mjs +426 -65
- package/api/theme/eject/eject.mjs +10 -6
- package/api/theme/targets/targets.d.mts +8 -0
- package/api/theme/targets/targets.mjs +24 -4
- package/api/theme/template/template.mjs +48 -2
- package/api/theme/theme.type.d.mts +8 -0
- package/api/theme/theme.type.mjs +5 -1
- package/api/theme/themeBuild.doc.mjs +7 -4
- package/api/theme/themeEject.doc.mjs +3 -3
- package/api/theme/themeRemove.doc.mjs +5 -2
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +2 -2
- package/api/theme/themeUse.doc.mjs +8 -2
- package/api/theme-edit/_adapter.d.mts +46 -3
- package/api/theme-edit/_adapter.mjs +372 -109
- package/api/theme-edit/_check.d.mts +6 -3
- package/api/theme-edit/_check.mjs +665 -87
- package/api/theme-edit/_color.mjs +4 -2
- package/api/theme-edit/_compiler.d.mts +2 -1
- package/api/theme-edit/_compiler.mjs +27 -13
- package/api/theme-edit/_context.d.mts +2 -1
- package/api/theme-edit/_context.mjs +47 -8
- package/api/theme-edit/_edit.d.mts +9 -3
- package/api/theme-edit/_edit.mjs +484 -66
- package/api/theme-edit/_how-commands.d.mts +33 -7
- package/api/theme-edit/_how-commands.mjs +57 -45
- package/api/theme-edit/_how-question.d.mts +4 -0
- package/api/theme-edit/_how-question.mjs +1004 -223
- package/api/theme-edit/_how.mjs +96 -9
- package/api/theme-edit/_palette.d.mts +38 -13
- package/api/theme-edit/_palette.mjs +620 -223
- package/api/theme-edit/_parts.mjs +63 -7
- package/api/theme-edit/_png.d.mts +4 -4
- package/api/theme-edit/_png.mjs +4 -2
- package/api/theme-edit/_preview-app.d.mts +6 -0
- package/api/theme-edit/_preview-app.mjs +1194 -207
- package/api/theme-edit/_preview.mjs +2 -2
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +37 -6
- package/api/theme-edit/_settings.d.mts +104 -33
- package/api/theme-edit/_settings.mjs +818 -118
- package/api/theme-edit/_tables.d.mts +7 -0
- package/api/theme-edit/_tables.mjs +61 -0
- package/api/theme-edit/theme-edit.type.d.mts +11 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -3
- package/api/theme-edit/themeEditHow.doc.mjs +6 -0
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewList.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
- package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
- package/api/upgrade/_adapter.d.mts +1 -0
- package/assets/codemods/run-codemod.mjs +61 -0
- package/assets/codemods/runner.mjs +5 -4
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
- package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
- package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
- package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
- package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
- package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
- package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
- package/assets/docs/tree/calendars.doc.mjs +1 -3
- package/assets/docs/tree/checks.doc.mjs +22 -1
- package/assets/docs.generated.json +2 -1
- package/assets/self-audit.generated.json +1 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
- package/assets/templates/components.generated.json +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +8 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +9 -0
- package/clients/cli/bin/astryx.mjs +19 -15
- package/clients/cli/build-id.generated.json +1 -0
- package/clients/cli/commands/ensure-core-built.mjs +12 -5
- package/clients/cli/commands/experimental/theme.mjs +178 -78
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
- package/clients/cli/commands/manifest.mjs +5 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +374 -42
- package/clients/cli/index.mjs +9 -3
- package/clients/cli/lib/manifest.mjs +37 -0
- package/clients/cli/lib/resolve-theme.mjs +2 -1
- package/clients/cli/manifest.generated.json +1 -0
- package/foundation/config/theme-state.d.mts +16 -0
- package/foundation/config/theme-state.mjs +84 -13
- package/foundation/discovery/module-exports.mjs +16 -2
- package/foundation/discovery/stored-self-audit.d.mts +31 -0
- package/foundation/discovery/stored-self-audit.mjs +119 -0
- package/foundation/discovery/template-adapter.d.mts +48 -2
- package/foundation/discovery/template-adapter.mjs +51 -19
- package/foundation/discovery/template-needs.d.mts +19 -0
- package/foundation/discovery/template-needs.mjs +50 -16
- package/foundation/discovery/template-source-tree.d.mts +7 -0
- package/foundation/discovery/template-source-tree.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +2 -1
- package/foundation/discovery/theme-discovery.mjs +2 -8
- package/foundation/discovery/theme-module-extensions.d.mts +18 -0
- package/foundation/discovery/theme-module-extensions.mjs +30 -0
- package/foundation/doc-compiler/import.mjs +22 -15
- package/foundation/doc-compiler/stored-docs.d.mts +18 -12
- package/foundation/doc-compiler/stored-docs.mjs +52 -19
- package/foundation/env/private-dir.d.mts +17 -0
- package/foundation/env/private-dir.mjs +42 -0
- package/foundation/fs/gather-cache.d.mts +108 -0
- package/foundation/fs/gather-cache.mjs +741 -0
- package/foundation/fs/jiti-cache.d.mts +21 -0
- package/foundation/fs/jiti-cache.mjs +66 -0
- package/foundation/fs/module-loader.mjs +14 -3
- package/foundation/fs/read-record.d.mts +31 -1
- package/foundation/fs/read-record.mjs +100 -7
- package/foundation/integrations/integrations.d.mts +8 -0
- package/foundation/integrations/integrations.mjs +4 -0
- package/foundation/integrations/validate-contributions.d.mts +62 -1
- package/foundation/integrations/validate-contributions.mjs +476 -40
- package/foundation/release/cache.d.mts +11 -2
- package/foundation/release/cache.mjs +59 -10
- package/foundation/release/folder-lock.d.mts +21 -0
- package/foundation/release/folder-lock.mjs +171 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +8 -6
|
@@ -99,6 +99,14 @@ export const doc = {
|
|
|
99
99
|
"Link to this integration's docs site, such as its home page. Catalogs that list the package may show it.",
|
|
100
100
|
example: "'https://widgets.acme.dev'",
|
|
101
101
|
},
|
|
102
|
+
{
|
|
103
|
+
name: 'logo',
|
|
104
|
+
type: '{ light: string; dark?: string }',
|
|
105
|
+
description:
|
|
106
|
+
"The square logo catalogs show beside your package's name: paths, relative to the package root, to images the package ships. Each is a PNG, JPEG or WebP image, or a shapes-only SVG, of at most 512 KB, whose extension (`.png`, `.jpg`, `.jpeg`, `.webp`, `.svg`) names its format. Set `dark` for a version drawn for dark backgrounds; without it, `light` is used everywhere. `{@command integration check}` notes a logo that is missing, not one of those images, or not packed. In an SVG, no attribute value may hold `<`, `>`, `&` or `\\`, so write `and` rather than `&` in a label. A package.json `marketplace.logo` is also read when this field is not set.",
|
|
107
|
+
example:
|
|
108
|
+
"{ light: './marketplace/logo.svg', dark: './marketplace/logo-dark.svg' }",
|
|
109
|
+
},
|
|
102
110
|
{
|
|
103
111
|
name: 'cliCommand',
|
|
104
112
|
type: 'string',
|
|
@@ -53,6 +53,10 @@ export const integrationBaseSchema: z.ZodObject<{
|
|
|
53
53
|
}, z.core.$strip>>;
|
|
54
54
|
issuesUrl: z.ZodOptional<z.ZodString>;
|
|
55
55
|
docsiteUrl: z.ZodOptional<z.ZodString>;
|
|
56
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
light: z.ZodString;
|
|
58
|
+
dark: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
56
60
|
}, z.core.$strip>;
|
|
57
61
|
export const integrationSchema: z.ZodObject<{
|
|
58
62
|
providerId: z.ZodOptional<z.ZodString>;
|
|
@@ -66,6 +70,10 @@ export const integrationSchema: z.ZodObject<{
|
|
|
66
70
|
}, z.core.$strip>>;
|
|
67
71
|
issuesUrl: z.ZodOptional<z.ZodString>;
|
|
68
72
|
docsiteUrl: z.ZodOptional<z.ZodString>;
|
|
73
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
light: z.ZodString;
|
|
75
|
+
dark: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>>;
|
|
69
77
|
agentDocs: z.ZodOptional<z.ZodObject<{
|
|
70
78
|
append: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
71
79
|
}, z.core.$strip>>;
|
|
@@ -99,6 +99,7 @@ export const integrationBaseSchema = z.object({
|
|
|
99
99
|
experimental: z.object({iconSets: z.string().optional()}).optional(),
|
|
100
100
|
issuesUrl: z.string().url().optional(),
|
|
101
101
|
docsiteUrl: z.string().url().optional(),
|
|
102
|
+
logo: z.object({light: z.string(), dark: z.string().optional()}).optional(),
|
|
102
103
|
});
|
|
103
104
|
|
|
104
105
|
// Unknown top-level keys are stripped rather than rejected. `.strict()` made a key from a
|
|
@@ -56,6 +56,15 @@ export interface AstryxIntegration {
|
|
|
56
56
|
* accepts it as a known field; catalogs that list the package may show
|
|
57
57
|
* it. */
|
|
58
58
|
docsiteUrl?: string;
|
|
59
|
+
/** The square logo catalogs show beside the package name: paths, relative
|
|
60
|
+
* to the package root, to images the package ships. Each is a PNG, JPEG,
|
|
61
|
+
* WebP, or an SVG drawn only with shapes, at most 512 KB. `dark`, when
|
|
62
|
+
* set, is drawn for dark backgrounds; without it `light` is used
|
|
63
|
+
* everywhere. `astryx integration check` checks both. */
|
|
64
|
+
logo?: {
|
|
65
|
+
light: string;
|
|
66
|
+
dark?: string;
|
|
67
|
+
};
|
|
59
68
|
/** The command that runs the Astryx CLI for this package's users, such as
|
|
60
69
|
* `acme astryx`. Every command the CLI prints in a project that loads
|
|
61
70
|
* this package starts with it, in place of the package-manager prefix
|
|
@@ -24,8 +24,12 @@
|
|
|
24
24
|
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
25
25
|
import {dirname, join} from 'node:path';
|
|
26
26
|
import * as nodeModule from 'node:module';
|
|
27
|
-
import {existsSync,
|
|
27
|
+
import {existsSync, mkdirSync, realpathSync} from 'node:fs';
|
|
28
28
|
import {tmpdir} from 'node:os';
|
|
29
|
+
import {
|
|
30
|
+
currentUid,
|
|
31
|
+
isPrivateDir,
|
|
32
|
+
} from '../../../foundation/env/private-dir.mjs';
|
|
29
33
|
|
|
30
34
|
// Node's compile cache keeps the compiled form of the CLI's modules between
|
|
31
35
|
// runs, so a run skips most of their compiling. It lives in a folder of the
|
|
@@ -33,24 +37,19 @@ import {tmpdir} from 'node:os';
|
|
|
33
37
|
// only once that folder exists, so a machine's first run just makes it and a
|
|
34
38
|
// one-off run never pays to write the cache; and only while it is a real
|
|
35
39
|
// folder the user owns that no one else can reach, since a shared folder
|
|
36
|
-
// could hold planted cache files.
|
|
40
|
+
// could hold planted cache files (foundation/env/private-dir.mjs, the check
|
|
41
|
+
// the kept search catalogs use too). Where the system has no user ids
|
|
37
42
|
// (Windows), ownership cannot be checked, so the cache stays off.
|
|
38
43
|
// NODE_DISABLE_COMPILE_CACHE turns it off. It is best effort: a cache Node
|
|
39
44
|
// cannot read or write is skipped, and nothing about it is printed.
|
|
40
45
|
try {
|
|
41
|
-
const uid =
|
|
46
|
+
const uid = currentUid();
|
|
42
47
|
if (!process.env.NODE_DISABLE_COMPILE_CACHE && uid != null) {
|
|
43
48
|
const cacheDir = join(tmpdir(), `node-compile-cache-${uid}`);
|
|
44
49
|
if (!existsSync(cacheDir)) {
|
|
45
50
|
mkdirSync(cacheDir, {mode: 0o700});
|
|
46
|
-
} else {
|
|
47
|
-
|
|
48
|
-
const own =
|
|
49
|
-
stat.isDirectory() &&
|
|
50
|
-
!stat.isSymbolicLink() &&
|
|
51
|
-
stat.uid === uid &&
|
|
52
|
-
(stat.mode & 0o077) === 0;
|
|
53
|
-
if (own) nodeModule.enableCompileCache?.(cacheDir);
|
|
51
|
+
} else if (isPrivateDir(cacheDir)) {
|
|
52
|
+
nodeModule.enableCompileCache?.(cacheDir);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
} catch {
|
|
@@ -91,7 +90,12 @@ if (!isNodeVersionSupported(process.versions.node)) {
|
|
|
91
90
|
// does it load and dispatch the command. See clients/cli/run.mjs,
|
|
92
91
|
// foundation/release/handoff.mjs, and spec AST-081 FR2 and FR9.
|
|
93
92
|
const {runCli} = await importSrc('run.mjs');
|
|
94
|
-
await
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
const {recordRunFor} = await importSrc('../../foundation/fs/gather-cache.mjs');
|
|
94
|
+
// A search or build records what it reads, so a later run with the same
|
|
95
|
+
// inputs can reuse its gathered catalog (foundation/fs/gather-cache.mjs).
|
|
96
|
+
await recordRunFor(process.argv.slice(2), () =>
|
|
97
|
+
runCli({
|
|
98
|
+
cliRoot: join(binDir, '..', '..', '..'),
|
|
99
|
+
argv: process.argv.slice(2),
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"9b0120affffa47bd384f7ee9715e6e41b5f6343c0962d66dfa9739424719ed03"}
|
|
@@ -231,11 +231,18 @@ export function coreBuildIsStale(entry, roots, generated = []) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
function buildCore() {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
const args = ['-F', '@astryxdesign/core', 'build'];
|
|
235
|
+
/** @type {import('node:child_process').ExecFileSyncOptions} */
|
|
236
|
+
const options = {cwd: REPO_ROOT, stdio: 'pipe', timeout: BUILD_TIMEOUT_MS};
|
|
237
|
+
// On Windows, pnpm is a `pnpm.cmd` batch file. execFileSync cannot start a
|
|
238
|
+
// batch file without a shell: `pnpm` gives ENOENT and `pnpm.cmd` gives
|
|
239
|
+
// EINVAL. The arguments are literals, so cmd.exe gets them directly.
|
|
240
|
+
/** @type {[string, string[]]} */
|
|
241
|
+
const [file, fileArgs] =
|
|
242
|
+
process.platform === 'win32'
|
|
243
|
+
? ['cmd.exe', ['/d', '/s', '/c', 'pnpm', ...args]]
|
|
244
|
+
: ['pnpm', args];
|
|
245
|
+
execFileSync(file, fileArgs, options);
|
|
239
246
|
}
|
|
240
247
|
|
|
241
248
|
/**
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import {getCliInvocation} from '../../../../foundation/env/package-manager.mjs';
|
|
20
20
|
import {jsonOut} from '../../../../foundation/response/json.mjs';
|
|
21
|
+
import {levenshteinDistance} from '../../../../foundation/text/levenshtein.mjs';
|
|
21
22
|
import {NO_RESULT_SET, resultSet} from '../../../../foundation/debug/index.mjs';
|
|
22
23
|
import {ERROR_CODES} from '../../../../foundation/response/error-codes.mjs';
|
|
23
24
|
import {
|
|
@@ -43,8 +44,10 @@ import {
|
|
|
43
44
|
themeEditUndo,
|
|
44
45
|
} from '../../../../api/theme-edit/theme-edit.mjs';
|
|
45
46
|
import {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
builtInThemes,
|
|
48
|
+
editorCompileProblem,
|
|
49
|
+
editorThemeHold,
|
|
50
|
+
editorThemeRefusal,
|
|
48
51
|
} from '../../../../api/theme-edit/_adapter.mjs';
|
|
49
52
|
import {registerThemeSubcommands} from '../theme.mjs';
|
|
50
53
|
import {doc as groupDoc} from '../experimental-theme.doc.mjs';
|
|
@@ -76,6 +79,7 @@ import {doc as previewAppFn} from '../../../../api/theme-edit/themeEditPreviewAp
|
|
|
76
79
|
import {doc as previewListFn} from '../../../../api/theme-edit/themeEditPreviewList.doc.mjs';
|
|
77
80
|
import {doc as previewRemoveFn} from '../../../../api/theme-edit/themeEditPreviewRemove.doc.mjs';
|
|
78
81
|
import {doc as howFn} from '../../../../api/theme-edit/themeEditHow.doc.mjs';
|
|
82
|
+
import {quoteCommandArgument} from '../../../../foundation/env/package-manager.mjs';
|
|
79
83
|
|
|
80
84
|
const PREFIX = 'astryx experimental theme';
|
|
81
85
|
const EDITOR = `${PREFIX} editor`;
|
|
@@ -250,6 +254,18 @@ function notCheckedLine(result) {
|
|
|
250
254
|
return n ? [`[warn] saved, not checked (${n.code}): ${n.cause}`] : [];
|
|
251
255
|
}
|
|
252
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Text with C0 control characters and DEL shown as escapes (\u001b), so
|
|
259
|
+
* text a person typed cannot move the cursor or recolor the terminal.
|
|
260
|
+
* @param {string} text
|
|
261
|
+
*/
|
|
262
|
+
const escapeControls = text =>
|
|
263
|
+
String(text).replace(
|
|
264
|
+
// eslint-disable-next-line no-control-regex
|
|
265
|
+
/[\u0000-\u0008\u000b-\u001f\u007f]/g,
|
|
266
|
+
c => `\\u${`000${c.charCodeAt(0).toString(16)}`.slice(-4)}`,
|
|
267
|
+
);
|
|
268
|
+
|
|
253
269
|
/**
|
|
254
270
|
* Run one API call: errors become the CLI error envelope, results go to
|
|
255
271
|
* JSON or to `render`.
|
|
@@ -269,8 +285,14 @@ async function run(program, call, render, answer) {
|
|
|
269
285
|
const err = /** @type {import('../../../../api/error.mjs').AstryxError} */ (
|
|
270
286
|
e
|
|
271
287
|
);
|
|
272
|
-
|
|
273
|
-
|
|
288
|
+
// Suggested commands start the way this project runs the CLI, in JSON
|
|
289
|
+
// as in text. Echoed user text never drives the terminal: control
|
|
290
|
+
// characters print as escapes.
|
|
291
|
+
return cliError(escapeControls(err.message), {
|
|
292
|
+
suggestions: err.suggestions?.map(x => ({
|
|
293
|
+
...x,
|
|
294
|
+
name: escapeControls(cmd(x.name)),
|
|
295
|
+
})),
|
|
274
296
|
code: err.code ?? ERROR_CODES.ERR_UNKNOWN,
|
|
275
297
|
});
|
|
276
298
|
}
|
|
@@ -281,7 +303,20 @@ async function run(program, call, render, answer) {
|
|
|
281
303
|
jsonOut(/** @type {any} */ (result));
|
|
282
304
|
return answered;
|
|
283
305
|
}
|
|
284
|
-
|
|
306
|
+
// --detail compact|brief (and --dense) print a change's status line
|
|
307
|
+
// alone; an answer (how, show, list) is the answer, and prints whole.
|
|
308
|
+
const o = program.opts();
|
|
309
|
+
const change = ['themeEdit.set', 'themeEdit.undo', 'themeEdit.new'].includes(
|
|
310
|
+
/** @type {any} */ (result)?.type,
|
|
311
|
+
);
|
|
312
|
+
const short =
|
|
313
|
+
change &&
|
|
314
|
+
(o.detail === 'compact' ||
|
|
315
|
+
o.detail === 'brief' ||
|
|
316
|
+
o.dense ||
|
|
317
|
+
o.lang === 'dense');
|
|
318
|
+
const lines = [...notCheckedLine(result), ...render(result)];
|
|
319
|
+
print(short ? lines.slice(0, notCheckedLine(result).length + 1) : lines);
|
|
285
320
|
return answered;
|
|
286
321
|
}
|
|
287
322
|
|
|
@@ -434,53 +469,52 @@ function lookupBlocks(d) {
|
|
|
434
469
|
/** @param {string[]} cmds @param {boolean} [sequence] */
|
|
435
470
|
const commandLines = (cmds, sequence) =>
|
|
436
471
|
sequence && cmds.length > 1
|
|
437
|
-
? [
|
|
438
|
-
: cmds
|
|
439
|
-
/** @param {Array<{command: string, why: string}>}
|
|
440
|
-
const refusedLines =
|
|
441
|
-
|
|
472
|
+
? [cmds.join(' && '), 'sequence: run as one line, in this order']
|
|
473
|
+
: cmds;
|
|
474
|
+
/** @param {Array<{command: string, why: string}>} refusedList */
|
|
475
|
+
const refusedLines = refusedList =>
|
|
476
|
+
refusedList.flatMap(r => [`x ${r.command}`, ` not run: ${r.why}`]);
|
|
442
477
|
/** @type {Array<string | import('../../formatters/index.mjs').Block>} */
|
|
443
478
|
const blocks = [...(hint ? [String(hint)] : []), ...project(rest)];
|
|
444
479
|
if (Array.isArray(results) && results.length)
|
|
445
480
|
blocks.push(
|
|
446
481
|
section('results:'),
|
|
447
|
-
|
|
448
|
-
results
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
])
|
|
454
|
-
.join('\n'),
|
|
482
|
+
list(
|
|
483
|
+
results.map((/** @type {any} */ r) => [
|
|
484
|
+
String(r.text),
|
|
485
|
+
...commandLines(r.commands ?? [], r.sequence),
|
|
486
|
+
...refusedLines(r.refused ?? []),
|
|
487
|
+
]),
|
|
455
488
|
),
|
|
456
489
|
);
|
|
457
490
|
if (Array.isArray(examples) && examples.length)
|
|
458
|
-
blocks.push(section('examples:'),
|
|
491
|
+
blocks.push(section('examples:'), list(commandLines(examples)));
|
|
459
492
|
if (Array.isArray(refused) && refused.length)
|
|
460
|
-
blocks.push(
|
|
493
|
+
blocks.push(
|
|
494
|
+
section('refused:'),
|
|
495
|
+
list(refused.map((/** @type {any} */ r) => refusedLines([r]))),
|
|
496
|
+
);
|
|
461
497
|
if (Array.isArray(points) && points.length)
|
|
462
498
|
blocks.push(
|
|
463
499
|
section('points:'),
|
|
464
|
-
|
|
465
|
-
points
|
|
466
|
-
.
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
500
|
+
records(
|
|
501
|
+
points.map((/** @type {any} */ x) => ({
|
|
502
|
+
at: x.at,
|
|
503
|
+
color: x.color,
|
|
504
|
+
alpha: x.alpha,
|
|
505
|
+
})),
|
|
470
506
|
),
|
|
471
507
|
);
|
|
472
508
|
if (Array.isArray(items) && items.length) {
|
|
473
509
|
if (items.some((/** @type {any} */ x) => Array.isArray(x.examples)))
|
|
474
510
|
blocks.push(
|
|
475
511
|
section('items:'),
|
|
476
|
-
|
|
477
|
-
items
|
|
478
|
-
.
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
])
|
|
483
|
-
.join('\n'),
|
|
512
|
+
list(
|
|
513
|
+
items.map((/** @type {any} */ x) => [
|
|
514
|
+
`${x.name} ${x.values}`,
|
|
515
|
+
`help: ${x.help}`,
|
|
516
|
+
...commandLines(x.examples),
|
|
517
|
+
]),
|
|
484
518
|
),
|
|
485
519
|
);
|
|
486
520
|
else blocks.push(...project({items}).slice(1));
|
|
@@ -561,9 +595,28 @@ function explained(c, doc, {tokens = false} = {}) {
|
|
|
561
595
|
return c;
|
|
562
596
|
}
|
|
563
597
|
|
|
598
|
+
/** Old and sibling names, and where each now is. */
|
|
599
|
+
const MOVED = /** @type {Record<string, Record<string, string>>} */ ({
|
|
600
|
+
theme: {
|
|
601
|
+
build: 'compile',
|
|
602
|
+
set: 'editor set',
|
|
603
|
+
undo: 'editor undo',
|
|
604
|
+
show: 'editor show',
|
|
605
|
+
new: 'editor new',
|
|
606
|
+
how: 'editor how',
|
|
607
|
+
explain: 'editor how',
|
|
608
|
+
reset: 'editor undo',
|
|
609
|
+
palette: 'editor set',
|
|
610
|
+
help: '--help',
|
|
611
|
+
},
|
|
612
|
+
editor: {explain: 'how', reset: 'undo', help: '--help', palette: 'set'},
|
|
613
|
+
preview: {help: '--help'},
|
|
614
|
+
});
|
|
615
|
+
|
|
564
616
|
/**
|
|
565
|
-
* A command group: bare, it prints its help
|
|
566
|
-
* unknown
|
|
617
|
+
* A command group: bare, it prints its help (in JSON too, as the root
|
|
618
|
+
* does); with an unknown word, the unknown-subcommand error, leading with
|
|
619
|
+
* where a moved name now is, then the nearest subcommands.
|
|
567
620
|
* @param {import('commander').Command} parent
|
|
568
621
|
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc
|
|
569
622
|
* @returns {import('commander').Command}
|
|
@@ -576,18 +629,55 @@ function defineGroup(parent, doc) {
|
|
|
576
629
|
/** @type {import('commander').Command} */ c,
|
|
577
630
|
) => {
|
|
578
631
|
const extras = c?.args ?? [];
|
|
632
|
+
const words = [];
|
|
633
|
+
for (let x = cmd; x && x.parent; x = x.parent) words.unshift(x.name());
|
|
634
|
+
const here = `${getCliInvocation()} ${words.join(' ')}`;
|
|
579
635
|
if (extras.length > 0) {
|
|
636
|
+
const word = String(extras[0]).toLowerCase();
|
|
637
|
+
const group = doc.name.split(' ').at(-1) ?? '';
|
|
638
|
+
const moved =
|
|
639
|
+
MOVED[group]?.[word] ??
|
|
640
|
+
// `preview <theme>`: the pages for a theme.
|
|
641
|
+
(group === 'preview' && /^[a-z][a-z0-9-]*$/.test(word)
|
|
642
|
+
? `add --theme ${word}`
|
|
643
|
+
: null);
|
|
644
|
+
const ranked = (cmd.commands ?? [])
|
|
645
|
+
.map(command => command.name())
|
|
646
|
+
.sort(
|
|
647
|
+
(a, b) =>
|
|
648
|
+
levenshteinDistance(word, a) - levenshteinDistance(word, b),
|
|
649
|
+
);
|
|
580
650
|
return cliError(
|
|
581
|
-
`unknown subcommand '${doc.name} ${String(extras[0])}'`,
|
|
651
|
+
`unknown subcommand '${doc.name} ${String(extras[0])}'${moved ? `; it is ${here} ${moved}` : ''}`,
|
|
582
652
|
{
|
|
583
|
-
suggestions:
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
653
|
+
suggestions: [
|
|
654
|
+
...(moved
|
|
655
|
+
? [{name: `${here} ${moved}`, reason: 'do this instead'}]
|
|
656
|
+
: []),
|
|
657
|
+
...ranked.map(name => ({
|
|
658
|
+
name: `${here} ${name}`,
|
|
659
|
+
reason: 'available subcommand',
|
|
660
|
+
})),
|
|
661
|
+
],
|
|
587
662
|
code: ERROR_CODES.ERR_UNKNOWN_SUBCOMMAND,
|
|
588
663
|
},
|
|
589
664
|
);
|
|
590
665
|
}
|
|
666
|
+
if (c?.optsWithGlobals?.().json) {
|
|
667
|
+
jsonOut(
|
|
668
|
+
/** @type {any} */ ({
|
|
669
|
+
type: 'help',
|
|
670
|
+
data: {
|
|
671
|
+
command: words.join(' '),
|
|
672
|
+
commands: (cmd.commands ?? []).map(command => ({
|
|
673
|
+
name: command.name(),
|
|
674
|
+
summary: command.summary() || command.description(),
|
|
675
|
+
})),
|
|
676
|
+
},
|
|
677
|
+
}),
|
|
678
|
+
);
|
|
679
|
+
return NO_RESULT_SET;
|
|
680
|
+
}
|
|
591
681
|
cmd.help();
|
|
592
682
|
return NO_RESULT_SET;
|
|
593
683
|
},
|
|
@@ -630,14 +720,26 @@ export function registerExperimentalTheme(group, program) {
|
|
|
630
720
|
if (extra.length)
|
|
631
721
|
throw new AstryxError(
|
|
632
722
|
`new takes one theme name; "${extra.join(' ')}" is extra. For a base theme, use --like. Nothing was changed.`,
|
|
633
|
-
|
|
723
|
+
// A built-in theme after the name is the base; other words
|
|
724
|
+
// were most likely part of the name.
|
|
725
|
+
builtInThemes().includes(extra[0])
|
|
634
726
|
? [
|
|
635
727
|
{
|
|
636
728
|
name: `${EDITOR} new ${name} --like ${extra[0]}`,
|
|
637
729
|
reason: 'do this instead',
|
|
638
730
|
},
|
|
639
731
|
]
|
|
640
|
-
: [
|
|
732
|
+
: [
|
|
733
|
+
{
|
|
734
|
+
name: `${EDITOR} new ${quoteCommandArgument(
|
|
735
|
+
[name, ...extra]
|
|
736
|
+
.join('-')
|
|
737
|
+
.toLowerCase()
|
|
738
|
+
.replace(/[^a-z0-9-]+/g, '-'),
|
|
739
|
+
)}`,
|
|
740
|
+
reason: 'do this instead',
|
|
741
|
+
},
|
|
742
|
+
],
|
|
641
743
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
642
744
|
);
|
|
643
745
|
return themeEditNew(name, {
|
|
@@ -807,6 +909,25 @@ export function registerExperimentalTheme(group, program) {
|
|
|
807
909
|
}).allowExcessArguments(false),
|
|
808
910
|
previewAppDoc,
|
|
809
911
|
);
|
|
912
|
+
{
|
|
913
|
+
// A folder name that starts with "-" reads as an option: say how to
|
|
914
|
+
// pass it.
|
|
915
|
+
const app = /** @type {any} */ (
|
|
916
|
+
preview.commands.find(
|
|
917
|
+
(/** @type {any} */ x) =>
|
|
918
|
+
x.name() === previewAppDoc.name.split(' ').pop(),
|
|
919
|
+
)
|
|
920
|
+
);
|
|
921
|
+
const unknown = app?.unknownOption?.bind(app);
|
|
922
|
+
if (app && unknown)
|
|
923
|
+
app.unknownOption = (/** @type {string} */ flag) =>
|
|
924
|
+
/^-[^-]/.test(flag) && flag.length > 2
|
|
925
|
+
? app.error(
|
|
926
|
+
`error: unknown option '${flag}'. A folder name that starts with "-" goes after --: ${PREFIX} preview app -- ${flag}`,
|
|
927
|
+
{code: 'commander.unknownOption'},
|
|
928
|
+
)
|
|
929
|
+
: unknown(flag);
|
|
930
|
+
}
|
|
810
931
|
|
|
811
932
|
explained(
|
|
812
933
|
defineCommand(preview, previewListDoc, {
|
|
@@ -820,7 +941,7 @@ export function registerExperimentalTheme(group, program) {
|
|
|
820
941
|
? project(/** @type {any} */ (r.data))
|
|
821
942
|
: [
|
|
822
943
|
...project(/** @type {any} */ (r.data)),
|
|
823
|
-
`Tip: ${PREFIX} preview add${o.path == null ? '' : ` --path
|
|
944
|
+
`Tip: ${PREFIX} preview add${o.path == null ? '' : ` --path ${quoteCommandArgument(String(o.path))}`}`,
|
|
824
945
|
],
|
|
825
946
|
r =>
|
|
826
947
|
resultSet({
|
|
@@ -933,46 +1054,19 @@ export function registerExperimentalTheme(group, program) {
|
|
|
933
1054
|
},
|
|
934
1055
|
);
|
|
935
1056
|
}
|
|
936
|
-
//
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
`After a picture, give only how many colors to list, not "${rest.slice(1).join(' ')}".`,
|
|
941
|
-
{
|
|
942
|
-
suggestions: [
|
|
943
|
-
{name: `${HOW} ${rest[0]} 5`, reason: 'do this instead'},
|
|
944
|
-
],
|
|
945
|
-
code: ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
946
|
-
},
|
|
947
|
-
);
|
|
948
|
-
// A missing picture is the first thing to say, before a bad count.
|
|
949
|
-
if (
|
|
950
|
-
picture &&
|
|
951
|
-
rest.length === 2 &&
|
|
952
|
-
!/^[1-9]\d*$/.test(rest[1]) &&
|
|
953
|
-
fileExists(rest[0])
|
|
954
|
-
)
|
|
955
|
-
return cliError(
|
|
956
|
-
`The count after a picture must be a positive whole number, not "${rest[1]}".`,
|
|
957
|
-
{
|
|
958
|
-
suggestions: [
|
|
959
|
-
{name: `${HOW} ${rest[0]} 5`, reason: 'do this instead'},
|
|
960
|
-
],
|
|
961
|
-
code: ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
962
|
-
},
|
|
963
|
-
);
|
|
1057
|
+
// The API decides what the words are (a picture and a count, or a
|
|
1058
|
+
// question); a picture is told by its extension here only to keep
|
|
1059
|
+
// option words after it for the count.
|
|
1060
|
+
const picture = /\.png$/i.test(rest[0] ?? '');
|
|
964
1061
|
const stray = picture ? null : strayOption('how', rest.slice(1));
|
|
965
1062
|
if (stray) return stray;
|
|
966
|
-
const count =
|
|
967
|
-
picture && rest.length === 2 ? Number(rest[1]) : undefined;
|
|
968
|
-
const subject = picture ? rest[0] : rest.join(' ');
|
|
969
1063
|
return run(
|
|
970
1064
|
program,
|
|
971
1065
|
() =>
|
|
972
|
-
themeEditHow(
|
|
1066
|
+
themeEditHow(rest.join(' '), {
|
|
973
1067
|
cwd: process.cwd(),
|
|
974
1068
|
at: o.at ?? [],
|
|
975
|
-
|
|
1069
|
+
words: rest,
|
|
976
1070
|
theme: o.theme,
|
|
977
1071
|
}),
|
|
978
1072
|
r => lookupBlocks(/** @type {any} */ (r.data)),
|
|
@@ -1006,6 +1100,12 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1006
1100
|
template: templateDoc,
|
|
1007
1101
|
targets: targetsDoc,
|
|
1008
1102
|
},
|
|
1009
|
-
{
|
|
1103
|
+
{
|
|
1104
|
+
group: 'experimental theme',
|
|
1105
|
+
build: 'compile',
|
|
1106
|
+
explain: editorThemeRefusal,
|
|
1107
|
+
preflight: editorCompileProblem,
|
|
1108
|
+
hold: editorThemeHold,
|
|
1109
|
+
},
|
|
1010
1110
|
);
|
|
1011
1111
|
}
|
|
@@ -39,7 +39,7 @@ export const doc = {
|
|
|
39
39
|
flag: '-o, --out <path>',
|
|
40
40
|
param: 'options.out',
|
|
41
41
|
description:
|
|
42
|
-
'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
|
|
42
|
+
'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces only its own earlier outputs: any other existing file fails with ERR_FILE_EXISTS and nothing is written. A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
flag: '--icons-specifier <specifier>',
|
|
@@ -89,7 +89,7 @@ export const doc = {
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
code: 1,
|
|
92
|
-
when: 'a build or validation error, or --check finds stale or missing outputs',
|
|
92
|
+
when: 'a build or validation error (an error envelope), or --check finds stale or missing outputs (the check result, with upToDate false and the stale files, is still printed: it is a result, not an error)',
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
related: ['experimental theme add', 'experimental theme list'],
|
|
@@ -94,7 +94,7 @@ export const doc = {
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
code: 1,
|
|
97
|
-
when: 'an unknown option, an unknown or empty theme, --theme given twice, an unknown --list kind, --list given twice, --at without a picture, a picture that is not a PNG or is damaged or too big, an --at point that is not whole pixel numbers or falls outside the picture, a count beside --at, or a count that is not a positive whole number, or a missing picture',
|
|
97
|
+
when: 'an unknown option, an unknown or empty theme, --theme given twice, an unknown --list kind, --list given twice, --at without a picture, a picture that is not a PNG or is damaged or too big, an --at point that is not whole pixel numbers or falls outside the picture, a count beside --at, or a count that is not a positive whole number, or a missing picture; or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED)',
|
|
98
98
|
},
|
|
99
99
|
],
|
|
100
100
|
related: ['experimental theme editor', 'experimental theme targets'],
|
|
@@ -126,9 +126,8 @@ export const doc = {
|
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
code: 1,
|
|
129
|
-
when: 'an unknown option, a refused change (an unknown part, variant, state, token or thing; a value of the wrong type; --mode on something that has no mode; a token the part never reads for that; corners on a part that shows no edge), a theme that does not exist, or a build failure; nothing is written',
|
|
129
|
+
when: 'an unknown option, a refused change (an unknown part, variant, state, token or thing; a value of the wrong type; --mode on something that has no mode; a token the part never reads for that; corners on a part that shows no edge), a theme that does not exist, or a build failure, or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED); nothing is written',
|
|
130
130
|
},
|
|
131
131
|
],
|
|
132
132
|
related: ['experimental theme editor', 'experimental theme compile'],
|
|
133
|
-
replaces: ['theme palette generate'],
|
|
134
133
|
};
|
|
@@ -59,7 +59,7 @@ export const doc = {
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
code: 1,
|
|
62
|
-
when: 'the theme does not exist, an unknown --section, or a page that does not render',
|
|
62
|
+
when: 'the theme does not exist, an unknown --section, or a page that does not render; or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED)',
|
|
63
63
|
},
|
|
64
64
|
],
|
|
65
65
|
related: ['experimental theme editor', 'experimental theme compile'],
|
|
@@ -12,7 +12,7 @@ export const doc = {
|
|
|
12
12
|
summary:
|
|
13
13
|
'Step back one change, or remove one setting; the result says what applies instead',
|
|
14
14
|
description:
|
|
15
|
-
"With only the theme, it steps back one change: the settings
|
|
15
|
+
"With only the theme, it steps back one change: the settings, the generated settings module and the build go back to how they were before the last change (your <theme>.theme.ts is not touched), and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With a thing, it removes that one setting wherever it is in the settings, and the result says what applies now (`now`): the whole-theme setting for a part setting removed, or the base theme's value; the theme is rebuilt and previewed. Name the setting the way it was set: the same thing and the same --on, --when, --state, --mode and --only (`show` lists every setting that way). For the headings dial, name which half: weight or tracking (default weight). Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files the editor wrote are deleted; a palette.config.json you made, or one that holds a color of your own, stays. Removing vibrancy makes the colors again at the default, 50; removing the last color removes vibrancy too, as it needs a color. A setting the theme does not have is refused and the error lists the settings it has for that thing. `undo <theme> base` and `undo <theme> mode` go back to the base and mode the theme was made with; when they never changed, that is refused. The history keeps the last 80 steps (in <theme>.history.json); older steps are dropped. Experimental: it may change or be removed in a patch release.",
|
|
16
16
|
fn: 'themeEditUndo',
|
|
17
17
|
args: [
|
|
18
18
|
{
|
|
@@ -97,7 +97,7 @@ export const doc = {
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
code: 1,
|
|
100
|
-
when: 'an unknown option, there is no earlier change, the theme does not set the thing, or the theme does not exist',
|
|
100
|
+
when: 'an unknown option, there is no earlier change, the theme does not set the thing, or the theme does not exist; or a folder outside a project with Core installed (ERR_PROJECT_REQUIRED)',
|
|
101
101
|
},
|
|
102
102
|
],
|
|
103
103
|
related: ['experimental theme editor', 'experimental theme editor show'],
|
|
@@ -15,7 +15,7 @@ export const doc = {
|
|
|
15
15
|
summary:
|
|
16
16
|
'Make and change a theme one checked change at a time (dials, tokens, part styles), with previews',
|
|
17
17
|
description:
|
|
18
|
-
"A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it by the same build as `astryx theme build` (`experimental theme compile`). Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, font, headings, text-size, base, mode; or a color: accent, neutral, success, warning, danger, info, each generating its light and dark shades from one color for the color tokens, and vibrancy, how saturated they are), a design token by name, or a CSS property on a part. Where it applies: --on <part|group>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. `how` answers everything else: what a part, group, setting or aspect does, how the colors are made, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
|
|
18
|
+
"A type-safe compiler for themes. A theme lives in themes/<theme>/: <theme>.settings.json holds the checked settings and is owned by this command; <theme>.settings.ts is generated from it on every change; <theme>.theme.ts extends it, is written once and is yours to edit; <theme>.css and <theme>.js are built from it by the same build as `astryx theme build` (`experimental theme compile`). Every change is CHECKED against what the installed Core's components really read (derived from Core itself, version for version, and cached under node_modules/.cache/) and against the token's type; a change that cannot take effect is refused, nothing is written, and the error leads with the command that works. The thing you set is a dial (a big move with named rungs: corners, spacing, font, headings, text-size, base, mode; or a color: accent, neutral, success, warning, danger, info, each generating its light and dark shades from one color for the color tokens, and vibrancy, how saturated they are), a design token by name, or a CSS property on a part. Where it applies: --on <part|group>, --when <prop>:<value>, --state <state>, --mode light|dark, --only. Every accepted change rebuilds and writes preview.html (the sample app page); `show` adds the theme-building page with every component. PNG pictures only with --png. Commands on one theme run one after the other, through a lock in node_modules/.cache/astryx-theme/ of the project; when node_modules cannot be written (a read-only install), changes are refused and `show` still reads the last build. `how` answers everything else: what a part, group, setting or aspect does, how the colors are made, plain-words questions (with exact commands), a picture's colors, and lists of what you can set. Experimental: it may change or be removed in a patch release.",
|
|
19
19
|
subcommands: ['new', 'set', 'undo', 'show', 'how'],
|
|
20
20
|
examples: [
|
|
21
21
|
{
|