@astryxdesign/cli 0.6.6-canary.6ea1fb7 → 0.6.6-canary.7c8ddf2

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 (176) 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/component/component-replacement.test.mjs +12 -0
  10. package/api/component/component.doc.mjs +5 -2
  11. package/api/docs/_adapter.mjs +48 -1
  12. package/api/docs/compiled-topics.test.mjs +1 -1
  13. package/api/docs/detail/section/section.d.mts +44 -0
  14. package/api/docs/detail/section/section.mjs +164 -13
  15. package/api/docs/detail/section/section.test.mjs +4 -4
  16. package/api/docs/docOverlays.test.mjs +28 -17
  17. package/api/docs/docs.doc.mjs +3 -3
  18. package/api/docs/docs.mjs +11 -16
  19. package/api/docs/docs.test.mjs +9 -10
  20. package/api/docs/integration-tree.test.mjs +26 -26
  21. package/api/docs/integrationDocs.test.mjs +2 -2
  22. package/api/docs/namespace-section.test.mjs +260 -0
  23. package/api/docs/token-tables.test.mjs +93 -0
  24. package/api/doctor/doctor.d.mts +6 -0
  25. package/api/doctor/doctor.mjs +149 -40
  26. package/api/doctor/doctor.test.mjs +104 -0
  27. package/api/doctor/theme-checks.mjs +1 -1
  28. package/api/gap-report/gap-report.doc.mjs +2 -1
  29. package/api/init/run/run.mjs +1 -0
  30. package/api/integration/validate-integration.mjs +20 -4
  31. package/api/integration/validate-integration.test.mjs +73 -0
  32. package/api/layout/check/check.d.mts +1 -0
  33. package/api/layout/check/check.mjs +1 -0
  34. package/api/layout/expand/expand.d.mts +1 -0
  35. package/api/layout/expand/expand.mjs +1 -0
  36. package/api/layout/grammar/grammar.d.mts +1 -0
  37. package/api/layout/grammar/grammar.mjs +1 -0
  38. package/api/layout/layoutCheck.doc.mjs +1 -1
  39. package/api/layout/layoutExpand.doc.mjs +1 -1
  40. package/api/layout/layoutGrammar.doc.mjs +1 -1
  41. package/api/search/search.d.mts +44 -0
  42. package/api/search/search.domain-priority.test.mjs +261 -0
  43. package/api/search/search.mjs +191 -29
  44. package/api/swizzle/swizzle.doc.mjs +5 -2
  45. package/api/template/copy/copy.mjs +12 -0
  46. package/api/template/template.doc.mjs +1 -1
  47. package/api/template/template.type.d.mts +3 -0
  48. package/api/template/template.type.mjs +3 -0
  49. package/api/theme/build/build.d.mts +70 -0
  50. package/api/theme/build/build.mjs +205 -41
  51. package/api/theme/build/font-warning.d.mts +11 -0
  52. package/api/theme/build/font-warning.mjs +28 -3
  53. package/assets/docs/author-a-theme.doc.mjs +16 -11
  54. package/assets/docs/getting-started.doc.mjs +2 -2
  55. package/assets/docs/principles.doc.dense.mjs +3 -3
  56. package/assets/docs/principles.doc.mjs +4 -4
  57. package/assets/docs/principles.doc.zh.mjs +3 -3
  58. package/assets/docs/styling-overview.doc.mjs +6 -6
  59. package/assets/docs/theme.doc.dense.mjs +1 -1
  60. package/assets/docs/theme.doc.zh.mjs +1 -1
  61. package/assets/docs/tree/component-migration.doc.mjs +107 -0
  62. package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
  63. package/assets/docs/tree/font-setup.doc.mjs +122 -0
  64. package/assets/docs/tree/headers-and-footers.doc.mjs +0 -1
  65. package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
  66. package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
  67. package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
  68. package/assets/docs/tree/internationalization.doc.mjs +29 -0
  69. package/assets/docs/tree/layout.doc.mjs +23 -0
  70. package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
  71. package/assets/docs/tree/migration-verification.doc.mjs +67 -0
  72. package/assets/docs/tree/migration.doc.mjs +28 -0
  73. package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
  74. package/assets/docs/tree/other-libraries.doc.mjs +218 -0
  75. package/assets/docs/tree/responsive.doc.mjs +0 -4
  76. package/assets/docs/tree/scaffold.doc.mjs +0 -5
  77. package/assets/docs/tree/side-panels.doc.mjs +0 -1
  78. package/assets/docs/tree/structure.doc.mjs +0 -4
  79. package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
  80. package/assets/docs/tree/styling-basics.doc.mjs +181 -0
  81. package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
  82. package/assets/docs/tree/styling.doc.mjs +29 -0
  83. package/assets/docs/tree/tailwind.doc.mjs +65 -0
  84. package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
  85. package/assets/docs/tree/tokens-border.doc.mjs +46 -0
  86. package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
  87. package/assets/docs/tree/tokens-color.doc.mjs +438 -0
  88. package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
  89. package/assets/docs/tree/tokens-data.doc.mjs +323 -0
  90. package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
  91. package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
  92. package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
  93. package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
  94. package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
  95. package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
  96. package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
  97. package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
  98. package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
  99. package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
  100. package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
  101. package/assets/docs/tree/tokens-size.doc.mjs +54 -0
  102. package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
  103. package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
  104. package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
  105. package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
  106. package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
  107. package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
  108. package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
  109. package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
  110. package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
  111. package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
  112. package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
  113. package/assets/docs/tree/tokens.doc.mjs +28 -0
  114. package/assets/docs/tree/type-scale.doc.mjs +147 -0
  115. package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
  116. package/assets/docs/tree/typography.doc.mjs +29 -0
  117. package/assets/docs/use-a-theme.doc.mjs +6 -3
  118. package/assets/templates/pages/incident-console/page.tsx +1 -1
  119. package/assets/theme.template.ts +4 -3
  120. package/clients/cli/commands/blog.mjs +3 -3
  121. package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
  122. package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
  123. package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
  124. package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
  125. package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
  126. package/clients/cli/commands/build-theme.mjs +68 -18
  127. package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
  128. package/clients/cli/commands/build.mjs +1 -0
  129. package/clients/cli/commands/component/index.mjs +4 -1
  130. package/clients/cli/commands/component-replacement.text.test.mjs +45 -0
  131. package/clients/cli/commands/docs.doc.mjs +2 -1
  132. package/clients/cli/commands/docs.test.mjs +15 -12
  133. package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
  134. package/clients/cli/commands/doctor.test.mjs +50 -1
  135. package/clients/cli/commands/import-hint-correctness.test.mjs +23 -0
  136. package/clients/cli/commands/layout-check.doc.mjs +1 -0
  137. package/clients/cli/commands/layout-expand.doc.mjs +1 -0
  138. package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
  139. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
  140. package/clients/cli/commands/layout.doc.mjs +1 -0
  141. package/clients/cli/commands/layout.mjs +6 -11
  142. package/clients/cli/commands/search.test.mjs +6 -2
  143. package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
  144. package/clients/cli/commands/template.mjs +4 -3
  145. package/clients/cli/commands/theme-add-lifecycle.test.mjs +9 -6
  146. package/clients/cli/commands/theme-build.doc.mjs +3 -1
  147. package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
  148. package/clients/cli/index.mjs +1 -1
  149. package/clients/cli/lib/component-format.mjs +13 -3
  150. package/clients/cli/lib/component-format.test.mjs +1 -1
  151. package/clients/cli/lib/define-command.mjs +4 -0
  152. package/foundation/agent-docs/agent-docs.mjs +18 -2
  153. package/foundation/agent-docs/agent-docs.test.mjs +18 -0
  154. package/foundation/config/project.test.mjs +1 -1
  155. package/foundation/discovery/docs-discovery.test.mjs +1 -1
  156. package/foundation/discovery/template-needs.d.mts +31 -0
  157. package/foundation/discovery/template-needs.mjs +156 -0
  158. package/foundation/discovery/template-needs.test.mjs +203 -0
  159. package/foundation/doc-compiler/bundle.mjs +52 -1
  160. package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
  161. package/foundation/doc-compiler/tree.d.mts +10 -0
  162. package/foundation/doc-compiler/tree.mjs +22 -0
  163. package/foundation/doc-compiler/tree.test.mjs +3 -2
  164. package/foundation/env/package-manager.d.mts +31 -8
  165. package/foundation/env/package-manager.mjs +120 -13
  166. package/foundation/env/package-manager.test.mjs +174 -1
  167. package/foundation/integrations/validate-contributions.d.mts +16 -0
  168. package/foundation/integrations/validate-contributions.mjs +56 -8
  169. package/foundation/response/response-types.doc.mjs +4 -4
  170. package/package.json +9 -9
  171. package/assets/docs/styling-libraries.doc.mjs +0 -469
  172. package/assets/docs/styling.doc.mjs +0 -412
  173. package/assets/docs/tokens.doc.dense.mjs +0 -15
  174. package/assets/docs/tokens.doc.mjs +0 -1491
  175. package/assets/docs/tokens.doc.zh.mjs +0 -15
  176. package/assets/docs/typography.doc.mjs +0 -286
@@ -218,6 +218,51 @@ describe('component list text', () => {
218
218
  expect(run.stdout).toContain('AcmeSideNav');
219
219
  },
220
220
  );
221
+
222
+ it('prints only the requested category at full detail', async () => {
223
+ const layout = await runCli(
224
+ ['component', '--list', '--category', 'Layout', '--detail', 'full'],
225
+ {cwd: tmpDir},
226
+ );
227
+ expect(layout.status, layout.stderr).toBe(0);
228
+ expect(layout.stdout.match(/^## .+$/gm)).toEqual(['## Layout']);
229
+ expect(layout.stdout).not.toContain('@astryxdesign/core/SideNav');
230
+ expect(layout.stdout).not.toContain('AcmeSideNav');
231
+
232
+ const navigation = await runCli(
233
+ ['component', '--list', '--category', 'Navigation', '--detail', 'full'],
234
+ {cwd: tmpDir},
235
+ );
236
+ expect(navigation.status, navigation.stderr).toBe(0);
237
+ expect(navigation.stdout.match(/^## .+$/gm)).toEqual(['## Navigation']);
238
+ expect(navigation.stdout).toMatch(
239
+ /^AcmeSideNav {2}<- from '@acme\/nav\/components\/AcmeSideNav' {2}\[@acme\/nav\]$/m,
240
+ );
241
+ expect(navigation.stdout).not.toMatch(/^SideNav[( ]/m);
242
+ });
243
+
244
+ it.each(['brief', 'compact'])(
245
+ 'prints only the requested category at %s detail',
246
+ async detail => {
247
+ const layout = await runCli(
248
+ ['component', '--category', 'Layout', '--detail', detail],
249
+ {cwd: tmpDir},
250
+ );
251
+ expect(layout.status, layout.stderr).toBe(0);
252
+ expect(layout.stdout).not.toContain('@astryxdesign/core/SideNav');
253
+ expect(layout.stdout).not.toContain('AcmeSideNav');
254
+
255
+ const navigation = await runCli(
256
+ ['component', '--category', 'Navigation', '--detail', detail],
257
+ {cwd: tmpDir},
258
+ );
259
+ expect(navigation.status, navigation.stderr).toBe(0);
260
+ expect(navigation.stdout).toContain(
261
+ '@acme/nav/components/AcmeSideNav [@acme/nav]',
262
+ );
263
+ expect(navigation.stdout).not.toMatch(/^name: +SideNav$/m);
264
+ },
265
+ );
221
266
  });
222
267
 
223
268
  describe('help documents the replacement', () => {
@@ -22,7 +22,8 @@ export const doc = {
22
22
  'does, and `--index` its section index. A route ' +
23
23
  'opens a node of the docs tree: `cli` lists its guides and reference, ' +
24
24
  '`cli/api/functions` lists every API function, and `cli/api/functions/search` prints ' +
25
- 'one. `--depth` reads as far down the tree as you ask, from the doc alone (0) to ' +
25
+ 'one. A namespace plus a section prints that section from the one guide below it ' +
26
+ 'that has it (`astryx docs layout side-panels`). `--depth` reads as far down the tree as you ask, from the doc alone (0) to ' +
26
27
  'everything below it (all), and with it `--detail` sets how much of each doc below ' +
27
28
  'shows: one line (brief, the default), its sections (compact), or all of it (full).',
28
29
  fn: 'docs',
@@ -98,8 +98,7 @@ describe('migration docs', () => {
98
98
 
99
99
  const output = console.log.mock.calls.map(c => c[0]).join('\n');
100
100
  expect(output).toContain('Migration Guide');
101
- expect(output).toContain('Recommended Order');
102
- expect(output).toContain('Map shadcn and Radix Primitives');
101
+ expect(output).toContain('migration');
103
102
  });
104
103
  });
105
104
 
@@ -113,7 +112,8 @@ describe('progressive reads', () => {
113
112
  expect(status).toBe(0);
114
113
  expect(stdout).toMatch(/^principles +\S/m);
115
114
  expect(widest(stdout)).toBeLessThanOrEqual(120);
116
- expect(stdout).toContain('Usage: pnpm exec astryx docs <topic>');
115
+ // The repo root has no `astryx` bin, so the CLI names the scoped package.
116
+ expect(stdout).toMatch(/Usage: \S+(?: dlx)? (?:astryx|@astryxdesign\/cli) docs <topic>/);
117
117
  }, SLOW);
118
118
 
119
119
  it("prints a topic's section index with the keys to read by", async () => {
@@ -329,22 +329,25 @@ describe('the docs tree, one level at a time', () => {
329
329
  expect(old.stderr).toContain('Unknown topic "cli-integrations"');
330
330
  }, SLOW);
331
331
 
332
- it('returns docs.node as JSON, and fails a section of a namespace', async () => {
332
+ it('returns docs.node as JSON, and reads a section of a namespace from its guide', async () => {
333
333
  const node = JSON.parse((await runCli(['docs', 'cli', '--json'])).stdout);
334
334
  expect(node).toMatchObject({
335
335
  type: 'docs.node',
336
336
  data: {route: 'cli', kind: 'namespace', breadcrumb: []},
337
337
  });
338
338
  expect(node.data.slots.map(slot => slot.name)).toEqual(['guides', 'reference']);
339
- const section = await runCli(['docs', 'cli', 'commands', '--json']);
340
- expect(section.status).toBe(1);
341
- const error = JSON.parse(section.stdout);
342
- expect(error).toMatchObject({code: 'ERR_UNKNOWN_SECTION'});
343
- // It names the namespace's children, in the order its slots list them.
344
- expect(error.suggestions.map(s => s.name)).toEqual(
345
- node.data.slots.flatMap(slot => slot.children.map(child => child.route)),
339
+ const section = JSON.parse(
340
+ (await runCli(['docs', 'layout', 'side-panels', '--json'])).stdout,
346
341
  );
347
- expect(error.suggestions.map(s => s.name)).toContain('cli/commands');
342
+ expect(section).toMatchObject({
343
+ type: 'docs.detail.section',
344
+ data: {id: 'side-panels', title: 'Side panels'},
345
+ });
346
+ const missing = await runCli(['docs', 'cli', 'zzzz-nope', '--json']);
347
+ expect(missing.status).toBe(1);
348
+ const error = JSON.parse(missing.stdout);
349
+ expect(error).toMatchObject({code: 'ERR_UNKNOWN_SECTION'});
350
+ expect(error.suggestions.map(s => s.name)).toContain('cli/integrations/quick-start');
348
351
  }, SLOW);
349
352
  });
350
353
 
@@ -17,7 +17,7 @@ export const doc = {
17
17
  'range that turns replacement on, a missing Core target, an invalid value, a ' +
18
18
  'component named after a different Core component, or two replacements for one ' +
19
19
  'Core component is an error. In a package without that range they are warnings, ' +
20
- 'with one more warning naming the range to declare.',
20
+ 'with a warning for each such component, naming the range to declare.',
21
21
  fn: 'integrationComponentConflicts',
22
22
  args: [
23
23
  {
@@ -168,7 +168,23 @@ describe('doctor — individual checks', () => {
168
168
  it('agent-docs: INFO when no docs present', () => {
169
169
  const res = checkAgentDocs({cwd: tmpDir});
170
170
  expect(res.status).toBe('info');
171
- expect(res.fix).toContain('astryx init');
171
+ expect(res.fix).toContain('init --features agents');
172
+ });
173
+
174
+ // The npm package named `astryx` is not this CLI: a project without the
175
+ // `astryx` bin gets the scoped package in the fix, one with it keeps the bin.
176
+ it('agent-docs: the fix names the scoped package when the project has no local CLI', () => {
177
+ fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
178
+ const res = checkAgentDocs({cwd: tmpDir});
179
+ expect(res.fix).toContain('`npx @astryxdesign/cli init --features agents`');
180
+ });
181
+
182
+ it('agent-docs: the fix keeps `npx astryx` when the project has a local CLI', () => {
183
+ fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
184
+ fs.mkdirSync(path.join(tmpDir, 'node_modules', '.bin'), {recursive: true});
185
+ fs.writeFileSync(path.join(tmpDir, 'node_modules', '.bin', 'astryx'), '');
186
+ const res = checkAgentDocs({cwd: tmpDir});
187
+ expect(res.fix).toContain('`npx astryx init --features agents`');
172
188
  });
173
189
 
174
190
  it('agent-docs: WARN when docs exist without XDS markers', () => {
@@ -186,6 +202,39 @@ describe('doctor — individual checks', () => {
186
202
  expect(res.status).toBe('pass');
187
203
  });
188
204
 
205
+ it('agent-docs: PASS from a subfolder, reading the project root', () => {
206
+ fs.writeFileSync(path.join(tmpDir, 'package.json'), '{"name":"app"}');
207
+ fs.writeFileSync(
208
+ path.join(tmpDir, 'AGENTS.md'),
209
+ '<!-- ASTRYX:START -->\nstuff\n<!-- ASTRYX:END -->\n',
210
+ );
211
+ const src = path.join(tmpDir, 'src');
212
+ fs.mkdirSync(src);
213
+ const res = checkAgentDocs({cwd: src});
214
+ expect(res.status).toBe('pass');
215
+ expect(res.message).toBe(
216
+ `Astryx agent docs section present in ${path.join('..', 'AGENTS.md')}.`,
217
+ );
218
+ });
219
+
220
+ it('agent-docs: reads every file init can write, Hermes included', () => {
221
+ fs.writeFileSync(
222
+ path.join(tmpDir, 'HERMES.md'),
223
+ '<!-- ASTRYX:START -->\nstuff\n<!-- ASTRYX:END -->\n',
224
+ );
225
+ expect(checkAgentDocs({cwd: tmpDir})).toMatchObject({
226
+ status: 'pass',
227
+ message: 'Astryx agent docs section present in HERMES.md.',
228
+ });
229
+ });
230
+
231
+ it('agent-docs: INFO names what it looked for and where', () => {
232
+ const res = checkAgentDocs({cwd: tmpDir});
233
+ expect(res.status).toBe('info');
234
+ expect(res.message).toContain('AGENTS.md, CLAUDE.md');
235
+ expect(res.message).toContain('HERMES.md');
236
+ });
237
+
189
238
  it('peer-deps: INFO when core not installed', () => {
190
239
  const res = checkPeerDeps({cwd: tmpDir, coreDir: null});
191
240
  expect(res.status).toBe('info');
@@ -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. */
@@ -53,7 +53,11 @@ function asText(value) {
53
53
  * @param {unknown} value
54
54
  */
55
55
  function printsField(lines, key, value) {
56
- const shown = asText(value).split('\n')[0].trimEnd();
56
+ // The text prefixes a command (`command`, `parent`) with the project's
57
+ // invocation (`pnpm exec astryx`, or `pnpm dlx @astryxdesign/cli` where no
58
+ // `astryx` bin is installed), so compare the part after `astryx`.
59
+ const text = asText(value).split('\n')[0].trimEnd();
60
+ const shown = text.replace(/^astryx /, '');
57
61
  return lines.some(line => line.startsWith(`${key}:`) && line.trimEnd().endsWith(shown));
58
62
  }
59
63
 
@@ -282,7 +286,7 @@ describe('search CLI — exit codes + JSON contract', () => {
282
286
 
283
287
  it('renders each result as a greppable key: value record', async () => {
284
288
  const r = await runCli(['search', 'button'], REPO_ROOT);
285
- expect(r.stdout).toContain('astryx component Button');
289
+ expect(r.stdout).toMatch(/^command:\s+\S.*(?:astryx|@astryxdesign\/cli) component Button$/m);
286
290
  // Fields mirror the JSON object and are line-greppable.
287
291
  expect(r.stdout).toMatch(/^name:\s+Button$/m);
288
292
  expect(r.stdout).toMatch(/^domain:\s+component$/m);
@@ -305,7 +305,8 @@ describe('swizzle — StyleX build setup note (#3373)', () => {
305
305
  expect(humanResult.stdout).toMatch(/StyleX compiler/i);
306
306
  expect(humanResult.stdout).toMatch(/unstyled/i);
307
307
  expect(humanResult.stdout).toMatch(/next\/font/i);
308
- expect(humanResult.stdout).toMatch(/astryx docs styling/);
308
+ // The fixture has no `astryx` bin installed, so the note names the scoped package.
309
+ expect(humanResult.stdout).toMatch(/@astryxdesign\/cli docs styling/);
309
310
  });
310
311
 
311
312
  it('does not print the StyleX note for components without StyleX', async () => {
@@ -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
  }
@@ -7,6 +7,7 @@ import * as fs from 'node:fs';
7
7
  import * as os from 'node:os';
8
8
  import * as path from 'node:path';
9
9
  import {runCli} from '../../../test-utils/run-cli.mjs';
10
+ import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
10
11
 
11
12
  let tmpDir;
12
13
 
@@ -35,10 +36,11 @@ describe('theme add compatibility lifecycle', () => {
35
36
  expect(result.stderr.match(/source copying is deprecated/g)).toHaveLength(
36
37
  1,
37
38
  );
38
- expect(result.stderr).toContain('pnpm exec astryx theme eject neutral');
39
- expect(result.stderr).toContain(
40
- 'pnpm exec astryx theme add neutral --import',
41
- );
39
+ // The app has no CLI installed, so the commands name the scoped package.
40
+ const run = getCliInvocation(tmpDir);
41
+ expect(run).toMatch(/ @astryxdesign\/cli$/);
42
+ expect(result.stderr).toContain(`${run} theme eject neutral`);
43
+ expect(result.stderr).toContain(`${run} theme add neutral --import`);
42
44
  expect(fs.existsSync(path.join(tmpDir, 'src/themes/neutral'))).toBe(true);
43
45
  expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
44
46
  false,
@@ -77,11 +79,12 @@ describe('theme add compatibility lifecycle', () => {
77
79
 
78
80
  const textResult = await runCli(['theme', 'add', '--list'], tmpDir);
79
81
  expect(textResult.status, textResult.stderr).toBe(0);
82
+ const run = getCliInvocation(tmpDir);
80
83
  expect(textResult.stdout).toContain(
81
- 'Import one: pnpm exec astryx theme add <slug> --import [--package <package>]',
84
+ `Import one: ${run} theme add <slug> --import [--package <package>]`,
82
85
  );
83
86
  expect(textResult.stdout).toContain(
84
- 'Fork source: pnpm exec astryx theme eject <slug> [target-path]',
87
+ `Fork source: ${run} theme eject <slug> [target-path]`,
85
88
  );
86
89
  expect(textResult.stdout).not.toContain('theme add <slug> [target-path]');
87
90
  expect(textResult.stderr).not.toContain('deprecated');
@@ -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: [
@@ -187,8 +187,9 @@ describe('upgrade — core codemods run before config load', () => {
187
187
 
188
188
  const out = await runHuman(['upgrade', '--from', '0.1.2', '--path', 'src']);
189
189
  expect(out).toMatch(/fails strict validation/i);
190
+ // The fixture has no `astryx` bin installed, so the command names the scoped package.
190
191
  expect(out).toContain(
191
- 'astryx upgrade --from 0.1.2 --codemod migrate-layout-components-to-experimental --apply',
192
+ '@astryxdesign/cli upgrade --from 0.1.2 --codemod migrate-layout-components-to-experimental --apply',
192
193
  );
193
194
  expect(exitCode).not.toBe(1);
194
195
  });
@@ -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'),
@@ -638,20 +638,30 @@ export function formatProps(docs, componentName) {
638
638
  * Format brief summaries for ALL components in one output.
639
639
  * `replacements` maps a replaced Core name to the full list entry of the
640
640
  * integration component that takes its slot; that entry is printed in its
641
- * place, naming its package.
641
+ * place, naming its package. `categories`, when given, limits the output to
642
+ * those group keys (the keys of the list result it renders), so the text shows
643
+ * the same groups as the JSON and `replacements` covers every slot it prints.
642
644
  * @param {string} coreDir
643
- * @param {{zh?: boolean, lang?: string, themeData?: any, replacements?: Map<string, any>}} [options]
645
+ * @param {{zh?: boolean, lang?: string, themeData?: any, replacements?: Map<string, any>, categories?: string[]}} [options]
644
646
  * @returns {Promise<string>}
645
647
  */
646
648
  export async function formatBriefAll(
647
649
  coreDir,
648
- {zh = false, lang, themeData = null, replacements = new Map()} = {},
650
+ {
651
+ zh = false,
652
+ lang,
653
+ themeData = null,
654
+ replacements = new Map(),
655
+ categories,
656
+ } = {},
649
657
  ) {
650
658
  const components = discoverComponents(coreDir);
659
+ const shown = categories ? new Set(categories) : null;
651
660
  /** @type {string[]} */
652
661
  const output = [];
653
662
 
654
663
  for (const [key, comps] of Object.entries(components)) {
664
+ if (shown && !shown.has(key)) continue;
655
665
  const isUngrouped = comps.length === 1 && comps[0] === key;
656
666
  if (!isUngrouped) {
657
667
  output.push(`## ${key}\n`);
@@ -56,7 +56,7 @@ describe('formatFull sub-component rendering', () => {
56
56
  expect(out).toContain('### XDSRadioListItem');
57
57
  expect(out).not.toContain('undefined');
58
58
  // Points the reader at the sub-component's own docs instead of a blank.
59
- expect(out).toContain('astryx component XDSRadioListItem');
59
+ expect(out).toMatch(/(?:astryx|@astryxdesign\/cli) component XDSRadioListItem/);
60
60
  });
61
61
 
62
62
  it('renders a full props table for a sub-component that has inline props', () => {
@@ -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 ?? '';