@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.a860a50

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 (291) hide show
  1. package/README.md +32 -18
  2. package/api/build/build.doc.mjs +3 -3
  3. package/api/build/build.test.mjs +14 -3
  4. package/api/build/build.type.d.mts +36 -2
  5. package/api/build/build.type.mjs +25 -4
  6. package/api/build/help/help.d.mts +8 -5
  7. package/api/build/help/help.mjs +56 -6
  8. package/api/component/component.doc.mjs +11 -2
  9. package/api/component/component.mjs +29 -0
  10. package/api/component/component.test.mjs +38 -0
  11. package/api/component/component.type.d.mts +17 -7
  12. package/api/component/component.type.mjs +27 -20
  13. package/api/discover/discover.doc.mjs +1 -1
  14. package/api/discover/discover.type.d.mts +4 -4
  15. package/api/discover/discover.type.mjs +10 -10
  16. package/api/docs/_adapter.d.mts +30 -27
  17. package/api/docs/_adapter.mjs +154 -124
  18. package/api/docs/compiled-topics.test.mjs +78 -0
  19. package/api/docs/detail/detail.d.mts +0 -15
  20. package/api/docs/detail/detail.mjs +14 -78
  21. package/api/docs/detail/section/section.mjs +22 -18
  22. package/api/docs/detail/section/section.test.mjs +4 -3
  23. package/api/docs/docs.type.d.mts +4 -4
  24. package/api/docs/docs.type.mjs +10 -10
  25. package/api/docs/index/index.mjs +6 -5
  26. package/api/doctor/doctor.mjs +3 -7
  27. package/api/gap-report/gap-report.doc.mjs +7 -4
  28. package/api/hook/hook.type.d.mts +3 -3
  29. package/api/hook/hook.type.mjs +11 -11
  30. package/api/init/init.doc.mjs +4 -0
  31. package/api/init/init.test.mjs +41 -1
  32. package/api/init/remove/remove.mjs +1 -1
  33. package/api/init/run/run.mjs +20 -10
  34. package/api/integration/add-contribution.component-names.test.mjs +120 -0
  35. package/api/integration/add-contribution.mjs +16 -3
  36. package/api/integration/add-contribution.test.mjs +84 -4
  37. package/api/integration/integrationAdd.doc.mjs +7 -4
  38. package/api/integration/integrationAddComponent.doc.mjs +1 -1
  39. package/api/integration/pack-check.mjs +49 -7
  40. package/api/integration/pack-check.test.mjs +249 -0
  41. package/api/integration/validate-integration.mjs +2 -0
  42. package/api/integration/validate-integration.test.mjs +91 -0
  43. package/api/integration/validateIntegration.doc.mjs +1 -1
  44. package/api/json/envelope-types.test.mjs +76 -0
  45. package/api/json/parseResponse.doc.mjs +2 -2
  46. package/api/layout/expand/expand.mjs +7 -5
  47. package/api/layout/expand/expand.path-safety.test.mjs +53 -0
  48. package/api/layout/grammar/grammar.mjs +2 -1
  49. package/api/layout/layoutExpand.doc.mjs +1 -1
  50. package/api/search/search-return-type.test.mjs +54 -0
  51. package/api/search/search.d.mts +2 -9
  52. package/api/search/search.doc.mjs +5 -1
  53. package/api/search/search.mjs +15 -8
  54. package/api/search/search.test.mjs +34 -0
  55. package/api/search/search.type.d.mts +1 -1
  56. package/api/search/search.type.mjs +1 -1
  57. package/api/swizzle/copy/copy.mjs +28 -11
  58. package/api/swizzle/swizzle.doc.mjs +1 -1
  59. package/api/swizzle/swizzle.type.d.mts +2 -2
  60. package/api/swizzle/swizzle.type.mjs +2 -2
  61. package/api/template/copy/copy.mjs +17 -23
  62. package/api/template/copy/copy.test.mjs +17 -0
  63. package/api/template/template.doc.mjs +2 -1
  64. package/api/template/template.type.d.mts +5 -5
  65. package/api/template/template.type.mjs +12 -12
  66. package/api/theme/add/add.binary.test.mjs +91 -0
  67. package/api/theme/add/add.mjs +15 -2
  68. package/api/theme/build/build.mjs +133 -42
  69. package/api/theme/build/build.public-component-vars.test.mjs +1 -1
  70. package/api/theme/build/build.receipt-doc.test.mjs +111 -0
  71. package/api/theme/build/build.test.mjs +127 -0
  72. package/api/theme/build/font-warning.mjs +3 -3
  73. package/api/theme/build/font-warning.test.mjs +5 -2
  74. package/api/theme/palette/generate/generate.mjs +8 -3
  75. package/api/theme/palette/generate/generate.test.mjs +96 -0
  76. package/api/theme/palette/generate/generator.d.mts +10 -13
  77. package/api/theme/palette/generate/generator.mjs +15 -4
  78. package/api/theme/palette/generate/generator.test.mjs +10 -0
  79. package/api/theme/template/template.mjs +11 -2
  80. package/api/theme/template/template.test.mjs +15 -0
  81. package/api/theme/theme.type.d.mts +170 -11
  82. package/api/theme/theme.type.mjs +94 -27
  83. package/api/theme/themeBuild.doc.mjs +7 -4
  84. package/api/theme/themeTemplate.doc.mjs +4 -1
  85. package/api/upgrade/_adapter.mjs +27 -4
  86. package/api/upgrade/list/list.mjs +2 -1
  87. package/api/upgrade/list/list.test.mjs +73 -0
  88. package/api/upgrade/status/status.mjs +2 -2
  89. package/api/upgrade/upgrade.doc.mjs +2 -1
  90. package/api/upgrade/upgrade.type.d.mts +8 -4
  91. package/api/upgrade/upgrade.type.mjs +11 -10
  92. package/assets/codemods/integration-discovery.mjs +40 -2
  93. package/assets/codemods/integration-discovery.test.mjs +58 -0
  94. package/assets/codemods/term-log.mjs +32 -8
  95. package/assets/codemods/term-log.test.mjs +19 -1
  96. package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
  97. package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
  98. package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
  99. package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
  100. package/assets/docs/cli-integrations.doc.mjs +9 -0
  101. package/assets/docs/styling-libraries.doc.mjs +1 -1
  102. package/assets/docs/working-with-ai.doc.mjs +1 -1
  103. package/assets/templates/pages/table-tree/page.tsx +1704 -0
  104. package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
  105. package/authoring/_shared/contract.ts +22 -0
  106. package/authoring/codemod/codemod.doc.mjs +6 -1
  107. package/authoring/codemod/parse.d.mts +8 -8
  108. package/authoring/codemod/parse.mjs +8 -6
  109. package/authoring/config/config.doc.mjs +1 -1
  110. package/authoring/config/debug-composition.test.mjs +92 -0
  111. package/authoring/config/parse.d.mts +13 -13
  112. package/authoring/config/parse.mjs +8 -8
  113. package/authoring/config/type.ts +18 -6
  114. package/authoring/debug/parse.d.mts +4 -4
  115. package/authoring/debug/parse.mjs +3 -3
  116. package/authoring/doctypes/_schema.d.mts +121 -11
  117. package/authoring/doctypes/_schema.mjs +144 -13
  118. package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
  119. package/authoring/doctypes/base/type.ts +8 -4
  120. package/authoring/doctypes/command/command.doc.mjs +3 -2
  121. package/authoring/doctypes/command/parse.d.mts +2 -2
  122. package/authoring/doctypes/command/parse.mjs +1 -1
  123. package/authoring/doctypes/command/type.ts +2 -2
  124. package/authoring/doctypes/component/component.doc.mjs +5 -2
  125. package/authoring/doctypes/component/parse.d.mts +2 -2
  126. package/authoring/doctypes/component/parse.mjs +1 -1
  127. package/authoring/doctypes/component/type.ts +1 -1
  128. package/authoring/doctypes/enum/parse.d.mts +2 -2
  129. package/authoring/doctypes/enum/parse.mjs +1 -1
  130. package/authoring/doctypes/enum/type.ts +1 -1
  131. package/authoring/doctypes/function/function.doc.mjs +4 -0
  132. package/authoring/doctypes/function/parse.d.mts +2 -2
  133. package/authoring/doctypes/function/parse.mjs +1 -1
  134. package/authoring/doctypes/function/type.ts +1 -1
  135. package/authoring/doctypes/hook/hook.doc.mjs +4 -0
  136. package/authoring/doctypes/hook/parse.d.mts +2 -2
  137. package/authoring/doctypes/hook/parse.mjs +1 -1
  138. package/authoring/doctypes/hook/type.ts +1 -1
  139. package/authoring/doctypes/legacy.d.mts +6 -6
  140. package/authoring/doctypes/legacy.mjs +3 -3
  141. package/authoring/doctypes/load-contract.test.mjs +207 -0
  142. package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
  143. package/authoring/doctypes/namespace/parse.d.mts +2 -2
  144. package/authoring/doctypes/namespace/parse.mjs +1 -1
  145. package/authoring/doctypes/namespace/type.ts +2 -2
  146. package/authoring/doctypes/parse.d.mts +18 -18
  147. package/authoring/doctypes/parse.mjs +9 -9
  148. package/authoring/doctypes/reference/parse.d.mts +2 -2
  149. package/authoring/doctypes/reference/parse.mjs +1 -1
  150. package/authoring/doctypes/reference/reference.doc.mjs +6 -2
  151. package/authoring/doctypes/reference/type.ts +1 -1
  152. package/authoring/doctypes/schema/parse.d.mts +2 -2
  153. package/authoring/doctypes/schema/parse.mjs +1 -1
  154. package/authoring/doctypes/schema/type.ts +2 -2
  155. package/authoring/doctypes/template/parse.d.mts +92 -1
  156. package/authoring/doctypes/template/parse.mjs +33 -1
  157. package/authoring/doctypes/template/template.doc.mjs +4 -0
  158. package/authoring/doctypes/template/type.ts +4 -1
  159. package/authoring/doctypes/types.ts +10 -10
  160. package/authoring/gap-report/parse.d.mts +9 -9
  161. package/authoring/gap-report/parse.mjs +6 -6
  162. package/authoring/gap-report/type.ts +1 -1
  163. package/authoring/identity/identity.doc.mjs +3 -2
  164. package/authoring/identity/type.ts +10 -10
  165. package/authoring/index.d.ts +19 -19
  166. package/authoring/integration/parse.d.mts +2 -2
  167. package/authoring/integration/parse.mjs +1 -1
  168. package/authoring/integration/schema.d.mts +4 -4
  169. package/authoring/integration/schema.mjs +3 -3
  170. package/authoring/integration/type.ts +1 -1
  171. package/clients/cli/command-load-failure.test.mjs +83 -0
  172. package/clients/cli/commands/blog.mjs +23 -8
  173. package/clients/cli/commands/blog.test.mjs +42 -1
  174. package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
  175. package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
  176. package/clients/cli/commands/build-theme.mjs +5 -5
  177. package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
  178. package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
  179. package/clients/cli/commands/build.doc.mjs +4 -1
  180. package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
  181. package/clients/cli/commands/build.mjs +32 -47
  182. package/clients/cli/commands/build.playbook.test.mjs +75 -0
  183. package/clients/cli/commands/build.text-fields.test.mjs +40 -0
  184. package/clients/cli/commands/component/index.mjs +2 -7
  185. package/clients/cli/commands/component-package.test.mjs +18 -0
  186. package/clients/cli/commands/component-resolution.test.mjs +21 -0
  187. package/clients/cli/commands/component.test.mjs +19 -0
  188. package/clients/cli/commands/detail-levels.test.mjs +2 -2
  189. package/clients/cli/commands/discover.broken-integration.test.mjs +48 -0
  190. package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
  191. package/clients/cli/commands/discover.doc.mjs +4 -2
  192. package/clients/cli/commands/discover.mjs +3 -3
  193. package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
  194. package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
  195. package/clients/cli/commands/doctor.mjs +6 -16
  196. package/clients/cli/commands/doctor.test.mjs +42 -0
  197. package/clients/cli/commands/gap-report.doc.mjs +16 -5
  198. package/clients/cli/commands/gap-report.test.mjs +72 -0
  199. package/clients/cli/commands/hook/index.mjs +7 -17
  200. package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
  201. package/clients/cli/commands/init.doc.mjs +19 -8
  202. package/clients/cli/commands/init.flag-help.test.mjs +153 -0
  203. package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
  204. package/clients/cli/commands/integration-add.doc.mjs +21 -5
  205. package/clients/cli/commands/integration-authoring.test.mjs +13 -9
  206. package/clients/cli/commands/interactive-guard.test.mjs +101 -24
  207. package/clients/cli/commands/json-contract.test.mjs +33 -0
  208. package/clients/cli/commands/layout-check.doc.mjs +14 -3
  209. package/clients/cli/commands/layout-expand.doc.mjs +21 -4
  210. package/clients/cli/commands/layout.doc.mjs +2 -2
  211. package/clients/cli/commands/layout.mjs +21 -9
  212. package/clients/cli/commands/layout.path-help.test.mjs +33 -0
  213. package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
  214. package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
  215. package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
  216. package/clients/cli/commands/search.doc.mjs +5 -2
  217. package/clients/cli/commands/search.mjs +13 -2
  218. package/clients/cli/commands/search.test.mjs +61 -0
  219. package/clients/cli/commands/swizzle.doc.mjs +2 -1
  220. package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
  221. package/clients/cli/commands/template.doc.mjs +28 -6
  222. package/clients/cli/commands/template.flag-help.test.mjs +117 -0
  223. package/clients/cli/commands/template.path-help.test.mjs +40 -0
  224. package/clients/cli/commands/theme-add.doc.mjs +2 -1
  225. package/clients/cli/commands/theme-build.doc.mjs +7 -6
  226. package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
  227. package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
  228. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  229. package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
  230. package/clients/cli/commands/upgrade.doc.mjs +17 -6
  231. package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
  232. package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
  233. package/clients/cli/index.mjs +13 -30
  234. package/clients/cli/latest-version-env.test.mjs +50 -0
  235. package/clients/cli/lib/cli-error.test.mjs +7 -0
  236. package/clients/cli/lib/component-format.mjs +9 -9
  237. package/clients/cli/lib/component-format.test.mjs +1 -1
  238. package/clients/cli/lib/define-command.mjs +32 -6
  239. package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
  240. package/clients/cli/lib/exit-codes.test.mjs +97 -0
  241. package/clients/cli/lib/hook-format.mjs +5 -5
  242. package/clients/cli/lib/json-shim.mjs +38 -2
  243. package/clients/cli/lib/json-shim.test.mjs +83 -0
  244. package/clients/cli/lib/manifest.d.ts +2 -0
  245. package/clients/cli/lib/manifest.mjs +22 -0
  246. package/clients/cli/lib/manifest.test.mjs +17 -0
  247. package/foundation/agent-docs/agent-docs.d.mts +4 -0
  248. package/foundation/agent-docs/agent-docs.mjs +69 -3
  249. package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
  250. package/foundation/config/integration-debug.test.mjs +28 -3
  251. package/foundation/config/project.mjs +123 -9
  252. package/foundation/config/project.test.mjs +126 -0
  253. package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
  254. package/foundation/discovery/docs-discovery.d.mts +4 -0
  255. package/foundation/discovery/docs-discovery.mjs +16 -2
  256. package/foundation/discovery/docs-discovery.test.mjs +47 -11
  257. package/foundation/discovery/template-adapter.d.mts +14 -5
  258. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
  259. package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
  260. package/foundation/discovery/template-adapter.mjs +292 -25
  261. package/foundation/discovery/theming-targets.test.mjs +4 -0
  262. package/foundation/doc-compiler/compile.d.mts +162 -0
  263. package/foundation/doc-compiler/compile.mjs +262 -0
  264. package/foundation/doc-compiler/doc-compiler.test.mjs +687 -0
  265. package/foundation/doc-compiler/ir.d.mts +9 -0
  266. package/foundation/doc-compiler/ir.mjs +287 -0
  267. package/foundation/doc-compiler/lenses.d.mts +33 -0
  268. package/foundation/doc-compiler/lenses.mjs +127 -0
  269. package/foundation/fs/module-loader.d.mts +1 -0
  270. package/foundation/fs/module-loader.mjs +50 -1
  271. package/foundation/fs/module-loader.stdout.test.mjs +332 -0
  272. package/foundation/fs/path-safety.d.mts +3 -2
  273. package/foundation/fs/path-safety.mjs +49 -19
  274. package/foundation/fs/path-safety.test.mjs +50 -0
  275. package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
  276. package/foundation/integrations/autolink.mjs +6 -1
  277. package/foundation/response/base.d.ts +8 -4
  278. package/foundation/response/error-codes.doc.mjs +1 -2
  279. package/foundation/response/error-codes.mjs +1 -1
  280. package/foundation/response/error-codes.test.mjs +83 -0
  281. package/foundation/response/json-contract.test.mjs +11 -0
  282. package/foundation/response/json.d.mts +4 -2
  283. package/foundation/response/json.mjs +8 -10
  284. package/foundation/response/response-types.doc.mjs +3 -3
  285. package/foundation/xle/expand.d.mts +2 -0
  286. package/foundation/xle/expand.mjs +3 -2
  287. package/foundation/xle/expand.test.mjs +54 -0
  288. package/package.json +9 -11
  289. package/clients/cli/lib/update-check.mjs +0 -83
  290. package/clients/cli/lib/update-check.test.mjs +0 -137
  291. package/clients/cli/update-hint-commands.test.mjs +0 -54
@@ -567,3 +567,252 @@ describe('pack-check mutation tests', () => {
567
567
  }
568
568
  });
569
569
  });
570
+
571
+ describe('extensionless subpath resolution', () => {
572
+ it('rejects .tsx public specifiers before publishing', async () => {
573
+ // Manually construct a package with OLD-style .tsx exports keys
574
+ writePackage({
575
+ manifest: "export default {components: './components'};\n",
576
+ files: ['astryx.integration.mjs', 'components', 'index.mjs'],
577
+ themes: false,
578
+ });
579
+ const pkgFile = path.join(tmpDir, 'package.json');
580
+ const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));
581
+ pkg.exports = {
582
+ '.': './index.mjs',
583
+ './components/AcmeWidget.tsx': './components/AcmeWidget.tsx',
584
+ };
585
+ fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
586
+ fs.writeFileSync(
587
+ path.join(tmpDir, 'index.mjs'),
588
+ 'export const existing = 1;\n',
589
+ );
590
+ fs.mkdirSync(path.join(tmpDir, 'components'));
591
+ fs.writeFileSync(
592
+ path.join(tmpDir, 'components', 'AcmeWidget.doc.mjs'),
593
+ `export default {type: 'component', name: 'AcmeWidget', import: '@acme/widgets/components/AcmeWidget.tsx', description: 'Widget.', props: []};\n`,
594
+ );
595
+ fs.writeFileSync(
596
+ path.join(tmpDir, 'components', 'AcmeWidget.tsx'),
597
+ 'export function AcmeWidget() { return null; }\n',
598
+ );
599
+
600
+ const result = await integrationPackCheck({cwd: tmpDir});
601
+
602
+ // The .tsx extension in the specifier must be caught
603
+ expect(result.data.packable).toBe(false);
604
+ expect(result.data.issues).toContainEqual(
605
+ expect.objectContaining({
606
+ code: 'typescript_extension_in_specifier',
607
+ message: expect.stringContaining('.tsx'),
608
+ }),
609
+ );
610
+ });
611
+
612
+ it('generated extensionless component specifier resolves through exports map', async () => {
613
+ fs.writeFileSync(
614
+ path.join(tmpDir, 'package.json'),
615
+ `${JSON.stringify({
616
+ name: '@acme/widgets',
617
+ version: '1.0.0',
618
+ files: ['index.mjs'],
619
+ exports: {'.': './index.mjs'},
620
+ })}\n`,
621
+ );
622
+ fs.writeFileSync(
623
+ path.join(tmpDir, 'index.mjs'),
624
+ 'export const existing = 1;\n',
625
+ );
626
+ await integrationAddComponent('AcmeWidget', {cwd: tmpDir});
627
+
628
+ // Verify the exports map has extensionless key → .tsx target
629
+ const pkg = JSON.parse(
630
+ fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
631
+ );
632
+ expect(pkg.exports['./components/AcmeWidget']).toBe(
633
+ './components/AcmeWidget.tsx',
634
+ );
635
+ expect(pkg.exports['./components/AcmeWidget.tsx']).toBeUndefined();
636
+
637
+ const result = await integrationPackCheck({cwd: tmpDir});
638
+
639
+ expect(result.data.packable).toBe(true);
640
+ expect(result.data.issues).not.toContainEqual(
641
+ expect.objectContaining({code: 'typescript_extension_in_specifier'}),
642
+ );
643
+ expect(result.data.issues).not.toContainEqual(
644
+ expect.objectContaining({code: 'component_import_unresolvable'}),
645
+ );
646
+ });
647
+
648
+ it('validates generated imports without project-local TypeScript', async () => {
649
+ fs.rmSync(tmpDir, {recursive: true, force: true});
650
+ tmpDir = fs.mkdtempSync(
651
+ path.join(os.tmpdir(), 'astryx-pack-check-no-typescript-'),
652
+ );
653
+ fs.writeFileSync(
654
+ path.join(tmpDir, 'package.json'),
655
+ `${JSON.stringify({
656
+ name: '@acme/widgets',
657
+ version: '1.0.0',
658
+ files: ['index.mjs'],
659
+ exports: {'.': './index.mjs'},
660
+ })}\n`,
661
+ );
662
+ fs.writeFileSync(
663
+ path.join(tmpDir, 'index.mjs'),
664
+ 'export const existing = 1;\n',
665
+ );
666
+ await integrationAddComponent('AcmeWidget', {cwd: tmpDir});
667
+
668
+ const result = await integrationPackCheck({cwd: tmpDir});
669
+
670
+ expect(result.data.packable).toBe(true);
671
+ expect(result.data.issues).not.toContainEqual(
672
+ expect.objectContaining({code: 'component_import_unresolvable'}),
673
+ );
674
+ });
675
+
676
+ it('generated extensionless template specifiers resolve for page and block types', async () => {
677
+ fs.writeFileSync(
678
+ path.join(tmpDir, 'package.json'),
679
+ `${JSON.stringify({
680
+ name: '@acme/widgets',
681
+ version: '1.0.0',
682
+ files: ['index.mjs'],
683
+ exports: {'.': './index.mjs'},
684
+ })}\n`,
685
+ );
686
+ fs.writeFileSync(
687
+ path.join(tmpDir, 'index.mjs'),
688
+ 'export const existing = 1;\n',
689
+ );
690
+ await integrationAddTemplate('account-page', {cwd: tmpDir, type: 'page'});
691
+ await integrationAddTemplate('info-card', {cwd: tmpDir, type: 'block'});
692
+
693
+ const pkg = JSON.parse(
694
+ fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
695
+ );
696
+ expect(pkg.exports['./templates/account-page']).toBe(
697
+ './templates/account-page.tsx',
698
+ );
699
+ expect(pkg.exports['./templates/info-card']).toBe(
700
+ './templates/info-card.tsx',
701
+ );
702
+
703
+ const result = await integrationPackCheck({cwd: tmpDir});
704
+
705
+ expect(result.data.packable).toBe(true);
706
+ expect(result.data.issues).not.toContainEqual(
707
+ expect.objectContaining({code: 'template_import_unresolvable'}),
708
+ );
709
+ expect(result.data.issues).not.toContainEqual(
710
+ expect.objectContaining({code: 'typescript_extension_in_specifier'}),
711
+ );
712
+ });
713
+
714
+ it('preserves condition-style exports sugar without creating a map', async () => {
715
+ // Package with condition-only exports (sugar, no subpaths)
716
+ fs.writeFileSync(
717
+ path.join(tmpDir, 'package.json'),
718
+ `${JSON.stringify({
719
+ name: '@acme/widgets',
720
+ version: '1.0.0',
721
+ files: ['index.mjs'],
722
+ exports: {import: './index.mjs', require: './index.cjs'},
723
+ })}\n`,
724
+ );
725
+ fs.writeFileSync(
726
+ path.join(tmpDir, 'index.mjs'),
727
+ 'export const existing = 1;\n',
728
+ );
729
+ fs.writeFileSync(path.join(tmpDir, 'index.cjs'), 'exports.existing = 1;\n');
730
+ fs.writeFileSync(
731
+ path.join(tmpDir, 'astryx.integration.mjs'),
732
+ 'export default {};\n',
733
+ );
734
+
735
+ await integrationAddComponent('AcmeWidget', {cwd: tmpDir});
736
+
737
+ const pkg = JSON.parse(
738
+ fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
739
+ );
740
+ // Condition sugar wrapped into subpath map with the component added
741
+ expect(pkg.exports['.']).toEqual({
742
+ import: './index.mjs',
743
+ require: './index.cjs',
744
+ });
745
+ expect(pkg.exports['./components/AcmeWidget']).toBe(
746
+ './components/AcmeWidget.tsx',
747
+ );
748
+ });
749
+
750
+ it('no-map: pack-check fails when generated component has no exports map', async () => {
751
+ fs.writeFileSync(
752
+ path.join(tmpDir, 'package.json'),
753
+ `${JSON.stringify({
754
+ name: '@acme/widgets',
755
+ version: '1.0.0',
756
+ files: ['dist'],
757
+ })}\n`,
758
+ );
759
+ fs.writeFileSync(
760
+ path.join(tmpDir, 'astryx.integration.mjs'),
761
+ 'export default {};\n',
762
+ );
763
+
764
+ await integrationAddComponent('AcmeWidget', {cwd: tmpDir});
765
+ await integrationAddTemplate('hero-page', {cwd: tmpDir, type: 'page'});
766
+
767
+ const pkg = JSON.parse(
768
+ fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
769
+ );
770
+ // No exports map created
771
+ expect(pkg.exports).toBeUndefined();
772
+
773
+ const result = await integrationPackCheck({cwd: tmpDir});
774
+
775
+ // The extensionless import cannot resolve without an exports map —
776
+ // pack-check must fail closed, not false-green.
777
+ expect(result.data.packable).toBe(false);
778
+ expect(result.data.issues).toContainEqual(
779
+ expect.objectContaining({
780
+ severity: 'error',
781
+ message: expect.stringContaining('AcmeWidget'),
782
+ }),
783
+ );
784
+ });
785
+
786
+ it('idempotent when extensionless export already exists', async () => {
787
+ fs.writeFileSync(
788
+ path.join(tmpDir, 'package.json'),
789
+ `${JSON.stringify({
790
+ name: '@acme/widgets',
791
+ version: '1.0.0',
792
+ files: ['index.mjs'],
793
+ exports: {
794
+ '.': './index.mjs',
795
+ './components/AcmeWidget': './components/AcmeWidget.tsx',
796
+ },
797
+ })}\n`,
798
+ );
799
+ fs.writeFileSync(
800
+ path.join(tmpDir, 'index.mjs'),
801
+ 'export const existing = 1;\n',
802
+ );
803
+ fs.writeFileSync(
804
+ path.join(tmpDir, 'astryx.integration.mjs'),
805
+ 'export default {};\n',
806
+ );
807
+
808
+ await integrationAddComponent('AcmeWidget', {cwd: tmpDir});
809
+
810
+ const pkg = JSON.parse(
811
+ fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
812
+ );
813
+ // Export preserved, no duplicate
814
+ expect(
815
+ Object.keys(pkg.exports).filter(k => k.includes('AcmeWidget')),
816
+ ).toEqual(['./components/AcmeWidget']);
817
+ });
818
+ });
@@ -400,8 +400,10 @@ export async function validateLocalIntegration(cwd = process.cwd()) {
400
400
  try {
401
401
  pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
402
402
  } catch (err) {
403
+ // A null name means "no manifest here"; this package has one.
403
404
  return {
404
405
  found: true,
406
+ name: '(local package)',
405
407
  manifestFile: manifests[0],
406
408
  issues: [
407
409
  error(
@@ -13,10 +13,16 @@ import {afterEach, beforeEach, describe, expect, it} from 'vitest';
13
13
  import * as fs from 'node:fs';
14
14
  import * as path from 'node:path';
15
15
  import {
16
+ validateIntegration,
16
17
  validateLocalIntegration,
17
18
  validateInstalledIntegration,
18
19
  summarizeIssues,
19
20
  } from './validate-integration.mjs';
21
+ import {
22
+ integrationComponentConflicts,
23
+ integrationDocConflicts,
24
+ integrationTemplateConflicts,
25
+ } from './authoring-checks.mjs';
20
26
 
21
27
  let tmpDir;
22
28
 
@@ -472,3 +478,88 @@ describe('validate-integration API', () => {
472
478
  expect(byCode(result.issues, 'invalid_package_spec')).toHaveLength(1);
473
479
  });
474
480
  });
481
+
482
+ describe('integration diagnostics are read-only', () => {
483
+ /** Every directory and file under `dir`, with file bytes. */
484
+ function snapshot(dir) {
485
+ /** @type {Record<string, string>} */
486
+ const entries = {};
487
+ /** @param {string} current */
488
+ const walk = current => {
489
+ for (const entry of fs.readdirSync(current, {withFileTypes: true})) {
490
+ const full = path.join(current, entry.name);
491
+ const key = path.relative(dir, full);
492
+ if (entry.isDirectory()) {
493
+ entries[`${key}/`] = '';
494
+ walk(full);
495
+ } else {
496
+ entries[key] = fs.readFileSync(full, 'base64');
497
+ }
498
+ }
499
+ };
500
+ walk(dir);
501
+ return entries;
502
+ }
503
+
504
+ /** A package with valid, broken, conflicting, and unreachable contributions. */
505
+ function writeDiagnosedPackage(dir) {
506
+ writePackage(dir, {
507
+ manifest:
508
+ "export default {\n components: './components',\n templates: './templates',\n docs: './docs',\n codemods: './gone',\n themes: './themes',\n};\n",
509
+ });
510
+ const write = (relative, contents) => {
511
+ fs.mkdirSync(path.dirname(path.join(dir, relative)), {recursive: true});
512
+ fs.writeFileSync(path.join(dir, relative), contents);
513
+ };
514
+ write(
515
+ 'components/Card.doc.mjs',
516
+ "export default {type: 'component', name: 'Card', props: []};\n",
517
+ );
518
+ write('components/Card.tsx', 'export function Card() { return null; }\n');
519
+ write(
520
+ 'components/Orphan.doc.mjs',
521
+ "export default {type: 'component', name: 'Orphan', props: []};\n",
522
+ );
523
+ write('templates/dash.doc.mjs', "export default {type: 'page', name: 'Dash'};\n");
524
+ write(
525
+ 'docs/theme.doc.mjs',
526
+ "export default {type: 'generic', name: 'theme', title: 'Theme', description: 'x', sections: [{title: 'A', content: [{type: 'prose', text: 'x'}]}]};\n",
527
+ );
528
+ write('themes/manifest.json', '{"version": 1, "themes": [{"slug": 7}]}\n');
529
+ write(
530
+ 'stray/Stray.doc.mjs',
531
+ "export default {type: 'component', name: 'Stray', props: []};\n",
532
+ );
533
+ }
534
+
535
+ it('leaves local and installed packages byte-for-byte unchanged', async () => {
536
+ const pkgDir = path.join(tmpDir, 'pkg');
537
+ writeDiagnosedPackage(pkgDir);
538
+ const consumer = path.join(tmpDir, 'consumer');
539
+ fs.mkdirSync(consumer, {recursive: true});
540
+ fs.writeFileSync(
541
+ path.join(consumer, 'package.json'),
542
+ JSON.stringify({name: 'consumer'}),
543
+ );
544
+ writeDiagnosedPackage(path.join(consumer, 'node_modules', '@acme', 'widgets'));
545
+ const before = {pkg: snapshot(pkgDir), consumer: snapshot(consumer)};
546
+
547
+ const local = await validateIntegration(undefined, {cwd: pkgDir});
548
+ const installed = await validateIntegration('@acme/widgets', {
549
+ cwd: consumer,
550
+ });
551
+ for (const [pkg, cwd] of [
552
+ [undefined, pkgDir],
553
+ ['@acme/widgets', consumer],
554
+ ]) {
555
+ await integrationTemplateConflicts(pkg, {cwd});
556
+ await integrationComponentConflicts(pkg, {cwd});
557
+ await integrationDocConflicts(pkg, {cwd});
558
+ }
559
+
560
+ expect(summarizeIssues(local.data.issues).errors).toBeGreaterThan(0);
561
+ expect(byCode(local.data.issues, 'unreachable_contribution')).toHaveLength(1);
562
+ expect(summarizeIssues(installed.data.issues).errors).toBeGreaterThan(0);
563
+ expect({pkg: snapshot(pkgDir), consumer: snapshot(consumer)}).toEqual(before);
564
+ });
565
+ });
@@ -45,7 +45,7 @@ export const doc = {
45
45
  {
46
46
  type: 'integration.validate',
47
47
  description:
48
- 'The result envelope: `data.name` and `data.version` of the validated package (both null when no local manifest is found), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message}.',
48
+ 'The result envelope: `data.name` and `data.version` of the validated package (both null only when no local manifest is found; `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}.',
49
49
  },
50
50
  ],
51
51
  examples: [
@@ -0,0 +1,76 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The published `@astryxdesign/cli/json` envelope types carry
5
+ * `apiVersion`, the field every `--json` envelope has. Type-checks a consumer
6
+ * fixture that reads it from each envelope shape.
7
+ */
8
+
9
+ import {describe, it, expect} from 'vitest';
10
+ import {spawnSync} from 'node:child_process';
11
+ import * as fs from 'node:fs';
12
+ import * as os from 'node:os';
13
+ import * as path from 'node:path';
14
+ import {createRequire} from 'node:module';
15
+ import {fileURLToPath} from 'node:url';
16
+
17
+ const INDEX = fileURLToPath(new URL('./index.ts', import.meta.url));
18
+ const TSC = createRequire(import.meta.url).resolve('typescript/bin/tsc');
19
+
20
+ const FIXTURE = `
21
+ import type {
22
+ assertResponse,
23
+ CLIError,
24
+ CLIUnsupportedError,
25
+ parseResponse,
26
+ } from ${JSON.stringify(INDEX)};
27
+
28
+ declare const error: CLIError;
29
+ declare const unsupported: CLIUnsupportedError;
30
+ declare const parsed: Exclude<ReturnType<typeof parseResponse>, CLIError | CLIUnsupportedError>;
31
+ declare const asserted: ReturnType<typeof assertResponse<'manifest'>>;
32
+
33
+ export const versions: number[] = [
34
+ error.apiVersion,
35
+ unsupported.apiVersion,
36
+ parsed.apiVersion,
37
+ asserted.apiVersion,
38
+ ];
39
+ `;
40
+
41
+ describe('@astryxdesign/cli/json envelope types', () => {
42
+ it('declare apiVersion on the success and error envelopes', () => {
43
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-envelope-types-'));
44
+ try {
45
+ fs.writeFileSync(path.join(dir, 'fixture.ts'), FIXTURE);
46
+ fs.writeFileSync(
47
+ path.join(dir, 'tsconfig.json'),
48
+ JSON.stringify({
49
+ compilerOptions: {
50
+ target: 'ES2022',
51
+ module: 'ESNext',
52
+ moduleResolution: 'bundler',
53
+ strict: true,
54
+ noEmit: true,
55
+ skipLibCheck: true,
56
+ allowImportingTsExtensions: true,
57
+ // index.ts re-exports JSDoc types from .type.mjs files; read them
58
+ // from source, as tsconfig.json-api.json does, not from generated
59
+ // declarations that exist only after a build.
60
+ allowJs: true,
61
+ types: [],
62
+ },
63
+ files: ['fixture.ts'],
64
+ }),
65
+ );
66
+ const res = spawnSync(process.execPath, [TSC, '-p', dir], {
67
+ encoding: 'utf-8',
68
+ timeout: 60_000,
69
+ });
70
+ expect(res.stdout + res.stderr).toBe('');
71
+ expect(res.status).toBe(0);
72
+ } finally {
73
+ fs.rmSync(dir, {recursive: true, force: true});
74
+ }
75
+ });
76
+ });
@@ -16,7 +16,7 @@ export const doc = {
16
16
  description:
17
17
  'The entry point for consuming the CLI as a subprocess. A JSON string is parsed; ' +
18
18
  'an already-parsed object is passed through unchanged, so it is safe to call on ' +
19
- 'either. It returns the structural { type, data, meta? } envelope without narrowing: ' +
19
+ 'either. It returns the structural { apiVersion, type, data, meta? } envelope without narrowing: ' +
20
20
  '`data` stays unknown until you discriminate on `type` (or use assertResponse).',
21
21
  importPath: '@astryxdesign/cli/json',
22
22
  signature: 'parseResponse(raw: unknown): any',
@@ -34,7 +34,7 @@ export const doc = {
34
34
  {
35
35
  type: 'any',
36
36
  description:
37
- 'The { type, data, meta? } envelope, or a CLIError envelope. The published signature is intentionally untyped; narrow it by casting to the matching *Response type exported from @astryxdesign/cli/json.',
37
+ 'The { apiVersion, type, data, meta? } envelope, or a CLIError envelope ({ apiVersion, error, code, suggestions? }). The published signature is intentionally untyped; narrow it by casting to the matching *Response type exported from @astryxdesign/cli/json.',
38
38
  },
39
39
  ],
40
40
  throws: [
@@ -120,18 +120,20 @@ export async function layoutExpand(expression, options = {}) {
120
120
 
121
121
  let written = null;
122
122
  if (targetPath) {
123
- let resolved;
123
+ // The guard sees the file that will be written, not only its directory:
124
+ // a symlink at that name would otherwise carry the write outside the root.
125
+ const fileTarget = isFilePathArg(targetPath)
126
+ ? targetPath
127
+ : path.join(targetPath, `${componentName}.tsx`);
128
+ let filePath;
124
129
  try {
125
- resolved = assertWithin(targetPath, cwd, {label: 'layout target path'});
130
+ filePath = assertWithin(fileTarget, cwd, {label: 'layout target path'});
126
131
  } catch (err) {
127
132
  if (err instanceof PathSafetyError) {
128
133
  throw new AstryxError(err.message, undefined, ERROR_CODES.ERR_PATH_TRAVERSAL);
129
134
  }
130
135
  throw err;
131
136
  }
132
- const filePath = isFilePathArg(targetPath)
133
- ? resolved
134
- : path.join(resolved, `${componentName}.tsx`);
135
137
  fs.mkdirSync(path.dirname(filePath), {recursive: true});
136
138
  fs.writeFileSync(filePath, result.code);
137
139
  written = path.relative(cwd, filePath);
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Path-safety tests for the `layout.expand` write. The file written, not
5
+ * only the directory it lands in, must stay inside the project root.
6
+ */
7
+
8
+ import {describe, it, expect, beforeAll} from 'vitest';
9
+ import * as fs from 'node:fs';
10
+ import * as os from 'node:os';
11
+ import * as path from 'node:path';
12
+ import {layoutExpand} from '../layout.mjs';
13
+ import {buildRegistry} from '../../../foundation/xle/registry.mjs';
14
+
15
+ const SLOW = 30_000;
16
+
17
+ // The registry imports every component doc on first use; warm it once.
18
+ beforeAll(async () => {
19
+ await buildRegistry();
20
+ }, 120_000);
21
+
22
+ describe('layout.expand — write confinement', () => {
23
+ it('rejects a directory target whose generated file is a symlink leading outside cwd', async () => {
24
+ // Inside the workspace so @astryxdesign/core resolves.
25
+ const cwd = fs.mkdtempSync(path.join(process.cwd(), '.xle-confine-test-'));
26
+ const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'xle-confine-outside-'));
27
+ try {
28
+ const victim = path.join(outside, 'victim.tsx');
29
+ fs.writeFileSync(victim, 'OUTSIDE');
30
+ fs.mkdirSync(path.join(cwd, 'out'));
31
+ fs.symlinkSync(victim, path.join(cwd, 'out', 'GeneratedLayout.tsx'));
32
+
33
+ await expect(
34
+ layoutExpand('V > B', {targetPath: './out', cwd}),
35
+ ).rejects.toMatchObject({code: 'ERR_PATH_TRAVERSAL'});
36
+ expect(fs.readFileSync(victim, 'utf-8')).toBe('OUTSIDE');
37
+ } finally {
38
+ fs.rmSync(cwd, {recursive: true, force: true});
39
+ fs.rmSync(outside, {recursive: true, force: true});
40
+ }
41
+ }, SLOW);
42
+
43
+ it('still writes <Name>.tsx into a plain directory target', async () => {
44
+ const cwd = fs.mkdtempSync(path.join(process.cwd(), '.xle-confine-test-'));
45
+ try {
46
+ const result = await layoutExpand('V > B', {targetPath: './out', name: 'Demo', cwd});
47
+ expect(result.data.written).toBe(path.join('out', 'Demo.tsx'));
48
+ expect(fs.existsSync(path.join(cwd, 'out', 'Demo.tsx'))).toBe(true);
49
+ } finally {
50
+ fs.rmSync(cwd, {recursive: true, force: true});
51
+ }
52
+ }, SLOW);
53
+ });
@@ -10,6 +10,7 @@
10
10
  */
11
11
 
12
12
  import {buildRegistry} from '../../../foundation/xle/registry.mjs';
13
+ import {MAX_REPEAT} from '../../../foundation/xle/expand.mjs';
13
14
 
14
15
  /**
15
16
  * `astryx layout grammar` — the agent cheatsheet, with the alias table
@@ -50,7 +51,7 @@ NODE ANATOMY Name#id.enum"payload"[attrs]{hint}*N > children
50
51
  .enum unique enum value of any prop: Bd.success Tx.lg B.primary
51
52
  "payload" primary text prop (label/title/heading) or text child: TI"Email" B"Save"
52
53
  {hint} kebab-case template/component reference (see TEMPLATE REFERENCING) — NEVER text
53
- *N / xN repeat (use $ for the counter: Tk"item-$"*3)
54
+ *N / xN repeat, at most ${MAX_REPEAT} copies (use $ for the counter: Tk"item-$"*3)
54
55
  trailing ! initial selection for scaffolded state: Tab"Overview"!
55
56
 
56
57
  ATTRS [...] (outline: bare tokens after the name, no brackets)
@@ -36,7 +36,7 @@ export const doc = {
36
36
  name: 'options.targetPath',
37
37
  type: 'string',
38
38
  description:
39
- 'Write the generated TSX here (validated to stay within cwd). A directory gets <name>.tsx; a file path is used as-is. Omit to return the code without writing.',
39
+ 'Write the generated TSX here (validated to stay within cwd). A path that ends in .tsx, .ts, .jsx, .js, .mjs, .cjs, .css, .scss, .json, .md or .html is used as-is; any other path is a directory that gets <name>.tsx. An existing file is replaced. Omit to return the code without writing.',
40
40
  },
41
41
  {
42
42
  name: 'options.form',
@@ -0,0 +1,54 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file The declared return type of `search()` is the canonical SearchResponse.
5
+ * Consumers of `@astryxdesign/cli/api` type-check against it; an `object` entry
6
+ * type erases every result field from their view.
7
+ */
8
+
9
+ import {createRequire} from 'node:module';
10
+ import * as path from 'node:path';
11
+ import {fileURLToPath} from 'node:url';
12
+ import {describe, expect, it} from 'vitest';
13
+
14
+ const require = createRequire(import.meta.url);
15
+ const ts = require('typescript');
16
+
17
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
18
+ const SEARCH = path.join(HERE, 'search.mjs');
19
+ const TYPES = path.join(HERE, 'search.type.mjs');
20
+
21
+ describe('search() declared return type', () => {
22
+ it('types each result as the canonical SearchResultEntry', () => {
23
+ const program = ts.createProgram([SEARCH, TYPES], {
24
+ allowJs: true,
25
+ noEmit: true,
26
+ skipLibCheck: true,
27
+ types: [],
28
+ module: ts.ModuleKind.NodeNext,
29
+ moduleResolution: ts.ModuleResolutionKind.NodeNext,
30
+ target: ts.ScriptTarget.ES2022,
31
+ });
32
+ const checker = program.getTypeChecker();
33
+ const source = program.getSourceFile(SEARCH);
34
+ /** @param {string} file @param {string} name */
35
+ const exportOf = (file, name) =>
36
+ checker
37
+ .getExportsOfModule(checker.getSymbolAtLocation(program.getSourceFile(file)))
38
+ .find((/** @type {any} */ s) => s.name === name);
39
+ /** @param {any} type @param {string} name */
40
+ const prop = (type, name) =>
41
+ checker.getTypeOfSymbolAtLocation(type.getProperty(name), source);
42
+ /** @param {any} type */
43
+ const names = type => type.getProperties().map((/** @type {any} */ p) => p.name).sort();
44
+
45
+ const fn = checker.getTypeOfSymbolAtLocation(exportOf(SEARCH, 'search'), source);
46
+ const response = checker.getAwaitedType(fn.getCallSignatures()[0].getReturnType());
47
+ const data = prop(response, 'data');
48
+ expect(names(data)).toEqual(['matchCount', 'query', 'results']);
49
+ const entry = checker.getIndexTypeOfType(prop(data, 'results'), ts.IndexKind.Number);
50
+ const canonical = checker.getDeclaredTypeOfSymbol(exportOf(TYPES, 'SearchResultEntry'));
51
+ expect(names(canonical)).toContain('command');
52
+ expect(names(entry)).toEqual(names(canonical));
53
+ }, 30_000);
54
+ });
@@ -68,20 +68,13 @@ export function scoreCandidate(term: string, { name, keywords, weakKeywords, des
68
68
  * @param {string} [options.cwd]
69
69
  * @param {'component'|'hook'|'doc'|'template'} [options.type] - Restrict to one domain.
70
70
  * @param {number} [options.limit] - Max results (default 20).
71
- * @returns {Promise<{type: 'search', data: {query: string, matchCount: number, results: Array<object>}}>}
71
+ * @returns {Promise<import('./search.type.mjs').SearchResponse>}
72
72
  */
73
73
  export function search(query: string, options?: {
74
74
  cwd?: string | undefined;
75
75
  type?: "component" | "hook" | "doc" | "template" | undefined;
76
76
  limit?: number | undefined;
77
- }): Promise<{
78
- type: "search";
79
- data: {
80
- query: string;
81
- matchCount: number;
82
- results: Array<object>;
83
- };
84
- }>;
77
+ }): Promise<import("./search.type.mjs").SearchResponse>;
85
78
  /** Valid domain filters for `--type`. */
86
79
  export const SEARCH_DOMAINS: string[];
87
80
  /**