@open-mercato/cli 0.11.1-develop.8593.1.50784dae35 → 0.11.1-develop.8687.1.adb16f62b3
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 +6 -2
- package/AGENTS.md +2 -0
- package/dist/agentic/guides/architecture.md +2 -2
- package/dist/agentic/guides/extensions.md +7 -2
- package/dist/agentic/guides/framework-extension-points.md +1 -0
- package/dist/agentic/guides/infrastructure-providers.md +20 -0
- package/dist/agentic/guides/integrations.md +2 -2
- package/dist/agentic/guides/module-facts.json +11067 -7122
- package/dist/agentic/guides/module-facts.v2.json +11055 -7094
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -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/assisted_selling/acl-features.md +16 -0
- package/dist/agentic/guides/modules/assisted_selling/contribution-resolutions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/entities.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/events.md +22 -0
- package/dist/agentic/guides/modules/assisted_selling/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/assisted_selling/index.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/setup.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-contributions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-hosts.md +23 -0
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/workers.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/backups/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/backups/exact-override-targets.md +11 -0
- package/dist/agentic/guides/modules/backups/index.md +5 -2
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/acl-features.md +2 -1
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +2 -0
- package/dist/agentic/guides/modules/catalog/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +5 -0
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -4
- package/dist/agentic/guides/modules/catalog/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/catalog/entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/events.md +4 -1
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +13 -7
- package/dist/agentic/guides/modules/catalog/index.md +9 -9
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +5 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/catalog/workers.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/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/workers.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/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/currencies/di-service-tokens.md +1 -1
- package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +3 -2
- package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/customer_accounts/index.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/workers.md +2 -0
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -1
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
- package/dist/agentic/guides/modules/customers/index.md +3 -3
- package/dist/agentic/guides/modules/customers/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -1
- package/dist/agentic/guides/modules/dashboards/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/dashboards/index.md +2 -3
- 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/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.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/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +14 -12
- package/dist/agentic/guides/modules/integrations/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/integrations/workers.md +3 -1
- package/dist/agentic/guides/modules/ledger/acl-features.md +16 -0
- package/dist/agentic/guides/modules/ledger/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/ledger/backend-pages.md +21 -0
- package/dist/agentic/guides/modules/ledger/domain-commands.md +22 -0
- package/dist/agentic/guides/modules/ledger/encryption.md +11 -0
- package/dist/agentic/guides/modules/ledger/entities.md +17 -0
- package/dist/agentic/guides/modules/ledger/events.md +19 -0
- package/dist/agentic/guides/modules/ledger/exact-override-targets.md +30 -0
- package/dist/agentic/guides/modules/ledger/index.md +22 -0
- package/dist/agentic/guides/modules/ledger/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/ledger/setup.md +11 -0
- package/dist/agentic/guides/modules/ledger/umes-hosts.md +26 -0
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- 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/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/resources/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/resources/setup.md +1 -1
- package/dist/agentic/guides/modules/sales/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/sales/index.md +3 -3
- package/dist/agentic/guides/modules/sales/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/staff/workers.md +1 -1
- 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/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/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +811 -21
- package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/reference-modules/example/backend-pages.md +2 -0
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +3 -1
- 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/entities.md +2 -0
- package/dist/agentic/guides/reference-modules/example/events.md +2 -1
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +25 -8
- package/dist/agentic/guides/reference-modules/example/index.md +7 -7
- package/dist/agentic/guides/reference-modules/example/notifications.md +1 -0
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +3 -1
- package/dist/agentic/guides/reference-modules/example/umes-hosts.md +4 -0
- package/dist/agentic/guides/upstream/AGENTS.md +5 -4
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +37 -20
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +12 -16
- package/dist/agentic/shared/ai/harness/README.md +4 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +1420 -41
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +640 -142
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +223 -16
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +25 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +1 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +21 -1
- package/dist/lib/cache-provider-manifest.js +9 -0
- package/dist/lib/cache-provider-manifest.js.map +7 -0
- package/dist/lib/generate-watch-plan.js +4 -0
- package/dist/lib/generate-watch-plan.js.map +2 -2
- package/dist/lib/generate-watch-runner.js +1 -0
- package/dist/lib/generate-watch-runner.js.map +2 -2
- package/dist/lib/generate-watch-structure.js +2 -0
- package/dist/lib/generate-watch-structure.js.map +2 -2
- package/dist/lib/generators/ast/writers.js +5 -1
- package/dist/lib/generators/ast/writers.js.map +2 -2
- package/dist/lib/generators/cache-providers.js +80 -0
- package/dist/lib/generators/cache-providers.js.map +7 -0
- package/dist/lib/generators/form-section-ast.js +156 -0
- package/dist/lib/generators/form-section-ast.js.map +7 -0
- package/dist/lib/generators/form-section-extension-compiler.js +568 -0
- package/dist/lib/generators/form-section-extension-compiler.js.map +7 -0
- package/dist/lib/generators/form-section-extension-source.js +245 -0
- package/dist/lib/generators/form-section-extension-source.js.map +7 -0
- package/dist/lib/generators/form-section-runtime-revisions.js +184 -0
- package/dist/lib/generators/form-section-runtime-revisions.js.map +7 -0
- package/dist/lib/generators/form-sections.js +773 -0
- package/dist/lib/generators/form-sections.js.map +7 -0
- package/dist/lib/generators/index.js +2 -0
- package/dist/lib/generators/index.js.map +2 -2
- package/dist/lib/generators/module-entities.js +21 -2
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-extension-facts.js +2 -1
- package/dist/lib/generators/module-extension-facts.js.map +2 -2
- package/dist/lib/generators/module-facts.js +30 -1
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +24 -2
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-registry.js +75 -3
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +27 -17
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/post-generate-invalidation.js +20 -1
- package/dist/lib/post-generate-invalidation.js.map +2 -2
- package/dist/lib/resolver.js +195 -1
- package/dist/lib/resolver.js.map +3 -3
- package/dist/lib/scaffold/field-dsl.js +393 -0
- package/dist/lib/scaffold/field-dsl.js.map +7 -0
- package/dist/lib/scaffold/index.js +412 -0
- package/dist/lib/scaffold/index.js.map +7 -0
- package/dist/lib/scaffold/targets.js +42 -0
- package/dist/lib/scaffold/targets.js.map +7 -0
- package/dist/lib/scaffold/templates/create-page.js +52 -0
- package/dist/lib/scaffold/templates/create-page.js.map +7 -0
- package/dist/lib/scaffold/templates/detail-page.js +186 -0
- package/dist/lib/scaffold/templates/detail-page.js.map +7 -0
- package/dist/lib/scaffold/templates/form-config.js +42 -0
- package/dist/lib/scaffold/templates/form-config.js.map +7 -0
- package/dist/lib/scaffold/templates/index.js +27 -0
- package/dist/lib/scaffold/templates/index.js.map +7 -0
- package/dist/lib/scaffold/templates/list-page.js +190 -0
- package/dist/lib/scaffold/templates/list-page.js.map +7 -0
- package/dist/lib/scaffold/templates/metas.js +47 -0
- package/dist/lib/scaffold/templates/metas.js.map +7 -0
- package/dist/lib/scaffold/templates/module-files.js +85 -0
- package/dist/lib/scaffold/templates/module-files.js.map +7 -0
- package/dist/lib/single-instance-strategy-guard.js +26 -3
- package/dist/lib/single-instance-strategy-guard.js.map +2 -2
- package/dist/lib/testing/integration-discovery.js +32 -3
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +232 -8
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +40 -7
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +2 -0
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +18 -0
- package/src/__tests__/rotation-json-output.test.ts +52 -0
- package/src/lib/__tests__/agentic-workflows-ownership.test.ts +79 -0
- package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
- package/src/lib/__tests__/generate-watch-plan.test.ts +3 -2
- package/src/lib/__tests__/generate-watch-runner.test.ts +13 -1
- package/src/lib/__tests__/generate-watch-structure.test.ts +34 -0
- package/src/lib/__tests__/post-generate-invalidation.test.ts +108 -0
- package/src/lib/__tests__/resolver.form-section-gates.test.ts +82 -0
- package/src/lib/__tests__/single-instance-strategy-guard.test.ts +129 -0
- package/src/lib/cache-provider-manifest.ts +8 -0
- package/src/lib/generate-watch-plan.ts +6 -3
- package/src/lib/generate-watch-runner.ts +1 -0
- package/src/lib/generate-watch-structure.ts +5 -1
- package/src/lib/generators/__tests__/cache-providers.test.ts +102 -0
- package/src/lib/generators/__tests__/derived-crud-route-collisions.test.ts +85 -0
- package/src/lib/generators/__tests__/form-section-outbox.test.ts +53 -0
- package/src/lib/generators/__tests__/form-sections.test.ts +896 -0
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -6
- package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +37 -13
- package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +13 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +2 -3
- package/src/lib/generators/__tests__/module-subset.test.ts +1 -1
- package/src/lib/generators/__tests__/openapi.test.ts +60 -13
- package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
- package/src/lib/generators/ast/writers.ts +6 -1
- package/src/lib/generators/cache-providers.ts +111 -0
- package/src/lib/generators/form-section-ast.ts +166 -0
- package/src/lib/generators/form-section-extension-compiler.ts +632 -0
- package/src/lib/generators/form-section-extension-source.ts +308 -0
- package/src/lib/generators/form-section-runtime-revisions.ts +211 -0
- package/src/lib/generators/form-sections.ts +896 -0
- package/src/lib/generators/index.ts +1 -0
- package/src/lib/generators/module-entities.ts +22 -4
- package/src/lib/generators/module-extension-facts.ts +1 -0
- package/src/lib/generators/module-facts.ts +40 -0
- package/src/lib/generators/module-override-targets.ts +19 -0
- package/src/lib/generators/module-registry.ts +80 -4
- package/src/lib/generators/openapi.ts +31 -20
- package/src/lib/post-generate-invalidation.ts +28 -1
- package/src/lib/resolver.ts +218 -0
- package/src/lib/scaffold/__tests__/__snapshots__/scaffold-golden.test.ts.snap +1742 -0
- package/src/lib/scaffold/__tests__/helpers.ts +75 -0
- package/src/lib/scaffold/__tests__/scaffold-ds-contract.test.ts +248 -0
- package/src/lib/scaffold/__tests__/scaffold-golden.test.ts +267 -0
- package/src/lib/scaffold/__tests__/scaffold-runtime.test.tsx +193 -0
- package/src/lib/scaffold/field-dsl.ts +491 -0
- package/src/lib/scaffold/index.ts +531 -0
- package/src/lib/scaffold/targets.ts +68 -0
- package/src/lib/scaffold/templates/create-page.ts +52 -0
- package/src/lib/scaffold/templates/detail-page.ts +190 -0
- package/src/lib/scaffold/templates/form-config.ts +42 -0
- package/src/lib/scaffold/templates/index.ts +27 -0
- package/src/lib/scaffold/templates/list-page.ts +190 -0
- package/src/lib/scaffold/templates/metas.ts +48 -0
- package/src/lib/scaffold/templates/module-files.ts +87 -0
- package/src/lib/single-instance-strategy-guard.ts +51 -1
- package/src/lib/testing/__tests__/integration-app-only-playwright.test.ts +225 -0
- package/src/lib/testing/__tests__/integration-app-only.test.ts +320 -0
- package/src/lib/testing/__tests__/integration-discovery.test.ts +45 -1
- package/src/lib/testing/integration-discovery.ts +32 -2
- package/src/lib/testing/integration.ts +293 -11
- package/src/mercato.ts +39 -5
- package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { createServer } from "node:net";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
import { mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import os from "node:os";
|
|
5
6
|
import { createHash, randomBytes } from "node:crypto";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { createInterface } from "node:readline/promises";
|
|
@@ -12,10 +13,36 @@ import { isUnsafeJwtSecret } from "@open-mercato/shared/lib/auth/jwt";
|
|
|
12
13
|
import { resolveEnvironment } from "../resolver.js";
|
|
13
14
|
import { resolveInitSuperadminCredentials } from "../init-secrets.js";
|
|
14
15
|
import { resolveSpawnCommand } from "../spawn.js";
|
|
15
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
APP_ONLY_INTEGRATION_ENV_VAR,
|
|
18
|
+
SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR,
|
|
19
|
+
DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR,
|
|
20
|
+
discoverIntegrationSpecFiles as discoverIntegrationSpecFilesShared,
|
|
21
|
+
isAppOwnedIntegrationSpecPath
|
|
22
|
+
} from "./integration-discovery.js";
|
|
16
23
|
import { resolveDockerHostFromContext, runCommandAndCapture } from "./runtime-utils.js";
|
|
17
24
|
const TEST_EMAIL_CAPTURE_ACCESS_TOKEN = process.env.OM_TEST_EMAIL_CAPTURE_ACCESS_TOKEN ?? randomBytes(32).toString("hex");
|
|
18
25
|
const TEST_EMAIL_CAPTURE_CORRELATION_TOKEN = process.env.OM_TEST_EMAIL_CAPTURE_CORRELATION_TOKEN ?? randomBytes(32).toString("hex");
|
|
26
|
+
const NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE = "No app-owned integration specs found";
|
|
27
|
+
const UNREPORTED_APP_OWNED_INTEGRATION_SPECS_MESSAGE = "the Playwright config does not report its spec files through discoverIntegrationSpecFiles, so app-owned specs are resolved after the environment starts";
|
|
28
|
+
const NO_RUNNABLE_APP_OWNED_INTEGRATION_SPECS_MESSAGE = "No app-owned integration specs are runnable in the ephemeral environment: every one is skipped by its requiredModules/requiredEnvVars metadata";
|
|
29
|
+
const INTEGRATION_TEST_USAGE = [
|
|
30
|
+
"Usage: mercato test:integration [filter] [options]",
|
|
31
|
+
"",
|
|
32
|
+
"Boots an ephemeral environment (Postgres, built app) and runs the Playwright integration suite.",
|
|
33
|
+
"",
|
|
34
|
+
"Options:",
|
|
35
|
+
" --filter <pattern> Run only specs matching the pattern (also accepted as a bare first argument)",
|
|
36
|
+
" --app-only Run only app-owned specs (outside node_modules/). Exits 0 without starting",
|
|
37
|
+
" anything when the app has none",
|
|
38
|
+
" --keep Leave the app and database running after the suite finishes",
|
|
39
|
+
" --screenshots Capture screenshots for every test (default outside CI)",
|
|
40
|
+
" --no-screenshots Capture screenshots only on failure (default in CI)",
|
|
41
|
+
" --verbose Stream build and server output",
|
|
42
|
+
" --force-rebuild Rebuild the app even when cached build artifacts are fresh",
|
|
43
|
+
" --no-reuse-env Always boot a fresh ephemeral environment",
|
|
44
|
+
" -h, --help Show this help"
|
|
45
|
+
].join("\n");
|
|
19
46
|
function shouldUseIsolatedPortForFreshEnvironment(options) {
|
|
20
47
|
return options.reuseExisting === false || options.existingStateBeforeReuseAttempt !== null;
|
|
21
48
|
}
|
|
@@ -1824,12 +1851,22 @@ function parseOptions(rawArgs) {
|
|
|
1824
1851
|
let verbose = false;
|
|
1825
1852
|
let forceRebuild = false;
|
|
1826
1853
|
let reuseExisting = true;
|
|
1854
|
+
let appOnly = false;
|
|
1855
|
+
let help = false;
|
|
1827
1856
|
for (let index = 0; index < rawArgs.length; index += 1) {
|
|
1828
1857
|
const argument = rawArgs[index];
|
|
1829
1858
|
if (argument === "--keep") {
|
|
1830
1859
|
keep = true;
|
|
1831
1860
|
continue;
|
|
1832
1861
|
}
|
|
1862
|
+
if (argument === "--app-only") {
|
|
1863
|
+
appOnly = true;
|
|
1864
|
+
continue;
|
|
1865
|
+
}
|
|
1866
|
+
if (argument === "--help" || argument === "-h") {
|
|
1867
|
+
help = true;
|
|
1868
|
+
continue;
|
|
1869
|
+
}
|
|
1833
1870
|
if (argument === "--screenshots") {
|
|
1834
1871
|
captureScreenshots = true;
|
|
1835
1872
|
continue;
|
|
@@ -1882,9 +1919,34 @@ function parseOptions(rawArgs) {
|
|
|
1882
1919
|
captureScreenshots: captureScreenshots ?? defaultCaptureScreenshots,
|
|
1883
1920
|
verbose,
|
|
1884
1921
|
forceRebuild,
|
|
1885
|
-
reuseExisting
|
|
1922
|
+
reuseExisting,
|
|
1923
|
+
appOnly,
|
|
1924
|
+
help
|
|
1886
1925
|
};
|
|
1887
1926
|
}
|
|
1927
|
+
function matchesPlaywrightFileFilter(relativePath, filter) {
|
|
1928
|
+
let pattern;
|
|
1929
|
+
try {
|
|
1930
|
+
pattern = new RegExp(filter, "i");
|
|
1931
|
+
} catch {
|
|
1932
|
+
return relativePath.toLowerCase().includes(filter.toLowerCase());
|
|
1933
|
+
}
|
|
1934
|
+
return pattern.test(relativePath);
|
|
1935
|
+
}
|
|
1936
|
+
function resolveAppOwnedIntegrationSpecPaths(discoveredSpecs, filter) {
|
|
1937
|
+
const appOwned = discoveredSpecs.map((entry) => entry.path).filter((specPath) => isAppOwnedIntegrationSpecPath(specPath));
|
|
1938
|
+
if (!filter) {
|
|
1939
|
+
return appOwned;
|
|
1940
|
+
}
|
|
1941
|
+
const matching = appOwned.filter((specPath) => matchesPlaywrightFileFilter(specPath, filter));
|
|
1942
|
+
if (appOwned.length > 0 && matching.length === 0) {
|
|
1943
|
+
throw new Error(`No app-owned integration specs match filter "${filter}"`);
|
|
1944
|
+
}
|
|
1945
|
+
return matching;
|
|
1946
|
+
}
|
|
1947
|
+
function buildAppOnlyPlaywrightFileFilters(specPaths) {
|
|
1948
|
+
return specPaths.map((specPath) => `/${specPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
|
|
1949
|
+
}
|
|
1888
1950
|
function parseEphemeralAppOptions(rawArgs) {
|
|
1889
1951
|
let verbose = false;
|
|
1890
1952
|
let captureScreenshots = null;
|
|
@@ -2170,6 +2232,122 @@ function normalizePath(filePath) {
|
|
|
2170
2232
|
async function discoverIntegrationSpecFiles() {
|
|
2171
2233
|
return discoverIntegrationSpecFilesShared(projectRootDirectory, LEGACY_INTEGRATION_TEST_ROOT);
|
|
2172
2234
|
}
|
|
2235
|
+
function isRecord(value) {
|
|
2236
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2237
|
+
}
|
|
2238
|
+
function parsePlaywrightListedSpecPaths(report, projectRoot) {
|
|
2239
|
+
if (!isRecord(report) || !Array.isArray(report.suites)) {
|
|
2240
|
+
throw new Error("[internal] Playwright --list report has no suites");
|
|
2241
|
+
}
|
|
2242
|
+
const rootDir = isRecord(report.config) && typeof report.config.rootDir === "string" ? report.config.rootDir : projectRoot;
|
|
2243
|
+
const listed = /* @__PURE__ */ new Set();
|
|
2244
|
+
for (const suite of report.suites) {
|
|
2245
|
+
if (!isRecord(suite) || typeof suite.file !== "string" || suite.file.length === 0) continue;
|
|
2246
|
+
listed.add(normalizePath(path.relative(projectRoot, path.resolve(rootDir, suite.file))));
|
|
2247
|
+
}
|
|
2248
|
+
return Array.from(listed).sort((left, right) => left.localeCompare(right));
|
|
2249
|
+
}
|
|
2250
|
+
function runQuietNpxCommand(args, environment, cwd) {
|
|
2251
|
+
const binary = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
2252
|
+
return new Promise((resolve, reject) => {
|
|
2253
|
+
const resolvedSpawn = resolveSpawnCommand(binary, args);
|
|
2254
|
+
const command = spawn(resolvedSpawn.command, resolvedSpawn.args, {
|
|
2255
|
+
cwd,
|
|
2256
|
+
env: environment,
|
|
2257
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
2258
|
+
...resolvedSpawn.spawnOptions
|
|
2259
|
+
});
|
|
2260
|
+
let stderr = "";
|
|
2261
|
+
command.stderr?.on("data", (chunk) => {
|
|
2262
|
+
stderr += chunk.toString();
|
|
2263
|
+
});
|
|
2264
|
+
command.on("error", reject);
|
|
2265
|
+
command.on("exit", (code) => {
|
|
2266
|
+
if (code === 0) {
|
|
2267
|
+
resolve();
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
reject(new Error(`Command failed: npx ${args.join(" ")} (exit ${code ?? "unknown"})
|
|
2271
|
+
${stderr.trim()}`));
|
|
2272
|
+
});
|
|
2273
|
+
});
|
|
2274
|
+
}
|
|
2275
|
+
function parseDiscoverySelectionReport(report, projectRoot) {
|
|
2276
|
+
if (!isRecord(report) || !Array.isArray(report.paths)) {
|
|
2277
|
+
throw new Error("[internal] Integration discovery selection report has no paths");
|
|
2278
|
+
}
|
|
2279
|
+
const reportRoot = typeof report.projectRoot === "string" ? report.projectRoot : projectRoot;
|
|
2280
|
+
const selected = /* @__PURE__ */ new Set();
|
|
2281
|
+
for (const entry of report.paths) {
|
|
2282
|
+
if (typeof entry !== "string" || entry.length === 0) continue;
|
|
2283
|
+
selected.add(normalizePath(path.relative(projectRoot, path.resolve(reportRoot, entry))));
|
|
2284
|
+
}
|
|
2285
|
+
return Array.from(selected).sort((left, right) => left.localeCompare(right));
|
|
2286
|
+
}
|
|
2287
|
+
const DEFAULT_PLAYWRIGHT_LIST_TARGET = {
|
|
2288
|
+
projectRoot: projectRootDirectory,
|
|
2289
|
+
configPath: PLAYWRIGHT_INTEGRATION_CONFIG_PATH
|
|
2290
|
+
};
|
|
2291
|
+
const PLAYWRIGHT_NO_SPEC_FILE_FILTER = "/__om_app_only_preflight_no_spec__$";
|
|
2292
|
+
async function runPlaywrightList(environment, fileFilters, target, readResult) {
|
|
2293
|
+
const outputDirectory = await mkdtemp(path.join(os.tmpdir(), "om-integration-list-"));
|
|
2294
|
+
const files = {
|
|
2295
|
+
listFile: path.join(outputDirectory, "list.json"),
|
|
2296
|
+
selectionFile: path.join(outputDirectory, "selection.json")
|
|
2297
|
+
};
|
|
2298
|
+
try {
|
|
2299
|
+
await runQuietNpxCommand(
|
|
2300
|
+
["playwright", "test", "--config", target.configPath, "--list", "--reporter=json", "--pass-with-no-tests", ...fileFilters],
|
|
2301
|
+
{
|
|
2302
|
+
...environment,
|
|
2303
|
+
PLAYWRIGHT_JSON_OUTPUT_FILE: files.listFile,
|
|
2304
|
+
[DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR]: files.selectionFile
|
|
2305
|
+
},
|
|
2306
|
+
target.projectRoot
|
|
2307
|
+
);
|
|
2308
|
+
return await readResult(files);
|
|
2309
|
+
} finally {
|
|
2310
|
+
await rm(outputDirectory, { recursive: true, force: true }).catch(() => void 0);
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
function listPlaywrightSelectedSpecPaths(environment, fileFilters = [], target = DEFAULT_PLAYWRIGHT_LIST_TARGET) {
|
|
2314
|
+
return runPlaywrightList(
|
|
2315
|
+
environment,
|
|
2316
|
+
fileFilters,
|
|
2317
|
+
target,
|
|
2318
|
+
async ({ listFile }) => parsePlaywrightListedSpecPaths(JSON.parse(await readFile(listFile, "utf8")), target.projectRoot)
|
|
2319
|
+
);
|
|
2320
|
+
}
|
|
2321
|
+
function listPlaywrightConfigSelectedSpecPaths(environment, target = DEFAULT_PLAYWRIGHT_LIST_TARGET) {
|
|
2322
|
+
return runPlaywrightList(
|
|
2323
|
+
environment,
|
|
2324
|
+
[PLAYWRIGHT_NO_SPEC_FILE_FILTER],
|
|
2325
|
+
target,
|
|
2326
|
+
async ({ selectionFile }) => existsSync(selectionFile) ? parseDiscoverySelectionReport(JSON.parse(await readFile(selectionFile, "utf8")), target.projectRoot) : null
|
|
2327
|
+
);
|
|
2328
|
+
}
|
|
2329
|
+
function buildAppOnlyEnvironment(environment) {
|
|
2330
|
+
return { ...environment, [APP_ONLY_INTEGRATION_ENV_VAR]: "1" };
|
|
2331
|
+
}
|
|
2332
|
+
async function listAppOwnedIntegrationSpecCandidates(listConfigSelection = listPlaywrightConfigSelectedSpecPaths) {
|
|
2333
|
+
const environment = { ...buildAppOnlyEnvironment(process.env), [SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR]: "1" };
|
|
2334
|
+
const selected = await listConfigSelection(environment);
|
|
2335
|
+
return selected ? selected.map((specPath) => ({ path: specPath })) : null;
|
|
2336
|
+
}
|
|
2337
|
+
async function resolveAppOnlySuiteRun(appOnlySpecPaths, environment, listSpecs = listPlaywrightSelectedSpecPaths, filter = null) {
|
|
2338
|
+
const commandEnvironment = buildAppOnlyEnvironment(environment.commandEnvironment);
|
|
2339
|
+
const fileFilters = appOnlySpecPaths ? buildAppOnlyPlaywrightFileFilters(appOnlySpecPaths) : filter ? [filter] : [];
|
|
2340
|
+
const listed = await listSpecs(commandEnvironment, fileFilters);
|
|
2341
|
+
const runnable = new Set(listed);
|
|
2342
|
+
const selected = appOnlySpecPaths ? appOnlySpecPaths.filter((specPath) => runnable.has(specPath)) : resolveAppOwnedIntegrationSpecPaths(listed.map((specPath) => ({ path: specPath })), null);
|
|
2343
|
+
if (selected.length === 0) {
|
|
2344
|
+
if (!appOnlySpecPaths && filter) {
|
|
2345
|
+
throw new Error(`No app-owned integration specs match filter "${filter}"`);
|
|
2346
|
+
}
|
|
2347
|
+
return null;
|
|
2348
|
+
}
|
|
2349
|
+
return { fileFilters: buildAppOnlyPlaywrightFileFilters(selected), commandEnvironment };
|
|
2350
|
+
}
|
|
2173
2351
|
async function extractSpecDescription(relativePath) {
|
|
2174
2352
|
const absolutePath = path.join(projectRootDirectory, relativePath);
|
|
2175
2353
|
try {
|
|
@@ -2646,10 +2824,24 @@ async function runPlaywrightSelection(environment, selection, options) {
|
|
|
2646
2824
|
}
|
|
2647
2825
|
async function runIntegrationTestSuiteOnce(environment, options) {
|
|
2648
2826
|
const testArgs = ["test:integration"];
|
|
2649
|
-
|
|
2827
|
+
let commandEnvironment = environment.commandEnvironment;
|
|
2828
|
+
if (options.appOnly) {
|
|
2829
|
+
const appOnlyRun = await resolveAppOnlySuiteRun(
|
|
2830
|
+
options.appOnlySpecPaths,
|
|
2831
|
+
environment,
|
|
2832
|
+
listPlaywrightSelectedSpecPaths,
|
|
2833
|
+
options.filter
|
|
2834
|
+
);
|
|
2835
|
+
if (!appOnlyRun) {
|
|
2836
|
+
console.log(`[integration] ${NO_RUNNABLE_APP_OWNED_INTEGRATION_SPECS_MESSAGE}.`);
|
|
2837
|
+
return;
|
|
2838
|
+
}
|
|
2839
|
+
testArgs.push(...appOnlyRun.fileFilters);
|
|
2840
|
+
commandEnvironment = appOnlyRun.commandEnvironment;
|
|
2841
|
+
} else if (options.filter) {
|
|
2650
2842
|
testArgs.push(options.filter);
|
|
2651
2843
|
}
|
|
2652
|
-
await runYarnCommandWithOutputMonitoring(testArgs,
|
|
2844
|
+
await runYarnCommandWithOutputMonitoring(testArgs, commandEnvironment, {
|
|
2653
2845
|
detectEnvironmentUnavailable: true,
|
|
2654
2846
|
abortOnEnvironmentUnavailable: true,
|
|
2655
2847
|
playwrightFailureHealthCheck: {
|
|
@@ -3095,8 +3287,28 @@ async function keepEnvironmentRunningForever() {
|
|
|
3095
3287
|
await new Promise(() => {
|
|
3096
3288
|
});
|
|
3097
3289
|
}
|
|
3098
|
-
async function runIntegrationTestsInEphemeralEnvironment(rawArgs) {
|
|
3290
|
+
async function runIntegrationTestsInEphemeralEnvironment(rawArgs, dependencies = {}) {
|
|
3099
3291
|
const options = parseOptions(rawArgs);
|
|
3292
|
+
if (options.help) {
|
|
3293
|
+
console.log(INTEGRATION_TEST_USAGE);
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
let appOnlySpecPaths = null;
|
|
3297
|
+
if (options.appOnly) {
|
|
3298
|
+
const discoverSpecs = dependencies.discoverSpecs ?? (() => listAppOwnedIntegrationSpecCandidates());
|
|
3299
|
+
const candidates = await discoverSpecs();
|
|
3300
|
+
if (candidates) {
|
|
3301
|
+
appOnlySpecPaths = resolveAppOwnedIntegrationSpecPaths(candidates, options.filter);
|
|
3302
|
+
if (appOnlySpecPaths.length === 0) {
|
|
3303
|
+
console.log(NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE);
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3306
|
+
console.log(`[integration] --app-only enabled: running ${appOnlySpecPaths.length} app-owned spec file(s).`);
|
|
3307
|
+
} else {
|
|
3308
|
+
console.log(`[integration] --app-only enabled: ${UNREPORTED_APP_OWNED_INTEGRATION_SPECS_MESSAGE}.`);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
const runSuiteWithRecovery = dependencies.runSuiteWithRecovery ?? runIntegrationTestSuiteWithRecovery;
|
|
3100
3312
|
const startOptions = {
|
|
3101
3313
|
verbose: options.verbose,
|
|
3102
3314
|
captureScreenshots: options.captureScreenshots,
|
|
@@ -3112,9 +3324,9 @@ async function runIntegrationTestsInEphemeralEnvironment(rawArgs) {
|
|
|
3112
3324
|
} else {
|
|
3113
3325
|
console.log("[integration] --no-reuse-env enabled: always booting a fresh ephemeral environment.");
|
|
3114
3326
|
}
|
|
3115
|
-
const environmentState = await
|
|
3327
|
+
const environmentState = await runSuiteWithRecovery(
|
|
3116
3328
|
startOptions,
|
|
3117
|
-
options,
|
|
3329
|
+
{ ...options, appOnlySpecPaths },
|
|
3118
3330
|
async (runtimeEnvironment) => {
|
|
3119
3331
|
console.log("[integration] Ensuring Playwright Chromium is installed...");
|
|
3120
3332
|
await runNpxCommand(["playwright", "install", "chromium"], runtimeEnvironment.commandEnvironment);
|
|
@@ -3310,18 +3522,30 @@ async function runInteractiveIntegrationInEphemeralEnvironment(rawArgs) {
|
|
|
3310
3522
|
}
|
|
3311
3523
|
export {
|
|
3312
3524
|
CAPTURED_OUTPUT_MAX_LENGTH,
|
|
3525
|
+
INTEGRATION_TEST_USAGE,
|
|
3526
|
+
NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE,
|
|
3527
|
+
NO_RUNNABLE_APP_OWNED_INTEGRATION_SPECS_MESSAGE,
|
|
3528
|
+
UNREPORTED_APP_OWNED_INTEGRATION_SPECS_MESSAGE,
|
|
3313
3529
|
acquireEphemeralRuntimeLock,
|
|
3530
|
+
buildAppOnlyPlaywrightFileFilters,
|
|
3314
3531
|
clearEphemeralEnvironmentState,
|
|
3315
3532
|
createBoundedOutputBuffer,
|
|
3316
3533
|
ephemeralPostgresInitSql,
|
|
3317
3534
|
formatCapturedOutput,
|
|
3318
3535
|
killProcessTree,
|
|
3536
|
+
listAppOwnedIntegrationSpecCandidates,
|
|
3537
|
+
listPlaywrightConfigSelectedSpecPaths,
|
|
3538
|
+
listPlaywrightSelectedSpecPaths,
|
|
3539
|
+
parseDiscoverySelectionReport,
|
|
3319
3540
|
parseEphemeralAppOptions,
|
|
3320
3541
|
parseIntegrationCoverageOptions,
|
|
3321
3542
|
parseInteractiveIntegrationOptions,
|
|
3322
3543
|
parseOptions,
|
|
3544
|
+
parsePlaywrightListedSpecPaths,
|
|
3323
3545
|
readEphemeralEnvironmentState,
|
|
3324
3546
|
registerEphemeralShutdownHandlers,
|
|
3547
|
+
resolveAppOnlySuiteRun,
|
|
3548
|
+
resolveAppOwnedIntegrationSpecPaths,
|
|
3325
3549
|
resolveAppReadyTimeoutMs,
|
|
3326
3550
|
resolveBuildCacheTtlSeconds,
|
|
3327
3551
|
resolveEphemeralJwtSecret,
|