@astryxdesign/cli 0.6.4-canary.06c8fa3 → 0.6.4-canary.10dd683

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 (91) hide show
  1. package/README.md +66 -63
  2. package/api/component/_adapter.d.mts +0 -25
  3. package/api/component/_adapter.mjs +5 -59
  4. package/api/component/component.d.mts +3 -6
  5. package/api/component/component.doc.mjs +10 -23
  6. package/api/component/component.mjs +9 -249
  7. package/api/component/component.type.d.mts +0 -25
  8. package/api/component/component.type.mjs +0 -44
  9. package/api/docs/docs.test.mjs +0 -2
  10. package/api/doctor/doctor.d.mts +3 -8
  11. package/api/doctor/doctor.mjs +9 -90
  12. package/api/doctor/doctor.test.mjs +10 -122
  13. package/api/index.d.mts +2 -1
  14. package/api/index.mjs +4 -4
  15. package/api/integration/pack-check.mjs +3 -28
  16. package/api/json/index.ts +1 -0
  17. package/api/layout/_adapter.d.mts +34 -0
  18. package/api/layout/_adapter.mjs +148 -0
  19. package/api/layout/check/check.d.mts +16 -0
  20. package/api/layout/check/check.mjs +40 -0
  21. package/api/layout/expand/expand.d.mts +22 -0
  22. package/api/layout/expand/expand.mjs +155 -0
  23. package/api/layout/expand/expand.path-safety.test.mjs +53 -0
  24. package/api/layout/grammar/grammar.d.mts +13 -0
  25. package/api/layout/grammar/grammar.mjs +87 -0
  26. package/api/layout/layout.d.mts +6 -0
  27. package/api/layout/layout.mjs +17 -0
  28. package/api/layout/layout.test.mjs +297 -0
  29. package/api/layout/layout.type.d.mts +89 -0
  30. package/api/layout/layout.type.mjs +103 -0
  31. package/api/layout/layoutCheck.doc.d.mts +11 -0
  32. package/api/layout/layoutCheck.doc.mjs +85 -0
  33. package/api/layout/layoutExpand.doc.d.mts +11 -0
  34. package/api/layout/layoutExpand.doc.mjs +107 -0
  35. package/api/layout/layoutGrammar.doc.d.mts +11 -0
  36. package/api/layout/layoutGrammar.doc.mjs +57 -0
  37. package/api/search/search.test.mjs +0 -18
  38. package/api/template/template-integration.test.mjs +65 -1
  39. package/api/template/template.mjs +1 -1
  40. package/api/upgrade/run/run.mjs +4 -6
  41. package/api/upgrade/upgrade.type.mjs +2 -2
  42. package/assets/codemods/__tests__/runner.test.mjs +1 -3
  43. package/assets/codemods/integration-runner.mjs +3 -3
  44. package/assets/codemods/runner.mjs +4 -5
  45. package/authoring/config/config.doc.mjs +1 -1
  46. package/authoring/config/type.ts +2 -2
  47. package/authoring/doctypes/command/command.doc.mjs +1 -1
  48. package/authoring/doctypes/command/type.ts +1 -1
  49. package/clients/cli/command-result-coverage.test.mjs +7 -7
  50. package/clients/cli/commands/component/index.mjs +55 -152
  51. package/clients/cli/commands/component-ownership.test.mjs +0 -89
  52. package/clients/cli/commands/component.doc.mjs +6 -23
  53. package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
  54. package/clients/cli/commands/docs.test.mjs +0 -29
  55. package/clients/cli/commands/layout-check.doc.mjs +65 -0
  56. package/clients/cli/commands/layout-expand.doc.mjs +83 -0
  57. package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
  58. package/clients/cli/commands/layout.doc.mjs +34 -0
  59. package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
  60. package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
  61. package/clients/cli/commands/layout.mjs +275 -0
  62. package/clients/cli/commands/layout.path-help.test.mjs +33 -0
  63. package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
  64. package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
  65. package/clients/cli/commands/text-json-parity.test.mjs +17 -0
  66. package/clients/cli/index.mjs +4 -0
  67. package/clients/cli/lib/exit-codes.test.mjs +8 -1
  68. package/clients/cli/lib/json-shim.mjs +14 -24
  69. package/clients/cli/lib/json-shim.test.mjs +20 -6
  70. package/clients/cli/lib/manifest.mjs +8 -2
  71. package/clients/cli/lib/manifest.test.mjs +2 -5
  72. package/foundation/discovery/template-adapter.mjs +1 -1
  73. package/foundation/doc-compiler/doc-loads.test.mjs +12 -0
  74. package/foundation/doc-compiler/tree.test.mjs +1 -9
  75. package/foundation/response/response-types.doc.mjs +17 -5
  76. package/foundation/response/response-types.doc.test.mjs +0 -23
  77. package/foundation/xle/browser.d.mts +3 -3
  78. package/foundation/xle/browser.mjs +3 -3
  79. package/foundation/xle/expand.mjs +2 -2
  80. package/foundation/xle/parse.mjs +1 -1
  81. package/foundation/xle/print.mjs +2 -2
  82. package/foundation/xle/splice.mjs +1 -1
  83. package/package.json +9 -9
  84. package/api/integration/pack-check.lifecycle-output.test.mjs +0 -105
  85. package/api/upgrade/run/files-changed.test.mjs +0 -111
  86. package/assets/codemods/file-count.test.mjs +0 -163
  87. package/assets/docs/tree/component-lookups.doc.mjs +0 -149
  88. package/clients/cli/commands/component-batch.test.mjs +0 -341
  89. package/clients/cli/lib/parse-error-format.test.mjs +0 -81
  90. package/foundation/response/batch.type.d.mts +0 -33
  91. package/foundation/response/batch.type.mjs +0 -34
@@ -67,6 +67,7 @@ export function runIntegrationCodemods(
67
67
  /** In-memory pipeline state keeps ordered dry-runs equivalent to apply. */
68
68
  const virtualContents = new Map(providedContents ?? []);
69
69
 
70
+ let totalFilesChanged = 0;
70
71
  let totalTransformsApplied = 0;
71
72
  /** @type {string[]} */
72
73
  const changedFiles = [];
@@ -114,6 +115,7 @@ export function runIntegrationCodemods(
114
115
  protection,
115
116
  contents: virtualContents,
116
117
  });
118
+ totalFilesChanged += r.filesChanged;
117
119
  totalTransformsApplied += r.filesChanged;
118
120
  changedFiles.push(...r.changedFiles);
119
121
  writtenFiles.push(...r.writtenFiles);
@@ -143,6 +145,7 @@ export function runIntegrationCodemods(
143
145
  protection,
144
146
  contents: virtualContents,
145
147
  });
148
+ totalFilesChanged += r.filesChanged;
146
149
  totalTransformsApplied += r.filesChanged;
147
150
  changedFiles.push(...r.changedFiles);
148
151
  writtenFiles.push(...r.writtenFiles);
@@ -151,9 +154,6 @@ export function runIntegrationCodemods(
151
154
  }
152
155
  }
153
156
 
154
- // A file several codemods changed is one file; transforms count each change.
155
- const totalFilesChanged = new Set(changedFiles).size;
156
-
157
157
  return {
158
158
  totalFilesChanged,
159
159
  totalTransformsApplied,
@@ -486,6 +486,7 @@ export async function runCodemods(
486
486
  (await import('jscodeshift')).default
487
487
  );
488
488
 
489
+ let totalFilesChanged = 0;
489
490
  let totalTransformsApplied = 0;
490
491
  let totalValidationBlocked = 0;
491
492
  /** @type {Array<{file: string, codemod: string, error: string}>} */
@@ -553,6 +554,7 @@ export async function runCodemods(
553
554
  protectionWriteCount = writtenFiles.length;
554
555
  }
555
556
  if (result.filesChanged > 0) {
557
+ totalFilesChanged += result.filesChanged;
556
558
  totalTransformsApplied += 1;
557
559
  }
558
560
  continue;
@@ -575,6 +577,7 @@ export async function runCodemods(
575
577
  changedFiles.push(...result.changedFiles);
576
578
  writtenFiles.push(...result.writtenFiles);
577
579
  if (result.filesChanged > 0) {
580
+ totalFilesChanged += result.filesChanged;
578
581
  totalTransformsApplied += result.filesChanged;
579
582
  }
580
583
  continue;
@@ -589,6 +592,7 @@ export async function runCodemods(
589
592
  protectedFiles.push(...result.protectedFiles);
590
593
  changedFiles.push(...result.changedFiles);
591
594
  writtenFiles.push(...result.writtenFiles);
595
+ totalFilesChanged += result.filesChanged;
592
596
  totalTransformsApplied += result.filesChanged;
593
597
  totalValidationBlocked += result.errors.filter(
594
598
  error =>
@@ -626,11 +630,6 @@ export async function runCodemods(
626
630
  );
627
631
  }
628
632
 
629
- // A file several codemods changed is one file. `totalTransformsApplied` is
630
- // unchanged: a code or config codemod counts each file it changed, and a
631
- // project codemod counts once. The two answer different questions.
632
- const totalFilesChanged = new Set(changedFiles).size;
633
-
634
633
  if (protectedFiles.length > 0) {
635
634
  const files = [...new Set(protectedFiles.map(item => item.file))];
636
635
  log.warn(
@@ -77,7 +77,7 @@ export const doc = {
77
77
  name: 'experimental.xle.components',
78
78
  type: 'Record<string, XleComponent>',
79
79
  description:
80
- 'No effect. Its only reader was the removed `layout` command. The key is still accepted so existing configs keep loading; delete it.',
80
+ 'Custom components the layout expander (XLE) may emit, keyed by tag.',
81
81
  },
82
82
  ],
83
83
  },
@@ -115,8 +115,8 @@ export interface AstryxConfig {
115
115
  /** Experimental XLE (layout expression) configuration. */
116
116
  xle?: {
117
117
  /**
118
- * No effect. Its only reader was the removed `layout` command. Still
119
- * accepted so existing configs keep loading; delete it.
118
+ * Register app-local components so XLE layout expressions can
119
+ * reference them by name via {hint}. Keyed by component name.
120
120
  */
121
121
  components?: Record<string, XleComponent>;
122
122
  };
@@ -151,7 +151,7 @@ export const doc = {
151
151
  name: 'subcommands',
152
152
  type: 'string[]',
153
153
  description:
154
- 'Subcommand names (for command groups like `theme`).',
154
+ 'Subcommand names (for command groups like `theme` / `layout`).',
155
155
  },
156
156
  {
157
157
  name: 'examples',
@@ -75,7 +75,7 @@ export interface CommandDoc extends AuthoredDocGraphFields {
75
75
  args?: CommandArgDoc[];
76
76
  /** Flags/options. */
77
77
  options?: CommandOptionDoc[];
78
- /** Subcommand names (for command groups like `theme`). */
78
+ /** Subcommand names (for command groups like `theme` / `layout`). */
79
79
  subcommands?: string[];
80
80
  /** Terminal examples. */
81
81
  examples?: CommandExampleDoc[];
@@ -29,17 +29,17 @@ import {program} from './index.mjs';
29
29
  import {reportsResult, reportsResultVia} from './lib/define-command.mjs';
30
30
 
31
31
  /**
32
- * Commands with no action of their own: a group that prints its subcommand
33
- * list and does nothing else has no run to report on.
32
+ * Commands with no action of their own: bare `astryx layout` prints its
33
+ * subcommand list and does nothing else, so there is no run to report on.
34
34
  *
35
35
  * Pinned as a SET rather than skipped silently — if a command joins this list,
36
36
  * that is a real change to what the CLI does and it should be read, not
37
- * absorbed. Every group ships an action today: `theme`, for instance, HAS one
38
- * — the one that rejects an unknown subcommand — so it goes through the
39
- * converter like any other. Its bare form prints help and never returns from
40
- * that action, which the recorder covers where help is recorded, not here.
37
+ * absorbed. (`theme` is deliberately NOT here: it HAS an action — the one that
38
+ * rejects an unknown subcommand — so it goes through the converter like any
39
+ * other. Its bare form prints help and never returns from that action, which
40
+ * the recorder covers where help is recorded, not here.)
41
41
  */
42
- const NO_ACTION_OF_THEIR_OWN = [];
42
+ const NO_ACTION_OF_THEIR_OWN = ['layout'];
43
43
 
44
44
  /**
45
45
  * Commands that record for themselves instead of returning a descriptor.
@@ -38,7 +38,6 @@ import {doc as componentFn} from '../../../../api/component/component.doc.mjs';
38
38
  *
39
39
  * @typedef {(
40
40
  * | import('../../../../api/component/component.type.mjs').ComponentListResponse
41
- * | import('../../../../api/component/component.type.mjs').ComponentBatchResponse
42
41
  * | import('../../../../api/component/component.type.mjs').ComponentDetailResponse
43
42
  * | import('../../../../api/component/component.type.mjs').ComponentDetailPropsResponse
44
43
  * | import('../../../../api/component/component.type.mjs').ComponentDetailSourceResponse
@@ -68,11 +67,6 @@ function summarize(result) {
68
67
  );
69
68
  return resultSet({count, resultKind: 'component'});
70
69
  }
71
- case 'component.batch':
72
- return resultSet({
73
- count: result.data.results.filter(row => row.status === 'found').length,
74
- resultKind: 'component',
75
- });
76
70
  case 'component.detail':
77
71
  case 'component.detail.props':
78
72
  case 'component.detail.source':
@@ -88,103 +82,19 @@ function summarize(result) {
88
82
  }
89
83
  }
90
84
 
91
- /**
92
- * Project one single-component API result through the existing formatter kit.
93
- * @param {import('../../../../api/component/component.type.mjs').ComponentSingleResponse} result
94
- * @param {string} requestedName
95
- * @param {'full'|'compact'|'brief'} detail
96
- * @param {ReturnType<typeof resolveTheme>} themeData
97
- * @returns {import('../../formatters/index.mjs').Block[]}
98
- */
99
- function componentDetailBlocks(result, requestedName, detail, themeData) {
100
- const resolvedName = (requestedName.split('/').pop() ?? requestedName).replace(
101
- /^XDS/,
102
- '',
103
- );
104
- switch (result.type) {
105
- case 'component.detail': {
106
- /** @type {import('../../formatters/index.mjs').Block[]} */
107
- const out = [];
108
- if (result.data.parentDoc) {
109
- out.push(record(result.data, {fields: ['parentDoc']}));
110
- }
111
- out.push(
112
- detail === 'brief'
113
- ? code(
114
- formatBrief(result.data, resolvedName, result.data.import, {
115
- themeData,
116
- }),
117
- )
118
- : detail === 'compact'
119
- ? code(
120
- formatCompact(result.data, resolvedName, result.data.import),
121
- )
122
- : code(
123
- formatFull(result.data, {
124
- themeData,
125
- importHint: result.data.import,
126
- }),
127
- ),
128
- );
129
- return out;
130
- }
131
- case 'component.detail.props':
132
- return [code(formatProps({props: result.data}, resolvedName))];
133
- case 'component.detail.source':
134
- case 'component.detail.showcase':
135
- return [code(result.data.source)];
136
- case 'component.detail.blocks': {
137
- const {showcase, examples, related} = result.data;
138
- /** @type {import('../../formatters/index.mjs').Block[]} */
139
- const out = [];
140
- if (showcase) {
141
- out.push(
142
- section('Showcase'),
143
- record(showcase, {fields: ['displayName', 'description']}),
144
- );
145
- }
146
- if (examples.length > 0) {
147
- out.push(
148
- section('Examples'),
149
- records(examples, {fields: ['name', 'description']}),
150
- );
151
- }
152
- if (related.length > 0) {
153
- out.push(
154
- section(
155
- `Related: ${related.length} blocks that use ${result.data.component}`,
156
- ),
157
- list(related.map(block => block.name)),
158
- );
159
- }
160
- if (!showcase && examples.length === 0 && related.length === 0) {
161
- out.push(text(`No blocks found for ${result.data.component}`));
162
- }
163
- return out;
164
- }
165
- default:
166
- return [];
167
- }
168
- }
169
-
170
85
  /**
171
86
  * @param {import('commander').Command} program
172
87
  */
173
88
  export function registerComponent(program) {
174
89
  defineCommand(program, componentCommand, {
175
90
  fn: componentFn,
176
- action: async (
177
- /** @type {string[] | undefined} */ names,
178
- /** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options,
179
- ) => {
91
+ action: async (/** @type {string | undefined} */ name, /** @type {{list?: boolean, category?: string, props?: boolean, source?: boolean, showcase?: boolean, blocks?: boolean, package?: string}} */ options) => {
180
92
  const run = getCliInvocation();
181
- const name = names?.length === 1 ? names[0] : undefined;
182
- const apiInput = !names?.length ? undefined : name ?? names;
183
93
  const zh = program.opts().zh || false;
184
94
  const dense = program.opts().dense || false;
185
95
  const lang = program.opts().lang || null;
186
96
  const detailSource = program.getOptionValueSource('detail');
187
- const isListView = options.list || options.category || !names?.length;
97
+ const isListView = options.list || options.category || !name;
188
98
  // Default detail level is full for single-component view, brief for list views.
189
99
  // (List views are scannable name lists; users can opt into compact/full.)
190
100
  let detail = program.opts().detail || 'full';
@@ -209,7 +119,7 @@ export function registerComponent(program) {
209
119
  /** @type {ComponentResult} */
210
120
  let result;
211
121
  try {
212
- result = /** @type {ComponentResult} */ (await componentApi(apiInput, {
122
+ result = /** @type {ComponentResult} */ (await componentApi(name, {
213
123
  cwd: process.cwd(),
214
124
  list: options.list,
215
125
  category: options.category,
@@ -227,12 +137,6 @@ export function registerComponent(program) {
227
137
  }
228
138
 
229
139
  const answered = summarize(result);
230
- if (
231
- result.type === 'component.batch' &&
232
- result.data.results.some(row => row.status !== 'found')
233
- ) {
234
- process.exitCode = 1;
235
- }
236
140
  if (json) {
237
141
  jsonOut(result);
238
142
  return answered;
@@ -248,7 +152,7 @@ export function registerComponent(program) {
248
152
  const listFooter = text(
249
153
  [
250
154
  `Import from the path shown (e.g. import {Button} from '@astryxdesign/core/Button')`,
251
- `Usage: ${run} component <name> [name...]`,
155
+ `Usage: ${run} component <name>`,
252
156
  ].join('\n'),
253
157
  );
254
158
 
@@ -327,65 +231,64 @@ export function registerComponent(program) {
327
231
  break;
328
232
  }
329
233
 
330
- case 'component.batch': {
234
+ case 'component.detail': {
235
+ const resolvedName = (name || '').replace(/^XDS/, '');
236
+ const importHint = result.data.import;
237
+ if (result.data.parentDoc) emit(record(result.data, {fields: ['parentDoc']}));
238
+ const doc =
239
+ detail === 'brief'
240
+ ? code(formatBrief(result.data, resolvedName, importHint, {themeData}))
241
+ : detail === 'compact'
242
+ ? code(formatCompact(result.data, resolvedName, importHint))
243
+ : code(formatFull(result.data, {themeData, importHint}));
244
+ emit(doc);
245
+ break;
246
+ }
247
+
248
+ case 'component.detail.props': {
249
+ const resolvedName = (name || '').replace(/^XDS/, '');
250
+ emit(code(formatProps({props: result.data}, resolvedName)));
251
+ break;
252
+ }
253
+
254
+ case 'component.detail.source': {
255
+ emit(code(result.data.source));
256
+ break;
257
+ }
258
+
259
+ case 'component.detail.showcase': {
260
+ emit(code(result.data.source));
261
+ break;
262
+ }
263
+
264
+ case 'component.detail.blocks': {
265
+ const {showcase, examples, related} = result.data;
331
266
  /** @type {import('../../formatters/index.mjs').Block[]} */
332
- const out = [
333
- section('Component batch'),
334
- record({count: result.data.count}),
335
- section('Results'),
336
- ];
337
- for (const row of result.data.results) {
338
- out.push(section(row.selector));
339
- if (row.status === 'found') {
340
- out.push(
341
- record(row, {fields: ['selector', 'status']}),
342
- section('Result'),
343
- ...componentDetailBlocks(
344
- row.result,
345
- row.selector,
346
- detail,
347
- themeData,
348
- ),
349
- );
350
- continue;
351
- }
267
+ const out = [];
268
+ if (showcase) {
352
269
  out.push(
353
- record(row, {
354
- fields: ['selector', 'status', 'code', 'error'],
355
- }),
270
+ section('Showcase'),
271
+ record(showcase, {fields: ['displayName', 'description']}),
356
272
  );
357
- if (row.status === 'ambiguous') {
358
- out.push(
359
- section('Candidates'),
360
- records(row.candidates, {
361
- fields: ['package', 'component', 'kind', 'installed'],
362
- }),
363
- );
364
- } else if (row.suggestions?.length) {
365
- out.push(
366
- section('Suggestions'),
367
- records(row.suggestions, {fields: ['name', 'reason']}),
368
- );
369
- }
273
+ }
274
+ if (examples.length > 0) {
275
+ out.push(
276
+ section('Examples'),
277
+ records(examples, {fields: ['name', 'description']}),
278
+ );
279
+ }
280
+ if (related.length > 0) {
281
+ out.push(
282
+ section(`Related: ${related.length} blocks that use ${result.data.component}`),
283
+ list(related.map(b => b.name)),
284
+ );
285
+ }
286
+ if (!showcase && examples.length === 0 && related.length === 0) {
287
+ out.push(text(`No blocks found for ${result.data.component}`));
370
288
  }
371
289
  emit(...out);
372
290
  break;
373
291
  }
374
-
375
- case 'component.detail':
376
- case 'component.detail.props':
377
- case 'component.detail.source':
378
- case 'component.detail.showcase':
379
- case 'component.detail.blocks':
380
- emit(
381
- ...componentDetailBlocks(
382
- result,
383
- name ?? '',
384
- detail,
385
- themeData,
386
- ),
387
- );
388
- break;
389
292
  }
390
293
  return answered;
391
294
  },
@@ -277,95 +277,6 @@ describe('component() — integration ownership via config', () => {
277
277
  expect(result.data.import).toBe(`${INTEGRATION_NAME}/Toolbar/Search`);
278
278
  });
279
279
 
280
- it('reports every installed candidate for an ambiguous batch selector', async () => {
281
- createFixture({extraComponent: 'AppShell'});
282
- const result = await component(['MetaAppShell', 'AppShell'], {cwd: tmpDir});
283
- expect(result.type).toBe('component.batch');
284
- expect(result.data.results[0]).toMatchObject({
285
- selector: 'MetaAppShell',
286
- status: 'found',
287
- });
288
- expect(result.data.results[1]).toMatchObject({
289
- selector: 'AppShell',
290
- status: 'ambiguous',
291
- code: 'ERR_UNKNOWN_COMPONENT',
292
- });
293
- expect(result.data.results[1].candidates).toEqual(
294
- expect.arrayContaining([
295
- {
296
- package: CORE_PACKAGE,
297
- component: 'AppShell',
298
- kind: 'component',
299
- installed: true,
300
- },
301
- {
302
- package: INTEGRATION_NAME,
303
- component: 'AppShell',
304
- kind: 'component',
305
- installed: true,
306
- },
307
- ]),
308
- );
309
- });
310
-
311
- it('keeps the single-result envelope for one package-qualified selector', async () => {
312
- createFixture();
313
- const result = await component('@test/meta@1.2.3/MetaAppShell', {
314
- cwd: tmpDir,
315
- });
316
- expect(result.type).toBe('component.detail');
317
- expect(result.data).toMatchObject({
318
- name: 'MetaAppShell',
319
- package: INTEGRATION_NAME,
320
- });
321
- });
322
-
323
- it('resolves an exact installed package version and refuses another version', async () => {
324
- createFixture();
325
- const result = await component(
326
- [
327
- '@test/meta@1.2.3/MetaAppShell',
328
- '@test/meta@9.9.9/MetaAppShell',
329
- ],
330
- {cwd: tmpDir},
331
- );
332
- expect(result.type).toBe('component.batch');
333
- expect(result.data.results[0]).toMatchObject({
334
- selector: '@test/meta@1.2.3/MetaAppShell',
335
- status: 'found',
336
- result: {type: 'component.detail'},
337
- });
338
- expect(result.data.results[1]).toMatchObject({
339
- selector: '@test/meta@9.9.9/MetaAppShell',
340
- status: 'not_found',
341
- code: 'ERR_UNKNOWN_PACKAGE',
342
- suggestions: [
343
- {
344
- name: 'astryx discover @test/meta@9.9.9',
345
- reason: 'look up this package version',
346
- },
347
- ],
348
- });
349
- });
350
-
351
- it('reports a package-qualified selector that conflicts with --package', async () => {
352
- createFixture();
353
- const result = await component(
354
- ['@test/meta/MetaAppShell', 'Button'],
355
- {cwd: tmpDir, package: CORE_PACKAGE},
356
- );
357
- expect(result.type).toBe('component.batch');
358
- expect(result.data.results[0]).toMatchObject({
359
- selector: '@test/meta/MetaAppShell',
360
- status: 'error',
361
- code: 'ERR_INVALID_ARGUMENT',
362
- });
363
- expect(result.data.results[1]).toMatchObject({
364
- selector: 'Button',
365
- status: 'found',
366
- });
367
- });
368
-
369
280
  it('JSON list includes integration components as {name, package} objects', async () => {
370
281
  createFixture();
371
282
  const result = await component(undefined, {cwd: tmpDir, list: true});
@@ -16,23 +16,11 @@ export const doc = {
16
16
  namespace: 'cli/commands',
17
17
  summary: 'List components or print component docs',
18
18
  description:
19
- 'Resolves one or several components by exact selector across core and integration ' +
20
- 'packages and prints each authored doc, or lists the catalog grouped by category. ' +
21
- "Use 'Button', 'widgets/Button', '@acme/widgets/Button', or " +
22
- "'@acme/widgets@1.2.3/Button'. A version applies to the package and must match the " +
23
- 'installed version. Boolean flags narrow every resolved component to just its props, ' +
24
- 'source, showcase, or example blocks.',
19
+ 'Resolves a component by name across core and integration packages and prints ' +
20
+ 'its authored doc, or lists the catalog grouped by category. Boolean flags narrow ' +
21
+ 'a single component to just its props, source, showcase, or example blocks.',
25
22
  fn: 'component',
26
- args: [
27
- {
28
- name: 'names',
29
- param: 'name',
30
- description:
31
- 'One or more exact selectors. Use Name, package/Name, @scope/package/Name, or @scope/package@version/Name. Two or more return one ordered batch. At most 100 selectors are accepted.',
32
- required: false,
33
- variadic: true,
34
- },
35
- ],
23
+ args: [{name: 'name', param: 'name', required: false}],
36
24
  options: [
37
25
  {
38
26
  flag: '--list',
@@ -67,16 +55,11 @@ export const doc = {
67
55
  {
68
56
  flag: '--package <name>',
69
57
  param: 'options.package',
70
- description:
71
- 'Scope lookup to an external package (e.g. @acme/xds-widgets)',
58
+ description: 'Scope lookup to an external package (e.g. @acme/xds-widgets)',
72
59
  },
73
60
  ],
74
61
  examples: [
75
62
  {label: 'Browse the catalog', cli: 'astryx component --list'},
76
- {
77
- label: 'Look up several components',
78
- cli: 'astryx component Button Badge Text',
79
- },
80
63
  {
81
64
  label: 'Props table as JSON',
82
65
  cli: 'astryx component XDSButton --props --json',
@@ -86,7 +69,7 @@ export const doc = {
86
69
  {code: 0, when: 'success'},
87
70
  {
88
71
  code: 1,
89
- when: 'unknown component, category, or package; more than 100 selectors; any batch row is unresolved; or @astryxdesign/core cannot be resolved',
72
+ when: 'unknown component, category, or package, or @astryxdesign/core cannot be resolved',
90
73
  },
91
74
  ],
92
75
  related: ['search', 'hook', 'docs', 'template', 'swizzle'],
@@ -179,9 +179,9 @@ describe('DebugEvent result summary', () => {
179
179
  it(
180
180
  'says so explicitly when a command has no result set',
181
181
  async () => {
182
- // Bare `integration` prints its subcommand list: nothing was looked
182
+ // `layout check` returns a verdict on one expression: nothing was looked
183
183
  // up, and the run says that rather than leaving four ambiguous nulls.
184
- const {event} = await runWithDebug(['integration']);
184
+ const {event} = await runWithDebug(['layout', 'check', 'VStack>Text']);
185
185
  expect(event.output).toMatchObject({
186
186
  resultKind: 'none',
187
187
  resultCount: null,
@@ -216,34 +216,6 @@ describe('the docs tree, one level at a time', () => {
216
216
  expect(JSON.parse(both.stdout).code).toBe('ERR_INVALID_ARGUMENT');
217
217
  }, SLOW);
218
218
 
219
- it('reads the component lookup guide and its output/API examples', async () => {
220
- const index = await runCli([
221
- 'docs',
222
- 'cli/component-lookups',
223
- '--index',
224
- ]);
225
- expect(index.status).toBe(0);
226
- expect(index.stdout).toContain('several');
227
- expect(index.stdout).toContain('selectors');
228
- expect(index.stdout).toContain('output');
229
- expect(index.stdout).toContain('api');
230
-
231
- const output = await runCli([
232
- 'docs',
233
- 'cli/component-lookups',
234
- 'output',
235
- ]);
236
- expect(output.status).toBe(0);
237
- expect(output.stdout).toContain('component.batch');
238
- expect(output.stdout).toContain('ERR_UNKNOWN_COMPONENT');
239
- expect(output.stdout).toContain('exits 1');
240
-
241
- const api = await runCli(['docs', 'cli/component-lookups', 'api']);
242
- expect(api.status).toBe(0);
243
- expect(api.stdout).toContain('component([])');
244
- expect(api.stdout).toContain("component(['Button'])");
245
- }, SLOW);
246
-
247
219
  it('reads the integration guide by its route, and not by its old name', async () => {
248
220
  const guide = await runCli(['docs', 'cli/integrations', '--index']);
249
221
  expect(guide.status).toBe(0);
@@ -280,7 +252,6 @@ describe('the docs tree, one level at a time', () => {
280
252
  const error = JSON.parse(section.stdout);
281
253
  expect(error).toMatchObject({code: 'ERR_UNKNOWN_SECTION'});
282
254
  expect(error.suggestions.map(s => s.name)).toEqual([
283
- 'cli/component-lookups',
284
255
  'cli/integrations',
285
256
  'cli/writing-docs',
286
257
  'cli/commands',