@astryxdesign/cli 0.7.4-canary.3f6ea7d → 0.7.4-canary.78641f8

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 (206) hide show
  1. package/README.md +63 -63
  2. package/api/component/_adapter.mjs +4 -3
  3. package/api/component/component.mjs +13 -6
  4. package/api/component/doc-links.test.mjs +33 -0
  5. package/api/docs/_adapter.d.mts +80 -0
  6. package/api/docs/_adapter.mjs +261 -11
  7. package/api/docs/detail/detail.mjs +8 -0
  8. package/api/docs/docOverlays.test.mjs +2 -1
  9. package/api/docs/docs.d.mts +16 -6
  10. package/api/docs/docs.doc.mjs +1 -1
  11. package/api/docs/docs.mjs +55 -6
  12. package/api/docs/docs.type.d.mts +28 -2
  13. package/api/docs/docs.type.mjs +13 -3
  14. package/api/docs/guide-route-targets.test.mjs +1002 -0
  15. package/api/docs/index/index.mjs +9 -0
  16. package/api/docs/integration-tree.test.mjs +22 -0
  17. package/api/docs/integrationDocs.test.mjs +85 -0
  18. package/api/docs/list/list.mjs +7 -1
  19. package/api/docs/node/node.mjs +9 -1
  20. package/api/docs/reference-blocks.test.mjs +1 -1
  21. package/api/doctor/built-checks.mjs +43 -13
  22. package/api/doctor/built-checks.test.mjs +29 -0
  23. package/api/doctor/doctor.doc.mjs +2 -2
  24. package/api/hook/list/list.d.mts +1 -1
  25. package/api/integration/_adapter.d.mts +11 -2
  26. package/api/integration/_adapter.mjs +30 -4
  27. package/api/integration/authoring-checks.mjs +29 -2
  28. package/api/integration/authoring-checks.test.mjs +131 -1
  29. package/api/integration/check/check.d.mts +4 -1
  30. package/api/integration/check/check.mjs +34 -4
  31. package/api/integration/check/check.test.mjs +49 -0
  32. package/api/integration/example-checks.no-npm.test.mjs +140 -0
  33. package/api/integration/example-checks.test.mjs +776 -0
  34. package/api/integration/integration-check.type.d.mts +8 -0
  35. package/api/integration/integration-check.type.mjs +4 -1
  36. package/api/integration/integrationCheck.doc.mjs +8 -1
  37. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  38. package/api/integration/pack-check.mjs +65 -1
  39. package/api/integration/pack-check.test.mjs +63 -0
  40. package/api/integration/validate-integration-case-disk.test.mjs +14 -2
  41. package/api/integration/validate-integration-gaps.test.mjs +43 -19
  42. package/api/integration/validate-integration.mjs +112 -14
  43. package/api/integration/validate-integration.type.d.mts +23 -4
  44. package/api/integration/validate-integration.type.mjs +14 -5
  45. package/api/integration/validateIntegration.doc.mjs +1 -1
  46. package/api/search/_candidate-score.d.mts +9 -3
  47. package/api/search/_candidate-score.mjs +90 -3
  48. package/api/search/_gather-components.mjs +48 -1
  49. package/api/search/_gather-docs.mjs +12 -2
  50. package/api/search/_lexical.d.mts +12 -0
  51. package/api/search/_lexical.mjs +3 -0
  52. package/api/search/_priority.mjs +5 -2
  53. package/api/search/_score.d.mts +2 -1
  54. package/api/search/_score.mjs +4 -3
  55. package/api/search/search.doc.mjs +1 -1
  56. package/api/search/search.family-members.test.mjs +124 -0
  57. package/api/search/search.family-word.test.mjs +146 -0
  58. package/api/search/search.mjs +28 -0
  59. package/api/template/template-suffix.test.mjs +26 -0
  60. package/api/theme/themeBuild.doc.mjs +1 -1
  61. package/api/theme/themeList.doc.mjs +1 -1
  62. package/api/theme/themeTargets.doc.mjs +1 -1
  63. package/assets/discover/official-packages.json +16 -0
  64. package/assets/docs/author-a-theme.doc.mjs +15 -15
  65. package/assets/docs/browser-support.doc.mjs +1 -1
  66. package/assets/docs/getting-started.doc.mjs +16 -16
  67. package/assets/docs/is-my-code-good.doc.mjs +6 -6
  68. package/assets/docs/styling-overview.doc.mjs +5 -5
  69. package/assets/docs/theme.doc.mjs +5 -5
  70. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  71. package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
  72. package/assets/docs/tree/add-a-topic.doc.mjs +6 -6
  73. package/assets/docs/tree/agent-guidance.doc.mjs +5 -5
  74. package/assets/docs/tree/authoring.doc.mjs +2 -2
  75. package/assets/docs/tree/block-template.doc.mjs +1 -1
  76. package/assets/docs/tree/check-the-props.doc.mjs +3 -3
  77. package/assets/docs/tree/check-your-docs.doc.mjs +6 -6
  78. package/assets/docs/tree/checks.doc.mjs +11 -11
  79. package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
  80. package/assets/docs/tree/cli-command.doc.mjs +6 -6
  81. package/assets/docs/tree/codemods.doc.mjs +7 -7
  82. package/assets/docs/tree/component-family.doc.mjs +1 -1
  83. package/assets/docs/tree/component-imports.doc.mjs +2 -2
  84. package/assets/docs/tree/component-lookups.doc.mjs +6 -5
  85. package/assets/docs/tree/computer-agent-guide.doc.mjs +7 -7
  86. package/assets/docs/tree/computer-integrations.doc.mjs +5 -5
  87. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +3 -3
  88. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  89. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  90. package/assets/docs/tree/doc-syntax.doc.mjs +219 -0
  91. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  92. package/assets/docs/tree/extend-or-replace.doc.mjs +39 -7
  93. package/assets/docs/tree/font-setup.doc.mjs +1 -1
  94. package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
  95. package/assets/docs/tree/global-integrations.doc.mjs +11 -11
  96. package/assets/docs/tree/global.doc.mjs +2 -2
  97. package/assets/docs/tree/host-entry.doc.mjs +1 -1
  98. package/assets/docs/tree/install-once.doc.mjs +4 -4
  99. package/assets/docs/tree/layout.doc.mjs +1 -1
  100. package/assets/docs/tree/links.doc.mjs +2 -2
  101. package/assets/docs/tree/migration-setup.doc.mjs +15 -15
  102. package/assets/docs/tree/migration.doc.mjs +2 -1
  103. package/assets/docs/tree/other-libraries.doc.mjs +1 -1
  104. package/assets/docs/tree/page-template.doc.mjs +2 -2
  105. package/assets/docs/tree/problems.doc.mjs +8 -8
  106. package/assets/docs/tree/project-global-or-both.doc.mjs +2 -2
  107. package/assets/docs/tree/publishing.doc.mjs +7 -7
  108. package/assets/docs/tree/quick-start.doc.mjs +9 -9
  109. package/assets/docs/tree/reference.doc.mjs +2 -2
  110. package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
  111. package/assets/docs/tree/replace-a-core-template.doc.mjs +4 -4
  112. package/assets/docs/tree/scaffold.doc.mjs +1 -1
  113. package/assets/docs/tree/sections-and-placement.doc.mjs +3 -3
  114. package/assets/docs/tree/see-it-in-an-app.doc.mjs +3 -3
  115. package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
  116. package/assets/docs/tree/single-component.doc.mjs +4 -4
  117. package/assets/docs/tree/start-a-template.doc.mjs +5 -5
  118. package/assets/docs/tree/styling-advanced.doc.mjs +1 -1
  119. package/assets/docs/tree/styling-libraries.doc.mjs +2 -1
  120. package/assets/docs/tree/styling.doc.mjs +1 -1
  121. package/assets/docs/tree/tailwind.doc.mjs +1 -1
  122. package/assets/docs/tree/test-in-an-app.doc.mjs +5 -5
  123. package/assets/docs/tree/test-template-in-app.doc.mjs +6 -6
  124. package/assets/docs/tree/tokens-and-setup.doc.mjs +1 -1
  125. package/assets/docs/tree/troubleshooting.doc.mjs +24 -20
  126. package/assets/docs/tree/uninstall.doc.mjs +2 -2
  127. package/assets/docs/tree/updates.doc.mjs +1 -1
  128. package/assets/docs/tree/upgrading.doc.mjs +3 -3
  129. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
  130. package/assets/docs/tree/verify-packed-template.doc.mjs +3 -3
  131. package/assets/docs/tree/versioning.doc.mjs +4 -4
  132. package/assets/docs/tree/who-answers.doc.mjs +4 -4
  133. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -4
  134. package/assets/docs/use-a-theme.doc.mjs +10 -10
  135. package/assets/docs/use-integrations.doc.mjs +1 -1
  136. package/assets/docs/working-with-ai.doc.mjs +15 -15
  137. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
  138. package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
  139. package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
  140. package/assets/templates/themes/butter/butterTheme.ts +274 -234
  141. package/assets/templates/themes/butter/palette.config.json +484 -0
  142. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +51 -0
  143. package/assets/templates/themes/matcha/matchaPalettes.generated.receipt.json +1502 -0
  144. package/assets/templates/themes/matcha/matchaPalettes.generated.ts +501 -0
  145. package/assets/templates/themes/matcha/matchaPalettes.ts +21 -0
  146. package/assets/templates/themes/matcha/matchaTheme.ts +164 -103
  147. package/assets/templates/themes/matcha/palette.config.json +448 -0
  148. package/assets/templates/themes/y2k/palette.config.json +166 -0
  149. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +54 -0
  150. package/assets/templates/themes/y2k/y2kPalettes.generated.receipt.json +872 -0
  151. package/assets/templates/themes/y2k/y2kPalettes.generated.ts +550 -0
  152. package/assets/templates/themes/y2k/y2kPalettes.ts +257 -0
  153. package/assets/templates/themes/y2k/y2kTheme.ts +164 -391
  154. package/authoring/codemod/codemod.doc.mjs +1 -1
  155. package/authoring/config/config.doc.mjs +4 -4
  156. package/authoring/debug/parse.d.mts +1 -1
  157. package/authoring/discover/discover.doc.mjs +1 -1
  158. package/authoring/doctypes/_schema.d.mts +4 -0
  159. package/authoring/doctypes/_schema.mjs +4 -0
  160. package/authoring/doctypes/reference/type.ts +14 -2
  161. package/authoring/gap-report/gap-report.doc.mjs +1 -1
  162. package/authoring/integration/integration.doc.mjs +6 -6
  163. package/clients/cli/commands/docs.doc.mjs +1 -1
  164. package/clients/cli/commands/docs.mjs +27 -2
  165. package/clients/cli/commands/docs.test.mjs +1 -1
  166. package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
  167. package/clients/cli/commands/doctor.doc.mjs +1 -1
  168. package/clients/cli/commands/doctor.mjs +12 -1
  169. package/clients/cli/commands/integration-check.doc.mjs +11 -0
  170. package/clients/cli/commands/integration-check.test.mjs +36 -3
  171. package/clients/cli/commands/integration-pack.doc.mjs +1 -1
  172. package/clients/cli/commands/integration-verify.doc.mjs +1 -1
  173. package/clients/cli/commands/integration.mjs +15 -3
  174. package/clients/cli/commands/theme-targets.doc.mjs +1 -1
  175. package/clients/cli/commands/upgrade.doc.mjs +2 -2
  176. package/clients/cli/lib/define-command.mjs +5 -3
  177. package/foundation/agent-docs/agent-docs.d.mts +14 -2
  178. package/foundation/agent-docs/agent-docs.mjs +65 -4
  179. package/foundation/agent-docs/agent-docs.test.mjs +107 -0
  180. package/foundation/discovery/docs-discovery.d.mts +93 -2
  181. package/foundation/discovery/docs-discovery.mjs +237 -8
  182. package/foundation/discovery/runner-allowlist.d.mts +2 -0
  183. package/foundation/discovery/runner-allowlist.mjs +4 -0
  184. package/foundation/discovery/runner-commands.d.mts +29 -13
  185. package/foundation/discovery/runner-commands.mjs +253 -17
  186. package/foundation/discovery/stray-pointers.mjs +11 -5
  187. package/foundation/discovery/stray-pointers.test.mjs +6 -0
  188. package/foundation/discovery/template-adapter.mjs +11 -0
  189. package/foundation/doc-compiler/compile.mjs +8 -1
  190. package/foundation/doc-compiler/doc-loads.test.mjs +7 -0
  191. package/foundation/doc-compiler/doc-syntax.d.mts +194 -0
  192. package/foundation/doc-compiler/doc-syntax.mjs +739 -0
  193. package/foundation/doc-compiler/doc-syntax.test.mjs +383 -0
  194. package/foundation/doc-compiler/links.d.mts +13 -16
  195. package/foundation/doc-compiler/links.mjs +40 -7
  196. package/foundation/doc-compiler/tree.d.mts +5 -0
  197. package/foundation/doc-compiler/tree.mjs +9 -0
  198. package/foundation/env/package-manager.d.mts +18 -0
  199. package/foundation/env/package-manager.mjs +40 -0
  200. package/foundation/integrations/cli-requirement.d.mts +29 -0
  201. package/foundation/integrations/cli-requirement.mjs +47 -0
  202. package/foundation/integrations/cli-requirement.test.mjs +23 -2
  203. package/foundation/integrations/validate-contributions.d.mts +53 -0
  204. package/foundation/integrations/validate-contributions.mjs +788 -0
  205. package/foundation/response/response-types.doc.mjs +6 -6
  206. package/package.json +9 -9
@@ -36,8 +36,15 @@ export type ValidateIntegrationOptions = {
36
36
  export type ValidateIntegrationResponse = {
37
37
  type: "integration.validate";
38
38
  /**
39
- * `notes`: information beside the issues that fails nothing, such as
40
- * `invalid_cli_command`, a `cliCommand` that was ignored as malformed;
39
+ * `notes`: information beside the issues. A note fails nothing by default;
40
+ * one with `next: true` counts as a warning under `integration check
41
+ * --next`, fails `integration check --strict --next`, and fails `--strict`
42
+ * from the next minor release. Notes include `invalid_cli_command`, a
43
+ * `cliCommand` that was ignored as malformed;
44
+ * `component_without_example`, `template_category`,
45
+ * `showcase_not_standalone` and `template_asset_not_packed`, what a
46
+ * package's examples need (next minor; a block's `alsoShowcaseFor` names
47
+ * count as shown);
41
48
  * `cli_peer_version`, the running CLI outside the package's
42
49
  * `@astryxdesign/cli` peer range; and
43
50
  * the package layout findings added after the last minor release, each with
@@ -50,8 +57,10 @@ export type ValidateIntegrationResponse = {
50
57
  * still pair (`source_without_component_doc`); `doc_name_mismatch` and
51
58
  * `unknown_block_component` (see `docNames` and `blockComponents`); and
52
59
  * since 0.7.3 each public-import finding; they become warnings in the next
53
- * minor release; and `runner_command`, an Astryx command a topic writes
54
- * with a package runner
60
+ * minor release; and, for the commands a topic writes, `runner_command`
61
+ * (written with a package runner), `plain_command` (written bare),
62
+ * `package_manager_command` (written for one package manager) and
63
+ * `doc_token` (a token that does not parse), each with the token to write
55
64
  */
56
65
  data: {
57
66
  validated: boolean;
@@ -61,10 +70,20 @@ export type ValidateIntegrationResponse = {
61
70
  notes?: Array<{
62
71
  code: string;
63
72
  message: string;
73
+ next?: boolean;
64
74
  }>;
65
75
  docTypes?: DocTypesReport;
66
76
  docNames?: DocNamesReport;
67
77
  blockComponents?: BlockComponentsReport;
78
+ exampleAssets?: {
79
+ status: "checked";
80
+ findings: [];
81
+ unchecked: Array<{
82
+ file: string;
83
+ asset: string;
84
+ reason: string;
85
+ }>;
86
+ };
68
87
  publicImports?: PublicImportsReport;
69
88
  };
70
89
  };
@@ -39,9 +39,16 @@
39
39
  * "healthy" — the two are otherwise byte-identical.
40
40
  * @typedef {object} ValidateIntegrationResponse
41
41
  * @property {'integration.validate'} type
42
- * @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[], notes?: Array<{code: string, message: string}>, docTypes?: DocTypesReport, docNames?: DocNamesReport, blockComponents?: BlockComponentsReport, publicImports?: PublicImportsReport}} data
43
- * `notes`: information beside the issues that fails nothing, such as
44
- * `invalid_cli_command`, a `cliCommand` that was ignored as malformed;
42
+ * @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[], notes?: Array<{code: string, message: string, next?: boolean}>, docTypes?: DocTypesReport, docNames?: DocNamesReport, blockComponents?: BlockComponentsReport, exampleAssets?: {status: 'checked', findings: [], unchecked: Array<{file: string, asset: string, reason: string}>}, publicImports?: PublicImportsReport}} data
43
+ * `notes`: information beside the issues. A note fails nothing by default;
44
+ * one with `next: true` counts as a warning under `integration check
45
+ * --next`, fails `integration check --strict --next`, and fails `--strict`
46
+ * from the next minor release. Notes include `invalid_cli_command`, a
47
+ * `cliCommand` that was ignored as malformed;
48
+ * `component_without_example`, `template_category`,
49
+ * `showcase_not_standalone` and `template_asset_not_packed`, what a
50
+ * package's examples need (next minor; a block's `alsoShowcaseFor` names
51
+ * count as shown);
45
52
  * `cli_peer_version`, the running CLI outside the package's
46
53
  * `@astryxdesign/cli` peer range; and
47
54
  * the package layout findings added after the last minor release, each with
@@ -54,8 +61,10 @@
54
61
  * still pair (`source_without_component_doc`); `doc_name_mismatch` and
55
62
  * `unknown_block_component` (see `docNames` and `blockComponents`); and
56
63
  * since 0.7.3 each public-import finding; they become warnings in the next
57
- * minor release; and `runner_command`, an Astryx command a topic writes
58
- * with a package runner
64
+ * minor release; and, for the commands a topic writes, `runner_command`
65
+ * (written with a package runner), `plain_command` (written bare),
66
+ * `package_manager_command` (written for one package manager) and
67
+ * `doc_token` (a token that does not parse), each with the token to write
59
68
  */
60
69
 
61
70
  /**
@@ -62,7 +62,7 @@ export const doc = {
62
62
  {
63
63
  type: 'integration.validate',
64
64
  description:
65
- "The result envelope: `data.validated`, false when nothing was validated — with no `package.json` at all, `data.issues` carries one `no_package` error-severity issue so the command exits 1; with a `package.json` but no integration manifest, `data.issues` is empty, which means \"not looked at\", not \"healthy\"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message, fix?, file?, line?}: `fix` is the change that resolves the issue, and `file` and `line` where it is, relative to the package, when the check knows them; and `data.notes` when there are any: {code, message} information that fails nothing, such as `invalid_cli_command` for a `cliCommand` that was ignored as malformed and `cli_peer_version` when the running CLI is outside the `@astryxdesign/cli` peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message: `duplicate_component_doc`, `symlinked_root`, `unreadable_file`, `invalid_package_json` (no `name` or `version`), `no_provider_id`, and `source_without_component_doc` for a doc whose file name differs from its source only in letter case where the two still pair; and `doc_name_mismatch` and `unknown_block_component` (see `docNames` and `blockComponents`); they become warnings in the next minor release. A `runner_command` note lists each Astryx command a topic writes with a package runner, with its file, line and the bare command to write. When the manifest loads, `data.docTypes` holds the doc type check: `status` (`checked` | `skipped`), `reason` when skipped, `typescript`, `docs` (doc values checked), `findings` ({doc, line, export, type, field, problem: `unknown_field` | `missing_field` | `wrong_type`, severity: `warning`, message, fix}), `unchecked` ({doc, reason}: a doc that could not be fully checked, or a root its reader cannot read), and `fixtures` when the components or docs root holds test fixture docs under `__tests__`: how many, none of them checked. When the manifest loads, `data.docNames` lists the component doc names it could not judge: `status` (`checked`), `findings` (always empty; a doc name the module its import names provably does not export is a `doc_name_mismatch` note, with its fix in the message) and `unchecked` ({file, name, reason}: a doc whose `name` differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, `data.blockComponents` lists the component names templates give in `exampleFor` or `componentsUsed` that could not be judged: `status` (`checked`), `findings` (always empty; a name neither the package nor Core has, and the template does not import, is an `unknown_block_component` note, with its fix in the message) and `unchecked` ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is a note in `data.notes`, its fix inside the message, listed only: it does not fail this command or `integration check --strict`, and fails `--strict` from the next minor release. The codes are `component_import_not_exported`, `component_import_other_package`, `component_import_missing_name`, `example_import_not_exported`, `example_import_missing_name`, `template_import_not_exported`, `template_import_outside_root`, `template_private_import`, `template_import_missing_name` and `template_no_default_export`. When the manifest loads, `data.publicImports` is `{status: 'checked', findings: [], unchecked}`: `unchecked` lists each import the check could not judge, as {file, specifier, reason}, the reason starting `example <label>:` for an import in a component example: an `exports` target not built yet; a module whose export list cannot be read in full (CommonJS, or a declaration file it cannot read); a root import in a package with no `exports` (the root module `main` names is not read); every name an import (other than a component doc's own component) names that its module does not export, while a TypeScript file in the package has a `declare module` block for a relative path or the package's own name or a subpath of it, which can add names to that module (a `declare module` in a comment, `declare global`, a wildcard such as `'*.css'`, and another package's name do not count; a file whose text has `declare module` but that cannot be parsed counts); the same for every such name when the package has more than 5,000 files to search for that block; a deep path into build output not built yet in a package with no `exports`; a template import of Core when `@astryxdesign/core` is not installed beside the package (a `packages/core` of the workspace under another name does not count); every import of the package's own name when package.json has no `name` or a `name` that is not a bare package name; one entry for the whole check when package.json cannot be read; and an import of a subpath whose `exports` entry has only a `types` target, unless it is `import type`, every binding is an inline `type`, or every name it imports is a type its types file declares: a value import of a name that file does not declare as a type, a namespace or side-effect import, or any import when the types file cannot be read (it may be build output). `integration check` counts the unchecked as not compared; they never fail it.",
65
+ "The result envelope: `data.validated`, false when nothing was validated — with no `package.json` at all, `data.issues` carries one `no_package` error-severity issue so the command exits 1; with a `package.json` but no integration manifest, `data.issues` is empty, which means \"not looked at\", not \"healthy\"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message, fix?, file?, line?}: `fix` is the change that resolves the issue, and `file` and `line` where it is, relative to the package, when the check knows them; and `data.notes` when there are any: {code, message, next?} information beside the issues; a note fails nothing by default, and one with `next: true` counts as a warning under `integration check --next`, fails `integration check --strict --next`, and fails `--strict` from the next minor release. Notes include `invalid_cli_command` for a `cliCommand` that was ignored as malformed and `cli_peer_version` when the running CLI is outside the `@astryxdesign/cli` peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message: `duplicate_component_doc`, `symlinked_root`, `unreadable_file`, `invalid_package_json` (no `name` or `version`), `no_provider_id`, and `source_without_component_doc` for a doc whose file name differs from its source only in letter case where the two still pair; and `doc_name_mismatch` and `unknown_block_component` (see `docNames` and `blockComponents`); they become warnings in the next minor release. For the commands a topic writes, `runner_command` (written with a package runner), `plain_command` (written bare), `package_manager_command` (written for one package manager) and `doc_token` (a token that does not parse) notes each give the file, line and the token to write. A `doc_target_not_found` note names a doc whose `replaces` or `extends` names no topic and no guide of the CLI's docs or the package's own (such as a namespace, with the guides below it), so it changes nothing unless an app also installs a package that provides it, and a `doc_section_unplaced` note a section whose `before` or `after` names no section of the topic or guide it extends, so it is added at the end, and a `duplicate_guide_replacement` note two docs of the package that replace one guide, of which only the last is read; they become warnings in the next minor release. When the manifest loads, `data.docTypes` holds the doc type check: `status` (`checked` | `skipped`), `reason` when skipped, `typescript`, `docs` (doc values checked), `findings` ({doc, line, export, type, field, problem: `unknown_field` | `missing_field` | `wrong_type`, severity: `warning`, message, fix}), `unchecked` ({doc, reason}: a doc that could not be fully checked, or a root its reader cannot read), and `fixtures` when the components or docs root holds test fixture docs under `__tests__`: how many, none of them checked. When the manifest loads, `data.docNames` lists the component doc names it could not judge: `status` (`checked`), `findings` (always empty; a doc name the module its import names provably does not export is a `doc_name_mismatch` note, with its fix in the message) and `unchecked` ({file, name, reason}: a doc whose `name` differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, `data.blockComponents` lists the component names templates give in `exampleFor` or `componentsUsed` that could not be judged: `status` (`checked`), `findings` (always empty; a name neither the package nor Core has, and the template does not import, is an `unknown_block_component` note, with its fix in the message) and `unchecked` ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is a note in `data.notes`, its fix inside the message, listed only: it does not fail this command or `integration check --strict`, and fails `--strict` from the next minor release. The codes are `component_import_not_exported`, `component_import_other_package`, `component_import_missing_name`, `example_import_not_exported`, `example_import_missing_name`, `template_import_not_exported`, `template_import_outside_root`, `template_private_import`, `template_import_missing_name` and `template_no_default_export`. Since 0.7.4 the examples a package ships are checked the same way: `component_without_example` (a published component no block template shows with `exampleFor` and `isShowcase: true`, or names in `alsoShowcaseFor`), `template_category` (a template category written as a path, such as `components/X`), `showcase_not_standalone` (a showcase that imports server-only code or reads `process.env` past `NODE_ENV`) and `template_asset_not_packed` (a `new URL(…, import.meta.url)` asset that is missing, or that `npm pack --dry-run` leaves out of the package). When npm cannot list the package's files, an asset no `files` entry can reach is still a note, and any other is listed in `data.exampleAssets` (`{status: 'checked', findings: [], unchecked}`, present only when it lists any) as {file, asset, reason}; `integration check` counts them as not compared. When the manifest loads, `data.publicImports` is `{status: 'checked', findings: [], unchecked}`: `unchecked` lists each import the check could not judge, as {file, specifier, reason}, the reason starting `example <label>:` for an import in a component example: an `exports` target not built yet; a module whose export list cannot be read in full (CommonJS, or a declaration file it cannot read); a root import in a package with no `exports` (the root module `main` names is not read); every name an import (other than a component doc's own component) names that its module does not export, while a TypeScript file in the package has a `declare module` block for a relative path or the package's own name or a subpath of it, which can add names to that module (a `declare module` in a comment, `declare global`, a wildcard such as `'*.css'`, and another package's name do not count; a file whose text has `declare module` but that cannot be parsed counts); the same for every such name when the package has more than 5,000 files to search for that block; a deep path into build output not built yet in a package with no `exports`; a template import of Core when `@astryxdesign/core` is not installed beside the package (a `packages/core` of the workspace under another name does not count); every import of the package's own name when package.json has no `name` or a `name` that is not a bare package name; one entry for the whole check when package.json cannot be read; and an import of a subpath whose `exports` entry has only a `types` target, unless it is `import type`, every binding is an inline `type`, or every name it imports is a type its types file declares: a value import of a name that file does not declare as a type, a namespace or side-effect import, or any import when the types file cannot be read (it may be build output). `integration check` counts the unchecked as not compared; they never fail it.",
66
66
  },
67
67
  ],
68
68
  examples: [
@@ -17,11 +17,13 @@
17
17
  * @param {string} [candidate.description]
18
18
  * @param {string[]} [candidate.prose] - Extra free-text blobs (doc section text, best practices).
19
19
  * @param {string[]} [candidate.guidance] - Usage guidance (features, best practices) — scored a tier below description.
20
- * @param {{fuzzy?: boolean, joins?: boolean}} [opts] - `fuzzy`: allow edit-distance (typo) matches. Default true; multi-word queries pass false. `joins`: read a spaced query joined into a name or keyword (default true); off when the query names an entry outright.
20
+ * @param {string} [candidate._family] - The family whose doc lists the entry as a member.
21
+ * @param {number} [candidate._familyIndex] - The entry's place among that family's members.
22
+ * @param {{fuzzy?: boolean, joins?: boolean, part?: boolean, synonym?: boolean}} [opts] - `fuzzy`: allow edit-distance (typo) matches. Default true; multi-word queries pass false. `joins`: read a spaced query joined into a name or keyword (default true); off when the query names an entry outright. `part`: the term is one word of a longer query, so a name's head word after single letters (Stack in VStack) does not count as a keyword hit for it. `synonym`: the term stands in for a word of the query, so it names no family.
21
23
  * @returns {{score: number, reason: string, alias?: 'partial' | 'keyword'} | null}
22
24
  * `alias` marks a hit that read the query's words joined.
23
25
  */
24
- export function scoreCandidate(term: string, { name, aliases, domain, keywords, weakKeywords, description, prose, guidance, }: {
26
+ export function scoreCandidate(term: string, { name, aliases, domain, keywords, weakKeywords, description, prose, guidance, _family, _familyIndex, }: {
25
27
  name: string;
26
28
  aliases?: string[] | undefined;
27
29
  domain?: string | undefined;
@@ -30,9 +32,13 @@ export function scoreCandidate(term: string, { name, aliases, domain, keywords,
30
32
  description?: string | undefined;
31
33
  prose?: string[] | undefined;
32
34
  guidance?: string[] | undefined;
33
- }, { fuzzy, joins }?: {
35
+ _family?: string | undefined;
36
+ _familyIndex?: number | undefined;
37
+ }, { fuzzy, joins, part, synonym }?: {
34
38
  fuzzy?: boolean;
35
39
  joins?: boolean;
40
+ part?: boolean;
41
+ synonym?: boolean;
36
42
  }): {
37
43
  score: number;
38
44
  reason: string;
@@ -41,11 +41,59 @@ import {
41
41
  wordForms,
42
42
  sameWord,
43
43
  startsAWordOf,
44
+ wordsOf,
44
45
  joined,
45
46
  isTypo,
46
47
  } from './_words.mjs';
47
48
  import {pluralOf} from './_query.mjs';
48
49
 
50
+ /**
51
+ * Whether a multi-word term spells out a name word by word: as many words as
52
+ * the name, each the name's word in order or, for a single-letter word, a word
53
+ * starting with that letter ("vertical" for V) that the entry's own
54
+ * description names. `vertical stack` spells out VStack when its description says
55
+ * "vertical"; `visual stack` does not.
56
+ * @param {string} term
57
+ * @param {string} name
58
+ * @param {string} description
59
+ */
60
+ function spellsOut(term, name, description) {
61
+ const words = term.split(/\s+/).filter(Boolean);
62
+ const parts = wordsOf(name);
63
+ if (words.length < 2 || words.length !== parts.length) return false;
64
+ const described = wordsOf(description);
65
+ let expanded = false;
66
+ for (let i = 0; i < words.length; i++) {
67
+ const w = words[i];
68
+ const p = parts[i];
69
+ if (sameWord(w, p)) continue;
70
+ // Only a single-letter word is an abbreviation to spell out: "With" in a
71
+ // name is not spelled out by "without".
72
+ if (p.length !== 1 || !w.startsWith(p)) return false;
73
+ if (!described.some(d => sameWord(d, w))) return false;
74
+ expanded = true;
75
+ }
76
+ return expanded;
77
+ }
78
+
79
+ /**
80
+ * Whether a one-word term is a name's last word and every word before it is a
81
+ * single letter: Stack in VStack and HStack.
82
+ * @param {string} term
83
+ * @param {string} name
84
+ */
85
+ function headOfLetters(term, name) {
86
+ const parts = wordsOf(name);
87
+ return (
88
+ parts.length >= 2 &&
89
+ sameWord(term, parts[parts.length - 1]) &&
90
+ parts.slice(0, -1).every(p => p.length === 1)
91
+ );
92
+ }
93
+
94
+ /** How many of a family's members a query naming the family lists. */
95
+ const FAMILY_MEMBERS = 3;
96
+
49
97
  /**
50
98
  * Score a single candidate against the search term across name, keywords,
51
99
  * and prose signals. Returns the best (highest) score plus a human reason,
@@ -62,7 +110,9 @@ import {pluralOf} from './_query.mjs';
62
110
  * @param {string} [candidate.description]
63
111
  * @param {string[]} [candidate.prose] - Extra free-text blobs (doc section text, best practices).
64
112
  * @param {string[]} [candidate.guidance] - Usage guidance (features, best practices) — scored a tier below description.
65
- * @param {{fuzzy?: boolean, joins?: boolean}} [opts] - `fuzzy`: allow edit-distance (typo) matches. Default true; multi-word queries pass false. `joins`: read a spaced query joined into a name or keyword (default true); off when the query names an entry outright.
113
+ * @param {string} [candidate._family] - The family whose doc lists the entry as a member.
114
+ * @param {number} [candidate._familyIndex] - The entry's place among that family's members.
115
+ * @param {{fuzzy?: boolean, joins?: boolean, part?: boolean, synonym?: boolean}} [opts] - `fuzzy`: allow edit-distance (typo) matches. Default true; multi-word queries pass false. `joins`: read a spaced query joined into a name or keyword (default true); off when the query names an entry outright. `part`: the term is one word of a longer query, so a name's head word after single letters (Stack in VStack) does not count as a keyword hit for it. `synonym`: the term stands in for a word of the query, so it names no family.
66
116
  * @returns {{score: number, reason: string, alias?: 'partial' | 'keyword'} | null}
67
117
  * `alias` marks a hit that read the query's words joined.
68
118
  */
@@ -77,8 +127,10 @@ export function scoreCandidate(
77
127
  description = '',
78
128
  prose = [],
79
129
  guidance = [],
130
+ _family,
131
+ _familyIndex,
80
132
  },
81
- {fuzzy = true, joins = true} = {},
133
+ {fuzzy = true, joins = true, part = false, synonym = false} = {},
82
134
  ) {
83
135
  let best = 0;
84
136
  let reason = '';
@@ -128,6 +180,15 @@ export function scoreCandidate(
128
180
  // Most of the name typed as words, cut short: `complex select` is
129
181
  // ComplexSelector, ahead of a one-word keyword elsewhere.
130
182
  consider(95, `name "${candidateName}" spelled`, 'partial');
183
+ } else if (
184
+ domain !== 'doc' &&
185
+ domain !== 'theme' &&
186
+ spellsOut(term, candidateName, description)
187
+ ) {
188
+ // The name's short words spelled out, in order, as the entry's own
189
+ // description spells them: `vertical stack` is VStack ("Vertical stack
190
+ // for arranging items top-to-bottom").
191
+ consider(95, `name "${candidateName}" spelled out`);
131
192
  } else if (pluralOf(nameLower, term) || pluralOf(term, nameLower)) {
132
193
  // One point under the exact spelling, so the doc named `tokens` still
133
194
  // outranks the Token component for `tokens`.
@@ -135,7 +196,16 @@ export function scoreCandidate(
135
196
  } else {
136
197
  if (sameWord(term, nameLower)) consider(95, `name "${candidateName}"`);
137
198
  // The term is a word of the name, or starts one: "input" in TextInput.
138
- else if (startsAWordOf(term, candidateName)) {
199
+ else if (
200
+ !part &&
201
+ domain !== 'doc' &&
202
+ domain !== 'theme' &&
203
+ headOfLetters(term, candidateName)
204
+ ) {
205
+ // The whole query is the name's head word after single letters (Stack
206
+ // in VStack, HStack): a variant named by its head, as a keyword is.
207
+ consider(90, `name "${candidateName}" ends in "${term}"`);
208
+ } else if (startsAWordOf(term, candidateName)) {
139
209
  consider(60, `name contains "${term}"`);
140
210
  }
141
211
  if (fuzzy) {
@@ -150,6 +220,23 @@ export function scoreCandidate(
150
220
  }
151
221
  }
152
222
 
223
+ // ── Family signal ───────────────────────────────────────────────
224
+ // A query naming a family lists its first members as a keyword would: the
225
+ // family doc names them, whether or not a component of the family's name
226
+ // exists ("chat" lists ChatMessage and its siblings). Only the whole query
227
+ // names the family: a word of a longer query lifts no member.
228
+ if (
229
+ !part &&
230
+ !synonym &&
231
+ _family &&
232
+ (_familyIndex ?? Infinity) < FAMILY_MEMBERS &&
233
+ (term === _family.toLowerCase() ||
234
+ term === wordsOf(_family).join(' ') ||
235
+ term.replace(/\s+/g, '') === _family.toLowerCase())
236
+ ) {
237
+ consider(90, `member of ${_family}`);
238
+ }
239
+
153
240
  // ── Keyword signals ─────────────────────────────────────────────
154
241
  const termJoined = joined(term);
155
242
  for (const kw of keywords) {
@@ -5,6 +5,8 @@
5
5
  * integrations contribute, read from their docs. Imported only by the adapter.
6
6
  */
7
7
 
8
+ import fs from 'node:fs';
9
+ import path from 'node:path';
8
10
  import {discoverExternalPackages} from '../../foundation/fs/paths.mjs';
9
11
  import {
10
12
  discoverComponents,
@@ -29,6 +31,28 @@ import {loadModuleDoc, guidanceFrom} from './_module-doc.mjs';
29
31
 
30
32
  /** @typedef {import('./_lexical.mjs').Candidate} Candidate */
31
33
 
34
+ /**
35
+ * The members a family doc names, each with the family and its place among
36
+ * the members (the family's own entry left out). A query naming the family
37
+ * lists its first members (see scoreCandidate).
38
+ * @param {any} docs
39
+ * @returns {Map<string, {_family: string, _familyIndex: number}>}
40
+ */
41
+ function familyPlaces(docs) {
42
+ /** @type {Map<string, {_family: string, _familyIndex: number}>} */
43
+ const out = new Map();
44
+ if (!docs || typeof docs.name !== 'string') return out;
45
+ (Array.isArray(docs.components) ? docs.components : [])
46
+ .map((/** @type {any} */ m) => (typeof m === 'string' ? m : m?.name))
47
+ .filter(
48
+ (/** @type {unknown} */ n) => typeof n === 'string' && n !== docs.name,
49
+ )
50
+ .forEach((/** @type {string} */ n, /** @type {number} */ i) =>
51
+ out.set(n, {_family: docs.name, _familyIndex: i}),
52
+ );
53
+ return out;
54
+ }
55
+
32
56
  /**
33
57
  * Build component candidates from core's own tree: name + keywords +
34
58
  * usage/description from the component's .doc.mjs.
@@ -40,6 +64,8 @@ async function gatherCoreComponents(coreDir) {
40
64
  const names = Object.values(grouped).flat();
41
65
  /** @type {Candidate[]} */
42
66
  const candidates = [];
67
+ /** @type {Map<string, {_family: string, _familyIndex: number}>} */
68
+ const places = new Map();
43
69
  for (const comp of names) {
44
70
  const readme = findComponentReadme(coreDir, comp);
45
71
  /** @type {string[]} */
@@ -58,6 +84,7 @@ async function gatherCoreComponents(coreDir) {
58
84
  description = doc.usage?.description || doc.description || '';
59
85
  guidance = guidanceFrom(doc);
60
86
  }
87
+ for (const [n, place] of familyPlaces(loaded)) places.set(n, place);
61
88
  }
62
89
  candidates.push({
63
90
  domain: 'component',
@@ -69,7 +96,17 @@ async function gatherCoreComponents(coreDir) {
69
96
  _import: resolveImportPath(coreDir, comp),
70
97
  });
71
98
  }
72
- return candidates;
99
+ // A family doc with no component of its own name (Chat) names members too.
100
+ const srcDir = path.join(coreDir, 'src');
101
+ const listed = new Set(names);
102
+ for (const dir of fs.existsSync(srcDir) ? fs.readdirSync(srcDir) : []) {
103
+ const doc = path.join(srcDir, dir, `${dir}.doc.mjs`);
104
+ if (listed.has(dir) || !fs.existsSync(doc)) continue;
105
+ for (const [n, place] of familyPlaces(await loadModuleDoc(doc)))
106
+ places.set(n, place);
107
+ }
108
+ // A family doc names its members, whose own docs may sit elsewhere.
109
+ return candidates.map(c => ({...c, ...places.get(c.name)}));
73
110
  }
74
111
 
75
112
  /**
@@ -105,9 +142,18 @@ async function gatherIntegrationComponents(loadedIntegrations) {
105
142
  .filter(rec => !isIntegrationMember(rec))
106
143
  .map(rec => rec.docPath),
107
144
  );
145
+ /** @type {string[]} */
146
+ const docPaths = [];
108
147
  forEachIntegrationDoc(integration.components, (docPath, stem) => {
109
148
  if (!renamed.has(docPath)) hold(fileNamed, stem, docPath);
149
+ docPaths.push(docPath);
110
150
  });
151
+ // A family doc names its members, whose own docs may sit beside it.
152
+ /** @type {Map<string, {_family: string, _familyIndex: number}>} */
153
+ const places = new Map();
154
+ for (const docPath of docPaths)
155
+ for (const [n, place] of familyPlaces(await loadModuleDoc(docPath)))
156
+ places.set(n, place);
111
157
  for (const rec of components) {
112
158
  const loaded = await loadModuleDoc(rec.docPath);
113
159
  // A family member is indexed from its own entry: the family's keywords
@@ -132,6 +178,7 @@ async function gatherIntegrationComponents(loadedIntegrations) {
132
178
  keywords: doc && Array.isArray(doc.keywords) ? doc.keywords : [],
133
179
  description: doc ? doc.usage?.description || doc.description || '' : '',
134
180
  guidance: guidanceFrom(doc),
181
+ ...places.get(rec.name),
135
182
  _package: rec.package ?? integration.name,
136
183
  // Exactly what `component` reports: a doc may state its own specifier
137
184
  // (one entry point exporting several components), and only when it
@@ -7,6 +7,7 @@
7
7
 
8
8
  import {
9
9
  guideEntry,
10
+ sectionPackageOf,
10
11
  loadDocsCatalog,
11
12
  lowerTopic,
12
13
  projectTree,
@@ -104,9 +105,17 @@ export async function gatherDocs(cwd) {
104
105
  // A tree hit names where it lives: its ancestors' titles, then its own.
105
106
  const path = [...tree.ancestors(node).map(a => a.title), node.title];
106
107
  if (node.kind === 'generic') {
108
+ // A guide an integration replaced or extended names the package that
109
+ // wrote it, and each section the package that wrote that section, as
110
+ // reads do (INV28).
111
+ const entry = guideEntry(node);
107
112
  let doc = null;
113
+ /** @type {((key: string) => string) | undefined} */
114
+ let sectionPackage;
108
115
  try {
109
- doc = (await lowerTopic(catalog, guideEntry(node))).doc;
116
+ const lowered = await lowerTopic(catalog, entry);
117
+ doc = lowered.doc;
118
+ sectionPackage = sectionPackageOf(entry, lowered);
110
119
  } catch {
111
120
  // As above: the owning commands report it.
112
121
  }
@@ -118,7 +127,8 @@ export async function gatherDocs(cwd) {
118
127
  node.summary,
119
128
  path.join(' › '),
120
129
  node.parent == null ? undefined : `astryx docs ${node.parent}`,
121
- node.provider,
130
+ entry.package,
131
+ sectionPackage,
122
132
  ),
123
133
  );
124
134
  continue;
@@ -31,6 +31,9 @@
31
31
  * Core's package for its components, hooks, and templates, the integration's
32
32
  * for what it contributed, and for a doc part the package that wrote it.
33
33
  * @property {string} [_displayName]
34
+ * @property {string} [_family] - The family whose doc lists a component as a
35
+ * member; a query naming the family lists its first members.
36
+ * @property {number} [_familyIndex] - The member's place in that doc's list.
34
37
  * @property {'page'|'block'} [_kind]
35
38
  * @property {string} [_resultName]
36
39
  * @property {string} [_commandName]
@@ -120,6 +123,15 @@ export type Candidate = {
120
123
  */
121
124
  _package?: string | undefined;
122
125
  _displayName?: string | undefined;
126
+ /**
127
+ * - The family whose doc lists a component as a
128
+ * member; a query naming the family lists its first members.
129
+ */
130
+ _family?: string | undefined;
131
+ /**
132
+ * - The member's place in that doc's list.
133
+ */
134
+ _familyIndex?: number | undefined;
123
135
  _kind?: "page" | "block" | undefined;
124
136
  _resultName?: string | undefined;
125
137
  _commandName?: string | undefined;
@@ -90,6 +90,9 @@ import {toResult, searchedComponentsOf} from './_result.mjs';
90
90
  * Core's package for its components, hooks, and templates, the integration's
91
91
  * for what it contributed, and for a doc part the package that wrote it.
92
92
  * @property {string} [_displayName]
93
+ * @property {string} [_family] - The family whose doc lists a component as a
94
+ * member; a query naming the family lists its first members.
95
+ * @property {number} [_familyIndex] - The member's place in that doc's list.
93
96
  * @property {'page'|'block'} [_kind]
94
97
  * @property {string} [_resultName]
95
98
  * @property {string} [_commandName]
@@ -130,9 +130,12 @@ export function domainPriority(
130
130
  return 1;
131
131
  }
132
132
  const fuzzy = tokens.length <= 1;
133
+ // The whole query is read as the whole query; its words are parts of it
134
+ // only when there are several.
133
135
  return words.some(
134
- w =>
135
- (bestForToken(w, candidate, {fuzzy})?.score ?? 0) >= STRONG_TOKEN_SCORE,
136
+ (w, i) =>
137
+ (bestForToken(w, candidate, {fuzzy, part: i > 0 && tokens.length > 1})
138
+ ?.score ?? 0) >= STRONG_TOKEN_SCORE,
136
139
  )
137
140
  ? 1
138
141
  : 0;
@@ -6,11 +6,12 @@
6
6
  * (synonym hits are discounted so a direct hit always wins).
7
7
  * @param {string} tok
8
8
  * @param {Candidate} candidate
9
- * @param {{fuzzy?: boolean}} [opts]
9
+ * @param {{fuzzy?: boolean, part?: boolean}} [opts] - see scoreCandidate
10
10
  * @returns {{score: number, reason: string} | null}
11
11
  */
12
12
  export function bestForToken(tok: string, candidate: Candidate, opts?: {
13
13
  fuzzy?: boolean;
14
+ part?: boolean;
14
15
  }): {
15
16
  score: number;
16
17
  reason: string;
@@ -39,7 +39,7 @@ const MIN_TOKEN_SCORE = 50;
39
39
  * (synonym hits are discounted so a direct hit always wins).
40
40
  * @param {string} tok
41
41
  * @param {Candidate} candidate
42
- * @param {{fuzzy?: boolean}} [opts]
42
+ * @param {{fuzzy?: boolean, part?: boolean}} [opts] - see scoreCandidate
43
43
  * @returns {{score: number, reason: string} | null}
44
44
  */
45
45
  export function bestForToken(tok, candidate, opts = {}) {
@@ -47,7 +47,8 @@ export function bestForToken(tok, candidate, opts = {}) {
47
47
  const syns = SYNONYM_INDEX.get(tok);
48
48
  if (syns) {
49
49
  for (const s of syns) {
50
- const h = scoreCandidate(s, candidate, opts);
50
+ // A synonym of a family's name names no family: its members stay put.
51
+ const h = scoreCandidate(s, candidate, {...opts, synonym: true});
51
52
  if (h) {
52
53
  const score = Math.round(h.score * 0.85);
53
54
  if (!best || score > best.score)
@@ -187,7 +188,7 @@ export function scoreQuery(
187
188
  let alias = false;
188
189
  let aliasWords = 0;
189
190
  for (const tok of tokens) {
190
- let h = bestForToken(tok, candidate, {fuzzy});
191
+ let h = bestForToken(tok, candidate, {fuzzy, part: true});
191
192
  if (
192
193
  compound?.covered.has(joined(tok)) &&
193
194
  compound.score > (h?.score ?? 0)
@@ -58,7 +58,7 @@ export const doc = {
58
58
  {
59
59
  type: 'search',
60
60
  description:
61
- 'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, `displayName` and `kind` for templates, and `displayName` for themes. A doc result is the smallest part that answers: one section (with `section`, and a command that reads only it), one docs-tree route, or a topic, whose command lists its sections. `parent` is the command that opens the level above it: the section list of its topic, the namespace a tree node sits in, the topic level (Guides or Foundations) for a flat topic, or the topic list for a top-level namespace. Every doc result also carries `package`, the npm package that authored it (for a section, the package its file came from). A theme result is one theme you can import: `name` is its slug, its command is `astryx theme add <slug>` (outside a project, where there is no app to add it to, `astryx theme eject <slug>`), and `package` is the npm package that ships it (`@astryxdesign/cli` for the CLI\'s own themes). When a search with no `type` could not obtain @astryxdesign/core, `meta.partial` is `{skipped, reason}`: the domains it skipped (`component`, `hook`, `template`) and why; the results are the docs and themes, and text mode prints one line on standard error.',
61
+ "The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, `displayName` and `kind` for templates, and `displayName` for themes. A doc result is the smallest part that answers: one section (with `section`, and a command that reads only it), one docs-tree route, or a topic, whose command lists its sections. `parent` is the command that opens the level above it: the section list of its topic, the namespace a tree node sits in, the topic level (Guides or Foundations) for a flat topic, or the topic list for a top-level namespace. Every doc result also carries `package`, the npm package that authored it (for a section, the package its file came from). A theme result is one theme you can import: `name` is its slug, its command is `{@command theme add <slug>}` (outside a project, where there is no app to add it to, `{@command theme eject <slug>}`), and `package` is the npm package that ships it (`@astryxdesign/cli` for the CLI's own themes). When a search with no `type` could not obtain @astryxdesign/core, `meta.partial` is `{skipped, reason}`: the domains it skipped (`component`, `hook`, `template`) and why; the results are the docs and themes, and text mode prints one line on standard error.",
62
62
  },
63
63
  ],
64
64
  throws: [