@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
|
@@ -3,7 +3,9 @@ import {
|
|
|
3
3
|
registerCliModules,
|
|
4
4
|
getCliModules,
|
|
5
5
|
hasCliModules,
|
|
6
|
+
isHelpRequest,
|
|
6
7
|
padByCodePointWidth,
|
|
8
|
+
resolveEnvBootstrapOptions,
|
|
7
9
|
run,
|
|
8
10
|
} from '../mercato'
|
|
9
11
|
import { pathIncludes } from '../lib/__tests__/path-helpers'
|
|
@@ -187,6 +189,421 @@ describe('padByCodePointWidth', () => {
|
|
|
187
189
|
})
|
|
188
190
|
})
|
|
189
191
|
|
|
192
|
+
describe('module command argument logging', () => {
|
|
193
|
+
beforeEach(() => {
|
|
194
|
+
jest.restoreAllMocks()
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it('redacts legacy encryption keys before logging module command arguments', async () => {
|
|
198
|
+
const rotateEncryptionKey = jest.fn().mockResolvedValue(undefined)
|
|
199
|
+
registerCliModules([
|
|
200
|
+
{
|
|
201
|
+
id: 'entities',
|
|
202
|
+
cli: [{ command: 'rotate-encryption-key', run: rotateEncryptionKey }],
|
|
203
|
+
} as Module,
|
|
204
|
+
])
|
|
205
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
206
|
+
|
|
207
|
+
expect(await run([
|
|
208
|
+
'node',
|
|
209
|
+
'mercato',
|
|
210
|
+
'entities',
|
|
211
|
+
'rotate-encryption-key',
|
|
212
|
+
'--old-key',
|
|
213
|
+
'argument-secret',
|
|
214
|
+
])).toBe(0)
|
|
215
|
+
expect(await run([
|
|
216
|
+
'node',
|
|
217
|
+
'mercato',
|
|
218
|
+
'entities',
|
|
219
|
+
'rotate-encryption-key',
|
|
220
|
+
'--oldKey=inline-secret',
|
|
221
|
+
])).toBe(0)
|
|
222
|
+
|
|
223
|
+
const output = consoleLogSpy.mock.calls.flat().map(String).join('\n')
|
|
224
|
+
expect(output).not.toContain('argument-secret')
|
|
225
|
+
expect(output).not.toContain('inline-secret')
|
|
226
|
+
expect(output).toContain('--old-key ****')
|
|
227
|
+
expect(output).toContain('--oldKey=****')
|
|
228
|
+
expect(rotateEncryptionKey).toHaveBeenCalledTimes(2)
|
|
229
|
+
consoleLogSpy.mockRestore()
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
// The echoed command line lands in terminal scrollback and CI logs, so every option that
|
|
233
|
+
// carries a credential has to be covered — not just the one the encryption work introduced.
|
|
234
|
+
it('redacts passwords and API keys passed to any module command', async () => {
|
|
235
|
+
const setup = jest.fn().mockResolvedValue(undefined)
|
|
236
|
+
const chat = jest.fn().mockResolvedValue(undefined)
|
|
237
|
+
registerCliModules([
|
|
238
|
+
{ id: 'auth', cli: [{ command: 'setup', run: setup }] } as Module,
|
|
239
|
+
{ id: 'ai_assistant', cli: [{ command: 'chat', run: chat }] } as Module,
|
|
240
|
+
])
|
|
241
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
242
|
+
|
|
243
|
+
expect(await run(['node', 'mercato', 'auth', 'setup', '--password', 'hunter2-secret'])).toBe(0)
|
|
244
|
+
expect(await run(['node', 'mercato', 'ai_assistant', 'chat', '--api-key', 'sk-live-secret'])).toBe(0)
|
|
245
|
+
expect(await run(['node', 'mercato', 'ai_assistant', 'chat', '--apiKey=sk-inline-secret'])).toBe(0)
|
|
246
|
+
|
|
247
|
+
const output = consoleLogSpy.mock.calls.flat().map(String).join('\n')
|
|
248
|
+
expect(output).not.toContain('hunter2-secret')
|
|
249
|
+
expect(output).not.toContain('sk-live-secret')
|
|
250
|
+
expect(output).not.toContain('sk-inline-secret')
|
|
251
|
+
expect(output).toContain('--password ****')
|
|
252
|
+
expect(output).toContain('--api-key ****')
|
|
253
|
+
expect(output).toContain('--apiKey=****')
|
|
254
|
+
consoleLogSpy.mockRestore()
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
// `--key` is key material in `seeds encrypt|decrypt|load` and a custom-field key in
|
|
258
|
+
// `entities add-field`, so the redaction has to be per-command rather than global.
|
|
259
|
+
it('redacts --key only for the commands where it carries key material', async () => {
|
|
260
|
+
const encrypt = jest.fn().mockResolvedValue(undefined)
|
|
261
|
+
const addField = jest.fn().mockResolvedValue(undefined)
|
|
262
|
+
registerCliModules([
|
|
263
|
+
{ id: 'seeds', cli: [{ command: 'encrypt', run: encrypt }] } as Module,
|
|
264
|
+
{ id: 'entities', cli: [{ command: 'add-field', run: addField }] } as Module,
|
|
265
|
+
])
|
|
266
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
267
|
+
|
|
268
|
+
expect(await run(['node', 'mercato', 'seeds', 'encrypt', '--key', 'base64-seed-key'])).toBe(0)
|
|
269
|
+
expect(await run(['node', 'mercato', 'entities', 'add-field', '--key', 'priority_level'])).toBe(0)
|
|
270
|
+
|
|
271
|
+
const output = consoleLogSpy.mock.calls.flat().map(String).join('\n')
|
|
272
|
+
expect(output).not.toContain('base64-seed-key')
|
|
273
|
+
expect(output).toContain('--key ****')
|
|
274
|
+
expect(output).toContain('--key priority_level')
|
|
275
|
+
consoleLogSpy.mockRestore()
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
describe('--help never triggers side effects (issue #5581)', () => {
|
|
280
|
+
beforeEach(() => {
|
|
281
|
+
jest.restoreAllMocks()
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
describe('isHelpRequest', () => {
|
|
285
|
+
it('matches the long and short help flags in any position', () => {
|
|
286
|
+
expect(isHelpRequest(['db', 'generate', '--help'])).toBe(true)
|
|
287
|
+
expect(isHelpRequest(['-h'])).toBe(true)
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
it('does not match arguments that merely contain the flag text', () => {
|
|
291
|
+
expect(isHelpRequest(['db', 'generate'])).toBe(false)
|
|
292
|
+
expect(isHelpRequest(['--help-me'])).toBe(false)
|
|
293
|
+
expect(isHelpRequest(['--no-help'])).toBe(false)
|
|
294
|
+
expect(isHelpRequest([])).toBe(false)
|
|
295
|
+
})
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
describe('resolveEnvBootstrapOptions', () => {
|
|
299
|
+
it('refuses to create .env from .env.example for a help invocation', () => {
|
|
300
|
+
expect(resolveEnvBootstrapOptions(['db', 'generate', '--help'])).toEqual({
|
|
301
|
+
createIfMissing: false,
|
|
302
|
+
quiet: true,
|
|
303
|
+
})
|
|
304
|
+
expect(resolveEnvBootstrapOptions(['-h'])).toEqual({ createIfMissing: false, quiet: true })
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
it('still creates .env for a real command invocation', () => {
|
|
308
|
+
expect(resolveEnvBootstrapOptions(['db', 'generate'])).toEqual({
|
|
309
|
+
createIfMissing: true,
|
|
310
|
+
quiet: false,
|
|
311
|
+
})
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
it.each(['--quiet', '-q'])('silences generation environment loading for %s only', (flag) => {
|
|
315
|
+
expect(resolveEnvBootstrapOptions(['generate', 'all', flag])).toEqual({
|
|
316
|
+
createIfMissing: true,
|
|
317
|
+
quiet: true,
|
|
318
|
+
})
|
|
319
|
+
expect(resolveEnvBootstrapOptions(['db', 'generate', flag])).toEqual({
|
|
320
|
+
createIfMissing: true,
|
|
321
|
+
quiet: false,
|
|
322
|
+
})
|
|
323
|
+
expect(resolveEnvBootstrapOptions(['generate', 'all']).quiet).toBe(false)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
it('keeps module search and module info read-only and quiet, so --json output parses', () => {
|
|
327
|
+
expect(resolveEnvBootstrapOptions(['module', 'search', 'ksef', '--json'])).toEqual({
|
|
328
|
+
createIfMissing: false,
|
|
329
|
+
quiet: true,
|
|
330
|
+
})
|
|
331
|
+
expect(resolveEnvBootstrapOptions(['module', 'search', 'ksef'])).toEqual({
|
|
332
|
+
createIfMissing: false,
|
|
333
|
+
quiet: true,
|
|
334
|
+
})
|
|
335
|
+
expect(resolveEnvBootstrapOptions(['module', 'info', '@open-mercato/webhooks'])).toEqual({
|
|
336
|
+
createIfMissing: false,
|
|
337
|
+
quiet: true,
|
|
338
|
+
})
|
|
339
|
+
// module add changes the app: it may still create .env, and prints as before
|
|
340
|
+
expect(resolveEnvBootstrapOptions(['module', 'add', '@open-mercato/webhooks'])).toEqual({
|
|
341
|
+
createIfMissing: true,
|
|
342
|
+
quiet: false,
|
|
343
|
+
})
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
it('silences the dotenv line for any --json invocation', () => {
|
|
347
|
+
expect(resolveEnvBootstrapOptions(['db', 'status', '--json'])).toEqual({
|
|
348
|
+
createIfMissing: true,
|
|
349
|
+
quiet: true,
|
|
350
|
+
})
|
|
351
|
+
})
|
|
352
|
+
|
|
353
|
+
it('keeps the pre-existing deploy and telemetry opt-outs', () => {
|
|
354
|
+
expect(resolveEnvBootstrapOptions(['deploy', 'railway'])).toEqual({
|
|
355
|
+
createIfMissing: false,
|
|
356
|
+
quiet: true,
|
|
357
|
+
})
|
|
358
|
+
expect(resolveEnvBootstrapOptions(['telemetry', 'init'])).toEqual({
|
|
359
|
+
createIfMissing: false,
|
|
360
|
+
quiet: true,
|
|
361
|
+
})
|
|
362
|
+
})
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
describe('dispatcher help branch', () => {
|
|
366
|
+
it('prints usage instead of running db:generate when --help is passed', async () => {
|
|
367
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
368
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
369
|
+
const dbGenerate = jest.fn()
|
|
370
|
+
|
|
371
|
+
registerCliModules([
|
|
372
|
+
{
|
|
373
|
+
id: 'db',
|
|
374
|
+
cli: [{ command: 'generate', help: 'Writes migrations. Applies nothing.', run: dbGenerate }],
|
|
375
|
+
} as any,
|
|
376
|
+
])
|
|
377
|
+
|
|
378
|
+
const exitCode = await run(['node', 'mercato', 'db', 'generate', '--help'])
|
|
379
|
+
|
|
380
|
+
expect(exitCode).toBe(0)
|
|
381
|
+
expect(dbGenerate).not.toHaveBeenCalled()
|
|
382
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
383
|
+
expect(printed).toContain('mercato db generate [args]')
|
|
384
|
+
expect(printed).toContain('Writes migrations. Applies nothing.')
|
|
385
|
+
|
|
386
|
+
consoleLogSpy.mockRestore()
|
|
387
|
+
consoleErrorSpy.mockRestore()
|
|
388
|
+
})
|
|
389
|
+
|
|
390
|
+
it('prints usage instead of running db:migrate when -h is passed', async () => {
|
|
391
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
392
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
393
|
+
const dbMigrate = jest.fn()
|
|
394
|
+
|
|
395
|
+
registerCliModules([
|
|
396
|
+
{ id: 'db', cli: [{ command: 'migrate', run: dbMigrate }] } as any,
|
|
397
|
+
])
|
|
398
|
+
|
|
399
|
+
const exitCode = await run(['node', 'mercato', 'db', 'migrate', '-h'])
|
|
400
|
+
|
|
401
|
+
expect(exitCode).toBe(0)
|
|
402
|
+
expect(dbMigrate).not.toHaveBeenCalled()
|
|
403
|
+
|
|
404
|
+
consoleLogSpy.mockRestore()
|
|
405
|
+
consoleErrorSpy.mockRestore()
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
it('prints usage instead of destroying data when greenfield --yes --help is passed', async () => {
|
|
409
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
410
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
411
|
+
const dbGreenfield = jest.fn()
|
|
412
|
+
|
|
413
|
+
registerCliModules([
|
|
414
|
+
{
|
|
415
|
+
id: 'db',
|
|
416
|
+
cli: [{
|
|
417
|
+
command: 'greenfield',
|
|
418
|
+
help: 'Destroys all data.',
|
|
419
|
+
run: dbGreenfield,
|
|
420
|
+
}],
|
|
421
|
+
} as any,
|
|
422
|
+
])
|
|
423
|
+
|
|
424
|
+
// --yes is the flag that skips greenfield's confirmation prompt, so pairing it with
|
|
425
|
+
// --help is the scenario that must never reach `run`, regardless of flag order.
|
|
426
|
+
const exitCode = await run(['node', 'mercato', 'db', 'greenfield', '--yes', '--help'])
|
|
427
|
+
|
|
428
|
+
expect(exitCode).toBe(0)
|
|
429
|
+
expect(dbGreenfield).not.toHaveBeenCalled()
|
|
430
|
+
|
|
431
|
+
consoleLogSpy.mockRestore()
|
|
432
|
+
consoleErrorSpy.mockRestore()
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
it('forwards --help to commands that declare handlesHelp', async () => {
|
|
436
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
437
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
438
|
+
const deploy = jest.fn()
|
|
439
|
+
|
|
440
|
+
registerCliModules([
|
|
441
|
+
{ id: 'deploy', cli: [{ command: 'railway', handlesHelp: true, run: deploy }] } as any,
|
|
442
|
+
])
|
|
443
|
+
|
|
444
|
+
const exitCode = await run(['node', 'mercato', 'deploy', 'railway', '--help'])
|
|
445
|
+
|
|
446
|
+
expect(exitCode).toBe(0)
|
|
447
|
+
expect(deploy).toHaveBeenCalledWith(['--help'])
|
|
448
|
+
|
|
449
|
+
consoleLogSpy.mockRestore()
|
|
450
|
+
consoleErrorSpy.mockRestore()
|
|
451
|
+
})
|
|
452
|
+
|
|
453
|
+
it('lists module search and info in the module command help', async () => {
|
|
454
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
455
|
+
|
|
456
|
+
const exitCode = await run(['node', 'mercato', 'module', '--help'])
|
|
457
|
+
|
|
458
|
+
expect(exitCode).toBe(0)
|
|
459
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
460
|
+
expect(printed).toContain('yarn mercato module search [<query>]')
|
|
461
|
+
expect(printed).toContain('yarn mercato module info <package-or-module-id> [--json]')
|
|
462
|
+
|
|
463
|
+
consoleLogSpy.mockRestore()
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
it('routes module search without a query to its usage, before any network call', async () => {
|
|
467
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
468
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
469
|
+
|
|
470
|
+
const searchExit = await run(['node', 'mercato', 'module', 'search'])
|
|
471
|
+
const infoExit = await run(['node', 'mercato', 'module', 'info'])
|
|
472
|
+
|
|
473
|
+
expect(searchExit).toBe(1)
|
|
474
|
+
expect(infoExit).toBe(1)
|
|
475
|
+
const printed = consoleErrorSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
476
|
+
expect(printed).toContain('Usage: yarn mercato module search [<query>]')
|
|
477
|
+
expect(printed).toContain('Usage: yarn mercato module info <package-or-module-id> [--json]')
|
|
478
|
+
|
|
479
|
+
consoleLogSpy.mockRestore()
|
|
480
|
+
consoleErrorSpy.mockRestore()
|
|
481
|
+
})
|
|
482
|
+
|
|
483
|
+
it('lists the module commands when the help flag sits in the command slot', async () => {
|
|
484
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
485
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
486
|
+
const dbGenerate = jest.fn()
|
|
487
|
+
|
|
488
|
+
registerCliModules([
|
|
489
|
+
{
|
|
490
|
+
id: 'db',
|
|
491
|
+
cli: [
|
|
492
|
+
{ command: 'generate', run: dbGenerate },
|
|
493
|
+
{ command: 'migrate', run: jest.fn() },
|
|
494
|
+
],
|
|
495
|
+
} as any,
|
|
496
|
+
])
|
|
497
|
+
|
|
498
|
+
const exitCode = await run(['node', 'mercato', 'db', '--help'])
|
|
499
|
+
|
|
500
|
+
expect(exitCode).toBe(0)
|
|
501
|
+
expect(dbGenerate).not.toHaveBeenCalled()
|
|
502
|
+
expect(consoleErrorSpy).not.toHaveBeenCalled()
|
|
503
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
504
|
+
expect(printed).toContain('Commands for "db": generate, migrate')
|
|
505
|
+
|
|
506
|
+
consoleLogSpy.mockRestore()
|
|
507
|
+
consoleErrorSpy.mockRestore()
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
it('lets a self-documenting command print its own subcommand help', async () => {
|
|
511
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
512
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
513
|
+
// Mirrors packages/core/src/modules/configs/cli.ts, whose `cache` command routes
|
|
514
|
+
// --help to its own printCacheHelp() rather than to the dispatcher's generic usage.
|
|
515
|
+
const cache = jest.fn((rest: string[]) => {
|
|
516
|
+
if (rest[0] === '--help') console.log('configs cache: stats | purge | structural')
|
|
517
|
+
})
|
|
518
|
+
|
|
519
|
+
registerCliModules([
|
|
520
|
+
{ id: 'configs', cli: [{ command: 'cache', handlesHelp: true, run: cache }] } as any,
|
|
521
|
+
])
|
|
522
|
+
|
|
523
|
+
const exitCode = await run(['node', 'mercato', 'configs', 'cache', '--help'])
|
|
524
|
+
|
|
525
|
+
expect(exitCode).toBe(0)
|
|
526
|
+
expect(cache).toHaveBeenCalledWith(['--help'])
|
|
527
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
528
|
+
expect(printed).toContain('configs cache: stats | purge | structural')
|
|
529
|
+
expect(printed).not.toContain('Usage: ✨ mercato configs cache [args]')
|
|
530
|
+
|
|
531
|
+
consoleLogSpy.mockRestore()
|
|
532
|
+
consoleErrorSpy.mockRestore()
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
it('still runs the command when no help flag is present', async () => {
|
|
536
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
537
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
538
|
+
const dbGenerate = jest.fn()
|
|
539
|
+
|
|
540
|
+
registerCliModules([
|
|
541
|
+
{ id: 'db', cli: [{ command: 'generate', run: dbGenerate }] } as any,
|
|
542
|
+
])
|
|
543
|
+
|
|
544
|
+
const exitCode = await run(['node', 'mercato', 'db', 'generate'])
|
|
545
|
+
|
|
546
|
+
expect(exitCode).toBe(0)
|
|
547
|
+
expect(dbGenerate).toHaveBeenCalled()
|
|
548
|
+
|
|
549
|
+
consoleLogSpy.mockRestore()
|
|
550
|
+
consoleErrorSpy.mockRestore()
|
|
551
|
+
})
|
|
552
|
+
})
|
|
553
|
+
|
|
554
|
+
describe('top-level command help', () => {
|
|
555
|
+
it('prints usage instead of initializing the app when init --help is passed', async () => {
|
|
556
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
557
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
558
|
+
|
|
559
|
+
const exitCode = await run(['node', 'mercato', 'init', '--help'])
|
|
560
|
+
|
|
561
|
+
expect(exitCode).toBe(0)
|
|
562
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
563
|
+
expect(printed).toContain('Usage: mercato init')
|
|
564
|
+
expect(printed).toContain('--skip-if-initialized')
|
|
565
|
+
|
|
566
|
+
consoleLogSpy.mockRestore()
|
|
567
|
+
consoleErrorSpy.mockRestore()
|
|
568
|
+
})
|
|
569
|
+
|
|
570
|
+
it('prints usage instead of seeding when seed:defaults --help is passed', async () => {
|
|
571
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
572
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
573
|
+
|
|
574
|
+
const exitCode = await run(['node', 'mercato', 'seed:defaults', '--help'])
|
|
575
|
+
|
|
576
|
+
expect(exitCode).toBe(0)
|
|
577
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
578
|
+
expect(printed).toContain('Usage: mercato seed:defaults')
|
|
579
|
+
|
|
580
|
+
consoleLogSpy.mockRestore()
|
|
581
|
+
consoleErrorSpy.mockRestore()
|
|
582
|
+
})
|
|
583
|
+
|
|
584
|
+
it.each(['constructor', 'toString', 'valueOf', 'hasOwnProperty', '__proto__'])(
|
|
585
|
+
'reports %s as an unknown module instead of matching an inherited prototype key',
|
|
586
|
+
async (inheritedKey) => {
|
|
587
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
588
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
589
|
+
|
|
590
|
+
registerCliModules([
|
|
591
|
+
{ id: 'db', cli: [{ command: 'generate', run: jest.fn() }] } as any,
|
|
592
|
+
])
|
|
593
|
+
|
|
594
|
+
const exitCode = await run(['node', 'mercato', inheritedKey, '--help'])
|
|
595
|
+
|
|
596
|
+
expect(exitCode).toBe(1)
|
|
597
|
+
const errors = consoleErrorSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
598
|
+
expect(errors).toContain(`Module not found: "${inheritedKey}"`)
|
|
599
|
+
|
|
600
|
+
consoleLogSpy.mockRestore()
|
|
601
|
+
consoleErrorSpy.mockRestore()
|
|
602
|
+
},
|
|
603
|
+
)
|
|
604
|
+
})
|
|
605
|
+
})
|
|
606
|
+
|
|
190
607
|
describe('db command failure output', () => {
|
|
191
608
|
const originalDatabaseUrl = process.env.DATABASE_URL
|
|
192
609
|
|
|
@@ -313,6 +730,110 @@ describe('db command failure output', () => {
|
|
|
313
730
|
})
|
|
314
731
|
})
|
|
315
732
|
|
|
733
|
+
describe('module command exit signal propagation', () => {
|
|
734
|
+
let consoleErrorSpy: jest.SpyInstance
|
|
735
|
+
let consoleLogSpy: jest.SpyInstance
|
|
736
|
+
|
|
737
|
+
beforeEach(() => {
|
|
738
|
+
jest.restoreAllMocks()
|
|
739
|
+
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
740
|
+
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
741
|
+
})
|
|
742
|
+
|
|
743
|
+
afterEach(() => {
|
|
744
|
+
consoleErrorSpy.mockRestore()
|
|
745
|
+
consoleLogSpy.mockRestore()
|
|
746
|
+
process.exitCode = undefined
|
|
747
|
+
})
|
|
748
|
+
|
|
749
|
+
it('propagates a non-zero process.exitCode set by a command that does not throw', async () => {
|
|
750
|
+
registerCliModules([
|
|
751
|
+
{
|
|
752
|
+
id: 'reporting',
|
|
753
|
+
cli: [{
|
|
754
|
+
command: 'export',
|
|
755
|
+
run: jest.fn().mockImplementation(async () => {
|
|
756
|
+
process.exitCode = 1
|
|
757
|
+
}),
|
|
758
|
+
}],
|
|
759
|
+
} as any,
|
|
760
|
+
])
|
|
761
|
+
|
|
762
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
763
|
+
|
|
764
|
+
expect(exitCode).toBe(1)
|
|
765
|
+
})
|
|
766
|
+
|
|
767
|
+
it('preserves the exact exit code a command signals rather than collapsing it to 1', async () => {
|
|
768
|
+
registerCliModules([
|
|
769
|
+
{
|
|
770
|
+
id: 'reporting',
|
|
771
|
+
cli: [{
|
|
772
|
+
command: 'export',
|
|
773
|
+
run: jest.fn().mockImplementation(async () => {
|
|
774
|
+
process.exitCode = 42
|
|
775
|
+
}),
|
|
776
|
+
}],
|
|
777
|
+
} as any,
|
|
778
|
+
])
|
|
779
|
+
|
|
780
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
781
|
+
|
|
782
|
+
expect(exitCode).toBe(42)
|
|
783
|
+
})
|
|
784
|
+
|
|
785
|
+
it('returns 0 for a command that completes without signalling a failure', async () => {
|
|
786
|
+
registerCliModules([
|
|
787
|
+
{
|
|
788
|
+
id: 'reporting',
|
|
789
|
+
cli: [{ command: 'export', run: jest.fn().mockResolvedValue(undefined) }],
|
|
790
|
+
} as any,
|
|
791
|
+
])
|
|
792
|
+
|
|
793
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
794
|
+
|
|
795
|
+
expect(exitCode).toBe(0)
|
|
796
|
+
})
|
|
797
|
+
|
|
798
|
+
it('ignores a non-zero process.exitCode inherited from before the command ran', async () => {
|
|
799
|
+
process.exitCode = 7
|
|
800
|
+
|
|
801
|
+
registerCliModules([
|
|
802
|
+
{
|
|
803
|
+
id: 'reporting',
|
|
804
|
+
cli: [{ command: 'export', run: jest.fn().mockResolvedValue(undefined) }],
|
|
805
|
+
} as any,
|
|
806
|
+
])
|
|
807
|
+
|
|
808
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
809
|
+
|
|
810
|
+
expect(exitCode).toBe(0)
|
|
811
|
+
expect(process.exitCode).toBe(7)
|
|
812
|
+
})
|
|
813
|
+
|
|
814
|
+
it('still reports 1 when a command throws, regardless of process.exitCode', async () => {
|
|
815
|
+
process.exitCode = 7
|
|
816
|
+
|
|
817
|
+
registerCliModules([
|
|
818
|
+
{
|
|
819
|
+
id: 'reporting',
|
|
820
|
+
cli: [{
|
|
821
|
+
command: 'export',
|
|
822
|
+
run: jest.fn().mockImplementation(async () => {
|
|
823
|
+
process.exitCode = 3
|
|
824
|
+
throw new Error('export failed')
|
|
825
|
+
}),
|
|
826
|
+
}],
|
|
827
|
+
} as any,
|
|
828
|
+
])
|
|
829
|
+
|
|
830
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
831
|
+
|
|
832
|
+
expect(exitCode).toBe(1)
|
|
833
|
+
expect(process.exitCode).toBe(7)
|
|
834
|
+
})
|
|
835
|
+
})
|
|
836
|
+
|
|
316
837
|
describe('init command failure output', () => {
|
|
317
838
|
const originalDatabaseUrl = process.env.DATABASE_URL
|
|
318
839
|
|
|
@@ -529,6 +1050,380 @@ describe('init command failure output', () => {
|
|
|
529
1050
|
consoleErrorSpy.mockRestore()
|
|
530
1051
|
consoleLogSpy.mockRestore()
|
|
531
1052
|
})
|
|
1053
|
+
|
|
1054
|
+
function mockInitDependencies({
|
|
1055
|
+
authSetup,
|
|
1056
|
+
}: {
|
|
1057
|
+
authSetup: jest.Mock
|
|
1058
|
+
}) {
|
|
1059
|
+
jest.doMock('child_process', () => ({
|
|
1060
|
+
execSync: jest.fn(),
|
|
1061
|
+
}))
|
|
1062
|
+
jest.doMock('pg', () => ({
|
|
1063
|
+
Client: jest.fn().mockImplementation(() => ({
|
|
1064
|
+
connect: jest.fn().mockResolvedValue(undefined),
|
|
1065
|
+
query: jest.fn().mockResolvedValue({
|
|
1066
|
+
rows: [{ org_id: 'org-1', tenant_id: 'tenant-1' }],
|
|
1067
|
+
}),
|
|
1068
|
+
end: jest.fn().mockResolvedValue(undefined),
|
|
1069
|
+
})),
|
|
1070
|
+
}))
|
|
1071
|
+
jest.doMock('../lib/generators', () => ({
|
|
1072
|
+
generateEntityIds: jest.fn().mockResolvedValue(undefined),
|
|
1073
|
+
generateModuleRegistries: jest.fn().mockResolvedValue(undefined),
|
|
1074
|
+
generateModuleEntities: jest.fn().mockResolvedValue(undefined),
|
|
1075
|
+
generateModuleDi: jest.fn().mockResolvedValue(undefined),
|
|
1076
|
+
generateModulePackageSources: jest.fn().mockResolvedValue(undefined),
|
|
1077
|
+
generateWebResearchAdapters: jest.fn().mockResolvedValue(undefined),
|
|
1078
|
+
generateOpenApi: jest.fn().mockResolvedValue(undefined),
|
|
1079
|
+
}))
|
|
1080
|
+
jest.doMock('../lib/db', () => ({
|
|
1081
|
+
dbMigrate: jest.fn().mockResolvedValue(undefined),
|
|
1082
|
+
}))
|
|
1083
|
+
jest.doMock('../lib/resolver', () => ({
|
|
1084
|
+
createResolver: () => ({
|
|
1085
|
+
getAppDir: () => '/tmp/test-app',
|
|
1086
|
+
}),
|
|
1087
|
+
}))
|
|
1088
|
+
jest.doMock('@open-mercato/shared/lib/bootstrap/dynamicLoader', () => ({
|
|
1089
|
+
bootstrapFromAppRoot: jest.fn().mockResolvedValue({
|
|
1090
|
+
modules: [
|
|
1091
|
+
{
|
|
1092
|
+
id: 'configs',
|
|
1093
|
+
cli: [{ command: 'restore-defaults', run: jest.fn().mockResolvedValue(undefined) }],
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
id: 'auth',
|
|
1097
|
+
cli: [
|
|
1098
|
+
{ command: 'setup', run: authSetup },
|
|
1099
|
+
{ command: 'seed-roles', run: jest.fn().mockResolvedValue(undefined) },
|
|
1100
|
+
],
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
id: 'entities',
|
|
1104
|
+
cli: [{ command: 'seed-encryption', run: jest.fn().mockResolvedValue(undefined) }],
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
id: 'query_index',
|
|
1108
|
+
cli: [{ command: 'reindex', run: jest.fn().mockResolvedValue(undefined) }],
|
|
1109
|
+
},
|
|
1110
|
+
],
|
|
1111
|
+
}),
|
|
1112
|
+
}))
|
|
1113
|
+
jest.doMock('@open-mercato/shared/lib/di/container', () => ({
|
|
1114
|
+
createRequestContainer: jest.fn().mockResolvedValue({
|
|
1115
|
+
resolve: jest.fn().mockReturnValue({}),
|
|
1116
|
+
}),
|
|
1117
|
+
}))
|
|
1118
|
+
jest.doMock(
|
|
1119
|
+
'@open-mercato/core/modules/auth/lib/setup-app',
|
|
1120
|
+
() => ({
|
|
1121
|
+
ensureCustomRoleAcls: jest.fn().mockResolvedValue(undefined),
|
|
1122
|
+
}),
|
|
1123
|
+
{ virtual: true },
|
|
1124
|
+
)
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
it.each(['--reinstall', '--no-demo-users'])('rejects unsafe production init before side effects with %s', async (flag) => {
|
|
1128
|
+
const previousEnv = { ...process.env }
|
|
1129
|
+
jest.spyOn(console, 'error').mockImplementation()
|
|
1130
|
+
jest.spyOn(console, 'log').mockImplementation()
|
|
1131
|
+
const authSetup = jest.fn().mockResolvedValue(undefined)
|
|
1132
|
+
mockInitDependencies({ authSetup })
|
|
1133
|
+
process.env.NODE_ENV = 'production'
|
|
1134
|
+
process.env.OM_INIT_SUPERADMIN_PASSWORD = 'password'
|
|
1135
|
+
try {
|
|
1136
|
+
const mercato = await import('../mercato')
|
|
1137
|
+
expect(await mercato.run(['node', 'mercato', 'init', flag, '--skip-password-policy'])).toBe(1)
|
|
1138
|
+
const { Client } = await import('pg')
|
|
1139
|
+
const { generateEntityIds } = await import('../lib/generators')
|
|
1140
|
+
const { dbMigrate } = await import('../lib/db')
|
|
1141
|
+
expect(Client).not.toHaveBeenCalled()
|
|
1142
|
+
expect(generateEntityIds).not.toHaveBeenCalled()
|
|
1143
|
+
expect(dbMigrate).not.toHaveBeenCalled()
|
|
1144
|
+
expect(authSetup).not.toHaveBeenCalled()
|
|
1145
|
+
} finally {
|
|
1146
|
+
process.env = previousEnv
|
|
1147
|
+
}
|
|
1148
|
+
})
|
|
1149
|
+
|
|
1150
|
+
it('passes valid production credentials to auth setup without bypassing policy', async () => {
|
|
1151
|
+
const previousEnv = { ...process.env }
|
|
1152
|
+
jest.spyOn(console, 'error').mockImplementation()
|
|
1153
|
+
jest.spyOn(console, 'log').mockImplementation()
|
|
1154
|
+
const authSetup = jest.fn().mockResolvedValue(undefined)
|
|
1155
|
+
mockInitDependencies({ authSetup })
|
|
1156
|
+
process.env.NODE_ENV = 'production'
|
|
1157
|
+
process.env.OM_INIT_SUPERADMIN_PASSWORD = 'Unique-Owner-937!'
|
|
1158
|
+
try {
|
|
1159
|
+
const mercato = await import('../mercato')
|
|
1160
|
+
expect(await mercato.run(['node', 'mercato', 'init', '--no-demo-users', '--skip-password-policy'])).toBe(0)
|
|
1161
|
+
expect(authSetup).toHaveBeenCalledWith(expect.arrayContaining(['--password', 'Unique-Owner-937!']))
|
|
1162
|
+
expect(authSetup.mock.calls[0][0]).not.toContain('--skip-password-policy')
|
|
1163
|
+
} finally {
|
|
1164
|
+
process.env = previousEnv
|
|
1165
|
+
}
|
|
1166
|
+
})
|
|
1167
|
+
|
|
1168
|
+
it('passes --include-demo-users to auth setup by default', async () => {
|
|
1169
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1170
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1171
|
+
const authSetup = jest.fn().mockResolvedValue(undefined)
|
|
1172
|
+
mockInitDependencies({ authSetup })
|
|
1173
|
+
|
|
1174
|
+
const mercato = await import('../mercato')
|
|
1175
|
+
const exitCode = await mercato.run(['node', 'mercato', 'init'])
|
|
1176
|
+
|
|
1177
|
+
expect(exitCode).toBe(0)
|
|
1178
|
+
expect(authSetup).toHaveBeenCalledWith(expect.arrayContaining(['--include-demo-users']))
|
|
1179
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('👤 Demo accounts (admin@/employee@): enabled')
|
|
1180
|
+
const loggedLines = consoleLogSpy.mock.calls.map((args) => args.join(' '))
|
|
1181
|
+
expect(loggedLines.some((line) => line.includes('🧰 Admin'))).toBe(true)
|
|
1182
|
+
expect(loggedLines.some((line) => line.includes('👷 Employee'))).toBe(true)
|
|
1183
|
+
|
|
1184
|
+
consoleErrorSpy.mockRestore()
|
|
1185
|
+
consoleLogSpy.mockRestore()
|
|
1186
|
+
})
|
|
1187
|
+
|
|
1188
|
+
it('skips --include-demo-users when --no-demo-users is passed', async () => {
|
|
1189
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1190
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1191
|
+
const authSetup = jest.fn().mockResolvedValue(undefined)
|
|
1192
|
+
mockInitDependencies({ authSetup })
|
|
1193
|
+
|
|
1194
|
+
const mercato = await import('../mercato')
|
|
1195
|
+
const exitCode = await mercato.run(['node', 'mercato', 'init', '--no-demo-users'])
|
|
1196
|
+
|
|
1197
|
+
expect(exitCode).toBe(0)
|
|
1198
|
+
expect(authSetup).toHaveBeenCalled()
|
|
1199
|
+
expect(authSetup.mock.calls[0][0]).not.toContain('--include-demo-users')
|
|
1200
|
+
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
1201
|
+
'👤 Demo accounts (admin@/employee@): skipped (--no-demo-users)',
|
|
1202
|
+
)
|
|
1203
|
+
const loggedLines = consoleLogSpy.mock.calls.map((args) => args.join(' '))
|
|
1204
|
+
expect(loggedLines.some((line) => line.includes('🧰 Admin'))).toBe(false)
|
|
1205
|
+
expect(loggedLines.some((line) => line.includes('👷 Employee'))).toBe(false)
|
|
1206
|
+
|
|
1207
|
+
consoleErrorSpy.mockRestore()
|
|
1208
|
+
consoleLogSpy.mockRestore()
|
|
1209
|
+
})
|
|
1210
|
+
|
|
1211
|
+
it('derives admin/employee emails from the --email domain, not the acme.com default (#5806)', async () => {
|
|
1212
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1213
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1214
|
+
|
|
1215
|
+
delete process.env.OM_INIT_ADMIN_EMAIL
|
|
1216
|
+
delete process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1217
|
+
|
|
1218
|
+
let adminEmailAtSetupTime: string | undefined
|
|
1219
|
+
let employeeEmailAtSetupTime: string | undefined
|
|
1220
|
+
// Reads OM_INIT_ADMIN_EMAIL/OM_INIT_EMPLOYEE_EMAIL at call time, mirroring what the
|
|
1221
|
+
// real `auth setup` -> setupInitialTenant reads. `runModuleCommand` invokes this
|
|
1222
|
+
// in-process (not spawned), so the env vars `mercato init` sets right before this
|
|
1223
|
+
// call are visible here exactly as they would be for the real command.
|
|
1224
|
+
const authSetup = jest.fn().mockImplementation(async () => {
|
|
1225
|
+
adminEmailAtSetupTime = process.env.OM_INIT_ADMIN_EMAIL
|
|
1226
|
+
employeeEmailAtSetupTime = process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1227
|
+
})
|
|
1228
|
+
mockInitDependencies({ authSetup })
|
|
1229
|
+
|
|
1230
|
+
const mercato = await import('../mercato')
|
|
1231
|
+
const exitCode = await mercato.run([
|
|
1232
|
+
'node',
|
|
1233
|
+
'mercato',
|
|
1234
|
+
'init',
|
|
1235
|
+
'--email=superadmin@example.org',
|
|
1236
|
+
'--password=Strong-Pa55!!',
|
|
1237
|
+
])
|
|
1238
|
+
|
|
1239
|
+
expect(exitCode).toBe(0)
|
|
1240
|
+
expect(authSetup).toHaveBeenCalled()
|
|
1241
|
+
expect(adminEmailAtSetupTime).toBe('admin@example.org')
|
|
1242
|
+
expect(employeeEmailAtSetupTime).toBe('employee@example.org')
|
|
1243
|
+
|
|
1244
|
+
delete process.env.OM_INIT_ADMIN_EMAIL
|
|
1245
|
+
delete process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1246
|
+
consoleErrorSpy.mockRestore()
|
|
1247
|
+
consoleLogSpy.mockRestore()
|
|
1248
|
+
})
|
|
1249
|
+
|
|
1250
|
+
it('does not set OM_INIT_ADMIN_EMAIL when it would equal the superadmin email (#5806)', async () => {
|
|
1251
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1252
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1253
|
+
|
|
1254
|
+
delete process.env.OM_INIT_ADMIN_EMAIL
|
|
1255
|
+
delete process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1256
|
+
|
|
1257
|
+
let adminEmailAtSetupTime: string | undefined
|
|
1258
|
+
let employeeEmailAtSetupTime: string | undefined
|
|
1259
|
+
const authSetup = jest.fn().mockImplementation(async () => {
|
|
1260
|
+
adminEmailAtSetupTime = process.env.OM_INIT_ADMIN_EMAIL
|
|
1261
|
+
employeeEmailAtSetupTime = process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1262
|
+
})
|
|
1263
|
+
mockInitDependencies({ authSetup })
|
|
1264
|
+
|
|
1265
|
+
const mercato = await import('../mercato')
|
|
1266
|
+
const exitCode = await mercato.run([
|
|
1267
|
+
'node',
|
|
1268
|
+
'mercato',
|
|
1269
|
+
'init',
|
|
1270
|
+
'--email=admin@example.org',
|
|
1271
|
+
'--password=Strong-Pa55!!',
|
|
1272
|
+
])
|
|
1273
|
+
|
|
1274
|
+
expect(exitCode).toBe(0)
|
|
1275
|
+
expect(authSetup).toHaveBeenCalled()
|
|
1276
|
+
// Derived admin@example.org would collide with the superadmin — leave unset so
|
|
1277
|
+
// deactivateDemoUsersIfSelfOnboardingEnabled cannot lock the primary account out.
|
|
1278
|
+
expect(adminEmailAtSetupTime).toBeUndefined()
|
|
1279
|
+
expect(employeeEmailAtSetupTime).toBe('employee@example.org')
|
|
1280
|
+
|
|
1281
|
+
delete process.env.OM_INIT_ADMIN_EMAIL
|
|
1282
|
+
delete process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1283
|
+
consoleErrorSpy.mockRestore()
|
|
1284
|
+
consoleLogSpy.mockRestore()
|
|
1285
|
+
})
|
|
1286
|
+
|
|
1287
|
+
it('does not set OM_INIT_*_EMAIL when --no-demo-users is passed (#5806)', async () => {
|
|
1288
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1289
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1290
|
+
|
|
1291
|
+
delete process.env.OM_INIT_ADMIN_EMAIL
|
|
1292
|
+
delete process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1293
|
+
|
|
1294
|
+
let adminEmailAtSetupTime: string | undefined
|
|
1295
|
+
let employeeEmailAtSetupTime: string | undefined
|
|
1296
|
+
const authSetup = jest.fn().mockImplementation(async () => {
|
|
1297
|
+
adminEmailAtSetupTime = process.env.OM_INIT_ADMIN_EMAIL
|
|
1298
|
+
employeeEmailAtSetupTime = process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1299
|
+
})
|
|
1300
|
+
mockInitDependencies({ authSetup })
|
|
1301
|
+
|
|
1302
|
+
const mercato = await import('../mercato')
|
|
1303
|
+
const exitCode = await mercato.run([
|
|
1304
|
+
'node',
|
|
1305
|
+
'mercato',
|
|
1306
|
+
'init',
|
|
1307
|
+
'--email=superadmin@example.org',
|
|
1308
|
+
'--password=Strong-Pa55!!',
|
|
1309
|
+
'--no-demo-users',
|
|
1310
|
+
])
|
|
1311
|
+
|
|
1312
|
+
expect(exitCode).toBe(0)
|
|
1313
|
+
expect(authSetup).toHaveBeenCalled()
|
|
1314
|
+
expect(adminEmailAtSetupTime).toBeUndefined()
|
|
1315
|
+
expect(employeeEmailAtSetupTime).toBeUndefined()
|
|
1316
|
+
|
|
1317
|
+
delete process.env.OM_INIT_ADMIN_EMAIL
|
|
1318
|
+
delete process.env.OM_INIT_EMPLOYEE_EMAIL
|
|
1319
|
+
consoleErrorSpy.mockRestore()
|
|
1320
|
+
consoleLogSpy.mockRestore()
|
|
1321
|
+
})
|
|
1322
|
+
})
|
|
1323
|
+
|
|
1324
|
+
describe('init on an already initialized database', () => {
|
|
1325
|
+
const originalDatabaseUrl = process.env.DATABASE_URL
|
|
1326
|
+
|
|
1327
|
+
beforeEach(() => {
|
|
1328
|
+
jest.restoreAllMocks()
|
|
1329
|
+
jest.resetModules()
|
|
1330
|
+
process.env.DATABASE_URL = 'postgres://postgres:secret@db.example.com:6543/shop_a'
|
|
1331
|
+
})
|
|
1332
|
+
|
|
1333
|
+
afterEach(() => {
|
|
1334
|
+
jest.dontMock('child_process')
|
|
1335
|
+
jest.dontMock('pg')
|
|
1336
|
+
jest.dontMock('../lib/generators')
|
|
1337
|
+
jest.dontMock('../lib/resolver')
|
|
1338
|
+
jest.resetModules()
|
|
1339
|
+
})
|
|
1340
|
+
|
|
1341
|
+
afterAll(() => {
|
|
1342
|
+
process.env.DATABASE_URL = originalDatabaseUrl
|
|
1343
|
+
})
|
|
1344
|
+
|
|
1345
|
+
function mockSeededDatabase(usersCount: string) {
|
|
1346
|
+
const generateEntityIds = jest.fn().mockResolvedValue(undefined)
|
|
1347
|
+
jest.doMock('child_process', () => ({ execSync: jest.fn() }))
|
|
1348
|
+
jest.doMock('pg', () => ({
|
|
1349
|
+
Client: jest.fn().mockImplementation(() => ({
|
|
1350
|
+
connect: jest.fn().mockResolvedValue(undefined),
|
|
1351
|
+
end: jest.fn().mockResolvedValue(undefined),
|
|
1352
|
+
query: jest.fn().mockImplementation(async (sql: string) => {
|
|
1353
|
+
if (sql.includes('pg_database')) return { rows: [{ exists: 1 }] }
|
|
1354
|
+
if (sql.includes('to_regclass')) return { rows: [{ regclass: 'users' }] }
|
|
1355
|
+
if (sql.includes('COUNT(*)')) return { rows: [{ count: usersCount }] }
|
|
1356
|
+
return { rows: [] }
|
|
1357
|
+
}),
|
|
1358
|
+
})),
|
|
1359
|
+
}))
|
|
1360
|
+
jest.doMock('../lib/generators', () => ({
|
|
1361
|
+
generateEntityIds,
|
|
1362
|
+
generateModuleRegistries: jest.fn().mockResolvedValue(undefined),
|
|
1363
|
+
generateModuleEntities: jest.fn().mockResolvedValue(undefined),
|
|
1364
|
+
generateModuleDi: jest.fn().mockResolvedValue(undefined),
|
|
1365
|
+
generateModulePackageSources: jest.fn().mockResolvedValue(undefined),
|
|
1366
|
+
generateWebResearchAdapters: jest.fn().mockResolvedValue(undefined),
|
|
1367
|
+
generateOpenApi: jest.fn().mockResolvedValue(undefined),
|
|
1368
|
+
}))
|
|
1369
|
+
jest.doMock('../lib/resolver', () => ({
|
|
1370
|
+
createResolver: () => ({ getAppDir: () => '/tmp/test-app' }),
|
|
1371
|
+
}))
|
|
1372
|
+
return { generateEntityIds }
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
it('aborts without --skip-if-initialized and points at the explicit reinstall', async () => {
|
|
1376
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1377
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1378
|
+
const { generateEntityIds } = mockSeededDatabase('2')
|
|
1379
|
+
|
|
1380
|
+
const mercato = await import('../mercato')
|
|
1381
|
+
const exitCode = await mercato.run(['node', 'mercato', 'init'])
|
|
1382
|
+
|
|
1383
|
+
expect(exitCode).toBe(1)
|
|
1384
|
+
const errors = consoleErrorSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
1385
|
+
expect(errors).toContain('Initialization aborted: found 2 existing user(s)')
|
|
1386
|
+
expect(generateEntityIds).not.toHaveBeenCalled()
|
|
1387
|
+
|
|
1388
|
+
consoleErrorSpy.mockRestore()
|
|
1389
|
+
consoleLogSpy.mockRestore()
|
|
1390
|
+
})
|
|
1391
|
+
|
|
1392
|
+
it('skips an initialized production database without bootstrap credentials', async () => {
|
|
1393
|
+
const previousEnv = { ...process.env }
|
|
1394
|
+
jest.spyOn(console, 'error').mockImplementation()
|
|
1395
|
+
jest.spyOn(console, 'log').mockImplementation()
|
|
1396
|
+
const { generateEntityIds } = mockSeededDatabase('3')
|
|
1397
|
+
process.env.NODE_ENV = 'production'
|
|
1398
|
+
delete process.env.OM_INIT_SUPERADMIN_PASSWORD
|
|
1399
|
+
try {
|
|
1400
|
+
const mercato = await import('../mercato')
|
|
1401
|
+
expect(await mercato.run(['node', 'mercato', 'init', '--skip-if-initialized'])).toBe(0)
|
|
1402
|
+
expect(generateEntityIds).not.toHaveBeenCalled()
|
|
1403
|
+
} finally {
|
|
1404
|
+
process.env = previousEnv
|
|
1405
|
+
}
|
|
1406
|
+
})
|
|
1407
|
+
|
|
1408
|
+
it('keeps the data, names the target database and exits 0 with --skip-if-initialized', async () => {
|
|
1409
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
1410
|
+
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
1411
|
+
const { generateEntityIds } = mockSeededDatabase('3')
|
|
1412
|
+
|
|
1413
|
+
const mercato = await import('../mercato')
|
|
1414
|
+
const exitCode = await mercato.run(['node', 'mercato', 'init', '--skip-if-initialized'])
|
|
1415
|
+
|
|
1416
|
+
expect(exitCode).toBe(0)
|
|
1417
|
+
const printed = consoleLogSpy.mock.calls.map((call) => String(call[0])).join('\n')
|
|
1418
|
+
expect(printed).toContain('Database already initialized (3 user(s) in db.example.com:6543/shop_a)')
|
|
1419
|
+
expect(printed).toContain('Check DATABASE_URL in .env')
|
|
1420
|
+
expect(printed).not.toContain('secret')
|
|
1421
|
+
expect(generateEntityIds).not.toHaveBeenCalled()
|
|
1422
|
+
expect(consoleErrorSpy).not.toHaveBeenCalled()
|
|
1423
|
+
|
|
1424
|
+
consoleErrorSpy.mockRestore()
|
|
1425
|
+
consoleLogSpy.mockRestore()
|
|
1426
|
+
})
|
|
532
1427
|
})
|
|
533
1428
|
|
|
534
1429
|
describe('seed:defaults command', () => {
|
|
@@ -909,6 +1804,11 @@ describe('server dev managed process exits', () => {
|
|
|
909
1804
|
expect(exitCode).toBe(0)
|
|
910
1805
|
expect(consoleErrorSpy).not.toHaveBeenCalled()
|
|
911
1806
|
expect(consoleLogSpy).toHaveBeenCalledWith('[server] Skipping scheduler auto-start — module not enabled')
|
|
1807
|
+
const { spawn } = await import('child_process')
|
|
1808
|
+
const nextSpawn = (spawn as jest.Mock).mock.calls.find((call) =>
|
|
1809
|
+
pathIncludes(call[1]?.[0] ?? '', 'next/dist/bin/next') && call[1]?.includes('dev'),
|
|
1810
|
+
)
|
|
1811
|
+
expect(nextSpawn?.[2]?.env.NODE_ENV).toBe('development')
|
|
912
1812
|
|
|
913
1813
|
consoleErrorSpy.mockRestore()
|
|
914
1814
|
consoleLogSpy.mockRestore()
|
|
@@ -1651,6 +2551,11 @@ describe('server start managed process exits', () => {
|
|
|
1651
2551
|
expect(exitCode).toBe(0)
|
|
1652
2552
|
expect(consoleErrorSpy).not.toHaveBeenCalled()
|
|
1653
2553
|
expect(consoleLogSpy).toHaveBeenCalledWith('[server] Skipping scheduler auto-start — module not enabled')
|
|
2554
|
+
const { spawn } = await import('child_process')
|
|
2555
|
+
const nextSpawn = (spawn as jest.Mock).mock.calls.find((call) =>
|
|
2556
|
+
pathIncludes(call[1]?.[0] ?? '', 'next/dist/bin/next') && call[1]?.includes('start'),
|
|
2557
|
+
)
|
|
2558
|
+
expect(nextSpawn?.[2]?.env.NODE_ENV).toBe('production')
|
|
1654
2559
|
|
|
1655
2560
|
consoleErrorSpy.mockRestore()
|
|
1656
2561
|
consoleLogSpy.mockRestore()
|