@astryxdesign/cli 0.7.3 → 0.7.4-canary.1a552f2

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 (244) 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/discover/_adapter.mjs +22 -10
  6. package/api/discover/_catalog-view.d.mts +2 -0
  7. package/api/discover/_catalog-view.mjs +1 -0
  8. package/api/discover/_catalog-view.test.mjs +1 -0
  9. package/api/discover/detail/detail.mjs +1 -0
  10. package/api/discover/detail/detail.test.mjs +3 -0
  11. package/api/discover/detail/doc/doc.mjs +5 -1
  12. package/api/discover/detail/doc/doc.test.mjs +1 -0
  13. package/api/discover/detail/item/item.mjs +2 -0
  14. package/api/discover/detail/item/item.test.mjs +2 -0
  15. package/api/discover/discover.doc.mjs +4 -4
  16. package/api/discover/discover.type.d.mts +20 -0
  17. package/api/discover/discover.type.mjs +5 -0
  18. package/api/discover/list/list.test.mjs +2 -0
  19. package/api/discover/search/search.d.mts +3 -2
  20. package/api/discover/search/search.mjs +26 -7
  21. package/api/discover/search/search.test.mjs +67 -0
  22. package/api/docs/_adapter.d.mts +80 -0
  23. package/api/docs/_adapter.mjs +261 -11
  24. package/api/docs/detail/detail.mjs +8 -0
  25. package/api/docs/docOverlays.test.mjs +2 -1
  26. package/api/docs/docs.d.mts +16 -6
  27. package/api/docs/docs.doc.mjs +1 -1
  28. package/api/docs/docs.mjs +55 -6
  29. package/api/docs/docs.type.d.mts +28 -2
  30. package/api/docs/docs.type.mjs +13 -3
  31. package/api/docs/guide-route-targets.test.mjs +1002 -0
  32. package/api/docs/index/index.mjs +9 -0
  33. package/api/docs/integration-tree.test.mjs +22 -0
  34. package/api/docs/integrationDocs.test.mjs +85 -0
  35. package/api/docs/list/list.mjs +7 -1
  36. package/api/docs/node/node.mjs +9 -1
  37. package/api/docs/reference-blocks.test.mjs +1 -1
  38. package/api/doctor/_adapter.d.mts +40 -0
  39. package/api/doctor/_adapter.mjs +171 -1
  40. package/api/doctor/built-checks.d.mts +85 -0
  41. package/api/doctor/built-checks.mjs +837 -0
  42. package/api/doctor/built-checks.test.mjs +531 -0
  43. package/api/doctor/doctor.d.mts +6 -5
  44. package/api/doctor/doctor.doc.mjs +11 -1
  45. package/api/doctor/doctor.mjs +18 -3
  46. package/api/doctor/doctor.type.d.mts +6 -0
  47. package/api/doctor/doctor.type.mjs +3 -0
  48. package/api/hook/list/list.d.mts +1 -1
  49. package/api/integration/_adapter.d.mts +11 -2
  50. package/api/integration/_adapter.mjs +30 -4
  51. package/api/integration/authoring-checks.mjs +29 -2
  52. package/api/integration/authoring-checks.test.mjs +131 -1
  53. package/api/integration/check/check.d.mts +4 -1
  54. package/api/integration/check/check.mjs +34 -4
  55. package/api/integration/check/check.test.mjs +49 -0
  56. package/api/integration/integration-check.type.d.mts +8 -0
  57. package/api/integration/integration-check.type.mjs +4 -1
  58. package/api/integration/integrationCheck.doc.mjs +8 -1
  59. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  60. package/api/integration/pack-check.mjs +71 -2
  61. package/api/integration/pack-check.test.mjs +77 -0
  62. package/api/integration/validate-integration-case-disk.test.mjs +2 -0
  63. package/api/integration/validate-integration-gaps.test.mjs +7 -4
  64. package/api/integration/validate-integration.mjs +96 -14
  65. package/api/integration/validate-integration.type.d.mts +10 -4
  66. package/api/integration/validate-integration.type.mjs +10 -5
  67. package/api/integration/validateIntegration.doc.mjs +1 -1
  68. package/api/search/_candidate-score.d.mts +3 -2
  69. package/api/search/_candidate-score.mjs +66 -3
  70. package/api/search/_gather-docs.mjs +12 -2
  71. package/api/search/_priority.mjs +2 -1
  72. package/api/search/_score.d.mts +2 -1
  73. package/api/search/_score.mjs +2 -2
  74. package/api/search/search.doc.mjs +1 -1
  75. package/api/search/search.family-members.test.mjs +124 -0
  76. package/api/search/search.mjs +28 -0
  77. package/api/theme/palette/generate/generate.d.mts +8 -0
  78. package/api/theme/palette/generate/generate.mjs +38 -11
  79. package/api/theme/palette/generate/generate.test.mjs +83 -4
  80. package/api/theme/palette/generate/generator.d.mts +6 -0
  81. package/api/theme/palette/generate/generator.mjs +6 -0
  82. package/api/theme/theme.type.d.mts +12 -1
  83. package/api/theme/theme.type.mjs +7 -1
  84. package/api/theme/themeBuild.doc.mjs +1 -1
  85. package/api/theme/themeList.doc.mjs +1 -1
  86. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  87. package/api/theme/themeTargets.doc.mjs +1 -1
  88. package/assets/discover/official-packages.json +16 -0
  89. package/assets/docs/author-a-theme.doc.mjs +15 -15
  90. package/assets/docs/browser-support.doc.mjs +1 -1
  91. package/assets/docs/getting-started.doc.mjs +16 -16
  92. package/assets/docs/is-my-code-good.doc.mjs +6 -6
  93. package/assets/docs/styling-overview.doc.mjs +5 -5
  94. package/assets/docs/theme.doc.mjs +5 -5
  95. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  96. package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
  97. package/assets/docs/tree/add-a-topic.doc.mjs +6 -6
  98. package/assets/docs/tree/agent-guidance.doc.mjs +5 -5
  99. package/assets/docs/tree/authoring.doc.mjs +2 -2
  100. package/assets/docs/tree/block-template.doc.mjs +1 -1
  101. package/assets/docs/tree/check-the-props.doc.mjs +3 -3
  102. package/assets/docs/tree/check-your-docs.doc.mjs +6 -6
  103. package/assets/docs/tree/checks.doc.mjs +11 -11
  104. package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
  105. package/assets/docs/tree/cli-command.doc.mjs +6 -6
  106. package/assets/docs/tree/codemods.doc.mjs +7 -7
  107. package/assets/docs/tree/component-family.doc.mjs +1 -1
  108. package/assets/docs/tree/component-imports.doc.mjs +2 -2
  109. package/assets/docs/tree/component-lookups.doc.mjs +6 -5
  110. package/assets/docs/tree/computer-agent-guide.doc.mjs +7 -7
  111. package/assets/docs/tree/computer-integrations.doc.mjs +5 -5
  112. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +3 -3
  113. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  114. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  115. package/assets/docs/tree/doc-syntax.doc.mjs +219 -0
  116. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  117. package/assets/docs/tree/extend-or-replace.doc.mjs +39 -7
  118. package/assets/docs/tree/font-setup.doc.mjs +1 -1
  119. package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
  120. package/assets/docs/tree/global-integrations.doc.mjs +11 -11
  121. package/assets/docs/tree/global.doc.mjs +2 -2
  122. package/assets/docs/tree/host-entry.doc.mjs +1 -1
  123. package/assets/docs/tree/install-once.doc.mjs +4 -4
  124. package/assets/docs/tree/layout.doc.mjs +1 -1
  125. package/assets/docs/tree/links.doc.mjs +2 -2
  126. package/assets/docs/tree/migration-setup.doc.mjs +15 -15
  127. package/assets/docs/tree/migration.doc.mjs +2 -1
  128. package/assets/docs/tree/other-libraries.doc.mjs +1 -1
  129. package/assets/docs/tree/page-template.doc.mjs +2 -2
  130. package/assets/docs/tree/problems.doc.mjs +8 -8
  131. package/assets/docs/tree/project-global-or-both.doc.mjs +2 -2
  132. package/assets/docs/tree/publishing.doc.mjs +7 -7
  133. package/assets/docs/tree/quick-start.doc.mjs +9 -9
  134. package/assets/docs/tree/reference.doc.mjs +2 -2
  135. package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
  136. package/assets/docs/tree/replace-a-core-template.doc.mjs +4 -4
  137. package/assets/docs/tree/scaffold.doc.mjs +1 -1
  138. package/assets/docs/tree/sections-and-placement.doc.mjs +3 -3
  139. package/assets/docs/tree/see-it-in-an-app.doc.mjs +3 -3
  140. package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
  141. package/assets/docs/tree/single-component.doc.mjs +4 -4
  142. package/assets/docs/tree/start-a-template.doc.mjs +5 -5
  143. package/assets/docs/tree/styling-advanced.doc.mjs +1 -1
  144. package/assets/docs/tree/styling-libraries.doc.mjs +2 -1
  145. package/assets/docs/tree/styling.doc.mjs +1 -1
  146. package/assets/docs/tree/tailwind.doc.mjs +1 -1
  147. package/assets/docs/tree/test-in-an-app.doc.mjs +5 -5
  148. package/assets/docs/tree/test-template-in-app.doc.mjs +6 -6
  149. package/assets/docs/tree/tokens-and-setup.doc.mjs +1 -1
  150. package/assets/docs/tree/troubleshooting.doc.mjs +24 -20
  151. package/assets/docs/tree/uninstall.doc.mjs +2 -2
  152. package/assets/docs/tree/updates.doc.mjs +1 -1
  153. package/assets/docs/tree/upgrading.doc.mjs +3 -3
  154. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
  155. package/assets/docs/tree/verify-packed-template.doc.mjs +3 -3
  156. package/assets/docs/tree/versioning.doc.mjs +4 -4
  157. package/assets/docs/tree/who-answers.doc.mjs +4 -4
  158. package/assets/docs/tree/write-the-template-file.doc.mjs +4 -4
  159. package/assets/docs/use-a-theme.doc.mjs +10 -10
  160. package/assets/docs/use-integrations.doc.mjs +1 -1
  161. package/assets/docs/working-with-ai.doc.mjs +15 -15
  162. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +1 -1
  163. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +1 -1
  164. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
  165. package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
  166. package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
  167. package/assets/templates/themes/butter/butterTheme.ts +274 -234
  168. package/assets/templates/themes/butter/palette.config.json +484 -0
  169. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +41 -0
  170. package/assets/templates/themes/gothic/gothicPalettes.generated.receipt.json +979 -0
  171. package/assets/templates/themes/gothic/gothicPalettes.generated.ts +271 -0
  172. package/assets/templates/themes/gothic/gothicTheme.ts +130 -160
  173. package/assets/templates/themes/gothic/palette.config.json +371 -0
  174. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +51 -0
  175. package/assets/templates/themes/matcha/matchaPalettes.generated.receipt.json +1502 -0
  176. package/assets/templates/themes/matcha/matchaPalettes.generated.ts +501 -0
  177. package/assets/templates/themes/matcha/matchaPalettes.ts +21 -0
  178. package/assets/templates/themes/matcha/matchaTheme.ts +164 -103
  179. package/assets/templates/themes/matcha/palette.config.json +448 -0
  180. package/assets/templates/themes/stone/palette.config.json +262 -0
  181. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +51 -0
  182. package/assets/templates/themes/stone/stonePalettes.generated.receipt.json +840 -0
  183. package/assets/templates/themes/stone/stonePalettes.generated.ts +501 -0
  184. package/assets/templates/themes/stone/stoneTheme.ts +190 -207
  185. package/assets/templates/themes/y2k/palette.config.json +166 -0
  186. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +54 -0
  187. package/assets/templates/themes/y2k/y2kPalettes.generated.receipt.json +872 -0
  188. package/assets/templates/themes/y2k/y2kPalettes.generated.ts +550 -0
  189. package/assets/templates/themes/y2k/y2kPalettes.ts +257 -0
  190. package/assets/templates/themes/y2k/y2kTheme.ts +164 -391
  191. package/authoring/codemod/codemod.doc.mjs +1 -1
  192. package/authoring/config/config.doc.mjs +4 -4
  193. package/authoring/debug/parse.d.mts +1 -1
  194. package/authoring/discover/discover.doc.mjs +1 -1
  195. package/authoring/doctypes/_schema.d.mts +4 -0
  196. package/authoring/doctypes/_schema.mjs +4 -0
  197. package/authoring/doctypes/reference/type.ts +14 -2
  198. package/authoring/gap-report/gap-report.doc.mjs +1 -1
  199. package/authoring/integration/integration.doc.mjs +6 -6
  200. package/clients/cli/commands/discover.mjs +1 -1
  201. package/clients/cli/commands/discover.sources.test.mjs +6 -0
  202. package/clients/cli/commands/docs.doc.mjs +1 -1
  203. package/clients/cli/commands/docs.mjs +27 -2
  204. package/clients/cli/commands/docs.test.mjs +1 -1
  205. package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
  206. package/clients/cli/commands/doctor.doc.mjs +13 -1
  207. package/clients/cli/commands/doctor.mjs +25 -9
  208. package/clients/cli/commands/integration-check.doc.mjs +11 -0
  209. package/clients/cli/commands/integration-check.test.mjs +36 -3
  210. package/clients/cli/commands/integration-pack.doc.mjs +1 -1
  211. package/clients/cli/commands/integration-verify.doc.mjs +1 -1
  212. package/clients/cli/commands/integration.mjs +15 -3
  213. package/clients/cli/commands/theme-targets.doc.mjs +1 -1
  214. package/clients/cli/commands/upgrade.doc.mjs +2 -2
  215. package/clients/cli/lib/define-command.mjs +5 -3
  216. package/foundation/agent-docs/agent-docs.d.mts +14 -2
  217. package/foundation/agent-docs/agent-docs.mjs +65 -4
  218. package/foundation/agent-docs/agent-docs.test.mjs +107 -0
  219. package/foundation/discovery/docs-discovery.d.mts +93 -2
  220. package/foundation/discovery/docs-discovery.mjs +237 -8
  221. package/foundation/discovery/runner-allowlist.d.mts +2 -0
  222. package/foundation/discovery/runner-allowlist.mjs +4 -0
  223. package/foundation/discovery/runner-commands.d.mts +29 -13
  224. package/foundation/discovery/runner-commands.mjs +253 -17
  225. package/foundation/discovery/stray-pointers.mjs +11 -5
  226. package/foundation/discovery/stray-pointers.test.mjs +6 -0
  227. package/foundation/doc-compiler/compile.mjs +8 -1
  228. package/foundation/doc-compiler/doc-loads.test.mjs +3 -0
  229. package/foundation/doc-compiler/doc-syntax.d.mts +194 -0
  230. package/foundation/doc-compiler/doc-syntax.mjs +739 -0
  231. package/foundation/doc-compiler/doc-syntax.test.mjs +383 -0
  232. package/foundation/doc-compiler/links.d.mts +13 -16
  233. package/foundation/doc-compiler/links.mjs +40 -7
  234. package/foundation/doc-compiler/tree.d.mts +5 -0
  235. package/foundation/doc-compiler/tree.mjs +9 -0
  236. package/foundation/env/package-manager.d.mts +18 -0
  237. package/foundation/env/package-manager.mjs +40 -0
  238. package/foundation/integrations/cli-requirement.d.mts +29 -0
  239. package/foundation/integrations/cli-requirement.mjs +47 -0
  240. package/foundation/integrations/cli-requirement.test.mjs +23 -2
  241. package/foundation/response/error-codes.test.mjs +9 -0
  242. package/foundation/response/response-types.doc.mjs +11 -11
  243. package/foundation/response/response-types.doc.test.mjs +29 -0
  244. package/package.json +9 -9
@@ -1724,6 +1724,69 @@ describe('integrationPackCheck', () => {
1724
1724
  expect(await codes()).not.toContain('section_ids_need_cli');
1725
1725
  }, 120_000);
1726
1726
 
1727
+ it('warns, without failing, when a doc section sets before or after on a CLI range that rejects them', async () => {
1728
+ writePackage({
1729
+ manifest: "export default {docs: './docs'};\n",
1730
+ themes: false,
1731
+ });
1732
+ fs.mkdirSync(path.join(tmpDir, 'docs'), {recursive: true});
1733
+ const pkgFile = path.join(tmpDir, 'package.json');
1734
+ const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));
1735
+ pkg.peerDependencies = {'@astryxdesign/cli': '>=0.7.0'};
1736
+ fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
1737
+ const issues = async () =>
1738
+ (await integrationPackCheck({cwd: tmpDir})).data.issues.filter(
1739
+ (/** @type {{code: string}} */ issue) =>
1740
+ issue.code === 'section_position_needs_cli',
1741
+ );
1742
+ // A placed guide's section counts too: an older CLI rejects the field in
1743
+ // any doc and hides the package's topics.
1744
+ fs.writeFileSync(
1745
+ path.join(tmpDir, 'docs', 'acme.doc.mjs'),
1746
+ "export default {type: 'namespace', name: 'acme', title: 'Acme', summary: 'Acme.', slots: {guides: {title: 'Guides', accepts: {kinds: ['generic']}}}};\n",
1747
+ );
1748
+ fs.writeFileSync(
1749
+ path.join(tmpDir, 'docs', 'setup.doc.mjs'),
1750
+ "export default {type: 'generic', name: 'setup', title: 'Setup', description: 'Set up.', placement: {parent: 'namespace:acme', slot: 'guides'}, sections: [{id: 'overview', title: 'Overview', after: 'nothing', content: [{type: 'prose', text: 'Set up.'}]}]};\n",
1751
+ );
1752
+ expect(await issues()).toEqual([
1753
+ expect.objectContaining({severity: 'warning'}),
1754
+ ]);
1755
+ pkg.peerDependencies = {'@astryxdesign/cli': '>=0.7.4'};
1756
+ fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
1757
+ expect(await issues()).toEqual([]);
1758
+ }, 120_000);
1759
+
1760
+ it('warns when a package whose docs write doc tokens has a CLI range that prints them raw', async () => {
1761
+ writePackage({
1762
+ manifest: "export default {docs: './docs'};\n",
1763
+ themes: false,
1764
+ });
1765
+ fs.mkdirSync(path.join(tmpDir, 'docs'), {recursive: true});
1766
+ const write = (/** @type {string} */ name, /** @type {string} */ text) =>
1767
+ fs.writeFileSync(
1768
+ path.join(tmpDir, 'docs', `${name}.doc.mjs`),
1769
+ `export default {type: 'generic', name: '${name}', title: 'Notes', description: 'Notes.', sections: [{title: 'Run', content: [{type: 'prose', text: ${JSON.stringify(text)}}]}]};\n`,
1770
+ );
1771
+ const found = async () =>
1772
+ (await integrationPackCheck({cwd: tmpDir})).data.issues.filter(
1773
+ (/** @type {{code: string}} */ issue) => issue.code === 'doc_tokens_need_cli',
1774
+ );
1775
+ // An escaped token is shown as written by every release.
1776
+ write('escaped', 'Write {@@pm install x} for an install.');
1777
+ expect(await found()).toEqual([]);
1778
+ write('tokens', 'Run {@command doctor} first.');
1779
+ expect((await found()).map((/** @type {any} */ issue) => issue.severity)).toEqual(['warning']);
1780
+ const pkgFile = path.join(tmpDir, 'package.json');
1781
+ const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));
1782
+ pkg.peerDependencies = {'@astryxdesign/cli': '>=0.7.3'};
1783
+ fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
1784
+ expect(await found()).toHaveLength(1);
1785
+ pkg.peerDependencies = {'@astryxdesign/cli': '>=0.7.4'};
1786
+ fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
1787
+ expect(await found()).toEqual([]);
1788
+ }, 120_000);
1789
+
1727
1790
  it('fails a package with a template that sets replaces on a CLI range that rejects the field', async () => {
1728
1791
  writePackage({
1729
1792
  manifest: "export default {templates: './templates'};\n",
@@ -2038,6 +2101,20 @@ describe('integrationPackCheck', () => {
2038
2101
  ).toEqual([]);
2039
2102
  });
2040
2103
 
2104
+ it("reads npm 8's scoped tarball name as the file npm writes", () => {
2105
+ const entry = {entryCount: 1, size: 1, unpackedSize: 1, files: []};
2106
+ expect(
2107
+ parseNpmPackOutput(
2108
+ JSON.stringify([{...entry, filename: '@acme/kit-1.0.0.tgz'}]),
2109
+ ).filename,
2110
+ ).toBe('acme-kit-1.0.0.tgz');
2111
+ expect(
2112
+ parseNpmPackOutput(
2113
+ JSON.stringify([{...entry, filename: 'acme-kit-1.0.0.tgz'}]),
2114
+ ).filename,
2115
+ ).toBe('acme-kit-1.0.0.tgz');
2116
+ });
2117
+
2041
2118
  it('rejects malformed npm pack output without a raw TypeError', () => {
2042
2119
  expect(() =>
2043
2120
  parseNpmPackOutput(
@@ -73,6 +73,7 @@ describe('a doc whose name differs from its source only in case, on a case-insen
73
73
  expect(data.notes).toEqual([
74
74
  {
75
75
  code: 'source_without_component_doc',
76
+ next: true,
76
77
  message:
77
78
  'Component doc "Acmewidget.doc.mjs" and its source "AcmeWidget.tsx" differ only in letter case. They pair on a case-insensitive disk (macOS, Windows) but not on Linux, where CI and most installs run, so there the component is missing. Fix: rename Acmewidget.doc.mjs to AcmeWidget.doc.mjs.',
78
79
  },
@@ -103,6 +104,7 @@ describe('a doc whose name differs from its source only in case, on a case-insen
103
104
  expect(data.notes).toEqual([
104
105
  {
105
106
  code: 'source_without_component_doc',
107
+ next: true,
106
108
  message:
107
109
  'Hidden component doc "Acmewidget.doc.mjs" and its source "AcmeWidget.tsx" differ only in letter case. They pair on a case-insensitive disk (macOS, Windows) but not on Linux, where CI and most installs run. Fix: rename Acmewidget.doc.mjs to AcmeWidget.doc.mjs.',
108
110
  },
@@ -185,7 +185,7 @@ describe('a name that differs from its file name', () => {
185
185
  expect(await issuesOf(dir)).toEqual([]);
186
186
  const issues = await allOf(dir);
187
187
  expect(issues.map(issue => issue.code)).toEqual(['doc_name_mismatch']);
188
- expect(Object.keys(issues[0]).sort()).toEqual(['code', 'message']);
188
+ expect(Object.keys(issues[0]).sort()).toEqual(['code', 'message', 'next']);
189
189
  expect(issues[0].message).toBe(
190
190
  'Component doc "AcmeWidget.doc.mjs" sets name: \'AcmeWidgets\', but components/AcmeWidget.tsx, the module its import names, does not export AcmeWidgets, so Astryx lists the component as "AcmeWidget" (its file name), and `astryx component AcmeWidget` prints `import {AcmeWidgets}`. Fix: set name: \'AcmeWidget\' in AcmeWidget.doc.mjs.',
191
191
  );
@@ -1369,6 +1369,7 @@ describe('package.json', () => {
1369
1369
  expect('notes' in validate ? validate.notes : undefined).toEqual([
1370
1370
  {
1371
1371
  code: 'invalid_package_json',
1372
+ next: true,
1372
1373
  message:
1373
1374
  'package.json has no "name", so npm cannot pack or publish the package, and a project that installs it has no name to select it by. Fix: add "name": "@your-scope/your-package" to package.json.',
1374
1375
  },
@@ -1892,7 +1893,9 @@ describe('layout findings 0.7.2 did not fail on', () => {
1892
1893
  );
1893
1894
  expect(validate.notes.length).toBeGreaterThan(0);
1894
1895
  for (const note of validate.notes) {
1895
- expect(Object.keys(note).sort()).toEqual(['code', 'message']);
1896
+ // Listed now, a warning from the next minor release: `next`.
1897
+ expect(Object.keys(note).sort()).toEqual(['code', 'message', 'next']);
1898
+ expect(note.next).toBe(true);
1896
1899
  expect(note.message).toContain('Fix: ');
1897
1900
  }
1898
1901
  } finally {
@@ -1917,7 +1920,7 @@ describe('layout findings 0.7.2 did not fail on', () => {
1917
1920
  );
1918
1921
  expect(run.status, run.stderr).toBe(0);
1919
1922
  expect(run.stdout).toContain(
1920
- 'note (duplicate_component_doc): Component "AcmeWidget" has 2 docs:',
1923
+ 'note (duplicate_component_doc): [next minor] Component "AcmeWidget" has 2 docs:',
1921
1924
  );
1922
1925
  expect(run.stdout).toContain('Summary: 0 errors, 0 warnings');
1923
1926
  });
@@ -1968,7 +1971,7 @@ describe('name findings listed until the next minor release', () => {
1968
1971
  );
1969
1972
  expect(run.status, run.stderr).toBe(0);
1970
1973
  expect(run.stdout).toContain(
1971
- 'note (unknown_block_component): Template "account-card" names "AcmeGizmo" in componentsUsed',
1974
+ 'note (unknown_block_component): [next minor] Template "account-card" names "AcmeGizmo" in componentsUsed',
1972
1975
  );
1973
1976
  expect(run.stdout).toContain('Summary: 0 errors, 0 warnings');
1974
1977
  });
@@ -37,7 +37,10 @@ import {assertWithin} from '../../foundation/fs/path-safety.mjs';
37
37
  import {normalizeProviderId} from '../../foundation/identity/provider-identity.mjs';
38
38
  import {integrationDocTypes} from '../docs/_adapter.mjs';
39
39
  import {integrationDocConsistency} from '../../foundation/discovery/doc-consistency.mjs';
40
- import {integrationRunnerCommands} from './_adapter.mjs';
40
+ import {
41
+ integrationDocCommands,
42
+ integrationDocTargets,
43
+ } from './_adapter.mjs';
41
44
  import {
42
45
  THEME_SLUG_RE,
43
46
  unreadThemeFolders,
@@ -77,6 +80,15 @@ import {runChoice} from '../../foundation/release/run-context.mjs';
77
80
  /** The running CLI is outside the package's `@astryxdesign/cli` peer range. */
78
81
  const CLI_PEER_VERSION = 'cli_peer_version';
79
82
 
83
+ /** A doc replaces or extends a name that holds no topic and no guide. */
84
+ const DOC_TARGET_NOT_FOUND = 'doc_target_not_found';
85
+
86
+ /** An extension section's `before` or `after` names no section of the base. */
87
+ const DOC_SECTION_UNPLACED = 'doc_section_unplaced';
88
+
89
+ /** Two docs of one package replace one guide; only the last one is read. */
90
+ const DUPLICATE_GUIDE_REPLACEMENT = 'duplicate_guide_replacement';
91
+
80
92
  export {validateLoadedIntegration, isListedIssue};
81
93
 
82
94
  /**
@@ -477,8 +489,11 @@ async function validateAtPackageDir(
477
489
  const publicImports = await publicImportIssues(packageDir, loaded);
478
490
  issues.push(...publicImports.issues);
479
491
  // Each finding is a note until the next minor makes it a warning.
492
+ // Listed now, a warning from the next minor release: `next`.
480
493
  if (publicImports.notes.length > 0)
481
- (result.notes ??= []).push(...publicImports.notes);
494
+ (result.notes ??= []).push(
495
+ ...publicImports.notes.map(note => ({...note, next: true})),
496
+ );
482
497
  result.publicImports = publicImports.report;
483
498
  if (scanUnreachable) {
484
499
  issues.push(
@@ -686,23 +701,78 @@ export async function validateInstalledIntegration(spec, cwd = process.cwd()) {
686
701
  }
687
702
 
688
703
  /**
689
- * The runner-command notes for a package's topics: each Astryx command a topic
690
- * writes with a package runner, where the doc file is, and the bare command to
691
- * write.
704
+ * The doc-syntax notes for a package's topics: each command a topic writes
705
+ * with a runner (`runner_command`), for one package manager
706
+ * (`package_manager_command`), or bare (`plain_command`), and each token that
707
+ * does not parse (`doc_token`), with the file, line and what to write
708
+ * instead. The next minor release turns them into warnings: `next`.
692
709
  * @param {any} integration a loaded integration
693
- * @returns {Promise<Array<{code: string, message: string}>>}
710
+ * @returns {Promise<Array<{code: string, message: string, next: true}>>}
694
711
  */
695
- async function runnerCommandNotes(integration) {
712
+ async function docCommandNotes(integration) {
696
713
  const packageDir = integration.__packageDir;
697
- return (await integrationRunnerCommands(integration)).map(each => ({
698
- code: 'runner_command',
714
+ return (await integrationDocCommands(integration)).map(each => ({
715
+ code: each.code,
699
716
  message:
700
717
  typeof packageDir === 'string'
701
718
  ? `${path.relative(packageDir, each.file).split(path.sep).join('/')}: ${each.message}`
702
719
  : each.message,
720
+ next: true,
703
721
  }));
704
722
  }
705
723
 
724
+ /**
725
+ * The notes for docs that replace or extend a topic or a guide the docs tree
726
+ * places, or place an extension's section with `before` or `after`: a name
727
+ * that holds neither (such as a namespace) applies nothing, and a key that
728
+ * names no section adds the section at the end. Each is listed, failing nothing, until
729
+ * the next minor release (architecture:cli-surface INV35).
730
+ * @param {any} integration a loaded integration
731
+ * @returns {Promise<Array<{code: string, message: string}>>}
732
+ */
733
+ async function docTargetNotes(integration) {
734
+ /** @type {Array<{code: string, message: string}>} */
735
+ const notes = [];
736
+ const targets = await integrationDocTargets(integration);
737
+ /** @type {Map<string, string[]>} lowercased route → the docs replacing it */
738
+ const replacers = new Map();
739
+ for (const each of targets) {
740
+ if (each.kind !== 'guide' || each.relationship !== 'replaces') continue;
741
+ // An old route and the new one name one guide.
742
+ const key = each.guide ?? each.target.toLowerCase();
743
+ replacers.set(key, [...(replacers.get(key) ?? []), each.topic]);
744
+ }
745
+ for (const [route, topics] of replacers) {
746
+ if (topics.length < 2) continue;
747
+ notes.push({
748
+ code: DUPLICATE_GUIDE_REPLACEMENT,
749
+ message: `"${topics.join('", "')}" all replace the guide "${route}", and only the last, "${topics.at(-1)}", is read. Fix: keep one replacement, or make the others extend it.`,
750
+ });
751
+ }
752
+ for (const each of targets) {
753
+ if (each.kind === 'namespace') {
754
+ const shown = each.guidesBelow.slice(0, 8);
755
+ const more = each.guidesBelow.length - shown.length;
756
+ notes.push({
757
+ code: DOC_TARGET_NOT_FOUND,
758
+ message: `"${each.topic}" ${each.relationship} "${each.target}", which is a namespace of the docs tree: it holds no sections to ${each.relationship === 'replaces' ? 'replace' : 'extend'}, so this changes nothing. Fix: name the route of a guide below it${shown.length > 0 ? `: ${shown.join(', ')}${more > 0 ? `, and ${more} more` : ''}` : ''}.`,
759
+ });
760
+ } else if (each.kind == null) {
761
+ notes.push({
762
+ code: DOC_TARGET_NOT_FOUND,
763
+ message: `"${each.topic}" ${each.relationship} "${each.target}", which is neither a topic nor a guide of the CLI's docs or this package's own: it changes nothing unless an app also installs a package that provides it. Fix: if it should name one of those, name a topic as \`${formatCliCommand('docs')}\` lists it, or a guide's route as \`${formatCliCommand('docs authoring --depth all')}\` or \`${formatCliCommand('docs cli --depth all')}\` lists it.`,
764
+ });
765
+ }
766
+ for (const {section, field, key} of each.unplaced) {
767
+ notes.push({
768
+ code: DOC_SECTION_UNPLACED,
769
+ message: `Section "${section}" of "${each.topic}" goes ${field} "${key}", which is no section of "${each.guide ?? each.target}", so it is added at the end. Fix: use a key \`${formatCliCommand(`docs ${each.guide ?? each.target} --index`)}\` lists.`,
770
+ });
771
+ }
772
+ }
773
+ return notes;
774
+ }
775
+
706
776
  /**
707
777
  * Unified entry: validate the LOCAL integration (no `pkg`) or an INSTALLED one
708
778
  * (`pkg` given) and return the `integration.validate` envelope. The no-manifest
@@ -743,20 +813,32 @@ export async function validateIntegration(pkg, options = {}) {
743
813
  // after the last minor release, each with its fix in the message, which
744
814
  // may not fail `--strict` until the next (architecture:cli-surface INV35):
745
815
  // the layout findings and the component names judged wrong.
816
+ // A finding the next minor release turns into a warning is marked `next`:
817
+ // `integration check --strict --next` fails on it today.
746
818
  const notes = result.found
747
819
  ? [
748
- ...(result.notes ?? []),
820
+ // A malformed cliCommand fails --strict from the next minor
821
+ // (spec:AST-081 FR5).
822
+ ...(result.notes ?? []).map(note =>
823
+ note.code === INVALID_CLI_COMMAND ? {...note, next: true} : note,
824
+ ),
749
825
  ...(result.listed ?? []).map(issue => ({
750
826
  code: issue.code,
751
827
  message: issue.message,
828
+ next: true,
752
829
  })),
753
- ...(names ?? []).flatMap(each => each.notes),
830
+ ...(names ?? []).flatMap(each =>
831
+ each.notes.map(note => ({...note, next: true})),
832
+ ),
754
833
  ]
755
834
  : [];
756
- // Each Astryx command a topic writes with a package runner, as a
757
- // `runner_command` note with its fix, the same way.
835
+ // The doc-syntax findings in the package's topics, as `next` notes with
836
+ // their fixes, the same way.
758
837
  if (integration?.docs) {
759
- notes.push(...(await runnerCommandNotes(integration)));
838
+ notes.push(...(await docCommandNotes(integration)));
839
+ notes.push(
840
+ ...(await docTargetNotes(integration)).map(note => ({...note, next: true})),
841
+ );
760
842
  }
761
843
  return {
762
844
  type: 'integration.validate',
@@ -36,8 +36,11 @@ 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;
41
44
  * `cli_peer_version`, the running CLI outside the package's
42
45
  * `@astryxdesign/cli` peer range; and
43
46
  * the package layout findings added after the last minor release, each with
@@ -50,8 +53,10 @@ export type ValidateIntegrationResponse = {
50
53
  * still pair (`source_without_component_doc`); `doc_name_mismatch` and
51
54
  * `unknown_block_component` (see `docNames` and `blockComponents`); and
52
55
  * 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
56
+ * minor release; and, for the commands a topic writes, `runner_command`
57
+ * (written with a package runner), `plain_command` (written bare),
58
+ * `package_manager_command` (written for one package manager) and
59
+ * `doc_token` (a token that does not parse), each with the token to write
55
60
  */
56
61
  data: {
57
62
  validated: boolean;
@@ -61,6 +66,7 @@ export type ValidateIntegrationResponse = {
61
66
  notes?: Array<{
62
67
  code: string;
63
68
  message: string;
69
+ next?: boolean;
64
70
  }>;
65
71
  docTypes?: DocTypesReport;
66
72
  docNames?: DocNamesReport;
@@ -39,9 +39,12 @@
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, 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;
45
48
  * `cli_peer_version`, the running CLI outside the package's
46
49
  * `@astryxdesign/cli` peer range; and
47
50
  * the package layout findings added after the last minor release, each with
@@ -54,8 +57,10 @@
54
57
  * still pair (`source_without_component_doc`); `doc_name_mismatch` and
55
58
  * `unknown_block_component` (see `docNames` and `blockComponents`); and
56
59
  * 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
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
59
64
  */
60
65
 
61
66
  /**
@@ -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`. 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,7 +17,7 @@
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 {{fuzzy?: boolean, joins?: boolean, part?: 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.
21
21
  * @returns {{score: number, reason: string, alias?: 'partial' | 'keyword'} | null}
22
22
  * `alias` marks a hit that read the query's words joined.
23
23
  */
@@ -30,9 +30,10 @@ export function scoreCandidate(term: string, { name, aliases, domain, keywords,
30
30
  description?: string | undefined;
31
31
  prose?: string[] | undefined;
32
32
  guidance?: string[] | undefined;
33
- }, { fuzzy, joins }?: {
33
+ }, { fuzzy, joins, part }?: {
34
34
  fuzzy?: boolean;
35
35
  joins?: boolean;
36
+ part?: boolean;
36
37
  }): {
37
38
  score: number;
38
39
  reason: string;
@@ -41,11 +41,56 @@ 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
+
49
94
  /**
50
95
  * Score a single candidate against the search term across name, keywords,
51
96
  * and prose signals. Returns the best (highest) score plus a human reason,
@@ -62,7 +107,7 @@ import {pluralOf} from './_query.mjs';
62
107
  * @param {string} [candidate.description]
63
108
  * @param {string[]} [candidate.prose] - Extra free-text blobs (doc section text, best practices).
64
109
  * @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.
110
+ * @param {{fuzzy?: boolean, joins?: boolean, part?: 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.
66
111
  * @returns {{score: number, reason: string, alias?: 'partial' | 'keyword'} | null}
67
112
  * `alias` marks a hit that read the query's words joined.
68
113
  */
@@ -78,7 +123,7 @@ export function scoreCandidate(
78
123
  prose = [],
79
124
  guidance = [],
80
125
  },
81
- {fuzzy = true, joins = true} = {},
126
+ {fuzzy = true, joins = true, part = false} = {},
82
127
  ) {
83
128
  let best = 0;
84
129
  let reason = '';
@@ -128,6 +173,15 @@ export function scoreCandidate(
128
173
  // Most of the name typed as words, cut short: `complex select` is
129
174
  // ComplexSelector, ahead of a one-word keyword elsewhere.
130
175
  consider(95, `name "${candidateName}" spelled`, 'partial');
176
+ } else if (
177
+ domain !== 'doc' &&
178
+ domain !== 'theme' &&
179
+ spellsOut(term, candidateName, description)
180
+ ) {
181
+ // The name's short words spelled out, in order, as the entry's own
182
+ // description spells them: `vertical stack` is VStack ("Vertical stack
183
+ // for arranging items top-to-bottom").
184
+ consider(95, `name "${candidateName}" spelled out`);
131
185
  } else if (pluralOf(nameLower, term) || pluralOf(term, nameLower)) {
132
186
  // One point under the exact spelling, so the doc named `tokens` still
133
187
  // outranks the Token component for `tokens`.
@@ -135,7 +189,16 @@ export function scoreCandidate(
135
189
  } else {
136
190
  if (sameWord(term, nameLower)) consider(95, `name "${candidateName}"`);
137
191
  // The term is a word of the name, or starts one: "input" in TextInput.
138
- else if (startsAWordOf(term, candidateName)) {
192
+ else if (
193
+ !part &&
194
+ domain !== 'doc' &&
195
+ domain !== 'theme' &&
196
+ headOfLetters(term, candidateName)
197
+ ) {
198
+ // The whole query is the name's head word after single letters (Stack
199
+ // in VStack, HStack): a variant named by its head, as a keyword is.
200
+ consider(90, `name "${candidateName}" ends in "${term}"`);
201
+ } else if (startsAWordOf(term, candidateName)) {
139
202
  consider(60, `name contains "${term}"`);
140
203
  }
141
204
  if (fuzzy) {
@@ -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;
@@ -132,7 +132,8 @@ export function domainPriority(
132
132
  const fuzzy = tokens.length <= 1;
133
133
  return words.some(
134
134
  w =>
135
- (bestForToken(w, candidate, {fuzzy})?.score ?? 0) >= STRONG_TOKEN_SCORE,
135
+ (bestForToken(w, candidate, {fuzzy, part: words.length > 1})?.score ??
136
+ 0) >= STRONG_TOKEN_SCORE,
136
137
  )
137
138
  ? 1
138
139
  : 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 = {}) {
@@ -187,7 +187,7 @@ export function scoreQuery(
187
187
  let alias = false;
188
188
  let aliasWords = 0;
189
189
  for (const tok of tokens) {
190
- let h = bestForToken(tok, candidate, {fuzzy});
190
+ let h = bestForToken(tok, candidate, {fuzzy, part: true});
191
191
  if (
192
192
  compound?.covered.has(joined(tok)) &&
193
193
  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: [