@open-mercato/cli 0.6.7 → 0.6.8-canary.320.1.bf889f49e4
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 +77 -4
- package/AGENTS.md +6 -1
- package/build.mjs +68 -11
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +32 -88
- package/dist/agentic/codex/enforcement-rules.md +2 -16
- package/dist/agentic/cursor/hooks/entity-migration-check.mjs +19 -50
- package/dist/agentic/cursor/rules/entity-guard.mdc +9 -21
- package/dist/agentic/cursor/rules/generated-guard.mdc +3 -5
- package/dist/agentic/cursor/rules/open-mercato.mdc +3 -29
- package/dist/agentic/guides/ai-workflows.md +76 -0
- package/dist/agentic/guides/architecture.md +107 -0
- package/dist/agentic/guides/backend-ui.md +86 -0
- package/dist/agentic/guides/contracts.md +92 -0
- package/dist/agentic/guides/extensions.md +121 -0
- package/dist/agentic/guides/framework-extension-points.md +36 -0
- package/dist/agentic/guides/integrations.md +81 -0
- package/dist/agentic/guides/module-facts.json +116757 -3951
- package/dist/agentic/guides/module-system.md +12 -127
- package/dist/agentic/guides/modules/ai_assistant.md +227 -28
- package/dist/agentic/guides/modules/api_docs.md +58 -2
- package/dist/agentic/guides/modules/api_keys.md +92 -7
- package/dist/agentic/guides/modules/attachments.md +119 -14
- package/dist/agentic/guides/modules/audit_logs.md +131 -10
- package/dist/agentic/guides/modules/auth.md +276 -33
- package/dist/agentic/guides/modules/business_rules.md +149 -14
- package/dist/agentic/guides/modules/catalog.md +482 -43
- package/dist/agentic/guides/modules/channel_gmail.md +82 -3
- package/dist/agentic/guides/modules/channel_imap.md +82 -3
- package/dist/agentic/guides/modules/checkout.md +305 -27
- package/dist/agentic/guides/modules/communication_channels.md +315 -33
- package/dist/agentic/guides/modules/configs.md +104 -8
- package/dist/agentic/guides/modules/content.md +57 -2
- package/dist/agentic/guides/modules/currencies.md +152 -17
- package/dist/agentic/guides/modules/customer_accounts.md +387 -45
- package/dist/agentic/guides/modules/customers.md +746 -85
- package/dist/agentic/guides/modules/dashboards.md +155 -10
- package/dist/agentic/guides/modules/data_sync.md +149 -16
- package/dist/agentic/guides/modules/design_system.md +102 -0
- package/dist/agentic/guides/modules/dictionaries.md +107 -12
- package/dist/agentic/guides/modules/directory.md +148 -15
- package/dist/agentic/guides/modules/entities.md +145 -13
- package/dist/agentic/guides/modules/events.md +59 -2
- package/dist/agentic/guides/modules/feature_toggles.md +119 -9
- package/dist/agentic/guides/modules/gateway_stripe.md +92 -4
- package/dist/agentic/guides/modules/generators.md +45 -2
- package/dist/agentic/guides/modules/inbox_ops.md +207 -27
- package/dist/agentic/guides/modules/integrations.md +149 -16
- package/dist/agentic/guides/modules/messages.md +223 -24
- package/dist/agentic/guides/modules/notifications.md +96 -8
- package/dist/agentic/guides/modules/onboarding.md +77 -6
- package/dist/agentic/guides/modules/payment_gateways.md +168 -21
- package/dist/agentic/guides/modules/perspectives.md +77 -7
- package/dist/agentic/guides/modules/planner.md +136 -18
- package/dist/agentic/guides/modules/portal.md +93 -2
- package/dist/agentic/guides/modules/progress.md +104 -14
- package/dist/agentic/guides/modules/query_index.md +154 -15
- package/dist/agentic/guides/modules/record_locks.md +206 -21
- package/dist/agentic/guides/modules/resources.md +197 -30
- package/dist/agentic/guides/modules/sales.md +687 -84
- package/dist/agentic/guides/modules/scheduler.md +133 -14
- package/dist/agentic/guides/modules/search.md +170 -6
- package/dist/agentic/guides/modules/security.md +294 -35
- package/dist/agentic/guides/modules/shipping_carriers.md +134 -18
- package/dist/agentic/guides/modules/sso.md +151 -26
- package/dist/agentic/guides/modules/staff.md +372 -57
- package/dist/agentic/guides/modules/storage_s3.md +95 -5
- package/dist/agentic/guides/modules/sync_akeneo.md +85 -3
- package/dist/agentic/guides/modules/sync_excel.md +75 -6
- package/dist/agentic/guides/modules/system_status_overlays.md +60 -2
- package/dist/agentic/guides/modules/translations.md +104 -10
- package/dist/agentic/guides/modules/webhooks.md +203 -24
- package/dist/agentic/guides/modules/wms.md +469 -47
- package/dist/agentic/guides/modules/workflows.md +302 -43
- package/dist/agentic/guides/reference-module-facts.json +6942 -0
- package/dist/agentic/guides/reference-modules/example.md +462 -0
- package/dist/agentic/guides/spec-delivery.md +56 -0
- package/dist/agentic/guides/testing-debugging.md +80 -0
- package/dist/agentic/guides/upstream/AGENTS.md +300 -0
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +334 -0
- package/dist/agentic/guides/upstream/manifest.json +8 -0
- package/dist/agentic/shared/AGENTS.md.template +120 -311
- package/dist/agentic/shared/ai/agentic.config.json +2 -0
- package/dist/agentic/shared/ai/harness/README.md +50 -0
- package/dist/agentic/shared/ai/harness/RELEASE.md +59 -0
- package/dist/agentic/shared/ai/harness/cases.json +20596 -0
- package/dist/agentic/shared/ai/harness/cases.schema.json +196 -0
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +6326 -0
- package/dist/agentic/shared/ai/harness/fixtures/index.json +51 -0
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +166 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +21 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +96 -0
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +172 -0
- package/dist/agentic/shared/ai/harness/knowledge-change.schema.json +228 -0
- package/dist/agentic/shared/ai/harness/release-matrix.json +163 -0
- package/dist/agentic/shared/ai/harness/release-result.schema.json +219 -0
- package/dist/agentic/shared/ai/harness/result.schema.json +136 -0
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +22 -0
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +1706 -0
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +73 -0
- package/dist/agentic/shared/ai/harness/validators.json +82 -0
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +2121 -0
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +1096 -0
- package/dist/agentic/shared/ai/harness/writable-spec-oracles.mjs +602 -0
- package/dist/agentic/shared/ai/lessons/_template.md +16 -0
- package/dist/agentic/shared/ai/lessons.md +26 -3
- package/dist/agentic/shared/ai/review-checklist.md +36 -0
- package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +21 -0
- package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +4 -0
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +98 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +21 -241
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +31 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +53 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +15 -0
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +11 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +30 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +12 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +13 -0
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +14 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +28 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +12 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +22 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +12 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +19 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +17 -601
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +21 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +15 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +16 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +10 -0
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +15 -310
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +19 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +31 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +100 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +16 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/knowledge-change.md +133 -0
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +17 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +25 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +11 -0
- package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +13 -0
- package/dist/agentic/shared/ai/skills/om-help/SKILL.md +15 -97
- package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +18 -0
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +20 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +33 -152
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +33 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +40 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +27 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +24 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +25 -708
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +16 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +25 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +15 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +12 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +34 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +4 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +11 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +31 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +39 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +43 -0
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +11 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +20 -820
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +32 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +172 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +14 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +83 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +40 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +11 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +22 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +13 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +41 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +19 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +44 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +39 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +20 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +57 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +11 -0
- package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +486 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +20 -843
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +42 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +27 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +13 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +43 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +11 -0
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +15 -63
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +15 -0
- package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +17 -467
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +29 -0
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +14 -0
- package/dist/agentic/shared/ai/skills/tiers.json +143 -21
- package/dist/agentic/shared/ai/skills/tiers.schema.json +52 -40
- package/dist/agentic/shared/ai/specs/2026-08-06-reference-module-activation.md +248 -0
- package/dist/agentic/shared/ai/specs/README.md +4 -3
- package/dist/agentic/shared/ai/specs/SPEC-000-template.md +226 -10
- package/dist/agentic/shared/ai/trackers/github.md +108 -4
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +224 -0
- package/dist/agentic/shared/scripts/check-lessons.mjs +178 -0
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +3812 -0
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +329 -0
- package/dist/agentic/shared/scripts/framework-context.mjs +888 -0
- package/dist/agentic/shared/scripts/install-skills.mjs +1029 -0
- package/dist/agentic/shared/scripts/install-skills.sh +4 -694
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +222 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +1774 -0
- package/dist/agentic/shared/scripts/validate-knowledge-change.mjs +1172 -0
- package/dist/bin.js +32 -34
- package/dist/bin.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-008.spec.js +88 -8
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +13 -3
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +434 -186
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/cli-bootstrap-mode.js +32 -0
- package/dist/lib/cli-bootstrap-mode.js.map +7 -0
- package/dist/lib/dev-supervisor-manifest.js +105 -0
- package/dist/lib/dev-supervisor-manifest.js.map +7 -0
- package/dist/lib/generate-watch-events.js +15 -0
- package/dist/lib/generate-watch-events.js.map +2 -2
- package/dist/lib/generators/entity-ids.js +11 -24
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +20 -0
- package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
- package/dist/lib/generators/module-di.js +10 -23
- package/dist/lib/generators/module-di.js.map +2 -2
- package/dist/lib/generators/module-entities.js +10 -23
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-extension-facts.js +1882 -0
- package/dist/lib/generators/module-extension-facts.js.map +7 -0
- package/dist/lib/generators/module-fact-sources.js +70 -0
- package/dist/lib/generators/module-fact-sources.js.map +7 -0
- package/dist/lib/generators/module-facts-discovery.js +64 -7
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +1913 -52
- package/dist/lib/generators/module-facts.js.map +3 -3
- package/dist/lib/generators/module-override-targets.js +712 -0
- package/dist/lib/generators/module-override-targets.js.map +7 -0
- package/dist/lib/generators/module-registry.js +405 -36
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/route-manifest-shards.js +170 -0
- package/dist/lib/generators/route-manifest-shards.js.map +7 -0
- package/dist/lib/in-process-generate-watcher.js +12 -3
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/lib/load-env.js +24 -0
- package/dist/lib/load-env.js.map +7 -0
- package/dist/lib/queue-worker-supervisor.js.map +2 -2
- package/dist/lib/resolver.js +28 -3
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/telemetry-init.js +358 -0
- package/dist/lib/telemetry-init.js.map +7 -0
- package/dist/lib/testing/integration.js +5 -2
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/lib/utils.js +15 -8
- package/dist/lib/utils.js.map +2 -2
- package/dist/mercato.js +35 -9
- package/dist/mercato.js.map +2 -2
- package/package.json +13 -11
- package/src/__tests__/mercato.test.ts +144 -0
- package/src/bin.ts +60 -42
- package/src/lib/__integration__/TC-INT-008.spec.ts +107 -9
- package/src/lib/__tests__/agentic-init.test.ts +41 -5
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +386 -0
- package/src/lib/__tests__/cli-bootstrap-mode.test.ts +22 -0
- package/src/lib/__tests__/content-stable-writes.test.ts +74 -0
- package/src/lib/__tests__/dev-supervisor-manifest.test.ts +131 -0
- package/src/lib/__tests__/generate-watch-events.test.ts +76 -0
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +52 -1
- package/src/lib/__tests__/injection-widget-id-validation.test.ts +184 -0
- package/src/lib/__tests__/load-env.test.ts +65 -0
- package/src/lib/__tests__/queue-worker-supervisor.test.ts +33 -0
- package/src/lib/__tests__/resolver.enterprise.test.ts +50 -0
- package/src/lib/__tests__/telemetry-init.test.ts +298 -0
- package/src/lib/agentic-init.ts +15 -3
- package/src/lib/agentic-setup.ts +573 -222
- package/src/lib/cli-bootstrap-mode.ts +31 -0
- package/src/lib/dev-supervisor-manifest.ts +142 -0
- package/src/lib/generate-watch-events.ts +14 -0
- package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +92 -0
- package/src/lib/generators/__tests__/entity-ids.test.ts +32 -0
- package/src/lib/generators/__tests__/helpers/override-target-diagnostic-fixtures.ts +150 -0
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +762 -0
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +603 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +139 -2
- package/src/lib/generators/__tests__/module-facts.computed-di-token.test.ts +88 -0
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +54 -10
- package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +414 -0
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +108 -0
- package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +393 -0
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +561 -0
- package/src/lib/generators/__tests__/module-facts.search-entity-id.test.ts +151 -0
- package/src/lib/generators/__tests__/module-facts.source-links.test.ts +160 -0
- package/src/lib/generators/__tests__/module-override-targets.diagnostic-wiring.test.ts +92 -0
- package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +149 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +328 -0
- package/src/lib/generators/__tests__/module-override-targets.unknown-mode.test.ts +117 -0
- package/src/lib/generators/__tests__/module-subset.test.ts +266 -0
- package/src/lib/generators/__tests__/output-snapshots.test.ts +3 -3
- package/src/lib/generators/__tests__/route-manifest-shards.test.ts +62 -0
- package/src/lib/generators/entity-ids.ts +10 -26
- package/src/lib/generators/extensions/injection-widgets.ts +51 -0
- package/src/lib/generators/module-di.ts +9 -25
- package/src/lib/generators/module-entities.ts +9 -25
- package/src/lib/generators/module-extension-facts.ts +2472 -0
- package/src/lib/generators/module-fact-sources.ts +108 -0
- package/src/lib/generators/module-facts-discovery.ts +104 -7
- package/src/lib/generators/module-facts.ts +2747 -138
- package/src/lib/generators/module-override-targets.ts +907 -0
- package/src/lib/generators/module-registry.ts +448 -35
- package/src/lib/generators/route-manifest-shards.ts +146 -0
- package/src/lib/in-process-generate-watcher.ts +13 -4
- package/src/lib/load-env.ts +30 -0
- package/src/lib/queue-worker-supervisor.ts +7 -2
- package/src/lib/resolver.ts +34 -3
- package/src/lib/telemetry-init.ts +461 -0
- package/src/lib/testing/__tests__/integration.test.ts +4 -0
- package/src/lib/testing/integration.ts +5 -2
- package/src/lib/utils.ts +24 -16
- package/src/mercato.ts +46 -9
- package/dist/agentic/guides/cache.md +0 -45
- package/dist/agentic/guides/core.md +0 -453
- package/dist/agentic/guides/events.md +0 -117
- package/dist/agentic/guides/queue.md +0 -53
- package/dist/agentic/guides/search.md +0 -115
- package/dist/agentic/guides/shared.md +0 -108
- package/dist/agentic/guides/ui.md +0 -347
- package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +0 -27
- package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +0 -27
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +0 -260
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +0 -146
- package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +0 -84
- package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +0 -193
- package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +0 -34
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +0 -762
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +0 -50
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +0 -97
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +0 -271
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +0 -101
|
@@ -3,6 +3,10 @@ import path from "node:path";
|
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { VariableDeclarationKind } from "ts-morph";
|
|
5
5
|
import ts from "typescript-js";
|
|
6
|
+
import {
|
|
7
|
+
DEV_SUPERVISOR_MANIFEST_FILE,
|
|
8
|
+
DEV_SUPERVISOR_MANIFEST_VERSION
|
|
9
|
+
} from "../dev-supervisor-manifest.js";
|
|
6
10
|
import {
|
|
7
11
|
calculateStructureChecksum,
|
|
8
12
|
toVar,
|
|
@@ -58,6 +62,11 @@ import {
|
|
|
58
62
|
resolveStandaloneSourceMirrorBase
|
|
59
63
|
} from "./scanner.js";
|
|
60
64
|
import { loadGeneratorExtensions } from "./extensions/index.js";
|
|
65
|
+
import {
|
|
66
|
+
renderRouteManifestShardOutputs,
|
|
67
|
+
renderRouteMetadataOutput,
|
|
68
|
+
routeManifestShardFilePattern
|
|
69
|
+
} from "./route-manifest-shards.js";
|
|
61
70
|
function assertUniqueBackendRoutePattern(seen, moduleId, pattern) {
|
|
62
71
|
if (!pattern.startsWith("/backend/")) return;
|
|
63
72
|
const previous = seen.get(pattern);
|
|
@@ -1096,6 +1105,8 @@ function normalizeWorkerMetadata(raw) {
|
|
|
1096
1105
|
if (typeof source.id === "string" && source.id.length > 0) normalized.id = source.id;
|
|
1097
1106
|
if (typeof source.queue === "string" && source.queue.length > 0) normalized.queue = source.queue;
|
|
1098
1107
|
if (typeof source.concurrency === "number") normalized.concurrency = source.concurrency;
|
|
1108
|
+
if (typeof source.lockDuration === "number") normalized.lockDuration = source.lockDuration;
|
|
1109
|
+
if (typeof source.maxStalledCount === "number") normalized.maxStalledCount = source.maxStalledCount;
|
|
1099
1110
|
return Object.keys(normalized).length > 0 ? normalized : null;
|
|
1100
1111
|
}
|
|
1101
1112
|
async function loadSubscriberMetadata(sourceFile) {
|
|
@@ -1155,12 +1166,16 @@ function discoverTranslations(roots) {
|
|
|
1155
1166
|
const locales = /* @__PURE__ */ new Set();
|
|
1156
1167
|
if (fs.existsSync(i18nCore)) {
|
|
1157
1168
|
for (const entry of fs.readdirSync(i18nCore, { withFileTypes: true })) {
|
|
1158
|
-
if (entry.isFile() &&
|
|
1169
|
+
if (entry.isFile() && /^[a-zA-Z0-9][a-zA-Z0-9_-]*\.json$/.test(entry.name)) {
|
|
1170
|
+
locales.add(entry.name.replace(/\.json$/, ""));
|
|
1171
|
+
}
|
|
1159
1172
|
}
|
|
1160
1173
|
}
|
|
1161
1174
|
if (fs.existsSync(i18nApp)) {
|
|
1162
1175
|
for (const entry of fs.readdirSync(i18nApp, { withFileTypes: true })) {
|
|
1163
|
-
if (entry.isFile() &&
|
|
1176
|
+
if (entry.isFile() && /^[a-zA-Z0-9][a-zA-Z0-9_-]*\.json$/.test(entry.name)) {
|
|
1177
|
+
locales.add(entry.name.replace(/\.json$/, ""));
|
|
1178
|
+
}
|
|
1164
1179
|
}
|
|
1165
1180
|
}
|
|
1166
1181
|
return Array.from(locales, (locale) => ({
|
|
@@ -1240,6 +1255,8 @@ async function processPageFiles(options) {
|
|
|
1240
1255
|
const eagerRoutes = [];
|
|
1241
1256
|
const runtimeRoutes = [];
|
|
1242
1257
|
const manifestRoutes = [];
|
|
1258
|
+
const manifestShardRoutes = [];
|
|
1259
|
+
const metadataRoutes = [];
|
|
1243
1260
|
const routePatterns = [];
|
|
1244
1261
|
for (const { relPath, fromApp } of files.filter(({ relPath: f }) => isModulePageFile(path.basename(f)))) {
|
|
1245
1262
|
const segs = relPath.split("/");
|
|
@@ -1307,7 +1324,19 @@ async function processPageFiles(options) {
|
|
|
1307
1324
|
const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath);
|
|
1308
1325
|
eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1309
1326
|
runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1310
|
-
|
|
1327
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps} }`;
|
|
1328
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps}, load: async () => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod.default ?? mod) as any } }`;
|
|
1329
|
+
manifestRoutes.push(manifestDeclaration);
|
|
1330
|
+
manifestShardRoutes.push({
|
|
1331
|
+
path: routePath,
|
|
1332
|
+
declaration: manifestDeclaration,
|
|
1333
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1334
|
+
});
|
|
1335
|
+
metadataRoutes.push({
|
|
1336
|
+
path: routePath,
|
|
1337
|
+
declaration: metadataDeclaration,
|
|
1338
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1339
|
+
});
|
|
1311
1340
|
routePatterns.push(routePath);
|
|
1312
1341
|
}
|
|
1313
1342
|
for (const { relPath, fromApp } of files.filter(({ relPath: f }) => !isModulePageFile(path.basename(f)))) {
|
|
@@ -1380,13 +1409,27 @@ async function processPageFiles(options) {
|
|
|
1380
1409
|
const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath);
|
|
1381
1410
|
eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1382
1411
|
runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1383
|
-
|
|
1412
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps} }`;
|
|
1413
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps}, load: async () => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod.default ?? mod) as any } }`;
|
|
1414
|
+
manifestRoutes.push(manifestDeclaration);
|
|
1415
|
+
manifestShardRoutes.push({
|
|
1416
|
+
path: routePath,
|
|
1417
|
+
declaration: manifestDeclaration,
|
|
1418
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1419
|
+
});
|
|
1420
|
+
metadataRoutes.push({
|
|
1421
|
+
path: routePath,
|
|
1422
|
+
declaration: metadataDeclaration,
|
|
1423
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1424
|
+
});
|
|
1384
1425
|
routePatterns.push(routePath);
|
|
1385
1426
|
}
|
|
1386
1427
|
return {
|
|
1387
1428
|
eagerRoutes,
|
|
1388
1429
|
runtimeRoutes,
|
|
1389
1430
|
manifestRoutes,
|
|
1431
|
+
manifestShardRoutes,
|
|
1432
|
+
metadataRoutes,
|
|
1390
1433
|
routePatterns
|
|
1391
1434
|
};
|
|
1392
1435
|
}
|
|
@@ -1395,11 +1438,13 @@ async function processApiRoutes(options) {
|
|
|
1395
1438
|
const apiApp = path.join(roots.appBase, "api");
|
|
1396
1439
|
const apiPkg = path.join(roots.pkgBase, "api");
|
|
1397
1440
|
if (!fs.existsSync(apiApp) && !fs.existsSync(apiPkg)) {
|
|
1398
|
-
return { eagerApis: [], runtimeApis: [], manifestApis: [] };
|
|
1441
|
+
return { eagerApis: [], runtimeApis: [], manifestApis: [], manifestShardApis: [], metadataApis: [] };
|
|
1399
1442
|
}
|
|
1400
1443
|
const eagerApis = [];
|
|
1401
1444
|
const runtimeApis = [];
|
|
1402
1445
|
const manifestApis = [];
|
|
1446
|
+
const manifestShardApis = [];
|
|
1447
|
+
const metadataApis = [];
|
|
1403
1448
|
const routeFiles = scanModuleDir(roots, SCAN_CONFIGS.apiRoutes);
|
|
1404
1449
|
for (const { relPath, fromApp } of routeFiles) {
|
|
1405
1450
|
const segs = relPath.split("/");
|
|
@@ -1428,7 +1473,11 @@ async function processApiRoutes(options) {
|
|
|
1428
1473
|
eagerImports.push(buildImportStatement(`* as ${importName}`, importPath));
|
|
1429
1474
|
eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`);
|
|
1430
1475
|
runtimeApis.push(`{ path: ${toLiteral(resolvedPath)}, metadata: ${metadataLiteral}, handlers: { ${exportedMethods.map((method) => `${method}: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod as any).${method}(req, ctx) }`).join(", ")} } }`);
|
|
1431
|
-
|
|
1476
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((method) => toLiteral(method)).join(", ")}] }`;
|
|
1477
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((method) => toLiteral(method)).join(", ")}], load: async () => ${buildDynamicImportExpression(importPath)} }`;
|
|
1478
|
+
manifestApis.push(manifestDeclaration);
|
|
1479
|
+
manifestShardApis.push({ path: resolvedPath, declaration: manifestDeclaration });
|
|
1480
|
+
metadataApis.push({ path: resolvedPath, declaration: metadataDeclaration });
|
|
1432
1481
|
}
|
|
1433
1482
|
const plainFiles = scanModuleDir(roots, SCAN_CONFIGS.apiPlainFiles);
|
|
1434
1483
|
for (const { relPath, fromApp } of plainFiles) {
|
|
@@ -1458,7 +1507,11 @@ async function processApiRoutes(options) {
|
|
|
1458
1507
|
eagerImports.push(buildImportStatement(`* as ${importName}`, importPath));
|
|
1459
1508
|
eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`);
|
|
1460
1509
|
runtimeApis.push(`{ path: ${toLiteral(resolvedPath)}, metadata: ${metadataLiteral}, handlers: { ${exportedMethods.map((entryMethod) => `${entryMethod}: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod as any).${entryMethod}(req, ctx) }`).join(", ")} } }`);
|
|
1461
|
-
|
|
1510
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((entryMethod) => toLiteral(entryMethod)).join(", ")}] }`;
|
|
1511
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((entryMethod) => toLiteral(entryMethod)).join(", ")}], load: async () => ${buildDynamicImportExpression(importPath)} }`;
|
|
1512
|
+
manifestApis.push(manifestDeclaration);
|
|
1513
|
+
manifestShardApis.push({ path: resolvedPath, declaration: manifestDeclaration });
|
|
1514
|
+
metadataApis.push({ path: resolvedPath, declaration: metadataDeclaration });
|
|
1462
1515
|
}
|
|
1463
1516
|
const methods = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
1464
1517
|
for (const method of methods) {
|
|
@@ -1497,13 +1550,19 @@ async function processApiRoutes(options) {
|
|
|
1497
1550
|
eagerImports.push(buildImportStatement(`${importName}, * as ${metaName}`, importPath));
|
|
1498
1551
|
eagerApis.push(`{ method: ${toLiteral(method)}, path: (${metaName}.metadata?.path ?? ${toLiteral(routePath)}), handler: ${importName}, metadata: ${metaName}.metadata${docsPart} }`);
|
|
1499
1552
|
runtimeApis.push(`{ method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, handler: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; const handler = ((mod as any).default ?? (mod as any).${method} ?? (mod as any).handler) as any; return handler(req, ctx) }, metadata: ${metadataLiteral} }`);
|
|
1500
|
-
|
|
1553
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("legacy")}, method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, methods: [${toLiteral(method)}] }`;
|
|
1554
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("legacy")}, method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, methods: [${toLiteral(method)}], load: async () => ${buildDynamicImportExpression(importPath)} }`;
|
|
1555
|
+
manifestApis.push(manifestDeclaration);
|
|
1556
|
+
manifestShardApis.push({ path: resolvedPath, declaration: manifestDeclaration });
|
|
1557
|
+
metadataApis.push({ path: resolvedPath, declaration: metadataDeclaration });
|
|
1501
1558
|
}
|
|
1502
1559
|
}
|
|
1503
1560
|
return {
|
|
1504
1561
|
eagerApis,
|
|
1505
1562
|
runtimeApis,
|
|
1506
|
-
manifestApis
|
|
1563
|
+
manifestApis,
|
|
1564
|
+
manifestShardApis,
|
|
1565
|
+
metadataApis
|
|
1507
1566
|
};
|
|
1508
1567
|
}
|
|
1509
1568
|
function processSubscribers(discovered) {
|
|
@@ -1521,7 +1580,7 @@ function processWorkers(discovered) {
|
|
|
1521
1580
|
for (const { id, importPath, metadata } of discovered) {
|
|
1522
1581
|
const workerId = metadata.id ?? id;
|
|
1523
1582
|
workers.push(
|
|
1524
|
-
`{ id: ${toLiteral(workerId)}, queue: ${toLiteral(metadata.queue)}, concurrency: ${toLiteral(metadata.concurrency ?? 1)}, handler: createLazyModuleWorker(() => ${buildDynamicImportExpression(importPath)}, ${toLiteral(workerId)}) }`
|
|
1583
|
+
`{ id: ${toLiteral(workerId)}, queue: ${toLiteral(metadata.queue)}, concurrency: ${toLiteral(metadata.concurrency ?? 1)}${metadata.lockDuration === void 0 ? "" : `, lockDuration: ${toLiteral(metadata.lockDuration)}`}${metadata.maxStalledCount === void 0 ? "" : `, maxStalledCount: ${toLiteral(metadata.maxStalledCount)}`}, handler: createLazyModuleWorker(() => ${buildDynamicImportExpression(importPath)}, ${toLiteral(workerId)}) }`
|
|
1525
1584
|
);
|
|
1526
1585
|
}
|
|
1527
1586
|
return workers;
|
|
@@ -2083,6 +2142,8 @@ function processWorkersAst(discovered) {
|
|
|
2083
2142
|
{ name: "id", value: workerId },
|
|
2084
2143
|
{ name: "queue", value: metadata.queue },
|
|
2085
2144
|
{ name: "concurrency", value: metadata.concurrency ?? 1 },
|
|
2145
|
+
...metadata.lockDuration === void 0 ? [] : [{ name: "lockDuration", value: metadata.lockDuration }],
|
|
2146
|
+
...metadata.maxStalledCount === void 0 ? [] : [{ name: "maxStalledCount", value: metadata.maxStalledCount }],
|
|
2086
2147
|
{
|
|
2087
2148
|
name: "handler",
|
|
2088
2149
|
value: callExpression(identifier("createLazyModuleWorker"), [
|
|
@@ -2097,48 +2158,229 @@ function processWorkersAst(discovered) {
|
|
|
2097
2158
|
}
|
|
2098
2159
|
return workers;
|
|
2099
2160
|
}
|
|
2161
|
+
function collectWorkerGenerationEntries(discovered, moduleId) {
|
|
2162
|
+
const workers = [];
|
|
2163
|
+
for (const { id, importPath, metadata } of discovered) {
|
|
2164
|
+
if (!metadata.queue) continue;
|
|
2165
|
+
workers.push({
|
|
2166
|
+
id: metadata.id ?? id,
|
|
2167
|
+
moduleId,
|
|
2168
|
+
queue: metadata.queue,
|
|
2169
|
+
concurrency: metadata.concurrency ?? 1,
|
|
2170
|
+
importPath
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
return workers;
|
|
2174
|
+
}
|
|
2100
2175
|
function processTranslationsAst(options) {
|
|
2101
|
-
const { discovered, modId, appImportBase, pkgImportBase, imports, extraImports } = options;
|
|
2176
|
+
const { discovered, modId, appImportBase, pkgImportBase, imports, extraImports, localeOutputs } = options;
|
|
2102
2177
|
const translations = [];
|
|
2103
2178
|
for (const { locale, coreHas, appHas } of discovered) {
|
|
2104
2179
|
if (coreHas && appHas) {
|
|
2105
2180
|
const coreName = `T_${toVar(modId)}_${toVar(locale)}_C`;
|
|
2106
2181
|
const appName = `T_${toVar(modId)}_${toVar(locale)}_A`;
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2182
|
+
const localeImports = [
|
|
2183
|
+
buildImportStatement(coreName, `${pkgImportBase}/i18n/${locale}.json`),
|
|
2184
|
+
buildImportStatement(appName, `${appImportBase}/i18n/${locale}.json`)
|
|
2185
|
+
];
|
|
2186
|
+
imports.push(...localeImports);
|
|
2187
|
+
extraImports?.push(...localeImports);
|
|
2188
|
+
const value = objectLiteral([
|
|
2189
|
+
{ kind: "spread", value: asExpression(identifier(coreName), "unknown as Record<string, string>") },
|
|
2190
|
+
{ kind: "spread", value: asExpression(identifier(appName), "unknown as Record<string, string>") }
|
|
2191
|
+
]);
|
|
2111
2192
|
translations.push({
|
|
2112
2193
|
name: JSON.stringify(locale),
|
|
2113
|
-
value
|
|
2114
|
-
{ kind: "spread", value: asExpression(identifier(coreName), "unknown as Record<string, string>") },
|
|
2115
|
-
{ kind: "spread", value: asExpression(identifier(appName), "unknown as Record<string, string>") }
|
|
2116
|
-
])
|
|
2194
|
+
value
|
|
2117
2195
|
});
|
|
2196
|
+
localeOutputs?.set(locale, { imports: localeImports, value });
|
|
2118
2197
|
continue;
|
|
2119
2198
|
}
|
|
2120
2199
|
if (appHas) {
|
|
2121
2200
|
const appName = `T_${toVar(modId)}_${toVar(locale)}_A`;
|
|
2122
|
-
|
|
2123
|
-
|
|
2201
|
+
const localeImports = [buildImportStatement(appName, `${appImportBase}/i18n/${locale}.json`)];
|
|
2202
|
+
imports.push(...localeImports);
|
|
2203
|
+
extraImports?.push(...localeImports);
|
|
2204
|
+
const value = asExpression(identifier(appName), "unknown as Record<string, string>");
|
|
2124
2205
|
translations.push({
|
|
2125
2206
|
name: JSON.stringify(locale),
|
|
2126
|
-
value
|
|
2207
|
+
value
|
|
2127
2208
|
});
|
|
2209
|
+
localeOutputs?.set(locale, { imports: localeImports, value });
|
|
2128
2210
|
continue;
|
|
2129
2211
|
}
|
|
2130
2212
|
if (coreHas) {
|
|
2131
2213
|
const coreName = `T_${toVar(modId)}_${toVar(locale)}_C`;
|
|
2132
|
-
|
|
2133
|
-
|
|
2214
|
+
const localeImports = [buildImportStatement(coreName, `${pkgImportBase}/i18n/${locale}.json`)];
|
|
2215
|
+
imports.push(...localeImports);
|
|
2216
|
+
extraImports?.push(...localeImports);
|
|
2217
|
+
const value = asExpression(identifier(coreName), "unknown as Record<string, string>");
|
|
2134
2218
|
translations.push({
|
|
2135
2219
|
name: JSON.stringify(locale),
|
|
2136
|
-
value
|
|
2220
|
+
value
|
|
2137
2221
|
});
|
|
2222
|
+
localeOutputs?.set(locale, { imports: localeImports, value });
|
|
2138
2223
|
}
|
|
2139
2224
|
}
|
|
2140
2225
|
return translations;
|
|
2141
2226
|
}
|
|
2227
|
+
function sourceDeclaresCliCommand(filePath, commandName) {
|
|
2228
|
+
let sourceText;
|
|
2229
|
+
try {
|
|
2230
|
+
sourceText = fs.readFileSync(filePath, "utf8");
|
|
2231
|
+
} catch {
|
|
2232
|
+
return false;
|
|
2233
|
+
}
|
|
2234
|
+
const sourceFile = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true);
|
|
2235
|
+
const declarations = /* @__PURE__ */ new Map();
|
|
2236
|
+
for (const statement of sourceFile.statements) {
|
|
2237
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
2238
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
2239
|
+
if (ts.isIdentifier(declaration.name) && declaration.initializer) {
|
|
2240
|
+
declarations.set(declaration.name.text, declaration.initializer);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
const expressionDeclaresCommand = (expression, seen = /* @__PURE__ */ new Set()) => {
|
|
2245
|
+
if (ts.isParenthesizedExpression(expression) || ts.isAsExpression(expression) || ts.isSatisfiesExpression(expression)) {
|
|
2246
|
+
return expressionDeclaresCommand(expression.expression, seen);
|
|
2247
|
+
}
|
|
2248
|
+
if (ts.isIdentifier(expression)) {
|
|
2249
|
+
if (seen.has(expression.text)) return false;
|
|
2250
|
+
const initializer = declarations.get(expression.text);
|
|
2251
|
+
if (!initializer) return false;
|
|
2252
|
+
const nextSeen = new Set(seen);
|
|
2253
|
+
nextSeen.add(expression.text);
|
|
2254
|
+
return expressionDeclaresCommand(initializer, nextSeen);
|
|
2255
|
+
}
|
|
2256
|
+
if (ts.isArrayLiteralExpression(expression)) {
|
|
2257
|
+
return expression.elements.some((element) => ts.isSpreadElement(element) ? expressionDeclaresCommand(element.expression, seen) : expressionDeclaresCommand(element, seen));
|
|
2258
|
+
}
|
|
2259
|
+
if (!ts.isObjectLiteralExpression(expression)) return false;
|
|
2260
|
+
return expression.properties.some((property) => {
|
|
2261
|
+
if (!ts.isPropertyAssignment(property)) return false;
|
|
2262
|
+
const propertyName = ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name) ? property.name.text : null;
|
|
2263
|
+
return propertyName === "command" && (ts.isStringLiteralLike(property.initializer) || ts.isNoSubstitutionTemplateLiteral(property.initializer)) && property.initializer.text === commandName;
|
|
2264
|
+
});
|
|
2265
|
+
};
|
|
2266
|
+
return sourceFile.statements.some((statement) => ts.isExportAssignment(statement) && !statement.isExportEquals && expressionDeclaresCommand(statement.expression));
|
|
2267
|
+
}
|
|
2268
|
+
function appDeclaresProgrammaticDevSupervisorOverrides(appDir) {
|
|
2269
|
+
const srcDir = path.join(appDir, "src");
|
|
2270
|
+
const pending = [srcDir];
|
|
2271
|
+
while (pending.length > 0) {
|
|
2272
|
+
const current = pending.pop();
|
|
2273
|
+
let entries;
|
|
2274
|
+
try {
|
|
2275
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
2276
|
+
} catch {
|
|
2277
|
+
continue;
|
|
2278
|
+
}
|
|
2279
|
+
for (const entry of entries) {
|
|
2280
|
+
const entryPath = path.join(current, entry.name);
|
|
2281
|
+
if (entry.isDirectory()) {
|
|
2282
|
+
if (entry.name !== "__tests__" && entry.name !== "node_modules") pending.push(entryPath);
|
|
2283
|
+
continue;
|
|
2284
|
+
}
|
|
2285
|
+
if (!/\.[cm]?tsx?$/.test(entry.name) || /(?:^|\.)test\.[cm]?tsx?$/.test(entry.name)) continue;
|
|
2286
|
+
let sourceText;
|
|
2287
|
+
try {
|
|
2288
|
+
sourceText = fs.readFileSync(entryPath, "utf8");
|
|
2289
|
+
} catch {
|
|
2290
|
+
continue;
|
|
2291
|
+
}
|
|
2292
|
+
const sourceFile = ts.createSourceFile(entryPath, sourceText, ts.ScriptTarget.Latest, true);
|
|
2293
|
+
const directImports = /* @__PURE__ */ new Set();
|
|
2294
|
+
const namespaceImports = /* @__PURE__ */ new Set();
|
|
2295
|
+
for (const statement of sourceFile.statements) {
|
|
2296
|
+
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteralLike(statement.moduleSpecifier) || statement.moduleSpecifier.text !== "@open-mercato/shared/modules/overrides") continue;
|
|
2297
|
+
const bindings = statement.importClause?.namedBindings;
|
|
2298
|
+
if (bindings && ts.isNamespaceImport(bindings)) namespaceImports.add(bindings.name.text);
|
|
2299
|
+
if (bindings && ts.isNamedImports(bindings)) {
|
|
2300
|
+
for (const element of bindings.elements) {
|
|
2301
|
+
const importedName = element.propertyName?.text ?? element.name.text;
|
|
2302
|
+
if (importedName === "applyWorkerOverrides" || importedName === "applyCliOverrides") {
|
|
2303
|
+
directImports.add(element.name.text);
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
let found = false;
|
|
2309
|
+
const visit = (node) => {
|
|
2310
|
+
if (found) return;
|
|
2311
|
+
if (ts.isCallExpression(node)) {
|
|
2312
|
+
if (ts.isIdentifier(node.expression) && directImports.has(node.expression.text)) {
|
|
2313
|
+
found = true;
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
if (ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression) && namespaceImports.has(node.expression.expression.text) && ["applyWorkerOverrides", "applyCliOverrides"].includes(node.expression.name.text)) {
|
|
2317
|
+
found = true;
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
ts.forEachChild(node, visit);
|
|
2322
|
+
};
|
|
2323
|
+
visit(sourceFile);
|
|
2324
|
+
if (found) return true;
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
return false;
|
|
2328
|
+
}
|
|
2329
|
+
function renderAstI18nLocaleRegistryFile(options) {
|
|
2330
|
+
const sourceFile = createGeneratedSourceFile(options.fileName);
|
|
2331
|
+
addAutoGeneratedComment(sourceFile, "registry (locale-specific i18n version)");
|
|
2332
|
+
addImportSpec(sourceFile, {
|
|
2333
|
+
moduleSpecifier: "@open-mercato/shared/modules/registry",
|
|
2334
|
+
namedImports: [{ name: "Module", isTypeOnly: true }]
|
|
2335
|
+
});
|
|
2336
|
+
addImportStatements(sourceFile, options.imports);
|
|
2337
|
+
sourceFile.addVariableStatement({
|
|
2338
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
2339
|
+
isExported: true,
|
|
2340
|
+
declarations: [{
|
|
2341
|
+
name: "modules",
|
|
2342
|
+
type: "Module[]",
|
|
2343
|
+
initializer: arrayLiteral(options.moduleEntries, writeValue)
|
|
2344
|
+
}]
|
|
2345
|
+
});
|
|
2346
|
+
sourceFile.addExportAssignment({
|
|
2347
|
+
isExportEquals: false,
|
|
2348
|
+
expression: "modules"
|
|
2349
|
+
});
|
|
2350
|
+
return getSourceText(sourceFile);
|
|
2351
|
+
}
|
|
2352
|
+
function buildI18nLocaleShardFileName(locale) {
|
|
2353
|
+
const safeLocale = locale.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2354
|
+
return `modules.i18n.${safeLocale}.generated.ts`;
|
|
2355
|
+
}
|
|
2356
|
+
function renderI18nLocaleLoadersFile(locales) {
|
|
2357
|
+
const cases = locales.map((locale) => {
|
|
2358
|
+
const moduleSpecifier = `./${buildI18nLocaleShardFileName(locale).replace(/\.ts$/, "")}`;
|
|
2359
|
+
return ` case ${JSON.stringify(locale)}:
|
|
2360
|
+
return import(${JSON.stringify(moduleSpecifier)}).then((entry) => entry.modules)`;
|
|
2361
|
+
}).join("\n");
|
|
2362
|
+
return `// AUTO-GENERATED by mercato generate registry (locale-specific i18n loaders)
|
|
2363
|
+
import type { Module } from '@open-mercato/shared/modules/registry'
|
|
2364
|
+
|
|
2365
|
+
export async function loadI18nModules(locale: string): Promise<Module[]> {
|
|
2366
|
+
switch (locale) {
|
|
2367
|
+
${cases ? `${cases}
|
|
2368
|
+
` : ""} default:
|
|
2369
|
+
return []
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
`;
|
|
2373
|
+
}
|
|
2374
|
+
function removeStaleI18nLocaleShards(outputDir, expectedFileNames) {
|
|
2375
|
+
if (!fs.existsSync(outputDir)) return;
|
|
2376
|
+
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
2377
|
+
if (!entry.isFile()) continue;
|
|
2378
|
+
if (!/^modules\.i18n\..+\.generated\.(?:ts|checksum)$/.test(entry.name)) continue;
|
|
2379
|
+
if (entry.name.startsWith("modules.i18n.loaders.generated.")) continue;
|
|
2380
|
+
if (expectedFileNames.has(entry.name)) continue;
|
|
2381
|
+
fs.unlinkSync(path.join(outputDir, entry.name));
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2142
2384
|
function resolveConventionFile(resolved, prefix, modId, importIdRef, imports, extraImports, importStyle = "namespace") {
|
|
2143
2385
|
if (!resolved) return null;
|
|
2144
2386
|
const importName = `${prefix}_${toVar(modId)}_${importIdRef.value++}`;
|
|
@@ -2201,6 +2443,10 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2201
2443
|
const frontendRouteManifestDecls = [];
|
|
2202
2444
|
const backendRouteManifestDecls = [];
|
|
2203
2445
|
const apiRouteManifestDecls = [];
|
|
2446
|
+
const backendRouteShardEntries = [];
|
|
2447
|
+
const backendRouteMetadataEntries = [];
|
|
2448
|
+
const apiRouteShardEntries = [];
|
|
2449
|
+
const apiRouteMetadataEntries = [];
|
|
2204
2450
|
const importIdRef = { value: 0 };
|
|
2205
2451
|
const requiresByModule = /* @__PURE__ */ new Map();
|
|
2206
2452
|
const commandLoaderEntries = [];
|
|
@@ -2344,6 +2590,7 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2344
2590
|
const fields = resolveConventionFile(discovered.resolve("data/fields.ts"), "F", modId, importIdRef, imports, runtimeImports);
|
|
2345
2591
|
if (fields) fieldsImportName = fields.importName;
|
|
2346
2592
|
}
|
|
2593
|
+
const integrationExports = integrationImportName ? `(${integrationImportName} as unknown as { integrations?: import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]; integration?: import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition; bundles?: import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]; bundle?: import('@open-mercato/shared/modules/integrations/types').IntegrationBundle })` : null;
|
|
2347
2594
|
{
|
|
2348
2595
|
const beApp = path.join(roots.appBase, "backend");
|
|
2349
2596
|
const bePkg = path.join(roots.pkgBase, "backend");
|
|
@@ -2365,6 +2612,8 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2365
2612
|
backendRoutes.push(...generatedBackendRoutes.eagerRoutes);
|
|
2366
2613
|
runtimeBackendRoutes.push(...generatedBackendRoutes.runtimeRoutes);
|
|
2367
2614
|
backendRouteManifestDecls.push(...generatedBackendRoutes.manifestRoutes);
|
|
2615
|
+
backendRouteShardEntries.push(...generatedBackendRoutes.manifestShardRoutes);
|
|
2616
|
+
backendRouteMetadataEntries.push(...generatedBackendRoutes.metadataRoutes);
|
|
2368
2617
|
for (const pattern of generatedBackendRoutes.routePatterns) {
|
|
2369
2618
|
assertUniqueBackendRoutePattern(seenBackendRoutePatterns, modId, pattern);
|
|
2370
2619
|
}
|
|
@@ -2383,6 +2632,8 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2383
2632
|
apis.push(...generatedApis.eagerApis);
|
|
2384
2633
|
runtimeApis.push(...generatedApis.runtimeApis);
|
|
2385
2634
|
apiRouteManifestDecls.push(...generatedApis.manifestApis);
|
|
2635
|
+
apiRouteShardEntries.push(...generatedApis.manifestShardApis);
|
|
2636
|
+
apiRouteMetadataEntries.push(...generatedApis.metadataApis);
|
|
2386
2637
|
}
|
|
2387
2638
|
{
|
|
2388
2639
|
const cliResolved = discovered.resolve("cli.ts");
|
|
@@ -2436,8 +2687,8 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2436
2687
|
${dashboardWidgets.length ? `dashboardWidgets: [${dashboardWidgets.join(", ")}],` : ""}
|
|
2437
2688
|
${setupImportName ? `setup: (${setupImportName}.default ?? ${setupImportName}.setup) || undefined,` : ""}
|
|
2438
2689
|
${encryptionImportName ? `defaultEncryptionMaps: ((${encryptionImportName}.default ?? ${encryptionImportName}.defaultEncryptionMaps) as import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]) || [],` : ""}
|
|
2439
|
-
${
|
|
2440
|
-
${
|
|
2690
|
+
${integrationExports ? `integrations: ((${integrationExports}.integrations ?? (${integrationExports}.integration ? [${integrationExports}.integration] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]),` : ""}
|
|
2691
|
+
${integrationExports ? `bundles: ((${integrationExports}.bundles ?? (${integrationExports}.bundle ? [${integrationExports}.bundle] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]),` : ""}
|
|
2441
2692
|
}`);
|
|
2442
2693
|
runtimeModuleDecls.push(`{
|
|
2443
2694
|
id: ${toLiteral(modId)},
|
|
@@ -2454,8 +2705,8 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2454
2705
|
${customEntitiesImportName ? `customEntities: ((${customEntitiesImportName}.default ?? ${customEntitiesImportName}.entities) as any) || [],` : ""}
|
|
2455
2706
|
${setupImportName ? `setup: (${setupImportName}.default ?? ${setupImportName}.setup) || undefined,` : ""}
|
|
2456
2707
|
${encryptionImportName ? `defaultEncryptionMaps: ((${encryptionImportName}.default ?? ${encryptionImportName}.defaultEncryptionMaps) as import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]) || [],` : ""}
|
|
2457
|
-
${
|
|
2458
|
-
${
|
|
2708
|
+
${integrationExports ? `integrations: ((${integrationExports}.integrations ?? (${integrationExports}.integration ? [${integrationExports}.integration] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]),` : ""}
|
|
2709
|
+
${integrationExports ? `bundles: ((${integrationExports}.bundles ?? (${integrationExports}.bundle ? [${integrationExports}.bundle] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]),` : ""}
|
|
2459
2710
|
}`);
|
|
2460
2711
|
}
|
|
2461
2712
|
{
|
|
@@ -2581,6 +2832,12 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2581
2832
|
exportName: "apiRoutes",
|
|
2582
2833
|
entries: apiRouteManifestDecls
|
|
2583
2834
|
});
|
|
2835
|
+
const routeManifestOutputs = [
|
|
2836
|
+
...renderRouteManifestShardOutputs("backend", backendRouteShardEntries),
|
|
2837
|
+
...renderRouteManifestShardOutputs("api", apiRouteShardEntries),
|
|
2838
|
+
renderRouteMetadataOutput("backend", backendRouteMetadataEntries),
|
|
2839
|
+
renderRouteMetadataOutput("api", apiRouteMetadataEntries)
|
|
2840
|
+
];
|
|
2584
2841
|
const legacySubscribersOutput = renderAstLegacyAliasFile({
|
|
2585
2842
|
fileName: "subscribers.generated.ts",
|
|
2586
2843
|
exportName: "moduleSubscribers",
|
|
@@ -2623,6 +2880,29 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2623
2880
|
writeGeneratedFile({ outFile: frontendRoutesOutFile, checksumFile: frontendRoutesChecksumFile, content: frontendRoutesOutput, structureChecksum, result, quiet });
|
|
2624
2881
|
writeGeneratedFile({ outFile: backendRoutesOutFile, checksumFile: backendRoutesChecksumFile, content: backendRoutesOutput, structureChecksum, result, quiet });
|
|
2625
2882
|
writeGeneratedFile({ outFile: apiRoutesOutFile, checksumFile: apiRoutesChecksumFile, content: apiRoutesOutput, structureChecksum, result, quiet });
|
|
2883
|
+
const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [
|
|
2884
|
+
fileName,
|
|
2885
|
+
fileName.replace(/\.ts$/, ".checksum")
|
|
2886
|
+
]));
|
|
2887
|
+
if (fs.existsSync(outputDir)) {
|
|
2888
|
+
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
2889
|
+
if (!entry.isFile() || !routeManifestShardFilePattern.test(entry.name)) continue;
|
|
2890
|
+
if (expectedRouteManifestFiles.has(entry.name)) continue;
|
|
2891
|
+
const stalePath = path.join(outputDir, entry.name);
|
|
2892
|
+
fs.unlinkSync(stalePath);
|
|
2893
|
+
result.filesWritten.push(stalePath);
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
for (const routeOutput of routeManifestOutputs) {
|
|
2897
|
+
writeGeneratedFile({
|
|
2898
|
+
outFile: path.join(outputDir, routeOutput.fileName),
|
|
2899
|
+
checksumFile: path.join(outputDir, routeOutput.fileName.replace(/\.ts$/, ".checksum")),
|
|
2900
|
+
content: routeOutput.content,
|
|
2901
|
+
structureChecksum,
|
|
2902
|
+
result,
|
|
2903
|
+
quiet
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2626
2906
|
writeGeneratedFile({ outFile: legacySubscribersOutFile, checksumFile: legacySubscribersChecksumFile, content: legacySubscribersOutput, structureChecksum, result, quiet });
|
|
2627
2907
|
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries);
|
|
2628
2908
|
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet });
|
|
@@ -2651,14 +2931,14 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2651
2931
|
{
|
|
2652
2932
|
const bootstrapPlugins = [...pluginRegistry.values()].filter((p) => p.bootstrapRegistration);
|
|
2653
2933
|
const allEntryImports = [
|
|
2654
|
-
buildImportStatement(`{
|
|
2934
|
+
buildImportStatement(`{ backendRouteFacades }`, `./backend-route-shards.generated`),
|
|
2655
2935
|
buildImportStatement(`{ frontendRoutes }`, `./frontend-routes.generated`)
|
|
2656
2936
|
];
|
|
2657
2937
|
const allRegImports = [
|
|
2658
2938
|
`import { registerBackendRouteManifests, registerFrontendRouteManifests } from '@open-mercato/shared/modules/registry'`
|
|
2659
2939
|
];
|
|
2660
2940
|
const allCalls = [
|
|
2661
|
-
`registerBackendRouteManifests(
|
|
2941
|
+
`registerBackendRouteManifests(backendRouteFacades)`,
|
|
2662
2942
|
`registerFrontendRouteManifests(frontendRoutes)`
|
|
2663
2943
|
];
|
|
2664
2944
|
for (const plugin of bootstrapPlugins) {
|
|
@@ -2693,6 +2973,8 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
2693
2973
|
const bootstrapChecksumFile = path.join(outputDir, "modules.bootstrap.generated.checksum");
|
|
2694
2974
|
const i18nOutFile = path.join(outputDir, "modules.i18n.generated.ts");
|
|
2695
2975
|
const i18nChecksumFile = path.join(outputDir, "modules.i18n.generated.checksum");
|
|
2976
|
+
const i18nLoadersOutFile = path.join(outputDir, "modules.i18n.loaders.generated.ts");
|
|
2977
|
+
const i18nLoadersChecksumFile = path.join(outputDir, "modules.i18n.loaders.generated.checksum");
|
|
2696
2978
|
const legacyOutFile = path.join(outputDir, "bootstrap-modules.generated.ts");
|
|
2697
2979
|
const legacyChecksumFile = path.join(outputDir, "bootstrap-modules.generated.checksum");
|
|
2698
2980
|
const enabledIdsOutFile = path.join(outputDir, "enabled-module-ids.generated.ts");
|
|
@@ -2706,6 +2988,7 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
2706
2988
|
const moduleDecls = [];
|
|
2707
2989
|
const bootstrapModuleDecls = [];
|
|
2708
2990
|
const i18nModuleDecls = [];
|
|
2991
|
+
const i18nLocaleShards = /* @__PURE__ */ new Map();
|
|
2709
2992
|
const importIdRef = { value: 0 };
|
|
2710
2993
|
const requiresByModule = /* @__PURE__ */ new Map();
|
|
2711
2994
|
const commandLoaderEntries = [];
|
|
@@ -2717,6 +3000,7 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
2717
3000
|
const frontendRoutes = [];
|
|
2718
3001
|
const backendRoutes = [];
|
|
2719
3002
|
const translations = [];
|
|
3003
|
+
const localeTranslations = /* @__PURE__ */ new Map();
|
|
2720
3004
|
const subscribers = [];
|
|
2721
3005
|
const workers = [];
|
|
2722
3006
|
let infoImportName = null;
|
|
@@ -2832,10 +3116,25 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
2832
3116
|
appImportBase,
|
|
2833
3117
|
pkgImportBase: imps.pkgBase,
|
|
2834
3118
|
imports,
|
|
2835
|
-
extraImports: translationImports
|
|
3119
|
+
extraImports: translationImports,
|
|
3120
|
+
localeOutputs: localeTranslations
|
|
2836
3121
|
}));
|
|
2837
|
-
bootstrapImports.push(...translationImports);
|
|
2838
3122
|
i18nImports.push(...translationImports);
|
|
3123
|
+
for (const [locale, localeTranslation] of localeTranslations) {
|
|
3124
|
+
const shard = i18nLocaleShards.get(locale) ?? { imports: [], moduleDecls: [] };
|
|
3125
|
+
shard.imports.push(...localeTranslation.imports);
|
|
3126
|
+
shard.moduleDecls.push(objectLiteral([
|
|
3127
|
+
{ name: "id", value: modId },
|
|
3128
|
+
{
|
|
3129
|
+
name: "translations",
|
|
3130
|
+
value: objectLiteral([{
|
|
3131
|
+
name: JSON.stringify(locale),
|
|
3132
|
+
value: localeTranslation.value
|
|
3133
|
+
}])
|
|
3134
|
+
}
|
|
3135
|
+
]));
|
|
3136
|
+
i18nLocaleShards.set(locale, shard);
|
|
3137
|
+
}
|
|
2839
3138
|
subscribers.push(...processSubscribersAst(await discovered.getSubscribers()));
|
|
2840
3139
|
workers.push(...processWorkersAst(await discovered.getWorkers()));
|
|
2841
3140
|
{
|
|
@@ -2944,7 +3243,9 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
2944
3243
|
routeAwareModuleEntries.push({ name: "backendRoutes", value: arrayLiteral(backendRoutes, writeValue) });
|
|
2945
3244
|
}
|
|
2946
3245
|
moduleDecls.push(objectLiteral(routeAwareModuleEntries));
|
|
2947
|
-
bootstrapModuleDecls.push(objectLiteral(moduleEntries
|
|
3246
|
+
bootstrapModuleDecls.push(objectLiteral(moduleEntries.filter(
|
|
3247
|
+
(entry) => entry.kind === "spread" || entry.name !== "translations"
|
|
3248
|
+
)));
|
|
2948
3249
|
i18nModuleDecls.push(objectLiteral(i18nModuleEntries));
|
|
2949
3250
|
}
|
|
2950
3251
|
const output = renderAstModuleRegistryFile({
|
|
@@ -2996,6 +3297,41 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
2996
3297
|
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet });
|
|
2997
3298
|
writeGeneratedFile({ outFile: bootstrapOutFile, checksumFile: bootstrapChecksumFile, content: bootstrapOutput, structureChecksum, result, quiet });
|
|
2998
3299
|
writeGeneratedFile({ outFile: i18nOutFile, checksumFile: i18nChecksumFile, content: i18nOutput, structureChecksum, result, quiet });
|
|
3300
|
+
const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b));
|
|
3301
|
+
const shardFileNames = /* @__PURE__ */ new Set();
|
|
3302
|
+
const expectedShardArtifacts = /* @__PURE__ */ new Set();
|
|
3303
|
+
for (const locale of i18nLocales) {
|
|
3304
|
+
const fileName = buildI18nLocaleShardFileName(locale);
|
|
3305
|
+
if (shardFileNames.has(fileName)) {
|
|
3306
|
+
throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`);
|
|
3307
|
+
}
|
|
3308
|
+
shardFileNames.add(fileName);
|
|
3309
|
+
expectedShardArtifacts.add(fileName);
|
|
3310
|
+
expectedShardArtifacts.add(fileName.replace(/\.ts$/, ".checksum"));
|
|
3311
|
+
const shard = i18nLocaleShards.get(locale);
|
|
3312
|
+
const content = renderAstI18nLocaleRegistryFile({
|
|
3313
|
+
fileName,
|
|
3314
|
+
imports: shard.imports,
|
|
3315
|
+
moduleEntries: shard.moduleDecls
|
|
3316
|
+
});
|
|
3317
|
+
writeGeneratedFile({
|
|
3318
|
+
outFile: path.join(outputDir, fileName),
|
|
3319
|
+
checksumFile: path.join(outputDir, fileName.replace(/\.ts$/, ".checksum")),
|
|
3320
|
+
content,
|
|
3321
|
+
structureChecksum,
|
|
3322
|
+
result,
|
|
3323
|
+
quiet
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts);
|
|
3327
|
+
writeGeneratedFile({
|
|
3328
|
+
outFile: i18nLoadersOutFile,
|
|
3329
|
+
checksumFile: i18nLoadersChecksumFile,
|
|
3330
|
+
content: renderI18nLocaleLoadersFile(i18nLocales),
|
|
3331
|
+
structureChecksum,
|
|
3332
|
+
result,
|
|
3333
|
+
quiet
|
|
3334
|
+
});
|
|
2999
3335
|
writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet });
|
|
3000
3336
|
const enabledIdsOutput = renderEnabledModuleIdsFile(enabled.map((entry) => entry.id));
|
|
3001
3337
|
writeGeneratedFile({ outFile: enabledIdsOutFile, checksumFile: enabledIdsChecksumFile, content: enabledIdsOutput, structureChecksum, result, quiet });
|
|
@@ -3014,14 +3350,19 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3014
3350
|
const legacyChecksumFile = path.join(outputDir, "cli-modules.generated.checksum");
|
|
3015
3351
|
const commandLoadersOutFile = path.join(outputDir, "command-loaders.generated.ts");
|
|
3016
3352
|
const commandLoadersChecksumFile = path.join(outputDir, "command-loaders.generated.checksum");
|
|
3353
|
+
const devSupervisorOutFile = path.join(outputDir, DEV_SUPERVISOR_MANIFEST_FILE);
|
|
3354
|
+
const devSupervisorChecksumFile = path.join(outputDir, "dev-supervisor.generated.checksum");
|
|
3017
3355
|
const enabled = discovery.enabled;
|
|
3018
3356
|
const imports = [];
|
|
3019
3357
|
const moduleDecls = [];
|
|
3020
3358
|
const importIdRef = { value: 0 };
|
|
3021
3359
|
const requiresByModule = /* @__PURE__ */ new Map();
|
|
3022
3360
|
const commandLoaderEntries = [];
|
|
3361
|
+
const devSupervisorWorkers = [];
|
|
3362
|
+
let schedulerStartStatus = "missing-module";
|
|
3363
|
+
let requiresFullBootstrap = enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true) || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir());
|
|
3023
3364
|
for (const discovered of discovery.modules) {
|
|
3024
|
-
const { modId,
|
|
3365
|
+
const { modId, imps, appImportBase } = discovered;
|
|
3025
3366
|
commandLoaderEntries.push(...discovered.commandLoaderEntries);
|
|
3026
3367
|
let cliImportName = null;
|
|
3027
3368
|
const translations = [];
|
|
@@ -3091,11 +3432,20 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3091
3432
|
if (fields) fieldsImportName = fields.importName;
|
|
3092
3433
|
}
|
|
3093
3434
|
{
|
|
3435
|
+
if (modId === "scheduler") schedulerStartStatus = "missing-cli";
|
|
3094
3436
|
const cliResolved = discovered.resolve("cli.ts");
|
|
3095
3437
|
if (cliResolved) {
|
|
3096
3438
|
const importName = `CLI_${toVar(modId)}`;
|
|
3097
3439
|
imports.push(buildImportStatement(importName, sanitizeGeneratedModuleSpecifier(cliResolved.importPath)));
|
|
3098
3440
|
cliImportName = importName;
|
|
3441
|
+
if (modId === "scheduler") {
|
|
3442
|
+
if (sourceDeclaresCliCommand(cliResolved.absolutePath, "start")) {
|
|
3443
|
+
schedulerStartStatus = "ok";
|
|
3444
|
+
} else {
|
|
3445
|
+
schedulerStartStatus = "missing-command";
|
|
3446
|
+
requiresFullBootstrap = true;
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3099
3449
|
}
|
|
3100
3450
|
}
|
|
3101
3451
|
translations.push(...processTranslationsAst({
|
|
@@ -3106,7 +3456,10 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3106
3456
|
imports
|
|
3107
3457
|
}));
|
|
3108
3458
|
subscribers.push(...processSubscribersAst(await discovered.getSubscribers()));
|
|
3109
|
-
|
|
3459
|
+
const discoveredWorkers = await discovered.getWorkers();
|
|
3460
|
+
const workerGenerationEntries = collectWorkerGenerationEntries(discoveredWorkers, modId);
|
|
3461
|
+
workers.push(...processWorkersAst(discoveredWorkers));
|
|
3462
|
+
devSupervisorWorkers.push(...workerGenerationEntries.map(({ importPath: _importPath, ...worker }) => worker));
|
|
3110
3463
|
{
|
|
3111
3464
|
dashboardWidgetsValue = buildModuleDashboardWidgetsValue(discovered.dashboardWidgetEntries);
|
|
3112
3465
|
}
|
|
@@ -3260,6 +3613,21 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3260
3613
|
const structureChecksum = discovery.getStructureChecksum();
|
|
3261
3614
|
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet });
|
|
3262
3615
|
writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet });
|
|
3616
|
+
const devSupervisorOutput = `${JSON.stringify({
|
|
3617
|
+
version: DEV_SUPERVISOR_MANIFEST_VERSION,
|
|
3618
|
+
workers: devSupervisorWorkers,
|
|
3619
|
+
schedulerStartStatus,
|
|
3620
|
+
requiresFullBootstrap
|
|
3621
|
+
}, null, 2)}
|
|
3622
|
+
`;
|
|
3623
|
+
writeGeneratedFile({
|
|
3624
|
+
outFile: devSupervisorOutFile,
|
|
3625
|
+
checksumFile: devSupervisorChecksumFile,
|
|
3626
|
+
content: devSupervisorOutput,
|
|
3627
|
+
structureChecksum,
|
|
3628
|
+
result,
|
|
3629
|
+
quiet
|
|
3630
|
+
});
|
|
3263
3631
|
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries);
|
|
3264
3632
|
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet });
|
|
3265
3633
|
return result;
|
|
@@ -3285,6 +3653,7 @@ async function generateModuleRegistries(options) {
|
|
|
3285
3653
|
];
|
|
3286
3654
|
}
|
|
3287
3655
|
export {
|
|
3656
|
+
extractCommandIdsFromSource,
|
|
3288
3657
|
extractNamedObjectLiteralExport,
|
|
3289
3658
|
generateModuleRegistries,
|
|
3290
3659
|
generateModuleRegistry,
|