@astryxdesign/cli 0.6.4-canary.ed2e54e → 0.6.4

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 (145) hide show
  1. package/README.md +66 -64
  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/discover/_adapter.d.mts +6 -114
  10. package/api/discover/_adapter.mjs +17 -372
  11. package/api/discover/detail/detail.d.mts +6 -18
  12. package/api/discover/detail/detail.mjs +13 -67
  13. package/api/discover/detail/detail.test.mjs +0 -85
  14. package/api/discover/discover.d.mts +9 -3
  15. package/api/discover/discover.doc.mjs +18 -61
  16. package/api/discover/discover.mjs +36 -220
  17. package/api/discover/discover.test.mjs +2 -11
  18. package/api/discover/discover.type.d.mts +8 -147
  19. package/api/discover/discover.type.mjs +12 -102
  20. package/api/discover/list/list.d.mts +6 -20
  21. package/api/discover/list/list.mjs +12 -45
  22. package/api/discover/list/list.test.mjs +0 -46
  23. package/api/discover/search/search.d.mts +16 -18
  24. package/api/discover/search/search.mjs +56 -102
  25. package/api/discover/search/search.test.mjs +10 -144
  26. package/api/docs/docs.test.mjs +0 -2
  27. package/api/doctor/doctor.d.mts +3 -8
  28. package/api/doctor/doctor.mjs +9 -90
  29. package/api/doctor/doctor.test.mjs +10 -122
  30. package/api/index.d.mts +2 -1
  31. package/api/index.mjs +4 -4
  32. package/api/integration/add-helpers.d.mts +2 -5
  33. package/api/integration/add-helpers.mjs +9 -36
  34. package/api/integration/pack-check.mjs +3 -28
  35. package/api/json/index.ts +1 -0
  36. package/api/layout/_adapter.d.mts +34 -0
  37. package/api/layout/_adapter.mjs +148 -0
  38. package/api/layout/check/check.d.mts +16 -0
  39. package/api/layout/check/check.mjs +40 -0
  40. package/api/layout/expand/expand.d.mts +22 -0
  41. package/api/layout/expand/expand.mjs +155 -0
  42. package/api/layout/expand/expand.path-safety.test.mjs +53 -0
  43. package/api/layout/grammar/grammar.d.mts +13 -0
  44. package/api/layout/grammar/grammar.mjs +87 -0
  45. package/api/layout/layout.d.mts +6 -0
  46. package/api/layout/layout.mjs +17 -0
  47. package/api/layout/layout.test.mjs +297 -0
  48. package/api/layout/layout.type.d.mts +89 -0
  49. package/api/layout/layout.type.mjs +103 -0
  50. package/api/layout/layoutCheck.doc.d.mts +11 -0
  51. package/api/layout/layoutCheck.doc.mjs +85 -0
  52. package/api/layout/layoutExpand.doc.d.mts +11 -0
  53. package/api/layout/layoutExpand.doc.mjs +107 -0
  54. package/api/layout/layoutGrammar.doc.d.mts +11 -0
  55. package/api/layout/layoutGrammar.doc.mjs +57 -0
  56. package/api/search/search.test.mjs +0 -18
  57. package/api/template/template-integration.test.mjs +65 -1
  58. package/api/template/template.mjs +1 -1
  59. package/api/theme/add/add.mjs +25 -17
  60. package/api/theme/add/add.staging.test.mjs +23 -40
  61. package/api/theme/build/build.family.test.mjs +12 -7
  62. package/api/theme/build/build.mjs +18 -8
  63. package/api/upgrade/run/run.mjs +4 -6
  64. package/api/upgrade/upgrade.type.mjs +2 -2
  65. package/assets/codemods/__tests__/runner.test.mjs +1 -3
  66. package/assets/codemods/integration-runner.mjs +3 -3
  67. package/assets/codemods/runner.mjs +4 -5
  68. package/assets/docs/internationalization.doc.mjs +5 -7
  69. package/assets/docs/tree/integrations.doc.mjs +1 -20
  70. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  71. package/authoring/config/config.doc.mjs +1 -9
  72. package/authoring/config/parse.d.mts +0 -2
  73. package/authoring/config/parse.mjs +0 -19
  74. package/authoring/config/parse.test.mjs +0 -8
  75. package/authoring/config/type.ts +2 -13
  76. package/authoring/doctypes/command/command.doc.mjs +1 -1
  77. package/authoring/doctypes/command/type.ts +1 -1
  78. package/authoring/index.d.mts +0 -1
  79. package/authoring/index.d.ts +0 -10
  80. package/authoring/index.mjs +0 -1
  81. package/clients/cli/command-result-coverage.test.mjs +7 -7
  82. package/clients/cli/commands/component/index.mjs +55 -152
  83. package/clients/cli/commands/component-ownership.test.mjs +0 -89
  84. package/clients/cli/commands/component.doc.mjs +6 -23
  85. package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
  86. package/clients/cli/commands/discover.doc.mjs +9 -53
  87. package/clients/cli/commands/discover.mjs +118 -393
  88. package/clients/cli/commands/docs.test.mjs +0 -29
  89. package/clients/cli/commands/layout-check.doc.mjs +65 -0
  90. package/clients/cli/commands/layout-expand.doc.mjs +83 -0
  91. package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
  92. package/clients/cli/commands/layout.doc.mjs +34 -0
  93. package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
  94. package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
  95. package/clients/cli/commands/layout.mjs +275 -0
  96. package/clients/cli/commands/layout.path-help.test.mjs +33 -0
  97. package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
  98. package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
  99. package/clients/cli/commands/text-json-parity.test.mjs +17 -0
  100. package/clients/cli/index.mjs +4 -0
  101. package/clients/cli/lib/exit-codes.test.mjs +8 -1
  102. package/clients/cli/lib/json-shim.mjs +14 -24
  103. package/clients/cli/lib/json-shim.test.mjs +20 -6
  104. package/clients/cli/lib/manifest.mjs +8 -3
  105. package/clients/cli/lib/manifest.test.mjs +2 -5
  106. package/foundation/discovery/authoring-self-docs.mjs +0 -1
  107. package/foundation/discovery/template-adapter.mjs +1 -1
  108. package/foundation/doc-compiler/doc-loads.test.mjs +12 -0
  109. package/foundation/doc-compiler/tree.test.mjs +1 -9
  110. package/foundation/integrations/integrations.d.mts +1 -14
  111. package/foundation/integrations/integrations.mjs +1 -41
  112. package/foundation/integrations/integrations.test.mjs +0 -31
  113. package/foundation/response/response-types.doc.mjs +21 -15
  114. package/foundation/response/response-types.doc.test.mjs +0 -23
  115. package/foundation/xle/browser.d.mts +3 -3
  116. package/foundation/xle/browser.mjs +3 -3
  117. package/foundation/xle/expand.mjs +2 -2
  118. package/foundation/xle/parse.mjs +1 -1
  119. package/foundation/xle/print.mjs +2 -2
  120. package/foundation/xle/splice.mjs +1 -1
  121. package/package.json +9 -9
  122. package/api/discover/_adapter.test.mjs +0 -215
  123. package/api/discover/_catalog-view.d.mts +0 -115
  124. package/api/discover/_catalog-view.mjs +0 -203
  125. package/api/discover/_catalog-view.test.mjs +0 -128
  126. package/api/discover/detail/item/item.d.mts +0 -26
  127. package/api/discover/detail/item/item.mjs +0 -78
  128. package/api/discover/detail/item/item.test.mjs +0 -73
  129. package/api/integration/pack-check.lifecycle-output.test.mjs +0 -105
  130. package/api/theme/add/add.rollback.test.mjs +0 -158
  131. package/api/theme/build/build.rollback.test.mjs +0 -148
  132. package/api/upgrade/run/files-changed.test.mjs +0 -111
  133. package/assets/codemods/file-count.test.mjs +0 -163
  134. package/assets/docs/tree/component-lookups.doc.mjs +0 -149
  135. package/authoring/discover/discover.doc.d.mts +0 -13
  136. package/authoring/discover/discover.doc.mjs +0 -138
  137. package/authoring/discover/parse.d.mts +0 -24
  138. package/authoring/discover/parse.mjs +0 -128
  139. package/authoring/discover/parse.test.mjs +0 -124
  140. package/authoring/discover/type.ts +0 -87
  141. package/clients/cli/commands/component-batch.test.mjs +0 -341
  142. package/clients/cli/commands/discover.sources.test.mjs +0 -267
  143. package/clients/cli/lib/parse-error-format.test.mjs +0 -81
  144. package/foundation/response/batch.type.d.mts +0 -33
  145. package/foundation/response/batch.type.mjs +0 -34
@@ -4,10 +4,10 @@
4
4
  * @file Programmatic API for the component command — DISPATCHER + BARREL.
5
5
  *
6
6
  * Returns the same typed envelope { type, data } that `astryx --json component`
7
- * outputs. `component(name, opts)` parses one selector or an ordered selector
8
- * list, resolves each subject through `_adapter`, and routes to the correct leaf
9
- * (list · detail · detail.props/source/showcase/blocks). The CLI command handler
10
- * is a thin wrapper around this function.
7
+ * outputs. `component(name, opts)` parses the (name, options) pair, resolves the
8
+ * subject once via `_adapter`, and routes to the correct leaf
9
+ * (list · detail · detail.props/source/showcase/blocks), returning that leaf's
10
+ * envelope. The CLI command handler is a thin wrapper around this function.
11
11
  *
12
12
  * Every leaf is also re-exported for direct scripting use.
13
13
  */
@@ -26,8 +26,6 @@ import {
26
26
  resolveUnscopedDoc,
27
27
  loadComponentDoc,
28
28
  scopeSubComponent,
29
- ComponentAmbiguityError,
30
- installedComponentPackageVersion,
31
29
  } from './_adapter.mjs';
32
30
  import {componentList} from './list/list.mjs';
33
31
  import {componentDetail} from './detail/detail.mjs';
@@ -36,199 +34,13 @@ import {componentDetailSource} from './detail/source/source.mjs';
36
34
  import {componentDetailShowcase} from './detail/showcase/showcase.mjs';
37
35
  import {componentDetailBlocks} from './detail/blocks/blocks.mjs';
38
36
 
39
- /** Maximum selectors accepted before any component resolution starts. */
40
- export const COMPONENT_BATCH_SELECTOR_LIMIT = 100;
41
-
42
37
  /** @type {ReadonlyArray<string>} */
43
38
  const DETAIL_LEVELS = ['full', 'compact', 'brief'];
44
39
  /** @type {ReadonlyArray<string>} */
45
40
  const LANGS = ['en', 'zh', 'dense'];
46
- /** @type {Set<string>} */
47
- const NOT_FOUND_CODES = new Set([
48
- ERROR_CODES.ERR_UNKNOWN_COMPONENT,
49
- ERROR_CODES.ERR_UNKNOWN_PACKAGE,
50
- ERROR_CODES.ERR_NOT_FOUND,
51
- ]);
52
-
53
- /**
54
- * Discover-compatible package target grammar. Versions belong to the package
55
- * head, never the item after the package slash.
56
- * @param {string} selector
57
- * @returns {{scoped: boolean, name: string, version?: string, item?: string}}
58
- */
59
- function splitSelector(selector) {
60
- const scoped = selector.startsWith('@');
61
- const firstSlash = selector.indexOf('/');
62
- let head = selector;
63
- /** @type {string | undefined} */
64
- let rest;
65
- const split = scoped
66
- ? firstSlash < 0
67
- ? -1
68
- : selector.indexOf('/', firstSlash + 1)
69
- : firstSlash;
70
- if (split > 0) {
71
- head = selector.slice(0, split);
72
- rest = selector.slice(split + 1) || undefined;
73
- }
74
- const at = head.indexOf('@', 1);
75
- return {
76
- scoped,
77
- name: at > 0 ? head.slice(0, at) : head,
78
- ...(at > 0 && head.slice(at + 1) ? {version: head.slice(at + 1)} : {}),
79
- ...(rest ? {item: rest} : {}),
80
- };
81
- }
82
-
83
- /**
84
- * Resolve one component selector into the existing single-component API inputs.
85
- * @param {unknown} value
86
- * @param {string|undefined} packageScope
87
- * @returns {{selector: string, name: string, package?: string, version?: string}}
88
- */
89
- function parseComponentSelector(value, packageScope) {
90
- if (typeof value !== 'string' || value.length === 0) {
91
- throw new AstryxError(
92
- `Invalid component selector "${String(value)}"`,
93
- undefined,
94
- ERROR_CODES.ERR_INVALID_ARGUMENT,
95
- );
96
- }
97
- const target = splitSelector(value);
98
- const packageShaped =
99
- target.scoped || target.item != null || target.version != null;
100
- if (!packageShaped) {
101
- return {selector: value, name: target.name, package: packageScope};
102
- }
103
- if (!target.item) {
104
- throw new AstryxError(
105
- `Component selector "${value}" names a package but no component`,
106
- undefined,
107
- ERROR_CODES.ERR_INVALID_ARGUMENT,
108
- );
109
- }
110
- if (packageScope && packageScope !== target.name) {
111
- throw new AstryxError(
112
- `Component selector "${value}" conflicts with --package "${packageScope}"`,
113
- undefined,
114
- ERROR_CODES.ERR_INVALID_ARGUMENT,
115
- );
116
- }
117
- return {
118
- selector: value,
119
- name: target.item,
120
- package: target.name,
121
- ...(target.version ? {version: target.version} : {}),
122
- };
123
- }
124
-
125
- /**
126
- * A version-qualified selector never falls through to another installed
127
- * version. Its structured suggestion points at the command that can discover
128
- * the requested package release.
129
- * @param {{package?: string, version?: string}} target
130
- * @param {string} coreDir
131
- * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
132
- * @returns {void}
133
- */
134
- function requireInstalledSelectorVersion(target, coreDir, loadedIntegrations) {
135
- if (!target.version) return;
136
- const packageName = /** @type {string} */ (target.package);
137
- const installed = installedComponentPackageVersion(
138
- coreDir,
139
- loadedIntegrations,
140
- packageName,
141
- );
142
- if (installed === target.version) return;
143
- const exact = `${packageName}@${target.version}`;
144
- throw new AstryxError(
145
- `Package "${exact}" is not installed`,
146
- [
147
- {
148
- name: `astryx discover ${exact}`,
149
- reason: 'look up this package version',
150
- },
151
- ],
152
- ERROR_CODES.ERR_UNKNOWN_PACKAGE,
153
- );
154
- }
155
-
156
- /**
157
- * Turn a single-lookup failure into one complete batch row.
158
- * @param {string} selector
159
- * @param {unknown} error
160
- * @returns {import('./component.type.mjs').ComponentBatchResult}
161
- */
162
- function batchFailure(selector, error) {
163
- const err =
164
- error instanceof AstryxError
165
- ? error
166
- : new AstryxError(
167
- error instanceof Error ? error.message : String(error),
168
- undefined,
169
- ERROR_CODES.ERR_UNKNOWN,
170
- );
171
- if (err instanceof ComponentAmbiguityError) {
172
- return {
173
- selector,
174
- status: 'ambiguous',
175
- code: err.code,
176
- error: err.message,
177
- candidates: err.candidates,
178
- };
179
- }
180
- return {
181
- selector,
182
- status: NOT_FOUND_CODES.has(err.code) ? 'not_found' : 'error',
183
- code: err.code,
184
- error: err.message,
185
- ...(err.suggestions ? {suggestions: err.suggestions} : {}),
186
- };
187
- }
188
41
 
189
42
  /**
190
- * @param {unknown[]} selectors
191
- * @param {object} options
192
- * @param {string} options.cwd
193
- * @param {string} [options.package]
194
- * @param {boolean} [options.props]
195
- * @param {boolean} [options.source]
196
- * @param {boolean} [options.showcase]
197
- * @param {boolean} [options.blocks]
198
- * @param {'full'|'compact'|'brief'} [options.detail]
199
- * @param {string|null} [options.lang]
200
- * @param {boolean} [options.zh]
201
- * @param {boolean} [options.dense]
202
- * @param {string} coreDir
203
- * @returns {Promise<import('./component.type.mjs').ComponentBatchResponse>}
204
- */
205
- async function componentBatch(selectors, options, coreDir) {
206
- const loadedIntegrations = await loadIntegrationsSafely(options.cwd);
207
- /** @type {import('./component.type.mjs').ComponentBatchResult[]} */
208
- const results = [];
209
- for (const value of selectors) {
210
- const selector = typeof value === 'string' ? value : String(value);
211
- try {
212
- const target = parseComponentSelector(value, options.package);
213
- requireInstalledSelectorVersion(target, coreDir, loadedIntegrations);
214
- const result =
215
- /** @type {import('./component.type.mjs').ComponentSingleResponse} */ (
216
- await component(target.name, {
217
- ...options,
218
- lang: options.lang ?? undefined,
219
- package: target.package,
220
- })
221
- );
222
- results.push({selector, status: 'found', result});
223
- } catch (error) {
224
- results.push(batchFailure(selector, error));
225
- }
226
- }
227
- return {type: 'component.batch', data: {count: results.length, results}};
228
- }
229
-
230
- /**
231
- * @param {string|string[]} [name]
43
+ * @param {string} [name]
232
44
  * @param {object} [options]
233
45
  * @param {string} [options.cwd]
234
46
  * @param {boolean} [options.list]
@@ -244,7 +56,6 @@ async function componentBatch(selectors, options, coreDir) {
244
56
  * @param {boolean} [options.dense]
245
57
  * @returns {Promise<(
246
58
  * import('./component.type.mjs').ComponentListResponse
247
- * | import('./component.type.mjs').ComponentBatchResponse
248
59
  * | import('./component.type.mjs').ComponentDetailResponse
249
60
  * | import('./component.type.mjs').ComponentDetailPropsResponse
250
61
  * | import('./component.type.mjs').ComponentDetailSourceResponse
@@ -268,16 +79,11 @@ export async function component(name, options = {}) {
268
79
  dense = false,
269
80
  } = options;
270
81
 
271
- const selectorList = Array.isArray(name) ? name : null;
272
- const noName = selectorList == null && !name;
273
-
274
82
  // Default detail level mirrors the CLI (see commands/component/index.mjs):
275
83
  // single-component views default to 'full', list-style views (--list,
276
84
  // --category, or no name) default to 'brief' (scannable name lists).
277
- // An explicit array remains a batch even when it is empty or a caller also
278
- // passes a list-only option.
279
- const isListView =
280
- selectorList == null && (list || category != null || noName);
85
+ // Keeping this in sync with the CLI is what the API↔CLI parity test checks.
86
+ const isListView = list || category != null || !name;
281
87
  const detail = detailOption ?? (isListView ? 'brief' : 'full');
282
88
 
283
89
  // Same accepted values and codes as the CLI's --detail and --lang, checked
@@ -297,14 +103,6 @@ export async function component(name, options = {}) {
297
103
  );
298
104
  }
299
105
 
300
- if (selectorList && selectorList.length > COMPONENT_BATCH_SELECTOR_LIMIT) {
301
- throw new AstryxError(
302
- `Component batch accepts at most ${COMPONENT_BATCH_SELECTOR_LIMIT} selectors; received ${selectorList.length}`,
303
- undefined,
304
- ERROR_CODES.ERR_INVALID_ARGUMENT,
305
- );
306
- }
307
-
308
106
  const coreDir = requireCoreDir(cwd);
309
107
 
310
108
  // A public API caller could pass a non-string category; the list leaf does
@@ -318,46 +116,11 @@ export async function component(name, options = {}) {
318
116
  );
319
117
  }
320
118
 
321
- // ── Explicit batch selector list ─────────────────────────────────
322
- // Array shape owns cardinality even if a caller also supplies a list-only
323
- // option. The aggregate limit above is checked before core or integrations
324
- // are resolved, so an oversized request can never emit a partial receipt.
325
- if (selectorList) {
326
- return componentBatch(
327
- selectorList,
328
- {
329
- cwd,
330
- package: packageScope,
331
- props,
332
- source,
333
- showcase,
334
- blocks,
335
- detail,
336
- lang,
337
- zh,
338
- dense,
339
- },
340
- coreDir,
341
- );
342
- }
343
-
344
119
  // ── List mode ──────────────────────────────────────────────────
345
- if (category || list || noName) {
120
+ if (category || list || !name) {
346
121
  return componentList(coreDir, {cwd, category, detail, zh, dense, lang});
347
122
  }
348
123
 
349
- if (typeof name === 'string') {
350
- const target = parseComponentSelector(name, packageScope);
351
- if (target.version) {
352
- const loadedIntegrations = await loadIntegrationsSafely(cwd);
353
- requireInstalledSelectorVersion(target, coreDir, loadedIntegrations);
354
- }
355
- if (target.name !== name || target.package !== packageScope) {
356
- return component(target.name, {...options, package: target.package});
357
- }
358
- name = target.name;
359
- }
360
-
361
124
  // ── Single component ───────────────────────────────────────────
362
125
  if (typeof name !== 'string') {
363
126
  throw new AstryxError(
@@ -423,10 +186,7 @@ export async function component(name, options = {}) {
423
186
  if (extDocPath) {
424
187
  // Legacy packages ship docs, never source.
425
188
  if (source) {
426
- return componentDetailSource(dirName, null, {
427
- name,
428
- notFoundInPackage: packageScope,
429
- });
189
+ return componentDetailSource(dirName, null, {name, notFoundInPackage: packageScope});
430
190
  }
431
191
  if (blocks) {
432
192
  return componentDetailBlocks(dirName, cwd);
@@ -28,31 +28,6 @@ export type ComponentListData = ({
28
28
  detail: "full";
29
29
  components: Record<string, import("@astryxdesign/cli/authoring").ComponentDoc[]>;
30
30
  });
31
- /**
32
- * `component(string[])` always returns this type, including empty and one-item
33
- * arrays. The CLI returns it for two or more positional selectors.
34
- */
35
- export type ComponentBatchResponse = import("../../foundation/response/batch.type.mjs").BatchResponse<"component.batch", ComponentSingleResponse, ComponentBatchCandidate>;
36
- /**
37
- * One installed component that makes an unqualified selector ambiguous.
38
- * Keys match a component row in `discover.search` so a caller does not learn a
39
- * second candidate shape.
40
- */
41
- export type ComponentBatchCandidate = {
42
- package: string;
43
- component: string;
44
- kind: "component";
45
- installed: true;
46
- };
47
- /**
48
- * The response a successful single selector would have returned.
49
- */
50
- export type ComponentSingleResponse = (ComponentDetailResponse | ComponentDetailPropsResponse | ComponentDetailSourceResponse | ComponentDetailShowcaseResponse | ComponentDetailBlocksResponse);
51
- /**
52
- * One row per requested selector, in argument order. Duplicate selectors keep
53
- * duplicate rows.
54
- */
55
- export type ComponentBatchResult = import("../../foundation/response/batch.type.mjs").BatchRow<ComponentSingleResponse, ComponentBatchCandidate>;
56
31
  /**
57
32
  * A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
58
33
  * list moved from bare strings to package-qualified objects so consumers can
@@ -18,9 +18,6 @@
18
18
  * astryx --json component --category Form -> component.list (filtered)
19
19
  * astryx --json component --list --detail compact -> component.list (data.detail='compact')
20
20
  * astryx --json component --list --detail full -> component.list (data.detail='full')
21
- * component([]) -> component.batch (data.count=0)
22
- * component(['Button']) -> component.batch (data.count=1)
23
- * astryx --json component Button Badge -> component.batch
24
21
  * astryx --json component Button -> component.detail
25
22
  * astryx --json component Button --props -> component.detail.props
26
23
  * astryx --json component Button --source -> component.detail.source
@@ -52,47 +49,6 @@
52
49
  * )} ComponentListData
53
50
  */
54
51
 
55
- /**
56
- * `component(string[])` always returns this type, including empty and one-item
57
- * arrays. The CLI returns it for two or more positional selectors.
58
- * @typedef {import('../../foundation/response/batch.type.mjs').BatchResponse<
59
- * 'component.batch',
60
- * ComponentSingleResponse,
61
- * ComponentBatchCandidate
62
- * >} ComponentBatchResponse
63
- */
64
-
65
- /**
66
- * One installed component that makes an unqualified selector ambiguous.
67
- * Keys match a component row in `discover.search` so a caller does not learn a
68
- * second candidate shape.
69
- * @typedef {object} ComponentBatchCandidate
70
- * @property {string} package
71
- * @property {string} component
72
- * @property {'component'} kind
73
- * @property {true} installed
74
- */
75
-
76
- /**
77
- * The response a successful single selector would have returned.
78
- * @typedef {(
79
- * | ComponentDetailResponse
80
- * | ComponentDetailPropsResponse
81
- * | ComponentDetailSourceResponse
82
- * | ComponentDetailShowcaseResponse
83
- * | ComponentDetailBlocksResponse
84
- * )} ComponentSingleResponse
85
- */
86
-
87
- /**
88
- * One row per requested selector, in argument order. Duplicate selectors keep
89
- * duplicate rows.
90
- * @typedef {import('../../foundation/response/batch.type.mjs').BatchRow<
91
- * ComponentSingleResponse,
92
- * ComponentBatchCandidate
93
- * >} ComponentBatchResult
94
- */
95
-
96
52
  /**
97
53
  * A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
98
54
  * list moved from bare strings to package-qualified objects so consumers can
@@ -12,78 +12,20 @@
12
12
  * configured" (`false`) from "configured but nothing discovered" (`true`),
13
13
  * which the list leaf surfaces as `meta`.
14
14
  *
15
- * @returns {Promise<{packages: ScannedPackage[], configured: boolean, project: Project}>}
15
+ * @returns {Promise<{packages: ScannedPackage[], configured: boolean}>}
16
16
  */
17
17
  export function discoverPackages(): Promise<{
18
18
  packages: ScannedPackage[];
19
19
  configured: boolean;
20
- project: Project;
21
20
  }>;
22
21
  /**
23
- * Every integration the project loads, with what it adds. An integration with
24
- * no components root is included with `components: []`; one that failed to
25
- * load is left out (the integration-issues nudge and Doctor report it).
26
- *
27
- * @param {Project | undefined} project
28
- * @param {ScannedPackage[]} scanned the packages {@link discoverPackages} found
29
- * @returns {Promise<InstalledPackage[]>}
30
- */
31
- export function describeInstalled(project: Project | undefined, scanned: ScannedPackage[]): Promise<InstalledPackage[]>;
32
- /**
33
- * Whether the project has any discover source: its own `discover` config field,
34
- * or an integration's `discover` named export (valid or not).
35
- * @param {Project | undefined} project
36
- * @returns {boolean}
37
- */
38
- export function hasSources(project: Project | undefined): boolean;
39
- /**
40
- * Package names the project's package.json declares in any dependency field.
41
- * @param {Project | undefined} project
42
- * @returns {Set<string>}
43
- */
44
- export function declaredDependencies(project: Project | undefined): Set<string>;
45
- /**
46
- * The command that adds a package with the project's package manager. Discover
47
- * only prints it; it never runs it.
48
- * @param {Project | undefined} project
49
- * @returns {(name: string, version?: string) => string}
50
- */
51
- export function addCommand(project: Project | undefined): (name: string, version?: string) => string;
52
- /**
53
- * The per-user cache directory the saved copies live in, never inside a
54
- * project. Standard platform locations only.
55
- * @returns {string}
56
- */
57
- export function defaultCacheDir(): string;
58
- /**
59
- * Call every discover source — the project's `discover` first, then each
60
- * integration's in load order — once per distinct function. A source that
61
- * throws, times out, or returns an invalid catalog falls back to its saved copy;
62
- * with none, it is reported and adds nothing. The others always count.
63
- *
64
- * @param {Project | undefined} project
65
- * @param {{package?: string, version?: string}} [request] ask for one package,
66
- * and optionally one version's contributions
67
- * @param {{cacheDir?: string, timeoutMs?: number}} [options]
68
- * @returns {Promise<CatalogResult>}
69
- */
70
- export function callSources(project: Project | undefined, request?: {
71
- package?: string;
72
- version?: string;
73
- }, options?: {
74
- cacheDir?: string;
75
- timeoutMs?: number;
76
- }): Promise<CatalogResult>;
77
- /**
78
- * Project a scanned or installed package into the discover list/detail entry
79
- * shape. Shared by the list and detail leaves so the entry keys (and their
80
- * order) stay in one place. A kind list appears only when it is not empty.
81
- * @param {InstalledPackage & {latest?: string}} pkg
22
+ * Project a scanned package into the discover list/detail entry shape. Shared
23
+ * by the list and detail leaves so the entry keys (and their order) stay in one
24
+ * place.
25
+ * @param {ScannedPackage} pkg
82
26
  * @returns {import('./discover.type.mjs').DiscoverListEntry}
83
27
  */
84
- export function toEntry(pkg: InstalledPackage & {
85
- latest?: string;
86
- }): import("./discover.type.mjs").DiscoverListEntry;
28
+ export function toEntry(pkg: ScannedPackage): import("./discover.type.mjs").DiscoverListEntry;
87
29
  /**
88
30
  * Locate a component's doc file within the given packages (case-insensitive).
89
31
  * @param {ScannedPackage[]} packages
@@ -104,56 +46,7 @@ export function loadValidatedDoc(result: ComponentResolution, { lang, zh }: {
104
46
  lang?: string | null;
105
47
  zh?: boolean;
106
48
  }): Promise<import("./discover.type.mjs").DiscoverDetailDocResponse["data"]>;
107
- /** The list and detail entry fields for each item kind, in display order. */
108
- export const KIND_FIELDS: readonly [readonly ["component", "components"], readonly ["template", "templates"], readonly ["doc", "docs"], readonly ["theme", "themes"], readonly ["codemod", "codemods"], readonly ["agent-doc", "agentDocs"]];
109
49
  export type ScannedPackage = import("./_package-scanner.mjs").ScannedPackage;
110
- export type DiscoverPackage = import("../../authoring/discover/type").DiscoverPackage;
111
- export type DiscoverSource = import("../../authoring/discover/type").DiscoverSource;
112
- /**
113
- * An installed integration with what it adds, per kind. `components` is the
114
- * scanned component list the discover leaves have always used.
115
- */
116
- export type InstalledPackage = ScannedPackage & {
117
- templates?: string[];
118
- docs?: string[];
119
- themes?: string[];
120
- codemods?: string[];
121
- };
122
- /**
123
- * What one source did on this run.
124
- */
125
- export type SourceState = {
126
- /**
127
- * the source's own name, or where it came from when it
128
- * gave none
129
- */
130
- name: string;
131
- /**
132
- * `astryx.config`, or the integration that exports it
133
- */
134
- from: string;
135
- status: "fresh" | "saved" | "failed";
136
- generatedAt?: string | undefined;
137
- complete?: boolean | undefined;
138
- /**
139
- * when the saved copy in use was written
140
- */
141
- savedAt?: string | undefined;
142
- /**
143
- * why the live call failed
144
- */
145
- error?: string | undefined;
146
- };
147
- /**
148
- * Everything every source returned, merged. When two sources list the same
149
- * package, the earlier source's entry is kept.
150
- */
151
- export type CatalogResult = {
152
- sources: SourceState[];
153
- packages: Array<DiscoverPackage & {
154
- source: string;
155
- }>;
156
- };
157
50
  /**
158
51
  * A located component doc within a scanned package — the shape returned by
159
52
  * {@link findComponent}, consumed by {@link loadValidatedDoc}.
@@ -163,4 +56,3 @@ export type ComponentResolution = {
163
56
  docPath: string;
164
57
  componentName: string;
165
58
  };
166
- import { Project } from '../../foundation/config/project.mjs';