@astryxdesign/cli 0.6.1-canary.f48d468 → 0.6.2-canary.a4bcbeb

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.
@@ -576,6 +576,43 @@ import './themes/ocean.css';
576
576
  },
577
577
  ],
578
578
  },
579
+ {
580
+ title: 'Building a Theme Family',
581
+ category: 'guide',
582
+ content: [
583
+ {
584
+ type: 'prose',
585
+ text: 'Use family mode when an app switches among one base theme and its selected descendants. The build writes one keyed CSS file containing every member, plus one keyed JavaScript module and one declaration file beside the root source.',
586
+ },
587
+ {
588
+ type: 'code',
589
+ lang: 'bash',
590
+ label: 'Build one family',
591
+ code: `astryx theme build --family \\
592
+ ./src/themes/ocean.mjs \\
593
+ ./src/themes/ocean-calm.mjs \\
594
+ ./src/themes/ocean-calm-deep.mjs \\
595
+ --family-key ocean-family`,
596
+ },
597
+ {
598
+ type: 'code',
599
+ lang: 'html',
600
+ label: 'Load native CSS and ESM independently',
601
+ code: `<link rel="stylesheet" href="./src/themes/ocean-family.css" />
602
+ <script type="module">
603
+ import {oceanCalmTheme} from './src/themes/ocean-family.js';
604
+ </script>`,
605
+ },
606
+ {
607
+ type: 'prose',
608
+ text: 'The family stylesheet eagerly downloads every selected member so first paint is complete. Switching members changes only the theme identity; it does not add, remove, or reorder stylesheets. A bundler such as Vite consumes the same CSS and ESM files.',
609
+ },
610
+ {
611
+ type: 'prose',
612
+ text: 'The family key is only the filename stem (`ocean-family.css`, `.js`, and `.d.ts`) and must differ from every selected member name. Use the ordinary standalone build when an app needs only one complete theme. Add `--check` to compare the exact keyed trio without writing.',
613
+ },
614
+ ],
615
+ },
579
616
  {
580
617
  title: 'Runtime vs Built Themes',
581
618
  category: 'guide',
@@ -50,7 +50,8 @@ export const docs = {
50
50
  label: 'Manual options',
51
51
  code: `npx @astryxdesign/cli init --features agents --agent claude # .claude/CLAUDE.md
52
52
  npx @astryxdesign/cli init --features agents --agent cursor # .cursorrules
53
- npx @astryxdesign/cli init --features agents --agent codex # AGENTS.md (Copilot, Codex, etc.)`,
53
+ npx @astryxdesign/cli init --features agents --agent codex # AGENTS.md (Copilot, Codex, etc.)
54
+ npx @astryxdesign/cli init --features agents --agent muse # AGENTS.md (Muse)`,
54
55
  },
55
56
  ],
56
57
  },
@@ -18,11 +18,13 @@
18
18
  * astryx theme build ./src/themes/ocean.ts
19
19
  * astryx theme build ./src/themes/ocean.ts --out ./dist/ocean.css
20
20
  * astryx theme build ./src/themes/*.ts
21
+ * astryx theme build --family ./src/themes/ocean.ts ./src/themes/ocean-calm.ts --family-key ocean-family
21
22
  *
22
- * `build` takes one or more theme files. Each is compiled by the same
23
+ * Ordinary builds take one or more theme files. Each is compiled by the same
23
24
  * single-file API call, in argument order, in one process — so the outputs are
24
25
  * byte-identical to running the CLI once per theme, and the first failure stops
25
- * the run exactly as a shell loop under `set -e` would.
26
+ * the run exactly as a shell loop under `set -e` would. Family mode delegates
27
+ * the selected files once to the API's in-memory family orchestration.
26
28
  */
27
29
 
28
30
  import * as fs from 'node:fs';
@@ -45,7 +47,11 @@ import {
45
47
  serializePaletteCandidate,
46
48
  themePaletteGenerate,
47
49
  } from '../../../api/theme/palette/generate/generate.mjs';
48
- import {themeBuild, importSpecifier} from '../../../api/theme/build/build.mjs';
50
+ import {
51
+ themeBuild,
52
+ themeBuildFamily,
53
+ importSpecifier,
54
+ } from '../../../api/theme/build/build.mjs';
49
55
  import {defineCommand} from '../lib/define-command.mjs';
50
56
  import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
51
57
  import {doc as themeGroup} from './theme.doc.mjs';
@@ -400,7 +406,7 @@ export function registerTheme(program) {
400
406
  fn: themeBuildFn,
401
407
  action: async (
402
408
  /** @type {string[]} */ files,
403
- /** @type {{out?: string, watch?: boolean, check?: boolean, iconsSpecifier?: string}} */ options,
409
+ /** @type {{out?: string, watch?: boolean, check?: boolean, iconsSpecifier?: string, family?: boolean, familyKey?: string}} */ options,
404
410
  ) => {
405
411
  const json = program.opts().json || false;
406
412
  const entries = files.map(file => ({
@@ -427,6 +433,28 @@ export function registerTheme(program) {
427
433
  });
428
434
  }
429
435
 
436
+ // Family mode is a thin orchestration branch over the existing build API.
437
+ // Its key is required exactly with --family, and options that describe one
438
+ // standalone output or a long-running loop remain intentionally separate.
439
+ if (Boolean(options.family) !== Boolean(options.familyKey)) {
440
+ return cliError(
441
+ options.family
442
+ ? '--family requires --family-key <key>'
443
+ : '--family-key requires --family',
444
+ {code: ERROR_CODES.ERR_THEME_INVALID},
445
+ );
446
+ }
447
+ if (options.family && options.out) {
448
+ return cliError('--family cannot be combined with --out', {
449
+ code: ERROR_CODES.ERR_THEME_INVALID,
450
+ });
451
+ }
452
+ if (options.family && options.watch) {
453
+ return cliError('--family cannot be combined with --watch', {
454
+ code: ERROR_CODES.ERR_THEME_INVALID,
455
+ });
456
+ }
457
+
430
458
  // --check and --watch are mutually exclusive: check is a one-shot,
431
459
  // exit-coded verification; watch is a long-running rebuild loop.
432
460
  if (options.check && options.watch) {
@@ -466,6 +494,33 @@ export function registerTheme(program) {
466
494
  // ✓/warning lines, and the install instructions are all emitted from
467
495
  // inside themeBuild via the shared logger.
468
496
  logger.setSilent(json);
497
+
498
+ if (options.family) {
499
+ try {
500
+ const result = await themeBuildFamily(
501
+ files,
502
+ {
503
+ familyKey: /** @type {string} */ (options.familyKey),
504
+ check: options.check,
505
+ iconsSpecifier: options.iconsSpecifier,
506
+ },
507
+ {cwd: process.cwd()},
508
+ );
509
+ if (json) jsonOut(result);
510
+ if (result.type === 'theme.build.check' && !result.data.upToDate) {
511
+ process.exitCode = 1;
512
+ }
513
+ return NO_RESULT_SET;
514
+ } catch (e) {
515
+ const err =
516
+ /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
517
+ return cliError(err.message, {
518
+ suggestions: err.suggestions,
519
+ code: err.code,
520
+ });
521
+ }
522
+ }
523
+
469
524
  /** @type {Array<{file: string, receipt: import('../../../api/theme/theme.type.mjs').ThemeBuildResponse | import('../../../api/theme/theme.type.mjs').ThemeBuildCheckResponse | null}>} */
470
525
  const results = [];
471
526
  let stale = false;
@@ -591,7 +646,10 @@ export function registerTheme(program) {
591
646
  try {
592
647
  result =
593
648
  options.list || !slug
594
- ? await themeListAvailable({cwd: process.cwd(), package: options.package})
649
+ ? await themeListAvailable({
650
+ cwd: process.cwd(),
651
+ package: options.package,
652
+ })
595
653
  : await themeAdd(slug, {
596
654
  targetPath,
597
655
  overwrite: options.overwrite,
@@ -41,9 +41,9 @@ export const doc = {
41
41
  {
42
42
  flag: '--agent <tool>',
43
43
  param: 'options.agent',
44
- choices: ['claude', 'cursor', 'codex', 'hermes', 'all'],
44
+ choices: ['claude', 'cursor', 'codex', 'hermes', 'muse', 'all'],
45
45
  description:
46
- 'Target AI tool for agent docs: claude, cursor, codex, hermes, all',
46
+ 'Target AI tool for agent docs: claude, cursor, codex, hermes, muse, all',
47
47
  },
48
48
  {
49
49
  flag: '--agent-docs-path <path...>',
@@ -14,19 +14,32 @@ export const doc = {
14
14
  name: 'theme build',
15
15
  displayName: 'astryx theme build',
16
16
  namespace: 'cli',
17
- summary: 'Compile one or more defineTheme files to CSS + JS',
17
+ summary: 'Compile standalone themes or one keyed theme family',
18
18
  description:
19
- 'Compiles a file that calls defineTheme() into a scoped CSS file, a JS module, and ' +
20
- 'type declarations: the exact CSS the <Theme> runtime emits. Takes any number of theme ' +
21
- 'files and compiles them in one process, in argument order, stopping at the first ' +
22
- 'failure; an app with several themes does not need a shell loop. With --check it writes ' +
23
- 'nothing and instead reports whether the committed outputs have drifted from source. ' +
24
- 'When a separate build step emits the icon registry, --icons-specifier declares the ' +
25
- 'fully specified module path that the generated JS should import.',
19
+ 'Compiles defineTheme() sources through the same theme pipeline into scoped CSS, ' +
20
+ 'standard ESM, and type declarations. Ordinary mode writes one complete set per ' +
21
+ 'theme. --family combines one selected extension tree into the three files named by ' +
22
+ 'the required --family-key, ready for one CSS load and identity-only switching. ' +
23
+ 'With --check it writes nothing and reports source drift. --icons-specifier keeps ' +
24
+ 'its existing generated-module behavior.',
26
25
  fn: 'themeBuild',
27
26
  args: [{name: 'files', param: 'file', required: true, variadic: true}],
28
27
  options: [
29
- {flag: '-o, --out <path>', param: 'options.out', description: 'Output CSS file path (single theme only)'},
28
+ {
29
+ flag: '--family',
30
+ description:
31
+ 'Build the selected extension family into one keyed CSS, JS, and declaration set',
32
+ },
33
+ {
34
+ flag: '--family-key <key>',
35
+ description:
36
+ 'Lower-kebab filename stem required with --family; must differ from every member name',
37
+ },
38
+ {
39
+ flag: '-o, --out <path>',
40
+ param: 'options.out',
41
+ description: 'Output CSS file path (single theme only)',
42
+ },
30
43
  {
31
44
  flag: '--icons-specifier <specifier>',
32
45
  param: 'options.iconsSpecifier',
@@ -35,7 +48,8 @@ export const doc = {
35
48
  },
36
49
  {
37
50
  flag: '-w, --watch',
38
- description: 'Rebuild automatically when a theme file changes (Ctrl-C to stop)',
51
+ description:
52
+ 'Rebuild automatically when a theme file changes (Ctrl-C to stop)',
39
53
  },
40
54
  {
41
55
  flag: '-c, --check',
@@ -49,6 +63,10 @@ export const doc = {
49
63
  label: 'Build to a CSS file',
50
64
  cli: 'astryx theme build ./src/themes/ocean.ts --out ./dist/ocean.css',
51
65
  },
66
+ {
67
+ label: 'Build one related family for attribute-only switching',
68
+ cli: 'astryx theme build --family ./themes/ocean.mjs ./themes/ocean-calm.mjs --family-key ocean-family',
69
+ },
52
70
  {
53
71
  label: 'Build every theme in a directory',
54
72
  cli: 'astryx theme build ./src/themes/*.ts',
@@ -47,7 +47,7 @@ export const LEGACY_MARKER_END = '<!-- XDS:END -->';
47
47
  * targets are user-chosen and not enumerable here.)
48
48
  */
49
49
  export const AGENT_DOC_PATHS = [
50
- AGENTS_MD, // Codex / ChatGPT / generic
50
+ AGENTS_MD, // Codex / ChatGPT / Muse / generic
51
51
  CLAUDE_MD, // Claude Code (root)
52
52
  CLAUDE_DIR_MD, // Claude Code (.claude/CLAUDE.md)
53
53
  CURSOR_RULES, // Cursor
@@ -53,7 +53,7 @@ export function inspectAgentDocs(targetDir: string, installedVersion?: string, e
53
53
  * Searches for existing files first, falls back to default creation path.
54
54
  *
55
55
  * @param {string} targetDir
56
- * @param {string} agent - Preset name: 'claude', 'cursor', 'codex', 'hermes', 'all'
56
+ * @param {string} agent - Preset name: 'claude', 'cursor', 'codex', 'hermes', 'muse', 'all'
57
57
  * @returns {{inject: string[], create: string[]}} Files to inject into vs create fresh
58
58
  */
59
59
  export function resolveAgentPaths(targetDir: string, agent: string): {
@@ -199,7 +199,7 @@ export function removeAgentDocs(targetDir: string): void;
199
199
  * @param {object} [options]
200
200
  * @param {boolean} [options.zh]
201
201
  * @param {string} [options.lang]
202
- * @param {string} [options.agent] - Tool preset: 'claude', 'cursor', 'codex', 'hermes', 'all'
202
+ * @param {string} [options.agent] - Tool preset: 'claude', 'cursor', 'codex', 'hermes', 'muse', 'all'
203
203
  * @param {string[]} [options.paths] - Explicit paths (overrides agent/auto-detect)
204
204
  * @param {boolean} [options.onlyReplace] - Only update files that already have Astryx markers (for upgrades)
205
205
  * @param {string[]} [options.topics] - Doc topics to list in the block; defaults
@@ -9,12 +9,13 @@
9
9
  * - Claude Code: CLAUDE.md (root) or .claude/CLAUDE.md
10
10
  * - Cursor: .cursorrules
11
11
  * - Codex/generic: AGENTS.md
12
+ * - Muse: AGENTS.md
12
13
  * - Hermes Agent: .hermes.md or HERMES.md (existing), else AGENTS.md
13
14
  *
14
15
  * Auto-detect: discovers existing files and updates them in place.
15
16
  * Default (no existing files): creates AGENTS.md (the tool-agnostic standard).
16
17
  *
17
- * --agent <tool>: target a specific tool preset (claude, cursor, codex, hermes, all)
18
+ * --agent <tool>: target a specific tool preset (claude, cursor, codex, hermes, muse, all)
18
19
  * --agent-docs-path <path>: explicit file path(s)
19
20
  */
20
21
 
@@ -181,6 +182,7 @@ const AGENT_PRESETS = {
181
182
  cursor: [CURSOR_RULES, AGENTS_MD],
182
183
  codex: [AGENTS_MD],
183
184
  hermes: [HERMES_DOT_MD, HERMES_MD, AGENTS_MD],
185
+ muse: [AGENTS_MD],
184
186
  };
185
187
 
186
188
  /**
@@ -280,7 +282,7 @@ export function inspectAgentDocs(targetDir, installedVersion, expectedBlock) {
280
282
  * Searches for existing files first, falls back to default creation path.
281
283
  *
282
284
  * @param {string} targetDir
283
- * @param {string} agent - Preset name: 'claude', 'cursor', 'codex', 'hermes', 'all'
285
+ * @param {string} agent - Preset name: 'claude', 'cursor', 'codex', 'hermes', 'muse', 'all'
284
286
  * @returns {{inject: string[], create: string[]}} Files to inject into vs create fresh
285
287
  */
286
288
  export function resolveAgentPaths(targetDir, agent) {
@@ -739,7 +741,7 @@ export function removeAgentDocs(targetDir) {
739
741
  * @param {object} [options]
740
742
  * @param {boolean} [options.zh]
741
743
  * @param {string} [options.lang]
742
- * @param {string} [options.agent] - Tool preset: 'claude', 'cursor', 'codex', 'hermes', 'all'
744
+ * @param {string} [options.agent] - Tool preset: 'claude', 'cursor', 'codex', 'hermes', 'muse', 'all'
743
745
  * @param {string[]} [options.paths] - Explicit paths (overrides agent/auto-detect)
744
746
  * @param {boolean} [options.onlyReplace] - Only update files that already have Astryx markers (for upgrades)
745
747
  * @param {string[]} [options.topics] - Doc topics to list in the block; defaults
@@ -852,9 +854,9 @@ export function installAgentDocs(
852
854
  }
853
855
 
854
856
  // Nothing exists — create root AGENTS.md as the default (skip if onlyReplace).
855
- // AGENTS.md is the tool-agnostic standard (Codex/Copilot, Cursor, and most
856
- // agents read it), so it's the safe default. Claude-specific output is opt-in
857
- // via `--agent claude` (→ .claude/CLAUDE.md); `--agent all` writes both.
857
+ // AGENTS.md is the tool-agnostic standard (Codex/Copilot, Cursor, Muse, and
858
+ // most agents read it), so it's the safe default. Claude-specific output is
859
+ // opt-in via `--agent claude` (→ .claude/CLAUDE.md); `--agent all` writes both.
858
860
  if (onlyReplace) return written;
859
861
 
860
862
  const defaultPath = AGENTS_MD;
@@ -793,6 +793,15 @@ describe('installAgentDocs', () => {
793
793
  expect(fs.existsSync(path.join(tmpDir, '.claude'))).toBe(false);
794
794
  });
795
795
 
796
+ it('respects --agent muse preset: creates AGENTS.md', () => {
797
+ setupCorePackage(tmpDir);
798
+
799
+ const written = installAgentDocs(tmpDir, {agent: 'muse'});
800
+
801
+ expect(written).toEqual(['AGENTS.md']);
802
+ expect(fs.existsSync(path.join(tmpDir, 'AGENTS.md'))).toBe(true);
803
+ });
804
+
796
805
  it('respects explicit --paths', () => {
797
806
  setupCorePackage(tmpDir);
798
807
 
@@ -911,6 +920,11 @@ describe('resolveAgentPaths', () => {
911
920
  expect(result).toEqual({inject: ['HERMES.md'], create: []});
912
921
  });
913
922
 
923
+ it('muse preset creates AGENTS.md when nothing exists', () => {
924
+ const result = resolveAgentPaths(tmpDir, 'muse');
925
+ expect(result).toEqual({inject: [], create: ['AGENTS.md']});
926
+ });
927
+
914
928
  it('claude preset still creates .claude/CLAUDE.md when nothing exists (hermes is additive)', () => {
915
929
  const result = resolveAgentPaths(tmpDir, 'claude');
916
930
  expect(result).toEqual({inject: [], create: ['.claude/CLAUDE.md']});
@@ -258,6 +258,35 @@ describe('collectThemingTargets', () => {
258
258
  },
259
259
  );
260
260
 
261
+ it('keeps DialogHeader theming metadata available in its direct doc', async () => {
262
+ const doc = await loadComponentDoc(
263
+ path.join(coreSrc, 'Dialog', 'DialogHeader.doc.mjs'),
264
+ );
265
+ expect(doc.subComponentOf).toBe('Dialog');
266
+ expect(doc.theming.targets).toEqual([
267
+ {className: 'astryx-dialog-header'},
268
+ {className: 'astryx-dialog-header-title-block'},
269
+ {className: 'astryx-dialog-header-close-icon'},
270
+ ]);
271
+ });
272
+
273
+ it.each([
274
+ 'dialog-header',
275
+ 'dialog-header-title-block',
276
+ 'dialog-header-close-icon',
277
+ ])('enumerates %s once under its canonical Dialog owner', async key => {
278
+ const matches = (await enumerated).filter(target => target.key === key);
279
+ expect(matches).toEqual([
280
+ {
281
+ key,
282
+ className: `astryx-${key}`,
283
+ component: 'Dialog',
284
+ props: [],
285
+ states: [],
286
+ },
287
+ ]);
288
+ });
289
+
261
290
  it.each(['table-header', 'table-body', 'table-footer'])(
262
291
  'enumerates %s once under its canonical Table owner',
263
292
  async key => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.1-canary.f48d468",
3
+ "version": "0.6.2-canary.a4bcbeb",
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",
@@ -100,10 +100,10 @@
100
100
  "zod": "^4.4.3"
101
101
  },
102
102
  "peerDependencies": {
103
- "@astryxdesign/charts": "0.6.1-canary.f48d468",
104
- "@astryxdesign/core": "0.6.1-canary.f48d468",
105
- "@astryxdesign/lab": "0.6.1-canary.f48d468",
106
- "@astryxdesign/theme-neutral": "0.6.1-canary.f48d468",
103
+ "@astryxdesign/charts": "0.6.2-canary.a4bcbeb",
104
+ "@astryxdesign/core": "0.6.2-canary.a4bcbeb",
105
+ "@astryxdesign/lab": "0.6.2-canary.a4bcbeb",
106
+ "@astryxdesign/theme-neutral": "0.6.2-canary.a4bcbeb",
107
107
  "gpt-tokenizer": "^3.4.0"
108
108
  },
109
109
  "peerDependenciesMeta": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.6.1-canary.f48d468",
125
- "@astryxdesign/core": "0.6.1-canary.f48d468",
126
- "@astryxdesign/lab": "0.6.1-canary.f48d468",
127
- "@astryxdesign/theme-neutral": "0.6.1-canary.f48d468",
124
+ "@astryxdesign/charts": "0.6.2-canary.a4bcbeb",
125
+ "@astryxdesign/core": "0.6.2-canary.a4bcbeb",
126
+ "@astryxdesign/lab": "0.6.2-canary.a4bcbeb",
127
+ "@astryxdesign/theme-neutral": "0.6.2-canary.a4bcbeb",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",