@astryxdesign/cli 0.6.5 → 0.6.6-canary.1f4eb3c
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/CHANGELOG.md +87 -0
- package/README.md +58 -55
- package/api/build/_adapter.d.mts +55 -2
- package/api/build/_adapter.mjs +100 -10
- package/api/build/build.doc.mjs +2 -2
- package/api/build/build.test.mjs +111 -2
- package/api/build/build.type.d.mts +8 -0
- package/api/build/build.type.mjs +2 -0
- package/api/build/kit/kit.mjs +99 -22
- package/api/build/kit/rank.d.mts +32 -8
- package/api/build/kit/rank.mjs +291 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +603 -0
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +25 -0
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.mjs +7 -1
- package/api/docs/docOverlays.test.mjs +10 -6
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +134 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +46 -1
- package/api/docs/docs.test.mjs +279 -0
- package/api/docs/docs.type.d.mts +81 -4
- package/api/docs/docs.type.mjs +41 -4
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +572 -0
- package/api/docs/integrationDocs.test.mjs +337 -0
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +149 -23
- package/api/doctor/_adapter.d.mts +43 -0
- package/api/doctor/_adapter.mjs +142 -0
- package/api/doctor/doctor.d.mts +0 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +6 -123
- package/api/doctor/theme-checks.d.mts +12 -0
- package/api/doctor/theme-checks.mjs +1117 -0
- package/api/doctor/theme-checks.test.mjs +526 -0
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.d.mts +3 -1
- package/api/gap-report/gap-report.mjs +27 -3
- package/api/gap-report/gap-report.test.mjs +106 -0
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +10 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +354 -28
- package/api/integration/add-theme.test.mjs +380 -16
- package/api/integration/authoring-checks.mjs +31 -8
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +495 -4
- package/api/integration/pack-check.test.mjs +619 -10
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/layout/expand/expand.mjs +12 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search.d.mts +39 -8
- package/api/search/search.doc.mjs +4 -4
- package/api/search/search.mjs +248 -66
- package/api/search/search.test.mjs +829 -0
- package/api/search/search.type.d.mts +6 -6
- package/api/search/search.type.mjs +5 -5
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +95 -13
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +4 -0
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +15 -8
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/show/show.mjs +17 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +6 -2
- package/api/template/template.mjs +2 -0
- package/api/template/template.type.d.mts +14 -0
- package/api/template/template.type.mjs +5 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +50 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.icon-lineage.test.mjs +117 -0
- package/api/theme/build/build.icon-preservation.test.mjs +639 -0
- package/api/theme/build/build.mjs +463 -155
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +220 -1
- package/api/theme/build/icon-imports.d.mts +47 -0
- package/api/theme/build/icon-imports.mjs +691 -0
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.d.mts +4 -1
- package/api/theme/themeBuild.doc.mjs +15 -4
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/run/run.mjs +20 -3
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +5 -0
- package/api/upgrade/upgrade.type.mjs +2 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/next/index.mjs +14 -1
- package/assets/codemods/transforms/next/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +161 -0
- package/assets/docs/getting-started.doc.mjs +59 -15
- package/assets/docs/icons.doc.mjs +1 -0
- package/assets/docs/principles.doc.dense.mjs +2 -2
- package/assets/docs/principles.doc.mjs +2 -2
- package/assets/docs/principles.doc.zh.mjs +2 -2
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/styling.doc.mjs +2 -2
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -770
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tokens.doc.mjs +4 -4
- package/assets/docs/tree/add-a-theme.doc.mjs +6 -2
- package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +68 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +32 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +102 -0
- package/assets/docs/tree/scaffold.doc.mjs +145 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/side-panels.doc.mjs +82 -0
- package/assets/docs/tree/structure.doc.mjs +144 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/troubleshooting.doc.mjs +13 -5
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +11 -7
- package/assets/docs/use-a-theme.doc.mjs +97 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +10 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.mjs +279 -30
- package/clients/cli/commands/build.mjs +7 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +88 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/discover.mjs +29 -1
- package/clients/cli/commands/discover.no-source.test.mjs +75 -0
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +273 -16
- package/clients/cli/commands/docs.test.mjs +382 -0
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +4 -4
- package/clients/cli/commands/doctor.test.mjs +9 -51
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/gap-report.mjs +12 -0
- package/clients/cli/commands/gap-report.test.mjs +63 -0
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +5 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration-authoring.test.mjs +12 -2
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/integration.mjs +3 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -0
- package/clients/cli/commands/layout-expand.doc.mjs +4 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
- package/clients/cli/commands/layout.doc.mjs +1 -0
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +61 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.doc.mjs +5 -4
- package/clients/cli/commands/search.mjs +30 -6
- package/clients/cli/commands/search.test.mjs +63 -17
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +70 -6
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +132 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +44 -0
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +4 -1
- package/clients/cli/lib/component-format.mjs +19 -2
- package/clients/cli/lib/manifest.mjs +44 -165
- package/clients/cli/lib/manifest.test.mjs +98 -7
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +31 -28
- package/foundation/agent-docs/agent-docs.test.mjs +1163 -0
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- package/foundation/discovery/theme-discovery.d.mts +78 -5
- package/foundation/discovery/theme-discovery.mjs +143 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +18 -8
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/tree.test.mjs +649 -0
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +79 -13
- package/foundation/integrations/cli-requirement.mjs +115 -22
- package/foundation/integrations/cli-requirement.test.mjs +205 -8
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.d.mts +5 -5
- package/foundation/response/response-types.doc.mjs +50 -35
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
|
@@ -19,8 +19,10 @@ export function validateInstalledIntegration(spec: string, cwd?: string): Promis
|
|
|
19
19
|
/**
|
|
20
20
|
* Unified entry: validate the LOCAL integration (no `pkg`) or an INSTALLED one
|
|
21
21
|
* (`pkg` given) and return the `integration.validate` envelope. The no-manifest
|
|
22
|
-
* local case is guidance, not an error — it comes back with `
|
|
23
|
-
* issues so the CLI can print a hint and stay exit-0.
|
|
22
|
+
* local case is guidance, not an error — it comes back with `validated: false`,
|
|
23
|
+
* `name: null` and no issues so the CLI can print a hint and stay exit-0.
|
|
24
|
+
* `validated` is what tells a machine consumer that empty `issues` means
|
|
25
|
+
* "nothing was checked" rather than "checked and healthy".
|
|
24
26
|
*
|
|
25
27
|
* This is the seam that keeps the CLI a thin wrapper: the command handler calls
|
|
26
28
|
* this and only chooses how to render (human vs --json) + the exit code.
|
|
@@ -427,8 +427,10 @@ export async function validateInstalledIntegration(spec, cwd = process.cwd()) {
|
|
|
427
427
|
/**
|
|
428
428
|
* Unified entry: validate the LOCAL integration (no `pkg`) or an INSTALLED one
|
|
429
429
|
* (`pkg` given) and return the `integration.validate` envelope. The no-manifest
|
|
430
|
-
* local case is guidance, not an error — it comes back with `
|
|
431
|
-
* issues so the CLI can print a hint and stay exit-0.
|
|
430
|
+
* local case is guidance, not an error — it comes back with `validated: false`,
|
|
431
|
+
* `name: null` and no issues so the CLI can print a hint and stay exit-0.
|
|
432
|
+
* `validated` is what tells a machine consumer that empty `issues` means
|
|
433
|
+
* "nothing was checked" rather than "checked and healthy".
|
|
432
434
|
*
|
|
433
435
|
* This is the seam that keeps the CLI a thin wrapper: the command handler calls
|
|
434
436
|
* this and only chooses how to render (human vs --json) + the exit code.
|
|
@@ -445,6 +447,9 @@ export async function validateIntegration(pkg, options = {}) {
|
|
|
445
447
|
return {
|
|
446
448
|
type: 'integration.validate',
|
|
447
449
|
data: {
|
|
450
|
+
// The one bit that separates "checked and clean" from "never checked":
|
|
451
|
+
// with no manifest there is nothing to validate, and issues stays [].
|
|
452
|
+
validated: result.found,
|
|
448
453
|
name: result.found ? (result.name ?? null) : null,
|
|
449
454
|
version: result.found ? (result.version ?? null) : null,
|
|
450
455
|
issues: result.issues,
|
|
@@ -625,3 +625,58 @@ describe('integration diagnostics are read-only', () => {
|
|
|
625
625
|
expect({pkg: snapshot(pkgDir), consumer: snapshot(consumer)}).toEqual(before);
|
|
626
626
|
});
|
|
627
627
|
});
|
|
628
|
+
|
|
629
|
+
describe('validated separates "checked and clean" from "never checked"', () => {
|
|
630
|
+
// `doctor integration validate --json` from a directory with no manifest
|
|
631
|
+
// returned {name: null, version: null, issues: []} and exit 0 — the same
|
|
632
|
+
// envelope a healthy, fully validated integration produces. Wire that into
|
|
633
|
+
// CI from the wrong directory and it is green forever.
|
|
634
|
+
it('is false for every check when no manifest is found', async () => {
|
|
635
|
+
const dir = path.join(tmpDir, 'plain');
|
|
636
|
+
fs.mkdirSync(dir, {recursive: true});
|
|
637
|
+
fs.writeFileSync(
|
|
638
|
+
path.join(dir, 'package.json'),
|
|
639
|
+
JSON.stringify({name: 'plain-app', version: '1.0.0'}),
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
const validate = await validateIntegration(undefined, {cwd: dir});
|
|
643
|
+
expect(validate.data.validated).toBe(false);
|
|
644
|
+
expect(validate.data.issues).toEqual([]);
|
|
645
|
+
|
|
646
|
+
const templates = await integrationTemplateConflicts(undefined, {cwd: dir});
|
|
647
|
+
const components = await integrationComponentConflicts(undefined, {cwd: dir});
|
|
648
|
+
const docs = await integrationDocConflicts(undefined, {cwd: dir});
|
|
649
|
+
expect(templates.data.validated).toBe(false);
|
|
650
|
+
expect(components.data.validated).toBe(false);
|
|
651
|
+
expect(docs.data.validated).toBe(false);
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
it('is true for a real integration, whose empty issue list then means healthy', async () => {
|
|
655
|
+
const dir = path.join(tmpDir, 'integration');
|
|
656
|
+
writePackage(dir, {manifest: 'export default {};\n'});
|
|
657
|
+
|
|
658
|
+
const validate = await validateIntegration(undefined, {cwd: dir});
|
|
659
|
+
expect(validate.data.validated).toBe(true);
|
|
660
|
+
expect(validate.data.name).toBe('@acme/widgets');
|
|
661
|
+
|
|
662
|
+
const templates = await integrationTemplateConflicts(undefined, {cwd: dir});
|
|
663
|
+
const components = await integrationComponentConflicts(undefined, {cwd: dir});
|
|
664
|
+
const docs = await integrationDocConflicts(undefined, {cwd: dir});
|
|
665
|
+
expect(templates.data.validated).toBe(true);
|
|
666
|
+
expect(components.data.validated).toBe(true);
|
|
667
|
+
expect(docs.data.validated).toBe(true);
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
it('is true for an installed package that could not be found — that is a real finding', async () => {
|
|
671
|
+
const consumer = path.join(tmpDir, 'consumer');
|
|
672
|
+
fs.mkdirSync(consumer, {recursive: true});
|
|
673
|
+
fs.writeFileSync(
|
|
674
|
+
path.join(consumer, 'package.json'),
|
|
675
|
+
JSON.stringify({name: 'consumer', version: '1.0.0'}),
|
|
676
|
+
);
|
|
677
|
+
|
|
678
|
+
const res = await validateIntegration('@acme/nope', {cwd: consumer});
|
|
679
|
+
expect(res.data.validated).toBe(true);
|
|
680
|
+
expect(summarizeIssues(res.data.issues).errors).toBeGreaterThan(0);
|
|
681
|
+
});
|
|
682
|
+
});
|
|
@@ -27,10 +27,15 @@ export type ValidateIntegrationOptions = {
|
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* `astryx --json doctor integration validate [package]`.
|
|
30
|
+
*
|
|
31
|
+
* `validated` is false in exactly one case: no integration manifest was found,
|
|
32
|
+
* so nothing was checked. An empty `issues` then means "not looked at", not
|
|
33
|
+
* "healthy" — the two are otherwise byte-identical.
|
|
30
34
|
*/
|
|
31
35
|
export type ValidateIntegrationResponse = {
|
|
32
36
|
type: "integration.validate";
|
|
33
37
|
data: {
|
|
38
|
+
validated: boolean;
|
|
34
39
|
name: string | null;
|
|
35
40
|
version: string | null;
|
|
36
41
|
issues: import("../../foundation/integrations/issue").AstryxIntegrationIssue[];
|
|
@@ -32,9 +32,13 @@
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* `astryx --json doctor integration validate [package]`.
|
|
35
|
+
*
|
|
36
|
+
* `validated` is false in exactly one case: no integration manifest was found,
|
|
37
|
+
* so nothing was checked. An empty `issues` then means "not looked at", not
|
|
38
|
+
* "healthy" — the two are otherwise byte-identical.
|
|
35
39
|
* @typedef {object} ValidateIntegrationResponse
|
|
36
40
|
* @property {'integration.validate'} type
|
|
37
|
-
* @property {{name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
41
|
+
* @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
38
42
|
*/
|
|
39
43
|
|
|
40
44
|
export {};
|
|
@@ -46,7 +46,7 @@ export const doc = {
|
|
|
46
46
|
{
|
|
47
47
|
type: 'integration.validate',
|
|
48
48
|
description:
|
|
49
|
-
'The result envelope: `data.name` and `data.version` of the validated package (both null
|
|
49
|
+
'The result envelope: `data.validated`, false only when no integration manifest was found — nothing was checked, so the empty `data.issues` means "not looked at", not "healthy"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message}.',
|
|
50
50
|
},
|
|
51
51
|
],
|
|
52
52
|
examples: [
|
|
@@ -18,7 +18,7 @@ import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
|
18
18
|
import {assertWithin, isFilePathArg, PathSafetyError} from '../../../foundation/fs/path-safety.mjs';
|
|
19
19
|
import {detectForm} from '../../../foundation/xle/parse.mjs';
|
|
20
20
|
import {expand} from '../../../foundation/xle/expand.mjs';
|
|
21
|
-
import {
|
|
21
|
+
import {replaceDemoMedia} from '../../template/template.mjs';
|
|
22
22
|
import {analyze, formatIssue} from '../_adapter.mjs';
|
|
23
23
|
|
|
24
24
|
/** @param {string} name */
|
|
@@ -59,28 +59,32 @@ function collectHintNames(doc) {
|
|
|
59
59
|
/**
|
|
60
60
|
* Build the blockModules map expand() needs: import-mode for app components,
|
|
61
61
|
* splice-mode (reading + asset-stripping the block source) for template blocks.
|
|
62
|
-
* Only blocks actually referenced are read.
|
|
62
|
+
* Only blocks actually referenced are read. Also returns how many demo media
|
|
63
|
+
* references the splice-mode sources had replaced.
|
|
63
64
|
*
|
|
64
65
|
* @param {import('../../../foundation/xle/xle-ast').XLEDoc} doc
|
|
65
66
|
* @param {import('../_adapter.mjs').LayoutBlock[]} blocks
|
|
66
|
-
* @returns {Map<string, import('../../../foundation/xle/xle-ast').BlockModule
|
|
67
|
+
* @returns {{modules: Map<string, import('../../../foundation/xle/xle-ast').BlockModule>, demoMediaReplaced: number}}
|
|
67
68
|
*/
|
|
68
69
|
function buildBlockModules(doc, blocks) {
|
|
69
70
|
const referenced = collectHintNames(doc);
|
|
70
|
-
if (referenced.size === 0) return new Map();
|
|
71
|
+
if (referenced.size === 0) return {modules: new Map(), demoMediaReplaced: 0};
|
|
71
72
|
const byKey = new Map(blocks.map(b => [normKey(b.dirName), b]));
|
|
72
73
|
/** @type {Map<string, import('../../../foundation/xle/xle-ast').BlockModule>} */
|
|
73
74
|
const modules = new Map();
|
|
75
|
+
let demoMediaReplaced = 0;
|
|
74
76
|
for (const name of referenced) {
|
|
75
77
|
const block = byKey.get(normKey(name));
|
|
76
78
|
if (!block) continue;
|
|
77
79
|
if (block.kind === 'component') {
|
|
78
80
|
modules.set(name, /** @type {import('../../../foundation/xle/xle-ast').BlockModule} */ (/** @type {unknown} */ ({mode: 'import', componentName: block.name, importPath: block.importPath, isDefault: block.isDefault})));
|
|
79
81
|
} else if (block.filePath && fs.existsSync(block.filePath)) {
|
|
80
|
-
|
|
82
|
+
const spliced = replaceDemoMedia(fs.readFileSync(block.filePath, 'utf-8'));
|
|
83
|
+
demoMediaReplaced += spliced.demoMediaReplaced;
|
|
84
|
+
modules.set(name, /** @type {import('../../../foundation/xle/xle-ast').BlockModule} */ ({mode: 'splice', componentName: block.dirName, source: spliced.source}));
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
|
-
return modules;
|
|
87
|
+
return {modules, demoMediaReplaced};
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
/**
|
|
@@ -115,7 +119,7 @@ export async function layoutExpand(expression, options = {}) {
|
|
|
115
119
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
116
120
|
);
|
|
117
121
|
}
|
|
118
|
-
const blockModules = buildBlockModules(doc, blocks);
|
|
122
|
+
const {modules: blockModules, demoMediaReplaced} = buildBlockModules(doc, blocks);
|
|
119
123
|
const result = expand(doc, registry, {componentName, blockModules});
|
|
120
124
|
|
|
121
125
|
let written = null;
|
|
@@ -150,6 +154,7 @@ export async function layoutExpand(expression, options = {}) {
|
|
|
150
154
|
blocksReferenced: [...blockModules.entries()].map(([name, m]) => ({name, mode: m.mode})),
|
|
151
155
|
warnings: warnings.map(formatIssue),
|
|
152
156
|
written,
|
|
157
|
+
demoMediaReplaced,
|
|
153
158
|
},
|
|
154
159
|
};
|
|
155
160
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The layout.expand receipt discloses demo media replaced in the template
|
|
5
|
+
* blocks it splices. Blocks are picked by what their source contains, not by
|
|
6
|
+
* name, so catalog renames do not break the suite.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, it, expect, beforeAll} from 'vitest';
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import {layoutExpand} from '../layout.mjs';
|
|
12
|
+
import {discoverTemplates} from '../../template/template.mjs';
|
|
13
|
+
import {buildRegistry} from '../../../foundation/xle/registry.mjs';
|
|
14
|
+
|
|
15
|
+
const SLOW = 60_000;
|
|
16
|
+
const FIXTURE_REF = /\/template-assets\/[\w.-]+\.\w+/g;
|
|
17
|
+
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
await buildRegistry();
|
|
20
|
+
}, 120_000);
|
|
21
|
+
|
|
22
|
+
/** @param {string} name */
|
|
23
|
+
const hintKey = name => name.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
24
|
+
|
|
25
|
+
/** @type {Promise<Array<{hint: string, refs: number}>> | undefined} */
|
|
26
|
+
let catalog;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Template blocks a `{hint}` resolves to unambiguously, with the number of demo
|
|
30
|
+
* media references in each one's source.
|
|
31
|
+
* @returns {Promise<Array<{hint: string, refs: number}>>}
|
|
32
|
+
*/
|
|
33
|
+
function catalogBlocks() {
|
|
34
|
+
catalog ??= discoverTemplates().then(found => {
|
|
35
|
+
const all = /** @type {Array<{dirName: string, type: string, filePath: string}>} */ (
|
|
36
|
+
found
|
|
37
|
+
).filter(t => t.type === 'block' && t.filePath && fs.existsSync(t.filePath));
|
|
38
|
+
const seen = new Map();
|
|
39
|
+
for (const t of all) seen.set(hintKey(t.dirName), (seen.get(hintKey(t.dirName)) ?? 0) + 1);
|
|
40
|
+
return all
|
|
41
|
+
.filter(t => seen.get(hintKey(t.dirName)) === 1)
|
|
42
|
+
.map(t => ({
|
|
43
|
+
hint: hintKey(t.dirName),
|
|
44
|
+
refs: (fs.readFileSync(t.filePath, 'utf-8').match(FIXTURE_REF) ?? []).length,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
return catalog;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe('layout.expand receipt - replaced demo media', () => {
|
|
51
|
+
it('counts the demo media of a spliced block once, however often it is referenced', async () => {
|
|
52
|
+
const block = (await catalogBlocks()).find(b => b.refs > 0);
|
|
53
|
+
if (!block) throw new Error('no template block carries demo media');
|
|
54
|
+
const res = await layoutExpand(`V > {${block.hint}}*3`);
|
|
55
|
+
expect(res.type).toBe('layout.expand');
|
|
56
|
+
expect(res.data.blocksReferenced).toHaveLength(1);
|
|
57
|
+
expect(res.data.demoMediaReplaced).toBe(block.refs);
|
|
58
|
+
expect(res.data.code).not.toContain('/template-assets/');
|
|
59
|
+
}, SLOW);
|
|
60
|
+
|
|
61
|
+
it('sums the demo media of every spliced block', async () => {
|
|
62
|
+
const [a, b] = (await catalogBlocks()).filter(x => x.refs > 0);
|
|
63
|
+
if (!b) throw new Error('fewer than two template blocks carry demo media');
|
|
64
|
+
const res = await layoutExpand(`V > {${a.hint}} + {${b.hint}}`);
|
|
65
|
+
expect(res.data.demoMediaReplaced).toBe(a.refs + b.refs);
|
|
66
|
+
}, SLOW);
|
|
67
|
+
|
|
68
|
+
it('reports 0 when nothing spliced carries demo media', async () => {
|
|
69
|
+
const plain = (await catalogBlocks()).find(b => b.refs === 0);
|
|
70
|
+
if (!plain) throw new Error('every template block carries demo media');
|
|
71
|
+
expect((await layoutExpand(`V > {${plain.hint}}`)).data.demoMediaReplaced).toBe(0);
|
|
72
|
+
expect((await layoutExpand('V > B"Save"')).data.demoMediaReplaced).toBe(0);
|
|
73
|
+
}, SLOW);
|
|
74
|
+
});
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
* @property {LayoutBlockReference[]} data.blocksReferenced
|
|
49
49
|
* @property {string[]} data.warnings
|
|
50
50
|
* @property {string | null} data.written
|
|
51
|
+
* @property {number} data.demoMediaReplaced Astryx demo media references (images, posters, videos) replaced in the spliced template blocks: images with a neutral placeholder, videos with an empty source. Swap in your own media at those points in the code; no media is installed. 0 when no spliced block carried any.
|
|
51
52
|
*/
|
|
52
53
|
|
|
53
54
|
/**
|
|
@@ -70,7 +70,7 @@ export const doc = {
|
|
|
70
70
|
{
|
|
71
71
|
type: 'layout.expand',
|
|
72
72
|
description:
|
|
73
|
-
'The expansion: the parsed form, the generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings,
|
|
73
|
+
'The expansion: the parsed form, the generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, written (the relative output path, or null when nothing was written), and demoMediaReplaced (how many Astryx demo media references in the spliced template blocks, such as images, posters and videos, were replaced with placeholders for you to swap for your own media).',
|
|
74
74
|
},
|
|
75
75
|
],
|
|
76
76
|
throws: [
|
package/api/search/search.d.mts
CHANGED
|
@@ -66,6 +66,7 @@ export function scoreQuery(term: string, tokens: string[], candidate: Candidate)
|
|
|
66
66
|
* @param {string} term - Lowercased search term.
|
|
67
67
|
* @param {object} candidate
|
|
68
68
|
* @param {string} candidate.name - Primary identifier (component/hook name, topic, template name).
|
|
69
|
+
* @param {string[]} [candidate.aliases] - Other names, scored like the name (a theme's display name).
|
|
69
70
|
* @param {string} [candidate.domain] - A component, hook, or template name
|
|
70
71
|
* also matches typed as words: `command palette` is CommandPalette.
|
|
71
72
|
* @param {string[]} [candidate.keywords] - Authored intent (componentsUsed, category words).
|
|
@@ -76,8 +77,9 @@ export function scoreQuery(term: string, tokens: string[], candidate: Candidate)
|
|
|
76
77
|
* @param {{fuzzy?: boolean}} [opts] - `fuzzy`: allow edit-distance (typo) matches. Default true; multi-word queries pass false.
|
|
77
78
|
* @returns {{score: number, reason: string} | null}
|
|
78
79
|
*/
|
|
79
|
-
export function scoreCandidate(term: string, { name, domain, keywords, weakKeywords, description, prose, guidance, }: {
|
|
80
|
+
export function scoreCandidate(term: string, { name, aliases, domain, keywords, weakKeywords, description, prose, guidance, }: {
|
|
80
81
|
name: string;
|
|
82
|
+
aliases?: string[] | undefined;
|
|
81
83
|
domain?: string | undefined;
|
|
82
84
|
keywords?: string[] | undefined;
|
|
83
85
|
weakKeywords?: string[] | undefined;
|
|
@@ -91,18 +93,42 @@ export function scoreCandidate(term: string, { name, domain, keywords, weakKeywo
|
|
|
91
93
|
reason: string;
|
|
92
94
|
} | null;
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* The components (name and keywords) a search response was scored against, or
|
|
97
|
+
* null when that search was narrowed away from components.
|
|
98
|
+
* @param {object} response
|
|
99
|
+
* @returns {{name: string, keywords: string[]}[] | null}
|
|
100
|
+
*/
|
|
101
|
+
export function searchedComponents(response: object): {
|
|
102
|
+
name: string;
|
|
103
|
+
keywords: string[];
|
|
104
|
+
}[] | null;
|
|
105
|
+
/**
|
|
106
|
+
* Every component the project can use, Core's and its integrations', with the
|
|
107
|
+
* keywords its own doc declares: the discovery and doc reads search's own
|
|
108
|
+
* candidates use, without the import paths and prose a result carries. `build`
|
|
109
|
+
* reads it to tell a part of a page from a page when its search was narrowed
|
|
110
|
+
* away from components.
|
|
111
|
+
* @param {string} coreDir
|
|
112
|
+
* @param {string} cwd
|
|
113
|
+
* @returns {Promise<{name: string, keywords: string[]}[]>}
|
|
114
|
+
*/
|
|
115
|
+
export function componentKeywords(coreDir: string, cwd: string): Promise<{
|
|
116
|
+
name: string;
|
|
117
|
+
keywords: string[];
|
|
118
|
+
}[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Unified ranked search across components, hooks, docs, templates, and themes.
|
|
95
121
|
*
|
|
96
122
|
* @param {string} query - Free-text search term.
|
|
97
123
|
* @param {object} [options]
|
|
98
124
|
* @param {string} [options.cwd]
|
|
99
|
-
* @param {'component'|'hook'|'doc'|'template'} [options.type] - Restrict to one domain.
|
|
125
|
+
* @param {'component'|'hook'|'doc'|'template'|'theme'} [options.type] - Restrict to one domain.
|
|
100
126
|
* @param {number} [options.limit] - Max results (default 20).
|
|
101
127
|
* @returns {Promise<import('./search.type.mjs').SearchResponse>}
|
|
102
128
|
*/
|
|
103
129
|
export function search(query: string, options?: {
|
|
104
130
|
cwd?: string | undefined;
|
|
105
|
-
type?: "component" | "hook" | "template" | "doc" | undefined;
|
|
131
|
+
type?: "theme" | "component" | "hook" | "template" | "doc" | undefined;
|
|
106
132
|
limit?: number | undefined;
|
|
107
133
|
}): Promise<import("./search.type.mjs").SearchResponse>;
|
|
108
134
|
export namespace SYNONYMS {
|
|
@@ -135,8 +161,13 @@ export const STOPWORDS: Set<string>;
|
|
|
135
161
|
* prefixed fields carry domain-specific payload used only by {@link toResult}.
|
|
136
162
|
*/
|
|
137
163
|
export type Candidate = {
|
|
138
|
-
domain: "component" | "hook" | "doc" | "template";
|
|
164
|
+
domain: "component" | "hook" | "doc" | "template" | "theme";
|
|
139
165
|
name: string;
|
|
166
|
+
/**
|
|
167
|
+
* - Other names the candidate answers to, scored
|
|
168
|
+
* with the same name signals: a theme's display name.
|
|
169
|
+
*/
|
|
170
|
+
aliases?: string[] | undefined;
|
|
140
171
|
keywords?: string[] | undefined;
|
|
141
172
|
weakKeywords?: string[] | undefined;
|
|
142
173
|
description?: string | undefined;
|
|
@@ -168,9 +199,9 @@ export type Candidate = {
|
|
|
168
199
|
*/
|
|
169
200
|
_parent?: string | undefined;
|
|
170
201
|
/**
|
|
171
|
-
* - The npm package that
|
|
172
|
-
*
|
|
173
|
-
*
|
|
202
|
+
* - The npm package that owns the candidate:
|
|
203
|
+
* Core's package for its components, hooks, and templates, the integration's
|
|
204
|
+
* for what it contributed, and for a doc part the package that wrote it.
|
|
174
205
|
*/
|
|
175
206
|
_package?: string | undefined;
|
|
176
207
|
_displayName?: string | undefined;
|
|
@@ -14,7 +14,7 @@ export const doc = {
|
|
|
14
14
|
namespace: 'cli/api',
|
|
15
15
|
displayName: 'search()',
|
|
16
16
|
summary:
|
|
17
|
-
'Unified ranked search across components, hooks, docs, and
|
|
17
|
+
'Unified ranked search across components, hooks, docs, templates, and themes.',
|
|
18
18
|
description:
|
|
19
19
|
'The single "I\'m looking for X" entry point across every content domain. ' +
|
|
20
20
|
'Ranking is keyword + fuzzy (not embeddings); name and keyword signals outrank ' +
|
|
@@ -35,7 +35,7 @@ export const doc = {
|
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: 'options.type',
|
|
38
|
-
type: "'component' | 'hook' | 'doc' | 'template'",
|
|
38
|
+
type: "'component' | 'hook' | 'doc' | 'template' | 'theme'",
|
|
39
39
|
description: 'Restrict results to a single domain.',
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -48,14 +48,14 @@ export const doc = {
|
|
|
48
48
|
name: 'options.cwd',
|
|
49
49
|
type: 'string',
|
|
50
50
|
description:
|
|
51
|
-
"Directory to resolve @astryxdesign/core from. A docs-only search (`type: 'doc'`) does not need it, and a search with no `type` covers the docs alone when core is missing.",
|
|
51
|
+
"Directory to resolve @astryxdesign/core from. A docs-only or themes-only search (`type: 'doc'` or `type: 'theme'`) does not need it, and a search with no `type` covers the docs and themes alone when core is missing.",
|
|
52
52
|
},
|
|
53
53
|
],
|
|
54
54
|
returns: [
|
|
55
55
|
{
|
|
56
56
|
type: 'search',
|
|
57
57
|
description:
|
|
58
|
-
'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs,
|
|
58
|
+
'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, `displayName` and `kind` for templates, and `displayName` for themes. A doc result is the smallest part that answers: one section (with `section`, and a command that reads only it), one docs-tree route, or a topic, whose command lists its sections. `parent` is the command that opens the level above it: the section list of its topic, the namespace a tree node sits in, the Unorganized level for a flat topic, or the topic list for a top-level namespace. Every doc result also carries `package`, the npm package that authored it (for a section, the package its file came from). A theme result is one theme you can import: `name` is its slug, its command is `astryx theme add --import <slug>`, and `package` is the npm package that ships it (`@astryxdesign/cli` for the CLI\'s own themes).',
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
61
|
throws: [
|