@astryxdesign/cli 0.6.3-canary.ea2f048 → 0.6.3-canary.ee13359
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.
- package/README.md +114 -76
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +36 -2
- package/api/build/build.type.mjs +25 -4
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.doc.mjs +13 -3
- package/api/component/component.mjs +91 -14
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +22 -11
- package/api/component/component.type.mjs +32 -24
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +40 -11
- package/api/discover/discover.doc.mjs +2 -1
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +230 -41
- package/api/docs/_adapter.mjs +734 -108
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +22 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +54 -19
- package/api/docs/detail/section/section.test.mjs +50 -0
- package/api/docs/docs.d.mts +10 -3
- package/api/docs/docs.doc.mjs +54 -16
- package/api/docs/docs.mjs +53 -10
- package/api/docs/docs.test.mjs +164 -4
- package/api/docs/docs.type.d.mts +205 -5
- package/api/docs/docs.type.mjs +137 -11
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +40 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/integration-tree.test.mjs +547 -0
- package/api/docs/integrationDocs.test.mjs +114 -8
- package/api/docs/list/list.mjs +28 -12
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/doctor/doctor.d.mts +99 -1
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +544 -1
- package/api/doctor/doctor.test.mjs +610 -1
- package/api/gap-report/gap-report.doc.mjs +8 -4
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +2 -2
- package/api/hook/list/list.mjs +69 -17
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +6 -1
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +130 -15
- package/api/integration/add-contribution.test.mjs +258 -7
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.mjs +108 -31
- package/api/integration/authoring-checks.test.mjs +171 -6
- package/api/integration/authoring-checks.type.d.mts +3 -1
- package/api/integration/authoring-checks.type.mjs +3 -1
- package/api/integration/integration-authoring.type.d.mts +3 -1
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +14 -4
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +2 -1
- package/api/integration/integrationAddDoc.doc.mjs +8 -1
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +2 -1
- package/api/integration/integrationPackCheck.doc.mjs +2 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +7 -5
- package/api/integration/pack-check.mjs +83 -7
- package/api/integration/pack-check.test.mjs +387 -47
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +52 -102
- package/api/integration/validate-integration.test.mjs +179 -26
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +3 -2
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/index.ts +2 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/_adapter.mjs +20 -5
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +2 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +29 -11
- package/api/search/search.doc.mjs +8 -2
- package/api/search/search.mjs +337 -41
- package/api/search/search.test.mjs +124 -1
- package/api/search/search.type.d.mts +15 -3
- package/api/search/search.type.mjs +5 -2
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +2 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/list/list.mjs +1 -0
- package/api/template/template-integration.test.mjs +1022 -3
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +30 -8
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +12 -14
- package/api/template/template.type.mjs +15 -14
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +84 -0
- package/api/theme/add/add.mjs +20 -3
- package/api/theme/add/add.staging.test.mjs +66 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.mjs +133 -42
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/palette/generate/generate.mjs +8 -3
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +15 -4
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +20 -0
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +8 -4
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +6 -2
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +139 -22
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/project-context.test.mjs +272 -0
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +12 -5
- package/api/upgrade/upgrade.type.d.mts +43 -5
- package/api/upgrade/upgrade.type.mjs +27 -11
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +48 -4
- package/assets/codemods/integration-discovery.test.mjs +73 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/docs/README.md +9 -0
- package/assets/docs/authoring.doc.mjs +14 -0
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +3 -3
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +124 -25
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/_shared/contract.ts +22 -0
- package/authoring/codemod/codemod.doc.mjs +7 -2
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +8 -6
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +18 -6
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +8 -8
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +718 -23
- package/authoring/doctypes/_schema.mjs +519 -39
- package/authoring/doctypes/base/graph-fields.doc.d.mts +9 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +64 -0
- package/authoring/doctypes/base/type.ts +41 -0
- package/authoring/doctypes/command/command.doc.mjs +4 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +5 -4
- package/authoring/doctypes/component/component.doc.mjs +6 -3
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +6 -5
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +4 -2
- package/authoring/doctypes/function/function.doc.mjs +7 -2
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +9 -4
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +5 -4
- package/authoring/doctypes/legacy.d.mts +8 -6
- package/authoring/doctypes/legacy.mjs +5 -4
- package/authoring/doctypes/load-contract.test.mjs +208 -0
- package/authoring/doctypes/namespace/namespace.doc.d.mts +9 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +128 -0
- package/authoring/doctypes/namespace/parse.d.mts +12 -0
- package/authoring/doctypes/namespace/parse.mjs +25 -0
- package/authoring/doctypes/namespace/parse.test.mjs +163 -0
- package/authoring/doctypes/namespace/type.ts +74 -0
- package/authoring/doctypes/parse.d.mts +22 -18
- package/authoring/doctypes/parse.mjs +22 -11
- package/authoring/doctypes/parse.test.mjs +77 -3
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +8 -5
- package/authoring/doctypes/reference/reference.doc.mjs +20 -5
- package/authoring/doctypes/reference/type.ts +53 -5
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +4 -4
- package/authoring/doctypes/template/parse.d.mts +94 -1
- package/authoring/doctypes/template/parse.mjs +40 -2
- package/authoring/doctypes/template/parse.test.mjs +26 -2
- package/authoring/doctypes/template/template.doc.mjs +13 -3
- package/authoring/doctypes/template/type.ts +13 -2
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +12 -10
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.d.mts +9 -0
- package/authoring/identity/identity.doc.mjs +61 -0
- package/authoring/identity/type.ts +132 -0
- package/authoring/index.d.mts +2 -0
- package/authoring/index.d.ts +52 -17
- package/authoring/index.mjs +3 -1
- package/authoring/integration/integration.doc.mjs +15 -8
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +10 -1
- package/authoring/integration/schema.d.mts +6 -4
- package/authoring/integration/schema.mjs +9 -3
- package/authoring/integration/type.ts +19 -8
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +16 -50
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +5 -2
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +37 -49
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +3 -8
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/component-package.test.mjs +46 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +52 -5
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +5 -3
- package/clients/cli/commands/discover.mjs +4 -4
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +28 -6
- package/clients/cli/commands/docs.mjs +238 -24
- package/clients/cli/commands/docs.test.mjs +193 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -3
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor-integration.test.mjs +83 -8
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +30 -25
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +17 -6
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +20 -9
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +32 -6
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +15 -4
- package/clients/cli/commands/layout-expand.doc.mjs +22 -5
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +3 -3
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +7 -4
- package/clients/cli/commands/search.mjs +28 -9
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/swizzle.doc.mjs +3 -2
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +52 -13
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/text-json-parity.test.mjs +719 -0
- package/clients/cli/commands/theme-add.doc.mjs +4 -3
- package/clients/cli/commands/theme-build.doc.mjs +8 -7
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +9 -5
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +22 -10
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +164 -1
- package/clients/cli/formatters/index.test.mjs +97 -0
- package/clients/cli/index.mjs +21 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +19 -10
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +36 -2
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +70 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/agent-docs/agent-docs.test.mjs +10 -1
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +20 -11
- package/foundation/config/project.mjs +263 -91
- package/foundation/config/project.test.mjs +270 -21
- package/foundation/discovery/authoring-self-docs.d.mts +75 -0
- package/foundation/discovery/authoring-self-docs.mjs +224 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +165 -0
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +119 -0
- package/foundation/discovery/cli-self-docs.mjs +490 -0
- package/foundation/discovery/cli-self-docs.test.mjs +375 -0
- package/foundation/discovery/component-discovery.d.mts +39 -1
- package/foundation/discovery/component-discovery.mjs +50 -1
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +116 -11
- package/foundation/discovery/docs-discovery.mjs +389 -108
- package/foundation/discovery/docs-discovery.test.mjs +325 -20
- package/foundation/discovery/docs-output-budget.d.mts +28 -0
- package/foundation/discovery/docs-output-budget.mjs +50 -0
- package/foundation/discovery/docs-section-key.d.mts +116 -0
- package/foundation/discovery/docs-section-key.mjs +322 -0
- package/foundation/discovery/docs-section-key.test.mjs +246 -0
- package/foundation/discovery/template-adapter.d.mts +113 -11
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +774 -83
- package/foundation/discovery/template-adapter.test.mjs +57 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +278 -0
- package/foundation/doc-compiler/bundle.test.mjs +266 -0
- package/foundation/doc-compiler/compile.d.mts +343 -0
- package/foundation/doc-compiler/compile.mjs +558 -0
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +305 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +714 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +291 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +22 -0
- package/foundation/doc-compiler/ir.mjs +471 -0
- package/foundation/doc-compiler/lenses.d.mts +34 -0
- package/foundation/doc-compiler/lenses.mjs +128 -0
- package/foundation/doc-compiler/links.d.mts +135 -0
- package/foundation/doc-compiler/links.mjs +253 -0
- package/foundation/doc-compiler/links.test.mjs +139 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +495 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +127 -0
- package/foundation/doc-compiler/read.mjs +325 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/identity/provider-identity.d.mts +90 -0
- package/foundation/identity/provider-identity.mjs +320 -0
- package/foundation/identity/provider-identity.test.mjs +254 -0
- package/foundation/identity/providers.d.mts +7 -0
- package/foundation/identity/providers.mjs +16 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -45
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +109 -0
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +3 -2
- package/foundation/integrations/contribution-inventory.mjs +27 -24
- package/foundation/integrations/contribution-inventory.test.mjs +86 -27
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +52 -21
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/integrations.d.mts +49 -2
- package/foundation/integrations/integrations.mjs +81 -8
- package/foundation/integrations/integrations.test.mjs +384 -1
- package/foundation/integrations/provider-conflicts.test.mjs +125 -0
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +131 -29
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +13 -4
- package/foundation/response/error-codes.mjs +8 -2
- package/foundation/response/error-codes.test.mjs +137 -10
- package/foundation/response/json-contract.test.mjs +57 -17
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +26 -16
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +4 -3
- package/foundation/xle/expand.test.mjs +54 -0
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +10 -11
- package/assets/templates/themes/manifest.json +0 -95
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
package/api/search/search.mjs
CHANGED
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
* queries they have nothing to do with.
|
|
51
51
|
*/
|
|
52
52
|
|
|
53
|
-
import {
|
|
53
|
+
import {readDocView} from '../../foundation/doc-compiler/read.mjs';
|
|
54
54
|
import {findCoreDir} from '../../foundation/fs/paths.mjs';
|
|
55
55
|
import {
|
|
56
56
|
discoverComponents,
|
|
57
|
-
|
|
57
|
+
discoverValidIntegrationComponents,
|
|
58
58
|
findComponentReadme,
|
|
59
59
|
resolveImportPath,
|
|
60
60
|
resolveIntegrationImportPath,
|
|
@@ -66,7 +66,20 @@ import {
|
|
|
66
66
|
import {loadIntegrationsSafely} from '../component/_adapter.mjs';
|
|
67
67
|
import {levenshteinDistance} from '../../foundation/text/string-utils.mjs';
|
|
68
68
|
import {discoverTemplates, extractComponents} from '../template/template.mjs';
|
|
69
|
-
import {
|
|
69
|
+
import {templateLookupIds} from '../../foundation/discovery/template-adapter.mjs';
|
|
70
|
+
import {
|
|
71
|
+
guideEntry,
|
|
72
|
+
loadDocsCatalog,
|
|
73
|
+
lowerTopic,
|
|
74
|
+
projectTree,
|
|
75
|
+
holdsOwnName,
|
|
76
|
+
} from '../docs/_adapter.mjs';
|
|
77
|
+
import {unlinkText} from '../../foundation/doc-compiler/links.mjs';
|
|
78
|
+
import {nodeView} from '../docs/node/node.mjs';
|
|
79
|
+
import {
|
|
80
|
+
sectionKey,
|
|
81
|
+
sectionSummary,
|
|
82
|
+
} from '../../foundation/discovery/docs-section-key.mjs';
|
|
70
83
|
import {AstryxError} from '../error.mjs';
|
|
71
84
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
72
85
|
import {setResultCoverage} from './coverage.mjs';
|
|
@@ -84,8 +97,18 @@ import {setResultCoverage} from './coverage.mjs';
|
|
|
84
97
|
* @property {string[]} [guidance]
|
|
85
98
|
* @property {string} [_import]
|
|
86
99
|
* @property {string} [_title]
|
|
100
|
+
* @property {string} [_topic] - A doc result's topic or docs-tree route.
|
|
101
|
+
* @property {string} [_section] - A doc result's section key, when it is one section.
|
|
102
|
+
* @property {string} [_command] - The command that reads exactly this doc part.
|
|
103
|
+
* @property {string} [_parent] - The command that opens the level above a doc
|
|
104
|
+
* part: its topic's section list, or the docs-tree namespace it sits in.
|
|
105
|
+
* @property {string} [_package] - The npm package that authored a docs-tree
|
|
106
|
+
* doc part. Flat topics carry none: an extension's sections can come from
|
|
107
|
+
* another package.
|
|
87
108
|
* @property {string} [_displayName]
|
|
88
109
|
* @property {'page'|'block'} [_kind]
|
|
110
|
+
* @property {string} [_resultName]
|
|
111
|
+
* @property {string} [_commandName]
|
|
89
112
|
*/
|
|
90
113
|
|
|
91
114
|
/**
|
|
@@ -528,16 +551,26 @@ export function scoreCandidate(
|
|
|
528
551
|
}
|
|
529
552
|
|
|
530
553
|
/**
|
|
531
|
-
*
|
|
554
|
+
* A component or hook doc, compiled, or null when it cannot be read.
|
|
532
555
|
* @param {string} docPath
|
|
533
556
|
* @param {string} [exportName]
|
|
557
|
+
* @param {'components' | 'hooks'} [root]
|
|
534
558
|
* @returns {Promise<any>}
|
|
535
559
|
*/
|
|
536
|
-
async function loadModuleDoc(
|
|
560
|
+
async function loadModuleDoc(
|
|
561
|
+
docPath,
|
|
562
|
+
exportName = 'docs',
|
|
563
|
+
root = 'components',
|
|
564
|
+
) {
|
|
537
565
|
try {
|
|
538
|
-
const mod = await import(pathToFileURL(docPath).href);
|
|
539
566
|
// Support both the stamped default export and the legacy named export.
|
|
540
|
-
return
|
|
567
|
+
return (
|
|
568
|
+
(await readDocView(docPath, {
|
|
569
|
+
root,
|
|
570
|
+
loader: 'native',
|
|
571
|
+
exports: ['default', exportName],
|
|
572
|
+
})) ?? null
|
|
573
|
+
);
|
|
541
574
|
} catch {
|
|
542
575
|
return null;
|
|
543
576
|
}
|
|
@@ -637,7 +670,8 @@ async function gatherIntegrationComponents(cwd) {
|
|
|
637
670
|
/** @type {Candidate[]} */
|
|
638
671
|
const candidates = [];
|
|
639
672
|
for (const integration of loadedIntegrations) {
|
|
640
|
-
|
|
673
|
+
const {components} = await discoverValidIntegrationComponents(integration);
|
|
674
|
+
for (const rec of components) {
|
|
641
675
|
const doc = await loadModuleDoc(rec.docPath);
|
|
642
676
|
candidates.push({
|
|
643
677
|
domain: 'component',
|
|
@@ -701,7 +735,7 @@ async function gatherHooks(coreDir) {
|
|
|
701
735
|
let description = '';
|
|
702
736
|
let importPath = '@astryxdesign/core/hooks';
|
|
703
737
|
if (docPath) {
|
|
704
|
-
const doc = await loadModuleDoc(docPath);
|
|
738
|
+
const doc = await loadModuleDoc(docPath, 'docs', 'hooks');
|
|
705
739
|
if (doc) {
|
|
706
740
|
keywords = Array.isArray(doc.keywords) ? doc.keywords : [];
|
|
707
741
|
description = doc.usage?.description || doc.description || '';
|
|
@@ -720,7 +754,11 @@ async function gatherHooks(coreDir) {
|
|
|
720
754
|
}
|
|
721
755
|
|
|
722
756
|
/**
|
|
723
|
-
* Build doc
|
|
757
|
+
* Build doc candidates at the grain a reader reads them: each section of a
|
|
758
|
+
* topic, whose command reads just that section; each topic as a whole, whose
|
|
759
|
+
* command lists its sections; and each docs-tree node by its route. The tree's
|
|
760
|
+
* guides split into sections like topics, and its typed docs also match by
|
|
761
|
+
* their own name, so `assertResponse` finds `cli/api/functions/assert-response`.
|
|
724
762
|
*
|
|
725
763
|
* Reads the project's catalog rather than the CLI's own docs directory, so a
|
|
726
764
|
* topic an integration contributed (or replaced) is searchable exactly like a
|
|
@@ -732,44 +770,274 @@ async function gatherHooks(coreDir) {
|
|
|
732
770
|
async function gatherDocs(cwd) {
|
|
733
771
|
/** @type {Candidate[]} */
|
|
734
772
|
const candidates = [];
|
|
735
|
-
let
|
|
773
|
+
let catalog;
|
|
736
774
|
try {
|
|
737
|
-
|
|
775
|
+
catalog = await loadDocsCatalog(cwd);
|
|
738
776
|
} catch {
|
|
739
777
|
return candidates;
|
|
740
778
|
}
|
|
741
|
-
|
|
742
|
-
|
|
779
|
+
let tree = null;
|
|
780
|
+
try {
|
|
781
|
+
tree = await projectTree(catalog);
|
|
782
|
+
} catch {
|
|
783
|
+
// `astryx doctor` reports a tree that fails to build; search still
|
|
784
|
+
// indexes the topics.
|
|
785
|
+
}
|
|
786
|
+
for (const entry of catalog.entries()) {
|
|
787
|
+
// A topic whose name opens another doc (spec:AST-046 FR11) is not
|
|
788
|
+
// offered: every hit's command must open the hit.
|
|
789
|
+
if (tree && !holdsOwnName(tree, catalog, entry)) continue;
|
|
790
|
+
let lowered = null;
|
|
743
791
|
try {
|
|
744
|
-
|
|
792
|
+
lowered = await lowerTopic(catalog, entry);
|
|
745
793
|
} catch {
|
|
746
794
|
// A topic that cannot be loaded is reported by the commands that own
|
|
747
795
|
// integration issues; search just cannot index it.
|
|
748
796
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
797
|
+
const doc = lowered?.doc ?? null;
|
|
798
|
+
// A flat topic lives in the Unorganized level; its hits say so, and name
|
|
799
|
+
// the package each section came from.
|
|
800
|
+
const home = tree?.get(entry.name);
|
|
801
|
+
const placed = home?.ref?.flatTopic === entry.name ? home : null;
|
|
802
|
+
/** @type {Map<string, string>} */
|
|
803
|
+
const packages = new Map([
|
|
804
|
+
[entry.providerId ?? entry.package, entry.package],
|
|
805
|
+
...entry.extensions.map(
|
|
806
|
+
ext => /** @type {[string, string]} */ ([ext.providerId ?? ext.package, ext.package]),
|
|
807
|
+
),
|
|
808
|
+
]);
|
|
809
|
+
candidates.push(
|
|
810
|
+
...topicCandidates(
|
|
811
|
+
entry.name,
|
|
812
|
+
doc,
|
|
813
|
+
entry.title,
|
|
814
|
+
'',
|
|
815
|
+
placed && tree
|
|
816
|
+
? [
|
|
817
|
+
...tree.ancestors(placed).map(a => a.title),
|
|
818
|
+
doc?.title || entry.title || entry.name,
|
|
819
|
+
].join(' › ')
|
|
820
|
+
: undefined,
|
|
821
|
+
placed ? `astryx docs ${placed.parent}` : undefined,
|
|
822
|
+
entry.package,
|
|
823
|
+
key =>
|
|
824
|
+
packages.get(lowered?.sectionProviders?.[key] ?? '') ?? entry.package,
|
|
825
|
+
),
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
if (tree == null) return candidates;
|
|
829
|
+
for (const node of tree.nodes.values()) {
|
|
830
|
+
// A flat topic is indexed above, as a topic.
|
|
831
|
+
if (node.ref?.flatTopic) continue;
|
|
832
|
+
// A tree hit names where it lives: its ancestors' titles, then its own.
|
|
833
|
+
const path = [...tree.ancestors(node).map(a => a.title), node.title];
|
|
834
|
+
if (node.kind === 'generic') {
|
|
835
|
+
let doc = null;
|
|
836
|
+
try {
|
|
837
|
+
doc = (await lowerTopic(catalog, guideEntry(node))).doc;
|
|
838
|
+
} catch {
|
|
839
|
+
// As above: the owning commands report it.
|
|
759
840
|
}
|
|
841
|
+
candidates.push(
|
|
842
|
+
...topicCandidates(
|
|
843
|
+
node.route,
|
|
844
|
+
doc,
|
|
845
|
+
node.title,
|
|
846
|
+
node.summary,
|
|
847
|
+
path.join(' › '),
|
|
848
|
+
node.parent == null ? undefined : `astryx docs ${node.parent}`,
|
|
849
|
+
node.provider,
|
|
850
|
+
),
|
|
851
|
+
);
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
const selfDoc = /** @type {any} */ (node.ref)?.selfDoc;
|
|
855
|
+
// A typed doc's content is what `astryx docs <route>` prints. The first
|
|
856
|
+
// column of its tables names what the doc defines (an error code, an
|
|
857
|
+
// option, a parameter), so each is a keyword the doc answers to.
|
|
858
|
+
/** @type {any[]} */
|
|
859
|
+
const content = (await nodeView(catalog, tree, node)).content ?? [];
|
|
860
|
+
/** @type {string[]} */
|
|
861
|
+
const defined = [];
|
|
862
|
+
for (const block of content) {
|
|
863
|
+
if (block.type !== 'table' || !Array.isArray(block.rows)) continue;
|
|
864
|
+
for (const row of block.rows)
|
|
865
|
+
if (row[0] != null) defined.push(plain(row[0]));
|
|
760
866
|
}
|
|
761
867
|
candidates.push({
|
|
762
868
|
domain: 'doc',
|
|
763
|
-
name:
|
|
764
|
-
keywords: [
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
869
|
+
name: node.name,
|
|
870
|
+
keywords: [
|
|
871
|
+
node.route.slice(node.route.lastIndexOf('/') + 1),
|
|
872
|
+
...(Array.isArray(selfDoc?.keywords) ? selfDoc.keywords : []),
|
|
873
|
+
...defined,
|
|
874
|
+
...codeTerms({content}),
|
|
875
|
+
],
|
|
876
|
+
description: node.summary || '',
|
|
877
|
+
prose: sectionProse({title: node.title, content}),
|
|
878
|
+
_topic: node.route,
|
|
879
|
+
_title: path.join(' › '),
|
|
880
|
+
_command: `astryx docs ${node.route}`,
|
|
881
|
+
_parent: node.parent == null ? 'astryx docs' : `astryx docs ${node.parent}`,
|
|
882
|
+
_package: node.provider,
|
|
768
883
|
});
|
|
769
884
|
}
|
|
770
885
|
return candidates;
|
|
771
886
|
}
|
|
772
887
|
|
|
888
|
+
/**
|
|
889
|
+
* The words one section says: its prose, headings, and list items.
|
|
890
|
+
* @param {any} section
|
|
891
|
+
* @returns {string[]}
|
|
892
|
+
*/
|
|
893
|
+
function sectionProse(section) {
|
|
894
|
+
/** @type {string[]} */
|
|
895
|
+
const prose = [];
|
|
896
|
+
if (section?.title) prose.push(section.title);
|
|
897
|
+
for (const block of section?.content || []) {
|
|
898
|
+
if ((block.type === 'prose' || block.type === 'heading') && block.text) {
|
|
899
|
+
prose.push(block.text);
|
|
900
|
+
} else if (block.type === 'list' && Array.isArray(block.items)) {
|
|
901
|
+
for (const item of block.items) {
|
|
902
|
+
const text = typeof item === 'string' ? item : item?.text;
|
|
903
|
+
if (typeof text === 'string') prose.push(text);
|
|
904
|
+
}
|
|
905
|
+
} else if (block.type === 'table' && Array.isArray(block.rows)) {
|
|
906
|
+
for (const row of block.rows) prose.push(row.map(plain).join(' '));
|
|
907
|
+
} else if (block.type === 'code' && typeof block.code === 'string') {
|
|
908
|
+
prose.push([block.label, block.code].filter(Boolean).join(' '));
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return prose;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* The identifiers a doc part names in code ticks (`token-ref`,
|
|
916
|
+
* `ERR_UNKNOWN_SECTION`). Each is a keyword: a reader who types one exactly
|
|
917
|
+
* wants the part that defines or explains it.
|
|
918
|
+
* @param {any} part - a section, or `{content}` of a typed doc
|
|
919
|
+
* @returns {string[]}
|
|
920
|
+
*/
|
|
921
|
+
function codeTerms(part) {
|
|
922
|
+
/** @type {Set<string>} */
|
|
923
|
+
const terms = new Set();
|
|
924
|
+
/** @param {unknown} text */
|
|
925
|
+
const scan = text => {
|
|
926
|
+
for (const m of String(text ?? '').matchAll(/`([^`\s]{2,40})`/g)) {
|
|
927
|
+
terms.add(m[1]);
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
for (const block of part?.content || []) {
|
|
931
|
+
if (block.type === 'prose') scan(block.text);
|
|
932
|
+
else if (block.type === 'list' && Array.isArray(block.items)) {
|
|
933
|
+
for (const item of block.items) {
|
|
934
|
+
scan(typeof item === 'string' ? item : item?.text);
|
|
935
|
+
}
|
|
936
|
+
} else if (block.type === 'table' && Array.isArray(block.rows)) {
|
|
937
|
+
for (const row of block.rows) for (const cell of row) scan(cell);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return [...terms];
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* The headings inside a section. Each names a subsection, so a query that
|
|
945
|
+
* names one should find the section as surely as one that names its title.
|
|
946
|
+
* @param {any} section
|
|
947
|
+
* @returns {string[]}
|
|
948
|
+
*/
|
|
949
|
+
function headings(section) {
|
|
950
|
+
return (section?.content || [])
|
|
951
|
+
.filter(
|
|
952
|
+
(/** @type {any} */ block) => block.type === 'heading' && block.text,
|
|
953
|
+
)
|
|
954
|
+
.map((/** @type {any} */ block) => String(block.text));
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* A table cell as plain words, without its code ticks.
|
|
959
|
+
* @param {unknown} cell
|
|
960
|
+
* @returns {string}
|
|
961
|
+
*/
|
|
962
|
+
function plain(cell) {
|
|
963
|
+
return unlinkText(String(cell ?? '')).replaceAll('`', '');
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* The candidates one topic yields: the topic itself, and one per section when
|
|
968
|
+
* it has more than one. A topic's command lists its sections, and a section's
|
|
969
|
+
* command reads only that section, so a hit never costs a whole-topic read.
|
|
970
|
+
* @param {string} name - the topic name, or a placed guide's route
|
|
971
|
+
* @param {any} doc - the lowered topic, or null when it did not load
|
|
972
|
+
* @param {string} [title]
|
|
973
|
+
* @param {string} [summary]
|
|
974
|
+
* @param {string} [path] - where the topic lives in the docs tree, as titles
|
|
975
|
+
* joined by ` › `; a flat topic is its own title
|
|
976
|
+
* @param {string} [parent] - the command that opens the level above the
|
|
977
|
+
* topic: its namespace, or the Unorganized level for a flat topic
|
|
978
|
+
* @param {string} [pkg] - the npm package that authored the topic
|
|
979
|
+
* @param {(key: string) => string} [sectionPackage] - the npm package a
|
|
980
|
+
* section came from: an extension's section names the extension's package
|
|
981
|
+
* @returns {Candidate[]}
|
|
982
|
+
*/
|
|
983
|
+
function topicCandidates(
|
|
984
|
+
name,
|
|
985
|
+
doc,
|
|
986
|
+
title,
|
|
987
|
+
summary = '',
|
|
988
|
+
path,
|
|
989
|
+
parent,
|
|
990
|
+
pkg,
|
|
991
|
+
sectionPackage,
|
|
992
|
+
) {
|
|
993
|
+
/** @type {any[]} */
|
|
994
|
+
const sections = doc?.sections ?? [];
|
|
995
|
+
const docTitle = path || doc?.title || title || name;
|
|
996
|
+
const split = sections.length > 1;
|
|
997
|
+
/** @type {Candidate[]} */
|
|
998
|
+
const out = [
|
|
999
|
+
{
|
|
1000
|
+
domain: 'doc',
|
|
1001
|
+
name,
|
|
1002
|
+
keywords: [
|
|
1003
|
+
...(doc?.title || title ? [doc?.title || title] : []),
|
|
1004
|
+
...(Array.isArray(doc?.keywords) ? doc.keywords : []),
|
|
1005
|
+
],
|
|
1006
|
+
description: doc?.description || summary,
|
|
1007
|
+
prose: split
|
|
1008
|
+
? sections.map(section => section.title).filter(Boolean)
|
|
1009
|
+
: sections.flatMap(sectionProse),
|
|
1010
|
+
_topic: name,
|
|
1011
|
+
_title: docTitle,
|
|
1012
|
+
_command: split ? `astryx docs ${name} --index` : `astryx docs ${name}`,
|
|
1013
|
+
...(parent ? {_parent: parent} : {}),
|
|
1014
|
+
...(pkg ? {_package: pkg} : {}),
|
|
1015
|
+
},
|
|
1016
|
+
];
|
|
1017
|
+
if (!split) return out;
|
|
1018
|
+
for (const section of sections) {
|
|
1019
|
+
const key = sectionKey(section);
|
|
1020
|
+
out.push({
|
|
1021
|
+
domain: 'doc',
|
|
1022
|
+
name: key,
|
|
1023
|
+
keywords: [
|
|
1024
|
+
...(section.title ? [section.title] : []),
|
|
1025
|
+
...headings(section),
|
|
1026
|
+
...codeTerms(section),
|
|
1027
|
+
],
|
|
1028
|
+
description: sectionSummary(section),
|
|
1029
|
+
prose: sectionProse(section),
|
|
1030
|
+
_topic: name,
|
|
1031
|
+
_section: key,
|
|
1032
|
+
_title: `${docTitle} › ${section.title}`,
|
|
1033
|
+
_command: `astryx docs ${name} ${key}`,
|
|
1034
|
+
_parent: `astryx docs ${name} --index`,
|
|
1035
|
+
...((sectionPackage?.(key) ?? pkg) ? {_package: sectionPackage?.(key) ?? pkg} : {}),
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
return out;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
773
1041
|
/**
|
|
774
1042
|
* Build template candidates (page + block) from the template discovery API.
|
|
775
1043
|
* @param {string} cwd
|
|
@@ -783,6 +1051,13 @@ async function gatherTemplates(cwd) {
|
|
|
783
1051
|
return [];
|
|
784
1052
|
}
|
|
785
1053
|
return templates.map(t => {
|
|
1054
|
+
// A replacement's target is its canonical unqualified lookup id. Keep the
|
|
1055
|
+
// integration-owned id as a keyword and response label, but score and print
|
|
1056
|
+
// commands against the id that `template()` resolves back to this entry.
|
|
1057
|
+
// This matters for replacement chains: one replacement's own id can be the
|
|
1058
|
+
// target of another, so using that shadowed id as the command would select
|
|
1059
|
+
// the other template.
|
|
1060
|
+
const commandName = t.replaces ?? t.dirName;
|
|
786
1061
|
// Blocks ship an authored componentsUsed; page templates don't, so derive
|
|
787
1062
|
// them from the source. Category words (e.g. "Dashboard - Analytics") are
|
|
788
1063
|
// strong intent signal for pages, which otherwise only index on name +
|
|
@@ -795,6 +1070,7 @@ async function gatherTemplates(cwd) {
|
|
|
795
1070
|
const keywords = Array.isArray(t.componentsUsed)
|
|
796
1071
|
? [...t.componentsUsed]
|
|
797
1072
|
: [];
|
|
1073
|
+
keywords.push(...templateLookupIds(t).filter(id => id !== commandName));
|
|
798
1074
|
/** @type {string[]} */
|
|
799
1075
|
let weakKeywords = [];
|
|
800
1076
|
if (t.type === 'page') {
|
|
@@ -810,12 +1086,14 @@ async function gatherTemplates(cwd) {
|
|
|
810
1086
|
}
|
|
811
1087
|
return {
|
|
812
1088
|
domain: 'template',
|
|
813
|
-
name:
|
|
1089
|
+
name: commandName,
|
|
814
1090
|
keywords,
|
|
815
1091
|
weakKeywords,
|
|
816
1092
|
description: t.description || '',
|
|
817
1093
|
_displayName: t.name,
|
|
818
1094
|
_kind: t.type, // 'page' | 'block'
|
|
1095
|
+
_resultName: t.dirName,
|
|
1096
|
+
_commandName: commandName,
|
|
819
1097
|
};
|
|
820
1098
|
});
|
|
821
1099
|
}
|
|
@@ -834,7 +1112,7 @@ async function gatherTemplates(cwd) {
|
|
|
834
1112
|
function toResult(c, score, reason, matchedTerms, queryTerms) {
|
|
835
1113
|
const base = {
|
|
836
1114
|
domain: c.domain,
|
|
837
|
-
name: c.name,
|
|
1115
|
+
name: c._resultName ?? c.name,
|
|
838
1116
|
score,
|
|
839
1117
|
reason,
|
|
840
1118
|
description: c.description || '',
|
|
@@ -856,10 +1134,16 @@ function toResult(c, score, reason, matchedTerms, queryTerms) {
|
|
|
856
1134
|
};
|
|
857
1135
|
break;
|
|
858
1136
|
case 'doc':
|
|
1137
|
+
// A doc result names its topic or route, plus the section when the
|
|
1138
|
+
// hit is one section; its command reads exactly that part.
|
|
859
1139
|
result = {
|
|
860
1140
|
...base,
|
|
1141
|
+
name: c._topic ?? c.name,
|
|
1142
|
+
...(c._section ? {section: c._section} : {}),
|
|
861
1143
|
title: c._title,
|
|
862
|
-
command: `astryx docs ${c.name}`,
|
|
1144
|
+
command: c._command ?? `astryx docs ${c.name}`,
|
|
1145
|
+
...(c._parent ? {parent: c._parent} : {}),
|
|
1146
|
+
...(c._package ? {package: c._package} : {}),
|
|
863
1147
|
};
|
|
864
1148
|
break;
|
|
865
1149
|
case 'template':
|
|
@@ -867,7 +1151,7 @@ function toResult(c, score, reason, matchedTerms, queryTerms) {
|
|
|
867
1151
|
...base,
|
|
868
1152
|
displayName: c._displayName,
|
|
869
1153
|
kind: c._kind,
|
|
870
|
-
command: `astryx template ${c.name}`,
|
|
1154
|
+
command: `astryx template ${c._commandName ?? c.name} --type ${c._kind}`,
|
|
871
1155
|
};
|
|
872
1156
|
break;
|
|
873
1157
|
default:
|
|
@@ -884,7 +1168,7 @@ function toResult(c, score, reason, matchedTerms, queryTerms) {
|
|
|
884
1168
|
* @param {string} [options.cwd]
|
|
885
1169
|
* @param {'component'|'hook'|'doc'|'template'} [options.type] - Restrict to one domain.
|
|
886
1170
|
* @param {number} [options.limit] - Max results (default 20).
|
|
887
|
-
* @returns {Promise<
|
|
1171
|
+
* @returns {Promise<import('./search.type.mjs').SearchResponse>}
|
|
888
1172
|
*/
|
|
889
1173
|
export async function search(query, options = {}) {
|
|
890
1174
|
const {cwd = process.cwd(), type, limit = 20} = options;
|
|
@@ -919,17 +1203,26 @@ export async function search(query, options = {}) {
|
|
|
919
1203
|
const term = String(query).trim().toLowerCase();
|
|
920
1204
|
const tokens = tokenizeQuery(term);
|
|
921
1205
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1206
|
+
// `astryx docs` reads docs without @astryxdesign/core, so a docs-only
|
|
1207
|
+
// search must too. Every other domain reads core.
|
|
1208
|
+
const docsOnly = type === 'doc';
|
|
1209
|
+
const coreDir = docsOnly ? null : findCoreDir(cwd);
|
|
1210
|
+
if (!docsOnly && !coreDir) {
|
|
1211
|
+
throw new AstryxError(
|
|
1212
|
+
'Could not find @astryxdesign/core package',
|
|
1213
|
+
undefined,
|
|
1214
|
+
ERROR_CODES.ERR_CORE_NOT_FOUND,
|
|
1215
|
+
);
|
|
925
1216
|
}
|
|
926
1217
|
|
|
927
1218
|
// Gather candidates from each requested domain in parallel.
|
|
928
1219
|
/** @param {string} d */
|
|
929
1220
|
const wants = d => !type || type === d;
|
|
930
1221
|
const [components, hooks, docTopics, templates] = await Promise.all([
|
|
931
|
-
wants('component')
|
|
932
|
-
|
|
1222
|
+
wants('component')
|
|
1223
|
+
? gatherComponents(/** @type {string} */ (coreDir), cwd)
|
|
1224
|
+
: [],
|
|
1225
|
+
wants('hook') ? gatherHooks(/** @type {string} */ (coreDir)) : [],
|
|
933
1226
|
wants('doc') ? gatherDocs(cwd) : [],
|
|
934
1227
|
wants('template') ? gatherTemplates(cwd) : [],
|
|
935
1228
|
]);
|
|
@@ -971,7 +1264,10 @@ export async function search(query, options = {}) {
|
|
|
971
1264
|
data: {
|
|
972
1265
|
query: String(query).trim(),
|
|
973
1266
|
matchCount: scored.length,
|
|
974
|
-
|
|
1267
|
+
// toResult gives every domain its command and domain fields.
|
|
1268
|
+
results: /** @type {import('./search.type.mjs').SearchResultEntry[]} */ (
|
|
1269
|
+
limited
|
|
1270
|
+
),
|
|
975
1271
|
},
|
|
976
1272
|
};
|
|
977
1273
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
import {describe, it, expect} from 'vitest';
|
|
23
23
|
import * as fs from 'node:fs';
|
|
24
|
+
import * as os from 'node:os';
|
|
24
25
|
import * as path from 'node:path';
|
|
25
26
|
import {fileURLToPath} from 'node:url';
|
|
26
27
|
import {
|
|
@@ -70,6 +71,111 @@ describe('search leaf — envelope + ranking', () => {
|
|
|
70
71
|
}, SLOW);
|
|
71
72
|
});
|
|
72
73
|
|
|
74
|
+
describe('search leaf — per-domain result fields', () => {
|
|
75
|
+
it('carries import for components and hooks, title for docs, displayName and kind for templates', async () => {
|
|
76
|
+
const r = await search('theme', {cwd, limit: 60});
|
|
77
|
+
expect(new Set(r.data.results.map(res => res.domain))).toEqual(
|
|
78
|
+
new Set(SEARCH_DOMAINS),
|
|
79
|
+
);
|
|
80
|
+
for (const res of r.data.results) {
|
|
81
|
+
expect(typeof res.command).toBe('string');
|
|
82
|
+
expect(typeof res.description).toBe('string');
|
|
83
|
+
if (res.domain === 'component' || res.domain === 'hook') {
|
|
84
|
+
expect(res.import).toMatch(/\S/);
|
|
85
|
+
} else if (res.domain === 'doc') {
|
|
86
|
+
expect(res.title).toMatch(/\S/);
|
|
87
|
+
const read = `astryx docs ${res.name}`;
|
|
88
|
+
expect([read, `${read} --index`, `${read} ${res.section}`]).toContain(res.command);
|
|
89
|
+
} else {
|
|
90
|
+
expect(res.displayName).toMatch(/\S/);
|
|
91
|
+
expect(['page', 'block']).toContain(res.kind);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, SLOW);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('search leaf — docs at the grain a reader reads them', () => {
|
|
98
|
+
it(
|
|
99
|
+
'finds one section of a guide, and a docs-tree leaf by its own name',
|
|
100
|
+
async () => {
|
|
101
|
+
const guide = await search('codemod protected files', {cwd, type: 'doc'});
|
|
102
|
+
expect(guide.data.results.slice(0, 3)).toContainEqual(
|
|
103
|
+
expect.objectContaining({
|
|
104
|
+
domain: 'doc',
|
|
105
|
+
name: 'cli/integrations',
|
|
106
|
+
section: 'codemods',
|
|
107
|
+
title: 'Astryx CLI › CLI Integrations › Codemods',
|
|
108
|
+
parent: 'astryx docs cli/integrations --index',
|
|
109
|
+
command: 'astryx docs cli/integrations codemods',
|
|
110
|
+
}),
|
|
111
|
+
);
|
|
112
|
+
const block = await search('token-ref', {cwd});
|
|
113
|
+
expect(block.data.results[0]).toMatchObject({
|
|
114
|
+
name: 'authoring',
|
|
115
|
+
section: 'reference-doc',
|
|
116
|
+
command: 'astryx docs authoring reference-doc',
|
|
117
|
+
});
|
|
118
|
+
const fn = await search('assertResponse', {cwd, type: 'doc'});
|
|
119
|
+
expect(fn.data.results[0]).toMatchObject({
|
|
120
|
+
name: 'cli/api/functions/assert-response',
|
|
121
|
+
title: 'Astryx CLI › API › Functions › assertResponse()',
|
|
122
|
+
parent: 'astryx docs cli/api/functions',
|
|
123
|
+
command: 'astryx docs cli/api/functions/assert-response',
|
|
124
|
+
});
|
|
125
|
+
expect(fn.data.results[0]).not.toHaveProperty('section');
|
|
126
|
+
},
|
|
127
|
+
SLOW,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
it(
|
|
131
|
+
'gives a top-level namespace hit the topic list as its parent',
|
|
132
|
+
async () => {
|
|
133
|
+
for (const [query, route] of [['unorganized', 'unorganized'], ['Astryx CLI', 'cli']]) {
|
|
134
|
+
const r = await search(query, {cwd, type: 'doc'});
|
|
135
|
+
expect(r.data.results).toContainEqual(
|
|
136
|
+
expect.objectContaining({
|
|
137
|
+
name: route,
|
|
138
|
+
command: `astryx docs ${route}`,
|
|
139
|
+
parent: 'astryx docs',
|
|
140
|
+
}),
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
SLOW,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
it(
|
|
148
|
+
'points a topic hit at its index, never a whole-topic read',
|
|
149
|
+
async () => {
|
|
150
|
+
const r = await search('cli/integrations', {cwd, type: 'doc'});
|
|
151
|
+
expect(r.data.results[0]).toMatchObject({
|
|
152
|
+
name: 'cli/integrations',
|
|
153
|
+
command: 'astryx docs cli/integrations --index',
|
|
154
|
+
});
|
|
155
|
+
expect(r.data.results[0]).not.toHaveProperty('section');
|
|
156
|
+
},
|
|
157
|
+
SLOW,
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
it(
|
|
161
|
+
'searches docs where @astryxdesign/core is not installed',
|
|
162
|
+
async () => {
|
|
163
|
+
const bare = fs.mkdtempSync(
|
|
164
|
+
path.join(os.tmpdir(), 'astryx-search-bare-'),
|
|
165
|
+
);
|
|
166
|
+
try {
|
|
167
|
+
const r = await search('assertResponse', {cwd: bare, type: 'doc'});
|
|
168
|
+
expect(r.data.results[0].name).toBe(
|
|
169
|
+
'cli/api/functions/assert-response',
|
|
170
|
+
);
|
|
171
|
+
} finally {
|
|
172
|
+
fs.rmSync(bare, {recursive: true, force: true});
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
SLOW,
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
|
|
73
179
|
describe('search leaf — matchCount is the total, not the cap', () => {
|
|
74
180
|
it('reports every match while `results` stays bounded by the limit', async () => {
|
|
75
181
|
// The regression: `matchCount` used to be `results.length`, so a query
|
|
@@ -160,6 +266,17 @@ describe('search leaf — error paths (pinned)', () => {
|
|
|
160
266
|
search('button', {cwd, type: /** @type {any} */ ('bogus')}),
|
|
161
267
|
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
162
268
|
}, SLOW);
|
|
269
|
+
|
|
270
|
+
it('throws ERR_CORE_NOT_FOUND when @astryxdesign/core cannot be found', async () => {
|
|
271
|
+
const empty = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-search-no-core-'));
|
|
272
|
+
try {
|
|
273
|
+
await expect(search('button', {cwd: empty})).rejects.toMatchObject({
|
|
274
|
+
code: 'ERR_CORE_NOT_FOUND',
|
|
275
|
+
});
|
|
276
|
+
} finally {
|
|
277
|
+
fs.rmSync(empty, {recursive: true, force: true});
|
|
278
|
+
}
|
|
279
|
+
}, SLOW);
|
|
163
280
|
});
|
|
164
281
|
|
|
165
282
|
describe('search leaf — limit validation (API matches the CLI contract)', () => {
|
|
@@ -213,12 +330,18 @@ describe('search leaf — integration components', () => {
|
|
|
213
330
|
);
|
|
214
331
|
fs.writeFileSync(
|
|
215
332
|
path.join(widgetsDir, 'components', 'FancyGizmo.doc.mjs'),
|
|
216
|
-
`export
|
|
333
|
+
`export default {
|
|
334
|
+
type: 'component',
|
|
217
335
|
name: 'FancyGizmo',
|
|
218
336
|
keywords: ['gizmo', 'widget'],
|
|
219
337
|
usage: {description: 'A fancy gizmo widget.'},
|
|
338
|
+
props: [],
|
|
220
339
|
};\n`,
|
|
221
340
|
);
|
|
341
|
+
fs.writeFileSync(
|
|
342
|
+
path.join(widgetsDir, 'components', 'FancyGizmo.tsx'),
|
|
343
|
+
`export function FancyGizmo() { return null; }\n`,
|
|
344
|
+
);
|
|
222
345
|
|
|
223
346
|
return dir;
|
|
224
347
|
}
|