@open-mercato/cli 0.9.1-develop.7574.1.837288eec1 → 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 +12 -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 +7 -5
- package/dist/agentic/guides/module-facts.json +17621 -2604
- package/dist/agentic/guides/module-facts.v2.json +17710 -2604
- package/dist/agentic/guides/module-tool.md +21 -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/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +7 -5
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +4 -2
- package/dist/agentic/guides/modules/catalog/events.md +18 -18
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +7 -5
- package/dist/agentic/guides/modules/catalog/index.md +2 -2
- package/dist/agentic/guides/modules/catalog/owned-contract-module-metadata.md +1 -1
- 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/index.md +5 -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/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +9 -10
- package/dist/agentic/guides/modules/customers/di-registrations-rich.md +6 -5
- 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 -5
- 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/umes-hosts.md +46 -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/events.md +4 -4
- 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/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/ecommerce/events.md +12 -12
- package/dist/agentic/guides/modules/ecommerce/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/ecommerce/index.md +3 -3
- package/dist/agentic/guides/modules/ecommerce/umes-contributions.md +1 -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/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/gateway_tpay/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/exact-override-targets.md +6 -3
- package/dist/agentic/guides/modules/gateway_tpay/index.md +5 -4
- package/dist/agentic/guides/modules/gateway_tpay/setup.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/umes-contributions.md +1 -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/events.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +3 -2
- 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/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/index.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/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/umes-contributions.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/index.md +1 -1
- 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 -29
- 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 +53 -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/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 +384 -16
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +6 -0
- package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
- 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 +12 -8
- 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 +6 -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 +321 -230
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +16 -11
- package/dist/agentic/shared/ai/harness/README.md +6 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +282 -19
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +204 -4
- 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-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/execution-sandbox.mjs +1 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +3 -3
- 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 +33 -4
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +126 -66
- 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 +429 -4
- 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__/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 +34 -4
- package/src/mercato.ts +167 -84
- package/src/types/cross-spawn.d.ts +2 -2
- package/src/lib/__tests__/agentic-build-artifacts.test.ts +0 -28
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function widget() {}
|
|
@@ -22,21 +22,33 @@ function yarnBinary(): string {
|
|
|
22
22
|
return process.platform === 'win32' ? 'yarn.cmd' : 'yarn'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function runCommand(command: string, args: string[], cwd: string): string {
|
|
25
|
+
function runCommand(command: string, args: string[], cwd: string, environment: NodeJS.ProcessEnv = {}): string {
|
|
26
26
|
const yarnCacheFolder = path.join(cwd, '.yarn', 'cache')
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
try {
|
|
28
|
+
return execFileSync(command, args, {
|
|
29
|
+
cwd,
|
|
30
|
+
encoding: 'utf8',
|
|
31
|
+
env: {
|
|
32
|
+
...process.env,
|
|
33
|
+
FORCE_COLOR: '0',
|
|
34
|
+
NODE_NO_WARNINGS: '1',
|
|
35
|
+
YARN_CACHE_FOLDER: yarnCacheFolder,
|
|
36
|
+
YARN_ENABLE_GLOBAL_CACHE: '0',
|
|
37
|
+
YARN_ENABLE_IMMUTABLE_INSTALLS: '0',
|
|
38
|
+
YARN_NODE_LINKER: 'node-modules',
|
|
39
|
+
...environment,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (!error || typeof error !== 'object') throw error
|
|
44
|
+
const errorRecord = error as Record<string, unknown>
|
|
45
|
+
const outputs = ['stdout', 'stderr'].flatMap((streamName) => {
|
|
46
|
+
const output = errorRecord[streamName]
|
|
47
|
+
return typeof output === 'string' || Buffer.isBuffer(output) ? [output.toString().trim()] : []
|
|
48
|
+
}).filter(Boolean)
|
|
49
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
50
|
+
throw new Error(outputs.length > 0 ? `${message}\n${outputs.join('\n')}` : message)
|
|
51
|
+
}
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
function runMercato(args: string[], cwd: string): string {
|
|
@@ -65,7 +77,19 @@ function createCoreWorkspacePackage(rootDir: string, relativeDir: string): strin
|
|
|
65
77
|
return coreDir
|
|
66
78
|
}
|
|
67
79
|
|
|
80
|
+
const commentedModulesSource = [
|
|
81
|
+
'// Central place to enable modules.',
|
|
82
|
+
'export const enabledModules = [',
|
|
83
|
+
' // customer_groups stays disabled by default.',
|
|
84
|
+
" // { id: 'customer_groups', from: '@open-mercato/core' },",
|
|
85
|
+
'',
|
|
86
|
+
' /* Block comment kept by module add. */',
|
|
87
|
+
']',
|
|
88
|
+
'',
|
|
89
|
+
].join('\n')
|
|
90
|
+
|
|
68
91
|
function createMonorepoFixture(rootDir: string): string {
|
|
92
|
+
writeFile(path.join(rootDir, 'yarn.lock'), '')
|
|
69
93
|
writeFile(
|
|
70
94
|
path.join(rootDir, 'package.json'),
|
|
71
95
|
JSON.stringify(
|
|
@@ -97,11 +121,12 @@ function createMonorepoFixture(rootDir: string): string {
|
|
|
97
121
|
2,
|
|
98
122
|
),
|
|
99
123
|
)
|
|
100
|
-
writeFile(path.join(appDir, 'src', 'modules.ts'),
|
|
124
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), commentedModulesSource)
|
|
101
125
|
return appDir
|
|
102
126
|
}
|
|
103
127
|
|
|
104
128
|
function createStandaloneFixture(rootDir: string): string {
|
|
129
|
+
writeFile(path.join(rootDir, 'yarn.lock'), '')
|
|
105
130
|
writeFile(
|
|
106
131
|
path.join(rootDir, '.yarnrc.yml'),
|
|
107
132
|
['nodeLinker: node-modules', 'enableGlobalCache: false', 'cacheFolder: ./.yarn/cache', ''].join('\n'),
|
|
@@ -152,7 +177,12 @@ test.describe('TC-INT-007: CLI official module install and eject flows', () => {
|
|
|
152
177
|
dependencies?: Record<string, string>
|
|
153
178
|
}
|
|
154
179
|
|
|
155
|
-
expect(modulesSource).
|
|
180
|
+
expect(modulesSource).toBe(
|
|
181
|
+
commentedModulesSource.replace(
|
|
182
|
+
' /* Block comment kept by module add. */\n',
|
|
183
|
+
" /* Block comment kept by module add. */\n { id: 'test_package', from: '@open-mercato/test-package' },\n",
|
|
184
|
+
),
|
|
185
|
+
)
|
|
156
186
|
expect(cssSource).toContain('node_modules/@open-mercato/test-package/src/**/*.{ts,tsx}')
|
|
157
187
|
expect(appPackageJson.dependencies?.['@open-mercato/test-package']).toBeTruthy()
|
|
158
188
|
} finally {
|
|
@@ -180,14 +210,196 @@ test.describe('TC-INT-007: CLI official module install and eject flows', () => {
|
|
|
180
210
|
const modulesSource = readFile(path.join(appDir, 'src', 'modules.ts'))
|
|
181
211
|
const cssSource = readFile(path.join(appDir, '.mercato', 'generated', 'module-package-sources.css'))
|
|
182
212
|
|
|
183
|
-
expect(modulesSource).
|
|
213
|
+
expect(modulesSource).toMatch(/id: 'test_package', from: '@app'/)
|
|
214
|
+
expect(modulesSource).not.toContain('locator:')
|
|
215
|
+
expect(modulesSource).toContain("packageName: '@open-mercato/test-package'")
|
|
184
216
|
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package', 'index.ts'))).toBe(true)
|
|
217
|
+
expect(readFile(path.join(appDir, 'src', 'modules', 'test_package', 'index.ts'))).toBe(readFile(path.join(fixtureModulePackage, 'src', 'modules', 'test_package', 'index.ts')))
|
|
185
218
|
expect(cssSource).toBe('')
|
|
186
219
|
} finally {
|
|
187
220
|
fs.rmSync(appDir, { recursive: true, force: true })
|
|
188
221
|
}
|
|
189
222
|
})
|
|
190
223
|
|
|
224
|
+
test('module add reports dependencies that must be enabled before registration', () => {
|
|
225
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-standalone-dependencies-'))
|
|
226
|
+
|
|
227
|
+
try {
|
|
228
|
+
createStandaloneFixture(appDir)
|
|
229
|
+
const packageDir = path.join(appDir, 'fixture-module-package')
|
|
230
|
+
fs.cpSync(fixtureModulePackage, packageDir, { recursive: true })
|
|
231
|
+
writeFile(
|
|
232
|
+
path.join(packageDir, 'src', 'modules', 'test_package', 'index.ts'),
|
|
233
|
+
"export const metadata = { id: 'test_package', requires: ['customers'], ejectable: true }\n",
|
|
234
|
+
)
|
|
235
|
+
runCommand(yarnBinary(), ['install'], appDir)
|
|
236
|
+
|
|
237
|
+
expect(() => runMercato(
|
|
238
|
+
['module', 'add', '@open-mercato/test-package@file:./fixture-module-package'],
|
|
239
|
+
appDir,
|
|
240
|
+
)).toThrow(/requires module\(s\) that are not enabled: customers/)
|
|
241
|
+
|
|
242
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toBe('export const enabledModules = []\n')
|
|
243
|
+
} finally {
|
|
244
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
test('module add resolves canonical requirements from retained ejected origins', () => {
|
|
249
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-canonical-requires-'))
|
|
250
|
+
|
|
251
|
+
try {
|
|
252
|
+
createStandaloneFixture(appDir)
|
|
253
|
+
const packageDir = path.join(appDir, 'fixture-module-package')
|
|
254
|
+
fs.cpSync(fixtureModulePackage, packageDir, { recursive: true })
|
|
255
|
+
const requirements = [
|
|
256
|
+
'@pkarw/marketing_consents@preview',
|
|
257
|
+
'npm:@pkarw/marketing_consents@1.0.0',
|
|
258
|
+
'github:pkarw/marketing-consents',
|
|
259
|
+
'npm:consent-helper@next',
|
|
260
|
+
'github:pkarw/consent-tools#main',
|
|
261
|
+
'pkarw/consent-tools',
|
|
262
|
+
'https://github.com/pkarw/consent-tools.git#release',
|
|
263
|
+
'ssh://git@github.com/pkarw/consent-tools.git#main',
|
|
264
|
+
'git@github.com:pkarw/consent-tools.git',
|
|
265
|
+
'github:pkarw/installed-tools',
|
|
266
|
+
'npm:@open-mercato/core@preview',
|
|
267
|
+
]
|
|
268
|
+
writeFile(
|
|
269
|
+
path.join(packageDir, 'src', 'modules', 'test_package', 'index.ts'),
|
|
270
|
+
`export const metadata = { id: 'test_package', requires: ${JSON.stringify(requirements)}, ejectable: true }\n`,
|
|
271
|
+
)
|
|
272
|
+
const entries = [
|
|
273
|
+
{ id: 'marketing_consents', from: '@app', locator: 'github:pkarw/marketing-consents', packageName: '@pkarw/marketing_consents' },
|
|
274
|
+
{ id: 'npm_consents', from: '@app', locator: 'npm:@pkarw/marketing_consents', packageName: '@pkarw/marketing_consents' },
|
|
275
|
+
{ id: 'npm_core', from: '@app', locator: 'npm:@open-mercato/core', packageName: '@open-mercato/core' },
|
|
276
|
+
{ id: 'consent_helper', from: '@app', locator: 'npm:consent-helper' },
|
|
277
|
+
{ id: 'consent_tools', from: '@app', locator: 'github:pkarw/consent-tools' },
|
|
278
|
+
]
|
|
279
|
+
for (const entry of entries) {
|
|
280
|
+
writeFile(
|
|
281
|
+
path.join(appDir, 'src', 'modules', entry.id, 'index.ts'),
|
|
282
|
+
`export const metadata = { id: '${entry.id}' }\n`,
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
const corePackageDir = path.join(appDir, 'vendor', 'core')
|
|
286
|
+
writeFile(
|
|
287
|
+
path.join(corePackageDir, 'package.json'),
|
|
288
|
+
JSON.stringify({ name: '@open-mercato/core', version: '0.4.7', type: 'module', repository: { type: 'git', url: 'https://github.com/pkarw/installed-tools.git' } }),
|
|
289
|
+
)
|
|
290
|
+
writeFile(
|
|
291
|
+
path.join(corePackageDir, 'src', 'modules', 'repository_tools', 'index.ts'),
|
|
292
|
+
"export const metadata = { id: 'repository_tools' }\n",
|
|
293
|
+
)
|
|
294
|
+
writeFile(
|
|
295
|
+
path.join(corePackageDir, 'dist', 'modules', 'repository_tools', 'index.js'),
|
|
296
|
+
"export const metadata = { id: 'repository_tools' }\n",
|
|
297
|
+
)
|
|
298
|
+
const enabledEntries = [...entries, { id: 'repository_tools', from: '@open-mercato/core', locator: 'github:pkarw/installed-tools' }]
|
|
299
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), `export const enabledModules = ${JSON.stringify(enabledEntries)}\n`)
|
|
300
|
+
runCommand(yarnBinary(), ['install'], appDir)
|
|
301
|
+
|
|
302
|
+
runMercato(['module', 'add', 'npm:@open-mercato/test-package@file:./fixture-module-package'], appDir)
|
|
303
|
+
|
|
304
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("id: 'test_package'")
|
|
305
|
+
} finally {
|
|
306
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
test('same-name modules from different origins do not satisfy canonical requirements', () => {
|
|
311
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-wrong-origin-'))
|
|
312
|
+
|
|
313
|
+
try {
|
|
314
|
+
createStandaloneFixture(appDir)
|
|
315
|
+
const packageDir = path.join(appDir, 'fixture-module-package')
|
|
316
|
+
fs.cpSync(fixtureModulePackage, packageDir, { recursive: true })
|
|
317
|
+
writeFile(
|
|
318
|
+
path.join(packageDir, 'src', 'modules', 'test_package', 'index.ts'),
|
|
319
|
+
"export const metadata = { id: 'test_package', requires: ['@pkarw/marketing_consents', 'github:pkarw/consent-tools'], ejectable: true }\n",
|
|
320
|
+
)
|
|
321
|
+
const modulesSource = `export const enabledModules = [
|
|
322
|
+
{ id: 'marketing_consents', from: '@app', locator: 'npm:@open-mercato/marketing_consents' },
|
|
323
|
+
{ id: 'consent_tools', from: '@app', locator: 'github:another-owner/consent-tools' },
|
|
324
|
+
]\n`
|
|
325
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), modulesSource)
|
|
326
|
+
runCommand(yarnBinary(), ['install'], appDir)
|
|
327
|
+
|
|
328
|
+
expect(() => runMercato(
|
|
329
|
+
['module', 'add', '@open-mercato/test-package@file:./fixture-module-package', '--eject'],
|
|
330
|
+
appDir,
|
|
331
|
+
)).toThrow(/@pkarw\/marketing_consents[\s\S]*github:pkarw\/consent-tools[\s\S]*npx create-mercato-module install/)
|
|
332
|
+
|
|
333
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toBe(modulesSource)
|
|
334
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package'))).toBe(false)
|
|
335
|
+
} finally {
|
|
336
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
test('module add rejects a same-ID source collision before ejecting', () => {
|
|
341
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-module-collision-'))
|
|
342
|
+
|
|
343
|
+
try {
|
|
344
|
+
createStandaloneFixture(appDir)
|
|
345
|
+
const modulesSource = "export const enabledModules = [{ id: 'test_package', from: '@app', locator: 'github:another-owner/test-package' }]\n"
|
|
346
|
+
const localSource = "export const metadata = { id: 'test_package', locator: 'github:another-owner/test-package' }\n"
|
|
347
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), modulesSource)
|
|
348
|
+
writeFile(path.join(appDir, 'src', 'modules', 'test_package', 'index.ts'), localSource)
|
|
349
|
+
runCommand(yarnBinary(), ['install'], appDir)
|
|
350
|
+
|
|
351
|
+
expect(() => runMercato(
|
|
352
|
+
['module', 'add', `@open-mercato/test-package@file:${fixtureModulePackage}`, '--eject'],
|
|
353
|
+
appDir,
|
|
354
|
+
)).toThrow(/(?=[\s\S]*test_package)(?=[\s\S]*(?:collision|already|conflict))(?=[\s\S]*another-owner)(?=[\s\S]*@open-mercato\/test-package)/i)
|
|
355
|
+
|
|
356
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toBe(modulesSource)
|
|
357
|
+
expect(readFile(path.join(appDir, 'src', 'modules', 'test_package', 'index.ts'))).toBe(localSource)
|
|
358
|
+
} finally {
|
|
359
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
360
|
+
}
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
test('GitHub locators detect a runtime ID collision before invoking Yarn', () => {
|
|
364
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-github-collision-'))
|
|
365
|
+
try {
|
|
366
|
+
createStandaloneFixture(appDir)
|
|
367
|
+
const modulesSource = "export const enabledModules = [{ id: 'test_package', from: '@app', locator: 'github:other/test-package' }]\n"
|
|
368
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), modulesSource)
|
|
369
|
+
const originalManifest = readFile(path.join(appDir, 'package.json'))
|
|
370
|
+
const executableDir = path.join(appDir, 'bin')
|
|
371
|
+
const packageManifest = Buffer.from(JSON.stringify({ name: '@pkarw/test-package' })).toString('base64')
|
|
372
|
+
const ghPath = path.join(executableDir, 'gh')
|
|
373
|
+
writeFile(ghPath, `#!/usr/bin/env node
|
|
374
|
+
const endpoint = process.argv[3]
|
|
375
|
+
const sha = 'a'.repeat(40)
|
|
376
|
+
const value = endpoint === 'user' ? { login: 'pkarw' }
|
|
377
|
+
: endpoint.includes('/commits/') ? { sha }
|
|
378
|
+
: endpoint.includes('/contents/') ? { encoding: 'base64', content: ${JSON.stringify(packageManifest)} }
|
|
379
|
+
: endpoint.includes('/git/trees/') ? { tree: [{ path: 'src/modules/test_package/index.ts' }] }
|
|
380
|
+
: { default_branch: 'main' }
|
|
381
|
+
process.stdout.write(JSON.stringify(value))
|
|
382
|
+
`)
|
|
383
|
+
const yarnPath = path.join(executableDir, 'yarn')
|
|
384
|
+
const marker = path.join(appDir, 'yarn-invoked')
|
|
385
|
+
writeFile(yarnPath, "#!/usr/bin/env node\nrequire('node:fs').writeFileSync(process.env.COLLISION_YARN_MARKER, 'invoked')\nprocess.exit(1)\n")
|
|
386
|
+
fs.chmodSync(ghPath, 0o755)
|
|
387
|
+
fs.chmodSync(yarnPath, 0o755)
|
|
388
|
+
for (const locator of ['github:pkarw/test-package', 'https://github.com/pkarw/test-package.git', 'git@github.com:pkarw/test-package.git', 'github:test-package']) {
|
|
389
|
+
expect(() => runCommand(process.execPath, [cliBin, 'module', 'add', locator, '--allow-third-party'], appDir, {
|
|
390
|
+
PATH: executableDir + path.delimiter + process.env.PATH,
|
|
391
|
+
COLLISION_YARN_MARKER: marker,
|
|
392
|
+
})).toThrow(/Module name collision[\s\S]*test_package[\s\S]*github:other\/test-package[\s\S]*github:pkarw\/test-package/)
|
|
393
|
+
}
|
|
394
|
+
expect(fs.existsSync(marker)).toBe(false)
|
|
395
|
+
expect(readFile(path.join(appDir, 'package.json'))).toBe(originalManifest)
|
|
396
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toBe(modulesSource)
|
|
397
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package'))).toBe(false)
|
|
398
|
+
} finally {
|
|
399
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
400
|
+
}
|
|
401
|
+
})
|
|
402
|
+
|
|
191
403
|
test('module enable supports package-backed and ejected flows plus both eject entrypoints', () => {
|
|
192
404
|
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-standalone-eject-'))
|
|
193
405
|
|
|
@@ -202,25 +414,51 @@ test.describe('TC-INT-007: CLI official module install and eject flows', () => {
|
|
|
202
414
|
|
|
203
415
|
runMercato(['module', 'enable', '@open-mercato/test-package'], appDir)
|
|
204
416
|
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain(
|
|
205
|
-
"
|
|
417
|
+
"id: 'test_package', from: '@open-mercato/test-package'",
|
|
206
418
|
)
|
|
207
419
|
|
|
208
420
|
writeFile(path.join(appDir, 'src', 'modules.ts'), 'export const enabledModules = []\n')
|
|
209
421
|
fs.rmSync(path.join(appDir, 'src', 'modules', 'test_package'), { recursive: true, force: true })
|
|
210
422
|
runMercato(['module', 'enable', '@open-mercato/test-package', '--eject'], appDir)
|
|
211
|
-
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("
|
|
423
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("id: 'test_package', from: '@app'")
|
|
212
424
|
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'test_package', 'index.ts'))).toBe(true)
|
|
213
425
|
expect(readFile(path.join(appDir, '.mercato', 'generated', 'module-package-sources.css'))).toBe('')
|
|
214
426
|
|
|
215
427
|
writeFile(path.join(appDir, 'src', 'modules.ts'), "export const enabledModules = [{ id: 'test_package', from: '@open-mercato/test-package' }]\n")
|
|
216
428
|
fs.rmSync(path.join(appDir, 'src', 'modules', 'test_package'), { recursive: true, force: true })
|
|
217
429
|
runMercato(['module', 'eject', 'test_package'], appDir)
|
|
218
|
-
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("
|
|
430
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("packageName: '@open-mercato/test-package'")
|
|
431
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).not.toContain("locator: 'npm:@open-mercato/test-package'")
|
|
432
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("id: 'test_package', from: '@app'")
|
|
219
433
|
|
|
220
434
|
writeFile(path.join(appDir, 'src', 'modules.ts'), "export const enabledModules = [{ id: 'test_package', from: '@open-mercato/test-package' }]\n")
|
|
221
435
|
fs.rmSync(path.join(appDir, 'src', 'modules', 'test_package'), { recursive: true, force: true })
|
|
222
436
|
runMercato(['eject', 'test_package'], appDir)
|
|
223
|
-
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("
|
|
437
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("packageName: '@open-mercato/test-package'")
|
|
438
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).not.toContain("locator: 'npm:@open-mercato/test-package'")
|
|
439
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toContain("id: 'test_package', from: '@app'")
|
|
440
|
+
} finally {
|
|
441
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
|
|
445
|
+
test('module add and module enable exit 0 without changes when the module is already enabled', () => {
|
|
446
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-cli-standalone-rerun-'))
|
|
447
|
+
|
|
448
|
+
try {
|
|
449
|
+
createStandaloneFixture(appDir)
|
|
450
|
+
runCommand(yarnBinary(), ['install'], appDir)
|
|
451
|
+
const packageSpec = `@open-mercato/test-package@file:${fixtureModulePackage}`
|
|
452
|
+
|
|
453
|
+
runMercato(['module', 'add', packageSpec], appDir)
|
|
454
|
+
const modulesSource = readFile(path.join(appDir, 'src', 'modules.ts'))
|
|
455
|
+
|
|
456
|
+
const addOutput = runMercato(['module', 'add', packageSpec], appDir)
|
|
457
|
+
const enableOutput = runMercato(['module', 'enable', '@open-mercato/test-package'], appDir)
|
|
458
|
+
|
|
459
|
+
expect(addOutput).toContain('is already enabled in modules.ts. Nothing to change.')
|
|
460
|
+
expect(enableOutput).toContain('is already enabled in modules.ts. Nothing to change.')
|
|
461
|
+
expect(readFile(path.join(appDir, 'src', 'modules.ts'))).toBe(modulesSource)
|
|
224
462
|
} finally {
|
|
225
463
|
fs.rmSync(appDir, { recursive: true, force: true })
|
|
226
464
|
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { expect, test } from '@playwright/test'
|
|
2
|
+
import { execFileSync, spawnSync } from 'node:child_process'
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import os from 'node:os'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', '..')
|
|
9
|
+
const cliBin = path.join(repoRoot, 'packages', 'cli', 'dist', 'bin.js')
|
|
10
|
+
|
|
11
|
+
function writeFile(filePath: string, content: string): void {
|
|
12
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
13
|
+
fs.writeFileSync(filePath, content)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function createPackage(packageRoot: string, packageName: string, moduleIds: string[]): void {
|
|
17
|
+
writeFile(path.join(packageRoot, 'package.json'), JSON.stringify({ name: packageName, version: '0.4.7', type: 'module' }))
|
|
18
|
+
for (const moduleId of moduleIds) {
|
|
19
|
+
writeFile(path.join(packageRoot, 'src', 'modules', moduleId, 'index.ts'), `export const metadata = { id: '${moduleId}', title: '${moduleId}', ejectable: true }\n`)
|
|
20
|
+
writeFile(path.join(packageRoot, 'dist', 'modules', moduleId, 'index.js'), `export const metadata = { id: '${moduleId}', title: '${moduleId}', ejectable: true }\n`)
|
|
21
|
+
writeFile(path.join(packageRoot, 'src', 'modules', moduleId, 'di.ts'), 'export function register() {}\n')
|
|
22
|
+
writeFile(path.join(packageRoot, 'dist', 'modules', moduleId, 'di.js'), 'export function register() {}\n')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function createApp(appDir: string, dependencies: Record<string, string> = {}): void {
|
|
27
|
+
writeFile(path.join(appDir, 'package.json'), JSON.stringify({ name: 'module-collision-integration', private: true, dependencies: { '@open-mercato/core': '0.4.7', ...dependencies } }))
|
|
28
|
+
writeFile(path.join(appDir, 'yarn.lock'), '')
|
|
29
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), 'export const enabledModules = []\n')
|
|
30
|
+
createPackage(path.join(appDir, 'node_modules', '@open-mercato', 'core'), '@open-mercato/core', [])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function runMercato(args: string[], appDir: string, environment: NodeJS.ProcessEnv = {}): { status: number | null; output: string } {
|
|
34
|
+
const result = spawnSync(process.execPath, [cliBin, ...args], {
|
|
35
|
+
cwd: appDir,
|
|
36
|
+
encoding: 'utf8',
|
|
37
|
+
env: { ...process.env, FORCE_COLOR: '0', NODE_NO_WARNINGS: '1', ...environment },
|
|
38
|
+
})
|
|
39
|
+
if (result.error) throw result.error
|
|
40
|
+
return { status: result.status, output: `${result.stdout}\n${result.stderr}` }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function installCommandStubs(appDir: string, candidateName?: string, candidateModuleId?: string): NodeJS.ProcessEnv {
|
|
44
|
+
const executableDir = path.join(appDir, 'bin')
|
|
45
|
+
const marker = path.join(appDir, 'yarn-invoked')
|
|
46
|
+
const yarnPath = path.join(executableDir, process.platform === 'win32' ? 'yarn.cmd' : 'yarn')
|
|
47
|
+
const yarnScript = `require('node:fs').writeFileSync(${JSON.stringify(marker)}, 'invoked'); process.exit(1)\n`
|
|
48
|
+
writeFile(yarnPath, process.platform === 'win32'
|
|
49
|
+
? `@"${process.execPath}" "%~dp0yarn-stub.cjs" %*\r\n`
|
|
50
|
+
: `#!${process.execPath}\n${yarnScript}`)
|
|
51
|
+
writeFile(path.join(executableDir, 'yarn-stub.cjs'), yarnScript)
|
|
52
|
+
fs.chmodSync(yarnPath, 0o755)
|
|
53
|
+
if (candidateName && candidateModuleId) {
|
|
54
|
+
const manifest = Buffer.from(JSON.stringify({ name: candidateName })).toString('base64')
|
|
55
|
+
const ghScript = `const endpoint = process.argv[3] || ''
|
|
56
|
+
const value = endpoint === 'user' ? { login: 'candidate' }
|
|
57
|
+
: endpoint.includes('/commits/') ? { sha: 'a'.repeat(40) }
|
|
58
|
+
: endpoint.includes('/contents/') ? { encoding: 'base64', content: ${JSON.stringify(manifest)} }
|
|
59
|
+
: endpoint.includes('/git/trees/') ? { tree: [{ path: 'src/modules/${candidateModuleId}/index.ts' }, { path: 'dist/modules/${candidateModuleId}/index.js' }] }
|
|
60
|
+
: { default_branch: 'main' }
|
|
61
|
+
process.stdout.write(JSON.stringify(value))\n`
|
|
62
|
+
const ghPath = path.join(executableDir, process.platform === 'win32' ? 'gh.cmd' : 'gh')
|
|
63
|
+
writeFile(ghPath, process.platform === 'win32'
|
|
64
|
+
? `@"${process.execPath}" "%~dp0gh-stub.cjs" %*\r\n`
|
|
65
|
+
: `#!${process.execPath}\n${ghScript}`)
|
|
66
|
+
writeFile(path.join(executableDir, 'gh-stub.cjs'), ghScript)
|
|
67
|
+
fs.chmodSync(ghPath, 0o755)
|
|
68
|
+
}
|
|
69
|
+
return { PATH: executableDir + path.delimiter + process.env.PATH }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function snapshotDirectory(directory: string): Record<string, string> {
|
|
73
|
+
if (!fs.existsSync(directory)) return {}
|
|
74
|
+
const files: Record<string, string> = {}
|
|
75
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
76
|
+
const fullPath = path.join(directory, entry.name)
|
|
77
|
+
if (entry.isDirectory()) {
|
|
78
|
+
for (const [relativePath, content] of Object.entries(snapshotDirectory(fullPath))) files[path.join(entry.name, relativePath)] = content
|
|
79
|
+
} else {
|
|
80
|
+
files[entry.name] = fs.readFileSync(fullPath).toString('base64')
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return files
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
test.describe('TC-INT-009: CLI source collision lifecycle safeguards', () => {
|
|
87
|
+
for (const kind of ['directory', 'archive']) {
|
|
88
|
+
test(`rejects a local ${kind} with unknown provenance before replacing an active npm binding`, () => {
|
|
89
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-file-origin-'))
|
|
90
|
+
const appDir = path.join(root, 'app')
|
|
91
|
+
try {
|
|
92
|
+
const binding = '@publisher/consents'
|
|
93
|
+
createApp(appDir, { [binding]: '0.4.7' })
|
|
94
|
+
createPackage(path.join(appDir, 'node_modules', binding), binding, ['consents'])
|
|
95
|
+
const packageRoot = path.join(root, 'package')
|
|
96
|
+
createPackage(packageRoot, binding, ['consents'])
|
|
97
|
+
if (kind === 'archive') execFileSync('tar', ['-czf', path.join(root, 'candidate.tgz'), '-C', root, 'package'])
|
|
98
|
+
const modulesSource = `export const enabledModules = [{ id: 'consents', from: '${binding}', locator: 'npm:${binding}' }]\n`
|
|
99
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), modulesSource)
|
|
100
|
+
const manifestBefore = fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')
|
|
101
|
+
const installedBefore = snapshotDirectory(path.join(appDir, 'node_modules'))
|
|
102
|
+
const environment = installCommandStubs(appDir)
|
|
103
|
+
const locator = kind === 'archive' ? 'file:../candidate.tgz' : 'file:../package'
|
|
104
|
+
const result = runMercato(['module', 'add', `${binding}@${locator}`, '--eject', '--allow-third-party'], appDir, environment)
|
|
105
|
+
|
|
106
|
+
expect(result.status, result.output).not.toBe(0)
|
|
107
|
+
expect(result.output).toContain('Package binding collision')
|
|
108
|
+
expect(result.output).toContain('unknown origin')
|
|
109
|
+
expect(result.output).toContain('consents')
|
|
110
|
+
expect(fs.existsSync(path.join(appDir, 'yarn-invoked'))).toBe(false)
|
|
111
|
+
expect(fs.readFileSync(path.join(appDir, 'src', 'modules.ts'), 'utf8')).toBe(modulesSource)
|
|
112
|
+
expect(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')).toBe(manifestBefore)
|
|
113
|
+
expect(snapshotDirectory(path.join(appDir, 'node_modules'))).toEqual(installedBefore)
|
|
114
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'consents'))).toBe(false)
|
|
115
|
+
expect(fs.existsSync(path.join(appDir, '.mercato', 'generated'))).toBe(false)
|
|
116
|
+
} finally { fs.rmSync(root, { recursive: true, force: true }) }
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
test('rejects a GitHub replacement of an active binding even when the selected module ID differs', () => {
|
|
121
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-binding-collision-'))
|
|
122
|
+
try {
|
|
123
|
+
const binding = '@publisher/shared-package'
|
|
124
|
+
createApp(appDir, { [binding]: 'github:existing/provider#main' })
|
|
125
|
+
createPackage(path.join(appDir, 'node_modules', binding), binding, ['active_module'])
|
|
126
|
+
const modulesSource = `export const enabledModules = [{ id: 'active_module', from: '${binding}', locator: 'github:existing/provider', packageName: '${binding}' }]\n`
|
|
127
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), modulesSource)
|
|
128
|
+
const manifestBefore = fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')
|
|
129
|
+
const environment = installCommandStubs(appDir, binding, 'candidate_module')
|
|
130
|
+
const result = runMercato(['module', 'add', 'github:candidate/provider', '--allow-third-party'], appDir, environment)
|
|
131
|
+
|
|
132
|
+
expect(result.status, result.output).not.toBe(0)
|
|
133
|
+
expect(result.output).toContain('active_module')
|
|
134
|
+
expect(result.output).toContain(binding)
|
|
135
|
+
expect(result.output).toContain('github:existing/provider')
|
|
136
|
+
expect(result.output).toContain('github:candidate/provider')
|
|
137
|
+
expect(fs.existsSync(path.join(appDir, 'yarn-invoked'))).toBe(false)
|
|
138
|
+
expect(fs.readFileSync(path.join(appDir, 'src', 'modules.ts'), 'utf8')).toBe(modulesSource)
|
|
139
|
+
expect(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')).toBe(manifestBefore)
|
|
140
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'candidate_module'))).toBe(false)
|
|
141
|
+
} finally {
|
|
142
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
test('rejects an npm file package runtime ID collision before invoking Yarn or copying sources', () => {
|
|
147
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-file-collision-'))
|
|
148
|
+
try {
|
|
149
|
+
createApp(appDir)
|
|
150
|
+
const candidateDir = path.join(appDir, 'candidate')
|
|
151
|
+
createPackage(candidateDir, '@publisher/candidate', ['consents'])
|
|
152
|
+
const modulesSource = "export const enabledModules = [{ id: 'consents', from: '@app', locator: 'github:existing/consents' }]\n"
|
|
153
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), modulesSource)
|
|
154
|
+
writeFile(path.join(appDir, 'src', 'modules', 'consents', 'index.ts'), 'export const metadata = { ejectable: true }\n')
|
|
155
|
+
const sourceBefore = snapshotDirectory(path.join(appDir, 'src'))
|
|
156
|
+
const manifestBefore = fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')
|
|
157
|
+
const result = runMercato(['module', 'add', '@publisher/candidate@file:./candidate', '--allow-third-party', '--eject'], appDir, installCommandStubs(appDir))
|
|
158
|
+
|
|
159
|
+
expect(result.status, result.output).not.toBe(0)
|
|
160
|
+
expect(result.output).toContain('consents')
|
|
161
|
+
expect(result.output).toMatch(/collision|already registered|conflict/i)
|
|
162
|
+
expect(fs.existsSync(path.join(appDir, 'yarn-invoked'))).toBe(false)
|
|
163
|
+
expect(snapshotDirectory(path.join(appDir, 'src'))).toEqual(sourceBefore)
|
|
164
|
+
expect(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8')).toBe(manifestBefore)
|
|
165
|
+
} finally {
|
|
166
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
test('every generate command rejects duplicate effective registrations before changing existing output', () => {
|
|
171
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-generate-duplicates-'))
|
|
172
|
+
try {
|
|
173
|
+
createApp(appDir)
|
|
174
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), "export const enabledModules = [{ id: 'consents', from: '@app' }]\nif (process.env.COLLISION_DUPLICATE_ENABLED === 'true') enabledModules.push({ id: 'consents', from: '@app' })\n")
|
|
175
|
+
writeFile(path.join(appDir, 'src', 'modules', 'consents', 'index.ts'), 'export const metadata = {}\n')
|
|
176
|
+
const outputDir = path.join(appDir, '.mercato', 'generated')
|
|
177
|
+
for (const file of ['entities.ids.generated.ts', 'modules.generated.ts', 'entities.generated.ts', 'di.generated.ts', 'module-package-sources.css']) writeFile(path.join(outputDir, file), 'preserved output\n')
|
|
178
|
+
const before = snapshotDirectory(outputDir)
|
|
179
|
+
|
|
180
|
+
for (const command of ['all', 'entity-ids', 'registry', 'entities', 'di']) {
|
|
181
|
+
const result = runMercato(['generate', command, '--quiet'], appDir, { COLLISION_DUPLICATE_ENABLED: 'true' })
|
|
182
|
+
expect(result.status, `${command}: ${result.output}`).not.toBe(0)
|
|
183
|
+
expect(result.output).toContain("Duplicate enabled module ID 'consents'")
|
|
184
|
+
expect(snapshotDirectory(outputDir), command).toEqual(before)
|
|
185
|
+
}
|
|
186
|
+
const singleProvider = runMercato(['generate', 'all', '--quiet'], appDir, { COLLISION_DUPLICATE_ENABLED: 'false' })
|
|
187
|
+
expect(singleProvider.status, singleProvider.output).toBe(0)
|
|
188
|
+
} finally {
|
|
189
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
test('an installed alias generates binding imports, ejects with canonical provenance, and disables cleanly', () => {
|
|
194
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-alias-lifecycle-'))
|
|
195
|
+
try {
|
|
196
|
+
const binding = 'consents_candidate'
|
|
197
|
+
const canonicalName = '@publisher/consents'
|
|
198
|
+
createApp(appDir, { [binding]: `npm:${canonicalName}@0.4.7` })
|
|
199
|
+
const packageRoot = path.join(appDir, 'node_modules', binding)
|
|
200
|
+
createPackage(packageRoot, canonicalName, ['consents', 'sibling'])
|
|
201
|
+
writeFile(path.join(packageRoot, 'src', 'modules', 'consents', 'sibling.ts'), "export { metadata } from '../sibling'\n")
|
|
202
|
+
const enabled = runMercato(['module', 'enable', binding, '--module', 'consents', '--allow-third-party'], appDir)
|
|
203
|
+
expect(enabled.status, enabled.output).toBe(0)
|
|
204
|
+
const outputDir = path.join(appDir, '.mercato', 'generated')
|
|
205
|
+
const modulesSource = fs.readFileSync(path.join(appDir, 'src', 'modules.ts'), 'utf8')
|
|
206
|
+
expect(modulesSource).toContain(`from: '${binding}'`)
|
|
207
|
+
expect(modulesSource).toContain(`packageName: '${canonicalName}'`)
|
|
208
|
+
expect(fs.readFileSync(path.join(outputDir, 'di.generated.ts'), 'utf8')).toContain(`${binding}/modules/consents/di`)
|
|
209
|
+
expect(fs.readFileSync(path.join(outputDir, 'module-package-sources.css'), 'utf8')).toContain(`node_modules/${binding}/src/`)
|
|
210
|
+
|
|
211
|
+
const ejected = runMercato(['module', 'eject', 'consents'], appDir)
|
|
212
|
+
expect(ejected.status, ejected.output).toBe(0)
|
|
213
|
+
const ejectedSource = fs.readFileSync(path.join(appDir, 'src', 'modules.ts'), 'utf8')
|
|
214
|
+
expect(ejectedSource).toContain("from: '@app'")
|
|
215
|
+
expect(ejectedSource).toContain(`packageName: '${canonicalName}'`)
|
|
216
|
+
expect(ejectedSource).toContain(`locator: 'npm:${canonicalName}'`)
|
|
217
|
+
expect(fs.readFileSync(path.join(appDir, 'src', 'modules', 'consents', 'sibling.ts'), 'utf8')).toContain(`${binding}/modules/sibling`)
|
|
218
|
+
|
|
219
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), 'export const enabledModules = []\n')
|
|
220
|
+
const disabled = runMercato(['generate', 'all', '--quiet'], appDir)
|
|
221
|
+
expect(disabled.status, disabled.output).toBe(0)
|
|
222
|
+
expect(fs.readFileSync(path.join(outputDir, 'di.generated.ts'), 'utf8')).not.toContain('consents')
|
|
223
|
+
expect(fs.readFileSync(path.join(outputDir, 'module-package-sources.css'), 'utf8')).toBe('')
|
|
224
|
+
expect(fs.existsSync(path.join(packageRoot, 'package.json'))).toBe(true)
|
|
225
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'consents', 'index.ts'))).toBe(true)
|
|
226
|
+
} finally {
|
|
227
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
test('missing alias exports fail enable and direct eject before source or config changes', () => {
|
|
232
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-alias-exports-'))
|
|
233
|
+
try {
|
|
234
|
+
const binding = 'consents_candidate'
|
|
235
|
+
createApp(appDir, { [binding]: 'npm:@publisher/consents@0.4.7' })
|
|
236
|
+
const packageRoot = path.join(appDir, 'node_modules', binding)
|
|
237
|
+
createPackage(packageRoot, '@publisher/consents', ['consents'])
|
|
238
|
+
writeFile(path.join(packageRoot, 'package.json'), JSON.stringify({ name: '@publisher/consents', exports: { '.': './dist/modules/consents/index.js' } }))
|
|
239
|
+
const configPath = path.join(appDir, 'src', 'modules.ts')
|
|
240
|
+
const emptyConfig = fs.readFileSync(configPath, 'utf8')
|
|
241
|
+
|
|
242
|
+
const enabled = runMercato(['module', 'enable', binding, '--module', 'consents', '--eject', '--allow-third-party'], appDir)
|
|
243
|
+
expect(enabled.status, enabled.output).not.toBe(0)
|
|
244
|
+
expect(enabled.output).toContain(`${binding}/modules/consents/`)
|
|
245
|
+
expect(fs.readFileSync(configPath, 'utf8')).toBe(emptyConfig)
|
|
246
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'consents'))).toBe(false)
|
|
247
|
+
|
|
248
|
+
const registeredConfig = `export const enabledModules = [{ id: 'consents', from: '${binding}' }]\n`
|
|
249
|
+
writeFile(configPath, registeredConfig)
|
|
250
|
+
const ejected = runMercato(['module', 'eject', 'consents'], appDir)
|
|
251
|
+
expect(ejected.status, ejected.output).not.toBe(0)
|
|
252
|
+
expect(ejected.output).toContain(`${binding}/modules/consents/`)
|
|
253
|
+
expect(fs.readFileSync(configPath, 'utf8')).toBe(registeredConfig)
|
|
254
|
+
expect(fs.existsSync(path.join(appDir, 'src', 'modules', 'consents'))).toBe(false)
|
|
255
|
+
} finally {
|
|
256
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
257
|
+
}
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
test('a single package registration with a local overlay remains valid', () => {
|
|
261
|
+
const appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-single-overlay-'))
|
|
262
|
+
try {
|
|
263
|
+
const binding = '@publisher/consents'
|
|
264
|
+
createApp(appDir, { [binding]: '0.4.7' })
|
|
265
|
+
createPackage(path.join(appDir, 'node_modules', binding), binding, ['consents'])
|
|
266
|
+
writeFile(path.join(appDir, 'src', 'modules.ts'), `export const enabledModules = [{ id: 'consents', from: '${binding}' }]\n`)
|
|
267
|
+
writeFile(path.join(appDir, 'src', 'modules', 'consents', 'index.ts'), "export const metadata = { title: 'Local overlay' }\n")
|
|
268
|
+
const before = snapshotDirectory(path.join(appDir, 'src'))
|
|
269
|
+
|
|
270
|
+
const result = runMercato(['generate', 'all', '--quiet'], appDir)
|
|
271
|
+
|
|
272
|
+
expect(result.status, result.output).toBe(0)
|
|
273
|
+
expect(snapshotDirectory(path.join(appDir, 'src'))).toEqual(before)
|
|
274
|
+
expect(fs.readFileSync(path.join(appDir, '.mercato', 'generated', 'di.generated.ts'), 'utf8')).toContain(`${binding}/modules/consents/di`)
|
|
275
|
+
} finally {
|
|
276
|
+
fs.rmSync(appDir, { recursive: true, force: true })
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
})
|
|
@@ -286,6 +286,10 @@ describe('runAgenticSetup ownership modes', () => {
|
|
|
286
286
|
) as { files: ManifestEntry[] }
|
|
287
287
|
expect(manifest.files.find((item) => item.path === '.ai/lessons.md')?.userEditable).toBe(true)
|
|
288
288
|
expect(manifest.files.find((item) => item.path === '.ai/lessons/_template.md')?.userEditable).toBe(true)
|
|
289
|
+
expect(
|
|
290
|
+
manifest.files.find((item) => item.path === '.ai/guides/production-deployment.md'),
|
|
291
|
+
).toMatchObject({ source: 'generated', userEditable: false })
|
|
292
|
+
expect(existsSync(join(appDir, '.ai', 'guides', 'production-deployment.md'))).toBe(true)
|
|
289
293
|
expect(existsSync(join(appDir, 'scripts', 'check-lessons.mjs'))).toBe(true)
|
|
290
294
|
if (process.platform !== 'win32') {
|
|
291
295
|
expect(statSync(join(appDir, 'scripts', 'install-skills.sh')).mode & 0o111).not.toBe(0)
|