@open-mercato/cli 0.9.1-develop.7575.1.8480826a9b → 0.10.0
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/.turbo/turbo-build.log +16 -2
- package/build.mjs +1 -0
- package/dist/agentic/claude-code/mcp.json.example +5 -1
- package/dist/agentic/codex/mcp.json.example +3 -0
- package/dist/agentic/cursor/mcp.json.example +4 -1
- package/dist/agentic/github-copilot/mcp.json.example +5 -1
- package/dist/agentic/guides/ai-workflows.md +1 -0
- package/dist/agentic/guides/architecture.md +9 -5
- package/dist/agentic/guides/customers-calendar.md +57 -0
- package/dist/agentic/guides/extensions.md +2 -0
- package/dist/agentic/guides/module-facts.json +25282 -6677
- package/dist/agentic/guides/module-facts.v2.json +25371 -6677
- package/dist/agentic/guides/module-tool.md +56 -0
- package/dist/agentic/guides/modules/agent_orchestrator/acl-features.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/backend-pages.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/cli-commands.md +4 -0
- package/dist/agentic/guides/modules/agent_orchestrator/contribution-resolutions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/di-registrations-rich.md +32 -32
- package/dist/agentic/guides/modules/agent_orchestrator/di-service-tokens.md +14 -14
- package/dist/agentic/guides/modules/agent_orchestrator/domain-commands.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/events.md +30 -29
- package/dist/agentic/guides/modules/agent_orchestrator/exact-override-targets.md +104 -35
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +17 -6
- package/dist/agentic/guides/modules/agent_orchestrator/setup.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/umes-contributions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/umes-hosts.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/workers.md +2 -0
- package/dist/agentic/guides/modules/ai_assistant/acl-features.md +4 -1
- package/dist/agentic/guides/modules/ai_assistant/ai-tools-mcp-capabilities.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/contribution-resolutions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/di-registrations-rich.md +5 -3
- package/dist/agentic/guides/modules/ai_assistant/di-service-tokens.md +4 -2
- package/dist/agentic/guides/modules/ai_assistant/encryption.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/entities.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/events.md +9 -8
- package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +23 -6
- package/dist/agentic/guides/modules/ai_assistant/index.md +9 -9
- package/dist/agentic/guides/modules/ai_assistant/notifications.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/setup.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/umes-contributions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/workers.md +2 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/attachments/ai-tools-mcp-capabilities.md +11 -0
- package/dist/agentic/guides/modules/attachments/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/attachments/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/attachments/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +6 -6
- package/dist/agentic/guides/modules/attachments/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/attachments/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/attachments/encryption.md +12 -0
- package/dist/agentic/guides/modules/attachments/entities.md +2 -0
- package/dist/agentic/guides/modules/attachments/events.md +3 -3
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +17 -7
- package/dist/agentic/guides/modules/attachments/generator-plugins.md +11 -0
- package/dist/agentic/guides/modules/attachments/index.md +13 -5
- package/dist/agentic/guides/modules/attachments/search-entities.md +11 -0
- package/dist/agentic/guides/modules/attachments/setup.md +1 -1
- package/dist/agentic/guides/modules/attachments/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/attachments/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/attachments/workers.md +2 -0
- package/dist/agentic/guides/modules/audit_logs/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/audit_logs/incoming-installed-contributions.md +12 -0
- package/dist/agentic/guides/modules/audit_logs/index.md +4 -2
- package/dist/agentic/guides/modules/auth/events.md +12 -12
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/events.md +3 -3
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/events.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/acl-features.md +12 -0
- package/dist/agentic/guides/modules/carrier_inpost/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/carrier_inpost/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/exact-override-targets.md +16 -0
- package/dist/agentic/guides/modules/carrier_inpost/index.md +18 -0
- package/dist/agentic/guides/modules/carrier_inpost/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/setup.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/cart/acl-features.md +19 -0
- package/dist/agentic/guides/modules/cart/contribution-resolutions.md +24 -0
- package/dist/agentic/guides/modules/cart/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/cart/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/cart/domain-commands.md +24 -0
- package/dist/agentic/guides/modules/cart/encryption.md +11 -0
- package/dist/agentic/guides/modules/cart/entities.md +15 -0
- package/dist/agentic/guides/modules/cart/events.md +35 -0
- package/dist/agentic/guides/modules/cart/exact-override-targets.md +27 -0
- package/dist/agentic/guides/modules/cart/index.md +25 -0
- package/dist/agentic/guides/modules/cart/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/cart/setup.md +11 -0
- package/dist/agentic/guides/modules/cart/umes-contributions.md +24 -0
- package/dist/agentic/guides/modules/cart/umes-hosts.md +40 -0
- package/dist/agentic/guides/modules/cart/workers.md +14 -0
- package/dist/agentic/guides/modules/catalog/acl-features.md +3 -1
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +3 -3
- package/dist/agentic/guides/modules/catalog/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +2 -0
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +7 -4
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +4 -1
- package/dist/agentic/guides/modules/catalog/entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/events.md +18 -18
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +12 -4
- package/dist/agentic/guides/modules/catalog/index.md +6 -6
- package/dist/agentic/guides/modules/catalog/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +2 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/acl-features.md +12 -0
- package/dist/agentic/guides/modules/channel_smtp/contribution-resolutions.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/di-registrations-rich.md +12 -0
- package/dist/agentic/guides/modules/channel_smtp/exact-override-targets.md +16 -0
- package/dist/agentic/guides/modules/channel_smtp/index.md +18 -0
- package/dist/agentic/guides/modules/channel_smtp/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/setup.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/umes-contributions.md +11 -0
- package/dist/agentic/guides/modules/checkout/events.md +16 -16
- package/dist/agentic/guides/modules/checkout/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/setup.md +1 -1
- package/dist/agentic/guides/modules/checkout/workers.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/events.md +17 -17
- package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
- package/dist/agentic/guides/modules/communication_channels/setup.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/workers.md +2 -2
- package/dist/agentic/guides/modules/configs/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/currencies/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/currencies/events.md +6 -6
- package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/currencies/index.md +4 -2
- package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/modules/customer_accounts/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/customer_accounts/events.md +27 -26
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/incoming-installed-contributions.md +13 -0
- package/dist/agentic/guides/modules/customer_accounts/index.md +6 -4
- package/dist/agentic/guides/modules/customer_accounts/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/customer_groups/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/customer_groups/events.md +7 -7
- package/dist/agentic/guides/modules/customer_groups/incoming-installed-contributions.md +11 -0
- package/dist/agentic/guides/modules/customer_groups/index.md +3 -2
- package/dist/agentic/guides/modules/customer_groups/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +12 -13
- package/dist/agentic/guides/modules/customers/di-registrations-rich.md +6 -3
- package/dist/agentic/guides/modules/customers/encryption.md +1 -1
- package/dist/agentic/guides/modules/customers/events.md +51 -51
- package/dist/agentic/guides/modules/customers/exact-override-targets.md +6 -3
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +12 -8
- package/dist/agentic/guides/modules/customers/index.md +12 -4
- package/dist/agentic/guides/modules/customers/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/customers/umes-hosts.md +48 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/data_sync/di-service-tokens.md +4 -4
- package/dist/agentic/guides/modules/data_sync/events.md +4 -4
- package/dist/agentic/guides/modules/data_sync/exact-override-targets.md +8 -8
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/events.md +5 -5
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/events.md +3 -3
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/directory/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/directory/events.md +6 -6
- package/dist/agentic/guides/modules/directory/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/directory/incoming-installed-contributions.md +4 -0
- package/dist/agentic/guides/modules/directory/index.md +2 -2
- package/dist/agentic/guides/modules/directory/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/documents/contribution-resolutions.md +3 -3
- package/dist/agentic/guides/modules/documents/events.md +15 -15
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/documents/umes-contributions.md +5 -5
- package/dist/agentic/guides/modules/ecommerce/acl-features.md +15 -0
- package/dist/agentic/guides/modules/ecommerce/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/ecommerce/backend-pages.md +12 -0
- package/dist/agentic/guides/modules/ecommerce/contribution-resolutions.md +33 -0
- package/dist/agentic/guides/modules/ecommerce/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/entities.md +13 -0
- package/dist/agentic/guides/modules/ecommerce/events.md +22 -0
- package/dist/agentic/guides/modules/ecommerce/exact-override-targets.md +42 -0
- package/dist/agentic/guides/modules/ecommerce/index.md +26 -0
- package/dist/agentic/guides/modules/ecommerce/notifications.md +12 -0
- package/dist/agentic/guides/modules/ecommerce/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/search-entities.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/setup.md +11 -0
- package/dist/agentic/guides/modules/ecommerce/umes-contributions.md +33 -0
- package/dist/agentic/guides/modules/ecommerce/umes-hosts.md +27 -0
- package/dist/agentic/guides/modules/entities/contribution-resolutions.md +14 -0
- package/dist/agentic/guides/modules/entities/exact-override-targets.md +4 -0
- package/dist/agentic/guides/modules/entities/index.md +5 -3
- package/dist/agentic/guides/modules/entities/umes-contributions.md +14 -0
- package/dist/agentic/guides/modules/eudr/events.md +23 -23
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/events.md +18 -18
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/forms/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/acl-features.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/contribution-resolutions.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/gateway_autopay/index.md +19 -0
- package/dist/agentic/guides/modules/gateway_autopay/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/setup.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/umes-contributions.md +12 -0
- package/dist/agentic/guides/modules/gateway_stripe/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/acl-features.md +12 -0
- package/dist/agentic/guides/modules/gateway_tpay/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/gateway_tpay/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/gateway_tpay/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/gateway_tpay/exact-override-targets.md +20 -0
- package/dist/agentic/guides/modules/gateway_tpay/index.md +20 -0
- package/dist/agentic/guides/modules/gateway_tpay/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/gateway_tpay/setup.md +11 -0
- package/dist/agentic/guides/modules/gateway_tpay/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/gateway_tpay/workers.md +11 -0
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/events.md +13 -13
- package/dist/agentic/guides/modules/inbox_ops/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +9 -8
- package/dist/agentic/guides/modules/integrations/di-service-tokens.md +5 -4
- package/dist/agentic/guides/modules/integrations/events.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +12 -10
- package/dist/agentic/guides/modules/integrations/incoming-installed-contributions.md +11 -0
- package/dist/agentic/guides/modules/integrations/index.md +3 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/messages/entities.md +2 -0
- package/dist/agentic/guides/modules/messages/events.md +9 -9
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/messages/umes-hosts.md +2 -0
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/di-registrations-rich.md +4 -4
- package/dist/agentic/guides/modules/payment_gateways/di-service-tokens.md +2 -2
- package/dist/agentic/guides/modules/payment_gateways/events.md +9 -9
- package/dist/agentic/guides/modules/payment_gateways/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/setup.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/events.md +3 -3
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/planner/events.md +6 -6
- package/dist/agentic/guides/modules/planner/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/planner/setup.md +1 -1
- package/dist/agentic/guides/modules/portal/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/portal/frontend-pages.md +1 -0
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/portal/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/progress/events.md +6 -6
- package/dist/agentic/guides/modules/progress/index.md +2 -2
- package/dist/agentic/guides/modules/promotions/acl-features.md +18 -0
- package/dist/agentic/guides/modules/promotions/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/promotions/backend-pages.md +16 -0
- package/dist/agentic/guides/modules/promotions/contribution-resolutions.md +18 -0
- package/dist/agentic/guides/modules/promotions/di-registrations-rich.md +15 -0
- package/dist/agentic/guides/modules/promotions/di-service-tokens.md +15 -0
- package/dist/agentic/guides/modules/promotions/domain-commands.md +23 -0
- package/dist/agentic/guides/modules/promotions/entities.md +19 -0
- package/dist/agentic/guides/modules/promotions/events.md +24 -0
- package/dist/agentic/guides/modules/promotions/exact-override-targets.md +41 -0
- package/dist/agentic/guides/modules/promotions/index.md +26 -0
- package/dist/agentic/guides/modules/promotions/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/promotions/setup.md +11 -0
- package/dist/agentic/guides/modules/promotions/umes-contributions.md +18 -0
- package/dist/agentic/guides/modules/promotions/umes-hosts.md +33 -0
- package/dist/agentic/guides/modules/promotions/workers.md +12 -0
- package/dist/agentic/guides/modules/push_notifications/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/push_notifications/events.md +2 -2
- package/dist/agentic/guides/modules/push_notifications/index.md +3 -2
- package/dist/agentic/guides/modules/query_index/events.md +8 -8
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/events.md +10 -10
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/events.md +15 -15
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/active-extension-bindings.md +5 -0
- package/dist/agentic/guides/modules/sales/di-registrations-rich.md +30 -30
- package/dist/agentic/guides/modules/sales/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/sales/domain-commands.md +1 -0
- package/dist/agentic/guides/modules/sales/events.md +44 -44
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +30 -30
- package/dist/agentic/guides/modules/sales/incoming-installed-contributions.md +3 -1
- package/dist/agentic/guides/modules/sales/index.md +4 -4
- package/dist/agentic/guides/modules/sales/umes-hosts.md +5 -2
- package/dist/agentic/guides/modules/scheduler/events.md +4 -4
- package/dist/agentic/guides/modules/scheduler/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/workers.md +1 -1
- package/dist/agentic/guides/modules/search/events.md +1 -1
- package/dist/agentic/guides/modules/search/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/search/workers.md +1 -1
- package/dist/agentic/guides/modules/security/contribution-resolutions.md +2 -0
- package/dist/agentic/guides/modules/security/events.md +22 -21
- package/dist/agentic/guides/modules/security/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/security/index.md +2 -2
- package/dist/agentic/guides/modules/security/notifications.md +1 -0
- package/dist/agentic/guides/modules/security/umes-contributions.md +2 -0
- package/dist/agentic/guides/modules/security/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/events.md +7 -7
- package/dist/agentic/guides/modules/shipping_carriers/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/umes-contributions.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/workers.md +1 -1
- package/dist/agentic/guides/modules/sso/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/sso/di-service-tokens.md +7 -6
- package/dist/agentic/guides/modules/sso/events.md +12 -12
- package/dist/agentic/guides/modules/sso/exact-override-targets.md +8 -7
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/active-extension-bindings.md +5 -3
- package/dist/agentic/guides/modules/staff/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/staff/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/staff/contribution-resolutions.md +23 -0
- package/dist/agentic/guides/modules/staff/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/staff/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/staff/encryption.md +1 -0
- package/dist/agentic/guides/modules/staff/entities.md +3 -0
- package/dist/agentic/guides/modules/staff/events.md +75 -70
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +99 -12
- package/dist/agentic/guides/modules/staff/frontend-pages.md +3 -0
- package/dist/agentic/guides/modules/staff/index.md +26 -13
- package/dist/agentic/guides/modules/staff/notifications.md +4 -0
- package/dist/agentic/guides/modules/staff/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/staff/setup.md +1 -1
- package/dist/agentic/guides/modules/staff/umes-contributions.md +24 -1
- package/dist/agentic/guides/modules/staff/umes-hosts.md +9 -0
- package/dist/agentic/guides/modules/storage_s3/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/modules/storage_s3/di-service-tokens.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/translations/events.md +2 -2
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/events.md +14 -14
- package/dist/agentic/guides/modules/warranty_claims/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/warranty_claims/index.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/setup.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/workers.md +1 -1
- package/dist/agentic/guides/modules/webhooks/events.md +12 -12
- package/dist/agentic/guides/modules/webhooks/exact-override-targets.md +2 -2
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/workers.md +2 -2
- package/dist/agentic/guides/modules/wms/acl-features.md +3 -1
- package/dist/agentic/guides/modules/wms/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/wms/contribution-resolutions.md +7 -1
- package/dist/agentic/guides/modules/wms/custom-entities.md +3 -0
- package/dist/agentic/guides/modules/wms/domain-commands.md +16 -0
- package/dist/agentic/guides/modules/wms/entities.md +3 -0
- package/dist/agentic/guides/modules/wms/events.md +40 -28
- package/dist/agentic/guides/modules/wms/exact-override-targets.md +10 -0
- package/dist/agentic/guides/modules/wms/host-extension-points.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +14 -10
- package/dist/agentic/guides/modules/wms/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/wms/search-entities.md +2 -0
- package/dist/agentic/guides/modules/wms/umes-contributions.md +7 -1
- package/dist/agentic/guides/modules/wms/umes-diagnostics.md +2 -0
- package/dist/agentic/guides/modules/wms/umes-hosts.md +54 -0
- package/dist/agentic/guides/modules/workflows/contribution-resolutions.md +3 -3
- package/dist/agentic/guides/modules/workflows/events.md +32 -32
- package/dist/agentic/guides/modules/workflows/exact-override-targets.md +2 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/workflows/setup.md +1 -1
- package/dist/agentic/guides/modules/workflows/umes-contributions.md +3 -3
- package/dist/agentic/guides/production-deployment.md +82 -0
- package/dist/agentic/guides/reference-module-facts.json +819 -33
- package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +2 -0
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +15 -4
- package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -2
- package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
- package/dist/agentic/guides/reference-modules/example/events.md +5 -5
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +21 -11
- package/dist/agentic/guides/reference-modules/example/index.md +4 -4
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +16 -5
- package/dist/agentic/guides/reference-modules/example/umes-hosts.md +1 -0
- package/dist/agentic/guides/template-tool.md +38 -0
- package/dist/agentic/guides/testing-debugging.md +2 -2
- package/dist/agentic/guides/upstream/AGENTS.md +3 -3
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +343 -206
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +16 -10
- package/dist/agentic/shared/ai/harness/README.md +10 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +639 -44
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +63 -3
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +516 -8
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/qa/tests/playwright.config.ts +1 -0
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.9.0-to-0.10.0/SKILL.md +269 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +6 -5
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +27 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +1 -1
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +13 -1
- package/dist/agentic/shared/ai/skills/om-find-module/SKILL.md +52 -0
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +1 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +1 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +1 -1
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +2 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +7 -5
- package/dist/agentic/shared/ai/skills/om-setup-ci/SKILL.md +42 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/setup-ci.mjs +525 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/verify-semgrep-rules.mjs +54 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/docs/README.md +463 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/gitleaks/action.yml +25 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/playwright/action.yml +31 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/setup/action.yml +55 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/dependabot.yml +27 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/audit.yml +193 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/ci.yml +477 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/codeql.yml +63 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/security.yml +254 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci-allowlist.json +4 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci.mjs +283 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.fixture.txt +89 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.yml +146 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/time-bomb-scanner.mjs +286 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/zap-rules.tsv +11 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +1 -1
- package/dist/agentic/shared/ai/skills/tiers.json +5 -2
- package/dist/agentic/shared/ai/trackers/github.md +314 -44
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +78 -9
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +9 -7
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +3 -3
- package/dist/bin.js +2 -0
- package/dist/bin.js.map +2 -2
- package/dist/i18n/de.json +4 -0
- package/dist/i18n/en.json +4 -0
- package/dist/i18n/es.json +4 -0
- package/dist/i18n/ko.json +4 -0
- package/dist/i18n/pl.json +4 -0
- package/dist/lib/__fixtures__/module-search/built-in.json +235 -0
- package/dist/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/dist/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/dist/lib/__fixtures__/official-module-package/package.json +33 -0
- package/dist/lib/__integration__/TC-INT-007.spec.js +241 -21
- package/dist/lib/__integration__/TC-INT-007.spec.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-009.spec.js +267 -0
- package/dist/lib/__integration__/TC-INT-009.spec.js.map +7 -0
- package/dist/lib/db/commands.js +2 -0
- package/dist/lib/db/commands.js.map +2 -2
- package/dist/lib/db/numeric-snapshots.js +13 -0
- package/dist/lib/db/numeric-snapshots.js.map +7 -0
- package/dist/lib/eject.js +25 -9
- package/dist/lib/eject.js.map +2 -2
- package/dist/lib/env-example.js +25 -0
- package/dist/lib/env-example.js.map +7 -0
- package/dist/lib/generate-child-process.js +23 -0
- package/dist/lib/generate-child-process.js.map +7 -0
- package/dist/lib/generators/ast/imports.js +9 -4
- package/dist/lib/generators/ast/imports.js.map +2 -2
- package/dist/lib/generators/entity-ids.js +12 -12
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/extensions/agent-files.js +119 -4
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/module-di.js +8 -9
- package/dist/lib/generators/module-di.js.map +2 -2
- package/dist/lib/generators/module-entities.js +8 -9
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-facts.js +7 -5
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +6 -1
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-package-sources.js +6 -4
- package/dist/lib/generators/module-package-sources.js.map +2 -2
- package/dist/lib/generators/module-registry.js +157 -144
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +9 -2
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/source-exports.js +73 -0
- package/dist/lib/generators/source-exports.js.map +7 -0
- package/dist/lib/in-process-generate-watcher.js +11 -5
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/lib/init-existing-database.js +26 -0
- package/dist/lib/init-existing-database.js.map +7 -0
- package/dist/lib/init-secrets.js +33 -1
- package/dist/lib/init-secrets.js.map +2 -2
- package/dist/lib/init-summary.js +44 -0
- package/dist/lib/init-summary.js.map +7 -0
- package/dist/lib/module-github.js +98 -0
- package/dist/lib/module-github.js.map +7 -0
- package/dist/lib/module-identity.js +131 -0
- package/dist/lib/module-identity.js.map +7 -0
- package/dist/lib/module-inspection.js +124 -0
- package/dist/lib/module-inspection.js.map +7 -0
- package/dist/lib/module-install.js +186 -19
- package/dist/lib/module-install.js.map +3 -3
- package/dist/lib/module-package.js +205 -15
- package/dist/lib/module-package.js.map +2 -2
- package/dist/lib/module-search-args.js +97 -0
- package/dist/lib/module-search-args.js.map +7 -0
- package/dist/lib/module-search-index.js +681 -0
- package/dist/lib/module-search-index.js.map +7 -0
- package/dist/lib/module-search.js +727 -0
- package/dist/lib/module-search.js.map +7 -0
- package/dist/lib/modules-config.js +210 -66
- package/dist/lib/modules-config.js.map +2 -2
- package/dist/lib/queue-worker-supervisor.js +3 -0
- package/dist/lib/queue-worker-supervisor.js.map +2 -2
- package/dist/lib/resolver.js +54 -35
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/telemetry-init.js +1 -1
- package/dist/lib/telemetry-init.js.map +1 -1
- package/dist/lib/testing/integration-discovery.js +61 -21
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +35 -4
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +209 -79
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +1 -1
- package/package.json +9 -9
- package/src/__tests__/documented-queue-subcommands.test.ts +63 -0
- package/src/__tests__/mercato.test.ts +905 -0
- package/src/bin.ts +5 -0
- package/src/i18n/de.json +4 -0
- package/src/i18n/en.json +4 -0
- package/src/i18n/es.json +4 -0
- package/src/i18n/ko.json +4 -0
- package/src/i18n/pl.json +4 -0
- package/src/lib/__fixtures__/module-search/README.md +97 -0
- package/src/lib/__fixtures__/module-search/built-in.json +235 -0
- package/src/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/src/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/src/lib/__fixtures__/official-module-package/dist/modules/test_package/widgets/injection/test/widget.js +1 -0
- package/src/lib/__integration__/TC-INT-007.spec.ts +259 -21
- package/src/lib/__integration__/TC-INT-009.spec.ts +279 -0
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +4 -0
- package/src/lib/__tests__/bin-next-subpath-hook.test.ts +25 -0
- package/src/lib/__tests__/eject.test.ts +98 -4
- package/src/lib/__tests__/env-example.test.ts +58 -0
- package/src/lib/__tests__/generate-child-process.test.ts +185 -0
- package/src/lib/__tests__/generate-quiet-entrypoint.test.ts +47 -0
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +91 -0
- package/src/lib/__tests__/init-existing-database.test.ts +27 -0
- package/src/lib/__tests__/init-secrets.test.ts +85 -1
- package/src/lib/__tests__/init-summary.test.ts +50 -0
- package/src/lib/__tests__/module-github.test.ts +108 -0
- package/src/lib/__tests__/module-identity.test.ts +144 -0
- package/src/lib/__tests__/module-inspection.test.ts +195 -0
- package/src/lib/__tests__/module-install.test.ts +614 -19
- package/src/lib/__tests__/module-package.test.ts +154 -0
- package/src/lib/__tests__/module-search.test.ts +1040 -0
- package/src/lib/__tests__/modules-config.test.ts +453 -1
- package/src/lib/__tests__/queue-worker-supervisor.test.ts +145 -1
- package/src/lib/__tests__/resolver.enterprise.test.ts +60 -0
- package/src/lib/__tests__/resolver.packages.test.ts +29 -0
- package/src/lib/__tests__/telemetry-init.test.ts +1 -1
- package/src/lib/db/__tests__/identifiers.test.ts +19 -0
- package/src/lib/db/__tests__/numeric-snapshots.test.ts +79 -0
- package/src/lib/db/commands.ts +2 -0
- package/src/lib/db/numeric-snapshots.ts +12 -0
- package/src/lib/eject.ts +28 -10
- package/src/lib/env-example.ts +31 -0
- package/src/lib/generate-child-process.ts +35 -0
- package/src/lib/generators/__tests__/agent-files-extension.test.ts +178 -0
- package/src/lib/generators/__tests__/attachment-access.test.ts +70 -0
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +42 -18
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +9 -8
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +5 -1
- package/src/lib/generators/__tests__/module-id-collisions.test.ts +146 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +8 -2
- package/src/lib/generators/__tests__/module-package-sources.test.ts +26 -6
- package/src/lib/generators/__tests__/module-registry-requires-enforcement.test.ts +130 -0
- package/src/lib/generators/__tests__/module-requirements.test.ts +56 -0
- package/src/lib/generators/__tests__/module-requires.test.ts +242 -0
- package/src/lib/generators/__tests__/module-subset.test.ts +103 -0
- package/src/lib/generators/__tests__/openapi.test.ts +24 -0
- package/src/lib/generators/ast/imports.ts +14 -4
- package/src/lib/generators/entity-ids.ts +12 -12
- package/src/lib/generators/extensions/agent-files.ts +154 -4
- package/src/lib/generators/module-di.ts +8 -9
- package/src/lib/generators/module-entities.ts +8 -9
- package/src/lib/generators/module-facts.ts +9 -5
- package/src/lib/generators/module-override-targets.ts +6 -1
- package/src/lib/generators/module-package-sources.ts +7 -5
- package/src/lib/generators/module-registry.ts +224 -182
- package/src/lib/generators/openapi.ts +10 -2
- package/src/lib/generators/source-exports.ts +93 -0
- package/src/lib/in-process-generate-watcher.ts +14 -6
- package/src/lib/init-existing-database.ts +24 -0
- package/src/lib/init-secrets.ts +37 -0
- package/src/lib/init-summary.ts +54 -0
- package/src/lib/module-github.ts +109 -0
- package/src/lib/module-identity.ts +145 -0
- package/src/lib/module-inspection.ts +133 -0
- package/src/lib/module-install.ts +214 -22
- package/src/lib/module-package.ts +243 -16
- package/src/lib/module-search-args.ts +116 -0
- package/src/lib/module-search-index.ts +1037 -0
- package/src/lib/module-search.ts +1013 -0
- package/src/lib/modules-config.ts +278 -80
- package/src/lib/queue-worker-supervisor.ts +3 -0
- package/src/lib/resolver.ts +58 -40
- package/src/lib/telemetry-init.ts +1 -1
- package/src/lib/testing/__tests__/integration-discovery.test.ts +89 -0
- package/src/lib/testing/__tests__/integration.test.ts +55 -0
- package/src/lib/testing/integration-discovery.ts +101 -32
- package/src/lib/testing/integration.ts +36 -4
- package/src/mercato.ts +267 -94
- package/src/types/cross-spawn.d.ts +2 -2
- package/src/lib/__tests__/agentic-build-artifacts.test.ts +0 -28
|
@@ -0,0 +1,1037 @@
|
|
|
1
|
+
// Ranking and lookups behind `mercato module search|info`, kept identical to the Open Mercato Modules catalog
|
|
2
|
+
// (https://modules.openmercato.com, `lib/core/search.ts` and `lib/core/refs.ts`): same MiniSearch options, tokenizer,
|
|
3
|
+
// stop words, boosts and built-in rules, so the CLI, the catalog site and its MCP server rank the same way.
|
|
4
|
+
// `__tests__/module-search.test.ts` holds this file to the catalog's own output on a fixture built from real data.
|
|
5
|
+
import MiniSearch, { type Options, type SearchResult } from 'minisearch'
|
|
6
|
+
import { satisfies } from 'semver'
|
|
7
|
+
|
|
8
|
+
export type CellStatus = string
|
|
9
|
+
export type OriginType = 'official' | 'community' | '3rd-party'
|
|
10
|
+
export type EntryKind = 'module' | 'provider' | 'library' | 'tool'
|
|
11
|
+
export type LicenseKind = 'osi' | 'proprietary' | 'enterprise' | 'unknown'
|
|
12
|
+
export type ReceiptSource = 'ci' | 'preview'
|
|
13
|
+
|
|
14
|
+
export type AgentPolicy = {
|
|
15
|
+
decision: 'allow' | 'ask' | 'refuse'
|
|
16
|
+
reasons: { code: string; text: string }[]
|
|
17
|
+
until?: string
|
|
18
|
+
consentText?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CatalogLine = {
|
|
22
|
+
key: string
|
|
23
|
+
version: string
|
|
24
|
+
source: 'latest' | 'previous' | 'develop'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type AnatomyLists = {
|
|
28
|
+
aclFeatures?: string[]
|
|
29
|
+
eventsEmitted?: string[]
|
|
30
|
+
eventsConsumed?: string[]
|
|
31
|
+
env?: string[]
|
|
32
|
+
hosts?: string[]
|
|
33
|
+
tables?: string[]
|
|
34
|
+
publicRoutes?: string[]
|
|
35
|
+
credentials?: { key: string; type?: string; required?: boolean }[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type AnatomySummary = {
|
|
39
|
+
version: string
|
|
40
|
+
counts?: Record<string, number | null>
|
|
41
|
+
lists?: AnatomyLists
|
|
42
|
+
callout?: string | null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type CellSummary = { status: CellStatus; at: string | null; moduleVersion?: string | null }
|
|
46
|
+
|
|
47
|
+
export type BuiltFor = { range: string | null; kind: string; lines: string[]; ranges?: Record<string, string> }
|
|
48
|
+
|
|
49
|
+
export type CatalogEntry = {
|
|
50
|
+
locator: string
|
|
51
|
+
path: string
|
|
52
|
+
npm: string | null
|
|
53
|
+
title: string
|
|
54
|
+
summary: string
|
|
55
|
+
whenToUse: string
|
|
56
|
+
type: OriginType
|
|
57
|
+
kind: EntryKind
|
|
58
|
+
category: string
|
|
59
|
+
tags: string[]
|
|
60
|
+
providers: { name: string; label: string }[]
|
|
61
|
+
moduleIds: string[]
|
|
62
|
+
/** What the package needs; an adapter's catalog libraries among them join its `yarn add` (`peerLibrarySpecs`). */
|
|
63
|
+
requires?: { raw: string; resolvesTo?: string | null }[]
|
|
64
|
+
renamedFrom: string[]
|
|
65
|
+
status: string
|
|
66
|
+
listed: boolean
|
|
67
|
+
featured: boolean
|
|
68
|
+
license: { spdx: string | null; kind: LicenseKind; mismatch?: boolean }
|
|
69
|
+
version: {
|
|
70
|
+
latest: string | null
|
|
71
|
+
preview: string | null
|
|
72
|
+
installableFrom: string | null
|
|
73
|
+
gitRef: string | null
|
|
74
|
+
recommended: Record<string, string | null>
|
|
75
|
+
}
|
|
76
|
+
compat: {
|
|
77
|
+
lines: Record<string, CellSummary>
|
|
78
|
+
verifiedOn: string[]
|
|
79
|
+
builtFor?: BuiltFor
|
|
80
|
+
inPresets?: string[]
|
|
81
|
+
inEmptyPreset?: string[]
|
|
82
|
+
ships?: Record<string, string>
|
|
83
|
+
isolation?: Record<string, { status: CellStatus; moduleVersion: string | null }>
|
|
84
|
+
}
|
|
85
|
+
anatomy: AnatomySummary | null
|
|
86
|
+
signals?: {
|
|
87
|
+
supplyChain?: { status: string; reasons: string[] }
|
|
88
|
+
hygiene?: { status: string; failing: string[] }
|
|
89
|
+
anatomy?: string
|
|
90
|
+
}
|
|
91
|
+
tier: 'listed' | 'verified' | null
|
|
92
|
+
quality: unknown
|
|
93
|
+
agentPolicy: Record<string, AgentPolicy>
|
|
94
|
+
install: { cli: string; cmm?: string; needsAllowThirdParty?: boolean; moduleFlag: string | null }
|
|
95
|
+
links: { page: string; md: string; json?: string; npm?: string | null; repo?: string | null }
|
|
96
|
+
_meta?: Record<string, unknown>
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type CatalogIndex = {
|
|
100
|
+
schemaVersion: 1
|
|
101
|
+
generatedAt: string
|
|
102
|
+
dataVersion: string
|
|
103
|
+
site: string
|
|
104
|
+
lines: CatalogLine[]
|
|
105
|
+
entries: CatalogEntry[]
|
|
106
|
+
dataAsOf?: { source?: ReceiptSource | null }
|
|
107
|
+
builtIn?: { coreVersion: string; count: number; href: string }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type BuiltInModule = {
|
|
111
|
+
id: string
|
|
112
|
+
title: string
|
|
113
|
+
description: string
|
|
114
|
+
category: string
|
|
115
|
+
requires?: string[]
|
|
116
|
+
inPresets?: string[]
|
|
117
|
+
inEmptyPreset?: string[]
|
|
118
|
+
anatomy: AnatomySummary | null
|
|
119
|
+
install: string
|
|
120
|
+
page: string
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type BuiltInIndex = {
|
|
124
|
+
schemaVersion: 1
|
|
125
|
+
coreVersion: string
|
|
126
|
+
generatedAt: string
|
|
127
|
+
modules: BuiltInModule[]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type ModuleCard = {
|
|
131
|
+
locator: string
|
|
132
|
+
path: string
|
|
133
|
+
title: string
|
|
134
|
+
summary: string
|
|
135
|
+
whenToUse: string
|
|
136
|
+
type: OriginType
|
|
137
|
+
kind: EntryKind
|
|
138
|
+
category: string
|
|
139
|
+
license: { spdx: string | null; kind: LicenseKind }
|
|
140
|
+
tier: 'listed' | 'verified' | null
|
|
141
|
+
omQuality: boolean
|
|
142
|
+
verifiedOn: string[]
|
|
143
|
+
line: string | null
|
|
144
|
+
status: CellStatus | null
|
|
145
|
+
agentPolicy: AgentPolicy | null
|
|
146
|
+
installableFrom: string | null
|
|
147
|
+
install: string
|
|
148
|
+
matchedOn: string[]
|
|
149
|
+
card: string
|
|
150
|
+
presetNote?: string
|
|
151
|
+
installEmptyPreset?: string | null
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type BuiltInCard = {
|
|
155
|
+
id: string
|
|
156
|
+
title: string
|
|
157
|
+
description: string
|
|
158
|
+
category: string
|
|
159
|
+
enabled: boolean | null
|
|
160
|
+
install: string
|
|
161
|
+
page: string
|
|
162
|
+
matchedOn: string[]
|
|
163
|
+
presetNote: string | null
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export type SearchModulesInput = {
|
|
167
|
+
query?: string
|
|
168
|
+
omVersion?: string
|
|
169
|
+
category?: string
|
|
170
|
+
type?: OriginType[]
|
|
171
|
+
kind?: (EntryKind | 'built-in')[]
|
|
172
|
+
verifiedOnly?: boolean
|
|
173
|
+
verifiedModulesOnly?: boolean
|
|
174
|
+
includeBuiltIn?: boolean
|
|
175
|
+
includeExamples?: boolean
|
|
176
|
+
emits?: string
|
|
177
|
+
consumes?: string
|
|
178
|
+
provider?: string
|
|
179
|
+
limit?: number
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type SearchModulesOutput = {
|
|
183
|
+
results: ModuleCard[]
|
|
184
|
+
builtIn: BuiltInCard[]
|
|
185
|
+
total: number
|
|
186
|
+
line: string | null
|
|
187
|
+
dataVersion: string
|
|
188
|
+
generatedAt: string
|
|
189
|
+
receiptSource?: ReceiptSource | null
|
|
190
|
+
didYouMean?: string
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const SEARCH_BOOST = {
|
|
194
|
+
title: 3,
|
|
195
|
+
npm: 3,
|
|
196
|
+
summary: 2,
|
|
197
|
+
whenToUse: 2,
|
|
198
|
+
providers: 2,
|
|
199
|
+
tags: 1.5,
|
|
200
|
+
aliases: 1.5,
|
|
201
|
+
renamedFrom: 1,
|
|
202
|
+
category: 1,
|
|
203
|
+
anatomy: 1,
|
|
204
|
+
} as const
|
|
205
|
+
type SearchField = keyof typeof SEARCH_BOOST
|
|
206
|
+
const SEARCH_FIELDS = Object.keys(SEARCH_BOOST) as SearchField[]
|
|
207
|
+
|
|
208
|
+
export const ALIASES_META_KEY = 'com.openmercato.modules/aliases'
|
|
209
|
+
export const INSTALLABLE_META_KEY = 'com.openmercato.modules/installable'
|
|
210
|
+
export const BUILTIN_MAX = 5
|
|
211
|
+
export const BUILTIN_RATIO = 0.5
|
|
212
|
+
export const BOOST_VERIFIED = 0.15
|
|
213
|
+
export const BOOST_OFFICIAL = 0.1
|
|
214
|
+
export const MIN_AND_RESULTS = 3
|
|
215
|
+
/** An OR hit that matched no query word as typed and scores below this share of the best hit is dropped. */
|
|
216
|
+
export const WEAK_HIT_RATIO = 0.2
|
|
217
|
+
export const SEARCH_MAX_LIMIT = 20
|
|
218
|
+
export const SEARCH_DEFAULTS = { verifiedOnly: false, includeBuiltIn: true, includeExamples: false, limit: 10 } as const
|
|
219
|
+
export const CORE_PACKAGE = '@open-mercato/core'
|
|
220
|
+
export const ENTERPRISE_PACKAGE = '@open-mercato/enterprise'
|
|
221
|
+
export const ENTERPRISE_ENABLE_STEP = 'echo OM_ENABLE_ENTERPRISE_MODULES=true >> .env'
|
|
222
|
+
export const PREVIEW_LINE =
|
|
223
|
+
"Receipts: Preview run in Docker on the maintainer's machine, not CI. The first nightly CI run replaces it."
|
|
224
|
+
const VERDICT_STATES: ReadonlySet<CellStatus> = new Set(['verified', 'broken', 'harness-red', 'infra-error'])
|
|
225
|
+
|
|
226
|
+
const STOPWORDS = new Set([
|
|
227
|
+
'a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', 'for', 'from', 'i', 'in', 'into', 'is', 'it', 'its', 'me',
|
|
228
|
+
'module', 'modules', 'my', 'of', 'on', 'or', 'our', 'that', 'the', 'this', 'to', 'via', 'we', 'with', 'you', 'your',
|
|
229
|
+
'can', 'do', 'does', 'how', 'need', 'needs', 'use', 'used', 'uses', 'want', 'wants', 'what', 'when', 'which',
|
|
230
|
+
])
|
|
231
|
+
|
|
232
|
+
export function tokenize(text: string): string[] {
|
|
233
|
+
const lower = text.toLowerCase()
|
|
234
|
+
const tokens = lower.split(/[^a-z0-9*]+/).filter((token) => token !== '')
|
|
235
|
+
for (const match of lower.matchAll(/[a-z0-9]+(?:[._-][a-z0-9*]+)+/g)) tokens.push(match[0])
|
|
236
|
+
return tokens
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function processTerm(term: string): string | null {
|
|
240
|
+
return term.length < 2 || STOPWORDS.has(term) ? null : term
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export type SearchDoc = {
|
|
244
|
+
id: string
|
|
245
|
+
group: 'module' | 'builtin'
|
|
246
|
+
title: string
|
|
247
|
+
npm: string
|
|
248
|
+
summary: string
|
|
249
|
+
whenToUse: string
|
|
250
|
+
providers: string
|
|
251
|
+
tags: string
|
|
252
|
+
aliases: string
|
|
253
|
+
renamedFrom: string
|
|
254
|
+
category: string
|
|
255
|
+
anatomy: string
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const SEARCH_OPTIONS: Options<SearchDoc> = {
|
|
259
|
+
idField: 'id',
|
|
260
|
+
fields: SEARCH_FIELDS,
|
|
261
|
+
storeFields: ['group'],
|
|
262
|
+
tokenize,
|
|
263
|
+
processTerm,
|
|
264
|
+
searchOptions: { prefix: true, fuzzy: 0.2, boost: { ...SEARCH_BOOST } },
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export type AnatomyIds = {
|
|
268
|
+
event: string[]
|
|
269
|
+
emits: string[]
|
|
270
|
+
consumes: string[]
|
|
271
|
+
entity: string[]
|
|
272
|
+
permission: string[]
|
|
273
|
+
env: string[]
|
|
274
|
+
host: string[]
|
|
275
|
+
setting: string[]
|
|
276
|
+
module: string[]
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export type ModuleMeta = {
|
|
280
|
+
entry: CatalogEntry
|
|
281
|
+
example: boolean
|
|
282
|
+
omQuality: boolean
|
|
283
|
+
ids: AnatomyIds
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export type BuiltInMeta = {
|
|
287
|
+
module: BuiltInModule
|
|
288
|
+
ids: AnatomyIds
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export type CatalogSearcher = {
|
|
292
|
+
miniSearch: MiniSearch<SearchDoc>
|
|
293
|
+
index: CatalogIndex
|
|
294
|
+
builtIn: BuiltInIndex | null
|
|
295
|
+
site: string
|
|
296
|
+
modules: Map<string, ModuleMeta>
|
|
297
|
+
builtInModules: Map<string, BuiltInMeta>
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function anatomyIds(anatomy: AnatomySummary | null | undefined, moduleIds: readonly string[]): AnatomyIds {
|
|
301
|
+
const lists = anatomy?.lists
|
|
302
|
+
return {
|
|
303
|
+
event: [...new Set([...(lists?.eventsEmitted ?? []), ...(lists?.eventsConsumed ?? [])])],
|
|
304
|
+
emits: [...(lists?.eventsEmitted ?? [])],
|
|
305
|
+
consumes: [...(lists?.eventsConsumed ?? [])],
|
|
306
|
+
entity: lists?.tables ?? [],
|
|
307
|
+
permission: lists?.aclFeatures ?? [],
|
|
308
|
+
env: lists?.env ?? [],
|
|
309
|
+
host: lists?.hosts ?? [],
|
|
310
|
+
setting: (lists?.credentials ?? []).map((credential) => credential.key),
|
|
311
|
+
module: [...moduleIds],
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const anatomyText = (ids: AnatomyIds) =>
|
|
316
|
+
[...ids.module, ...ids.entity, ...ids.event, ...ids.permission, ...ids.setting, ...ids.env, ...ids.host].join(' ')
|
|
317
|
+
|
|
318
|
+
function aliasesOf(entry: CatalogEntry): string[] {
|
|
319
|
+
const value = entry._meta?.[ALIASES_META_KEY]
|
|
320
|
+
return Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : []
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function moduleDoc(entry: CatalogEntry, ids: AnatomyIds): SearchDoc {
|
|
324
|
+
return {
|
|
325
|
+
id: entry.locator,
|
|
326
|
+
group: 'module',
|
|
327
|
+
title: entry.title,
|
|
328
|
+
npm: [entry.npm ?? entry.locator.replace(/^github:/, ''), entry.path].join(' '),
|
|
329
|
+
summary: entry.summary,
|
|
330
|
+
whenToUse: entry.whenToUse,
|
|
331
|
+
providers: entry.providers.map((provider) => `${provider.name} ${provider.label}`).join(' '),
|
|
332
|
+
tags: entry.tags.join(' '),
|
|
333
|
+
aliases: aliasesOf(entry).join(' '),
|
|
334
|
+
renamedFrom: entry.renamedFrom.map((locator) => locator.replace(/^(npm|github):/, '')).join(' '),
|
|
335
|
+
category: entry.category,
|
|
336
|
+
anatomy: anatomyText(ids),
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function builtInDoc(coreModule: BuiltInModule, ids: AnatomyIds): SearchDoc {
|
|
341
|
+
return {
|
|
342
|
+
id: `core:${coreModule.id}`,
|
|
343
|
+
group: 'builtin',
|
|
344
|
+
title: coreModule.title,
|
|
345
|
+
npm: coreModule.id,
|
|
346
|
+
summary: coreModule.description,
|
|
347
|
+
whenToUse: '',
|
|
348
|
+
providers: '',
|
|
349
|
+
tags: '',
|
|
350
|
+
aliases: '',
|
|
351
|
+
renamedFrom: '',
|
|
352
|
+
category: coreModule.category,
|
|
353
|
+
anatomy: anatomyText(ids),
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export function createCatalogSearcher(index: CatalogIndex, builtIn: BuiltInIndex | null): CatalogSearcher {
|
|
358
|
+
const miniSearch = new MiniSearch<SearchDoc>(SEARCH_OPTIONS)
|
|
359
|
+
const modules = new Map<string, ModuleMeta>()
|
|
360
|
+
const builtInModules = new Map<string, BuiltInMeta>()
|
|
361
|
+
const docs: SearchDoc[] = []
|
|
362
|
+
for (const entry of index.entries.filter((candidate) => candidate.listed)) {
|
|
363
|
+
const ids = anatomyIds(entry.anatomy, entry.moduleIds)
|
|
364
|
+
modules.set(entry.locator, {
|
|
365
|
+
entry,
|
|
366
|
+
ids,
|
|
367
|
+
example: entry.tags.includes('example'),
|
|
368
|
+
omQuality: entry.quality !== null && entry.quality !== undefined,
|
|
369
|
+
})
|
|
370
|
+
docs.push(moduleDoc(entry, ids))
|
|
371
|
+
}
|
|
372
|
+
for (const coreModule of builtIn?.modules ?? []) {
|
|
373
|
+
const ids = anatomyIds(coreModule.anatomy, [coreModule.id])
|
|
374
|
+
builtInModules.set(coreModule.id, { module: coreModule, ids })
|
|
375
|
+
docs.push(builtInDoc(coreModule, ids))
|
|
376
|
+
}
|
|
377
|
+
miniSearch.addAll(docs)
|
|
378
|
+
const loaded = MiniSearch.loadJS<SearchDoc>(miniSearch.toJSON(), SEARCH_OPTIONS)
|
|
379
|
+
return { miniSearch: loaded, index, builtIn, site: index.site.replace(/\/+$/, ''), modules, builtInModules }
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const absolute = (site: string, page: string) => (/^https?:\/\//.test(page) ? page : `${site}${page}`)
|
|
383
|
+
|
|
384
|
+
export function latestLine(lines: readonly CatalogLine[]): CatalogLine | null {
|
|
385
|
+
return lines.find((line) => line.source === 'latest') ?? null
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
|
|
389
|
+
|
|
390
|
+
export function resolveLine(
|
|
391
|
+
omVersion: string | null | undefined,
|
|
392
|
+
lines: readonly CatalogLine[],
|
|
393
|
+
): { line: string | null; version: string | null; note: string | null } {
|
|
394
|
+
const found = (line: CatalogLine | null) =>
|
|
395
|
+
line ? { line: line.key, version: line.version, note: null } : { line: null, version: null, note: null }
|
|
396
|
+
const raw = (omVersion ?? '').trim()
|
|
397
|
+
if (raw === '') return found(latestLine(lines))
|
|
398
|
+
const byKey = lines.find((line) => line.key === raw)
|
|
399
|
+
if (byKey) return found(byKey)
|
|
400
|
+
const version = raw.replace(/^(?:v|=|\^|~|>=)\s*/, '')
|
|
401
|
+
const semver = SEMVER.exec(version)
|
|
402
|
+
const lineKey = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version)
|
|
403
|
+
if ((!semver && !lineKey) || semver?.[4]?.split('.').some((part) => /^0\d+$/.test(part))) {
|
|
404
|
+
return { line: null, version: null, note: 'Unknown Open Mercato version.' }
|
|
405
|
+
}
|
|
406
|
+
const exact = lines.find((line) => line.version === version)
|
|
407
|
+
if (exact) return found(exact)
|
|
408
|
+
if (semver && semver[4] && /(^|[.-])develop([.-]|$)/.test(semver[4])) {
|
|
409
|
+
const next = lines.find((line) => line.source === 'develop')
|
|
410
|
+
if (next) return found(next)
|
|
411
|
+
}
|
|
412
|
+
const majorMinor = semver ?? lineKey
|
|
413
|
+
if (!majorMinor) return { line: null, version: null, note: 'Unknown Open Mercato version.' }
|
|
414
|
+
const key = `${Number(majorMinor[1])}.${Number(majorMinor[2])}`
|
|
415
|
+
const line = lines.find((candidate) => candidate.key === key)
|
|
416
|
+
if (line) return found(line)
|
|
417
|
+
return { line: null, version: null, note: `Line ${key} is not tested by the catalog.` }
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function matchedOn(
|
|
421
|
+
match: SearchResult['match'],
|
|
422
|
+
meta: { providers?: readonly { name: string; label: string }[]; tags?: readonly string[]; ids: AnatomyIds; category?: string },
|
|
423
|
+
queryTerms: readonly string[] = [],
|
|
424
|
+
): string[] {
|
|
425
|
+
const chips: string[] = []
|
|
426
|
+
const add = (chip: string) => {
|
|
427
|
+
if (!chips.includes(chip)) chips.push(chip)
|
|
428
|
+
}
|
|
429
|
+
const has = (id: string, term: string) => tokenize(id).includes(term)
|
|
430
|
+
const order: SearchField[] = ['title', 'npm', 'aliases', 'renamedFrom', 'providers', 'anatomy', 'summary', 'whenToUse', 'tags', 'category']
|
|
431
|
+
const typed = new Set(queryTerms)
|
|
432
|
+
const fieldsByTerm = Object.entries(match).sort(
|
|
433
|
+
(left, right) => Number(typed.has(right[0])) - Number(typed.has(left[0])) || right[0].length - left[0].length,
|
|
434
|
+
)
|
|
435
|
+
for (const field of order) {
|
|
436
|
+
for (const [term, fields] of fieldsByTerm) {
|
|
437
|
+
if (!fields.includes(field)) continue
|
|
438
|
+
if (field === 'title' || field === 'npm' || field === 'aliases' || field === 'renamedFrom') add('name')
|
|
439
|
+
else if (field === 'summary' || field === 'whenToUse') add('summary')
|
|
440
|
+
else if (field === 'tags') {
|
|
441
|
+
const tag = meta.tags?.find((candidate) => has(candidate, term))
|
|
442
|
+
add(tag ? `tag ${tag}` : 'summary')
|
|
443
|
+
} else if (field === 'category' && meta.category) add(`category ${meta.category}`)
|
|
444
|
+
else if (field === 'providers') {
|
|
445
|
+
const provider = meta.providers?.find((candidate) => has(candidate.name, term) || has(candidate.label, term))
|
|
446
|
+
add(provider ? `provider ${provider.label}` : 'provider')
|
|
447
|
+
} else if (field === 'anatomy') anatomyChips(meta.ids, fieldsByTerm, has).forEach(add)
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return chips.slice(0, 5)
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function anatomyChips(
|
|
454
|
+
ids: AnatomyIds,
|
|
455
|
+
fieldsByTerm: readonly (readonly [string, readonly string[]])[],
|
|
456
|
+
has: (id: string, term: string) => boolean,
|
|
457
|
+
): string[] {
|
|
458
|
+
const kinds: (keyof AnatomyIds)[] = ['event', 'entity', 'permission', 'env', 'setting', 'host', 'module']
|
|
459
|
+
const terms = fieldsByTerm.filter(([, fields]) => fields.includes('anatomy')).map(([term]) => term)
|
|
460
|
+
const left = new Set(terms)
|
|
461
|
+
const chips: string[] = []
|
|
462
|
+
while (left.size > 0) {
|
|
463
|
+
let best: { chip: string; covers: string[]; exact: boolean; first: number } | null = null
|
|
464
|
+
for (const kind of kinds)
|
|
465
|
+
for (const id of ids[kind]) {
|
|
466
|
+
const covers = terms.filter((term) => left.has(term) && (id === term || has(id, term)))
|
|
467
|
+
if (covers.length === 0) continue
|
|
468
|
+
const exact = covers.includes(id)
|
|
469
|
+
const first = terms.indexOf(covers[0] as string)
|
|
470
|
+
const better =
|
|
471
|
+
!best ||
|
|
472
|
+
covers.length > best.covers.length ||
|
|
473
|
+
(covers.length === best.covers.length && (exact && !best.exact ? true : exact === best.exact && first < best.first))
|
|
474
|
+
if (better) best = { chip: `${kind} ${id}`, covers, exact, first }
|
|
475
|
+
}
|
|
476
|
+
if (!best) break
|
|
477
|
+
chips.push(best.chip)
|
|
478
|
+
for (const term of best.covers) left.delete(term)
|
|
479
|
+
}
|
|
480
|
+
return chips
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const STABLE_VERSION = /^\d+\.\d+\.\d+$/
|
|
484
|
+
|
|
485
|
+
function satisfiesRange(version: string, range: string): boolean {
|
|
486
|
+
try {
|
|
487
|
+
return satisfies(version, range, { includePrerelease: true })
|
|
488
|
+
} catch {
|
|
489
|
+
return false
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export function lineVersion(entry: CatalogEntry, line: string | null): string | null {
|
|
494
|
+
return (line !== null ? entry.compat.ships?.[line] : undefined) ?? installVersion(entry, line)
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** A cell whose receipt judged another version than the one a fresh app gets on the line is no verdict on that line. */
|
|
498
|
+
function judgedCell(entry: CatalogEntry, line: string): CellSummary | null {
|
|
499
|
+
const cell = entry.compat.lines[line] ?? null
|
|
500
|
+
if (!cell || cell.moduleVersion === null || cell.moduleVersion === undefined || !VERDICT_STATES.has(cell.status)) return cell
|
|
501
|
+
const installs = lineVersion(entry, line)
|
|
502
|
+
return installs === null || cell.moduleVersion === installs ? cell : null
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export function statusOn(entry: CatalogEntry, line: string): CellStatus {
|
|
506
|
+
if (entry.version.recommended[line]) return 'verified'
|
|
507
|
+
return judgedCell(entry, line)?.status ?? 'untested'
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function installableOn(entry: CatalogEntry, line: string | null): string | null | undefined {
|
|
511
|
+
if (line === null) return undefined
|
|
512
|
+
const map = entry._meta?.[INSTALLABLE_META_KEY]
|
|
513
|
+
if (!map || typeof map !== 'object') return undefined
|
|
514
|
+
const value = (map as Record<string, unknown>)[line]
|
|
515
|
+
return typeof value === 'string' ? value : value === null ? null : undefined
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export function installVersion(entry: CatalogEntry, line: string | null): string | null {
|
|
519
|
+
return (
|
|
520
|
+
(line !== null ? entry.version.recommended[line] : null) ??
|
|
521
|
+
installableOn(entry, line) ??
|
|
522
|
+
entry.version.latest ??
|
|
523
|
+
entry.version.preview ??
|
|
524
|
+
null
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function declaredRangeOf(entry: CatalogEntry, version: string): string | null {
|
|
529
|
+
const builtFor = entry.compat.builtFor
|
|
530
|
+
if (!builtFor || builtFor.kind === 'missing' || builtFor.kind === 'star') return null
|
|
531
|
+
if (builtFor.ranges) {
|
|
532
|
+
for (const [line, range] of Object.entries(builtFor.ranges)) if (lineVersion(entry, line) === version) return range
|
|
533
|
+
return null
|
|
534
|
+
}
|
|
535
|
+
const lines = new Set([...Object.keys(entry.compat.lines), ...Object.keys(entry.compat.ships ?? {})])
|
|
536
|
+
return [...lines].some((line) => lineVersion(entry, line) === version) ? builtFor.range : null
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* The version an app from the empty preset installs: the one a new app ships where the install version broke in
|
|
541
|
+
* isolation there, or where its declared peers reject the version that line ships.
|
|
542
|
+
*/
|
|
543
|
+
export function emptyPresetVersion(entry: CatalogEntry, line: string | null): string | null {
|
|
544
|
+
const version = installVersion(entry, line)
|
|
545
|
+
if (line === null || !version) return version
|
|
546
|
+
const ships = entry.compat.ships?.[line]
|
|
547
|
+
if (!ships || ships === version) return version
|
|
548
|
+
const isolation = entry.compat.isolation?.[line]
|
|
549
|
+
if (isolation?.moduleVersion === version) return isolation.status === 'broken' ? ships : version
|
|
550
|
+
const range = declaredRangeOf(entry, version)
|
|
551
|
+
return STABLE_VERSION.test(ships) && range !== null && !satisfiesRange(ships, range) ? ships : version
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export function builtInEnableCommand(id: string): string {
|
|
555
|
+
return `yarn mercato module enable ${CORE_PACKAGE} --module ${id}`
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** A provider without a module of its own: an adapter `yarn add` adds and `yarn generate` registers. */
|
|
559
|
+
export const isAdapter = (entry: Pick<CatalogEntry, 'kind' | 'moduleIds'>): boolean =>
|
|
560
|
+
entry.kind === 'provider' && entry.moduleIds.length === 0
|
|
561
|
+
|
|
562
|
+
/** Finds a catalog entry by locator (`npm:<name>`). */
|
|
563
|
+
export type PeerLookup = (locator: string) => CatalogEntry | null | undefined
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* The catalog libraries an adapter peers on, as `name@version` for its `yarn add` (catalog `peerLibrarySpecs`). An
|
|
567
|
+
* @open-mercato peer of an @open-mercato adapter comes from the same release and takes the adapter's version; any
|
|
568
|
+
* other peer takes its own install version on the line. Empty for every other kind.
|
|
569
|
+
*/
|
|
570
|
+
export function peerLibrarySpecs(
|
|
571
|
+
entry: CatalogEntry,
|
|
572
|
+
version: string | null,
|
|
573
|
+
line: string | null,
|
|
574
|
+
find: PeerLookup | undefined,
|
|
575
|
+
): string[] {
|
|
576
|
+
if (!find || !entry.npm || !isAdapter(entry)) return []
|
|
577
|
+
const specs: string[] = []
|
|
578
|
+
for (const requirement of entry.requires ?? []) {
|
|
579
|
+
const peer = requirement.resolvesTo?.startsWith('npm:') ? find(requirement.resolvesTo) : null
|
|
580
|
+
if (!peer?.npm || peer.kind !== 'library' || peer.npm === entry.npm) continue
|
|
581
|
+
const sameRelease = Boolean(version) && peer.npm.startsWith('@open-mercato/') && entry.npm.startsWith('@open-mercato/')
|
|
582
|
+
const peerVersion = sameRelease ? version : installVersion(peer, line)
|
|
583
|
+
const spec = peerVersion ? `${peer.npm}@${peerVersion}` : peer.npm
|
|
584
|
+
if (!specs.includes(spec)) specs.push(spec)
|
|
585
|
+
}
|
|
586
|
+
return specs
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function packageCommand(entry: CatalogEntry, spec: string, peers: readonly string[] = []): string | null {
|
|
590
|
+
if (entry.kind === 'tool') return entry.tags.includes('cli') ? `npx ${spec}` : `yarn add ${spec}`
|
|
591
|
+
if (isAdapter(entry)) return `yarn add ${[...peers, spec].join(' ')}`
|
|
592
|
+
return entry.kind === 'library' ? `yarn add ${spec}` : null
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function inPreset(entry: CatalogEntry, enabled: readonly { id: string; from: string }[] | null): boolean {
|
|
596
|
+
if (!enabled || !entry.npm || entry.moduleIds.length === 0) return false
|
|
597
|
+
return entry.moduleIds.every((id) => enabled.some((item) => item.id === id && item.from === entry.npm))
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function installCli(
|
|
601
|
+
entry: CatalogEntry,
|
|
602
|
+
line: string | null,
|
|
603
|
+
preset: readonly { id: string; from: string }[] | null,
|
|
604
|
+
version: string | null = installVersion(entry, line),
|
|
605
|
+
find?: PeerLookup,
|
|
606
|
+
): string {
|
|
607
|
+
if (entry.npm === null) {
|
|
608
|
+
const repo = entry.locator.replace(/^github:/, '')
|
|
609
|
+
const ref = entry.version.gitRef ? ` --ref ${entry.version.gitRef}` : ''
|
|
610
|
+
return `npx create-mercato-module install ${repo}${ref}`
|
|
611
|
+
}
|
|
612
|
+
const spec = version ? `${entry.npm}@${version}` : entry.npm
|
|
613
|
+
const own = packageCommand(entry, spec, peerLibrarySpecs(entry, version, line, find))
|
|
614
|
+
if (own) return own
|
|
615
|
+
if (inPreset(entry, preset)) return `yarn add ${spec}`
|
|
616
|
+
const moduleFlag = entry.install.moduleFlag ?? null
|
|
617
|
+
if (entry.npm === ENTERPRISE_PACKAGE && !moduleFlag) return `${ENTERPRISE_ENABLE_STEP} && yarn generate`
|
|
618
|
+
const thirdParty = entry.npm.startsWith('@open-mercato/') ? '' : ' --allow-third-party'
|
|
619
|
+
if (!moduleFlag && entry.moduleIds.length > 1) {
|
|
620
|
+
return entry.moduleIds.map((id) => `yarn mercato module add ${spec}${thirdParty} --module ${id}`).join(' && ')
|
|
621
|
+
}
|
|
622
|
+
return `yarn mercato module add ${spec}${thirdParty}${moduleFlag ? ` --module ${moduleFlag}` : ''}`
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/** The command of an app that does not register the package yet (an app from the empty preset) on a line. */
|
|
626
|
+
export function installCommand(
|
|
627
|
+
entry: CatalogEntry,
|
|
628
|
+
line: string | null,
|
|
629
|
+
latest: string | null,
|
|
630
|
+
find?: PeerLookup,
|
|
631
|
+
): string {
|
|
632
|
+
if (line === null || line === latest) return entry.install.cli
|
|
633
|
+
const both = entry.npm !== null && (entry.compat.inEmptyPreset ?? []).includes(line)
|
|
634
|
+
const version = (entry.compat.inPresets ?? []).includes(line)
|
|
635
|
+
? emptyPresetVersion(entry, line)
|
|
636
|
+
: installVersion(entry, line)
|
|
637
|
+
const npm = entry.npm
|
|
638
|
+
return installCli(entry, line, both && npm ? entry.moduleIds.map((id) => ({ id, from: npm })) : null, version, find)
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function listAnd(items: readonly string[]): string {
|
|
642
|
+
return items.length <= 1 ? (items[0] ?? '') : `${items.slice(0, -1).join(', ')} and ${items[items.length - 1]}`
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
const EMPTY_PRESET_LEAD = 'In an app from the empty preset:'
|
|
646
|
+
|
|
647
|
+
function presetInstallText(moduleIds: readonly string[]): string {
|
|
648
|
+
return `Nothing to install: a new app already registers ${moduleIds.length ? listAnd(moduleIds) : 'it'} in src/modules.ts.`
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export function newAppInstallText(moduleIds: readonly string[], emptyCommand: string | null): string {
|
|
652
|
+
return emptyCommand ? `${presetInstallText(moduleIds)} ${EMPTY_PRESET_LEAD} ${emptyCommand}` : presetInstallText(moduleIds)
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Where a new app (classic preset) of the line already registers the package, `install` is that sentence, `presetNote`
|
|
657
|
+
* the whole install sentence and `installEmptyPreset` the command of an app from the empty preset (null when that
|
|
658
|
+
* preset registers it too). Elsewhere `install` is the command.
|
|
659
|
+
*/
|
|
660
|
+
export function installFields(
|
|
661
|
+
entry: CatalogEntry,
|
|
662
|
+
line: string | null,
|
|
663
|
+
latest: string | null,
|
|
664
|
+
find?: PeerLookup,
|
|
665
|
+
): Pick<ModuleCard, 'install' | 'presetNote' | 'installEmptyPreset'> {
|
|
666
|
+
const command = installCommand(entry, line, latest, find)
|
|
667
|
+
if (line === null || !(entry.compat.inPresets ?? []).includes(line)) return { install: command }
|
|
668
|
+
const empty = (entry.compat.inEmptyPreset ?? []).includes(line) ? null : command
|
|
669
|
+
return {
|
|
670
|
+
install: presetInstallText(entry.moduleIds),
|
|
671
|
+
presetNote: newAppInstallText(entry.moduleIds, empty),
|
|
672
|
+
installEmptyPreset: empty,
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** What a new app (classic preset) of the line has of a built-in module; null when a new app has it off. */
|
|
677
|
+
export function builtInPresetText(coreModule: BuiltInModule, line: string | null): string | null {
|
|
678
|
+
if (!line || !coreModule.inPresets?.includes(line)) return null
|
|
679
|
+
const on = `On in a new app on ${line}: nothing to enable.`
|
|
680
|
+
if (coreModule.inEmptyPreset?.includes(line)) return on
|
|
681
|
+
return `${on} ${EMPTY_PRESET_LEAD} ${coreModule.install || builtInEnableCommand(coreModule.id)}`
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/** The `get_module` warnings of a built-in module. */
|
|
685
|
+
export function builtInNotes(coreModule: BuiltInModule, line: string | null): string[] {
|
|
686
|
+
const text = builtInPresetText(coreModule, line)
|
|
687
|
+
if (text) return [`Built into Open Mercato core as ${coreModule.id}.`, text]
|
|
688
|
+
return [`Built into Open Mercato core as ${coreModule.id}. Enable it: ${builtInEnableCommand(coreModule.id)}`]
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/** Order without a query: OM Quality, Verified, Listed, then featured, receipt freshness on the line, title. */
|
|
692
|
+
function relevanceCompare(line: string | null) {
|
|
693
|
+
const level = (meta: ModuleMeta) =>
|
|
694
|
+
meta.omQuality ? 0 : meta.entry.tier === 'verified' ? 1 : meta.entry.tier === 'listed' ? 2 : 3
|
|
695
|
+
const fresh = (meta: ModuleMeta) => {
|
|
696
|
+
const at = line ? judgedCell(meta.entry, line)?.at : null
|
|
697
|
+
return at ? Date.parse(at) : 0
|
|
698
|
+
}
|
|
699
|
+
return (left: ModuleMeta, right: ModuleMeta) =>
|
|
700
|
+
level(left) - level(right) ||
|
|
701
|
+
Number(right.entry.featured) - Number(left.entry.featured) ||
|
|
702
|
+
fresh(right) - fresh(left) ||
|
|
703
|
+
left.entry.title.localeCompare(right.entry.title)
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/** The query with one swap of two adjacent letters undone in one word (`stirpe` -> `stripe`); at most 60 variants. */
|
|
707
|
+
export function swapVariants(query: string): string[] {
|
|
708
|
+
const words = query.trim().toLowerCase().split(/\s+/).filter(Boolean)
|
|
709
|
+
if (words.length > 6) return []
|
|
710
|
+
const variants: string[] = []
|
|
711
|
+
words.forEach((word, wordIndex) => {
|
|
712
|
+
if (word.length < 3 || word.length > 24 || !/^[a-z0-9]+$/.test(word) || processTerm(word) === null) return
|
|
713
|
+
for (let index = 0; index < word.length - 1; index++) {
|
|
714
|
+
if (word[index] === word[index + 1]) continue
|
|
715
|
+
const swapped = `${word.slice(0, index)}${word[index + 1]}${word[index]}${word.slice(index + 2)}`
|
|
716
|
+
variants.push([...words.slice(0, wordIndex), swapped, ...words.slice(wordIndex + 1)].join(' '))
|
|
717
|
+
}
|
|
718
|
+
})
|
|
719
|
+
return [...new Set(variants)].slice(0, 60)
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export type RankedModule = { meta: ModuleMeta; matchedOn: string[] }
|
|
723
|
+
|
|
724
|
+
export type RankedSearch = {
|
|
725
|
+
line: string | null
|
|
726
|
+
latest: string | null
|
|
727
|
+
modules: RankedModule[]
|
|
728
|
+
builtIn: BuiltInCard[]
|
|
729
|
+
didYouMean: string | null
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
type Hits = {
|
|
733
|
+
modules: { meta: ModuleMeta; result: SearchResult }[]
|
|
734
|
+
builtIns: { meta: BuiltInMeta; result: SearchResult }[]
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* `search_modules` ranking (tools@1): AND first, then OR with weak hits cut, then one swapped pair of letters. Without
|
|
739
|
+
* a query (blank, or only stop words next to a filter) the filters alone pick the modules, in relevance order.
|
|
740
|
+
*/
|
|
741
|
+
export function rankModules(searcher: CatalogSearcher, rawInput: SearchModulesInput): RankedSearch {
|
|
742
|
+
const input = {
|
|
743
|
+
...rawInput,
|
|
744
|
+
query: rawInput.query ?? '',
|
|
745
|
+
verifiedOnly: rawInput.verifiedOnly ?? SEARCH_DEFAULTS.verifiedOnly,
|
|
746
|
+
includeBuiltIn: rawInput.includeBuiltIn ?? SEARCH_DEFAULTS.includeBuiltIn,
|
|
747
|
+
includeExamples: rawInput.includeExamples ?? SEARCH_DEFAULTS.includeExamples,
|
|
748
|
+
}
|
|
749
|
+
const lines = searcher.index.lines
|
|
750
|
+
const latest = latestLine(lines)?.key ?? null
|
|
751
|
+
const line = input.omVersion ? resolveLine(input.omVersion, lines).line : latest
|
|
752
|
+
const boostDocument = (id: unknown) => {
|
|
753
|
+
const meta = searcher.modules.get(String(id))
|
|
754
|
+
if (!meta) return 1
|
|
755
|
+
const verified = line !== null && statusOn(meta.entry, line) === 'verified' ? 1 : 0
|
|
756
|
+
return 1 + BOOST_VERIFIED * verified + BOOST_OFFICIAL * (meta.entry.type === 'official' ? 1 : 0)
|
|
757
|
+
}
|
|
758
|
+
const wantKinds = input.kind
|
|
759
|
+
const provider = input.provider?.toLowerCase()
|
|
760
|
+
const providerMatches = (item: { name: string; label: string }) => item.name === provider || item.label.toLowerCase() === provider
|
|
761
|
+
const moduleOk = (meta: ModuleMeta) => {
|
|
762
|
+
const entry = meta.entry
|
|
763
|
+
return (
|
|
764
|
+
entry.listed &&
|
|
765
|
+
(input.includeExamples || !meta.example) &&
|
|
766
|
+
(!input.category || entry.category === input.category) &&
|
|
767
|
+
(!input.type || input.type.includes(entry.type)) &&
|
|
768
|
+
(!wantKinds || wantKinds.includes(entry.kind)) &&
|
|
769
|
+
(!input.verifiedOnly || (line !== null && statusOn(entry, line) === 'verified')) &&
|
|
770
|
+
(!input.verifiedModulesOnly || entry.kind !== 'module' || (line !== null && Boolean(entry.version.recommended[line]))) &&
|
|
771
|
+
(!input.emits || meta.ids.emits.includes(input.emits)) &&
|
|
772
|
+
(!input.consumes || meta.ids.consumes.includes(input.consumes)) &&
|
|
773
|
+
(!provider || entry.providers.some(providerMatches))
|
|
774
|
+
)
|
|
775
|
+
}
|
|
776
|
+
const builtInOk = (meta: BuiltInMeta) =>
|
|
777
|
+
input.includeBuiltIn &&
|
|
778
|
+
(!wantKinds || wantKinds.includes('built-in')) &&
|
|
779
|
+
(!input.type || input.type.includes('official')) &&
|
|
780
|
+
(!input.category || meta.module.category === input.category) &&
|
|
781
|
+
!input.provider &&
|
|
782
|
+
!input.verifiedOnly &&
|
|
783
|
+
(!input.emits || meta.ids.emits.includes(input.emits)) &&
|
|
784
|
+
(!input.consumes || meta.ids.consumes.includes(input.consumes))
|
|
785
|
+
const builtInCard = (meta: BuiltInMeta, chips: string[]): BuiltInCard => ({
|
|
786
|
+
id: meta.module.id,
|
|
787
|
+
title: meta.module.title,
|
|
788
|
+
description: meta.module.description,
|
|
789
|
+
category: meta.module.category,
|
|
790
|
+
enabled: null,
|
|
791
|
+
install: meta.module.install || builtInEnableCommand(meta.module.id),
|
|
792
|
+
page: absolute(searcher.site, meta.module.page),
|
|
793
|
+
matchedOn: chips,
|
|
794
|
+
presetNote: builtInPresetText(meta.module, line),
|
|
795
|
+
})
|
|
796
|
+
|
|
797
|
+
const filtered = Boolean(
|
|
798
|
+
input.category || input.emits || input.consumes || input.provider || input.type || wantKinds || input.verifiedOnly,
|
|
799
|
+
)
|
|
800
|
+
const words = tokenize(input.query).some((term) => processTerm(term) !== null)
|
|
801
|
+
if (input.query.trim() === '' || (filtered && !words)) {
|
|
802
|
+
const filterChips = (category: string, providers: readonly { name: string; label: string }[]): string[] => [
|
|
803
|
+
...(input.emits ? [`event ${input.emits}`] : []),
|
|
804
|
+
...(input.consumes && input.consumes !== input.emits ? [`event ${input.consumes}`] : []),
|
|
805
|
+
...(provider ? providers.filter(providerMatches).slice(0, 1).map((item) => `provider ${item.label}`) : []),
|
|
806
|
+
...(input.category ? [`category ${category}`] : []),
|
|
807
|
+
]
|
|
808
|
+
const modules = [...searcher.modules.values()].filter(moduleOk).sort(relevanceCompare(line))
|
|
809
|
+
const narrowed = Boolean(input.category || input.emits || input.consumes || wantKinds)
|
|
810
|
+
const builtIns = narrowed
|
|
811
|
+
? [...searcher.builtInModules.values()].filter(builtInOk).sort((left, right) => left.module.title.localeCompare(right.module.title))
|
|
812
|
+
: []
|
|
813
|
+
return {
|
|
814
|
+
line,
|
|
815
|
+
latest,
|
|
816
|
+
modules: modules.map((meta) => ({ meta, matchedOn: filterChips(meta.entry.category, meta.entry.providers) })),
|
|
817
|
+
builtIn: builtIns.slice(0, BUILTIN_MAX).map((meta) => builtInCard(meta, filterChips(meta.module.category, []))),
|
|
818
|
+
didYouMean: null,
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
const run = (combineWith: 'AND' | 'OR', query: string = input.query): Hits => {
|
|
823
|
+
const hits = searcher.miniSearch.search(query, {
|
|
824
|
+
combineWith,
|
|
825
|
+
prefix: true,
|
|
826
|
+
fuzzy: 0.2,
|
|
827
|
+
boost: { ...SEARCH_BOOST },
|
|
828
|
+
boostDocument,
|
|
829
|
+
})
|
|
830
|
+
const modules: Hits['modules'] = []
|
|
831
|
+
const builtIns: Hits['builtIns'] = []
|
|
832
|
+
for (const result of hits) {
|
|
833
|
+
const id = String(result.id)
|
|
834
|
+
if (result['group'] === 'builtin') {
|
|
835
|
+
const meta = searcher.builtInModules.get(id.replace(/^core:/, ''))
|
|
836
|
+
if (meta && builtInOk(meta)) builtIns.push({ meta, result })
|
|
837
|
+
} else {
|
|
838
|
+
const meta = searcher.modules.get(id)
|
|
839
|
+
if (meta && moduleOk(meta)) modules.push({ meta, result })
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return { modules, builtIns }
|
|
843
|
+
}
|
|
844
|
+
const none = (hits: Hits) => hits.modules.length === 0 && hits.builtIns.length === 0
|
|
845
|
+
const topOf = (hits: Hits) => Math.max(hits.modules[0]?.result.score ?? 0, hits.builtIns[0]?.result.score ?? 0)
|
|
846
|
+
const typed = new Set(tokenize(input.query).filter((term) => processTerm(term) !== null))
|
|
847
|
+
const strong = <T extends { result: SearchResult }>(hits: readonly T[], top: number): T[] =>
|
|
848
|
+
hits.filter((hit) => hit.result.score >= WEAK_HIT_RATIO * top || Object.keys(hit.result.match).some((term) => typed.has(term)))
|
|
849
|
+
let found = run('AND')
|
|
850
|
+
let didYouMean: string | null = null
|
|
851
|
+
if (none(found)) {
|
|
852
|
+
const orHits = run('OR')
|
|
853
|
+
const top = topOf(orHits)
|
|
854
|
+
found = { modules: strong(orHits.modules, top), builtIns: strong(orHits.builtIns, top) }
|
|
855
|
+
if (none(found)) {
|
|
856
|
+
let best: { variant: string; hits: Hits; top: number } | null = null
|
|
857
|
+
for (const variant of swapVariants(input.query)) {
|
|
858
|
+
const hits = run('AND', variant)
|
|
859
|
+
const top = topOf(hits)
|
|
860
|
+
if (!none(hits) && (!best || top > best.top)) best = { variant, hits, top }
|
|
861
|
+
}
|
|
862
|
+
if (best) {
|
|
863
|
+
found = best.hits
|
|
864
|
+
didYouMean = best.variant
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
} else if (found.modules.length < MIN_AND_RESULTS && tokenize(input.query).filter((term) => processTerm(term)).length > 1) {
|
|
868
|
+
const orHits = run('OR')
|
|
869
|
+
const top = Math.max(topOf(found), topOf(orHits))
|
|
870
|
+
const seen = new Set(found.modules.map((hit) => hit.meta.entry.locator))
|
|
871
|
+
found = {
|
|
872
|
+
modules: [...found.modules, ...strong(orHits.modules, top).filter((hit) => !seen.has(hit.meta.entry.locator))],
|
|
873
|
+
builtIns: found.builtIns,
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
const best = found.modules[0]?.result.score ?? 0
|
|
878
|
+
const query = (didYouMean ?? input.query).trim().toLowerCase()
|
|
879
|
+
const builtIn = found.builtIns
|
|
880
|
+
.filter(
|
|
881
|
+
({ meta, result }) =>
|
|
882
|
+
result.score >= BUILTIN_RATIO * best ||
|
|
883
|
+
meta.module.title.toLowerCase() === query ||
|
|
884
|
+
meta.module.id === query.replace(/[\s-]+/g, '_'),
|
|
885
|
+
)
|
|
886
|
+
.slice(0, BUILTIN_MAX)
|
|
887
|
+
.map(({ meta, result }) => builtInCard(meta, matchedOn(result.match, { ids: meta.ids }, result.queryTerms)))
|
|
888
|
+
const modules = found.modules.map(({ meta, result }) => ({
|
|
889
|
+
meta,
|
|
890
|
+
matchedOn: matchedOn(
|
|
891
|
+
result.match,
|
|
892
|
+
{ providers: meta.entry.providers, tags: meta.entry.tags, ids: meta.ids, category: meta.entry.category },
|
|
893
|
+
result.queryTerms,
|
|
894
|
+
),
|
|
895
|
+
}))
|
|
896
|
+
return { line, latest, modules, builtIn, didYouMean }
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export function toModuleCard(searcher: CatalogSearcher, hit: RankedModule, line: string | null, latest: string | null): ModuleCard {
|
|
900
|
+
const entry = hit.meta.entry
|
|
901
|
+
return {
|
|
902
|
+
locator: entry.locator,
|
|
903
|
+
path: entry.path,
|
|
904
|
+
title: entry.title,
|
|
905
|
+
summary: entry.summary,
|
|
906
|
+
whenToUse: entry.whenToUse,
|
|
907
|
+
type: entry.type,
|
|
908
|
+
kind: entry.kind,
|
|
909
|
+
category: entry.category,
|
|
910
|
+
license: { spdx: entry.license.spdx, kind: entry.license.kind },
|
|
911
|
+
tier: entry.tier,
|
|
912
|
+
omQuality: hit.meta.omQuality,
|
|
913
|
+
verifiedOn: entry.compat.verifiedOn,
|
|
914
|
+
line,
|
|
915
|
+
status: line ? statusOn(entry, line) : null,
|
|
916
|
+
agentPolicy: line ? (entry.agentPolicy[line] ?? null) : null,
|
|
917
|
+
installableFrom: entry.version.installableFrom,
|
|
918
|
+
...installFields(entry, line, latest, peerLookup(searcher)),
|
|
919
|
+
matchedOn: hit.matchedOn,
|
|
920
|
+
card: absolute(searcher.site, entry.links.page),
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/** The listed entries of the search index, where the catalog looks up an adapter's peer libraries. */
|
|
925
|
+
export function peerLookup(searcher: CatalogSearcher): PeerLookup {
|
|
926
|
+
return (locator) => searcher.modules.get(locator)?.entry
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export function receiptSourceOf(searcher: CatalogSearcher): ReceiptSource | null {
|
|
930
|
+
const source = searcher.index.dataAsOf?.source
|
|
931
|
+
return source === 'ci' || source === 'preview' ? source : null
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export function searchModules(searcher: CatalogSearcher, input: SearchModulesInput): SearchModulesOutput {
|
|
935
|
+
const limit = Math.min(SEARCH_MAX_LIMIT, Math.max(1, Math.floor(input.limit ?? SEARCH_DEFAULTS.limit)))
|
|
936
|
+
const ranked = rankModules(searcher, input)
|
|
937
|
+
return {
|
|
938
|
+
results: ranked.modules.slice(0, limit).map((hit) => toModuleCard(searcher, hit, ranked.line, ranked.latest)),
|
|
939
|
+
builtIn: ranked.builtIn,
|
|
940
|
+
total: ranked.modules.length,
|
|
941
|
+
line: ranked.line,
|
|
942
|
+
dataVersion: searcher.index.dataVersion,
|
|
943
|
+
generatedAt: searcher.index.generatedAt,
|
|
944
|
+
receiptSource: receiptSourceOf(searcher),
|
|
945
|
+
...(ranked.didYouMean ? { didYouMean: ranked.didYouMean } : {}),
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
export function stripVersion(ref: string): { name: string; version: string | null } {
|
|
950
|
+
const match = /^(.+?)@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/.exec(ref.trim())
|
|
951
|
+
return match ? { name: match[1] as string, version: match[2] as string } : { name: ref.trim(), version: null }
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
export type ResolvedRef =
|
|
955
|
+
| { kind: 'entry'; entry: CatalogEntry; candidates: string[] }
|
|
956
|
+
| { kind: 'builtin'; builtIn: BuiltInModule; candidates: string[] }
|
|
957
|
+
| { kind: 'none'; candidates: string[] }
|
|
958
|
+
|
|
959
|
+
const normalizeRef = (value: string) => value.trim().toLowerCase()
|
|
960
|
+
const rankEntry = (entry: CatalogEntry) => (entry.type === 'official' ? 0 : 2) + (entry.tier === 'verified' ? 0 : 1)
|
|
961
|
+
|
|
962
|
+
export function resolveRef(ref: string, entries: readonly CatalogEntry[], builtIn: readonly BuiltInModule[]): ResolvedRef {
|
|
963
|
+
const wanted = normalizeRef(stripVersion(ref).name)
|
|
964
|
+
const direct = entries.find(
|
|
965
|
+
(entry) =>
|
|
966
|
+
normalizeRef(entry.locator) === wanted ||
|
|
967
|
+
(entry.npm !== null && normalizeRef(entry.npm) === wanted) ||
|
|
968
|
+
normalizeRef(entry.path) === wanted ||
|
|
969
|
+
normalizeRef(`/m/${entry.path}`) === wanted ||
|
|
970
|
+
entry.renamedFrom.some((previous) => normalizeRef(previous) === wanted || normalizeRef(previous) === `npm:${wanted}`),
|
|
971
|
+
)
|
|
972
|
+
if (direct) return { kind: 'entry', entry: direct, candidates: [] }
|
|
973
|
+
const githubPath = wanted.startsWith('github:')
|
|
974
|
+
? `github/${wanted.slice(7)}`
|
|
975
|
+
: wanted.replace(/^https:\/\/github\.com\//, 'github/')
|
|
976
|
+
const github = entries.find((entry) => normalizeRef(entry.path) === githubPath)
|
|
977
|
+
if (github) return { kind: 'entry', entry: github, candidates: [] }
|
|
978
|
+
|
|
979
|
+
const id = wanted.replace(/^core:/, '')
|
|
980
|
+
const byId = entries.filter((entry) => entry.moduleIds.includes(id)).sort((left, right) => rankEntry(left) - rankEntry(right))
|
|
981
|
+
const core = builtIn.find((coreModule) => coreModule.id === id)
|
|
982
|
+
if (core) return { kind: 'builtin', builtIn: core, candidates: byId.map((entry) => entry.locator).slice(0, 10) }
|
|
983
|
+
if (byId.length === 1) return { kind: 'entry', entry: byId[0] as CatalogEntry, candidates: [] }
|
|
984
|
+
if (byId.length > 1) return { kind: 'none', candidates: byId.map((entry) => entry.locator).slice(0, 10) }
|
|
985
|
+
|
|
986
|
+
const loose = entries
|
|
987
|
+
.filter(
|
|
988
|
+
(entry) =>
|
|
989
|
+
wanted.length >= 3 &&
|
|
990
|
+
(normalizeRef(entry.locator).includes(wanted) || entry.moduleIds.some((moduleId) => moduleId.includes(wanted.replace(/-/g, '_')))),
|
|
991
|
+
)
|
|
992
|
+
.sort((left, right) => rankEntry(left) - rankEntry(right))
|
|
993
|
+
return { kind: 'none', candidates: loose.map((entry) => entry.locator).slice(0, 10) }
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
const clip = (text: string, max = 200) => (text.length > max ? `${text.slice(0, max - 3)}...` : text)
|
|
997
|
+
|
|
998
|
+
export function entryWarnings(
|
|
999
|
+
entry: CatalogEntry,
|
|
1000
|
+
today: string,
|
|
1001
|
+
line: string | null,
|
|
1002
|
+
receiptSource: ReceiptSource | null = null,
|
|
1003
|
+
): string[] {
|
|
1004
|
+
const warnings: string[] = []
|
|
1005
|
+
if (!entry.listed) warnings.push(`Not listed: ${(line ? entry.agentPolicy[line] : null)?.reasons[0]?.text ?? 'see the card.'}`)
|
|
1006
|
+
if (entry.status !== 'active') warnings.push(`Status: ${entry.status}.`)
|
|
1007
|
+
if (entry.version.installableFrom && entry.version.installableFrom > today)
|
|
1008
|
+
warnings.push(
|
|
1009
|
+
`${entry.version.latest ?? 'The newest release'} is installable from ${entry.version.installableFrom} (Yarn age gate).`,
|
|
1010
|
+
)
|
|
1011
|
+
if (entry.license.mismatch) warnings.push('License sources disagree. See the card.')
|
|
1012
|
+
const supplyChain = entry.signals?.supplyChain
|
|
1013
|
+
if (supplyChain && supplyChain.status !== 'ok')
|
|
1014
|
+
warnings.push(`Supply chain ${supplyChain.status}: ${supplyChain.reasons.join('; ') || 'see the card'}.`)
|
|
1015
|
+
const hygiene = entry.signals?.hygiene
|
|
1016
|
+
if (hygiene && hygiene.status !== 'ok') warnings.push(`Hygiene ${hygiene.status}: ${hygiene.failing.join(', ') || 'see the card'}.`)
|
|
1017
|
+
if (entry.signals?.anatomy === 'hidden') warnings.push('Anatomy is not published for this entry.')
|
|
1018
|
+
return [...(receiptSource === 'preview' ? [PREVIEW_LINE] : []), ...warnings.map((warning) => clip(warning))].slice(0, 10)
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export function unknownModuleMessage(ref: string, candidates: readonly string[]): string {
|
|
1022
|
+
return candidates.length > 0
|
|
1023
|
+
? `Unknown module "${ref.slice(0, 80)}". Did you mean: ${candidates.join(', ')}?`
|
|
1024
|
+
: `Unknown module "${ref.slice(0, 80)}".`
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
export function builtInWarnings(coreModule: BuiltInModule, line: string | null): string[] {
|
|
1028
|
+
return builtInNotes(coreModule, line).map((note) => clip(note))
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export function sharedModuleIdWarning(id: string, count: number): string {
|
|
1032
|
+
return clip(`Module ID ${id} is provided by ${count} entries. Pick one of the candidates.`)
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export function cardUrl(searcher: CatalogSearcher, page: string): string {
|
|
1036
|
+
return absolute(searcher.site, page)
|
|
1037
|
+
}
|