@astryxdesign/cli 0.6.4 → 0.6.5-canary.00f1ed9
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 +56 -0
- package/README.md +103 -95
- package/api/build/_adapter.d.mts +36 -2
- package/api/build/_adapter.mjs +41 -10
- package/api/build/build.doc.mjs +8 -3
- package/api/build/build.test.mjs +60 -2
- package/api/build/kit/kit.mjs +109 -26
- package/api/build/kit/rank.d.mts +24 -8
- package/api/build/kit/rank.mjs +277 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/component/_adapter.d.mts +25 -0
- package/api/component/_adapter.mjs +59 -5
- package/api/component/component.d.mts +6 -3
- package/api/component/component.doc.mjs +37 -17
- package/api/component/component.mjs +249 -9
- package/api/component/component.type.d.mts +25 -0
- package/api/component/component.type.mjs +44 -0
- package/api/discover/_adapter.d.mts +114 -6
- package/api/discover/_adapter.mjs +372 -17
- package/api/discover/_adapter.test.mjs +215 -0
- package/api/discover/_catalog-view.d.mts +115 -0
- package/api/discover/_catalog-view.mjs +203 -0
- package/api/discover/_catalog-view.test.mjs +128 -0
- package/api/discover/detail/detail.d.mts +18 -6
- package/api/discover/detail/detail.mjs +67 -13
- package/api/discover/detail/detail.test.mjs +85 -0
- package/api/discover/detail/item/item.d.mts +26 -0
- package/api/discover/detail/item/item.mjs +78 -0
- package/api/discover/detail/item/item.test.mjs +73 -0
- package/api/discover/discover.d.mts +3 -9
- package/api/discover/discover.doc.mjs +61 -18
- package/api/discover/discover.mjs +220 -36
- package/api/discover/discover.test.mjs +11 -2
- package/api/discover/discover.type.d.mts +147 -8
- package/api/discover/discover.type.mjs +102 -12
- package/api/discover/list/list.d.mts +20 -6
- package/api/discover/list/list.mjs +45 -12
- package/api/discover/list/list.test.mjs +46 -0
- package/api/discover/search/search.d.mts +18 -16
- package/api/discover/search/search.mjs +102 -56
- package/api/discover/search/search.test.mjs +144 -10
- package/api/docs/_adapter.d.mts +8 -3
- package/api/docs/_adapter.mjs +14 -6
- package/api/docs/docOverlays.test.mjs +27 -1
- package/api/docs/docs.doc.mjs +2 -2
- package/api/docs/docs.test.mjs +54 -18
- package/api/docs/integration-tree.test.mjs +17 -0
- package/api/docs/integrationDocs.test.mjs +27 -5
- package/api/doctor/doctor.d.mts +8 -3
- package/api/doctor/doctor.doc.mjs +17 -8
- package/api/doctor/doctor.mjs +90 -9
- package/api/doctor/doctor.test.mjs +122 -10
- package/api/doctor/doctor.type.d.mts +1 -1
- package/api/doctor/doctor.type.mjs +1 -1
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.doc.mjs +19 -10
- package/api/hook/hook.doc.mjs +6 -3
- package/api/index.d.mts +1 -0
- package/api/index.mjs +5 -3
- package/api/init/init.doc.mjs +17 -12
- 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 +5 -2
- package/api/integration/add-helpers.mjs +36 -9
- package/api/integration/add-theme.mjs +266 -23
- package/api/integration/add-theme.test.mjs +247 -0
- package/api/integration/authoring-checks.mjs +12 -9
- 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 +1 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.lifecycle-output.test.mjs +107 -0
- package/api/integration/pack-check.mjs +92 -10
- package/api/integration/pack-check.test.mjs +140 -1
- package/api/integration/pack-check.type.mjs +1 -1
- 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/json/assertResponse.doc.mjs +1 -1
- package/api/json/isError.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 +51 -1
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +299 -17
- package/api/search/search.test.mjs +216 -18
- package/api/swizzle/copy/copy.mjs +66 -3
- package/api/swizzle/swizzle.doc.mjs +11 -5
- package/api/template/copy/copy.mjs +15 -9
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/copy/copy.test.mjs +9 -0
- package/api/template/show/show.mjs +15 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +8 -3
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +2 -0
- package/api/template/template.type.mjs +2 -0
- package/api/theme/add/add.mjs +17 -25
- package/api/theme/add/add.rollback.test.mjs +158 -0
- package/api/theme/add/add.staging.test.mjs +40 -23
- package/api/theme/build/build.d.mts +24 -0
- package/api/theme/build/build.family.test.mjs +7 -12
- package/api/theme/build/build.mjs +243 -26
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.rollback.test.mjs +148 -0
- package/api/theme/generateTonalPalette.doc.mjs +1 -2
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +9 -10
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +2 -1
- package/api/theme/themePaletteGenerate.doc.mjs +15 -8
- package/api/theme/themeTargets.doc.mjs +3 -2
- package/api/theme/themeTemplate.doc.mjs +2 -1
- package/api/upgrade/run/files-changed.test.mjs +111 -0
- package/api/upgrade/run/run.mjs +25 -6
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +24 -22
- package/api/upgrade/upgrade.type.d.mts +1 -0
- package/api/upgrade/upgrade.type.mjs +3 -2
- package/assets/codemods/__tests__/runner.test.mjs +3 -1
- package/assets/codemods/file-count.test.mjs +163 -0
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +5 -4
- package/assets/docs/README.md +4 -2
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +8 -2
- package/assets/docs/elevation.doc.mjs +6 -4
- package/assets/docs/getting-started.doc.mjs +5 -16
- package/assets/docs/icons.doc.mjs +3 -21
- package/assets/docs/illustrations.doc.mjs +7 -15
- package/assets/docs/internationalization.doc.mjs +7 -5
- package/assets/docs/layout.doc.dense.mjs +130 -82
- package/assets/docs/layout.doc.mjs +133 -77
- package/assets/docs/migration.doc.mjs +19 -21
- package/assets/docs/motion.doc.mjs +16 -3
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +8 -0
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +8 -3
- package/assets/docs/spacing.doc.mjs +7 -2
- package/assets/docs/styling-libraries.doc.mjs +6 -2
- package/assets/docs/styling.doc.mjs +19 -23
- package/assets/docs/theme.doc.dense.mjs +58 -18
- package/assets/docs/theme.doc.mjs +57 -47
- package/assets/docs/theme.doc.zh.mjs +9 -8
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +389 -8
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/add-a-component.doc.mjs +75 -0
- package/assets/docs/tree/add-a-theme.doc.mjs +85 -0
- package/assets/docs/tree/add-a-topic.doc.mjs +144 -0
- package/assets/docs/tree/agent-guidance.doc.mjs +138 -0
- package/assets/docs/tree/block-template.doc.mjs +130 -0
- package/assets/docs/tree/build-the-template.doc.mjs +28 -0
- package/assets/docs/tree/building-blocks.doc.mjs +46 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +137 -0
- package/assets/docs/tree/checks.doc.mjs +119 -0
- package/assets/docs/tree/codemods.doc.mjs +147 -0
- package/assets/docs/tree/component-family.doc.mjs +113 -0
- package/assets/docs/tree/component-imports.doc.mjs +69 -0
- package/assets/docs/tree/component-lookups.doc.mjs +149 -0
- package/assets/docs/tree/components.doc.mjs +23 -0
- package/assets/docs/tree/configuration.doc.mjs +23 -0
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +182 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +118 -0
- package/assets/docs/tree/describe-the-component.doc.mjs +57 -0
- package/assets/docs/tree/docs.doc.mjs +21 -0
- package/assets/docs/tree/document-the-template.doc.mjs +28 -0
- package/assets/docs/tree/document-the-theme.doc.mjs +68 -0
- package/assets/docs/tree/export-template-assets.doc.mjs +147 -0
- package/assets/docs/tree/extend-or-replace.doc.mjs +103 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +106 -0
- package/assets/docs/tree/generate-a-palette.doc.mjs +66 -0
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +105 -0
- package/assets/docs/tree/help.doc.mjs +16 -0
- package/assets/docs/tree/integrations.doc.mjs +25 -451
- package/assets/docs/tree/links.doc.mjs +98 -0
- package/assets/docs/tree/package-and-test.doc.mjs +32 -0
- package/assets/docs/tree/page-template.doc.mjs +71 -0
- package/assets/docs/tree/publishing.doc.mjs +111 -0
- package/assets/docs/tree/quick-start.doc.mjs +272 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +104 -0
- package/assets/docs/tree/replace-a-core-template.doc.mjs +172 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +108 -0
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +59 -0
- package/assets/docs/tree/ship.doc.mjs +16 -0
- package/assets/docs/tree/short-and-findable.doc.mjs +108 -0
- package/assets/docs/tree/single-component.doc.mjs +165 -0
- package/assets/docs/tree/start-a-template.doc.mjs +143 -0
- package/assets/docs/tree/subcomponent.doc.mjs +115 -0
- package/assets/docs/tree/template-assets.doc.mjs +64 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +121 -0
- package/assets/docs/tree/template-fonts.doc.mjs +102 -0
- package/assets/docs/tree/template-grading-rubric.doc.mjs +452 -0
- package/assets/docs/tree/template-icons.doc.mjs +97 -0
- package/assets/docs/tree/template-images-media.doc.mjs +127 -0
- package/assets/docs/tree/template-styles.doc.mjs +93 -0
- package/assets/docs/tree/templates.doc.mjs +34 -0
- package/assets/docs/tree/test-in-an-app.doc.mjs +115 -0
- package/assets/docs/tree/test-template-in-app.doc.mjs +128 -0
- package/assets/docs/tree/themes.doc.mjs +39 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +153 -0
- package/assets/docs/tree/upgrading.doc.mjs +103 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +51 -0
- package/assets/docs/tree/verify-packed-template.doc.mjs +77 -0
- package/assets/docs/tree/versioning.doc.mjs +162 -0
- package/assets/docs/tree/write-good-templates.doc.mjs +64 -0
- package/assets/docs/tree/write-the-template-file.doc.mjs +154 -0
- package/assets/docs/typography.doc.mjs +24 -4
- package/assets/docs/working-with-ai.doc.mjs +30 -22
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- 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-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/config/config.doc.mjs +9 -1
- package/authoring/config/parse.d.mts +2 -0
- package/authoring/config/parse.mjs +19 -0
- package/authoring/config/parse.test.mjs +8 -0
- package/authoring/config/type.ts +11 -0
- package/authoring/discover/discover.doc.d.mts +13 -0
- package/authoring/discover/discover.doc.mjs +138 -0
- package/authoring/discover/parse.d.mts +24 -0
- package/authoring/discover/parse.mjs +128 -0
- package/authoring/discover/parse.test.mjs +124 -0
- package/authoring/discover/type.ts +87 -0
- package/authoring/doctypes/_schema.d.mts +3 -2
- package/authoring/doctypes/_schema.mjs +6 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +4 -2
- package/authoring/doctypes/component/component.doc.mjs +6 -0
- package/authoring/doctypes/component/type.ts +8 -0
- package/authoring/doctypes/reference/reference.doc.mjs +7 -0
- package/authoring/doctypes/reference/type.ts +5 -0
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- 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 +7 -1
- package/authoring/doctypes/template/type.ts +12 -2
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +10 -0
- package/authoring/index.mjs +1 -0
- package/authoring/integration/integration.doc.mjs +12 -10
- package/clients/cli/commands/component/index.mjs +152 -55
- package/clients/cli/commands/component-batch.test.mjs +341 -0
- package/clients/cli/commands/component-ownership.test.mjs +89 -0
- package/clients/cli/commands/component.doc.mjs +27 -9
- package/clients/cli/commands/discover.doc.mjs +53 -9
- package/clients/cli/commands/discover.mjs +393 -118
- package/clients/cli/commands/discover.sources.test.mjs +267 -0
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +60 -17
- package/clients/cli/commands/docs.test.mjs +113 -24
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -2
- package/clients/cli/commands/doctor-integration.test.mjs +53 -0
- package/clients/cli/commands/doctor.doc.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +53 -9
- package/clients/cli/commands/gap-report.doc.mjs +10 -9
- package/clients/cli/commands/init.doc.mjs +9 -6
- package/clients/cli/commands/integration-add.doc.mjs +17 -7
- package/clients/cli/commands/integration-authoring.test.mjs +70 -9
- package/clients/cli/commands/integration-pack.doc.mjs +5 -9
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration-verify.doc.mjs +22 -0
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +76 -43
- package/clients/cli/commands/layout-expand.doc.mjs +3 -1
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +16 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +10 -3
- package/clients/cli/commands/search.mjs +21 -2
- package/clients/cli/commands/search.test.mjs +21 -4
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/template.mjs +19 -5
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/text-json-parity.test.mjs +7 -1
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
- package/clients/cli/commands/theme-palette.doc.mjs +1 -2
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +2 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.doc.mjs +62 -3
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +28 -6
- package/clients/cli/lib/define-command.mjs +28 -4
- package/clients/cli/lib/define-command.test.mjs +54 -0
- package/clients/cli/lib/exit-codes.test.mjs +17 -1
- package/clients/cli/lib/json-shim.mjs +24 -14
- package/clients/cli/lib/manifest.mjs +48 -156
- package/clients/cli/lib/manifest.test.mjs +103 -9
- package/clients/cli/lib/parse-error-format.test.mjs +81 -0
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/agent-docs/agent-docs.test.mjs +3 -2
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +6 -2
- package/foundation/discovery/cli-self-docs.mjs +16 -2
- package/foundation/discovery/cli-self-docs.test.mjs +20 -0
- package/foundation/discovery/docs-discovery.mjs +5 -1
- package/foundation/discovery/docs-discovery.test.mjs +21 -0
- package/foundation/discovery/docs-section-key.d.mts +1 -1
- package/foundation/discovery/docs-section-key.mjs +1 -1
- 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/doc-compiler/doc-loads.test.mjs +5 -4
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/tree.d.mts +4 -0
- package/foundation/doc-compiler/tree.mjs +6 -1
- package/foundation/doc-compiler/tree.test.mjs +65 -14
- package/foundation/integrations/cli-requirement.d.mts +75 -11
- package/foundation/integrations/cli-requirement.mjs +120 -23
- package/foundation/integrations/cli-requirement.test.mjs +141 -9
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/integrations/integrations.d.mts +14 -1
- package/foundation/integrations/integrations.mjs +41 -1
- package/foundation/integrations/integrations.test.mjs +31 -0
- package/foundation/response/batch.type.d.mts +33 -0
- package/foundation/response/batch.type.mjs +34 -0
- package/foundation/response/error-codes.doc.mjs +6 -8
- package/foundation/response/error-codes.test.mjs +30 -5
- package/foundation/response/response-types.doc.d.mts +5 -4
- package/foundation/response/response-types.doc.mjs +49 -19
- package/foundation/response/response-types.doc.test.mjs +23 -0
- package/foundation/response/response.doc.mjs +11 -10
- package/package.json +9 -9
- package/assets/docs/tree/integrations.test.mjs +0 -62
- package/assets/docs/tree/writing-docs.doc.mjs +0 -286
|
@@ -6,16 +6,36 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type DiscoverListResponse = {
|
|
8
8
|
type: "discover.list";
|
|
9
|
+
/**
|
|
10
|
+
* The integrations the project loads.
|
|
11
|
+
*/
|
|
9
12
|
data: DiscoverListEntry[];
|
|
10
13
|
/**
|
|
11
|
-
* Present when the list is empty
|
|
12
|
-
*
|
|
13
|
-
* nothing discovered".
|
|
14
|
+
* Present when the list is empty, and
|
|
15
|
+
* whenever the project has a discover source.
|
|
14
16
|
*/
|
|
15
|
-
meta?:
|
|
16
|
-
configured: boolean;
|
|
17
|
-
} | undefined;
|
|
17
|
+
meta?: DiscoverListMeta | undefined;
|
|
18
18
|
};
|
|
19
|
+
export type DiscoverListMeta = {
|
|
20
|
+
/**
|
|
21
|
+
* Present when `data` is empty, so callers can
|
|
22
|
+
* distinguish "no packages configured" from "configured but nothing
|
|
23
|
+
* discovered".
|
|
24
|
+
*/
|
|
25
|
+
configured?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* What the project could add,
|
|
28
|
+
* one entry per integration, never an alias of a package it has.
|
|
29
|
+
*/
|
|
30
|
+
available?: DiscoverAvailableEntry[] | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* What each discover source did.
|
|
33
|
+
*/
|
|
34
|
+
sources?: DiscoverSourceState[] | undefined;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* An installed integration.
|
|
38
|
+
*/
|
|
19
39
|
export type DiscoverListEntry = {
|
|
20
40
|
name: string;
|
|
21
41
|
category: string;
|
|
@@ -23,13 +43,94 @@ export type DiscoverListEntry = {
|
|
|
23
43
|
version?: string | undefined;
|
|
24
44
|
description?: string | undefined;
|
|
25
45
|
displayName?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Template ids, when it adds any.
|
|
48
|
+
*/
|
|
49
|
+
templates?: string[] | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Doc topic names, when it adds any.
|
|
52
|
+
*/
|
|
53
|
+
docs?: string[] | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Theme slugs, when it adds any.
|
|
56
|
+
*/
|
|
57
|
+
themes?: string[] | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* `<version>/<id>`, when it adds any.
|
|
60
|
+
*/
|
|
61
|
+
codemods?: string[] | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Agent guidance, when a source lists any.
|
|
64
|
+
*/
|
|
65
|
+
agentDocs?: string[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* The latest release a discover source knows.
|
|
68
|
+
*/
|
|
69
|
+
latest?: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A package the project could add.
|
|
73
|
+
*/
|
|
74
|
+
export type DiscoverAvailableEntry = {
|
|
75
|
+
name: string;
|
|
76
|
+
/**
|
|
77
|
+
* Its latest release.
|
|
78
|
+
*/
|
|
79
|
+
version?: string | undefined;
|
|
80
|
+
components: string[];
|
|
81
|
+
templates?: string[] | undefined;
|
|
82
|
+
docs?: string[] | undefined;
|
|
83
|
+
themes?: string[] | undefined;
|
|
84
|
+
codemods?: string[] | undefined;
|
|
85
|
+
agentDocs?: string[] | undefined;
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The integration's other package names.
|
|
89
|
+
*/
|
|
90
|
+
aliases?: string[] | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* The discover source that lists it.
|
|
93
|
+
*/
|
|
94
|
+
source: string;
|
|
95
|
+
};
|
|
96
|
+
export type DiscoverSourceState = {
|
|
97
|
+
name: string;
|
|
98
|
+
/**
|
|
99
|
+
* `astryx.config`, or the integration that exports it.
|
|
100
|
+
*/
|
|
101
|
+
from: string;
|
|
102
|
+
/**
|
|
103
|
+
* `saved`: the live call
|
|
104
|
+
* failed and discover used the copy saved at `savedAt`.
|
|
105
|
+
*/
|
|
106
|
+
status: "fresh" | "saved" | "failed";
|
|
107
|
+
generatedAt?: string | undefined;
|
|
108
|
+
complete?: boolean | undefined;
|
|
109
|
+
savedAt?: string | undefined;
|
|
110
|
+
error?: string | undefined;
|
|
26
111
|
};
|
|
27
112
|
/**
|
|
28
113
|
* astryx --json discover
|
|
29
114
|
*/
|
|
30
115
|
export type DiscoverDetailResponse = {
|
|
31
116
|
type: "discover.detail";
|
|
32
|
-
|
|
117
|
+
/**
|
|
118
|
+
* `installed` says whether the project has the package;
|
|
119
|
+
* `installedVersion` is set when it has another version than the one shown.
|
|
120
|
+
* `install` is the package-manager command that adds a package the project
|
|
121
|
+
* does not have; discover prints it and never runs it. `installedAs` names
|
|
122
|
+
* the package the project has instead, when this one is an alias of it.
|
|
123
|
+
* `versions` (newest first) comes from a discover source.
|
|
124
|
+
*/
|
|
125
|
+
data: DiscoverListEntry & {
|
|
126
|
+
installed: boolean;
|
|
127
|
+
installedVersion?: string;
|
|
128
|
+
aliases?: string[];
|
|
129
|
+
source?: string;
|
|
130
|
+
installedAs?: string;
|
|
131
|
+
install?: string;
|
|
132
|
+
versions?: import("../../authoring/discover/type").DiscoverVersion[];
|
|
133
|
+
};
|
|
33
134
|
};
|
|
34
135
|
/**
|
|
35
136
|
* astryx --json discover
|
|
@@ -39,18 +140,52 @@ export type DiscoverDetailDocResponse = {
|
|
|
39
140
|
data: import("@astryxdesign/cli/authoring").ComponentDoc;
|
|
40
141
|
};
|
|
41
142
|
/**
|
|
42
|
-
* astryx --json discover
|
|
143
|
+
* astryx --json discover
|
|
144
|
+
*/
|
|
145
|
+
export type DiscoverItemResponse = {
|
|
146
|
+
type: "discover.item";
|
|
147
|
+
data: {
|
|
148
|
+
package: string;
|
|
149
|
+
version?: string;
|
|
150
|
+
kind: import("../../authoring/discover/type").DiscoverKind;
|
|
151
|
+
name: string;
|
|
152
|
+
title?: string;
|
|
153
|
+
summary?: string;
|
|
154
|
+
keywords?: string[];
|
|
155
|
+
installed: boolean;
|
|
156
|
+
installedAs?: string;
|
|
157
|
+
install?: string;
|
|
158
|
+
source?: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* astryx --json discover <searchterm>
|
|
43
163
|
*/
|
|
44
164
|
export type DiscoverSearchResponse = {
|
|
45
165
|
type: "discover.search";
|
|
166
|
+
/**
|
|
167
|
+
* `total` is set when `--limit` cut the list.
|
|
168
|
+
*/
|
|
46
169
|
data: {
|
|
47
170
|
query: string;
|
|
48
171
|
matches: DiscoverSearchEntry[];
|
|
172
|
+
total?: number;
|
|
49
173
|
};
|
|
50
174
|
};
|
|
51
175
|
export type DiscoverSearchEntry = {
|
|
52
176
|
package: string;
|
|
177
|
+
/**
|
|
178
|
+
* The item's name, for every kind; for a package
|
|
179
|
+
* match, the package name.
|
|
180
|
+
*/
|
|
53
181
|
component: string;
|
|
182
|
+
kind: import("../../authoring/discover/type").DiscoverKind | "package";
|
|
183
|
+
/**
|
|
184
|
+
* Whether the project has the package.
|
|
185
|
+
*/
|
|
186
|
+
installed: boolean;
|
|
187
|
+
title?: string | undefined;
|
|
188
|
+
summary?: string | undefined;
|
|
54
189
|
};
|
|
55
190
|
/**
|
|
56
191
|
* Options for `discover()`.
|
|
@@ -59,4 +194,8 @@ export type DiscoverOptions = {
|
|
|
59
194
|
components?: boolean | undefined;
|
|
60
195
|
lang?: string | undefined;
|
|
61
196
|
zh?: boolean | undefined;
|
|
197
|
+
type?: import("@astryxdesign/cli/authoring").DiscoverKind | undefined;
|
|
198
|
+
installed?: boolean | undefined;
|
|
199
|
+
available?: boolean | undefined;
|
|
200
|
+
limit?: number | undefined;
|
|
62
201
|
};
|
|
@@ -7,24 +7,37 @@
|
|
|
7
7
|
* Invocation -> type discriminator
|
|
8
8
|
* ------------------------------------------------------------------
|
|
9
9
|
* astryx --json discover -> discover.list
|
|
10
|
-
* astryx --json discover @scope/name
|
|
10
|
+
* astryx --json discover @scope/name[@version] -> discover.detail
|
|
11
11
|
* astryx --json discover @scope/name/Component -> discover.detail.doc
|
|
12
|
-
* astryx --json discover
|
|
13
|
-
* astryx --json discover <searchterm>
|
|
12
|
+
* astryx --json discover @scope/name/<item> -> discover.item
|
|
13
|
+
* astryx --json discover <searchterm> -> discover.search
|
|
14
14
|
* (not found) -> CLIError
|
|
15
|
+
*
|
|
16
|
+
* Fields added for discover sources are additive: every earlier field keeps
|
|
17
|
+
* its meaning.
|
|
15
18
|
*/
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* astryx --json discover
|
|
19
22
|
* @typedef {object} DiscoverListResponse
|
|
20
23
|
* @property {'discover.list'} type
|
|
21
|
-
* @property {DiscoverListEntry[]} data
|
|
22
|
-
* @property {
|
|
23
|
-
*
|
|
24
|
-
* nothing discovered".
|
|
24
|
+
* @property {DiscoverListEntry[]} data The integrations the project loads.
|
|
25
|
+
* @property {DiscoverListMeta} [meta] Present when the list is empty, and
|
|
26
|
+
* whenever the project has a discover source.
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
29
|
/**
|
|
30
|
+
* @typedef {object} DiscoverListMeta
|
|
31
|
+
* @property {boolean} [configured] Present when `data` is empty, so callers can
|
|
32
|
+
* distinguish "no packages configured" from "configured but nothing
|
|
33
|
+
* discovered".
|
|
34
|
+
* @property {DiscoverAvailableEntry[]} [available] What the project could add,
|
|
35
|
+
* one entry per integration, never an alias of a package it has.
|
|
36
|
+
* @property {DiscoverSourceState[]} [sources] What each discover source did.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An installed integration.
|
|
28
41
|
* @typedef {object} DiscoverListEntry
|
|
29
42
|
* @property {string} name
|
|
30
43
|
* @property {string} category
|
|
@@ -32,13 +45,60 @@
|
|
|
32
45
|
* @property {string} [version]
|
|
33
46
|
* @property {string} [description]
|
|
34
47
|
* @property {string} [displayName]
|
|
48
|
+
* @property {string[]} [templates] Template ids, when it adds any.
|
|
49
|
+
* @property {string[]} [docs] Doc topic names, when it adds any.
|
|
50
|
+
* @property {string[]} [themes] Theme slugs, when it adds any.
|
|
51
|
+
* @property {string[]} [codemods] `<version>/<id>`, when it adds any.
|
|
52
|
+
* @property {string[]} [agentDocs] Agent guidance, when a source lists any.
|
|
53
|
+
* @property {string} [latest] The latest release a discover source knows.
|
|
35
54
|
*/
|
|
36
55
|
|
|
37
56
|
/**
|
|
38
|
-
*
|
|
57
|
+
* A package the project could add.
|
|
58
|
+
* @typedef {object} DiscoverAvailableEntry
|
|
59
|
+
* @property {string} name
|
|
60
|
+
* @property {string} [version] Its latest release.
|
|
61
|
+
* @property {string[]} components
|
|
62
|
+
* @property {string[]} [templates]
|
|
63
|
+
* @property {string[]} [docs]
|
|
64
|
+
* @property {string[]} [themes]
|
|
65
|
+
* @property {string[]} [codemods]
|
|
66
|
+
* @property {string[]} [agentDocs]
|
|
67
|
+
* @property {string} [description]
|
|
68
|
+
* @property {string[]} [aliases] The integration's other package names.
|
|
69
|
+
* @property {string} source The discover source that lists it.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @typedef {object} DiscoverSourceState
|
|
74
|
+
* @property {string} name
|
|
75
|
+
* @property {string} from `astryx.config`, or the integration that exports it.
|
|
76
|
+
* @property {'fresh' | 'saved' | 'failed'} status `saved`: the live call
|
|
77
|
+
* failed and discover used the copy saved at `savedAt`.
|
|
78
|
+
* @property {string} [generatedAt]
|
|
79
|
+
* @property {boolean} [complete]
|
|
80
|
+
* @property {string} [savedAt]
|
|
81
|
+
* @property {string} [error]
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* astryx --json discover @scope/name[@version]
|
|
39
86
|
* @typedef {object} DiscoverDetailResponse
|
|
40
87
|
* @property {'discover.detail'} type
|
|
41
|
-
* @property {DiscoverListEntry
|
|
88
|
+
* @property {DiscoverListEntry & {
|
|
89
|
+
* installed: boolean,
|
|
90
|
+
* installedVersion?: string,
|
|
91
|
+
* aliases?: string[],
|
|
92
|
+
* source?: string,
|
|
93
|
+
* installedAs?: string,
|
|
94
|
+
* install?: string,
|
|
95
|
+
* versions?: import('../../authoring/discover/type').DiscoverVersion[],
|
|
96
|
+
* }} data `installed` says whether the project has the package;
|
|
97
|
+
* `installedVersion` is set when it has another version than the one shown.
|
|
98
|
+
* `install` is the package-manager command that adds a package the project
|
|
99
|
+
* does not have; discover prints it and never runs it. `installedAs` names
|
|
100
|
+
* the package the project has instead, when this one is an alias of it.
|
|
101
|
+
* `versions` (newest first) comes from a discover source.
|
|
42
102
|
*/
|
|
43
103
|
|
|
44
104
|
/**
|
|
@@ -49,16 +109,42 @@
|
|
|
49
109
|
*/
|
|
50
110
|
|
|
51
111
|
/**
|
|
52
|
-
* astryx --json discover
|
|
112
|
+
* astryx --json discover @scope/name/<item>, for an item that is not an
|
|
113
|
+
* installed component.
|
|
114
|
+
* @typedef {object} DiscoverItemResponse
|
|
115
|
+
* @property {'discover.item'} type
|
|
116
|
+
* @property {{
|
|
117
|
+
* package: string,
|
|
118
|
+
* version?: string,
|
|
119
|
+
* kind: import('../../authoring/discover/type').DiscoverKind,
|
|
120
|
+
* name: string,
|
|
121
|
+
* title?: string,
|
|
122
|
+
* summary?: string,
|
|
123
|
+
* keywords?: string[],
|
|
124
|
+
* installed: boolean,
|
|
125
|
+
* installedAs?: string,
|
|
126
|
+
* install?: string,
|
|
127
|
+
* source?: string,
|
|
128
|
+
* }} data
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* astryx --json discover <searchterm>
|
|
53
133
|
* @typedef {object} DiscoverSearchResponse
|
|
54
134
|
* @property {'discover.search'} type
|
|
55
|
-
* @property {{query: string, matches: DiscoverSearchEntry[]}} data
|
|
135
|
+
* @property {{query: string, matches: DiscoverSearchEntry[], total?: number}} data
|
|
136
|
+
* `total` is set when `--limit` cut the list.
|
|
56
137
|
*/
|
|
57
138
|
|
|
58
139
|
/**
|
|
59
140
|
* @typedef {object} DiscoverSearchEntry
|
|
60
141
|
* @property {string} package
|
|
61
|
-
* @property {string} component
|
|
142
|
+
* @property {string} component The item's name, for every kind; for a package
|
|
143
|
+
* match, the package name.
|
|
144
|
+
* @property {import('../../authoring/discover/type').DiscoverKind | 'package'} kind
|
|
145
|
+
* @property {boolean} installed Whether the project has the package.
|
|
146
|
+
* @property {string} [title]
|
|
147
|
+
* @property {string} [summary]
|
|
62
148
|
*/
|
|
63
149
|
|
|
64
150
|
/**
|
|
@@ -67,6 +153,10 @@
|
|
|
67
153
|
* @property {boolean} [components]
|
|
68
154
|
* @property {string} [lang]
|
|
69
155
|
* @property {boolean} [zh]
|
|
156
|
+
* @property {import('../../authoring/discover/type').DiscoverKind} [type]
|
|
157
|
+
* @property {boolean} [installed]
|
|
158
|
+
* @property {boolean} [available]
|
|
159
|
+
* @property {number} [limit]
|
|
70
160
|
*/
|
|
71
161
|
|
|
72
162
|
export {};
|
|
@@ -2,14 +2,28 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Build the discover.list response.
|
|
6
|
-
*
|
|
7
|
-
* configured" from "configured but nothing discovered".
|
|
5
|
+
* Build the discover.list response. `data` lists installed integrations. An
|
|
6
|
+
* empty `data` carries `meta.configured`, so callers can distinguish "nothing
|
|
7
|
+
* configured" from "configured but nothing discovered". With discover sources,
|
|
8
|
+
* `meta.available` lists what the project could add and `meta.sources` reports
|
|
9
|
+
* what each source did.
|
|
8
10
|
*
|
|
9
|
-
* @param {import('../
|
|
10
|
-
* @param {{
|
|
11
|
+
* @param {Array<import('../_adapter.mjs').InstalledPackage & {latest?: string}>} packages
|
|
12
|
+
* @param {{
|
|
13
|
+
* configured: boolean,
|
|
14
|
+
* available?: Array<Record<string, unknown>>,
|
|
15
|
+
* sources?: import('../_adapter.mjs').SourceState[],
|
|
16
|
+
* type?: import('../../../authoring/discover/type').DiscoverKind,
|
|
17
|
+
* only?: 'installed' | 'available',
|
|
18
|
+
* }} options
|
|
11
19
|
* @returns {import('../discover.type.mjs').DiscoverListResponse}
|
|
12
20
|
*/
|
|
13
|
-
export function list(packages: import("../
|
|
21
|
+
export function list(packages: Array<import("../_adapter.mjs").InstalledPackage & {
|
|
22
|
+
latest?: string;
|
|
23
|
+
}>, { configured, available, sources, type, only }: {
|
|
14
24
|
configured: boolean;
|
|
25
|
+
available?: Array<Record<string, unknown>>;
|
|
26
|
+
sources?: import("../_adapter.mjs").SourceState[];
|
|
27
|
+
type?: import("../../../authoring/discover/type").DiscoverKind;
|
|
28
|
+
only?: "installed" | "available";
|
|
15
29
|
}): import("../discover.type.mjs").DiscoverListResponse;
|
|
@@ -1,26 +1,59 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file discover.list leaf —
|
|
4
|
+
* @file discover.list leaf — the integrations the project has, and, when it has
|
|
5
|
+
* discover sources, the ones it could add.
|
|
5
6
|
*
|
|
6
|
-
* @position api/discover/list — pure projection of the packages
|
|
7
|
-
* ../_adapter into the discover.list envelope.
|
|
7
|
+
* @position api/discover/list — pure projection of the packages and catalog
|
|
8
|
+
* resolved by ../_adapter into the discover.list envelope.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import {toEntry} from '../_adapter.mjs';
|
|
12
|
+
import {hasKind} from '../_catalog-view.mjs';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
* Build the discover.list response.
|
|
14
|
-
*
|
|
15
|
-
* configured" from "configured but nothing discovered".
|
|
15
|
+
* Build the discover.list response. `data` lists installed integrations. An
|
|
16
|
+
* empty `data` carries `meta.configured`, so callers can distinguish "nothing
|
|
17
|
+
* configured" from "configured but nothing discovered". With discover sources,
|
|
18
|
+
* `meta.available` lists what the project could add and `meta.sources` reports
|
|
19
|
+
* what each source did.
|
|
16
20
|
*
|
|
17
|
-
* @param {import('../
|
|
18
|
-
* @param {{
|
|
21
|
+
* @param {Array<import('../_adapter.mjs').InstalledPackage & {latest?: string}>} packages
|
|
22
|
+
* @param {{
|
|
23
|
+
* configured: boolean,
|
|
24
|
+
* available?: Array<Record<string, unknown>>,
|
|
25
|
+
* sources?: import('../_adapter.mjs').SourceState[],
|
|
26
|
+
* type?: import('../../../authoring/discover/type').DiscoverKind,
|
|
27
|
+
* only?: 'installed' | 'available',
|
|
28
|
+
* }} options
|
|
19
29
|
* @returns {import('../discover.type.mjs').DiscoverListResponse}
|
|
20
30
|
*/
|
|
21
|
-
export function list(packages, {configured}) {
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
export function list(packages, {configured, available, sources, type, only}) {
|
|
32
|
+
const keep = (/** @type {Record<string, unknown>} */ entry) =>
|
|
33
|
+
type == null || hasKind(entry, type);
|
|
34
|
+
const data =
|
|
35
|
+
only === 'available'
|
|
36
|
+
? []
|
|
37
|
+
: packages
|
|
38
|
+
.map(toEntry)
|
|
39
|
+
.filter(entry =>
|
|
40
|
+
keep(/** @type {Record<string, unknown>} */ (entry)),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
/** @type {Record<string, unknown>} */
|
|
44
|
+
const meta = {};
|
|
45
|
+
if (data.length === 0) meta.configured = configured;
|
|
46
|
+
if (sources !== undefined) {
|
|
47
|
+
meta.available = only === 'installed' ? [] : (available ?? []).filter(keep);
|
|
48
|
+
meta.sources = sources;
|
|
24
49
|
}
|
|
25
|
-
return
|
|
50
|
+
return Object.keys(meta).length > 0
|
|
51
|
+
? {
|
|
52
|
+
type: 'discover.list',
|
|
53
|
+
data,
|
|
54
|
+
meta: /** @type {import('../discover.type.mjs').DiscoverListMeta} */ (
|
|
55
|
+
meta
|
|
56
|
+
),
|
|
57
|
+
}
|
|
58
|
+
: {type: 'discover.list', data};
|
|
26
59
|
}
|
|
@@ -57,3 +57,49 @@ describe('discover.list leaf', () => {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
|
+
|
|
61
|
+
describe('discover.list leaf with discover sources', () => {
|
|
62
|
+
const installed = [
|
|
63
|
+
pkg('@acme/widgets', ['Alpha'], {
|
|
64
|
+
version: '1.2.3',
|
|
65
|
+
latest: '1.3.0',
|
|
66
|
+
templates: ['pages/Home'],
|
|
67
|
+
}),
|
|
68
|
+
];
|
|
69
|
+
const available = [
|
|
70
|
+
{name: '@acme/charts', version: '2.0.0', components: ['Chart'], source: 'Acme'},
|
|
71
|
+
{name: '@acme/themes', version: '1.0.0', components: [], themes: ['ocean'], source: 'Acme'},
|
|
72
|
+
];
|
|
73
|
+
const sources = [{name: 'Acme', from: 'astryx.config', status: 'fresh'}];
|
|
74
|
+
|
|
75
|
+
it('lists what is installed in data and what could be added in meta', () => {
|
|
76
|
+
const res = list(installed, {configured: true, available, sources});
|
|
77
|
+
expect(res.data).toEqual([
|
|
78
|
+
{
|
|
79
|
+
name: '@acme/widgets',
|
|
80
|
+
category: '@acme/widgets',
|
|
81
|
+
components: ['Alpha'],
|
|
82
|
+
version: '1.2.3',
|
|
83
|
+
templates: ['pages/Home'],
|
|
84
|
+
latest: '1.3.0',
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
expect(res.meta).toEqual({available, sources});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('keeps one side with only', () => {
|
|
91
|
+
expect(
|
|
92
|
+
list(installed, {configured: true, available, sources, only: 'installed'})
|
|
93
|
+
.meta?.available,
|
|
94
|
+
).toEqual([]);
|
|
95
|
+
const res = list(installed, {configured: true, available, sources, only: 'available'});
|
|
96
|
+
expect(res.data).toEqual([]);
|
|
97
|
+
expect(res.meta).toEqual({configured: true, available, sources});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('keeps only packages that add a kind with type', () => {
|
|
101
|
+
const res = list(installed, {configured: true, available, sources, type: 'theme'});
|
|
102
|
+
expect(res.data).toEqual([]);
|
|
103
|
+
expect(res.meta?.available?.map(e => e.name)).toEqual(['@acme/themes']);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('../_package-scanner.mjs').ScannedPackage} ScannedPackage
|
|
6
|
-
*/
|
|
7
4
|
/**
|
|
8
5
|
* Search all packages for `query` (a free-text term that never starts with
|
|
9
|
-
* `@`). Resolves to a
|
|
10
|
-
*
|
|
11
|
-
* fuzzy suggestions when any exist.
|
|
6
|
+
* `@`). Resolves to a search response when anything matches, even a single
|
|
7
|
+
* item or an exact component name, or throws AstryxError (ERR_NOT_FOUND) —
|
|
8
|
+
* with fuzzy suggestions when any exist.
|
|
12
9
|
*
|
|
13
|
-
* @param {ScannedPackage[]} packages
|
|
10
|
+
* @param {ScannedPackage[]} packages installed packages
|
|
14
11
|
* @param {string} query
|
|
15
|
-
* @param {{
|
|
16
|
-
*
|
|
17
|
-
* import('
|
|
18
|
-
*
|
|
19
|
-
*
|
|
12
|
+
* @param {{
|
|
13
|
+
* items?: SearchItem[],
|
|
14
|
+
* type?: import('../../../authoring/discover/type').DiscoverKind,
|
|
15
|
+
* only?: 'installed' | 'available',
|
|
16
|
+
* limit?: number,
|
|
17
|
+
* }} opts
|
|
18
|
+
* @returns {Promise<import('../discover.type.mjs').DiscoverSearchResponse>}
|
|
20
19
|
*/
|
|
21
|
-
export function search(packages: ScannedPackage[], query: string,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
export function search(packages: ScannedPackage[], query: string, opts: {
|
|
21
|
+
items?: SearchItem[];
|
|
22
|
+
type?: import("../../../authoring/discover/type").DiscoverKind;
|
|
23
|
+
only?: "installed" | "available";
|
|
24
|
+
limit?: number;
|
|
25
|
+
}): Promise<import("../discover.type.mjs").DiscoverSearchResponse>;
|
|
25
26
|
export type ScannedPackage = import("../_package-scanner.mjs").ScannedPackage;
|
|
27
|
+
export type SearchItem = import("../_catalog-view.mjs").SearchItem;
|