@astryxdesign/cli 0.7.2-canary.621784f → 0.7.2-canary.64e1dde

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 (186) hide show
  1. package/README.md +12 -12
  2. package/api/discover/_adapter.d.mts +119 -12
  3. package/api/discover/_adapter.mjs +449 -10
  4. package/api/discover/_adapter.test.mjs +599 -17
  5. package/api/discover/_catalog-view.d.mts +16 -5
  6. package/api/discover/_catalog-view.mjs +32 -8
  7. package/api/discover/discover.d.mts +11 -0
  8. package/api/discover/discover.doc.mjs +7 -6
  9. package/api/discover/discover.mjs +107 -19
  10. package/api/discover/discover.type.d.mts +18 -7
  11. package/api/discover/discover.type.mjs +15 -7
  12. package/api/discover/list/list.d.mts +4 -3
  13. package/api/discover/list/list.mjs +17 -10
  14. package/api/doctor/doctor.mjs +27 -3
  15. package/api/doctor/doctor.test.mjs +43 -0
  16. package/api/doctor/theme-checks.test.mjs +136 -0
  17. package/api/gap-report/gap-report.d.mts +3 -0
  18. package/api/gap-report/gap-report.doc.mjs +11 -3
  19. package/api/gap-report/gap-report.mjs +152 -48
  20. package/api/gap-report/gap-report.test.mjs +233 -0
  21. package/api/gap-report/gap-report.type.d.mts +41 -0
  22. package/api/gap-report/gap-report.type.mjs +18 -0
  23. package/api/integration/_adapter.d.mts +10 -0
  24. package/api/integration/_adapter.mjs +13 -0
  25. package/api/integration/authoring-checks.mjs +14 -3
  26. package/api/integration/authoring-checks.test.mjs +326 -0
  27. package/api/integration/authoring-checks.type.d.mts +50 -0
  28. package/api/integration/authoring-checks.type.mjs +21 -1
  29. package/api/integration/integrationComponentConflicts.doc.mjs +9 -3
  30. package/api/integration/integrationDocConflicts.doc.mjs +17 -5
  31. package/api/integration/pack-check.mjs +292 -7
  32. package/api/integration/pack-check.test.mjs +341 -0
  33. package/api/integration/validateIntegration.doc.mjs +3 -1
  34. package/api/search/search.d.mts +72 -12
  35. package/api/search/search.domain-priority.test.mjs +108 -18
  36. package/api/search/search.mjs +501 -37
  37. package/api/search/search.test.mjs +139 -0
  38. package/api/theme/build/build.family.test.mjs +54 -6
  39. package/api/theme/build/build.mjs +110 -13
  40. package/api/theme/themeBuild.doc.mjs +4 -4
  41. package/api/upgrade/_adapter.d.mts +40 -2
  42. package/api/upgrade/_adapter.mjs +117 -4
  43. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  44. package/api/upgrade/run/run.mjs +30 -1
  45. package/api/upgrade/status/status.d.mts +21 -5
  46. package/api/upgrade/status/status.mjs +45 -8
  47. package/api/upgrade/upgrade.doc.mjs +5 -3
  48. package/api/upgrade/upgrade.type.d.mts +23 -0
  49. package/api/upgrade/upgrade.type.mjs +16 -1
  50. package/assets/codemods/runner.mjs +7 -1
  51. package/assets/discover/official-packages.json +367 -0
  52. package/assets/docs/author-a-theme.doc.mjs +2 -2
  53. package/assets/docs/styling-overview.doc.mjs +1 -1
  54. package/assets/docs/theme.doc.mjs +1 -1
  55. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  56. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  57. package/assets/docs/tree/add-a-topic.doc.mjs +11 -8
  58. package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
  59. package/assets/docs/tree/block-template.doc.mjs +6 -18
  60. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  61. package/assets/docs/tree/check-the-props.doc.mjs +2 -2
  62. package/assets/docs/tree/check-your-docs.doc.mjs +16 -7
  63. package/assets/docs/tree/checks.doc.mjs +7 -7
  64. package/assets/docs/tree/codemods.doc.mjs +4 -4
  65. package/assets/docs/tree/component-family.doc.mjs +3 -5
  66. package/assets/docs/tree/component-imports.doc.mjs +2 -2
  67. package/assets/docs/tree/components.doc.mjs +1 -1
  68. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -16
  69. package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
  70. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  71. package/assets/docs/tree/docs.doc.mjs +3 -3
  72. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  73. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  74. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  75. package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
  76. package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
  77. package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
  78. package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
  79. package/assets/docs/tree/integrations.doc.mjs +8 -0
  80. package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
  81. package/assets/docs/tree/layout.doc.mjs +6 -6
  82. package/assets/docs/tree/links.doc.mjs +5 -4
  83. package/assets/docs/tree/migration-setup.doc.mjs +3 -2
  84. package/assets/docs/tree/migration-verification.doc.mjs +0 -1
  85. package/assets/docs/tree/migration.doc.mjs +0 -1
  86. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  87. package/assets/docs/tree/page-template.doc.mjs +3 -7
  88. package/assets/docs/tree/publishing.doc.mjs +2 -2
  89. package/assets/docs/tree/quick-start.doc.mjs +37 -21
  90. package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
  91. package/assets/docs/tree/replace-a-core-template.doc.mjs +5 -7
  92. package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
  93. package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
  94. package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
  95. package/assets/docs/tree/single-component.doc.mjs +12 -4
  96. package/assets/docs/tree/start-a-template.doc.mjs +3 -3
  97. package/assets/docs/tree/subcomponent.doc.mjs +6 -6
  98. package/assets/docs/tree/template-assets.doc.mjs +2 -2
  99. package/assets/docs/tree/template-doc-overview.doc.mjs +5 -16
  100. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  101. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  102. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  103. package/assets/docs/tree/template-styles.doc.mjs +2 -2
  104. package/assets/docs/tree/templates.doc.mjs +1 -1
  105. package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
  106. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  107. package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
  108. package/assets/docs/tree/troubleshooting.doc.mjs +8 -8
  109. package/assets/docs/tree/upgrading.doc.mjs +4 -4
  110. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
  111. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  112. package/assets/docs/tree/versioning.doc.mjs +6 -6
  113. package/assets/docs/tree/write-the-template-file.doc.mjs +2 -2
  114. package/authoring/codemod/codemod.doc.mjs +7 -3
  115. package/authoring/config/config.doc.mjs +9 -6
  116. package/authoring/config/type.ts +4 -2
  117. package/authoring/discover/discover.doc.mjs +1 -1
  118. package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
  119. package/authoring/doctypes/command/command.doc.mjs +14 -12
  120. package/authoring/doctypes/component/component.doc.mjs +29 -26
  121. package/authoring/doctypes/component/type.ts +7 -5
  122. package/authoring/doctypes/enum/enum.doc.mjs +7 -4
  123. package/authoring/doctypes/function/function.doc.mjs +9 -8
  124. package/authoring/doctypes/hook/hook.doc.mjs +5 -4
  125. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
  126. package/authoring/doctypes/reference/reference.doc.mjs +11 -10
  127. package/authoring/doctypes/schema/schema.doc.mjs +9 -9
  128. package/authoring/doctypes/template/template.doc.mjs +2 -2
  129. package/authoring/doctypes/theme/theme.doc.mjs +2 -2
  130. package/authoring/gap-report/gap-report.doc.mjs +2 -2
  131. package/authoring/identity/identity.doc.mjs +3 -3
  132. package/authoring/integration/integration.doc.mjs +4 -3
  133. package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
  134. package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
  135. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  136. package/clients/cli/commands/discover.doc.mjs +1 -1
  137. package/clients/cli/commands/discover.mjs +144 -93
  138. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  139. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  140. package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -1
  141. package/clients/cli/commands/doctor-integration-docs.doc.mjs +17 -5
  142. package/clients/cli/commands/doctor-integration-validate.doc.mjs +3 -1
  143. package/clients/cli/commands/doctor.mjs +34 -3
  144. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  145. package/clients/cli/commands/gap-report.mjs +24 -2
  146. package/clients/cli/commands/gap-report.test.mjs +79 -0
  147. package/clients/cli/commands/integration-check.test.mjs +65 -0
  148. package/clients/cli/commands/integration.mjs +2 -3
  149. package/clients/cli/commands/json-contract.test.mjs +5 -1
  150. package/clients/cli/commands/setup-nudge.test.mjs +79 -1
  151. package/clients/cli/commands/swizzle.mjs +5 -3
  152. package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
  153. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  154. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  155. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  156. package/clients/cli/index.mjs +29 -5
  157. package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
  158. package/foundation/agent-docs/agent-doc-state.mjs +38 -0
  159. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  160. package/foundation/agent-docs/agent-docs.mjs +8 -6
  161. package/foundation/discovery/authoring-self-docs.mjs +1 -1
  162. package/foundation/discovery/copied-passages.d.mts +208 -0
  163. package/foundation/discovery/copied-passages.mjs +720 -0
  164. package/foundation/discovery/copied-passages.test.mjs +124 -0
  165. package/foundation/discovery/doc-types.d.mts +1 -1
  166. package/foundation/discovery/doc-types.mjs +3 -3
  167. package/foundation/discovery/doc-types.test.mjs +48 -0
  168. package/foundation/discovery/docs-discovery.d.mts +7 -0
  169. package/foundation/discovery/docs-discovery.mjs +26 -2
  170. package/foundation/discovery/project-typescript.d.mts +11 -2
  171. package/foundation/discovery/project-typescript.mjs +32 -4
  172. package/foundation/discovery/prop-drift.d.mts +1 -1
  173. package/foundation/discovery/prop-drift.mjs +2 -2
  174. package/foundation/discovery/prop-drift.test.mjs +55 -2
  175. package/foundation/discovery/type-text.mjs +1 -1
  176. package/foundation/discovery/type-text.test.mjs +1 -1
  177. package/foundation/doc-compiler/doc-loads.test.mjs +10 -2
  178. package/foundation/env/package-manager.d.mts +32 -0
  179. package/foundation/env/package-manager.mjs +47 -0
  180. package/foundation/env/package-manager.test.mjs +194 -7
  181. package/foundation/fs/module-loader.d.mts +2 -1
  182. package/foundation/fs/module-loader.mjs +60 -4
  183. package/foundation/fs/module-loader.test.mjs +194 -0
  184. package/foundation/response/response-types.doc.mjs +7 -6
  185. package/package.json +11 -11
  186. package/scripts/postinstall.mjs +3 -3
package/README.md CHANGED
@@ -437,7 +437,7 @@ Every response has a `type` discriminant. The full set is below (generated from
437
437
  | `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
438
438
  | `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
439
439
  | `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
440
- | `discover.list` | 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". |
440
+ | `discover.list` | What the project has, the integrations it loads and the official packages it declares, official packages first (name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered". |
441
441
  | `discover.detail` | 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. |
442
442
  | `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
443
443
  | `discover.item` | 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. |
@@ -447,8 +447,8 @@ Every response has a `type` discriminant. The full set is below (generated from
447
447
  | `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, package, command, basis, reason, alternatives, ...} (the start and each alternative name the package that owns the template), pages (search's closest templates), blocks and domain as SearchResultEntry[] (each naming its package), frame and foundation (Core component names), and hint {reason, commands} when thin. |
448
448
  | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |
449
449
  | `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package. |
450
- | `gap-report.categories` | The fixed gap category values and human-readable labels. |
451
- | `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals. |
450
+ | `gap-report.categories` | The fixed gap category values and human-readable labels; when a loaded integration names its own issues URL, meta.destinations lists every destination ({to, default, issuesUrl}) and meta.ask tells an agent to ask the person. |
451
+ | `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals; without --to, when a loaded integration names its own issues URL, destinations and ask as on gap-report.categories. |
452
452
  | `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
453
453
  | `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |
454
454
  | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. The envelope's package names the npm package that owns the template. |
@@ -468,8 +468,8 @@ Every response has a `type` discriminant. The full set is below (generated from
468
468
  | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
469
469
  | `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
470
470
  | `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |
471
- | `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
472
- | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
471
+ | `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. no_codemods and config_fixable carry cliBehindCore ({cliVersion, command}) when the installed Core is newer than the CLI, which then has no codemods for the releases after its own version. |
472
+ | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. When the installed Core is newer than the CLI, it also carries cliBehindCore ({cliVersion, command}): codemods for the releases after cliVersion did not run. |
473
473
  | `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |
474
474
  | `help` | Help, in one of two shapes. A bare `astryx --json` returns the root manifest: name, version, commands (the command names), jsonSupported, and manifest (the full payload `astryx manifest --json` returns). `--help --json` on any command, or `astryx help [command] --json`, returns that command's help: command, description, usage, options (each flags, description, and defaultValue and choices when set), and subcommands (each name and description). data.manifest marks the first shape; data.usage marks the second. |
475
475
  | `version` | The CLI version, for `astryx --version --json`: {version}. |
@@ -479,7 +479,7 @@ Every response has a `type` discriminant. The full set is below (generated from
479
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
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
- | `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`). |
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`). copiedPassages lists each pair of topics that repeat 10 or more words of prose word for word: topic, section, otherTopic, otherOwner (package \| core), words, passages, owner (the topic that should keep the text), text (the passage as the topic writes it), line (where the copy starts in the topic to change, or null), and message (the exact replacement); each is also a copied_passage warning in issues. |
483
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. |
484
484
 
485
485
  <!-- END GENERATED: response-types -->
@@ -581,12 +581,12 @@ There is no factory: write a plain object. For editor autocomplete and
581
581
  type-checking, annotate it with the `AstryxConfig` type exported from
582
582
  `@astryxdesign/cli/authoring`.
583
583
 
584
- | Field | Type | Purpose |
585
- | ----------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------- |
586
- | `integrations` | `string[]` | Integration package names to load (see [Integrations](#integrations)). |
587
- | `issuesUrl` | `string` | Where "report an issue" links point for your project. Defaults to the core issue tracker. |
588
- | `hooks.postCodemod` | `PostCodemodHook[]` | Commands to run after `astryx upgrade` applies codemods (e.g. reinstall, rebuild, reformat). |
589
- | `experimental.xle.components` | `Record<string, XleComponent>` | Register app-local components so layout (XLE) expressions can reference them by name. Unstable. |
584
+ | Field | Type | Purpose |
585
+ | ----------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
586
+ | `integrations` | `string[]` | Integration package names to load (see [Integrations](#integrations)). |
587
+ | `issuesUrl` | `string` | Where "report an issue" links point for your project. Defaults to the core issue tracker. |
588
+ | `hooks.postCodemod` | `PostCodemodHook[]` | Commands to run after `astryx upgrade` applies codemods (e.g. reinstall, rebuild, reformat). |
589
+ | `experimental.xle.components` | `Record<string, XleComponent>` | Custom components for the removed layout expander, keyed by component name. The CLI still validates the field, so an entry without a string `from` makes `astryx.config` invalid, but nothing reads it. |
590
590
 
591
591
  The config is validated against a strict schema when the CLI loads it, so an
592
592
  unknown field is a hard error rather than a silent no-op. `astryx doctor`
@@ -42,13 +42,28 @@ export function hasSources(project: Project | undefined): boolean;
42
42
  * @returns {Set<string>}
43
43
  */
44
44
  export function declaredDependencies(project: Project | undefined): Set<string>;
45
+ /**
46
+ * What the project's own package.json, the nearest one above the folder
47
+ * discover runs in, declares among the official packages.
48
+ * @param {Project | undefined} project
49
+ * @param {OfficialPackage[]} official
50
+ * @returns {OfficialDeclarations}
51
+ */
52
+ export function officialDeclarations(project: Project | undefined, official: OfficialPackage[]): OfficialDeclarations;
45
53
  /**
46
54
  * The command that adds a package with the project's package manager. Discover
47
- * only prints it; it never runs it.
55
+ * only prints it; it never runs it. Asked for one version, it adds that
56
+ * version. Given the official list, it otherwise pins an official package to
57
+ * what its entry names (spec:AST-051 FR2): the project's Core version or
58
+ * declared Core range, else the latest release. A range is quoted, because
59
+ * `^`, `<`, `>`, `|` and spaces mean something to a shell.
48
60
  * @param {Project | undefined} project
61
+ * @param {{official?: OfficialPackage[]}} [options]
49
62
  * @returns {(name: string, version?: string) => string}
50
63
  */
51
- export function addCommand(project: Project | undefined): (name: string, version?: string) => string;
64
+ export function addCommand(project: Project | undefined, { official }?: {
65
+ official?: OfficialPackage[];
66
+ }): (name: string, version?: string) => string;
52
67
  /**
53
68
  * The per-user cache directory the saved copies live in, never inside a
54
69
  * project. Standard platform locations only.
@@ -56,15 +71,17 @@ export function addCommand(project: Project | undefined): (name: string, version
56
71
  */
57
72
  export function defaultCacheDir(): string;
58
73
  /**
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.
74
+ * Call every discover source (see {@link callOwnSources}), then read the
75
+ * official list (spec:AST-051 FR11). The list comes last, so a source keeps
76
+ * its entry for an official package, or for any package of the same
77
+ * integration (FR7); the list adds the official packages no source covers.
78
+ * The result stays in source order; discover puts official packages first
79
+ * only where it shows them ({@link officialFirst}).
63
80
  *
64
81
  * @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]
82
+ * @param {{package?: string, version?: string}} [request]
83
+ * @param {{cacheDir?: string, timeoutMs?: number, official?: OfficialList}} [options]
84
+ * `official`: the list {@link officialList} read; read here when absent
68
85
  * @returns {Promise<CatalogResult>}
69
86
  */
70
87
  export function callSources(project: Project | undefined, request?: {
@@ -73,7 +90,62 @@ export function callSources(project: Project | undefined, request?: {
73
90
  }, options?: {
74
91
  cacheDir?: string;
75
92
  timeoutMs?: number;
93
+ official?: OfficialList;
76
94
  }): Promise<CatalogResult>;
95
+ /**
96
+ * Official packages first, in the official list's order; the rest keep theirs.
97
+ * @template T
98
+ * @param {T[]} items
99
+ * @param {OfficialPackage[]} official
100
+ * @param {(item: T) => string} nameOf
101
+ * @returns {T[]}
102
+ */
103
+ export function officialFirst<T>(items: T[], official: OfficialPackage[], nameOf: (item: T) => string): T[];
104
+ /**
105
+ * The official list this CLI carries (spec:AST-051 FR11). The file holds no
106
+ * versions; each entry takes them from this CLI and the project:
107
+ *
108
+ * - Its latest release is the newest release this CLI knows: its own version
109
+ * on a release CLI, or the project's Core version when that is a newer
110
+ * release.
111
+ * - A package released with Core lists a release CLI's own version and the
112
+ * project's Core version (installed, else declared exactly), so each,
113
+ * the latest release included, can be looked up. Its add command pins the project's Core version, else the Core range
114
+ * the project declares, else the latest release; nothing on a canary CLI in
115
+ * a project with no Core, which may have been published without it.
116
+ * - A canary-only package is listed only by a canary CLI, as a prerelease at
117
+ * the project's Core version when that is a prerelease, else at the CLI's
118
+ * own version when the project has no Core. It is not listed beside a
119
+ * released or declared Core, which it cannot be installed with.
120
+ *
121
+ * @param {{file?: string, version?: string, project?: Project}} [options] the
122
+ * list file and the CLI version to read it for, both defaulting to this
123
+ * CLI's own, and the project whose Core decides the versions
124
+ * @returns {OfficialList}
125
+ */
126
+ export function officialList({ file, version, project, }?: {
127
+ file?: string;
128
+ version?: string;
129
+ project?: Project;
130
+ }): OfficialList;
131
+ /**
132
+ * What the project has: its installed integrations plus each official package
133
+ * its own package.json declares as a dependency whose entry the official list
134
+ * supplied, official packages first. A declared official package that a source
135
+ * lists stays as that source shows it (FR7). One that failed to load as an
136
+ * integration stays out. A declared one takes what it adds from the list and
137
+ * its version from the copy the project installed, under an npm alias too.
138
+ *
139
+ * @param {Project | undefined} project
140
+ * @param {InstalledPackage[]} installed from {@link describeInstalled}
141
+ * @param {CatalogResult} catalog
142
+ * @param {OfficialDeclarations} declared from {@link officialDeclarations}
143
+ * @param {OfficialPackage[]} official the official list, for the order
144
+ * @returns {Array<InstalledPackage & {declaredOfficial?: true}>}
145
+ */
146
+ export function withDeclaredOfficial(project: Project | undefined, installed: InstalledPackage[], catalog: CatalogResult, declared: OfficialDeclarations, official: OfficialPackage[]): Array<InstalledPackage & {
147
+ declaredOfficial?: true;
148
+ }>;
77
149
  /**
78
150
  * Project a scanned or installed package into the discover list/detail entry
79
151
  * shape. Shared by the list and detail leaves so the entry keys (and their
@@ -104,11 +176,43 @@ export function loadValidatedDoc(result: ComponentResolution, { lang, zh }: {
104
176
  lang?: string | null;
105
177
  zh?: boolean;
106
178
  }): Promise<import("./discover.type.mjs").DiscoverDetailDocResponse["data"]>;
179
+ /** The name the official list goes by, as a source and on each of its entries. */
180
+ export const OFFICIAL_SOURCE_NAME: "Astryx";
181
+ /** The official list, generated from the repository when the CLI is built. */
182
+ export const OFFICIAL_LIST_FILE: string;
107
183
  /** The list and detail entry fields for each item kind, in display order. */
108
184
  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
185
  export type ScannedPackage = import("./_package-scanner.mjs").ScannedPackage;
110
186
  export type DiscoverPackage = import("../../authoring/discover/type").DiscoverPackage;
111
187
  export type DiscoverSource = import("../../authoring/discover/type").DiscoverSource;
188
+ /**
189
+ * An official package as this CLI lists it (spec:AST-051 FR11), with what its
190
+ * add command pins (FR2): the project's Core version, the Core range the
191
+ * project declares, or the latest release; with none, it pins nothing.
192
+ */
193
+ export type OfficialPackage = DiscoverPackage & {
194
+ pin?: string;
195
+ };
196
+ /**
197
+ * The official packages the project's package.json declares: the real package
198
+ * name of each, mapped to the name it is installed under (an npm alias such as
199
+ * `"my-theme": "npm:@astryxdesign/theme-gothic@0.7.0"` installs under
200
+ * `my-theme`). `dependency` holds those declared in dependencies,
201
+ * devDependencies or optionalDependencies, which make a package the project's
202
+ * own; `any` adds peerDependencies, which only keep it from being offered.
203
+ */
204
+ export type OfficialDeclarations = {
205
+ dependency: Map<string, string>;
206
+ any: Set<string>;
207
+ };
208
+ /**
209
+ * The official list as this CLI reads it. `error` says why the file could not
210
+ * be read; the list is then empty and discover reports it like a failed source.
211
+ */
212
+ export type OfficialList = {
213
+ packages: OfficialPackage[];
214
+ error?: string;
215
+ };
112
216
  /**
113
217
  * An installed integration with what it adds, per kind. `components` is the
114
218
  * scanned component list the discover leaves have always used.
@@ -129,7 +233,8 @@ export type SourceState = {
129
233
  */
130
234
  name: string;
131
235
  /**
132
- * `astryx.config`, or the integration that exports it
236
+ * `astryx.config`, the integration that exports it, or
237
+ * `@astryxdesign/cli` for the official list
133
238
  */
134
239
  from: string;
135
240
  status: "fresh" | "saved" | "failed";
@@ -145,13 +250,15 @@ export type SourceState = {
145
250
  error?: string | undefined;
146
251
  };
147
252
  /**
148
- * Everything every source returned, merged. When two sources list the same
149
- * package, the earlier source's entry is kept.
253
+ * Everything every source returned, merged, the official list last. When two
254
+ * sources list the same package, the earlier source's entry is kept. `official`
255
+ * marks an entry the official list supplied.
150
256
  */
151
257
  export type CatalogResult = {
152
258
  sources: SourceState[];
153
259
  packages: Array<DiscoverPackage & {
154
260
  source: string;
261
+ official?: true;
155
262
  }>;
156
263
  };
157
264
  /**