@astryxdesign/cli 0.6.6-canary.e1dda17 → 0.6.6-canary.ee02ce2

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.
Files changed (68) hide show
  1. package/README.md +83 -83
  2. package/api/build/_adapter.d.mts +15 -0
  3. package/api/build/_adapter.mjs +22 -0
  4. package/api/build/build.doc.mjs +1 -1
  5. package/api/build/build.type.d.mts +4 -0
  6. package/api/build/build.type.mjs +1 -0
  7. package/api/build/help/help.mjs +1 -1
  8. package/api/build/kit/kit.mjs +12 -1
  9. package/api/doctor/_adapter.d.mts +7 -0
  10. package/api/doctor/_adapter.mjs +48 -0
  11. package/api/doctor/doctor.mjs +5 -3
  12. package/api/doctor/theme-checks.d.mts +12 -0
  13. package/api/doctor/theme-checks.mjs +115 -1
  14. package/api/doctor/theme-checks.test.mjs +142 -1
  15. package/api/init/run/run.mjs +1 -0
  16. package/api/layout/check/check.d.mts +1 -0
  17. package/api/layout/check/check.mjs +1 -0
  18. package/api/layout/expand/expand.d.mts +1 -0
  19. package/api/layout/expand/expand.mjs +1 -0
  20. package/api/layout/grammar/grammar.d.mts +1 -0
  21. package/api/layout/grammar/grammar.mjs +1 -0
  22. package/api/layout/layoutCheck.doc.mjs +1 -1
  23. package/api/layout/layoutExpand.doc.mjs +1 -1
  24. package/api/layout/layoutGrammar.doc.mjs +1 -1
  25. package/api/template/copy/copy.mjs +12 -0
  26. package/api/template/template.doc.mjs +1 -1
  27. package/api/template/template.type.d.mts +3 -0
  28. package/api/template/template.type.mjs +3 -0
  29. package/api/theme/build/build.d.mts +70 -0
  30. package/api/theme/build/build.mjs +205 -41
  31. package/api/theme/build/font-warning.d.mts +11 -0
  32. package/api/theme/build/font-warning.mjs +28 -3
  33. package/assets/docs/author-a-theme.doc.mjs +4 -4
  34. package/assets/docs/styling-overview.doc.mjs +211 -0
  35. package/assets/docs/theme.doc.dense.mjs +1 -1
  36. package/assets/docs/theme.doc.mjs +5 -5
  37. package/assets/docs/theme.doc.zh.mjs +1 -1
  38. package/assets/docs/use-a-theme.doc.mjs +159 -47
  39. package/assets/templates/pages/table-comparison/template.doc.mjs +1 -1
  40. package/authoring/doctypes/template/type.ts +1 -0
  41. package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
  42. package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
  43. package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
  44. package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
  45. package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
  46. package/clients/cli/commands/build-theme.mjs +68 -18
  47. package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
  48. package/clients/cli/commands/build.mjs +1 -0
  49. package/clients/cli/commands/docs.test.mjs +1 -1
  50. package/clients/cli/commands/doctor.doc.mjs +1 -1
  51. package/clients/cli/commands/import-hint-correctness.test.mjs +23 -0
  52. package/clients/cli/commands/layout-check.doc.mjs +1 -0
  53. package/clients/cli/commands/layout-expand.doc.mjs +1 -0
  54. package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
  55. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
  56. package/clients/cli/commands/layout.doc.mjs +1 -0
  57. package/clients/cli/commands/layout.mjs +6 -11
  58. package/clients/cli/commands/template.mjs +4 -3
  59. package/clients/cli/commands/theme-build.doc.mjs +3 -1
  60. package/clients/cli/index.mjs +1 -1
  61. package/clients/cli/lib/define-command.mjs +4 -0
  62. package/foundation/agent-docs/agent-docs.mjs +4 -1
  63. package/foundation/agent-docs/agent-docs.test.mjs +18 -0
  64. package/foundation/discovery/template-needs.d.mts +31 -0
  65. package/foundation/discovery/template-needs.mjs +156 -0
  66. package/foundation/discovery/template-needs.test.mjs +203 -0
  67. package/foundation/response/response-types.doc.mjs +4 -4
  68. package/package.json +9 -9
@@ -2,11 +2,12 @@
2
2
 
3
3
  /**
4
4
  * @file End-to-end test for the `astryx theme build` font-loading warning
5
- * (#5015). A theme that names webfont families gets, AFTER the install
6
- * instructions, a stdout notice naming the fonts plus the copy-pasteable
7
- * fix — the Google Fonts <link> pair and a self-hosted @font-face with
8
- * font-display: swap — and still exits 0 (it is a warning, not an error).
9
- * Themes that only name generics or known system stacks get none of it.
5
+ * (#5015). A theme that names webfont families gets a one-line stdout notice
6
+ * naming the fonts; with `--detail full` it gets, AFTER the install
7
+ * instructions, the copy-pasteable fix — the Google Fonts <link> pair and a
8
+ * self-hosted @font-face with font-display: swap. It still exits 0 (it is a
9
+ * warning, not an error). Themes that only name generics or known system
10
+ * stacks get none of it.
10
11
  */
11
12
 
12
13
  import {describe, it, expect, beforeAll, beforeEach, afterEach} from 'vitest';
@@ -54,7 +55,7 @@ describe('theme build font-loading warning', () => {
54
55
  );
55
56
 
56
57
  const result = await runCli(
57
- ['theme', 'build', path.relative(project, themeFile)],
58
+ ['--detail', 'full', 'theme', 'build', path.relative(project, themeFile)],
58
59
  project,
59
60
  );
60
61
 
@@ -84,6 +85,34 @@ describe('theme build font-loading warning', () => {
84
85
  expect(result.stderr).not.toContain('Font "');
85
86
  });
86
87
 
88
+ it('names the unloaded fonts in one line by default', async () => {
89
+ const project = path.join(tmpDir, 'project');
90
+ const themeFile = writeTheme(
91
+ project,
92
+ 'fonty',
93
+ `export default {
94
+ name: 'fonty',
95
+ typography: {
96
+ body: {family: 'Space Grotesk', fallbacks: 'Arial, sans-serif'},
97
+ code: {family: 'JetBrains Mono'},
98
+ },
99
+ };\n`,
100
+ );
101
+
102
+ const result = await runCli(
103
+ ['theme', 'build', path.relative(project, themeFile)],
104
+ project,
105
+ );
106
+
107
+ expect(result.code).toBe(0);
108
+ expect(result.stdout).toContain(
109
+ '[note] Fonts named but not loaded: "Space Grotesk", "JetBrains Mono". Load them in your app (recipe: astryx docs typography).\n',
110
+ );
111
+ expect(result.stdout).not.toContain('fonts.googleapis.com');
112
+ expect(result.stdout).not.toContain('@font-face');
113
+ expect(result.stdout).toContain('Run with --detail full');
114
+ });
115
+
87
116
  it('keeps --json stdout one valid envelope: notices inside, snippet suppressed', async () => {
88
117
  const project = path.join(tmpDir, 'project');
89
118
  const themeFile = writeTheme(
@@ -127,7 +156,7 @@ describe('theme build font-loading warning', () => {
127
156
  );
128
157
 
129
158
  const result = await runCli(
130
- ['theme', 'build', path.relative(project, themeFile)],
159
+ ['--detail', 'full', 'theme', 'build', path.relative(project, themeFile)],
131
160
  project,
132
161
  );
133
162
 
@@ -52,7 +52,7 @@ describe('theme build install-instructions import path', () => {
52
52
  const themeFile = writeTheme(project, 'cwd-theme');
53
53
 
54
54
  const result = await runCli(
55
- ['theme', 'build', path.relative(project, themeFile)],
55
+ ['--detail', 'full', 'theme', 'build', path.relative(project, themeFile)],
56
56
  project,
57
57
  );
58
58
 
@@ -70,7 +70,7 @@ describe('theme build install-instructions import path', () => {
70
70
  const themeFile = writeTheme(path.join(project, 'themes'), 'sub-theme');
71
71
 
72
72
  const result = await runCli(
73
- ['theme', 'build', path.relative(project, themeFile)],
73
+ ['--detail', 'full', 'theme', 'build', path.relative(project, themeFile)],
74
74
  project,
75
75
  );
76
76
 
@@ -89,7 +89,7 @@ describe('theme build install-instructions import path', () => {
89
89
  );
90
90
 
91
91
  const result = await runCli(
92
- ['theme', 'build', path.relative(project, themeFile)],
92
+ ['--detail', 'full', 'theme', 'build', path.relative(project, themeFile)],
93
93
  project,
94
94
  );
95
95
 
@@ -63,8 +63,11 @@ import {
63
63
  } from '../../../api/theme/palette/generate/generate.mjs';
64
64
  import {
65
65
  importSpecifier,
66
+ printBatchTrailer,
67
+ printCompactTrailer,
66
68
  themeBuild,
67
69
  themeBuildFamily,
70
+ themeBuildForReport,
68
71
  } from '../../../api/theme/build/build.mjs';
69
72
  import {defineCommand} from '../lib/define-command.mjs';
70
73
  import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
@@ -105,13 +108,17 @@ function resolveCliBin() {
105
108
  * Resolves with the child's exit code; never rejects.
106
109
  *
107
110
  * @param {string} file - The theme file argument, as the user passed it.
108
- * @param {{out?: string, iconsSpecifier?: string}} options - Parsed command
109
- * options that affect generated output.
111
+ * @param {{out?: string, iconsSpecifier?: string, detail?: string}} options -
112
+ * Parsed command options that affect generated output, plus the detail
113
+ * level the user chose.
110
114
  * @returns {Promise<number>}
111
115
  */
112
116
  function runThemeBuildOnceChild(file, options) {
113
117
  const cliBin = resolveCliBin();
114
- const args = [cliBin, 'theme', 'build', file];
118
+ // A detail level the user chose applies to every rebuild.
119
+ const args = options.detail
120
+ ? [cliBin, '--detail', options.detail, 'theme', 'build', file]
121
+ : [cliBin, 'theme', 'build', file];
115
122
  if (options.out) args.push('--out', options.out);
116
123
  if (options.iconsSpecifier)
117
124
  args.push('--icons-specifier', options.iconsSpecifier);
@@ -135,7 +142,7 @@ function runThemeBuildOnceChild(file, options) {
135
142
  *
136
143
  * @param {Array<{file: string, filePath: string}>} entries - The theme file
137
144
  * arguments as the user passed them, with their resolved absolute paths.
138
- * @param {{out?: string, iconsSpecifier?: string}} options - Parsed command options.
145
+ * @param {{out?: string, iconsSpecifier?: string, detail?: string}} options - Parsed command options, plus the detail level the user chose.
139
146
  * @returns {Promise<void>} Resolves when the watcher is stopped (Ctrl-C).
140
147
  */
141
148
  async function runThemeBuildWatch(entries, options) {
@@ -361,7 +368,8 @@ function printThemeApp(result) {
361
368
  emit(
362
369
  text('Wire the generated module once in the app root:'),
363
370
  code(
364
- `import {themes, defaultThemeSlug} from './${stem}';\n\n` +
371
+ "import {Theme} from '@astryxdesign/core';\n" +
372
+ `import {themes, defaultThemeSlug} from './${stem}';\n\n` +
365
373
  '<Theme theme={themes[defaultThemeSlug]}>\n <App />\n</Theme>',
366
374
  ),
367
375
  );
@@ -533,6 +541,13 @@ export function registerTheme(program) {
533
541
  /** @type {{out?: string, watch?: boolean, check?: boolean, iconsSpecifier?: string, family?: boolean, familyKey?: string}} */ options,
534
542
  ) => {
535
543
  const json = program.opts().json || false;
544
+ // The report is one line per theme unless the user asks for
545
+ // `--detail full`, which prints the install example and the font
546
+ // guidance: once for one theme, as it always has, and once for the whole
547
+ // batch rather than per theme.
548
+ const detailChosen = program.getOptionValueSource('detail') !== 'default';
549
+ const detail = detailChosen ? program.opts().detail : undefined;
550
+ const compact = detail !== 'full';
536
551
  const entries = files.map(file => ({
537
552
  file,
538
553
  filePath: path.resolve(process.cwd(), file),
@@ -608,7 +623,7 @@ export function registerTheme(program) {
608
623
  code: ERROR_CODES.ERR_THEME_INVALID,
609
624
  });
610
625
  }
611
- await runThemeBuildWatch(entries, options);
626
+ await runThemeBuildWatch(entries, {...options, detail});
612
627
  return NO_RESULT_SET;
613
628
  }
614
629
 
@@ -645,20 +660,44 @@ export function registerTheme(program) {
645
660
  }
646
661
  }
647
662
 
663
+ // --json and --check keep their own output at every detail level.
664
+ const report = !json && !options.check && (entries.length > 1 || compact);
665
+ /** @type {import('../../../api/theme/build/build.mjs').ThemeBuildTrailer[]} */
666
+ const trailers = [];
667
+
648
668
  /** @type {Array<{file: string, receipt: import('../../../api/theme/theme.type.mjs').ThemeBuildResponse | import('../../../api/theme/theme.type.mjs').ThemeBuildCheckResponse | null}>} */
649
669
  const results = [];
650
670
  let stale = false;
651
671
  for (const entry of entries) {
652
672
  try {
653
- const result = await themeBuild(
654
- entry.file,
655
- {
656
- out: options.out,
657
- check: options.check,
658
- iconsSpecifier: options.iconsSpecifier,
659
- },
660
- {cwd: process.cwd()},
661
- );
673
+ const buildOptions = {
674
+ out: options.out,
675
+ check: options.check,
676
+ iconsSpecifier: options.iconsSpecifier,
677
+ };
678
+ let result;
679
+ if (report) {
680
+ const built = await themeBuildForReport(
681
+ entry.file,
682
+ buildOptions,
683
+ {cwd: process.cwd()},
684
+ {compact},
685
+ );
686
+ result = built.receipt;
687
+ if (built.trailer) trailers.push(built.trailer);
688
+ if (compact && result?.type === 'theme.build') {
689
+ const {outputs, sizeKB, tokenCount, componentCount} = result.data;
690
+ emit(
691
+ text(
692
+ `[ok] ${outputs.css} (${sizeKB} KB, ${tokenCount} token overrides, ${componentCount} component overrides)`,
693
+ ),
694
+ );
695
+ }
696
+ } else {
697
+ result = await themeBuild(entry.file, buildOptions, {
698
+ cwd: process.cwd(),
699
+ });
700
+ }
662
701
  results.push({file: entry.file, receipt: result ?? null});
663
702
  if (
664
703
  options.check &&
@@ -673,7 +712,10 @@ export function registerTheme(program) {
673
712
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
674
713
  // Stop at the first failure, as a shell loop under `set -e` does.
675
714
  // With several themes in flight the message alone rarely says which
676
- // one broke, so name it.
715
+ // one broke, so name it. Themes already written keep their install
716
+ // and font guidance.
717
+ if (report && compact) printCompactTrailer(trailers);
718
+ else if (report) printBatchTrailer(trailers);
677
719
  return cliError(
678
720
  entries.length > 1 ? `${entry.file}: ${err.message}` : err.message,
679
721
  {suggestions: err.suggestions, code: err.code},
@@ -694,7 +736,14 @@ export function registerTheme(program) {
694
736
  };
695
737
  jsonOut(batch);
696
738
  }
697
- } else if (entries.length > 1) {
739
+ } else {
740
+ if (report && compact) {
741
+ printCompactTrailer(trailers, {hint: !detailChosen});
742
+ } else if (report) {
743
+ printBatchTrailer(trailers);
744
+ }
745
+ }
746
+ if (!json && entries.length > 1) {
698
747
  emit(
699
748
  text(
700
749
  options.check
@@ -823,7 +872,8 @@ export function registerTheme(program) {
823
872
  'Use it in your app (import path is relative to a file in src/ — adjust if yours lives elsewhere):',
824
873
  ),
825
874
  code(
826
- `import { ${exportName} } from '${entryModule}';\n\n` +
875
+ "import { Theme } from '@astryxdesign/core';\n" +
876
+ `import { ${exportName} } from '${entryModule}';\n\n` +
827
877
  `<Theme theme={${exportName}}>\n <App />\n</Theme>`,
828
878
  ),
829
879
  text(
@@ -157,6 +157,39 @@ describe('theme build --watch', () => {
157
157
  expect(stdout).toMatch(/Stopped watching/);
158
158
  }, 30_000);
159
159
 
160
+ it.each([
161
+ [[], false],
162
+ [['--detail', 'full'], true],
163
+ ])(
164
+ 'keeps the detail level for each build (%j)',
165
+ async (detail, full) => {
166
+ fs.writeFileSync(
167
+ path.join(tmpDir, 'wd.mjs'),
168
+ `export default { name: 'wd', tokens: { '--color-bg': '#ffffff' } };\n`,
169
+ );
170
+ const child = spawn(
171
+ process.execPath,
172
+ [CLI_BIN, ...detail, 'theme', 'build', 'wd.mjs', '--watch'],
173
+ {cwd: tmpDir, env: {...process.env, FORCE_COLOR: '0'}},
174
+ );
175
+ let stdout = '';
176
+ child.stdout.on('data', d => (stdout += d.toString()));
177
+ child.stderr.on('data', d => (stdout += d.toString()));
178
+ try {
179
+ expect(await waitFor(() => /Watching/i.test(stdout))).toBe(true);
180
+ } finally {
181
+ child.kill('SIGINT');
182
+ }
183
+ await new Promise(resolve => {
184
+ child.on('exit', resolve);
185
+ setTimeout(resolve, 4000);
186
+ });
187
+ expect(stdout.includes('Install in your app')).toBe(full);
188
+ expect(/\[ok\] wd\.css \(/.test(stdout)).toBe(!full);
189
+ },
190
+ 30_000,
191
+ );
192
+
160
193
  it('watches every file it was given and rebuilds only the one that changed', async () => {
161
194
  const first = path.join(tmpDir, 'w1.mjs');
162
195
  const second = path.join(tmpDir, 'w2.mjs');
@@ -226,6 +226,7 @@ export function registerBuild(program) {
226
226
  }
227
227
  : brief(['name', 'package', 'description', 'command']),
228
228
  ),
229
+ ...(start.notes ?? []).map(note => text(note)),
229
230
  );
230
231
  if (start.alternatives.length) {
231
232
  out.push(
@@ -198,7 +198,7 @@ describe('blocks as text', () => {
198
198
  it('prints the labels of a real section above their fences', async () => {
199
199
  const {status, stdout} = await runCli(['docs', 'theme', 'quick-start']);
200
200
  expect(status).toBe(0);
201
- expect(stdout).toContain('Basic theme setup:\n```tsx\nimport {Theme}');
201
+ expect(stdout).toContain('Wire the generated module once:\n```tsx\nimport {Theme}');
202
202
  }, SLOW);
203
203
  });
204
204
 
@@ -16,7 +16,7 @@ export const doc = {
16
16
  summary: 'Diagnose Astryx projects and integration packages',
17
17
  description:
18
18
  'Runs read-only project health diagnostics by default: Node version, @astryxdesign/core ' +
19
- 'install and version alignment, generated app themes when present, earlier copied-theme migration, config, integrations (linked without a config entry, ' +
19
+ 'install and version alignment, theme packages, generated app themes when present, earlier copied-theme migration, config, integrations (linked without a config entry, ' +
20
20
  'provider identity, contribution issues), agent docs, core peer dependencies, package manager, ' +
21
21
  "and the docs the CLI reads. It writes nothing, but loading astryx.config runs that file's code. " +
22
22
  'The `integration` subcommands provide authoring checks for one integration package.',
@@ -248,4 +248,27 @@ describe('import hint correctness', () => {
248
248
  });
249
249
  }
250
250
  });
251
+
252
+ describe('CLI --detail brief text output for a single component', () => {
253
+ it('brief text output names the component and its package', async () => {
254
+ const result = await runCli(['component', 'Button', '--detail', 'brief'], REPO_ROOT);
255
+ expect(result.code).toBe(0);
256
+ expect(result.stdout).toContain('Button');
257
+ expect(result.stdout).toContain('@astryxdesign/core');
258
+ });
259
+
260
+ it('brief text is shorter than compact text', async () => {
261
+ const brief = await runCli(['component', 'Button', '--detail', 'brief'], REPO_ROOT);
262
+ const compact = await runCli(['component', 'Button', '--detail', 'compact'], REPO_ROOT);
263
+ expect(brief.code).toBe(0);
264
+ expect(compact.code).toBe(0);
265
+ expect(brief.stdout.length).toBeLessThan(compact.stdout.length);
266
+ });
267
+
268
+ it('brief text shows the import path in the signature line', async () => {
269
+ const result = await runCli(['component', 'Button', '--detail', 'brief'], REPO_ROOT);
270
+ expect(result.code).toBe(0);
271
+ expect(result.stdout).toContain('@astryxdesign/core/Button');
272
+ });
273
+ });
251
274
  });
@@ -62,5 +62,6 @@ export const doc = {
62
62
  },
63
63
  ],
64
64
  deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
65
+ notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
65
66
  related: ['layout expand', 'layout grammar'],
66
67
  };
@@ -82,5 +82,6 @@ export const doc = {
82
82
  },
83
83
  ],
84
84
  deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
85
+ notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
85
86
  related: ['layout check', 'layout grammar'],
86
87
  };
@@ -27,5 +27,6 @@ export const doc = {
27
27
  {code: 1, when: 'the component registry cannot be read'},
28
28
  ],
29
29
  deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
30
+ notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
30
31
  related: ['layout expand', 'layout check'],
31
32
  };
@@ -0,0 +1,140 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Deprecation lifecycle coverage for the layout command group (DEP-0006).
5
+ *
6
+ * Mirrors the DEP-0005 theme-add-lifecycle tests: pins the JSON
7
+ * `meta.deprecations` entry, the human-mode stderr warning, the help label,
8
+ * and the docs reference pages.
9
+ */
10
+
11
+ import {describe, it, expect} from 'vitest';
12
+ import {runCli} from '../../../test-utils/run-cli.mjs';
13
+
14
+ const SLOW = 30_000;
15
+
16
+ describe('layout DEP-0006 lifecycle', () => {
17
+ it('JSON mode carries meta.deprecations with DEP-0006 and its replacements', async () => {
18
+ const result = await runCli(['layout', 'grammar', '--json']);
19
+ expect(result.status).toBe(0);
20
+ const envelope = JSON.parse(result.stdout);
21
+ expect(envelope.meta).toBeDefined();
22
+ expect(envelope.meta.deprecations).toEqual([
23
+ {
24
+ id: 'DEP-0006',
25
+ replacements: ['build', 'template', 'docs layout'],
26
+ },
27
+ ]);
28
+ // Canonical data is unchanged
29
+ expect(envelope.type).toBe('layout.grammar');
30
+ expect(envelope.data.text).toBeDefined();
31
+ expect(envelope.data.aliases).toBeDefined();
32
+ }, SLOW);
33
+
34
+ it('human mode emits one stderr deprecation warning', async () => {
35
+ const result = await runCli(['layout', 'grammar']);
36
+ expect(result.status).toBe(0);
37
+ expect(result.stderr).toContain('[DEP-0006]');
38
+ expect(result.stderr).toContain('astryx layout is deprecated');
39
+ expect(result.stderr).toContain('astryx build');
40
+ expect(result.stderr).toContain('astryx template');
41
+ expect(result.stderr).toContain('astryx docs layout');
42
+ }, SLOW);
43
+
44
+ it('JSON mode does NOT emit the stderr warning', async () => {
45
+ const result = await runCli(['layout', 'grammar', '--json']);
46
+ expect(result.stderr).not.toContain('[DEP-0006]');
47
+ }, SLOW);
48
+
49
+ it('layout --help labels the command as deprecated', async () => {
50
+ const result = await runCli(['layout', '--help']);
51
+ expect(result.stdout).toContain('DEPRECATED');
52
+ expect(result.stdout).toContain('DEP-0006');
53
+ });
54
+
55
+ it('layout expand --json carries the same meta.deprecations', async () => {
56
+ const result = await runCli([
57
+ 'layout', 'expand', 'V[g6] > C*2', '--json',
58
+ ]);
59
+ expect(result.status).toBe(0);
60
+ const envelope = JSON.parse(result.stdout);
61
+ expect(envelope.meta.deprecations).toEqual([
62
+ {
63
+ id: 'DEP-0006',
64
+ replacements: ['build', 'template', 'docs layout'],
65
+ },
66
+ ]);
67
+ expect(envelope.type).toBe('layout.expand');
68
+ }, SLOW);
69
+
70
+ it('layout check --json carries the same meta.deprecations', async () => {
71
+ const result = await runCli([
72
+ 'layout', 'check', 'V[g6] > C*2', '--json',
73
+ ]);
74
+ expect(result.status).toBe(0);
75
+ const envelope = JSON.parse(result.stdout);
76
+ expect(envelope.meta.deprecations).toEqual([
77
+ {
78
+ id: 'DEP-0006',
79
+ replacements: ['build', 'template', 'docs layout'],
80
+ },
81
+ ]);
82
+ expect(envelope.type).toBe('layout.check');
83
+ }, SLOW);
84
+
85
+ // FR29d: every reference page names DEP-0006 and the replacements.
86
+ // Removing the label from any single page must fail this test.
87
+ describe('docs reference pages name DEP-0006', () => {
88
+ const COMMAND_PAGES = [
89
+ 'cli/commands/layout',
90
+ 'cli/commands/layout-expand',
91
+ 'cli/commands/layout-check',
92
+ 'cli/commands/layout-grammar',
93
+ ];
94
+
95
+ const FUNCTION_PAGES = [
96
+ 'cli/api/functions/layout-expand',
97
+ 'cli/api/functions/layout-check',
98
+ 'cli/api/functions/layout-grammar',
99
+ ];
100
+
101
+ for (const page of COMMAND_PAGES) {
102
+ it(`${page} names DEP-0006 and replacements`, async () => {
103
+ const result = await runCli(['docs', page, '--json']);
104
+ expect(result.status, result.stderr).toBe(0);
105
+ const body = result.stdout;
106
+ expect(body).toContain('DEP-0006');
107
+ expect(body).toContain('build');
108
+ expect(body).toContain('template');
109
+ expect(body).toContain('docs layout');
110
+ }, SLOW);
111
+ }
112
+
113
+ for (const page of FUNCTION_PAGES) {
114
+ it(`${page} names DEP-0006 and replacements`, async () => {
115
+ const result = await runCli(['docs', page, '--json']);
116
+ expect(result.status, result.stderr).toBe(0);
117
+ const body = result.stdout;
118
+ expect(body).toContain('DEP-0006');
119
+ expect(body).toContain('build');
120
+ expect(body).toContain('template');
121
+ expect(body).toContain('docs layout');
122
+ }, SLOW);
123
+ }
124
+ });
125
+
126
+ it('response-types reference names DEP-0006 in each layout entry description', async () => {
127
+ const result = await runCli(['docs', 'cli/api/enums/response-types', '--json']);
128
+ expect(result.status, result.stderr).toBe(0);
129
+ const envelope = JSON.parse(result.stdout);
130
+ // The enum page has a table in its content; each row is [value, description].
131
+ const tables = envelope.data.content.filter(b => b.type === 'table');
132
+ const rows = tables.flatMap(t => t.rows || []);
133
+ for (const type of ['layout.expand', 'layout.check', 'layout.grammar']) {
134
+ const row = rows.find(r => r[0] && r[0].includes(type));
135
+ expect(row, `${type} not found in response-types table`).toBeDefined();
136
+ expect(row[1], `${type} description missing DEP-0006`).toContain('DEP-0006');
137
+ expect(row[1], `${type} description missing replacements`).toContain('replacement');
138
+ }
139
+ }, SLOW);
140
+ });
@@ -31,5 +31,6 @@ export const doc = {
31
31
  {code: 1, when: 'no subcommand (help is printed) or an unknown subcommand'},
32
32
  ],
33
33
  deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
34
+ notes: [{"type": "prose", "text": "**Deprecated (DEP-0006).** Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance. This command will be removed in a future minor release."}],
34
35
  related: ['template', 'build'],
35
36
  };
@@ -63,17 +63,12 @@ import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
63
63
  * DEP-0006: the `astryx layout` command group is deprecated.
64
64
  *
65
65
  * Human mode: one stderr warning per invocation.
66
- * JSON mode: `meta.deprecation` in the response envelope.
66
+ * JSON mode: `meta.deprecations` array in the response envelope.
67
67
  */
68
- const DEPRECATION = {
68
+ const LAYOUT_DEPRECATION = Object.freeze({
69
69
  id: 'DEP-0006',
70
- cleanup: 'CLN-0006',
71
- replacement: [
72
- 'astryx build "<idea>" — choose the template to start from',
73
- 'astryx template <name> <path> — scaffold it',
74
- 'astryx docs layout — layout guidance',
75
- ],
76
- };
70
+ replacements: ['build', 'template', 'docs layout'],
71
+ });
77
72
 
78
73
  function warnDeprecated() {
79
74
  if (!isJsonMode()) {
@@ -91,10 +86,10 @@ function warnDeprecated() {
91
86
  * Add deprecation metadata to a JSON response before output.
92
87
  * Canonical stdout (type, data) is unchanged; the metadata sits in `meta`.
93
88
  * @param {{type: string, data: unknown}} result
94
- * @returns {{type: string, data: unknown, meta: {deprecation: typeof DEPRECATION}}}
89
+ * @returns {{type: string, data: unknown, meta: {deprecations: [typeof LAYOUT_DEPRECATION]}}}
95
90
  */
96
91
  function withDeprecation(result) {
97
- return {...result, meta: {deprecation: DEPRECATION}};
92
+ return {...result, meta: {deprecations: [LAYOUT_DEPRECATION]}};
98
93
  }
99
94
 
100
95
  /** The largest layout expression read from --file or stdin. */
@@ -137,9 +137,9 @@ export function registerTemplate(program) {
137
137
  return lines.join('\n');
138
138
  };
139
139
  emit(
140
- section(`Page Templates (${pages.length})`),
140
+ pages.length > 0 && section(`Page Templates (${pages.length})`),
141
141
  pages.length > 0 && text(grouped(pages)),
142
- section(`Block Templates (${blocks.length})`),
142
+ blocks.length > 0 && section(`Block Templates (${blocks.length})`),
143
143
  blocks.length > 0 && text(grouped(blocks)),
144
144
  section('Usage'),
145
145
  text(
@@ -220,7 +220,7 @@ export function registerTemplate(program) {
220
220
  }
221
221
 
222
222
  case 'template.copy': {
223
- const {outputDir, fileName, demoMediaReplaced} = result.data;
223
+ const {outputDir, fileName, demoMediaReplaced, notes} = result.data;
224
224
  const file = `${outputDir}/${fileName}`;
225
225
  emit(
226
226
  text(`Copied template to ${file}`),
@@ -230,6 +230,7 @@ export function registerTemplate(program) {
230
230
  `Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'} in ${file}: ` +
231
231
  'images now show a neutral placeholder and videos have an empty source. Supply your own media there.',
232
232
  ),
233
+ ...notes.map(/** @param {string} note */ note => text(note)),
233
234
  );
234
235
  break;
235
236
  }
@@ -21,7 +21,9 @@ export const doc = {
21
21
  'theme. --family combines one selected extension tree into the three files named by ' +
22
22
  'the required --family-key, ready for one CSS load and identity-only switching. ' +
23
23
  'With --check it writes nothing and reports source drift. --icons-specifier keeps ' +
24
- 'its existing generated-module behavior.',
24
+ 'its existing generated-module behavior. It prints one line per built theme and ' +
25
+ 'one line naming fonts the themes do not load; --detail full adds the install ' +
26
+ 'example and the font recipe, once for a batch.',
25
27
  fn: 'themeBuild',
26
28
  args: [{name: 'files', param: 'file', required: true, variadic: true}],
27
29
  options: [
@@ -362,7 +362,7 @@ export async function createProgram() {
362
362
  .addOption(
363
363
  new Option(
364
364
  '--detail <level>',
365
- 'Detail level for component, hook, and docs tree reads (e.g. docs cli/commands/build). Lists default to brief',
365
+ 'Detail level for component, hook, and docs tree reads (e.g. docs cli/commands/build), and for theme build reports. Lists default to brief; theme build prints one line per built theme unless full, which adds the install example and font recipe',
366
366
  )
367
367
  .choices(['full', 'compact', 'brief'])
368
368
  .default('full'),
@@ -122,6 +122,10 @@ export function defineCommand(parent, doc, {fn, action} = {}) {
122
122
  const cmd = parent.command(argSpec ? `${token} ${argSpec}` : token);
123
123
  Object.defineProperty(cmd, COMMAND_DOCS, {value: {doc, fn}, configurable: true});
124
124
  if (doc.summary) cmd.description(doc.summary);
125
+ if (doc.deprecated) {
126
+ const base = cmd.description() || '';
127
+ cmd.description(`${base} [DEPRECATED: ${doc.deprecated}]`);
128
+ }
125
129
 
126
130
  const paramDesc = (/** @type {string | undefined} */ name) =>
127
131
  (fn?.params ?? []).find(p => p.name === name)?.description ?? '';
@@ -335,6 +335,9 @@ export function detectStylingSystem(targetDir) {
335
335
  // Key off a StyleX *compiler* plugin — the runtime alone won't render.
336
336
  const stylexCompilers = [
337
337
  '@stylexjs/babel-plugin',
338
+ '@stylexjs/rollup-plugin',
339
+ '@stylexjs/webpack-plugin',
340
+ '@stylexjs/nextjs-plugin',
338
341
  'vite-plugin-stylex',
339
342
  'unplugin-stylex',
340
343
  '@stylexswc/unplugin',
@@ -452,7 +455,7 @@ export function generateCompressedIndex(
452
455
  } else if (stylingSystem === 'tailwind') {
453
456
  lines.push('- Style with component props first, then Tailwind utilities backed by tokens. No raw hex/px.');
454
457
  } else {
455
- lines.push("- Style with component props first, then tokens (var(--color-*|--spacing-*|--radius-*)). No raw hex/px. No StyleX/Tailwind compiler here — don't use xstyle/utility classes.");
458
+ lines.push("- Style with component props first, then tokens (var(--color-*|--spacing-*|--radius-*)). No raw hex/px. No StyleX/Tailwind compiler here — don't use xstyle/utility classes directly. Some templates use StyleX and need a compiler plugin; see `astryx docs styling-overview`.");
456
459
  }
457
460
  lines.push('- Palettes and custom colors go through the theme, never :root overrides. See `astryx docs theme`.');
458
461
  // Self-check — post-generation pass. Validated via vibe tests (internal/vibe-tests/