@astryxdesign/cli 0.6.3-canary.f839b67 → 0.6.4-canary.06c8fa3

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 (189) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/README.md +64 -66
  3. package/api/component/_adapter.d.mts +25 -0
  4. package/api/component/_adapter.mjs +59 -5
  5. package/api/component/component.d.mts +6 -3
  6. package/api/component/component.doc.mjs +23 -10
  7. package/api/component/component.mjs +249 -9
  8. package/api/component/component.type.d.mts +25 -0
  9. package/api/component/component.type.mjs +44 -0
  10. package/api/discover/_adapter.d.mts +114 -6
  11. package/api/discover/_adapter.mjs +372 -17
  12. package/api/discover/_adapter.test.mjs +215 -0
  13. package/api/discover/_catalog-view.d.mts +115 -0
  14. package/api/discover/_catalog-view.mjs +203 -0
  15. package/api/discover/_catalog-view.test.mjs +128 -0
  16. package/api/discover/detail/detail.d.mts +18 -6
  17. package/api/discover/detail/detail.mjs +67 -13
  18. package/api/discover/detail/detail.test.mjs +85 -0
  19. package/api/discover/detail/item/item.d.mts +26 -0
  20. package/api/discover/detail/item/item.mjs +78 -0
  21. package/api/discover/detail/item/item.test.mjs +73 -0
  22. package/api/discover/discover.d.mts +3 -9
  23. package/api/discover/discover.doc.mjs +61 -18
  24. package/api/discover/discover.mjs +220 -36
  25. package/api/discover/discover.test.mjs +11 -2
  26. package/api/discover/discover.type.d.mts +147 -8
  27. package/api/discover/discover.type.mjs +102 -12
  28. package/api/discover/list/list.d.mts +20 -6
  29. package/api/discover/list/list.mjs +45 -12
  30. package/api/discover/list/list.test.mjs +46 -0
  31. package/api/discover/search/search.d.mts +18 -16
  32. package/api/discover/search/search.mjs +102 -56
  33. package/api/discover/search/search.test.mjs +144 -10
  34. package/api/docs/_adapter.d.mts +49 -7
  35. package/api/docs/_adapter.mjs +284 -33
  36. package/api/docs/docs.doc.mjs +4 -3
  37. package/api/docs/docs.test.mjs +2 -0
  38. package/api/docs/docs.type.d.mts +21 -5
  39. package/api/docs/docs.type.mjs +21 -5
  40. package/api/docs/integration-tree.test.mjs +9 -1
  41. package/api/docs/reference-blocks.test.mjs +406 -0
  42. package/api/doctor/doctor.d.mts +8 -3
  43. package/api/doctor/doctor.mjs +95 -10
  44. package/api/doctor/doctor.test.mjs +122 -10
  45. package/api/index.d.mts +1 -2
  46. package/api/index.mjs +4 -4
  47. package/api/integration/add-helpers.d.mts +5 -2
  48. package/api/integration/add-helpers.mjs +36 -9
  49. package/api/integration/authoring-checks.mjs +14 -1
  50. package/api/integration/pack-check.lifecycle-output.test.mjs +105 -0
  51. package/api/integration/pack-check.mjs +28 -3
  52. package/api/json/index.ts +0 -1
  53. package/api/search/search.test.mjs +18 -0
  54. package/api/template/table-floating-bulk-actions.test.mjs +66 -0
  55. package/api/template/template-integration.test.mjs +1 -65
  56. package/api/template/template.mjs +1 -1
  57. package/api/theme/add/add.mjs +17 -25
  58. package/api/theme/add/add.rollback.test.mjs +158 -0
  59. package/api/theme/add/add.staging.test.mjs +40 -23
  60. package/api/theme/build/build.family.test.mjs +7 -12
  61. package/api/theme/build/build.mjs +8 -18
  62. package/api/theme/build/build.rollback.test.mjs +148 -0
  63. package/api/upgrade/run/files-changed.test.mjs +111 -0
  64. package/api/upgrade/run/run.mjs +6 -4
  65. package/api/upgrade/upgrade.type.mjs +2 -2
  66. package/assets/codemods/__tests__/registry.test.mjs +1 -0
  67. package/assets/codemods/__tests__/runner.test.mjs +3 -1
  68. package/assets/codemods/file-count.test.mjs +163 -0
  69. package/assets/codemods/integration-runner.mjs +3 -3
  70. package/assets/codemods/registry.mjs +1 -0
  71. package/assets/codemods/runner.mjs +5 -4
  72. package/assets/codemods/transforms/next/index.mjs +1 -19
  73. package/assets/codemods/transforms/v0.6.4/index.mjs +31 -0
  74. package/assets/docs/internationalization.doc.mjs +7 -5
  75. package/assets/docs/styling-libraries.doc.mjs +1 -1
  76. package/assets/docs/theme.doc.mjs +1 -1
  77. package/assets/docs/tree/component-lookups.doc.mjs +149 -0
  78. package/assets/docs/tree/integrations.doc.mjs +20 -1
  79. package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
  80. package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
  81. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  82. package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
  83. package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
  84. package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
  85. package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
  86. package/authoring/config/config.doc.mjs +9 -1
  87. package/authoring/config/parse.d.mts +2 -0
  88. package/authoring/config/parse.mjs +19 -0
  89. package/authoring/config/parse.test.mjs +8 -0
  90. package/authoring/config/type.ts +13 -2
  91. package/authoring/discover/discover.doc.d.mts +13 -0
  92. package/authoring/discover/discover.doc.mjs +138 -0
  93. package/authoring/discover/parse.d.mts +24 -0
  94. package/authoring/discover/parse.mjs +128 -0
  95. package/authoring/discover/parse.test.mjs +124 -0
  96. package/authoring/discover/type.ts +87 -0
  97. package/authoring/doctypes/_schema.d.mts +72 -0
  98. package/authoring/doctypes/_schema.mjs +25 -1
  99. package/authoring/doctypes/command/command.doc.mjs +1 -1
  100. package/authoring/doctypes/command/type.ts +1 -1
  101. package/authoring/doctypes/load-contract.test.mjs +25 -0
  102. package/authoring/doctypes/reference/reference.doc.mjs +31 -4
  103. package/authoring/doctypes/reference/type.ts +20 -5
  104. package/authoring/index.d.mts +1 -0
  105. package/authoring/index.d.ts +10 -0
  106. package/authoring/index.mjs +1 -0
  107. package/clients/cli/command-result-coverage.test.mjs +7 -7
  108. package/clients/cli/commands/component/index.mjs +152 -55
  109. package/clients/cli/commands/component-batch.test.mjs +341 -0
  110. package/clients/cli/commands/component-ownership.test.mjs +89 -0
  111. package/clients/cli/commands/component.doc.mjs +23 -6
  112. package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
  113. package/clients/cli/commands/discover.doc.mjs +53 -9
  114. package/clients/cli/commands/discover.mjs +393 -118
  115. package/clients/cli/commands/discover.sources.test.mjs +267 -0
  116. package/clients/cli/commands/docs.mjs +2 -2
  117. package/clients/cli/commands/docs.test.mjs +29 -0
  118. package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
  119. package/clients/cli/commands/text-json-parity.test.mjs +0 -17
  120. package/clients/cli/index.mjs +0 -4
  121. package/clients/cli/lib/exit-codes.test.mjs +1 -8
  122. package/clients/cli/lib/json-shim.mjs +24 -14
  123. package/clients/cli/lib/json-shim.test.mjs +6 -20
  124. package/clients/cli/lib/manifest.mjs +3 -8
  125. package/clients/cli/lib/manifest.test.mjs +5 -2
  126. package/clients/cli/lib/parse-error-format.test.mjs +81 -0
  127. package/foundation/discovery/authoring-self-docs.d.mts +12 -0
  128. package/foundation/discovery/authoring-self-docs.mjs +21 -8
  129. package/foundation/discovery/authoring-self-docs.test.mjs +7 -2
  130. package/foundation/discovery/docs-discovery.d.mts +4 -1
  131. package/foundation/discovery/docs-discovery.mjs +40 -6
  132. package/foundation/discovery/docs-discovery.test.mjs +40 -0
  133. package/foundation/discovery/template-adapter.mjs +1 -1
  134. package/foundation/doc-compiler/doc-loads.test.mjs +0 -12
  135. package/foundation/doc-compiler/lenses.d.mts +5 -3
  136. package/foundation/doc-compiler/lenses.mjs +48 -3
  137. package/foundation/doc-compiler/links.d.mts +30 -3
  138. package/foundation/doc-compiler/links.mjs +46 -5
  139. package/foundation/doc-compiler/links.test.mjs +53 -0
  140. package/foundation/doc-compiler/tree.test.mjs +9 -1
  141. package/foundation/integrations/cli-requirement.test.mjs +17 -42
  142. package/foundation/integrations/integrations.d.mts +14 -1
  143. package/foundation/integrations/integrations.mjs +41 -1
  144. package/foundation/integrations/integrations.test.mjs +31 -0
  145. package/foundation/response/batch.type.d.mts +33 -0
  146. package/foundation/response/batch.type.mjs +34 -0
  147. package/foundation/response/response-types.doc.mjs +15 -21
  148. package/foundation/response/response-types.doc.test.mjs +23 -0
  149. package/foundation/xle/browser.d.mts +3 -3
  150. package/foundation/xle/browser.mjs +3 -3
  151. package/foundation/xle/expand.mjs +2 -2
  152. package/foundation/xle/parse.mjs +1 -1
  153. package/foundation/xle/print.mjs +2 -2
  154. package/foundation/xle/splice.mjs +1 -1
  155. package/package.json +9 -9
  156. package/api/layout/_adapter.d.mts +0 -34
  157. package/api/layout/_adapter.mjs +0 -148
  158. package/api/layout/check/check.d.mts +0 -16
  159. package/api/layout/check/check.mjs +0 -40
  160. package/api/layout/expand/expand.d.mts +0 -22
  161. package/api/layout/expand/expand.mjs +0 -155
  162. package/api/layout/expand/expand.path-safety.test.mjs +0 -53
  163. package/api/layout/grammar/grammar.d.mts +0 -13
  164. package/api/layout/grammar/grammar.mjs +0 -87
  165. package/api/layout/layout.d.mts +0 -6
  166. package/api/layout/layout.mjs +0 -17
  167. package/api/layout/layout.test.mjs +0 -297
  168. package/api/layout/layout.type.d.mts +0 -89
  169. package/api/layout/layout.type.mjs +0 -103
  170. package/api/layout/layoutCheck.doc.d.mts +0 -11
  171. package/api/layout/layoutCheck.doc.mjs +0 -85
  172. package/api/layout/layoutExpand.doc.d.mts +0 -11
  173. package/api/layout/layoutExpand.doc.mjs +0 -107
  174. package/api/layout/layoutGrammar.doc.d.mts +0 -11
  175. package/api/layout/layoutGrammar.doc.mjs +0 -57
  176. package/clients/cli/commands/layout-check.doc.mjs +0 -65
  177. package/clients/cli/commands/layout-expand.doc.mjs +0 -83
  178. package/clients/cli/commands/layout-grammar.doc.mjs +0 -30
  179. package/clients/cli/commands/layout.doc.mjs +0 -34
  180. package/clients/cli/commands/layout.error-codes.test.mjs +0 -66
  181. package/clients/cli/commands/layout.exit-parity.test.mjs +0 -41
  182. package/clients/cli/commands/layout.mjs +0 -275
  183. package/clients/cli/commands/layout.path-help.test.mjs +0 -33
  184. package/clients/cli/commands/layout.stdin-cap.test.mjs +0 -47
  185. package/clients/cli/commands/layout.text-fields.test.mjs +0 -39
  186. /package/assets/codemods/transforms/{next → v0.6.4}/__tests__/migrate-native-picker-to-presentation.test.mjs +0 -0
  187. /package/assets/codemods/transforms/{next → v0.6.4}/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +0 -0
  188. /package/assets/codemods/transforms/{next → v0.6.4}/migrate-native-picker-to-presentation.mjs +0 -0
  189. /package/assets/codemods/transforms/{next → v0.6.4}/migrate-theme-catalog-to-descriptors.mjs +0 -0
@@ -45,7 +45,7 @@ export function findManifestPaths(dir: string): string[];
45
45
  * @param {string} file absolute manifest path
46
46
  * @param {string} [label] used in error messages
47
47
  * @param {{fresh?: boolean}} [options]
48
- * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, agentDocsError?: string}>}
48
+ * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string}>}
49
49
  */
50
50
  export function loadManifest(file: string, label?: string, { fresh }?: {
51
51
  fresh?: boolean;
@@ -55,6 +55,8 @@ export function loadManifest(file: string, label?: string, { fresh }?: {
55
55
  debug?: import("../../authoring/debug/type").DebugEventHandler;
56
56
  gapReport?: import("../../authoring/gap-report/type").GapReportHandler;
57
57
  gapReportError?: string;
58
+ discover?: import("../../authoring/discover/type").DiscoverSource;
59
+ discoverError?: string;
58
60
  agentDocsError?: string;
59
61
  }>;
60
62
  /**
@@ -154,6 +156,9 @@ export function loadIntegrations(specs?: string[], { cwd, fresh, resolveProvider
154
156
  * validated package-owned handler from the `gapReport` NAMED export.
155
157
  * @property {string} [__gapReportError] isolated named-handler validation error.
156
158
  * Named exports are not manifest keys — see {@link loadManifest}.
159
+ * @property {import('../../authoring/discover/type').DiscoverSource} [__discover]
160
+ * validated catalog source from the `discover` NAMED export.
161
+ * @property {string} [__discoverError] isolated discover-source validation error.
157
162
  */
158
163
  /** Conventional manifest basenames, in load-precedence order. */
159
164
  export const MANIFEST_BASENAMES: string[];
@@ -245,4 +250,12 @@ export type LoadedIntegration = {
245
250
  * Named exports are not manifest keys — see {@link loadManifest}.
246
251
  */
247
252
  __gapReportError?: string | undefined;
253
+ /**
254
+ * validated catalog source from the `discover` NAMED export.
255
+ */
256
+ __discover?: import("../../authoring/discover/type").DiscoverSource | undefined;
257
+ /**
258
+ * isolated discover-source validation error.
259
+ */
260
+ __discoverError?: string | undefined;
248
261
  };
@@ -29,6 +29,7 @@ import {
29
29
  } from '../../authoring/integration/schema.mjs';
30
30
  import {importUserModule, findPresentFiles} from '../fs/module-loader.mjs';
31
31
  import {parseGapReportHandler} from '../../authoring/gap-report/parse.mjs';
32
+ import {parseDiscoverSource} from '../../authoring/discover/parse.mjs';
32
33
  import {resolveProviders} from './provider-resolution.mjs';
33
34
 
34
35
  /**
@@ -80,6 +81,9 @@ import {resolveProviders} from './provider-resolution.mjs';
80
81
  * validated package-owned handler from the `gapReport` NAMED export.
81
82
  * @property {string} [__gapReportError] isolated named-handler validation error.
82
83
  * Named exports are not manifest keys — see {@link loadManifest}.
84
+ * @property {import('../../authoring/discover/type').DiscoverSource} [__discover]
85
+ * validated catalog source from the `discover` NAMED export.
86
+ * @property {string} [__discoverError] isolated discover-source validation error.
83
87
  */
84
88
 
85
89
  /** Conventional manifest basenames, in load-precedence order. */
@@ -167,6 +171,23 @@ function parseGapReportHandlerExport(value, label) {
167
171
  }
168
172
  }
169
173
 
174
+ /**
175
+ * Parse the optional named discover source the same way: a malformed one is
176
+ * isolated from every other contribution and reported by `astryx discover`.
177
+ *
178
+ * @param {unknown} value
179
+ * @param {string} label
180
+ * @returns {{source?: import('../../authoring/discover/type').DiscoverSource, error?: string}}
181
+ */
182
+ function parseDiscoverSourceExport(value, label) {
183
+ if (value === undefined) return {};
184
+ try {
185
+ return {source: parseDiscoverSource(value, `${label} named export "discover"`)};
186
+ } catch (error) {
187
+ return {error: error instanceof Error ? error.message : String(error)};
188
+ }
189
+ }
190
+
170
191
  /**
171
192
  * Load and validate a manifest module's default export, while isolating the
172
193
  * optional `agentDocs` contribution from the manifest's other fields.
@@ -183,7 +204,7 @@ function parseGapReportHandlerExport(value, label) {
183
204
  * @param {string} file absolute manifest path
184
205
  * @param {string} [label] used in error messages
185
206
  * @param {{fresh?: boolean}} [options]
186
- * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, agentDocsError?: string}>}
207
+ * @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string}>}
187
208
  */
188
209
  export async function loadManifest(
189
210
  file,
@@ -194,6 +215,7 @@ export async function loadManifest(
194
215
  const raw = mod?.default;
195
216
  const baseManifest = parseIntegrationBase(raw, label);
196
217
  const gapReport = parseGapReportHandlerExport(mod?.gapReport, label);
218
+ const discover = parseDiscoverSourceExport(mod?.discover, label);
197
219
  const hasAgentDocs =
198
220
  raw != null &&
199
221
  typeof raw === 'object' &&
@@ -228,6 +250,8 @@ export async function loadManifest(
228
250
  : undefined,
229
251
  gapReport: gapReport.handler,
230
252
  gapReportError: gapReport.error,
253
+ discover: discover.source,
254
+ discoverError: discover.error,
231
255
  agentDocsError,
232
256
  };
233
257
  }
@@ -345,6 +369,10 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
345
369
  let gapReportHandler;
346
370
  /** @type {string | undefined} */
347
371
  let gapReportError;
372
+ /** @type {import('../../authoring/discover/type').DiscoverSource | undefined} */
373
+ let discoverSource;
374
+ /** @type {string | undefined} */
375
+ let discoverError;
348
376
  /** @type {string | undefined} */
349
377
  let agentDocsError;
350
378
  try {
@@ -354,6 +382,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
354
382
  debug: debugHandler,
355
383
  gapReport: gapReportHandler,
356
384
  gapReportError,
385
+ discover: discoverSource,
386
+ discoverError,
357
387
  agentDocsError,
358
388
  } = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
359
389
  } catch (err) {
@@ -397,6 +427,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
397
427
  __debug: debugHandler,
398
428
  __gapReport: gapReportHandler,
399
429
  __gapReportError: gapReportError,
430
+ __discover: discoverSource,
431
+ __discoverError: discoverError,
400
432
  __spec: spec,
401
433
  __packageDir: packageDir,
402
434
  __packageExports: pkg.exports ?? null,
@@ -448,6 +480,10 @@ export async function loadIntegrations(
448
480
  let gapReportHandler;
449
481
  /** @type {string | undefined} */
450
482
  let gapReportError;
483
+ /** @type {import('../../authoring/discover/type').DiscoverSource | undefined} */
484
+ let discoverSource;
485
+ /** @type {string | undefined} */
486
+ let discoverError;
451
487
  /** @type {string | undefined} */
452
488
  let agentDocsError;
453
489
  try {
@@ -457,6 +493,8 @@ export async function loadIntegrations(
457
493
  debug: debugHandler,
458
494
  gapReport: gapReportHandler,
459
495
  gapReportError,
496
+ discover: discoverSource,
497
+ discoverError,
460
498
  agentDocsError,
461
499
  } = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
462
500
  } catch (err) {
@@ -507,6 +545,8 @@ export async function loadIntegrations(
507
545
  __debug: debugHandler,
508
546
  __gapReport: gapReportHandler,
509
547
  __gapReportError: gapReportError,
548
+ __discover: discoverSource,
549
+ __discoverError: discoverError,
510
550
  __spec: spec,
511
551
  __packageDir: packageDir,
512
552
  __packageExports: pkg.exports ?? null,
@@ -785,3 +785,34 @@ describe('the `gapReport` named export', () => {
785
785
  expect(loaded.__unknownKeys).toEqual(['gapReport']);
786
786
  });
787
787
  });
788
+
789
+ describe('the `discover` named export', () => {
790
+ it('is carried out of the manifest module as __discover', async () => {
791
+ writeManifestPackage(tmpDir, {
792
+ body:
793
+ `export async function discover() { return {schemaVersion: 1}; }\n` +
794
+ `export default {issuesUrl: 'https://example.com/i'};\n`,
795
+ });
796
+
797
+ const [loaded] = await loadIntegrations(['@acme/widgets'], {cwd: tmpDir});
798
+
799
+ expect(typeof loaded.__discover).toBe('function');
800
+ expect(loaded.__discoverError).toBeUndefined();
801
+ expect(loaded.__unknownKeys).toEqual([]);
802
+ expect(loaded.issuesUrl).toBe('https://example.com/i');
803
+ });
804
+
805
+ it('keeps the manifest and records why when the export is not a function', async () => {
806
+ writeManifestPackage(tmpDir, {
807
+ body:
808
+ `export const discover = {url: 'https://example.com/catalog.json'};\n` +
809
+ `export default {issuesUrl: 'https://example.com/i'};\n`,
810
+ });
811
+
812
+ const [loaded] = await loadIntegrations(['@acme/widgets'], {cwd: tmpDir});
813
+
814
+ expect(loaded.__discover).toBeUndefined();
815
+ expect(loaded.__discoverError).toContain('must be a function');
816
+ expect(loaded.issuesUrl).toBe('https://example.com/i');
817
+ });
818
+ });
@@ -0,0 +1,33 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * One complete row for an accepted selector.
6
+ */
7
+ export type BatchRow<TResult, TCandidate> = ({
8
+ selector: string;
9
+ status: "found";
10
+ result: TResult;
11
+ } | {
12
+ selector: string;
13
+ status: "ambiguous";
14
+ code: string;
15
+ error: string;
16
+ candidates: TCandidate[];
17
+ } | {
18
+ selector: string;
19
+ status: "not_found" | "error";
20
+ code: string;
21
+ error: string;
22
+ suggestions?: import("./base").Suggestion[];
23
+ });
24
+ /**
25
+ * One ordered batch receipt inside the shared `{type, data}` success envelope.
26
+ */
27
+ export type BatchResponse<TType extends string, TResult, TCandidate> = {
28
+ type: TType;
29
+ data: {
30
+ count: number;
31
+ results: BatchRow<TResult, TCandidate>[];
32
+ };
33
+ };
@@ -0,0 +1,34 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Shared published types for complete multi-selector lookup receipts.
5
+ * Adopting API subjects specialize these types with their single-result and
6
+ * ambiguity-candidate types instead of defining command-specific row shapes.
7
+ *
8
+ * @input One exact selector, its single-result response, and its candidate shape.
9
+ * @output BatchRow and BatchResponse for every AST-053 lookup adopter.
10
+ * @position packages/cli/foundation/response — shared JSON response types
11
+ */
12
+
13
+ /**
14
+ * One complete row for an accepted selector.
15
+ * @template TResult
16
+ * @template TCandidate
17
+ * @typedef {(
18
+ * | {selector: string; status: 'found'; result: TResult}
19
+ * | {selector: string; status: 'ambiguous'; code: string; error: string; candidates: TCandidate[]}
20
+ * | {selector: string; status: 'not_found' | 'error'; code: string; error: string; suggestions?: import('./base').Suggestion[]}
21
+ * )} BatchRow
22
+ */
23
+
24
+ /**
25
+ * One ordered batch receipt inside the shared `{type, data}` success envelope.
26
+ * @template {string} TType
27
+ * @template TResult
28
+ * @template TCandidate
29
+ * @typedef {object} BatchResponse
30
+ * @property {TType} type
31
+ * @property {{count: number; results: BatchRow<TResult, TCandidate>[]}} data
32
+ */
33
+
34
+ export {};
@@ -37,6 +37,11 @@ export const doc = {
37
37
  description:
38
38
  'The component catalog grouped by category: `detail` (the level: names | compact | full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries, or a full ComponentDoc per entry.',
39
39
  },
40
+ {
41
+ value: 'component.batch',
42
+ description:
43
+ 'The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found | not_found | ambiguous | error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}).',
44
+ },
40
45
  {
41
46
  value: 'component.detail',
42
47
  description:
@@ -104,21 +109,27 @@ export const doc = {
104
109
  {
105
110
  value: 'discover.list',
106
111
  description:
107
- 'The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered".',
112
+ 'The integrations the project loads (name, category, components, version, a list per other kind they add, and latest when a source knows it); with a discover source, meta.available lists what the project could add and meta.sources reports each source; when empty it carries meta.configured to tell "nothing configured" from "nothing discovered".',
108
113
  },
109
114
  {
110
115
  value: 'discover.detail',
111
- description: 'A single external package entry, for an @scope/name query.',
116
+ description:
117
+ 'One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it.',
112
118
  },
113
119
  {
114
120
  value: 'discover.detail.doc',
115
121
  description:
116
- 'The validated ComponentDoc for one external component: an @scope/name/Component query, or a free-text term resolving to exactly one component.',
122
+ 'The validated ComponentDoc for one installed component, for an @scope/name/Component query.',
123
+ },
124
+ {
125
+ value: 'discover.item',
126
+ description:
127
+ 'One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package.',
117
128
  },
118
129
  {
119
130
  value: 'discover.search',
120
131
  description:
121
- 'The echoed query plus the matching {package, component} pairs, when a free-text term matches several components.',
132
+ 'The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list.',
122
133
  },
123
134
 
124
135
  // search
@@ -307,22 +318,5 @@ export const doc = {
307
318
  description:
308
319
  'The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
309
320
  },
310
-
311
- // layout (XLE/XLO)
312
- {
313
- value: 'layout.expand',
314
- description:
315
- 'The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written).',
316
- },
317
- {
318
- value: 'layout.check',
319
- description:
320
- 'The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline).',
321
- },
322
- {
323
- value: 'layout.grammar',
324
- description:
325
- "The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry.",
326
- },
327
321
  ],
328
322
  };
@@ -53,6 +53,29 @@ function expectNamed(type, fields) {
53
53
  }
54
54
 
55
55
  describe('response-types EnumDoc names every field', () => {
56
+ it('component.batch names every row field and state', async () => {
57
+ const res = await data(['component', 'Button', 'Badge']);
58
+ expect(res.type).toBe('component.batch');
59
+ expect(describedAs('component.batch')).toMatch(/BatchResponse.*BatchRow/);
60
+ expectNamed('component.batch', [
61
+ 'count',
62
+ 'results',
63
+ 'selector',
64
+ 'status',
65
+ 'result',
66
+ 'code',
67
+ 'error',
68
+ 'candidates',
69
+ 'package',
70
+ 'component',
71
+ 'kind',
72
+ 'installed',
73
+ 'suggestions',
74
+ 'name',
75
+ 'reason',
76
+ ]);
77
+ });
78
+
56
79
  it('component.detail: the ownership fields and parentDoc', async () => {
57
80
  const res = await data(['component', 'HStack']);
58
81
  expect(res.type).toBe('component.detail');
@@ -2,8 +2,8 @@
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
4
  /**
5
- * Validate an expression and return both canonical surfaces — the browser
6
- * twin of `layout check`. Never throws on invalid input; returns the errors.
5
+ * Validate an expression and return both canonical surfaces. Never throws on
6
+ * invalid input; returns the errors.
7
7
  *
8
8
  * @param {string} expression
9
9
  * @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
@@ -19,7 +19,7 @@ export function checkExpression(expression: string, registry: import("./xle-ast"
19
19
  loose?: boolean | undefined;
20
20
  }): import("./browser").CheckResult;
21
21
  /**
22
- * Validate + expand to TSX — the browser twin of `layout expand`.
22
+ * Validate + expand to TSX.
23
23
  * Returns either {code, ...} or {errors} (never writes files).
24
24
  *
25
25
  * @param {string} expression
@@ -44,8 +44,8 @@ function formatIssue(issue) {
44
44
  }
45
45
 
46
46
  /**
47
- * Validate an expression and return both canonical surfaces — the browser
48
- * twin of `layout check`. Never throws on invalid input; returns the errors.
47
+ * Validate an expression and return both canonical surfaces. Never throws on
48
+ * invalid input; returns the errors.
49
49
  *
50
50
  * @param {string} expression
51
51
  * @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
@@ -85,7 +85,7 @@ export function checkExpression(expression, registry, opts = {}) {
85
85
  }
86
86
 
87
87
  /**
88
- * Validate + expand to TSX — the browser twin of `layout expand`.
88
+ * Validate + expand to TSX.
89
89
  * Returns either {code, ...} or {errors} (never writes files).
90
90
  *
91
91
  * @param {string} expression
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @input validated doc (nodes carry .bound) + registry
15
15
  * @output expand() → {code, componentsUsed, states, todos}
16
- * @position lib/xle — last stage; api/layout.mjs orchestrates
16
+ * @position lib/xle — last stage; the browser barrel orchestrates
17
17
  */
18
18
 
19
19
  import {PAYLOAD_PROPS} from './validate.mjs';
@@ -751,7 +751,7 @@ export function expand(doc, registry, options = {}) {
751
751
  : [];
752
752
 
753
753
  const code = [
754
- `// Generated by \`astryx layout expand\` — this file is the artifact; edit freely.`,
754
+ `// Generated by the Astryx XLE expander — this file is the artifact; edit freely.`,
755
755
  ...importLines,
756
756
  ...blockSection,
757
757
  '',
@@ -302,7 +302,7 @@ function parseAttrToken(token, line) {
302
302
  * Guard against unbounded recursion in the compact parser. A layout tree this
303
303
  * deep is never hand-authored; without the cap the recursive descent blows the
304
304
  * JS call stack and surfaces a raw RangeError (→ ERR_UNKNOWN, no line/col)
305
- * instead of a located ERR_LAYOUT_PARSE. The counter is module-level so it
305
+ * instead of a located parse error. The counter is module-level so it
306
306
  * spans group / attribute sub-streams; each parse entry point resets it.
307
307
  */
308
308
  const MAX_COMPACT_DEPTH = 512;
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @file XLE canonical printers — AST → compact (XLE) or outline (XLO) text.
5
5
  *
6
- * Used by `astryx layout check --form …` so either party (agent or human)
7
- * can request the other surface, and by round-trip conformance tests.
6
+ * Used by `checkExpression` so either party (agent or human) can request the
7
+ * other surface, and by round-trip conformance tests.
8
8
  * Printing is best-effort canonical: spelling variants the lexer
9
9
  * normalized are emitted in canonical form.
10
10
  *
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @input block TSX source (splice) or a name+importPath (import)
20
20
  * @output prepareSpliceModule / parseImportStatements + import-merge helpers
21
- * @position lib/xle — used by expand.mjs; sources gathered in api/layout.mjs
21
+ * @position lib/xle — used by expand.mjs; sources gathered by the caller
22
22
  */
23
23
 
24
24
  const IMPORT_RE =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.3-canary.f839b67",
3
+ "version": "0.6.4-canary.06c8fa3",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -101,10 +101,10 @@
101
101
  "zod": "^4.4.3"
102
102
  },
103
103
  "peerDependencies": {
104
- "@astryxdesign/charts": "0.6.3-canary.f839b67",
105
- "@astryxdesign/core": "0.6.3-canary.f839b67",
106
- "@astryxdesign/lab": "0.6.3-canary.f839b67",
107
- "@astryxdesign/theme-neutral": "0.6.3-canary.f839b67"
104
+ "@astryxdesign/charts": "0.6.4-canary.06c8fa3",
105
+ "@astryxdesign/core": "0.6.4-canary.06c8fa3",
106
+ "@astryxdesign/lab": "0.6.4-canary.06c8fa3",
107
+ "@astryxdesign/theme-neutral": "0.6.4-canary.06c8fa3"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.6.3-canary.f839b67",
125
- "@astryxdesign/core": "0.6.3-canary.f839b67",
126
- "@astryxdesign/lab": "0.6.3-canary.f839b67",
127
- "@astryxdesign/theme-neutral": "0.6.3-canary.f839b67",
124
+ "@astryxdesign/charts": "0.6.4-canary.06c8fa3",
125
+ "@astryxdesign/core": "0.6.4-canary.06c8fa3",
126
+ "@astryxdesign/lab": "0.6.4-canary.06c8fa3",
127
+ "@astryxdesign/theme-neutral": "0.6.4-canary.06c8fa3",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",
@@ -1,34 +0,0 @@
1
- // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
- // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
-
4
- /** @param {import('../../foundation/xle/xle-ast').RawIssue} issue */
5
- export function formatIssue(issue: import("../../foundation/xle/xle-ast").RawIssue): string;
6
- /**
7
- * Parse + validate, throwing structured XDSErrors on failure.
8
- * Returns {doc, registry, blocks, warnings}.
9
- *
10
- * @param {string} expression
11
- * @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
12
- */
13
- export function analyze(expression: string, { form, loose, cwd }?: {
14
- form?: "compact" | "outline" | "auto";
15
- loose?: boolean;
16
- cwd?: string;
17
- }): Promise<{
18
- doc: import("../../foundation/xle/xle-ast").XLEDoc;
19
- registry: import("../../foundation/xle/xle-ast").Registry;
20
- blocks: LayoutBlock[];
21
- errors: import("../../foundation/xle/xle-ast").RawIssue[];
22
- warnings: import("../../foundation/xle/xle-ast").RawIssue[];
23
- }>;
24
- export type LayoutBlock = {
25
- dirName: string;
26
- name: string;
27
- kind: "template" | "component";
28
- type?: string | undefined;
29
- description?: string | undefined;
30
- category?: string | undefined;
31
- importPath?: string | undefined;
32
- filePath?: string | undefined;
33
- isDefault?: boolean | undefined;
34
- };