@astryxdesign/cli 0.7.2-canary.fc12a18 → 0.7.2-canary.fdd384f

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 (174) hide show
  1. package/README.md +9 -8
  2. package/api/build/help/help.mjs +1 -1
  3. package/api/component/_adapter.d.mts +41 -1
  4. package/api/component/_adapter.mjs +93 -7
  5. package/api/component/component.mjs +22 -5
  6. package/api/component/component.test.mjs +420 -167
  7. package/api/component/integration-export-name.test.mjs +644 -0
  8. package/api/component/list/list.mjs +42 -4
  9. package/api/docs/_adapter.d.mts +11 -0
  10. package/api/docs/_adapter.mjs +244 -1
  11. package/api/docs/integrationDocs.test.mjs +124 -0
  12. package/api/doctor/theme-checks.mjs +1 -1
  13. package/api/gap-report/gap-report.mjs +67 -4
  14. package/api/index.d.mts +2 -0
  15. package/api/index.mjs +2 -0
  16. package/api/init/run/run.mjs +2 -2
  17. package/api/integration/_adapter.d.mts +12 -0
  18. package/api/integration/_adapter.mjs +54 -0
  19. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  20. package/api/integration/add-contribution.mjs +8 -4
  21. package/api/integration/add-contribution.test.mjs +4 -2
  22. package/api/integration/authoring-checks.mjs +11 -2
  23. package/api/integration/authoring-checks.test.mjs +39 -0
  24. package/api/integration/authoring-checks.type.d.mts +9 -0
  25. package/api/integration/authoring-checks.type.mjs +14 -1
  26. package/api/integration/check/check.d.mts +96 -0
  27. package/api/integration/check/check.mjs +357 -0
  28. package/api/integration/check/check.test.mjs +489 -0
  29. package/api/integration/integration-check.type.d.mts +118 -0
  30. package/api/integration/integration-check.type.mjs +84 -0
  31. package/api/integration/integrationCheck.doc.d.mts +10 -0
  32. package/api/integration/integrationCheck.doc.mjs +73 -0
  33. package/api/integration/integrationComponentConflicts.doc.mjs +36 -5
  34. package/api/integration/pack-check.mjs +61 -107
  35. package/api/integration/pack-check.test.mjs +359 -0
  36. package/api/integration/validate-integration.mjs +8 -0
  37. package/api/integration/validate-integration.test.mjs +11 -0
  38. package/api/integration/validate-integration.type.d.mts +8 -0
  39. package/api/integration/validate-integration.type.mjs +12 -1
  40. package/api/integration/validateIntegration.doc.mjs +17 -3
  41. package/api/search/search.d.mts +9 -0
  42. package/api/search/search.integration-check.test.mjs +24 -0
  43. package/api/search/search.mjs +108 -16
  44. package/api/search/search.test.mjs +36 -0
  45. package/api/swizzle/copy/copy.mjs +28 -14
  46. package/api/template/template.test.mjs +120 -3
  47. package/api/theme/build/build.family.test.mjs +64 -0
  48. package/api/theme/build/build.mjs +180 -24
  49. package/api/theme/themeBuild.doc.mjs +4 -4
  50. package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
  51. package/assets/codemods/transforms/next/index.mjs +11 -1
  52. package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
  53. package/assets/docs/README.md +10 -0
  54. package/assets/docs/author-a-theme.doc.mjs +1 -1
  55. package/assets/docs/getting-started.doc.mjs +3 -3
  56. package/assets/docs/theme.doc.dense.mjs +1 -1
  57. package/assets/docs/theme.doc.mjs +1 -1
  58. package/assets/docs/theme.doc.zh.mjs +1 -1
  59. package/assets/docs/tree/add-a-component.doc.mjs +10 -0
  60. package/assets/docs/tree/block-template.doc.mjs +2 -2
  61. package/assets/docs/tree/check-the-props.doc.mjs +196 -0
  62. package/assets/docs/tree/check-your-docs.doc.mjs +44 -3
  63. package/assets/docs/tree/checks.doc.mjs +21 -13
  64. package/assets/docs/tree/component-family.doc.mjs +5 -1
  65. package/assets/docs/tree/component-imports.doc.mjs +8 -0
  66. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  67. package/assets/docs/tree/links.doc.mjs +2 -2
  68. package/assets/docs/tree/page-template.doc.mjs +1 -1
  69. package/assets/docs/tree/quick-start.doc.mjs +1 -1
  70. package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
  71. package/assets/docs/tree/single-component.doc.mjs +3 -2
  72. package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
  73. package/assets/docs/tree/type-scale.doc.mjs +3 -3
  74. package/assets/docs/tree/versioning.doc.mjs +1 -0
  75. package/assets/docs/tree/write-the-template-file.doc.mjs +2 -1
  76. package/assets/docs/use-a-theme.doc.mjs +2 -2
  77. package/assets/docs/working-with-ai.doc.mjs +43 -4
  78. package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
  79. package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
  80. package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
  81. package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
  82. package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
  83. package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
  84. package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
  85. package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
  86. package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
  87. package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
  88. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
  89. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
  90. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
  91. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
  92. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
  93. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
  94. package/assets/templates/pages/detail-page/page.tsx +3 -3
  95. package/assets/templates/pages/table-inbox/page.tsx +10 -8
  96. package/assets/theme.template.ts +1 -1
  97. package/authoring/doctypes/base/type.ts +6 -0
  98. package/authoring/doctypes/component/component.doc.mjs +4 -4
  99. package/authoring/doctypes/component/type.ts +6 -3
  100. package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
  101. package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
  102. package/authoring/doctypes/template/parse.d.mts +6 -2
  103. package/authoring/doctypes/template/parse.mjs +3 -1
  104. package/authoring/doctypes/template/template.doc.mjs +1 -1
  105. package/authoring/doctypes/template/type.ts +22 -0
  106. package/authoring/index.d.ts +1 -0
  107. package/authoring/integration/integration.doc.mjs +8 -1
  108. package/authoring/integration/parse.test.mjs +10 -0
  109. package/authoring/integration/schema.d.mts +2 -0
  110. package/authoring/integration/schema.mjs +1 -0
  111. package/authoring/integration/type.ts +4 -0
  112. package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
  113. package/clients/cli/commands/build-theme.mjs +1 -1
  114. package/clients/cli/commands/build-theme.path-safety.test.mjs +224 -6
  115. package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
  116. package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
  117. package/clients/cli/commands/doctor-integration-validate.doc.mjs +11 -2
  118. package/clients/cli/commands/doctor-integration.test.mjs +837 -0
  119. package/clients/cli/commands/doctor.mjs +190 -0
  120. package/clients/cli/commands/integration-check.doc.mjs +85 -0
  121. package/clients/cli/commands/integration-check.test.mjs +267 -0
  122. package/clients/cli/commands/integration.doc.mjs +6 -2
  123. package/clients/cli/commands/integration.mjs +107 -1
  124. package/clients/cli/commands/text-json-parity.test.mjs +5 -0
  125. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  126. package/clients/cli/index.mjs +1 -0
  127. package/clients/cli/lib/component-format.mjs +5 -1
  128. package/foundation/config/project.mjs +82 -0
  129. package/foundation/discovery/authoring-self-docs.mjs +1 -0
  130. package/foundation/discovery/component-discovery.d.mts +190 -10
  131. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  132. package/foundation/discovery/component-discovery.mjs +864 -56
  133. package/foundation/discovery/component-discovery.test.mjs +96 -0
  134. package/foundation/discovery/component-replacement.mjs +18 -0
  135. package/foundation/discovery/component-replacement.test.mjs +40 -0
  136. package/foundation/discovery/doc-types.d.mts +157 -0
  137. package/foundation/discovery/doc-types.mjs +1224 -0
  138. package/foundation/discovery/doc-types.test.mjs +652 -0
  139. package/foundation/discovery/docs-discovery.d.mts +81 -0
  140. package/foundation/discovery/docs-discovery.mjs +57 -0
  141. package/foundation/discovery/integration-doc-files.d.mts +22 -0
  142. package/foundation/discovery/integration-doc-files.mjs +231 -0
  143. package/foundation/discovery/integration-doc-files.test.mjs +246 -0
  144. package/foundation/discovery/module-exports.d.mts +27 -0
  145. package/foundation/discovery/module-exports.mjs +356 -31
  146. package/foundation/discovery/module-exports.test.mjs +172 -0
  147. package/foundation/discovery/package-tsconfig.d.mts +14 -0
  148. package/foundation/discovery/package-tsconfig.mjs +228 -0
  149. package/foundation/discovery/package-tsconfig.test.mjs +210 -0
  150. package/foundation/discovery/project-typescript.d.mts +23 -0
  151. package/foundation/discovery/project-typescript.mjs +61 -0
  152. package/foundation/discovery/prop-drift.d.mts +278 -0
  153. package/foundation/discovery/prop-drift.mjs +2263 -0
  154. package/foundation/discovery/prop-drift.test.mjs +2219 -0
  155. package/foundation/discovery/template-adapter.mjs +74 -5
  156. package/foundation/discovery/type-match.d.mts +53 -0
  157. package/foundation/discovery/type-match.mjs +660 -0
  158. package/foundation/discovery/type-match.test.mjs +169 -0
  159. package/foundation/discovery/type-text.d.mts +68 -0
  160. package/foundation/discovery/type-text.mjs +658 -0
  161. package/foundation/discovery/type-text.test.mjs +196 -0
  162. package/foundation/discovery/unresolved-references.d.mts +62 -0
  163. package/foundation/discovery/unresolved-references.mjs +790 -0
  164. package/foundation/discovery/unresolved-references.test.mjs +567 -0
  165. package/foundation/doc-compiler/doc-loads.test.mjs +11 -1
  166. package/foundation/doc-compiler/inputs.mjs +23 -0
  167. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  168. package/foundation/doc-compiler/links.d.mts +9 -5
  169. package/foundation/doc-compiler/links.mjs +4 -2
  170. package/foundation/integrations/contribution-inventory.mjs +6 -1
  171. package/foundation/response/response-types.doc.mjs +7 -2
  172. package/foundation/xle/registry.mjs +4 -0
  173. package/foundation/xle/registry.test.mjs +28 -0
  174. package/package.json +10 -10
package/README.md CHANGED
@@ -476,10 +476,11 @@ Every response has a `type` discriminant. The full set is below (generated from
476
476
  | `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and an optional fix, always present on warn and fail) plus a `summary` of counts per status. |
477
477
  | `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
478
478
  | `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |
479
- | `integration.validate` | The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
479
+ | `integration.validate` | The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. When the manifest loads, docTypes checks each doc against its published authoring type: status (checked \| skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked). |
480
480
  | `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
481
- | `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
481
+ | `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked \| skipped), reason, typescript, components, typesCompared, typesSkipped, findings (all warnings), unchecked, typesNotCompared, and propsNotChecked. |
482
482
  | `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
483
+ | `integration.check` | Every source check of an integration package in one result: validated (false when no integration manifest was found, so nothing was checked), the package name and version, strict, and checks, one entry per check (validate, components, templates, docs), each with check, errors, warnings, skipped, failed, and response, the envelope that check returns on its own. The totals are errors, warnings, and skipped; unchecked counts what the checks could not compare. With --strict, failures lists each warning and each piece of skipped work again as an error, in the issue format the checks use; it is empty without --strict. failed decides the exit code. |
483
484
 
484
485
  <!-- END GENERATED: response-types -->
485
486
  <!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
@@ -551,12 +552,12 @@ data: { checks, summary } }`) that AI agents and scripts can parse.
551
552
  Omit `[package]` to inspect the package at the current directory, or pass an
552
553
  installed package name:
553
554
 
554
- | Command | What it checks | Exit `1` when |
555
- | ----------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------- |
556
- | `doctor integration validate [package]` | Manifest shape and every declared contribution | A structural issue has error severity |
557
- | `doctor integration templates [package]` | Template IDs shared with Core | The integration is invalid; ID conflicts are warnings |
558
- | `doctor integration components [package]` | Component names shared with Core | The integration is invalid; name conflicts are warnings |
559
- | `doctor integration docs [package]` | Core topic replacements, extensions, and same-name conflicts | A Core overlap is accidental or the docs are invalid |
555
+ | Command | What it checks | Exit `1` when |
556
+ | ----------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
557
+ | `doctor integration validate [package]` | Manifest shape and every declared contribution | A structural issue has error severity |
558
+ | `doctor integration templates [package]` | Template IDs shared with Core | The integration is invalid; ID conflicts are warnings |
559
+ | `doctor integration components [package]` | Component names shared with Core, and each props table against the TypeScript props | The integration is invalid; name conflicts and prop differences are warnings |
560
+ | `doctor integration docs [package]` | Core topic replacements, extensions, and same-name conflicts | A Core overlap is accidental or the docs are invalid |
560
561
 
561
562
  Template and component conflicts include the exact `--package` command needed
562
563
  to select the integration contribution. Doc replacements and extensions are
@@ -63,7 +63,7 @@ export function buildHelp() {
63
63
  "Keep the template's page frame, gap, and padding values. Replace its data, copy, and sections.",
64
64
  'No <div>/raw HTML for layout — use VStack/HStack/Grid/Stack/Card etc.',
65
65
  'No style={{}} — use component props, and design tokens for values.',
66
- "Wrap the app in <Theme theme={...}> (import {Theme} from '@astryxdesign/core') and import core reset.css + astryx.css.",
66
+ "Wrap the app in <Theme theme={...}> (import {Theme} from '@astryxdesign/core/theme') and import core reset.css + astryx.css.",
67
67
  ],
68
68
  related: [
69
69
  {
@@ -26,6 +26,8 @@
26
26
  * @property {string|null} sourcePath
27
27
  * @property {string|undefined} issuesUrl
28
28
  * @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration|null} integration
29
+ * @property {import('../../foundation/discovery/component-discovery.mjs').NameHold} hold
30
+ * how the owner holds the name, for the owner rule
29
31
  */
30
32
  /**
31
33
  * What ownership shaping needs from an owner. The core and legacy-external
@@ -138,6 +140,25 @@ export function assertUnambiguousOwners(owners: ComponentOwner[], dirName: strin
138
140
  * @returns {string | null}
139
141
  */
140
142
  export function resolveLegacyExternalDoc(ext: ExternalPackageRef, dirName: string): string | null;
143
+ /**
144
+ * Whether a legacy external package documents `dirName`.
145
+ * @param {string} cwd
146
+ * @param {string} dirName
147
+ * @returns {boolean}
148
+ */
149
+ export function legacyExternalDocuments(cwd: string, dirName: string): boolean;
150
+ /**
151
+ * Whether a legacy docs package keeps `dirName` over these owners, each of which
152
+ * holds it only as an export a doc records.
153
+ * @param {string} cwd
154
+ * @param {string} dirName
155
+ * @param {Array<{hold?: string, docPath?: string | null}>} owners
156
+ * @returns {boolean}
157
+ */
158
+ export function legacyExternalKeeps(cwd: string, dirName: string, owners: Array<{
159
+ hold?: string;
160
+ docPath?: string | null;
161
+ }>): boolean;
141
162
  /**
142
163
  * The core source file for `dirName` (the no-scope `--source` path reads core
143
164
  * directly — it does NOT fall back to externals or fuzzy search).
@@ -210,7 +231,20 @@ export function scopeSubComponent(docs: LoadedComponentDoc, dirName: string, cor
210
231
  };
211
232
  matchingComponent: any;
212
233
  } | null;
213
- export { CORE_PACKAGE };
234
+ /**
235
+ * The doc an integration owner shows for `dirName`: when `dirName` is a member
236
+ * its family doc lists under its own name (`AcmeSlide` in an `AcmeCarousel`
237
+ * doc), the doc scoped to that member as {@link scopeSubComponent} scopes
238
+ * Core's, keeping the import the family doc states; otherwise `docs` itself.
239
+ * @param {LoadedComponentDoc} docs
240
+ * @param {OwnershipSubject} owner
241
+ * @param {string} dirName
242
+ * @returns {LoadedComponentDoc & {parentDoc?: string, import?: string}}
243
+ */
244
+ export function scopeIntegrationMember(docs: LoadedComponentDoc, owner: OwnershipSubject, dirName: string): LoadedComponentDoc & {
245
+ parentDoc?: string;
246
+ import?: string;
247
+ };
214
248
  /**
215
249
  * Internal ambiguity marker. Single-component callers still receive the same
216
250
  * AstryxError code, message, and suggestions; batch callers can additionally
@@ -261,6 +295,10 @@ export type ComponentOwner = {
261
295
  sourcePath: string | null;
262
296
  issuesUrl: string | undefined;
263
297
  integration: import("../../foundation/integrations/integrations.mjs").LoadedIntegration | null;
298
+ /**
299
+ * how the owner holds the name, for the owner rule
300
+ */
301
+ hold: import("../../foundation/discovery/component-discovery.mjs").NameHold;
264
302
  };
265
303
  /**
266
304
  * What ownership shaping needs from an owner. The core and legacy-external
@@ -303,4 +341,6 @@ export type ResolvedUnscopedDoc = {
303
341
  resolvedSourcePath: string | null;
304
342
  };
305
343
  import { CORE_PACKAGE } from '../../foundation/discovery/component-discovery.mjs';
344
+ import { unscopedComponentOwners } from '../../foundation/discovery/component-discovery.mjs';
306
345
  import { AstryxError } from '../error.mjs';
346
+ export { CORE_PACKAGE, unscopedComponentOwners };
@@ -28,13 +28,17 @@ import {
28
28
  import {
29
29
  CORE_PACKAGE,
30
30
  discoverComponents,
31
+ docStem,
31
32
  findComponentReadme,
32
33
  findComponentSource,
33
34
  findExternalComponentDoc,
34
- findIntegrationComponentDoc,
35
- findIntegrationComponentSource,
35
+ findIntegrationComponent,
36
+ integrationMemberEntry,
37
+ isIntegrationMember,
38
+ recordedDocName,
36
39
  resolveImportPath,
37
40
  resolveIntegrationImportPath as resolveIntegrationImport,
41
+ unscopedComponentOwners,
38
42
  } from '../../foundation/discovery/component-discovery.mjs';
39
43
  import {Project} from '../../foundation/config/project.mjs';
40
44
  import {loadComponentDoc as loadValidatedComponentDoc} from '../../foundation/discovery/component-loader.mjs';
@@ -42,7 +46,7 @@ import {resolveComponentReplacements} from '../../foundation/discovery/component
42
46
  import {searchComponents} from '../../foundation/text/string-utils.mjs';
43
47
  import {AstryxError} from '../error.mjs';
44
48
 
45
- export {CORE_PACKAGE};
49
+ export {CORE_PACKAGE, unscopedComponentOwners};
46
50
 
47
51
  /**
48
52
  * A loaded component doc. The shared validated loader accepts stamped and legacy
@@ -71,6 +75,8 @@ export {CORE_PACKAGE};
71
75
  * @property {string|null} sourcePath
72
76
  * @property {string|undefined} issuesUrl
73
77
  * @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration|null} integration
78
+ * @property {import('../../foundation/discovery/component-discovery.mjs').NameHold} hold
79
+ * how the owner holds the name, for the owner rule
74
80
  */
75
81
 
76
82
  /**
@@ -240,17 +246,19 @@ export function resolveOwners(coreDir, dirName, loadedIntegrations) {
240
246
  sourcePath: findComponentSource(coreDir, dirName),
241
247
  issuesUrl: undefined,
242
248
  integration: null,
249
+ hold: 'core',
243
250
  });
244
251
  }
245
252
  for (const integration of loadedIntegrations) {
246
- const docPath = findIntegrationComponentDoc(integration, dirName);
247
- if (!docPath) continue;
253
+ const found = findIntegrationComponent(integration, dirName);
254
+ if (!found) continue;
248
255
  owners.push({
249
256
  package: integration.name,
250
- docPath,
251
- sourcePath: findIntegrationComponentSource(integration, dirName),
257
+ docPath: found.docPath,
258
+ sourcePath: found.sourcePath,
252
259
  issuesUrl: integration.issuesUrl,
253
260
  integration,
261
+ hold: found.hold,
254
262
  });
255
263
  }
256
264
  return owners;
@@ -361,6 +369,39 @@ export function resolveLegacyExternalDoc(ext, dirName) {
361
369
  return extDocPath && extDocPath.endsWith('.doc.mjs') ? extDocPath : null;
362
370
  }
363
371
 
372
+ /**
373
+ * Whether a legacy external package documents `dirName`.
374
+ * @param {string} cwd
375
+ * @param {string} dirName
376
+ * @returns {boolean}
377
+ */
378
+ export function legacyExternalDocuments(cwd, dirName) {
379
+ return discoverExternalPackages(cwd).some(
380
+ ext => resolveLegacyExternalDoc(ext, dirName) != null,
381
+ );
382
+ }
383
+
384
+ /**
385
+ * Whether a legacy docs package keeps `dirName` over these owners, each of which
386
+ * holds it only as an export a doc records.
387
+ * @param {string} cwd
388
+ * @param {string} dirName
389
+ * @param {Array<{hold?: string, docPath?: string | null}>} owners
390
+ * @returns {boolean}
391
+ */
392
+ export function legacyExternalKeeps(cwd, dirName, owners) {
393
+ return (
394
+ owners.length > 0 &&
395
+ owners.every(
396
+ owner =>
397
+ owner.hold === 'doc' &&
398
+ owner.docPath != null &&
399
+ docStem(owner.docPath).toLowerCase() !== dirName.toLowerCase(),
400
+ ) &&
401
+ legacyExternalDocuments(cwd, dirName)
402
+ );
403
+ }
404
+
364
405
  /**
365
406
  * The core source file for `dirName` (the no-scope `--source` path reads core
366
407
  * directly — it does NOT fall back to externals or fuzzy search).
@@ -583,3 +624,48 @@ export function scopeSubComponent(docs, dirName, coreDir) {
583
624
 
584
625
  return {scoped, matchingComponent};
585
626
  }
627
+
628
+ /**
629
+ * The doc an integration owner shows for `dirName`: when `dirName` is a member
630
+ * its family doc lists under its own name (`AcmeSlide` in an `AcmeCarousel`
631
+ * doc), the doc scoped to that member as {@link scopeSubComponent} scopes
632
+ * Core's, keeping the import the family doc states; otherwise `docs` itself.
633
+ * @param {LoadedComponentDoc} docs
634
+ * @param {OwnershipSubject} owner
635
+ * @param {string} dirName
636
+ * @returns {LoadedComponentDoc & {parentDoc?: string, import?: string}}
637
+ */
638
+ export function scopeIntegrationMember(docs, owner, dirName) {
639
+ const record = {name: dirName, docPath: owner.docPath ?? null};
640
+ if (!isIntegrationMember(record)) return docs;
641
+ const entry = integrationMemberEntry(docs, record);
642
+ // The files list the member but the doc this process loaded has no entry
643
+ // for it (the doc changed after it loaded): never answer with the family.
644
+ if (entry == null) {
645
+ throw new AstryxError(
646
+ `No component named "${dirName}": its family doc changed after this process loaded it.`,
647
+ undefined,
648
+ ERROR_CODES.ERR_UNKNOWN_COMPONENT,
649
+ );
650
+ }
651
+ // Built from the entry, as scopeSubComponent scopes Core's, so a member that
652
+ // shares the doc's own `name` is scoped too.
653
+ /** @type {LoadedComponentDoc & {parentDoc?: string, import?: string}} */
654
+ const scoped = {
655
+ name: dirName,
656
+ description: entry.description,
657
+ props: entry.props,
658
+ components: [entry],
659
+ // The name the family doc opens under, for every member.
660
+ parentDoc:
661
+ owner.integration && record.docPath
662
+ ? recordedDocName(owner.integration, record.docPath)
663
+ : docs.name === dirName && record.docPath
664
+ ? docStem(record.docPath)
665
+ : docs.name,
666
+ };
667
+ if (docs.usage) scoped.usage = docs.usage;
668
+ if (docs.theming) scoped.theming = docs.theming;
669
+ if (docs.import) scoped.import = docs.import;
670
+ return scoped;
671
+ }
@@ -19,9 +19,11 @@ import {
19
19
  requireCoreDir,
20
20
  loadIntegrationsSafely,
21
21
  resolveOwners,
22
+ scopeIntegrationMember,
22
23
  classifyScope,
23
24
  assertUnambiguousOwners,
24
25
  resolveLegacyExternalDoc,
26
+ legacyExternalKeeps,
25
27
  resolveCoreSourcePath,
26
28
  resolveUnscopedDoc,
27
29
  loadComponentDoc,
@@ -29,6 +31,7 @@ import {
29
31
  ComponentAmbiguityError,
30
32
  installedComponentPackageVersion,
31
33
  resolveComponentReplacement,
34
+ unscopedComponentOwners,
32
35
  } from './_adapter.mjs';
33
36
  import {componentList} from './list/list.mjs';
34
37
  import {componentDetail} from './detail/detail.mjs';
@@ -427,7 +430,13 @@ export async function component(name, options = {}) {
427
430
  if (blocks) {
428
431
  return componentDetailBlocks(dirName, cwd, owner.package);
429
432
  }
430
- const docs = await loadComponentDoc(owner.docPath, docOpts);
433
+ const loaded = await loadComponentDoc(owner.docPath, docOpts);
434
+ // A family member an integration lists under its own name reads as that
435
+ // member, the way a Core sub-component does below.
436
+ const docs =
437
+ scoped.kind === 'integration'
438
+ ? scopeIntegrationMember(loaded, owner, dirName)
439
+ : loaded;
431
440
  if (props) return componentDetailProps(docs, owner.package);
432
441
  return componentDetail(docs, owner, dirName, coreDir);
433
442
  }
@@ -481,12 +490,14 @@ export async function component(name, options = {}) {
481
490
  });
482
491
  }
483
492
 
493
+ // The owner rule runs first, over valid and invalid owners alike.
494
+ const ruled = unscopedComponentOwners(owners);
484
495
  // Invalid integration metadata does not create ambiguity against a valid
485
- // owner. Keep raw owners only when no doc owner is valid, so an integration-
496
+ // owner. Keep ruled owners only when no doc owner is valid, so an integration-
486
497
  // only component still exposes its source and returns ERR_INVALID_DOC for
487
498
  // detail instead of degrading to an unrelated unknown-component error.
488
499
  const validOwners = [];
489
- for (const owner of owners) {
500
+ for (const owner of ruled) {
490
501
  if (owner.package === CORE_PACKAGE) {
491
502
  validOwners.push(owner);
492
503
  continue;
@@ -498,7 +509,12 @@ export async function component(name, options = {}) {
498
509
  // Project/Doctor report invalid metadata; it is not an effective owner.
499
510
  }
500
511
  }
501
- const effectiveOwners = validOwners.length > 0 ? validOwners : owners;
512
+ const loadable = validOwners.length > 0 ? validOwners : ruled;
513
+ // A legacy docs package's exact doc keeps its name over an export name a doc
514
+ // records, as Core and file-named owners do.
515
+ const effectiveOwners = legacyExternalKeeps(cwd, dirName, loadable)
516
+ ? []
517
+ : loadable;
502
518
 
503
519
  // ── Ambiguity: owned by MORE THAN ONE valid package, no --package ──
504
520
  assertUnambiguousOwners(effectiveOwners, dirName);
@@ -516,7 +532,8 @@ export async function component(name, options = {}) {
516
532
  // Integration components don't carry showcases — fail without scanning.
517
533
  return componentDetailShowcase(dirName, {cwd, name, resolve: false, ownerPackage: owner.package});
518
534
  }
519
- const docs = await loadComponentDoc(owner.docPath, docOpts);
535
+ const loaded = await loadComponentDoc(owner.docPath, docOpts);
536
+ const docs = scopeIntegrationMember(loaded, owner, dirName);
520
537
  if (props) return componentDetailProps(docs, owner.package);
521
538
  return componentDetail(docs, owner, dirName, coreDir);
522
539
  }