@astryxdesign/cli 0.7.2-canary.020e1fe → 0.7.2-canary.081ccea

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 (133) hide show
  1. package/README.md +62 -62
  2. package/api/component/_adapter.d.mts +31 -0
  3. package/api/component/_adapter.mjs +116 -0
  4. package/api/component/component.mjs +60 -10
  5. package/api/component/doc-links.test.mjs +386 -0
  6. package/api/discover/_adapter.d.mts +119 -12
  7. package/api/discover/_adapter.mjs +449 -10
  8. package/api/discover/_adapter.test.mjs +599 -17
  9. package/api/discover/_catalog-view.d.mts +16 -5
  10. package/api/discover/_catalog-view.mjs +32 -8
  11. package/api/discover/detail/doc/doc.mjs +9 -1
  12. package/api/discover/discover.d.mts +11 -0
  13. package/api/discover/discover.doc.mjs +7 -6
  14. package/api/discover/discover.mjs +107 -19
  15. package/api/discover/discover.type.d.mts +18 -7
  16. package/api/discover/discover.type.mjs +15 -7
  17. package/api/discover/list/list.d.mts +4 -3
  18. package/api/discover/list/list.mjs +17 -10
  19. package/api/docs/_adapter.d.mts +63 -0
  20. package/api/docs/_adapter.mjs +309 -16
  21. package/api/docs/integration-tree.test.mjs +22 -0
  22. package/api/docs/list/list.mjs +12 -2
  23. package/api/doctor/theme-checks.test.mjs +136 -0
  24. package/api/gap-report/gap-report.d.mts +3 -0
  25. package/api/gap-report/gap-report.doc.mjs +11 -3
  26. package/api/gap-report/gap-report.mjs +152 -48
  27. package/api/gap-report/gap-report.test.mjs +233 -0
  28. package/api/gap-report/gap-report.type.d.mts +41 -0
  29. package/api/gap-report/gap-report.type.mjs +18 -0
  30. package/api/integration/_adapter.d.mts +33 -0
  31. package/api/integration/_adapter.mjs +58 -0
  32. package/api/integration/authoring-checks.mjs +98 -3
  33. package/api/integration/authoring-checks.test.mjs +769 -0
  34. package/api/integration/authoring-checks.type.d.mts +134 -0
  35. package/api/integration/authoring-checks.type.mjs +60 -1
  36. package/api/integration/integrationComponentConflicts.doc.mjs +3 -1
  37. package/api/integration/integrationDocConflicts.doc.mjs +22 -5
  38. package/api/integration/pack-check.mjs +296 -7
  39. package/api/integration/pack-check.test.mjs +367 -0
  40. package/api/integration/validate-integration-fixes.test.mjs +67 -0
  41. package/api/integration/validate-integration.mjs +28 -3
  42. package/api/integration/validate-integration.test.mjs +77 -8
  43. package/api/integration/validateIntegration.doc.mjs +1 -1
  44. package/api/search/search.mjs +2 -1
  45. package/api/upgrade/_adapter.d.mts +40 -2
  46. package/api/upgrade/_adapter.mjs +117 -4
  47. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  48. package/api/upgrade/run/run.mjs +30 -1
  49. package/api/upgrade/status/status.d.mts +21 -5
  50. package/api/upgrade/status/status.mjs +45 -8
  51. package/api/upgrade/upgrade.doc.mjs +5 -3
  52. package/api/upgrade/upgrade.type.d.mts +23 -0
  53. package/api/upgrade/upgrade.type.mjs +16 -1
  54. package/assets/codemods/runner.mjs +7 -1
  55. package/assets/discover/official-packages.json +367 -0
  56. package/assets/docs/author-a-theme.doc.mjs +2 -2
  57. package/assets/docs/browser-support.doc.mjs +1 -1
  58. package/assets/docs/styling-overview.doc.mjs +1 -1
  59. package/assets/docs/theme.doc.mjs +1 -1
  60. package/assets/docs/tree/add-a-topic.doc.mjs +3 -3
  61. package/assets/docs/tree/check-the-props.doc.mjs +7 -2
  62. package/assets/docs/tree/check-your-docs.doc.mjs +15 -3
  63. package/assets/docs/tree/checks.doc.mjs +5 -5
  64. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -5
  65. package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
  66. package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
  67. package/assets/docs/tree/layout.doc.mjs +6 -6
  68. package/assets/docs/tree/migration-setup.doc.mjs +2 -2
  69. package/assets/docs/tree/publishing.doc.mjs +3 -3
  70. package/assets/docs/tree/quick-start.doc.mjs +2 -2
  71. package/assets/docs/tree/sections-and-placement.doc.mjs +2 -2
  72. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  73. package/assets/docs/tree/troubleshooting.doc.mjs +5 -5
  74. package/assets/docs/tree/upgrading.doc.mjs +1 -1
  75. package/authoring/discover/discover.doc.mjs +1 -1
  76. package/authoring/doctypes/component/component.doc.mjs +1 -1
  77. package/authoring/doctypes/component/type.ts +8 -0
  78. package/authoring/doctypes/hook/type.ts +4 -0
  79. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  80. package/clients/cli/commands/discover.doc.mjs +1 -1
  81. package/clients/cli/commands/discover.mjs +144 -93
  82. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  83. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  84. package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -2
  85. package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
  86. package/clients/cli/commands/doctor-integration.test.mjs +48 -1
  87. package/clients/cli/commands/doctor.mjs +91 -5
  88. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  89. package/clients/cli/commands/gap-report.mjs +24 -2
  90. package/clients/cli/commands/gap-report.test.mjs +79 -0
  91. package/clients/cli/commands/integration-authoring.test.mjs +46 -0
  92. package/clients/cli/commands/integration-check.test.mjs +144 -0
  93. package/clients/cli/commands/integration.mjs +12 -7
  94. package/clients/cli/commands/json-contract.test.mjs +5 -1
  95. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  96. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  97. package/foundation/discovery/copied-passages.d.mts +216 -0
  98. package/foundation/discovery/copied-passages.mjs +720 -0
  99. package/foundation/discovery/copied-passages.test.mjs +124 -0
  100. package/foundation/discovery/doc-consistency.d.mts +34 -0
  101. package/foundation/discovery/doc-consistency.mjs +513 -0
  102. package/foundation/discovery/doc-consistency.test.mjs +347 -0
  103. package/foundation/discovery/doc-fluff.d.mts +112 -0
  104. package/foundation/discovery/doc-fluff.mjs +328 -0
  105. package/foundation/discovery/doc-fluff.test.mjs +142 -0
  106. package/foundation/discovery/doc-types.mjs +12 -5
  107. package/foundation/discovery/doc-types.test.mjs +46 -2
  108. package/foundation/discovery/docs-discovery.d.mts +7 -0
  109. package/foundation/discovery/docs-discovery.mjs +26 -2
  110. package/foundation/discovery/prop-drift.d.mts +25 -6
  111. package/foundation/discovery/prop-drift.mjs +171 -6
  112. package/foundation/discovery/prop-drift.test.mjs +65 -0
  113. package/foundation/discovery/stray-pointers.d.mts +52 -0
  114. package/foundation/discovery/stray-pointers.mjs +293 -0
  115. package/foundation/discovery/stray-pointers.test.mjs +86 -0
  116. package/foundation/doc-compiler/doc-loads.test.mjs +16 -0
  117. package/foundation/doc-compiler/links.d.mts +32 -0
  118. package/foundation/doc-compiler/links.mjs +163 -26
  119. package/foundation/doc-compiler/links.test.mjs +97 -4
  120. package/foundation/doc-compiler/tree.mjs +30 -1
  121. package/foundation/doc-compiler/tree.test.mjs +7 -0
  122. package/foundation/env/package-manager.d.mts +32 -0
  123. package/foundation/env/package-manager.mjs +47 -0
  124. package/foundation/env/package-manager.test.mjs +194 -7
  125. package/foundation/fs/module-loader.d.mts +2 -1
  126. package/foundation/fs/module-loader.mjs +60 -4
  127. package/foundation/fs/module-loader.test.mjs +194 -0
  128. package/foundation/integrations/contribution-inventory.d.mts +11 -0
  129. package/foundation/integrations/contribution-inventory.mjs +50 -2
  130. package/foundation/integrations/issue.ts +6 -0
  131. package/foundation/integrations/validate-contributions.mjs +30 -1
  132. package/foundation/response/response-types.doc.mjs +10 -9
  133. package/package.json +11 -11
package/README.md CHANGED
@@ -419,68 +419,68 @@ Every response has a `type` discriminant. The full set is below (generated from
419
419
 
420
420
  <!-- BEGIN GENERATED: response-types -->
421
421
 
422
- | Type | What `data` carries |
423
- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
424
- | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
425
- | `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |
426
- | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
427
- | `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |
428
- | `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |
429
- | `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |
430
- | `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |
431
- | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |
432
- | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |
433
- | `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
434
- | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
435
- | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
436
- | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |
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
- | `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
- | `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". |
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
- | `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
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. |
444
- | `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |
445
- | `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |
446
- | `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
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
- | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |
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. |
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
- | `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
- | `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. |
455
- | `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template. |
456
- | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
457
- | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |
458
- | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
459
- | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
460
- | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
461
- | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
462
- | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
463
- | `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
464
- | `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
465
- | `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |
466
- | `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
467
- | `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |
468
- | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
469
- | `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
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. |
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
- | `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
- | `version` | The CLI version, for `astryx --version --json`: {version}. |
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
- | `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
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}. 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
- | `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. 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`). |
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. |
422
+ | Type | What `data` carries |
423
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
424
+ | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
425
+ | `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |
426
+ | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
427
+ | `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |
428
+ | `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |
429
+ | `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |
430
+ | `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |
431
+ | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |
432
+ | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |
433
+ | `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
434
+ | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
435
+ | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
436
+ | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |
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
+ | `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
+ | `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
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
+ | `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
+ | `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
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. |
444
+ | `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |
445
+ | `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |
446
+ | `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
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
+ | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |
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; 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
+ | `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
+ | `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
+ | `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. |
455
+ | `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template. |
456
+ | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
457
+ | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |
458
+ | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
459
+ | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
460
+ | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
461
+ | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
462
+ | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
463
+ | `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
464
+ | `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
465
+ | `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |
466
+ | `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
467
+ | `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |
468
+ | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
469
+ | `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
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. 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
+ | `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
+ | `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
+ | `version` | The CLI version, for `astryx --version --json`: {version}. |
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
+ | `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
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, fix?, file?, line?}] (the issues validation finds in the source and, prefixed packed_, in the packed tree, with the fix and the place when the check knows them). |
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, fix?, file?, line?} (fix: the change that resolves it; file and line: where, relative to the package). 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
+ | `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. 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; a default_mismatch carries docDefault, codeDefault, and a fix), 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`). 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. fluff lists padding phrases and low-density topics: topic, kind (phrase \| density), phrase, section, file (relative to the package root), line, density, and message (what to cut or write instead); each is also a doc_fluff warning in issues. strayPointers lists each code span that is exactly `astryx docs <name>` for a doc that exists, in the prose, description or summary of a topic or the text fields of a component doc: topic (the topic or component doc), kind (topic \| component), section, field (the field outside any section, such as description or usage.bestPractices[0].description, else null), file (relative to the package root), line, pointer (the written command), link (the {@link} that replaces it), and message; each is also a stray_doc_pointer warning in issues. |
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 -->
486
486
  <!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
@@ -245,6 +245,37 @@ export function scopeIntegrationMember(docs: LoadedComponentDoc, owner: Ownershi
245
245
  parentDoc?: string;
246
246
  import?: string;
247
247
  };
248
+ /**
249
+ * A search response with every inline `{@link <target>}` in a component
250
+ * result's description resolved to the command that opens the doc it names,
251
+ * as `astryx component` prints it (spec:AST-047 FR9). The response object is
252
+ * kept, with its results replaced.
253
+ * @template {{data: {results: any[]}}} R
254
+ * @param {R} response
255
+ * @param {string} cwd
256
+ * @returns {Promise<R>}
257
+ */
258
+ export function linkSearchResponse<R extends {
259
+ data: {
260
+ results: any[];
261
+ };
262
+ }>(response: R, cwd: string): Promise<R>;
263
+ /**
264
+ * A component read with every inline `{@link <target>}` in its doc text
265
+ * resolved to the command that opens the doc it names (spec:AST-047 FR9), in
266
+ * the detail, its props projection, and each list entry. A Core component's
267
+ * links resolve against the CLI's own docs; an integration's against that
268
+ * integration's. A link that names no doc prints as written.
269
+ * @template {{type: string, package?: string, data?: any}} R
270
+ * @param {R} response
271
+ * @param {string} cwd
272
+ * @returns {Promise<R>}
273
+ */
274
+ export function linkComponentResponse<R extends {
275
+ type: string;
276
+ package?: string;
277
+ data?: any;
278
+ }>(response: R, cwd: string): Promise<R>;
248
279
  /**
249
280
  * Internal ambiguity marker. Single-component callers still receive the same
250
281
  * AstryxError code, message, and suggestions; batch callers can additionally
@@ -45,6 +45,11 @@ import {loadComponentDoc as loadValidatedComponentDoc} from '../../foundation/di
45
45
  import {resolveComponentReplacements} from '../../foundation/discovery/component-replacement.mjs';
46
46
  import {searchComponents} from '../../foundation/text/string-utils.mjs';
47
47
  import {AstryxError} from '../error.mjs';
48
+ import {
49
+ componentLinkProvider,
50
+ linkComponentDoc,
51
+ loadDocsCatalog,
52
+ } from '../docs/_adapter.mjs';
48
53
 
49
54
  export {CORE_PACKAGE, unscopedComponentOwners};
50
55
 
@@ -669,3 +674,114 @@ export function scopeIntegrationMember(docs, owner, dirName) {
669
674
  if (docs.import) scoped.import = docs.import;
670
675
  return scoped;
671
676
  }
677
+
678
+ /**
679
+ * A search response with every inline `{@link <target>}` in a component
680
+ * result's description resolved to the command that opens the doc it names,
681
+ * as `astryx component` prints it (spec:AST-047 FR9). The response object is
682
+ * kept, with its results replaced.
683
+ * @template {{data: {results: any[]}}} R
684
+ * @param {R} response
685
+ * @param {string} cwd
686
+ * @returns {Promise<R>}
687
+ */
688
+ export async function linkSearchResponse(response, cwd) {
689
+ const results = response.data.results;
690
+ if (
691
+ !results.some(
692
+ result =>
693
+ result?.domain === 'component' &&
694
+ typeof result.description === 'string' &&
695
+ result.description.includes('{@link'),
696
+ )
697
+ ) {
698
+ return response;
699
+ }
700
+ const linked = [];
701
+ for (const result of results) {
702
+ if (
703
+ result?.domain !== 'component' ||
704
+ typeof result.description !== 'string' ||
705
+ !result.description.includes('{@link')
706
+ ) {
707
+ linked.push(result);
708
+ continue;
709
+ }
710
+ const read = await linkComponentResponse(
711
+ {
712
+ type: 'component.detail',
713
+ package: result.package,
714
+ data: {description: result.description},
715
+ },
716
+ cwd,
717
+ );
718
+ linked.push({...result, description: read.data.description});
719
+ }
720
+ response.data = {...response.data, results: linked};
721
+ return response;
722
+ }
723
+
724
+ /**
725
+ * A component read with every inline `{@link <target>}` in its doc text
726
+ * resolved to the command that opens the doc it names (spec:AST-047 FR9), in
727
+ * the detail, its props projection, and each list entry. A Core component's
728
+ * links resolve against the CLI's own docs; an integration's against that
729
+ * integration's. A link that names no doc prints as written.
730
+ * @template {{type: string, package?: string, data?: any}} R
731
+ * @param {R} response
732
+ * @param {string} cwd
733
+ * @returns {Promise<R>}
734
+ */
735
+ export async function linkComponentResponse(response, cwd) {
736
+ const {type} = response;
737
+ if (
738
+ type !== 'component.detail' &&
739
+ type !== 'component.detail.props' &&
740
+ type !== 'component.list'
741
+ ) {
742
+ return response;
743
+ }
744
+ if (!JSON.stringify(response.data ?? null).includes('{@link')) {
745
+ return response;
746
+ }
747
+ const catalog = await loadDocsCatalog(cwd);
748
+ /** @type {Map<string, string>} */
749
+ const declared = new Map();
750
+ for (const integration of await loadIntegrationsSafely(cwd)) {
751
+ const id = /** @type {any} */ (integration).providerId;
752
+ if (typeof id === 'string') declared.set(integration.name, id);
753
+ }
754
+ /**
755
+ * @param {any} doc
756
+ * @param {string | undefined} owner
757
+ */
758
+ const link = async (doc, owner) => {
759
+ if (typeof owner !== 'string') return doc;
760
+ try {
761
+ return (
762
+ await linkComponentDoc(
763
+ catalog,
764
+ componentLinkProvider(owner, declared.get(owner)),
765
+ doc,
766
+ )
767
+ ).doc;
768
+ } catch {
769
+ // An owner that is not a provider id links nothing; its text reads as
770
+ // written.
771
+ return doc;
772
+ }
773
+ };
774
+ if (type !== 'component.list') {
775
+ return {...response, data: await link(response.data, response.package)};
776
+ }
777
+ /** @type {Record<string, any[]>} */
778
+ const components = {};
779
+ for (const [group, entries] of Object.entries(
780
+ response.data.components ?? {},
781
+ )) {
782
+ const linked = [];
783
+ for (const entry of entries) linked.push(await link(entry, entry?.package));
784
+ components[group] = linked;
785
+ }
786
+ return {...response, data: {...response.data, components}};
787
+ }