@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
@@ -35,6 +35,15 @@ export async function index(topic, options = {}) {
35
35
  ...view,
36
36
  // A guide the docs tree places is read by its route, not its doc name.
37
37
  name: entry.tree ? entry.name : view.name,
38
+ // What it took the place of, and whose that was (INV28).
39
+ ...(entry.replaces != null
40
+ ? {
41
+ replaces: entry.replaces,
42
+ ...(entry.replacedPackage != null
43
+ ? {replacedPackage: entry.replacedPackage}
44
+ : {}),
45
+ }
46
+ : {}),
38
47
  // Each section names the package that wrote it: the topic's own, or an
39
48
  // extension's.
40
49
  sections: view.sections.map(s => ({
@@ -189,6 +189,28 @@ describe('integration docs in the docs tree', () => {
189
189
  ).toEqual(['acme/setup', 'acme/deploy']);
190
190
  }, SLOW);
191
191
 
192
+ it('renders a placed guide summary once, so an escaped token stays written', async () => {
193
+ scaffold({
194
+ ...kit(),
195
+ 'deploy.doc.mjs': guide('deploy', {
196
+ description: 'Show the syntax {@@pm run build} beside {@pm run build}.',
197
+ placement: {parent: 'namespace:acme', slot: 'guides', order: 2},
198
+ }),
199
+ });
200
+ const top = await docs('acme', undefined, {cwd: tmpDir});
201
+ const deploy = top.data.slots[0].children.find((/** @type {any} */ c) => c.route === 'acme/deploy');
202
+ expect(deploy.summary).toMatch(/^Show the syntax \{@pm run build\} beside `\S+ run build`\.$/);
203
+ }, SLOW);
204
+
205
+ it('renders a flat topic summary once, so an escaped token stays written', async () => {
206
+ scaffold({
207
+ ...kit(),
208
+ 'notes.doc.mjs': {...kit()['notes.doc.mjs'], description: 'Show the syntax {@@pm run build} beside {@pm run build}.'},
209
+ });
210
+ const listed = await docs('guides', undefined, {cwd: tmpDir});
211
+ expect(JSON.stringify(listed.data)).toContain('Show the syntax {@pm run build} beside `');
212
+ }, SLOW);
213
+
192
214
  it('reads a placed guide one level at a time, with its links resolved', async () => {
193
215
  scaffold(kit());
194
216
  const index = await docs('acme/setup', undefined, {cwd: tmpDir, index: true});
@@ -164,6 +164,46 @@ describe('integration-contributed topics', () => {
164
164
  expect(prose).not.toContain('{@link');
165
165
  }, SLOW);
166
166
 
167
+ it('renders a linked component or template summary once, so an escaped token stays written', async () => {
168
+ scaffold({
169
+ 'using-widgets.doc.mjs': topic({
170
+ name: 'using-widgets',
171
+ title: 'Using widgets',
172
+ sections: [
173
+ {
174
+ title: 'Overview',
175
+ content: [
176
+ {type: 'reference', target: 'component:AcmeButton'},
177
+ {type: 'reference', target: 'block:acme-card'},
178
+ ],
179
+ },
180
+ ],
181
+ }),
182
+ });
183
+ const pkgDir = path.join(tmpDir, 'node_modules', '@acme', 'widgets');
184
+ fs.writeFileSync(
185
+ path.join(pkgDir, 'astryx.integration.mjs'),
186
+ "export default {components: './components', templates: './templates', docs: './docs'};\n",
187
+ );
188
+ fs.mkdirSync(path.join(pkgDir, 'components'));
189
+ fs.writeFileSync(
190
+ path.join(pkgDir, 'components', 'AcmeButton.doc.mjs'),
191
+ "export default {type: 'component', name: 'AcmeButton', displayName: 'Acme Button', description: 'Shows {@@pm run build}.', props: []};\n",
192
+ );
193
+ fs.writeFileSync(path.join(pkgDir, 'components', 'AcmeButton.tsx'), 'export function AcmeButton() { return null; }\n');
194
+ fs.mkdirSync(path.join(pkgDir, 'templates'));
195
+ fs.writeFileSync(
196
+ path.join(pkgDir, 'templates', 'acme-card.doc.mjs'),
197
+ "export default {type: 'block', name: 'Acme card', description: 'Card for {@@pm run build}.'};\n",
198
+ );
199
+ fs.writeFileSync(path.join(pkgDir, 'templates', 'acme-card.tsx'), 'export default function Fixture() { return null; }\n');
200
+
201
+ const detail = await docs('using-widgets', undefined, {cwd: tmpDir, full: true});
202
+ const text = JSON.stringify(detail.data);
203
+ expect(text).toContain('Shows {@pm run build}.');
204
+ expect(text).toContain('Card for {@pm run build}.');
205
+ }, SLOW);
206
+
167
207
  it('selects Core in a link only where the bare name would open something else', async () => {
168
208
  const core = await discoverCoreTemplates();
169
209
  const page = core.find(template => template.type === 'page')?.dirName;
@@ -459,3 +499,48 @@ describe('integration-contributed topics', () => {
459
499
  expect(catalog.resolve('deploying')).toBeUndefined();
460
500
  }, SLOW);
461
501
  });
502
+
503
+ describe('doc tokens in a contributed topic', () => {
504
+ it(
505
+ 'render in the list, the read and search, for the project the read is about',
506
+ async () => {
507
+ scaffold({
508
+ 'deploying.doc.mjs': topic({
509
+ description:
510
+ 'Install with {@pm install @acme/widgets}, then run {@command doctor}.',
511
+ sections: [
512
+ {
513
+ title: 'Overview',
514
+ content: [{type: 'prose', text: 'Run {@command doctor} first.'}],
515
+ },
516
+ ],
517
+ }),
518
+ });
519
+ // The project in tmpDir uses Bun; the process's own folder uses pnpm.
520
+ fs.writeFileSync(path.join(tmpDir, 'bun.lock'), '{}\n');
521
+
522
+ const listed = await docs(undefined, undefined, {cwd: tmpDir});
523
+ const entry = listed.data.find(t => t.topic === 'deploying');
524
+ expect(entry.description).toBe(
525
+ 'Install with `bun add @acme/widgets`, then run `astryx doctor`.',
526
+ );
527
+ const detail = await docs('deploying', undefined, {
528
+ cwd: tmpDir,
529
+ full: true,
530
+ });
531
+ expect(JSON.stringify(detail)).not.toContain('{@');
532
+ expect(detail.data.sections[0].content[0].text).toBe(
533
+ 'Run `astryx doctor` first.',
534
+ );
535
+ // Core's own docs show tokens as written on purpose; this topic's render.
536
+ const found = await search('deploying', {cwd: tmpDir, type: 'doc'});
537
+ const hit = found.data.results.find(
538
+ (/** @type {any} */ result) => result.name === 'deploying',
539
+ );
540
+ expect(hit.description).toBe(
541
+ 'Install with `bun add @acme/widgets`, then run `astryx doctor`.',
542
+ );
543
+ },
544
+ SLOW,
545
+ );
546
+ });
@@ -52,7 +52,13 @@ export async function list({cwd} = {}) {
52
52
  ),
53
53
  package: entry.package,
54
54
  };
55
- if (entry.replaces != null) listed.replaces = entry.replaces;
55
+ if (entry.replaces != null) {
56
+ listed.replaces = entry.replaces;
57
+ // INV28: the package whose topic it replaced, beside its own.
58
+ if (entry.replacedPackage != null) {
59
+ listed.replacedPackage = entry.replacedPackage;
60
+ }
61
+ }
56
62
  entries.push(listed);
57
63
  }
58
64
  // The docs tree's top-level namespaces, the CLI's and each integration's,
@@ -94,7 +94,15 @@ function childIdentity(child) {
94
94
  return {
95
95
  route: child.route,
96
96
  name: child.route.slice(child.route.lastIndexOf('/') + 1),
97
- package: child.provider,
97
+ package: child.guideOverlay?.replacement?.package ?? child.provider,
98
+ // A guide an integration's doc took the place of names whose it was.
99
+ ...(child.guideOverlay?.replacement
100
+ ? {
101
+ replaces: child.route,
102
+ replacedPackage:
103
+ child.guideOverlay.replacedPackage ?? child.provider,
104
+ }
105
+ : {}),
98
106
  kind: child.kind,
99
107
  title: child.title,
100
108
  summary: child.summary,
@@ -259,7 +259,7 @@ describe('a reference block in a topic section', () => {
259
259
  /^docs\(\): Read the reference docs: .* Read it with `astryx docs cli\/api\/functions\/docs`\.$/,
260
260
  );
261
261
  expect(more[1].text).toMatch(
262
- /^Theme System: .* Read it with `astryx docs theme`\.$/,
262
+ /^Theming: .* Read it with `astryx docs theme`\.$/,
263
263
  );
264
264
  },
265
265
  SLOW,
@@ -164,10 +164,50 @@ export function installCommandFor(cwd: string): ((name: string) => string) | nul
164
164
  * @returns {boolean}
165
165
  */
166
166
  export function insideProjectElsewhere(cwd: string): boolean;
167
+ /**
168
+ * The absolute path `doctor --built` checks, or null when it does not exist.
169
+ * @param {string} cwd
170
+ * @param {string} target
171
+ * @returns {string | null}
172
+ */
173
+ export function resolveBuiltPath(cwd: string, target: string): string | null;
174
+ /**
175
+ * The files under a `doctor --built` path, in a stable order: each with its
176
+ * path relative to the folder (a file's own name when the path is one file),
177
+ * whether it sits in build output, and a reader that returns its text, or
178
+ * null when it cannot be read or is over 5 MB. Installs and version control
179
+ * are skipped; at most BUILT_FILE_LIMIT files are listed.
180
+ * @param {string} target an existing absolute path
181
+ * @returns {{files: {rel: string, built: boolean, read: () => string | null}[], truncated: boolean, missing?: number}}
182
+ */
183
+ export function readBuiltPath(target: string): {
184
+ files: {
185
+ rel: string;
186
+ built: boolean;
187
+ read: () => string | null;
188
+ }[];
189
+ truncated: boolean;
190
+ missing?: number;
191
+ };
192
+ /**
193
+ * The integration packages whose components count as Astryx for a `--built`
194
+ * path, read without running anything: each dependency the nearest
195
+ * package.json above the path declares whose installed copy, resolved the way
196
+ * the CLI autolinks integrations (a workspace root's hoisted copy included),
197
+ * holds an integration manifest. Every `@astryxdesign/*` package counts
198
+ * beside them.
199
+ * @param {string} target the path as given
200
+ * @param {string} cwd
201
+ * @returns {string[]}
202
+ */
203
+ export function builtIntegrationPackages(target: string, cwd: string): string[];
167
204
  export { resolveRecordedTheme } from "../theme/theme.mjs";
168
205
  export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
169
206
  export const SOURCE_EXTENSIONS: Set<string>;
170
207
  export { displayHomePath };
208
+ /** `doctor --built` reads at most this many files, of at most this size. */
209
+ export const BUILT_FILE_LIMIT: 20000;
210
+ export const BUILT_FILE_MAX_MB: 5;
171
211
  import { globalBehind } from '../../foundation/release/notices.mjs';
172
212
  import { projectLag } from '../../foundation/release/notices.mjs';
173
213
  import { lastNoticeSkip } from '../../foundation/release/notices.mjs';
@@ -26,7 +26,10 @@ import {
26
26
  } from '../../foundation/release/choose.mjs';
27
27
  import {readReleaseFacts} from '../../foundation/release/project.mjs';
28
28
  import {astryxCommandsOnSearchPath} from '../../foundation/env/search-path.mjs';
29
- import {readDeclaredDependencies} from '../../foundation/integrations/autolink.mjs';
29
+ import {
30
+ readDeclaredDependencies,
31
+ scanAutolinkCandidates,
32
+ } from '../../foundation/integrations/autolink.mjs';
30
33
  import {
31
34
  computerSkillFile,
32
35
  displayHomePath,
@@ -437,3 +440,170 @@ export function installCommandFor(cwd) {
437
440
  export function insideProjectElsewhere(cwd) {
438
441
  return installFolder(cwd)?.moved === true;
439
442
  }
443
+
444
+ /** Folders `doctor --built` never reads: installs and version control. */
445
+ const BUILT_SKIPPED_DIRS = new Set(['node_modules', '.git', '.hg', '.sl']);
446
+
447
+ /** Folders that hold build output: read for stylesheets, never as source. */
448
+ const BUILD_OUTPUT_DIRS = new Set(['.next', 'dist', 'build', 'out', '.output']);
449
+
450
+ /** `doctor --built` reads at most this many files, of at most this size. */
451
+ export const BUILT_FILE_LIMIT = 20000;
452
+ export const BUILT_FILE_MAX_MB = 5;
453
+ const BUILT_FILE_MAX_BYTES = BUILT_FILE_MAX_MB * 1024 * 1024;
454
+
455
+ /**
456
+ * The absolute path `doctor --built` checks, or null when it does not exist.
457
+ * @param {string} cwd
458
+ * @param {string} target
459
+ * @returns {string | null}
460
+ */
461
+ export function resolveBuiltPath(cwd, target) {
462
+ const resolved = path.resolve(cwd, target);
463
+ return fs.existsSync(resolved) ? resolved : null;
464
+ }
465
+
466
+ /**
467
+ * The files under a `doctor --built` path, in a stable order: each with its
468
+ * path relative to the folder (a file's own name when the path is one file),
469
+ * whether it sits in build output, and a reader that returns its text, or
470
+ * null when it cannot be read or is over 5 MB. Installs and version control
471
+ * are skipped; at most BUILT_FILE_LIMIT files are listed.
472
+ * @param {string} target an existing absolute path
473
+ * @returns {{files: {rel: string, built: boolean, read: () => string | null}[], truncated: boolean, missing?: number}}
474
+ */
475
+ export function readBuiltPath(target) {
476
+ /** @param {string} file */
477
+ const reader = file => () => {
478
+ try {
479
+ if (fs.statSync(file).size > BUILT_FILE_MAX_BYTES) return null;
480
+ return fs.readFileSync(file, 'utf8');
481
+ } catch {
482
+ return null;
483
+ }
484
+ };
485
+ if (!fs.statSync(target).isDirectory()) {
486
+ const inBuild = path
487
+ .dirname(target)
488
+ .split(path.sep)
489
+ .some(part => BUILD_OUTPUT_DIRS.has(part));
490
+ /** @type {{rel: string, built: boolean, read: () => string | null}[]} */
491
+ const files = [
492
+ {rel: path.basename(target), built: inBuild, read: reader(target)},
493
+ ];
494
+ let missing = 0;
495
+ // A built page carries its styles and scripts in files it links: read
496
+ // the local ones beside it, as built output.
497
+ if (/\.html?$/iu.test(target)) {
498
+ // A link inside an HTML comment is not one the page loads.
499
+ const page = (reader(target)() ?? '').replace(/<!--[\s\S]*?-->/g, ' ');
500
+ const seen = new Set([path.resolve(target)]);
501
+ for (const match of page.matchAll(
502
+ /<(?:link|script)\b[^>]*?\b(?:href|src)\s*=\s*(?:"([^"#?]+)|'([^'#?]+)|([^\s"'#?>]+))/giu,
503
+ )) {
504
+ const href = match[1] ?? match[2] ?? match[3];
505
+ if (/^(?:[a-z][\w+.-]*:|\/\/)/iu.test(href)) continue;
506
+ // A root-relative link names a file from the build root: the page's
507
+ // folder or the nearest folder above it that holds the file.
508
+ let file = path.resolve(path.dirname(target), href.replace(/^\//u, ''));
509
+ if (href.startsWith('/')) {
510
+ for (let dir = path.dirname(target); ; dir = path.dirname(dir)) {
511
+ const candidate = path.join(dir, href);
512
+ if (fs.existsSync(candidate)) {
513
+ file = candidate;
514
+ break;
515
+ }
516
+ if (path.dirname(dir) === dir) break;
517
+ }
518
+ }
519
+ if (seen.has(file)) continue;
520
+ if (!fs.existsSync(file)) {
521
+ // Only a missing stylesheet could have held Astryx styles; a
522
+ // missing favicon or manifest changes nothing.
523
+ if (
524
+ /\.css$/iu.test(href) ||
525
+ /\brel\s*=\s*["']?stylesheet/iu.test(match[0])
526
+ ) {
527
+ missing++;
528
+ }
529
+ continue;
530
+ }
531
+ seen.add(file);
532
+ files.push({
533
+ rel: path
534
+ .relative(path.dirname(target), file)
535
+ .split(path.sep)
536
+ .join('/'),
537
+ built: true,
538
+ read: reader(file),
539
+ });
540
+ }
541
+ }
542
+ return {files, truncated: false, missing};
543
+ }
544
+ /** @type {{rel: string, built: boolean, read: () => string | null}[]} */
545
+ const files = [];
546
+ // A path that is itself build output (`--built dist`) is read as built.
547
+ /** @type {{dir: string, built: boolean}[]} */
548
+ const stack = [
549
+ {dir: target, built: BUILD_OUTPUT_DIRS.has(path.basename(target))},
550
+ ];
551
+ while (stack.length > 0) {
552
+ const {dir, built} = /** @type {{dir: string, built: boolean}} */ (
553
+ stack.pop()
554
+ );
555
+ let entries;
556
+ try {
557
+ entries = fs.readdirSync(dir, {withFileTypes: true});
558
+ } catch {
559
+ continue;
560
+ }
561
+ entries.sort((a, b) => a.name.localeCompare(b.name));
562
+ for (const entry of entries) {
563
+ const full = path.join(dir, entry.name);
564
+ if (entry.isDirectory()) {
565
+ if (BUILT_SKIPPED_DIRS.has(entry.name)) continue;
566
+ stack.push({
567
+ dir: full,
568
+ built: built || BUILD_OUTPUT_DIRS.has(entry.name),
569
+ });
570
+ } else if (entry.isFile()) {
571
+ if (files.length >= BUILT_FILE_LIMIT) return {files, truncated: true};
572
+ files.push({
573
+ rel: path.relative(target, full).split(path.sep).join('/'),
574
+ built,
575
+ read: reader(full),
576
+ });
577
+ }
578
+ }
579
+ }
580
+ return {files, truncated: false};
581
+ }
582
+
583
+ /**
584
+ * The integration packages whose components count as Astryx for a `--built`
585
+ * path, read without running anything: each dependency the nearest
586
+ * package.json above the path declares whose installed copy, resolved the way
587
+ * the CLI autolinks integrations (a workspace root's hoisted copy included),
588
+ * holds an integration manifest. Every `@astryxdesign/*` package counts
589
+ * beside them.
590
+ * @param {string} target the path as given
591
+ * @param {string} cwd
592
+ * @returns {string[]}
593
+ */
594
+ export function builtIntegrationPackages(target, cwd) {
595
+ let dir = path.resolve(cwd, target);
596
+ try {
597
+ if (!fs.statSync(dir).isDirectory()) dir = path.dirname(dir);
598
+ } catch {
599
+ dir = path.resolve(cwd);
600
+ }
601
+ for (let at = dir; ; at = path.dirname(at)) {
602
+ if (fs.existsSync(path.join(at, 'package.json'))) {
603
+ return [
604
+ ...new Set(scanAutolinkCandidates(at).map(candidate => candidate.spec)),
605
+ ];
606
+ }
607
+ if (path.dirname(at) === at) return [];
608
+ }
609
+ }
@@ -0,0 +1,85 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Read a path and gather the evidence both checks judge.
6
+ * @param {string} target an existing file or folder
7
+ * @param {readonly string[]} packages package names whose components count as
8
+ * Astryx, beside every `@astryxdesign/*` package
9
+ * @returns {BuiltScan}
10
+ */
11
+ export function scanBuilt(target: string, packages: readonly string[]): BuiltScan;
12
+ /**
13
+ * The two checks for a path.
14
+ * @param {string} target as the caller gave it
15
+ * @param {{cwd: string, packages: readonly string[]}} options `packages`: the
16
+ * integration packages whose components count as Astryx
17
+ * @returns {import('./doctor.type.mjs').DoctorCheck[]}
18
+ */
19
+ export function checkBuilt(target: string, { cwd, packages }: {
20
+ cwd: string;
21
+ packages: readonly string[];
22
+ }): import("./doctor.type.mjs").DoctorCheck[];
23
+ export type BuiltFinding = {
24
+ /**
25
+ * the rubric category: `Astryx components`,
26
+ * `Icons` or `Styling`
27
+ */
28
+ category: string;
29
+ /**
30
+ * relative to the checked path
31
+ */
32
+ file: string;
33
+ /**
34
+ * 1-based
35
+ */
36
+ line: number;
37
+ message: string;
38
+ };
39
+ export type BuiltScan = {
40
+ sourceFiles: number;
41
+ /**
42
+ * source files whose JSX was inspected
43
+ */
44
+ jsxFiles: number;
45
+ builtFiles: number;
46
+ /**
47
+ * imports from Astryx packages
48
+ */
49
+ imports: number;
50
+ /**
51
+ * files with one
52
+ */
53
+ importFiles: number;
54
+ /**
55
+ * JSX uses of names imported from them
56
+ */
57
+ componentUses: number;
58
+ /**
59
+ * the Astryx packages imported, sorted
60
+ */
61
+ packages: string[];
62
+ /**
63
+ * built files with an Astryx stylesheet
64
+ */
65
+ stylesheets: string[];
66
+ findings: BuiltFinding[];
67
+ /**
68
+ * whether the file limit cut the read short
69
+ */
70
+ truncated: boolean;
71
+ /**
72
+ * source files over the size limit, unreadable, or
73
+ * not parsed
74
+ */
75
+ unread: number;
76
+ /**
77
+ * those files, relative to the path
78
+ */
79
+ unreadFiles: string[];
80
+ /**
81
+ * local files a built page links that are not
82
+ * there
83
+ */
84
+ missingLinks: number;
85
+ };