@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
|
@@ -60,7 +60,7 @@ export type GenerateWatcherOptions = {
|
|
|
60
60
|
export type GenerateWatcherHandle = {
|
|
61
61
|
/** Resolves when the watcher loop has stopped (after `close()`). */
|
|
62
62
|
readonly done: Promise<void>
|
|
63
|
-
/** Stop the
|
|
63
|
+
/** Stop polling, drain the active cycle, and resolve `done`. Idempotent. */
|
|
64
64
|
close(): Promise<void>
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -89,6 +89,7 @@ export function startInProcessGenerateWatcher(
|
|
|
89
89
|
|
|
90
90
|
let stopping = false
|
|
91
91
|
let pollTimer: ReturnType<typeof setTimeout> | null = null
|
|
92
|
+
let activeCycle: Promise<void> | null = null
|
|
92
93
|
let running = false
|
|
93
94
|
let pendingReason: string | null = null
|
|
94
95
|
let previousChecksum = ''
|
|
@@ -99,6 +100,7 @@ export function startInProcessGenerateWatcher(
|
|
|
99
100
|
})
|
|
100
101
|
|
|
101
102
|
async function runOnce(reason: string): Promise<void> {
|
|
103
|
+
if (stopping) return
|
|
102
104
|
if (running) {
|
|
103
105
|
pendingReason = reason
|
|
104
106
|
return
|
|
@@ -128,7 +130,7 @@ export function startInProcessGenerateWatcher(
|
|
|
128
130
|
function scheduleNext(): void {
|
|
129
131
|
if (stopping) return
|
|
130
132
|
pollTimer = setTimeout(() => {
|
|
131
|
-
|
|
133
|
+
activeCycle = (async () => {
|
|
132
134
|
if (stopping) return
|
|
133
135
|
try {
|
|
134
136
|
const changeVersion = changeSignal?.currentVersion() ?? 0
|
|
@@ -164,13 +166,15 @@ export function startInProcessGenerateWatcher(
|
|
|
164
166
|
pollTimer.unref?.()
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
|
|
169
|
+
activeCycle = (async () => {
|
|
168
170
|
try {
|
|
169
171
|
await changeSignal?.refresh()
|
|
172
|
+
if (stopping) return
|
|
170
173
|
const initialChangeVersion = changeSignal?.currentVersion() ?? 0
|
|
171
174
|
if (!skipInitial) {
|
|
172
175
|
await runOnce('initial')
|
|
173
176
|
}
|
|
177
|
+
if (stopping) return
|
|
174
178
|
previousChecksum = await computeStructureChecksum()
|
|
175
179
|
observedChangeVersion = initialChangeVersion
|
|
176
180
|
if (!quiet) {
|
|
@@ -199,9 +203,13 @@ export function startInProcessGenerateWatcher(
|
|
|
199
203
|
clearTimeout(pollTimer)
|
|
200
204
|
pollTimer = null
|
|
201
205
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
206
|
+
// Drain before closing subscriptions: an in-flight capture can refresh
|
|
207
|
+
// them, and a generator child must exit before dev restarts its group.
|
|
208
|
+
try {
|
|
209
|
+
await activeCycle
|
|
210
|
+
await changeSignal?.close()
|
|
211
|
+
} finally {
|
|
212
|
+
doneResolve?.()
|
|
205
213
|
doneResolve = null
|
|
206
214
|
}
|
|
207
215
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ExistingDatabaseDecision = 'proceed' | 'skip' | 'abort'
|
|
2
|
+
|
|
3
|
+
export function decideExistingDatabase(existingUsersCount: number, skipIfInitialized: boolean): ExistingDatabaseDecision {
|
|
4
|
+
if (!Number.isFinite(existingUsersCount) || existingUsersCount <= 0) return 'proceed'
|
|
5
|
+
return skipIfInitialized ? 'skip' : 'abort'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function describeDatabaseTarget(databaseUrl: string): string {
|
|
9
|
+
try {
|
|
10
|
+
const url = new URL(databaseUrl)
|
|
11
|
+
const database = decodeURIComponent(url.pathname.replace(/^\/+/, '')) || '(default database)'
|
|
12
|
+
const host = url.hostname || 'localhost'
|
|
13
|
+
return `${host}${url.port ? `:${url.port}` : ''}/${database}`
|
|
14
|
+
} catch {
|
|
15
|
+
return 'the database from DATABASE_URL'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function formatSkipIfInitializedMessage(existingUsersCount: number, databaseUrl: string): string[] {
|
|
20
|
+
return [
|
|
21
|
+
`✅ Database already initialized (${existingUsersCount} user(s) in ${describeDatabaseTarget(databaseUrl)}) — keeping the existing data and skipping the first-run seed.`,
|
|
22
|
+
' Not the database you expected? Check DATABASE_URL in .env. To wipe it and seed from scratch: yarn mercato init --reinstall',
|
|
23
|
+
]
|
|
24
|
+
}
|
package/src/lib/init-secrets.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { parseBooleanToken } from '@open-mercato/shared/lib/boolean'
|
|
2
|
+
import { getPasswordPolicy, validatePassword } from '@open-mercato/shared/lib/auth/passwordPolicy'
|
|
2
3
|
import { randomBytes } from 'node:crypto'
|
|
4
|
+
import { createTranslator } from '@open-mercato/shared/lib/i18n/translate'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
|
|
7
|
+
const requireLocale = createRequire(import.meta.url)
|
|
8
|
+
|
|
9
|
+
function initTranslator(env: NodeJS.ProcessEnv) {
|
|
10
|
+
const locale = (env.LC_ALL || env.LC_MESSAGES || env.LANG || 'en').split(/[_.-]/)[0].toLowerCase()
|
|
11
|
+
const supportedLocale = ['en', 'pl', 'es', 'de', 'ko'].includes(locale) ? locale : 'en'
|
|
12
|
+
const dictionary: Record<string, string> = requireLocale(`../i18n/${supportedLocale}.json`)
|
|
13
|
+
return createTranslator(dictionary)
|
|
14
|
+
}
|
|
3
15
|
|
|
4
16
|
type EnvReader = (key: string) => string | undefined
|
|
5
17
|
|
|
@@ -71,3 +83,28 @@ export function resolveInitDerivedSecrets(options: {
|
|
|
71
83
|
employeePassword: resolvePassword('OM_INIT_EMPLOYEE_PASSWORD', employeeEmail),
|
|
72
84
|
}
|
|
73
85
|
}
|
|
86
|
+
|
|
87
|
+
export function resolveInitSuperadminCredentials(args: string[], env: NodeJS.ProcessEnv = process.env) {
|
|
88
|
+
const argValue = (name: string) => args.find((arg) => arg.startsWith(`${name}=`))?.slice(name.length + 1) || undefined
|
|
89
|
+
const email = argValue('--email') ?? readEnvValue(env, 'OM_INIT_SUPERADMIN_EMAIL') ?? 'superadmin@acme.com'
|
|
90
|
+
const suppliedPassword = argValue('--password') ?? readEnvValue(env, 'OM_INIT_SUPERADMIN_PASSWORD')
|
|
91
|
+
const isProduction = (env.NODE_ENV ?? '').trim().toLowerCase() === 'production'
|
|
92
|
+
const skipPolicyArg = args.find((arg) =>
|
|
93
|
+
arg === '--skip-password-policy' || arg.startsWith('--skip-password-policy=') ||
|
|
94
|
+
arg === '--allow-weak-password' || arg.startsWith('--allow-weak-password='),
|
|
95
|
+
)
|
|
96
|
+
const skipPasswordPolicy = !isProduction && (skipPolicyArg
|
|
97
|
+
? parseBooleanToken(skipPolicyArg.split('=')[1] ?? 'true') ?? true
|
|
98
|
+
: true)
|
|
99
|
+
if (isProduction) {
|
|
100
|
+
const t = initTranslator(env)
|
|
101
|
+
const placeholder = suppliedPassword?.trim().toLowerCase()
|
|
102
|
+
if (!suppliedPassword || !placeholder || ['secret', 'password', 'changeme', 'change-me', 'change_me', 'replace-me', 'replace_me'].includes(placeholder)) {
|
|
103
|
+
throw new Error(t('cli.init.errors.superadminPasswordRequired'))
|
|
104
|
+
}
|
|
105
|
+
if (!validatePassword(suppliedPassword, getPasswordPolicy(env)).ok) {
|
|
106
|
+
throw new Error(t('cli.init.errors.superadminPasswordPolicy'))
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { email, password: suppliedPassword ?? 'secret', skipPasswordPolicy }
|
|
110
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type InitSummaryUser = { icon: string; label: string; email: string; password: string }
|
|
2
|
+
|
|
3
|
+
type InitSummaryOptions = {
|
|
4
|
+
users: InitSummaryUser[]
|
|
5
|
+
autoStart: boolean
|
|
6
|
+
columns?: number
|
|
7
|
+
color?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const segmenter = new Intl.Segmenter('en', { granularity: 'grapheme' })
|
|
11
|
+
const panelStyle = '\u001b[48;2;57;62;70m\u001b[38;2;238;238;238m'
|
|
12
|
+
const reset = '\u001b[0m'
|
|
13
|
+
|
|
14
|
+
function cellWidth(value: string): number {
|
|
15
|
+
if (/\p{Extended_Pictographic}|\p{Regional_Indicator}|[\u1100-\u115f\u2329\u232a\u2e80-\ua4cf\uac00-\ud7a3\uf900-\ufaff\ufe10-\ufe19\ufe30-\ufe6f\uff01-\uff60\uffe0-\uffe6]/u.test(value)) return 2
|
|
16
|
+
return /^\p{Mark}+$/u.test(value) ? 0 : 1
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function wrapLine(line: string, width: number): string[] {
|
|
20
|
+
const wrapped: string[] = []
|
|
21
|
+
let current = ''
|
|
22
|
+
let currentWidth = 0
|
|
23
|
+
for (const { segment } of segmenter.segment(line)) {
|
|
24
|
+
const segmentWidth = cellWidth(segment)
|
|
25
|
+
if (currentWidth + segmentWidth > width && current) {
|
|
26
|
+
wrapped.push(current)
|
|
27
|
+
current = ''
|
|
28
|
+
currentWidth = 0
|
|
29
|
+
}
|
|
30
|
+
current += segment
|
|
31
|
+
currentWidth += segmentWidth
|
|
32
|
+
}
|
|
33
|
+
wrapped.push(current)
|
|
34
|
+
return wrapped
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function formatInitSummary({ users, autoStart, columns = 80, color = false }: InitSummaryOptions): string[] {
|
|
38
|
+
const width = Number.isFinite(columns) && columns >= 8 ? Math.floor(columns) : 80
|
|
39
|
+
const lines = ['', '🔑 DEVELOPMENT ACCOUNTS', '']
|
|
40
|
+
for (const user of users) {
|
|
41
|
+
lines.push(`${user.icon} ${user.label}`, ` Email: ${user.email}`, ` Password: ${user.password}`, '')
|
|
42
|
+
}
|
|
43
|
+
lines.push(...(autoStart
|
|
44
|
+
? ['🚀 The dev server will start automatically.', ' Next time, run: yarn dev']
|
|
45
|
+
: ['🚀 Start the dev server: yarn dev']))
|
|
46
|
+
lines.push('')
|
|
47
|
+
const rule = '━'.repeat(width)
|
|
48
|
+
const content = lines.flatMap((line) => wrapLine(line, width - 4).map((part) => ` ${part}`))
|
|
49
|
+
return [rule, ...content, rule].map((line) => {
|
|
50
|
+
if (!color) return line
|
|
51
|
+
const visibleWidth = [...segmenter.segment(line)].reduce((total, { segment }) => total + cellWidth(segment), 0)
|
|
52
|
+
return `${panelStyle}${line}${' '.repeat(Math.max(0, width - visibleWidth))}${reset}`
|
|
53
|
+
})
|
|
54
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { assertModulePackageExports, parsePackageNameFromSpec } from './module-package'
|
|
3
|
+
|
|
4
|
+
export type GithubModuleTarget = {
|
|
5
|
+
packageName: string
|
|
6
|
+
packageSpec: string
|
|
7
|
+
moduleIds: string[]
|
|
8
|
+
locator: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function githubApi(endpoint: string, cwd: string): unknown {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(execFileSync('gh', ['api', endpoint], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 60_000, maxBuffer: 16 * 1024 * 1024 })) as unknown
|
|
14
|
+
} catch {
|
|
15
|
+
throw new Error(`Cannot read GitHub repository metadata at ${endpoint}. Check the locator and access with "gh auth login". No package was installed.`)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function record(value: unknown): Record<string, unknown> {
|
|
20
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function resolveGithubModuleTarget(input: string, cwd: string, options: { moduleId?: string; enabledModules?: readonly { id: string; from?: string }[] } = {}): GithubModuleTarget {
|
|
24
|
+
let normalized = input.trim()
|
|
25
|
+
.replace(/^(?:(?:git\+)?https?:\/\/github\.com\/)+/i, '')
|
|
26
|
+
.replace(/^github\.com\//i, '')
|
|
27
|
+
.replace(/^github:/i, '')
|
|
28
|
+
.replace(/^git@github\.com:/i, '')
|
|
29
|
+
.replace(/^(?:git\+)?ssh:\/\/(?:git@)?github\.com\//i, '')
|
|
30
|
+
const hash = normalized.indexOf('#')
|
|
31
|
+
const separator = hash < 0 ? normalized.lastIndexOf('@') : hash
|
|
32
|
+
const requestedRef = separator < 0 ? undefined : normalized.slice(separator + 1)
|
|
33
|
+
if (requestedRef !== undefined && !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/.test(requestedRef)) {
|
|
34
|
+
throw new Error('Invalid GitHub revision. No package was installed.')
|
|
35
|
+
}
|
|
36
|
+
normalized = (separator < 0 ? normalized : normalized.slice(0, separator)).replace(/\/$/, '').replace(/\.git$/i, '')
|
|
37
|
+
if (/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(normalized)) {
|
|
38
|
+
const login = record(githubApi('user', cwd)).login
|
|
39
|
+
if (typeof login !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9-]*$/.test(login)) {
|
|
40
|
+
throw new Error('Cannot determine your GitHub account. Use owner/repository or a full GitHub URL.')
|
|
41
|
+
}
|
|
42
|
+
normalized = `${login}/${normalized}`
|
|
43
|
+
}
|
|
44
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9][A-Za-z0-9._-]*$/.test(normalized)) {
|
|
45
|
+
throw new Error('Unsupported GitHub locator. Use github:owner/repository, a repository URL, or owner/repository.')
|
|
46
|
+
}
|
|
47
|
+
const repository = normalized.toLowerCase()
|
|
48
|
+
const ref = requestedRef ?? record(githubApi(`repos/${repository}`, cwd)).default_branch
|
|
49
|
+
if (typeof ref !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,254}$/.test(ref)) {
|
|
50
|
+
throw new Error('Cannot determine a valid GitHub revision. Use a repository locator with #branch, #tag, or #commit.')
|
|
51
|
+
}
|
|
52
|
+
const sha = record(githubApi(`repos/${repository}/commits/${encodeURIComponent(ref)}`, cwd)).sha
|
|
53
|
+
if (typeof sha !== 'string' || !/^[0-9a-f]{40}$/.test(sha)) {
|
|
54
|
+
throw new Error(`Cannot resolve ${repository} to an immutable commit. No package was installed.`)
|
|
55
|
+
}
|
|
56
|
+
const contents = record(githubApi(`repos/${repository}/contents/package.json?ref=${sha}`, cwd))
|
|
57
|
+
if (contents.encoding !== 'base64' || typeof contents.content !== 'string') {
|
|
58
|
+
throw new Error(`Repository ${repository} has no readable package.json. No package was installed.`)
|
|
59
|
+
}
|
|
60
|
+
let manifest: Record<string, unknown>
|
|
61
|
+
try {
|
|
62
|
+
manifest = record(JSON.parse(Buffer.from(contents.content, 'base64').toString('utf8')))
|
|
63
|
+
} catch {
|
|
64
|
+
throw new Error(`Repository ${repository} has invalid package.json. No package was installed.`)
|
|
65
|
+
}
|
|
66
|
+
const packageName = manifest.name
|
|
67
|
+
if (typeof packageName !== 'string' || !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(packageName) || parsePackageNameFromSpec(packageName) !== packageName) {
|
|
68
|
+
throw new Error(`Repository ${repository} has no valid npm package name. No package was installed.`)
|
|
69
|
+
}
|
|
70
|
+
const tree = record(githubApi(`repos/${repository}/git/trees/${sha}?recursive=1`, cwd))
|
|
71
|
+
if (!Array.isArray(tree.tree) || tree.truncated === true) {
|
|
72
|
+
throw new Error(`Cannot enumerate modules in ${repository}. No package was installed.`)
|
|
73
|
+
}
|
|
74
|
+
const moduleIds = Array.from(new Set(tree.tree.flatMap((entry: unknown) => {
|
|
75
|
+
const filePath = record(entry).path
|
|
76
|
+
const match = typeof filePath === 'string' ? /^src\/modules\/([a-z0-9]+(?:_[a-z0-9]+)*)\/index\.ts$/.exec(filePath) : null
|
|
77
|
+
return match ? [match[1]] : []
|
|
78
|
+
})))
|
|
79
|
+
if (moduleIds.length === 0) throw new Error(`Repository ${repository} has no module descriptors in src/modules/. No package was installed.`)
|
|
80
|
+
const files = tree.tree.flatMap((entry: unknown) => {
|
|
81
|
+
const filePath = record(entry).path
|
|
82
|
+
if (typeof filePath !== 'string') return []
|
|
83
|
+
const compiledPath = /^src\/modules\/.+\.tsx?$/.test(filePath) ? filePath.replace(/^src\//, 'dist/').replace(/\.tsx?$/, '.js') : undefined
|
|
84
|
+
return compiledPath ? [filePath, compiledPath] : [filePath]
|
|
85
|
+
})
|
|
86
|
+
const requiredModuleIds = new Set([
|
|
87
|
+
...(options.moduleId ? [options.moduleId] : moduleIds.length === 1 ? moduleIds : []),
|
|
88
|
+
...(options.enabledModules ?? []).filter((entry) => (entry.from ?? '@open-mercato/core') === packageName).map((entry) => entry.id),
|
|
89
|
+
])
|
|
90
|
+
const sourceCache = new Map<string, string>()
|
|
91
|
+
const readSource = (relativePath: string): string => {
|
|
92
|
+
const cached = sourceCache.get(relativePath)
|
|
93
|
+
if (cached !== undefined) return cached
|
|
94
|
+
const encodedPath = relativePath.split('/').map(encodeURIComponent).join('/')
|
|
95
|
+
const file = record(githubApi(`repos/${repository}/contents/${encodedPath}?ref=${sha}`, cwd))
|
|
96
|
+
if (file.encoding !== 'base64' || typeof file.content !== 'string' || file.content.length > 2 * 1024 * 1024) {
|
|
97
|
+
throw new Error(`Cannot inspect module source in ${repository} at the selected commit. No package was installed.`)
|
|
98
|
+
}
|
|
99
|
+
const source = Buffer.from(file.content, 'base64').toString('utf8')
|
|
100
|
+
if (Buffer.byteLength(source, 'utf8') > 1024 * 1024) throw new Error(`Module source inspection limit exceeded in ${repository}. No package was installed.`)
|
|
101
|
+
sourceCache.set(relativePath, source)
|
|
102
|
+
return source
|
|
103
|
+
}
|
|
104
|
+
for (const moduleId of requiredModuleIds) {
|
|
105
|
+
if (!moduleIds.includes(moduleId)) continue
|
|
106
|
+
assertModulePackageExports(manifest, packageName, moduleId, files, readSource)
|
|
107
|
+
}
|
|
108
|
+
return { packageName, packageSpec: `${packageName}@github:${repository}#${sha}`, moduleIds, locator: `github:${repository}` }
|
|
109
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import ts from 'typescript-js'
|
|
4
|
+
import { normalizeModuleLocator, type ModuleIdentity } from '@open-mercato/shared/modules/module-locators'
|
|
5
|
+
import type { ModuleEntry, PackageResolver } from './resolver'
|
|
6
|
+
import { readEnabledModules } from './modules-config'
|
|
7
|
+
|
|
8
|
+
function readJson(filePath: string): Record<string, unknown> {
|
|
9
|
+
try {
|
|
10
|
+
const value: unknown = JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
|
11
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}
|
|
12
|
+
} catch {
|
|
13
|
+
return {}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function readMetadataLocator(moduleBase: string): string | undefined {
|
|
18
|
+
const indexPath = ['index.ts', 'index.js'].map((name) => path.join(moduleBase, name)).find((candidate) => fs.existsSync(candidate))
|
|
19
|
+
if (!indexPath) return undefined
|
|
20
|
+
const source = ts.createSourceFile(indexPath, fs.readFileSync(indexPath, 'utf8'), ts.ScriptTarget.Latest, true)
|
|
21
|
+
let locator: string | undefined
|
|
22
|
+
function visit(node: ts.Node): void {
|
|
23
|
+
if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === 'metadata' && node.initializer) {
|
|
24
|
+
let initializer = node.initializer
|
|
25
|
+
while (ts.isAsExpression(initializer) || ts.isSatisfiesExpression(initializer) || ts.isParenthesizedExpression(initializer)) initializer = initializer.expression
|
|
26
|
+
if (ts.isObjectLiteralExpression(initializer)) {
|
|
27
|
+
for (const property of initializer.properties) {
|
|
28
|
+
if (ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)) && property.name.text === 'locator' && ts.isStringLiteralLike(property.initializer)) locator = property.initializer.text
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
ts.forEachChild(node, visit)
|
|
33
|
+
}
|
|
34
|
+
visit(source)
|
|
35
|
+
return locator
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function sourceLocator(value: unknown): string | undefined {
|
|
39
|
+
if (typeof value !== 'string') return undefined
|
|
40
|
+
const locator = normalizeModuleLocator(value)
|
|
41
|
+
return locator?.startsWith('npm:') || locator?.startsWith('github:') ? locator : undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function installedDependencyLocator(specifier: unknown, canonicalName: string | undefined): string | undefined {
|
|
45
|
+
if (typeof specifier !== 'string') return undefined
|
|
46
|
+
if (/^(?:github:|github\.com\/|(?:git\+)?https?:\/\/github\.com\/|git@github\.com:|(?:git\+)?ssh:\/\/|[a-z0-9][a-z0-9-]*\/[a-z0-9._-]+(?:[#@]|$))/i.test(specifier)) {
|
|
47
|
+
const locator = sourceLocator(specifier)
|
|
48
|
+
return locator?.startsWith('github:') ? locator : undefined
|
|
49
|
+
}
|
|
50
|
+
if (specifier.startsWith('npm:')) {
|
|
51
|
+
const aliasTarget = specifier.match(/^npm:(@[^/]+\/[^@]+|[^@]+)(?:@.+)?$/)?.[1]
|
|
52
|
+
return aliasTarget ? sourceLocator(`npm:${aliasTarget}`) : undefined
|
|
53
|
+
}
|
|
54
|
+
if (!canonicalName || /^(?:[a-z][a-z0-9+.-]*:|[./]|https?:)/i.test(specifier)) return undefined
|
|
55
|
+
return sourceLocator(`npm:${canonicalName}`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function assertDeclaredIdentity(entry: ModuleEntry, observedLocator: string | undefined, canonicalName: string | undefined): void {
|
|
59
|
+
const binding = entry.from ?? '@open-mercato/core'
|
|
60
|
+
if (entry.packageName && canonicalName && entry.packageName !== canonicalName) {
|
|
61
|
+
throw new Error(`[modules] Cannot resolve module '${entry.id}' from binding '${binding}': declared package '${entry.packageName}' disagrees with installed package '${canonicalName}'. Restore the intended binding or correct src/modules.ts, then regenerate.`)
|
|
62
|
+
}
|
|
63
|
+
const declaredLocator = sourceLocator(entry.locator)
|
|
64
|
+
if (declaredLocator && observedLocator && declaredLocator !== observedLocator) {
|
|
65
|
+
throw new Error(`[modules] Cannot resolve module '${entry.id}' from binding '${binding}': declared origin '${declaredLocator}' disagrees with observed origin '${observedLocator}'. Disable the old provider before replacing it, then regenerate.`)
|
|
66
|
+
}
|
|
67
|
+
if (declaredLocator?.startsWith('npm:') && canonicalName && declaredLocator !== sourceLocator(`npm:${canonicalName}`)) {
|
|
68
|
+
throw new Error(`[modules] Cannot resolve module '${entry.id}' from binding '${binding}': declared origin '${declaredLocator}' disagrees with installed package '${canonicalName}'. Correct src/modules.ts to select the intended provider, then regenerate.`)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function readModuleLocators(
|
|
73
|
+
entry: ModuleEntry,
|
|
74
|
+
resolver: PackageResolver,
|
|
75
|
+
appManifest: Record<string, unknown>,
|
|
76
|
+
packageManifests: Map<string, Record<string, unknown>>,
|
|
77
|
+
): string[] {
|
|
78
|
+
const from = entry.from ?? '@open-mercato/core'
|
|
79
|
+
if (from === '@app') {
|
|
80
|
+
const retainedLocator = sourceLocator(entry.locator ?? readMetadataLocator(resolver.getModulePaths(entry).appBase))
|
|
81
|
+
assertDeclaredIdentity(entry, retainedLocator, entry.packageName)
|
|
82
|
+
return retainedLocator ? [retainedLocator] : []
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let manifest = packageManifests.get(from)
|
|
86
|
+
if (!manifest) {
|
|
87
|
+
manifest = readJson(path.join(resolver.getPackageRoot(from), 'package.json'))
|
|
88
|
+
packageManifests.set(from, manifest)
|
|
89
|
+
}
|
|
90
|
+
const canonicalName = typeof manifest.name === 'string' ? manifest.name : undefined
|
|
91
|
+
const observedLocators = new Set<string>()
|
|
92
|
+
for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) {
|
|
93
|
+
const dependencies = appManifest[section]
|
|
94
|
+
if (!dependencies || typeof dependencies !== 'object' || Array.isArray(dependencies)) continue
|
|
95
|
+
const specifier = (dependencies as Record<string, unknown>)[from]
|
|
96
|
+
const locator = installedDependencyLocator(specifier, canonicalName)
|
|
97
|
+
if (locator?.startsWith('npm:') && canonicalName !== from && typeof specifier === 'string' && !specifier.startsWith('npm:')) {
|
|
98
|
+
throw new Error(`[modules] Cannot resolve module '${entry.id}' from binding '${from}': installed package '${canonicalName}' does not match the dependency binding. Restore the intended package or declare an explicit npm alias, then regenerate.`)
|
|
99
|
+
}
|
|
100
|
+
if (locator) observedLocators.add(locator)
|
|
101
|
+
}
|
|
102
|
+
if (observedLocators.size > 1) {
|
|
103
|
+
throw new Error(`[modules] Cannot resolve module '${entry.id}' from binding '${from}': dependency sections declare conflicting origins. Keep one provider for this binding in package.json, then regenerate.`)
|
|
104
|
+
}
|
|
105
|
+
const observedLocator = [...observedLocators][0]
|
|
106
|
+
if (observedLocator?.startsWith('npm:') && canonicalName && observedLocator !== sourceLocator(`npm:${canonicalName}`)) {
|
|
107
|
+
throw new Error(`[modules] Cannot resolve module '${entry.id}' from binding '${from}': dependency origin '${observedLocator}' disagrees with installed package '${canonicalName}'. Restore the intended package through the package manager, then regenerate.`)
|
|
108
|
+
}
|
|
109
|
+
assertDeclaredIdentity(entry, observedLocator, canonicalName)
|
|
110
|
+
const locator = observedLocator ?? sourceLocator(entry.locator)
|
|
111
|
+
return locator ? [locator] : []
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function getModuleLocators(entry: ModuleEntry, resolver: PackageResolver): string[] {
|
|
115
|
+
return readModuleLocators(entry, resolver, readJson(path.join(resolver.getAppDir(), 'package.json')), new Map())
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function assertUniqueEnabledModuleIds(enabledModules: readonly ModuleEntry[], resolver: PackageResolver): void {
|
|
119
|
+
const byId = new Map<string, ModuleEntry>()
|
|
120
|
+
for (const entry of enabledModules) {
|
|
121
|
+
const existing = byId.get(entry.id)
|
|
122
|
+
if (existing) {
|
|
123
|
+
const describe = (provider: ModuleEntry): string => {
|
|
124
|
+
const binding = provider.from ?? '@open-mercato/core'
|
|
125
|
+
const source = sourceLocator(provider.locator)
|
|
126
|
+
return binding === '@app'
|
|
127
|
+
? `@app (${resolver.getModulePaths(provider).appBase})${source ? `, origin ${source}` : ''}`
|
|
128
|
+
: `binding '${binding}'${source ? `, origin ${source}` : ''}`
|
|
129
|
+
}
|
|
130
|
+
throw new Error(`[generate] Duplicate enabled module ID '${entry.id}': ${describe(existing)} and ${describe(entry)}. Keep one provider in src/modules.ts, then run yarn mercato generate. Installing under another package alias does not allow both module IDs to run.`)
|
|
131
|
+
}
|
|
132
|
+
byId.set(entry.id, entry)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function getEnabledModuleIdentities(resolver: PackageResolver, enabledModules: readonly ModuleEntry[] = resolver.loadEnabledModules()): ModuleIdentity[] {
|
|
137
|
+
const modulesPath = typeof resolver.getModulesConfigPath === 'function'
|
|
138
|
+
? resolver.getModulesConfigPath()
|
|
139
|
+
: path.join(resolver.getAppDir(), 'src', 'modules.ts')
|
|
140
|
+
if (fs.existsSync(modulesPath)) assertUniqueEnabledModuleIds(readEnabledModules(modulesPath), resolver)
|
|
141
|
+
assertUniqueEnabledModuleIds(enabledModules, resolver)
|
|
142
|
+
const appManifest = readJson(path.join(resolver.getAppDir(), 'package.json'))
|
|
143
|
+
const packageManifests = new Map<string, Record<string, unknown>>()
|
|
144
|
+
return enabledModules.map((entry) => ({ id: entry.id, locators: readModuleLocators(entry, resolver, appManifest, packageManifests) }))
|
|
145
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import os from 'node:os'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { execFileSync } from 'node:child_process'
|
|
5
|
+
import spawn from 'cross-spawn'
|
|
6
|
+
import { assertModulePackageExports, isModulePackageExportError } from './module-package'
|
|
7
|
+
|
|
8
|
+
export type InspectedModuleTarget = {
|
|
9
|
+
packageName: string
|
|
10
|
+
packageSpec: string
|
|
11
|
+
moduleIds: string[]
|
|
12
|
+
locator?: string
|
|
13
|
+
version?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type ArtifactInspection = { moduleIds: string[]; version?: string }
|
|
17
|
+
|
|
18
|
+
function record(value: unknown): Record<string, unknown> {
|
|
19
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function inspectFiles(manifest: Record<string, unknown>, packageName: string, files: string[], requiredModuleIds: readonly string[], readSource: (relativePath: string) => string): ArtifactInspection {
|
|
23
|
+
if (manifest.name !== packageName) throw new Error(`Inspected package does not match "${packageName}". No package was installed.`)
|
|
24
|
+
const moduleIds = [...new Set(files.flatMap((file) => {
|
|
25
|
+
const match = /^src\/modules\/([a-z0-9]+(?:_[a-z0-9]+)*)\/index\.ts$/.exec(file)
|
|
26
|
+
return match && files.includes(`dist/modules/${match[1]}/index.js`) ? [match[1]] : []
|
|
27
|
+
}))]
|
|
28
|
+
const checkedModuleIds = requiredModuleIds.length ? requiredModuleIds : moduleIds.length === 1 ? moduleIds : []
|
|
29
|
+
for (const moduleId of checkedModuleIds) {
|
|
30
|
+
if (!moduleIds.includes(moduleId)) throw new Error(`Package "${packageName}" is missing source or compiled descriptors for "${moduleId}". No package was installed.`)
|
|
31
|
+
assertModulePackageExports(manifest, packageName, moduleId, files, readSource)
|
|
32
|
+
}
|
|
33
|
+
if (moduleIds.length === 0) throw new Error(`Package "${packageName}" is missing source or compiled module descriptors. Build the package before retrying. No package was installed.`)
|
|
34
|
+
return { moduleIds, ...(typeof manifest.version === 'string' ? { version: manifest.version } : {}) }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function inspectArchive(archive: string, packageName: string, requiredModuleIds: readonly string[]): ArtifactInspection {
|
|
38
|
+
const manifest = record(JSON.parse(execFileSync('tar', ['-xOf', archive, 'package/package.json'], { encoding: 'utf8', timeout: 15_000 })))
|
|
39
|
+
const files = execFileSync('tar', ['-tf', archive], { encoding: 'utf8', timeout: 15_000, maxBuffer: 16 * 1024 * 1024 }).split('\n').filter((file) => file.startsWith('package/')).map((file) => file.slice('package/'.length))
|
|
40
|
+
return inspectFiles(manifest, packageName, files, requiredModuleIds, (relativePath) => execFileSync('tar', ['-xOf', archive, `package/${relativePath}`], { encoding: 'utf8', timeout: 15_000, maxBuffer: 1024 * 1024 }))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function packageFiles(packageRoot: string, relativeDir = ''): string[] {
|
|
44
|
+
return fs.readdirSync(path.join(packageRoot, relativeDir), { withFileTypes: true }).flatMap((entry) => {
|
|
45
|
+
if (entry.name === 'node_modules' || entry.name.startsWith('.')) return []
|
|
46
|
+
const relativePath = path.posix.join(relativeDir, entry.name)
|
|
47
|
+
return entry.isDirectory() ? packageFiles(packageRoot, relativePath) : entry.isFile() ? [relativePath] : []
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isModernYarnProject(appDir: string): boolean {
|
|
52
|
+
let directory = appDir
|
|
53
|
+
while (true) {
|
|
54
|
+
if (fs.existsSync(path.join(directory, '.yarnrc.yml'))) return true
|
|
55
|
+
const manifestPath = path.join(directory, 'package.json')
|
|
56
|
+
if (fs.existsSync(manifestPath)) {
|
|
57
|
+
const manifest = record(JSON.parse(fs.readFileSync(manifestPath, 'utf8')))
|
|
58
|
+
if (typeof manifest.packageManager === 'string' && /^yarn@(?:[2-9]|[1-9][0-9]+)\./.test(manifest.packageManager)) return true
|
|
59
|
+
}
|
|
60
|
+
const parent = path.dirname(directory)
|
|
61
|
+
if (parent === directory) return false
|
|
62
|
+
directory = parent
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function yarnNpmConfiguration(appDir: string, packageName: string, temporaryDir: string): string[] {
|
|
67
|
+
if (!isModernYarnProject(appDir)) return []
|
|
68
|
+
const settings = new Map<string, unknown>()
|
|
69
|
+
for (const setting of ['npmRegistryServer', 'npmScopes', 'npmRegistries', 'npmAuthToken', 'npmAuthIdent']) {
|
|
70
|
+
const result = spawn.sync(process.platform === 'win32' ? 'yarn.cmd' : 'yarn', ['config', 'get', setting, '--json', '--no-redacted'], {
|
|
71
|
+
cwd: appDir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 15_000,
|
|
72
|
+
})
|
|
73
|
+
if (result.error || result.status !== 0) throw new Error('Cannot inspect project package registry configuration')
|
|
74
|
+
settings.set(setting, JSON.parse(result.stdout))
|
|
75
|
+
}
|
|
76
|
+
const scope = packageName.startsWith('@') ? packageName.slice(1).split('/')[0] : undefined
|
|
77
|
+
const scopeSettings = scope ? record(record(settings.get('npmScopes'))[scope]) : {}
|
|
78
|
+
const registry = typeof scopeSettings.npmRegistryServer === 'string' ? scopeSettings.npmRegistryServer : settings.get('npmRegistryServer')
|
|
79
|
+
if (typeof registry !== 'string') throw new Error('Missing project package registry')
|
|
80
|
+
const registryUrl = new URL(registry)
|
|
81
|
+
if (!['http:', 'https:'].includes(registryUrl.protocol) || registryUrl.username || registryUrl.password) throw new Error('Invalid project package registry')
|
|
82
|
+
const registryKey = `//${registryUrl.host}${registryUrl.pathname}`.replace(/\/$/, '')
|
|
83
|
+
const registries = record(settings.get('npmRegistries'))
|
|
84
|
+
const registrySettings = record(registries[registry.replace(/\/$/, '')] ?? registries[registryKey] ?? registries[`${registryKey}/`])
|
|
85
|
+
const auth = scopeSettings.npmAuthToken || scopeSettings.npmAuthIdent ? scopeSettings
|
|
86
|
+
: registrySettings.npmAuthToken || registrySettings.npmAuthIdent ? registrySettings
|
|
87
|
+
: { npmAuthToken: settings.get('npmAuthToken'), npmAuthIdent: settings.get('npmAuthIdent') }
|
|
88
|
+
const userConfig = process.env.NPM_CONFIG_USERCONFIG ?? process.env.npm_config_userconfig ?? path.join(os.homedir(), '.npmrc')
|
|
89
|
+
const existingConfig = fs.existsSync(userConfig) ? fs.readFileSync(userConfig, 'utf8') : ''
|
|
90
|
+
const lines = [existingConfig, `registry=${JSON.stringify(registry)}`]
|
|
91
|
+
if (scope) lines.push(`@${scope}:registry=${JSON.stringify(registry)}`)
|
|
92
|
+
if (typeof auth.npmAuthToken === 'string' && auth.npmAuthToken) lines.push(`${registryKey}/:_authToken=${JSON.stringify(auth.npmAuthToken)}`)
|
|
93
|
+
else if (typeof auth.npmAuthIdent === 'string' && auth.npmAuthIdent) lines.push(`${registryKey}/:_auth=${Buffer.from(auth.npmAuthIdent).toString('base64')}`)
|
|
94
|
+
const configPath = path.join(temporaryDir, 'inspection.npmrc')
|
|
95
|
+
fs.writeFileSync(configPath, `${lines.join('\n')}\n`, { mode: 0o600 })
|
|
96
|
+
return ['--userconfig', configPath, '--registry', registry, ...(scope ? [`--@${scope}:registry=${registry}`] : [])]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function inspectNpmModuleTarget(packageSpec: string, packageName: string, appDir: string, requiredModuleIds: readonly string[] = []): InspectedModuleTarget {
|
|
100
|
+
const filePrefix = `${packageName}@file:`
|
|
101
|
+
if (packageSpec.startsWith(filePrefix)) {
|
|
102
|
+
const packageRoot = path.resolve(appDir, packageSpec.slice(filePrefix.length))
|
|
103
|
+
if (fs.statSync(packageRoot).isFile()) return { packageName, packageSpec, ...inspectArchive(packageRoot, packageName, requiredModuleIds) }
|
|
104
|
+
const manifest = record(JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8')))
|
|
105
|
+
const inspected = inspectFiles(manifest, packageName, packageFiles(packageRoot), requiredModuleIds, (relativePath) => fs.readFileSync(path.join(packageRoot, relativePath), 'utf8'))
|
|
106
|
+
return { packageName, packageSpec, ...inspected }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const temporaryDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mercato-module-inspection-'))
|
|
110
|
+
let inspectionStep = 'read the project registry configuration'
|
|
111
|
+
try {
|
|
112
|
+
const configurationArgs = yarnNpmConfiguration(appDir, packageName, temporaryDir)
|
|
113
|
+
inspectionStep = 'fetch the exact npm artifact'
|
|
114
|
+
const packedProcess = spawn.sync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['pack', packageSpec, '--ignore-scripts', '--json', '--pack-destination', temporaryDir, ...configurationArgs], {
|
|
115
|
+
cwd: appDir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 60_000, maxBuffer: 16 * 1024 * 1024,
|
|
116
|
+
})
|
|
117
|
+
if (packedProcess.error || packedProcess.status !== 0) throw new Error('Artifact inspection failed')
|
|
118
|
+
inspectionStep = 'parse the npm artifact response'
|
|
119
|
+
const packages: unknown = JSON.parse(packedProcess.stdout)
|
|
120
|
+
const packed = record(Array.isArray(packages) ? packages[0] : undefined)
|
|
121
|
+
if (packed.name !== packageName || typeof packed.version !== 'string' || !/^[0-9A-Za-z.+-]+$/.test(packed.version)
|
|
122
|
+
|| typeof packed.filename !== 'string' || path.basename(packed.filename) !== packed.filename) throw new Error('Invalid packed manifest')
|
|
123
|
+
inspectionStep = 'validate the packed module artifact'
|
|
124
|
+
const inspected = inspectArchive(path.join(temporaryDir, packed.filename), packageName, requiredModuleIds)
|
|
125
|
+
if (inspected.version !== packed.version) throw new Error('Packed artifact version disagrees with resolution')
|
|
126
|
+
return { packageName, packageSpec, ...inspected, locator: `npm:${packageName}` }
|
|
127
|
+
} catch (error) {
|
|
128
|
+
const safeDetail = isModulePackageExportError(error) && error instanceof Error ? ` ${error.message}` : ''
|
|
129
|
+
throw new Error(`Cannot inspect the exact module artifact for "${packageName}" while trying to ${inspectionStep}.${safeDetail} Check project registry credentials, package access and shipped src/dist module descriptors before retrying. No package was installed.`)
|
|
130
|
+
} finally {
|
|
131
|
+
fs.rmSync(temporaryDir, { recursive: true, force: true })
|
|
132
|
+
}
|
|
133
|
+
}
|