@open-mercato/cli 0.6.7-develop.6862.1.c11a64ce0a → 0.6.7
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 +4 -4
- package/build.mjs +7 -24
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +88 -32
- package/dist/agentic/codex/enforcement-rules.md +16 -2
- package/dist/agentic/cursor/hooks/entity-migration-check.mjs +50 -19
- package/dist/agentic/cursor/rules/entity-guard.mdc +21 -9
- package/dist/agentic/cursor/rules/generated-guard.mdc +5 -3
- package/dist/agentic/cursor/rules/open-mercato.mdc +29 -3
- package/dist/agentic/guides/cache.md +45 -0
- package/dist/agentic/guides/core.md +453 -0
- package/dist/agentic/guides/events.md +117 -0
- package/dist/agentic/guides/module-facts.json +3833 -115419
- package/dist/agentic/guides/module-system.md +127 -12
- package/dist/agentic/guides/modules/ai_assistant.md +28 -227
- package/dist/agentic/guides/modules/api_docs.md +2 -58
- package/dist/agentic/guides/modules/api_keys.md +7 -92
- package/dist/agentic/guides/modules/attachments.md +14 -119
- package/dist/agentic/guides/modules/audit_logs.md +10 -131
- package/dist/agentic/guides/modules/auth.md +33 -276
- package/dist/agentic/guides/modules/business_rules.md +14 -149
- package/dist/agentic/guides/modules/catalog.md +43 -475
- package/dist/agentic/guides/modules/channel_gmail.md +3 -82
- package/dist/agentic/guides/modules/channel_imap.md +3 -82
- package/dist/agentic/guides/modules/checkout.md +27 -299
- package/dist/agentic/guides/modules/communication_channels.md +33 -315
- package/dist/agentic/guides/modules/configs.md +8 -104
- package/dist/agentic/guides/modules/content.md +2 -57
- package/dist/agentic/guides/modules/currencies.md +17 -152
- package/dist/agentic/guides/modules/customer_accounts.md +45 -387
- package/dist/agentic/guides/modules/customers.md +85 -746
- package/dist/agentic/guides/modules/dashboards.md +10 -155
- package/dist/agentic/guides/modules/data_sync.md +16 -149
- package/dist/agentic/guides/modules/dictionaries.md +12 -107
- package/dist/agentic/guides/modules/directory.md +15 -148
- package/dist/agentic/guides/modules/entities.md +13 -145
- package/dist/agentic/guides/modules/events.md +2 -59
- package/dist/agentic/guides/modules/feature_toggles.md +9 -119
- package/dist/agentic/guides/modules/gateway_stripe.md +4 -92
- package/dist/agentic/guides/modules/generators.md +2 -45
- package/dist/agentic/guides/modules/inbox_ops.md +27 -207
- package/dist/agentic/guides/modules/integrations.md +16 -146
- package/dist/agentic/guides/modules/messages.md +24 -223
- package/dist/agentic/guides/modules/notifications.md +8 -96
- package/dist/agentic/guides/modules/onboarding.md +6 -77
- package/dist/agentic/guides/modules/payment_gateways.md +21 -164
- package/dist/agentic/guides/modules/perspectives.md +7 -77
- package/dist/agentic/guides/modules/planner.md +18 -136
- package/dist/agentic/guides/modules/portal.md +2 -93
- package/dist/agentic/guides/modules/progress.md +14 -104
- package/dist/agentic/guides/modules/query_index.md +15 -154
- package/dist/agentic/guides/modules/record_locks.md +21 -206
- package/dist/agentic/guides/modules/resources.md +30 -197
- package/dist/agentic/guides/modules/sales.md +84 -678
- package/dist/agentic/guides/modules/scheduler.md +14 -133
- package/dist/agentic/guides/modules/search.md +6 -170
- package/dist/agentic/guides/modules/security.md +35 -294
- package/dist/agentic/guides/modules/shipping_carriers.md +18 -134
- package/dist/agentic/guides/modules/sso.md +26 -151
- package/dist/agentic/guides/modules/staff.md +57 -369
- package/dist/agentic/guides/modules/storage_s3.md +5 -95
- package/dist/agentic/guides/modules/sync_akeneo.md +3 -85
- package/dist/agentic/guides/modules/sync_excel.md +6 -75
- package/dist/agentic/guides/modules/system_status_overlays.md +2 -60
- package/dist/agentic/guides/modules/translations.md +10 -104
- package/dist/agentic/guides/modules/webhooks.md +24 -203
- package/dist/agentic/guides/modules/wms.md +46 -441
- package/dist/agentic/guides/modules/workflows.md +43 -302
- package/dist/agentic/guides/queue.md +53 -0
- package/dist/agentic/guides/search.md +115 -0
- package/dist/agentic/guides/shared.md +108 -0
- package/dist/agentic/guides/ui.md +347 -0
- package/dist/agentic/shared/AGENTS.md.template +311 -124
- package/dist/agentic/shared/ai/agentic.config.json +0 -2
- package/dist/agentic/shared/ai/lessons.md +3 -26
- package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +0 -4
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +241 -20
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +260 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +601 -16
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +146 -0
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +310 -14
- package/dist/agentic/shared/ai/skills/om-help/SKILL.md +97 -15
- package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +84 -0
- package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +193 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +152 -33
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +708 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +34 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +762 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +820 -20
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +50 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +97 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +843 -19
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +271 -0
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +63 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +467 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +101 -0
- package/dist/agentic/shared/ai/skills/tiers.json +21 -143
- package/dist/agentic/shared/ai/skills/tiers.schema.json +40 -52
- package/dist/agentic/shared/ai/specs/README.md +3 -4
- package/dist/agentic/shared/ai/specs/SPEC-000-template.md +10 -226
- package/dist/agentic/shared/ai/trackers/github.md +4 -108
- package/dist/agentic/shared/scripts/install-skills.sh +694 -4
- package/dist/bin.js +1 -13
- package/dist/bin.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-008.spec.js +8 -88
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +3 -13
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +186 -418
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +0 -20
- package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
- package/dist/lib/generators/module-facts-discovery.js +7 -41
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +45 -1387
- package/dist/lib/generators/module-facts.js.map +3 -3
- package/dist/lib/generators/module-registry.js +5 -11
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/resolver.js +0 -2
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/testing/integration.js +0 -5
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +1 -23
- package/dist/mercato.js.map +2 -2
- package/package.json +11 -13
- package/src/bin.ts +1 -33
- package/src/lib/__integration__/TC-INT-008.spec.ts +9 -107
- package/src/lib/__tests__/agentic-init.test.ts +5 -41
- package/src/lib/agentic-init.ts +3 -15
- package/src/lib/agentic-setup.ts +224 -530
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +2 -88
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +0 -1
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +10 -54
- package/src/lib/generators/__tests__/module-subset.test.ts +0 -18
- package/src/lib/generators/extensions/injection-widgets.ts +0 -51
- package/src/lib/generators/module-facts-discovery.ts +7 -58
- package/src/lib/generators/module-facts.ts +46 -1851
- package/src/lib/generators/module-registry.ts +6 -16
- package/src/lib/resolver.ts +0 -3
- package/src/lib/testing/__tests__/integration.test.ts +0 -4
- package/src/lib/testing/integration.ts +0 -5
- package/src/mercato.ts +1 -26
- package/dist/agentic/guides/ai-workflows.md +0 -76
- package/dist/agentic/guides/architecture.md +0 -107
- package/dist/agentic/guides/backend-ui.md +0 -80
- package/dist/agentic/guides/contracts.md +0 -92
- package/dist/agentic/guides/extensions.md +0 -121
- package/dist/agentic/guides/framework-extension-points.md +0 -36
- package/dist/agentic/guides/integrations.md +0 -81
- package/dist/agentic/guides/modules/design_system.md +0 -102
- package/dist/agentic/guides/spec-delivery.md +0 -22
- package/dist/agentic/guides/testing-debugging.md +0 -80
- package/dist/agentic/guides/upstream/AGENTS.md +0 -298
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +0 -316
- package/dist/agentic/guides/upstream/manifest.json +0 -8
- package/dist/agentic/shared/ai/harness/README.md +0 -50
- package/dist/agentic/shared/ai/harness/RELEASE.md +0 -57
- package/dist/agentic/shared/ai/harness/cases.json +0 -13680
- package/dist/agentic/shared/ai/harness/cases.schema.json +0 -133
- package/dist/agentic/shared/ai/harness/fixtures/index.json +0 -49
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +0 -162
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +0 -21
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +0 -96
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +0 -172
- package/dist/agentic/shared/ai/harness/release-matrix.json +0 -158
- package/dist/agentic/shared/ai/harness/release-result.schema.json +0 -219
- package/dist/agentic/shared/ai/harness/result.schema.json +0 -76
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +0 -12
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +0 -73
- package/dist/agentic/shared/ai/harness/validators.json +0 -78
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +0 -2121
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +0 -1096
- package/dist/agentic/shared/ai/lessons/_template.md +0 -16
- package/dist/agentic/shared/ai/review-checklist.md +0 -36
- package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +0 -21
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +0 -98
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +0 -16
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +0 -53
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +0 -11
- package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +0 -30
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +0 -12
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +0 -13
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +0 -28
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +0 -22
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +0 -13
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +0 -10
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +0 -17
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +0 -29
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +0 -100
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +0 -16
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +0 -17
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +0 -25
- package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +0 -11
- package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +0 -18
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +0 -20
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +0 -33
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +0 -40
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +0 -27
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +0 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +0 -16
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +0 -14
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +0 -15
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +0 -12
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +0 -34
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +0 -4
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +0 -11
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +0 -31
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +0 -39
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +0 -43
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +0 -19
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +0 -172
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +0 -12
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +0 -83
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +0 -21
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +0 -22
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +0 -13
- package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +0 -41
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +0 -19
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +0 -44
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +0 -39
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +0 -20
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +0 -57
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +0 -486
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +0 -18
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +0 -27
- package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +0 -13
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +0 -41
- package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +0 -11
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +0 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +0 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +0 -14
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +0 -187
- package/dist/agentic/shared/scripts/check-lessons.mjs +0 -178
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +0 -2958
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +0 -329
- package/dist/agentic/shared/scripts/framework-context.mjs +0 -888
- package/dist/agentic/shared/scripts/install-skills.mjs +0 -1029
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +0 -222
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +0 -1774
- package/dist/lib/generators/module-extension-facts.js +0 -1840
- package/dist/lib/generators/module-extension-facts.js.map +0 -7
- package/dist/lib/generators/module-fact-sources.js +0 -70
- package/dist/lib/generators/module-fact-sources.js.map +0 -7
- package/dist/lib/generators/module-override-targets.js +0 -688
- package/dist/lib/generators/module-override-targets.js.map +0 -7
- package/dist/lib/load-env.js +0 -24
- package/dist/lib/load-env.js.map +0 -7
- package/dist/lib/telemetry-init.js +0 -358
- package/dist/lib/telemetry-init.js.map +0 -7
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +0 -386
- package/src/lib/__tests__/injection-widget-id-validation.test.ts +0 -184
- package/src/lib/__tests__/load-env.test.ts +0 -65
- package/src/lib/__tests__/telemetry-init.test.ts +0 -298
- package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +0 -92
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +0 -762
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +0 -404
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +0 -108
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +0 -561
- package/src/lib/generators/__tests__/module-facts.source-links.test.ts +0 -119
- package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +0 -149
- package/src/lib/generators/__tests__/module-override-targets.test.ts +0 -304
- package/src/lib/generators/module-extension-facts.ts +0 -2365
- package/src/lib/generators/module-fact-sources.ts +0 -108
- package/src/lib/generators/module-override-targets.ts +0 -863
- package/src/lib/load-env.ts +0 -30
- package/src/lib/telemetry-init.ts +0 -461
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/generators/module-facts.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport type {\n ModuleExtensionContributionFact,\n ModuleExtensionHostFact,\n ModuleExtensionSurfaceFacts,\n ModuleExtensionTargetRef,\n} from '@open-mercato/shared/modules/widgets/extension-points'\nimport { toSnake } from '../utils'\nimport { extractCommandIdsFromSource } from './module-registry'\nimport { MODULE_CODE_EXTENSIONS } from './scanner'\nimport type { ApiRouteInterceptorBridge } from './module-extension-facts'\nimport {\n assertNoUnresolvedExtensionTargets,\n correlateIncomingExtensions,\n correlateModuleExtensionFacts,\n extractActivationTargetOwners,\n extractKnownApiRouteIds,\n extractKnownCommandIds,\n extractModuleExtensionFacts,\n renderFrameworkExtensionPointsMarkdown,\n withModuleExtensionFactExtractionCache,\n} from './module-extension-facts'\nimport {\n collectModuleOverrideTargets,\n type ModuleOverrideTarget,\n type ModuleOverrideTargetDiagnostic,\n} from './module-override-targets'\nimport { buildFactSourceLookup, type FactSourceLookup } from './module-fact-sources'\n\nexport interface ModuleEntityFact {\n id: string\n class: string\n table: string\n editable: boolean\n customFields: boolean\n}\n\nexport interface ApiRouteAuthRule {\n requireAuth?: boolean\n requireFeatures?: string[]\n requireRoles?: string[]\n}\n\nexport interface ModuleApiRouteFact {\n path: string\n methods: string[]\n auth: Record<string, ApiRouteAuthRule>\n sourcePath: string | null\n}\n\n/**\n * Statically declared page metadata that affects extensibility or access, using the\n * runtime `PageMetadata` contract keys and the same alias precedence as\n * `resolvePageRouteMetadata` (`pageGroup ?? group`, `pageGroupKey ?? groupKey`,\n * `pageOrder ?? order`). Executable guards, icons, titles and translation results are\n * never serialized.\n */\nexport interface ModulePageMetadata {\n requireAuth?: boolean\n requireCustomerAuth?: boolean\n requireFeatures?: string[]\n requireCustomerFeatures?: string[]\n navHidden?: boolean\n navGroup?: string\n navGroupKey?: string\n navOrder?: number\n pageContext?: 'main' | 'admin' | 'settings' | 'profile'\n}\n\nexport interface ModulePageFact {\n path: string\n sourcePath: string\n /** Companion metadata file (`page.meta.*` / `meta.*`) when runtime reads metadata from one. */\n metadataSourcePath?: string\n metadata?: ModulePageMetadata\n}\n\nexport interface ModuleCliCommandFact {\n command: string\n sourcePath: string\n}\n\nexport interface ModuleAiToolFact {\n name: string\n sourcePath: string\n}\n\nexport interface ModuleAiAgentFact {\n id: string\n sourcePath: string\n}\n\nexport interface ModuleEventFact {\n id: string\n label?: string\n category: string | null\n entity: string | null\n clientBroadcast?: boolean\n portalBroadcast?: boolean\n}\n\nexport interface ModuleHostTokens {\n entityIds: string[]\n tableIds: string[]\n}\n\nexport type ModuleFactSourceRef = {\n sourcePath: string\n exportName?: string\n line?: number\n}\n\nexport type ModuleFactRef = {\n factSection: string\n factKey: string\n}\n\nexport type ModuleFactSourceKind =\n | 'module-metadata'\n | 'entity'\n | 'event'\n | 'acl-feature'\n | 'api-route'\n | 'di-registration'\n | 'search'\n | 'vector'\n | 'notification'\n | 'cli-command'\n | 'backend-page'\n | 'frontend-page'\n | 'ai-tool'\n | 'ai-agent'\n | 'ai-extension'\n | 'command'\n | 'subscriber'\n | 'worker'\n | 'page-middleware'\n | 'setup'\n | 'encryption'\n | 'custom-entity'\n | 'integration'\n | 'generator-plugin'\n | 'extension-host'\n | 'extension-contribution'\n\nexport type ModuleOwnedContractKind =\n | 'module-metadata'\n | 'command'\n | 'worker'\n | 'page-middleware'\n | 'setup'\n | 'encryption'\n | 'di-registration'\n | 'custom-entity'\n | 'ai-extension'\n | 'generator-plugin'\n\nexport type ModuleFactSafeScalar = string | number | boolean | null\n\nexport type ModuleOwnedContractFact = {\n kind: ModuleOwnedContractKind\n id: string\n source: ModuleFactSourceRef\n metadata?: Record<string, ModuleFactSafeScalar | ModuleFactSafeScalar[]>\n}\n\nexport type ModuleOwnedContracts = Partial<\n Record<ModuleOwnedContractKind, ModuleOwnedContractFact[]>\n>\n\n/**\n * Provenance pointer into a fact section that already serializes the declaration site.\n * `factKey` is omitted when it equals the owning entry's `id`, which is the common case.\n */\nexport type ModuleFactIndexRef = {\n factSection: string\n factKey?: string\n}\n\n/**\n * One provenance entry per proven `(kind, id)` in the module. Exactly one of `source`\n * (the declaration site, for facts that have no other home in the JSON) or `factRef`\n * (a deterministic pointer into a fact section that already carries the source inline)\n * is present, so a consumer resolves any fact's origin through this single index.\n */\nexport type ModuleFactSourceEntry = {\n kind: ModuleFactSourceKind\n id: string\n source?: ModuleFactSourceRef\n factRef?: ModuleFactIndexRef\n}\n\nexport type ModuleFactDiagnostic = {\n code: 'duplicate-source' | 'unresolved-static-contract'\n kind: ModuleFactSourceKind\n id: string\n source?: ModuleFactSourceRef\n}\n\nexport type ModuleDiRegistrationFact = {\n token: string\n registrationKind: 'function' | 'class' | 'value' | 'alias'\n providerSymbol?: string\n lifetime?: 'singleton' | 'scoped' | 'transient'\n injectionMode?: 'classic' | 'proxy'\n source: ModuleFactSourceRef\n}\n\nexport interface ModuleFacts {\n module: string\n title: string | null\n description: string | null\n coreVersion: string | null\n sourcePackage: string | null\n sourceVersion: string | null\n sourceRoot: string\n entities: ModuleEntityFact[]\n events: ModuleEventFact[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n backendPages: ModulePageFact[]\n frontendPages: ModulePageFact[]\n cliCommands: ModuleCliCommandFact[]\n aiTools: ModuleAiToolFact[]\n aiAgents: ModuleAiAgentFact[]\n extensionSurfaces?: ModuleExtensionSurfaceFacts\n factSources?: ModuleFactSourceEntry[]\n ownedContracts?: ModuleOwnedContracts\n factDiagnostics?: ModuleFactDiagnostic[]\n overrideTargets?: ModuleOverrideTarget[]\n overrideTargetDiagnostics?: ModuleOverrideTargetDiagnostic[]\n warnings: string[]\n}\n\nexport interface ExtractModuleFactsOptions {\n moduleId: string\n /**\n * Parent modules directory joined with `moduleId` to locate the module source.\n * Legacy input; prefer the explicit per-module `moduleRoot` for modules that do\n * not live under a single shared root (auto-discovery). One of `moduleRoot` /\n * `coreSrcRoot` must be provided.\n */\n coreSrcRoot?: string\n /** Explicit module source directory. When set it overrides `coreSrcRoot + moduleId`. */\n moduleRoot?: string\n coreVersion?: string | null\n sourcePackage?: string | null\n sourceVersion?: string | null\n registryPath?: string | null\n registrySource?: string | null\n}\n\n/** A discovered module and the source directory its facts are extracted from. */\nexport interface ModuleFactSource {\n moduleId: string\n moduleRoot: string\n from?: string\n packageVersion?: string | null\n}\n\nfunction readSourceFile(filePath: string): ts.SourceFile | null {\n if (!fs.existsSync(filePath)) return null\n const source = fs.readFileSync(filePath, 'utf8')\n const scriptKind = filePath.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS\n return ts.createSourceFile(filePath, source, ts.ScriptTarget.ES2020, true, scriptKind)\n}\n\nfunction resolveConventionFile(baseDir: string, basename: string): string | null {\n for (const extension of ['.ts', '.tsx']) {\n const candidate = path.join(baseDir, `${basename}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nfunction readStringPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const name = ts.isIdentifier(property.name)\n ? property.name.text\n : ts.isStringLiteralLike(property.name)\n ? property.name.text\n : undefined\n if (name !== propertyName) continue\n if (ts.isStringLiteralLike(property.initializer)) return property.initializer.text\n return undefined\n }\n return undefined\n}\n\nfunction getClassDecoratorCall(node: ts.ClassDeclaration, decoratorName: string): ts.CallExpression | undefined {\n const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n if (ts.isIdentifier(expression.expression) && expression.expression.text === decoratorName) {\n return expression\n }\n }\n return undefined\n}\n\nfunction readDecoratorTableName(decoratorCall: ts.CallExpression): string | undefined {\n const firstArgument = decoratorCall.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) return undefined\n return readStringPropertyInitializer(firstArgument, 'tableName')\n}\n\nfunction getPropertyDecoratorName(member: ts.PropertyDeclaration): string | undefined {\n const decorators = ts.canHaveDecorators(member) ? ts.getDecorators(member) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n const firstArgument = expression.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) continue\n const columnName = readStringPropertyInitializer(firstArgument, 'name')\n if (columnName) return columnName\n }\n return undefined\n}\n\nfunction classHasUpdatedAtColumn(node: ts.ClassDeclaration): boolean {\n for (const member of node.members) {\n if (!ts.isPropertyDeclaration(member) || !member.name) continue\n const propertyName = ts.isIdentifier(member.name)\n ? member.name.text\n : ts.isStringLiteralLike(member.name)\n ? member.name.text\n : undefined\n if (propertyName === 'updatedAt') return true\n if (getPropertyDecoratorName(member) === 'updated_at') return true\n }\n return false\n}\n\nfunction collectCustomFieldEntityIds(ceFilePath: string | null): Set<string> {\n const result = new Set<string>()\n if (!ceFilePath) return result\n const sourceFile = readSourceFile(ceFilePath)\n if (!sourceFile) return result\n\n const readEntityId = (expression: ts.Expression): string | undefined => {\n const current = unwrapExpression(expression)\n if (ts.isStringLiteralLike(current)) {\n return current.text.includes(':') ? current.text : undefined\n }\n\n const readAccessPath = (candidate: ts.Expression): string[] | null => {\n const access = unwrapExpression(candidate)\n if (ts.isIdentifier(access)) return [access.text]\n if (ts.isPropertyAccessExpression(access)) {\n const parent = readAccessPath(access.expression)\n return parent ? [...parent, access.name.text] : null\n }\n if (ts.isElementAccessExpression(access) && access.argumentExpression) {\n const parent = readAccessPath(access.expression)\n const key = unwrapExpression(access.argumentExpression)\n return parent && ts.isStringLiteralLike(key) ? [...parent, key.text] : null\n }\n return null\n }\n\n const accessPath = readAccessPath(current)\n if (accessPath?.length === 3 && accessPath[0] === 'E') {\n return `${accessPath[1]}:${accessPath[2]}`\n }\n return undefined\n }\n\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node)) {\n const initializer = getObjectPropertyInitializer(node, 'id')\n if (initializer) {\n const id = readEntityId(initializer)\n if (id) result.add(id)\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEntities(\n moduleId: string,\n entitiesFilePath: string | null,\n customFieldEntityIds: Set<string>,\n): ModuleEntityFact[] {\n const sourceFile = entitiesFilePath ? readSourceFile(entitiesFilePath) : null\n if (!sourceFile) return []\n\n const facts: ModuleEntityFact[] = []\n sourceFile.forEachChild((node) => {\n if (!ts.isClassDeclaration(node) || !node.name) return\n const isExported = node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n if (!isExported) return\n const entityDecorator = getClassDecoratorCall(node, 'Entity')\n if (!entityDecorator) return\n\n const className = node.name.text\n const table = readDecoratorTableName(entityDecorator)\n if (!table) return\n\n const entityId = `${moduleId}:${toSnake(className)}`\n facts.push({\n id: entityId,\n class: className,\n table,\n editable: classHasUpdatedAtColumn(node),\n customFields: customFieldEntityIds.has(entityId),\n })\n })\n\n return facts\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression\n while (ts.isAsExpression(current) || ts.isParenthesizedExpression(current) || ts.isTypeAssertionExpression(current)) {\n current = current.expression\n }\n return current\n}\n\nfunction unwrapArrayLiteral(expression: ts.Expression): ts.ArrayLiteralExpression | null {\n const current = unwrapExpression(expression)\n return ts.isArrayLiteralExpression(current) ? current : null\n}\n\nfunction getPropertyName(property: ts.ObjectLiteralElementLike): string | undefined {\n if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) return undefined\n const name = property.name\n if (!name) return undefined\n if (ts.isIdentifier(name)) return name.text\n if (ts.isStringLiteralLike(name)) return name.text\n return undefined\n}\n\nfunction getObjectPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): ts.Expression | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n if (getPropertyName(property) === propertyName) return property.initializer\n }\n return undefined\n}\n\nfunction findObjectLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ObjectLiteralExpression | null {\n let result: ts.ObjectLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const unwrapped = unwrapExpression(node.initializer)\n if (ts.isObjectLiteralExpression(unwrapped)) {\n result = unwrapped\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction buildVariableInitializerMap(sourceFile: ts.SourceFile): Map<string, ts.Expression> {\n const initializers = new Map<string, ts.Expression>()\n const visit = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {\n if (!initializers.has(node.name.text)) initializers.set(node.name.text, node.initializer)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return initializers\n}\n\nfunction resolveToObjectLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ObjectLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isObjectLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToObjectLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction resolveToArrayLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ArrayLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isArrayLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToArrayLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction findDefaultExportExpression(sourceFile: ts.SourceFile): ts.Expression | null {\n for (const statement of sourceFile.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) return statement.expression\n }\n return null\n}\n\nfunction findArrayLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ArrayLiteralExpression | null {\n let result: ts.ArrayLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const arrayLiteral = unwrapArrayLiteral(node.initializer)\n if (arrayLiteral) {\n result = arrayLiteral\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEvents(eventsFilePath: string | null): ModuleEventFact[] {\n const sourceFile = eventsFilePath ? readSourceFile(eventsFilePath) : null\n if (!sourceFile) return []\n\n const eventsArray = findArrayLiteralDeclaration(sourceFile, 'events')\n if (!eventsArray) return []\n\n const facts: ModuleEventFact[] = []\n for (const element of eventsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const id = readStringPropertyInitializer(element, 'id')\n if (!id) continue\n const label = readStringPropertyInitializer(element, 'label')\n const category = readStringPropertyInitializer(element, 'category')\n const entity = readStringPropertyInitializer(element, 'entity')\n const fact: ModuleEventFact = {\n id,\n category: category ?? null,\n entity: entity ?? null,\n }\n const clientBroadcast = readBooleanPropertyInitializer(element, 'clientBroadcast')\n const portalBroadcast = readBooleanPropertyInitializer(element, 'portalBroadcast')\n if (label !== undefined) fact.label = label\n if (clientBroadcast !== undefined) fact.clientBroadcast = clientBroadcast\n if (portalBroadcast !== undefined) fact.portalBroadcast = portalBroadcast\n facts.push(fact)\n }\n\n return facts\n}\n\nfunction extractAclFeatures(aclFilePath: string | null): string[] {\n const sourceFile = aclFilePath ? readSourceFile(aclFilePath) : null\n if (!sourceFile) return []\n\n const featuresArray = findArrayLiteralDeclaration(sourceFile, 'features')\n if (!featuresArray) return []\n\n const featureIds: string[] = []\n const seen = new Set<string>()\n for (const element of featuresArray.elements) {\n let featureId: string | undefined\n if (ts.isObjectLiteralExpression(element)) {\n featureId = readStringPropertyInitializer(element, 'id')\n } else if (ts.isStringLiteralLike(element)) {\n featureId = element.text\n }\n if (!featureId || seen.has(featureId)) continue\n seen.add(featureId)\n featureIds.push(featureId)\n }\n\n return featureIds\n}\n\nfunction readBooleanPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): boolean | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n if (initializer.kind === ts.SyntaxKind.TrueKeyword) return true\n if (initializer.kind === ts.SyntaxKind.FalseKeyword) return false\n return undefined\n}\n\nfunction readStringArrayPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string[] | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n const arrayLiteral = unwrapArrayLiteral(initializer)\n if (!arrayLiteral) return undefined\n const values: string[] = []\n for (const element of arrayLiteral.elements) {\n if (ts.isStringLiteralLike(element)) values.push(element.text)\n }\n return values\n}\n\nfunction parseApiRouteAuthRule(metadataLiteral: ts.ObjectLiteralExpression): ApiRouteAuthRule {\n const rule: ApiRouteAuthRule = {}\n const requireAuth = readBooleanPropertyInitializer(metadataLiteral, 'requireAuth')\n if (requireAuth !== undefined) rule.requireAuth = requireAuth\n const requireFeatures = readStringArrayPropertyInitializer(metadataLiteral, 'requireFeatures')\n if (requireFeatures && requireFeatures.length > 0) rule.requireFeatures = requireFeatures\n const requireRoles = readStringArrayPropertyInitializer(metadataLiteral, 'requireRoles')\n if (requireRoles && requireRoles.length > 0) rule.requireRoles = requireRoles\n return rule\n}\n\nfunction parseApiRouteEntry(entryLiteral: ts.ObjectLiteralExpression): ModuleApiRouteFact | null {\n const routePath = readStringPropertyInitializer(entryLiteral, 'path')\n if (!routePath) return null\n\n const methods: string[] = []\n const seenMethods = new Set<string>()\n const handlersInitializer = getObjectPropertyInitializer(entryLiteral, 'handlers')\n if (handlersInitializer && ts.isObjectLiteralExpression(handlersInitializer)) {\n for (const property of handlersInitializer.properties) {\n const methodName = getPropertyName(property)\n if (methodName && !seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n } else {\n const singleMethod = readStringPropertyInitializer(entryLiteral, 'method')\n if (singleMethod && !seenMethods.has(singleMethod)) {\n seenMethods.add(singleMethod)\n methods.push(singleMethod)\n }\n }\n\n const auth: Record<string, ApiRouteAuthRule> = {}\n const metadataInitializer = getObjectPropertyInitializer(entryLiteral, 'metadata')\n if (metadataInitializer && ts.isObjectLiteralExpression(metadataInitializer)) {\n for (const property of metadataInitializer.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const methodName = getPropertyName(property)\n if (!methodName) continue\n const methodMetadata = unwrapExpression(property.initializer)\n if (!ts.isObjectLiteralExpression(methodMetadata)) continue\n auth[methodName] = parseApiRouteAuthRule(methodMetadata)\n if (!seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n }\n\n return { path: routePath, methods, auth, sourcePath: null }\n}\n\nfunction extractApiRoutes(\n moduleId: string,\n registrySource: string | null,\n registryDescription: string,\n routeSourcePaths: ReadonlyMap<string, string>,\n warnings: string[],\n): ModuleApiRouteFact[] {\n if (registrySource == null) {\n warnings.push(`[module-facts] module registry unavailable (${registryDescription}); API route auth omitted for ${moduleId}`)\n return []\n }\n\n const sourceFile = ts.createSourceFile(\n 'module-registry.generated.ts',\n registrySource,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS,\n )\n\n const routes: ModuleApiRouteFact[] = []\n const seenPaths = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node) && readStringPropertyInitializer(node, 'id') === moduleId) {\n const apisInitializer = getObjectPropertyInitializer(node, 'apis')\n const apisArray = apisInitializer ? unwrapArrayLiteral(apisInitializer) : null\n if (apisArray) {\n for (const element of apisArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const route = parseApiRouteEntry(element)\n if (route && !seenPaths.has(route.path)) {\n seenPaths.add(route.path)\n routes.push({ ...route, sourcePath: routeSourcePaths.get(route.path) ?? null })\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return routes\n}\n\nfunction resolveRegistrySource(options: ExtractModuleFactsOptions): { source: string | null; description: string } {\n if (typeof options.registrySource === 'string') {\n return { source: options.registrySource, description: 'registrySource' }\n }\n if (options.registryPath) {\n if (!fs.existsSync(options.registryPath)) {\n return { source: null, description: options.registryPath }\n }\n return { source: fs.readFileSync(options.registryPath, 'utf8'), description: options.registryPath }\n }\n return { source: null, description: 'registryPath not provided' }\n}\n\nfunction detectAwilixRegistrationKind(expression: ts.Expression): string | null {\n let current: ts.Expression = unwrapExpression(expression)\n while (ts.isCallExpression(current)) {\n const callee = current.expression\n if (ts.isIdentifier(callee)) return callee.text\n if (ts.isPropertyAccessExpression(callee)) {\n current = callee.expression\n continue\n }\n break\n }\n return null\n}\n\nfunction extractDiTokens(diFilePath: string | null): string[] {\n if (!diFilePath) return []\n const sourceFile = readSourceFile(diFilePath)\n if (!sourceFile) return []\n\n const tokens: string[] = []\n const seen = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'register'\n ) {\n const argument = node.arguments[0]\n if (argument && ts.isObjectLiteralExpression(argument)) {\n for (const property of argument.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const kind = detectAwilixRegistrationKind(property.initializer)\n if (kind !== 'asFunction' && kind !== 'asClass') continue\n const tokenName = getPropertyName(property)\n if (tokenName && !seen.has(tokenName)) {\n seen.add(tokenName)\n tokens.push(tokenName)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return tokens\n}\n\nfunction extractSearchEntities(searchFilePath: string | null, warnings: string[]): string[] {\n if (!searchFilePath) return []\n const sourceFile = readSourceFile(searchFilePath)\n if (!sourceFile) return []\n\n const searchConfig = findObjectLiteralDeclaration(sourceFile, 'searchConfig')\n if (!searchConfig) {\n warnings.push(`[module-facts] search.ts present but no searchConfig object literal: ${searchFilePath}`)\n return []\n }\n const entitiesInitializer = getObjectPropertyInitializer(searchConfig, 'entities')\n const entitiesArray = entitiesInitializer ? unwrapArrayLiteral(entitiesInitializer) : null\n if (!entitiesArray) {\n warnings.push(`[module-facts] searchConfig.entities is not an array literal: ${searchFilePath}`)\n return []\n }\n\n const entityIds: string[] = []\n const seen = new Set<string>()\n for (const element of entitiesArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const entityId = readStringPropertyInitializer(element, 'entityId')\n if (entityId && !seen.has(entityId)) {\n seen.add(entityId)\n entityIds.push(entityId)\n }\n }\n return entityIds\n}\n\nfunction extractNotifications(notificationsFilePath: string | null, warnings: string[]): string[] {\n if (!notificationsFilePath) return []\n const sourceFile = readSourceFile(notificationsFilePath)\n if (!sourceFile) return []\n\n const notificationsArray =\n findArrayLiteralDeclaration(sourceFile, 'notificationTypes') ??\n findArrayLiteralDeclaration(sourceFile, 'notifications')\n if (!notificationsArray) {\n warnings.push(`[module-facts] notifications.ts present but no notificationTypes array literal: ${notificationsFilePath}`)\n return []\n }\n\n const notificationIds: string[] = []\n const seen = new Set<string>()\n for (const element of notificationsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const notificationId = readStringPropertyInitializer(element, 'type')\n if (notificationId && !seen.has(notificationId)) {\n seen.add(notificationId)\n notificationIds.push(notificationId)\n }\n }\n return notificationIds\n}\n\nfunction extractCli(cliFilePath: string | null, warnings: string[]): string[] {\n if (!cliFilePath) return []\n const sourceFile = readSourceFile(cliFilePath)\n if (!sourceFile) return []\n\n const defaultExport = findDefaultExportExpression(sourceFile)\n if (!defaultExport) {\n warnings.push(`[module-facts] cli.ts present but no default export: ${cliFilePath}`)\n return []\n }\n\n const initializers = buildVariableInitializerMap(sourceFile)\n const collectCommand = (objectLiteral: ts.ObjectLiteralExpression): string | undefined =>\n readStringPropertyInitializer(objectLiteral, 'command')\n\n const commands: string[] = []\n const seen = new Set<string>()\n const pushCommand = (command: string | undefined): void => {\n if (command && !seen.has(command)) {\n seen.add(command)\n commands.push(command)\n }\n }\n\n const arrayLiteral = resolveToArrayLiteral(defaultExport, initializers)\n if (arrayLiteral) {\n for (const element of arrayLiteral.elements) {\n const objectLiteral = resolveToObjectLiteral(element, initializers)\n if (objectLiteral) pushCommand(collectCommand(objectLiteral))\n }\n return commands\n }\n\n const singleObject = resolveToObjectLiteral(defaultExport, initializers)\n if (singleObject) {\n pushCommand(collectCommand(singleObject))\n return commands\n }\n\n warnings.push(`[module-facts] cli.ts default export is neither an array nor an object literal: ${cliFilePath}`)\n return commands\n}\n\nfunction listSourceFilesRecursive(directory: string): string[] {\n const files: string[] = []\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.name === '__tests__' || entry.name === '__mocks__' || entry.name === 'node_modules') continue\n const fullPath = path.join(directory, entry.name)\n if (entry.isDirectory()) {\n files.push(...listSourceFilesRecursive(fullPath))\n } else if (\n /\\.tsx?$/.test(entry.name)\n && !entry.name.endsWith('.d.ts')\n && !/\\.(?:test|spec)\\.tsx?$/.test(entry.name)\n ) {\n files.push(fullPath)\n }\n }\n return files\n}\n\nfunction toPortableSourceRoot(moduleId: string, sourcePackage: string | null): string {\n return path.posix.join('node_modules', sourcePackage ?? '@open-mercato/core', 'src', 'modules', moduleId)\n}\n\nfunction toPortableSourcePath(moduleRoot: string, sourceRoot: string, filePath: string): string {\n const relativePath = path.relative(moduleRoot, filePath).split(path.sep).join('/')\n return path.posix.join(sourceRoot, relativePath)\n}\n\nfunction sourceHasDefaultExport(sourceFile: ts.SourceFile): boolean {\n return sourceFile.statements.some((statement) => {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) return true\n if (!ts.isFunctionDeclaration(statement) && !ts.isClassDeclaration(statement)) return false\n return statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword) ?? false\n })\n}\n\nfunction readRouteMetadataPath(sourceFile: ts.SourceFile): string | null {\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n return metadata ? readStringPropertyInitializer(metadata, 'path') ?? null : null\n}\n\nfunction extractApiRouteSourcePaths(\n moduleId: string,\n moduleRoot: string,\n sourceRoot: string,\n): Map<string, string> {\n const apiRoot = path.join(moduleRoot, 'api')\n const sources = new Map<string, string>()\n if (!fs.existsSync(apiRoot)) return sources\n const methodDirectories = new Set(['get', 'post', 'put', 'patch', 'delete'])\n\n for (const filePath of listSourceFilesRecursive(apiRoot)) {\n const relativePath = path.relative(apiRoot, filePath).split(path.sep).join('/')\n const segments = relativePath.split('/')\n const fileName = segments.pop() as string\n const fileStem = fileName.replace(/\\.tsx?$/, '')\n let routeSegments: string[]\n if (fileStem === 'route') {\n routeSegments = segments\n } else if (segments[0] && methodDirectories.has(segments[0].toLowerCase())) {\n routeSegments = [...segments.slice(1), fileStem]\n } else {\n routeSegments = [...segments, fileStem]\n }\n const defaultPath = `/${[moduleId, ...routeSegments].filter(Boolean).join('/')}`\n const sourceFile = readSourceFile(filePath)\n const routePath = sourceFile ? readRouteMetadataPath(sourceFile) ?? defaultPath : defaultPath\n sources.set(routePath, toPortableSourcePath(moduleRoot, sourceRoot, filePath))\n }\n return sources\n}\n\nfunction extractModulePages(\n moduleId: string,\n moduleRoot: string,\n sourceRoot: string,\n surface: 'backend' | 'frontend',\n): ModulePageFact[] {\n const pageRoot = path.join(moduleRoot, surface)\n if (!fs.existsSync(pageRoot)) return []\n const pages: ModulePageFact[] = []\n const seen = new Set<string>()\n\n for (const filePath of listSourceFilesRecursive(pageRoot)) {\n if (!filePath.endsWith('.tsx')) continue\n const relativePath = path.relative(pageRoot, filePath).split(path.sep).join('/')\n const segments = relativePath.split('/')\n const fileName = segments.pop() as string\n const fileStem = fileName.replace(/\\.tsx$/, '')\n const isModernPage = fileStem === 'page'\n if (!isModernPage && (fileStem === 'meta' || fileStem.endsWith('.meta') || /^[A-Z]/.test(fileStem))) continue\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile || !sourceHasDefaultExport(sourceFile)) continue\n const routeSegments = isModernPage ? segments : [...segments, fileStem]\n const routePath = surface === 'frontend'\n ? `/${routeSegments.filter(Boolean).join('/')}`\n : isModernPage\n ? `/backend/${routeSegments.join('/') || moduleId}`\n : `/backend/${routeSegments[0] === moduleId\n ? routeSegments.filter(Boolean).join('/')\n : [moduleId, ...routeSegments].filter(Boolean).join('/')}`\n if (seen.has(routePath)) continue\n seen.add(routePath)\n const metadataFilePath = resolvePageMetadataFile(path.dirname(filePath))\n const metadataSourceFile = metadataFilePath ? readSourceFile(metadataFilePath) : sourceFile\n const metadata = metadataSourceFile ? readPageMetadata(metadataSourceFile) : undefined\n pages.push({\n path: routePath,\n sourcePath: toPortableSourcePath(moduleRoot, sourceRoot, filePath),\n ...(metadataFilePath\n ? { metadataSourcePath: toPortableSourcePath(moduleRoot, sourceRoot, metadataFilePath) }\n : {}),\n ...(metadata ? { metadata } : {}),\n })\n }\n return pages.sort((left, right) => left.path.localeCompare(right.path))\n}\n\nfunction findAncestorVariableDeclaration(node: ts.Node): ts.VariableDeclaration | null {\n let current: ts.Node | undefined = node.parent\n while (current) {\n if (ts.isVariableDeclaration(current)) return current\n current = current.parent\n }\n return null\n}\n\nfunction findAncestorCallExpression(node: ts.Node): ts.CallExpression | null {\n let current: ts.Node | undefined = node.parent\n while (current) {\n if (ts.isCallExpression(current)) return current\n if (ts.isVariableDeclaration(current) || ts.isStatement(current)) return null\n current = current.parent\n }\n return null\n}\n\nfunction extractNamedAiFacts(\n filePaths: readonly string[],\n moduleRoot: string,\n sourceRoot: string,\n propertyName: 'name' | 'id',\n): Array<{ value: string; sourcePath: string }> {\n const facts: Array<{ value: string; sourcePath: string }> = []\n const seen = new Set<string>()\n for (const filePath of filePaths) {\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const initializers = buildVariableInitializerMap(sourceFile)\n const readDefinitionValue = (objectLiteral: ts.ObjectLiteralExpression): string | undefined => {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n const resolved = unwrapExpression(initializer)\n if (ts.isStringLiteralLike(resolved)) return resolved.text\n if (ts.isIdentifier(resolved)) {\n const declarationInitializer = initializers.get(resolved.text)\n if (declarationInitializer) {\n const declarationValue = unwrapExpression(declarationInitializer)\n if (ts.isStringLiteralLike(declarationValue)) return declarationValue.text\n }\n }\n return undefined\n }\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node)) {\n const value = readDefinitionValue(node)\n if (value && !seen.has(value)) {\n const declaration = findAncestorVariableDeclaration(node)\n const declarationName = declaration && ts.isIdentifier(declaration.name) ? declaration.name.text : ''\n const declarationType = declaration?.type?.getText(sourceFile) ?? ''\n const call = findAncestorCallExpression(node)\n const callee = call?.expression.getText(sourceFile) ?? ''\n const isDefinition = propertyName === 'name'\n ? /AiTool/.test(declarationType) || /tool$/i.test(declarationName) || /AiTool/.test(callee)\n : /AiAgentDefinition/.test(declarationType) || /agent$/i.test(declarationName) || /defineAiAgent/.test(callee)\n if (isDefinition) {\n seen.add(value)\n facts.push({\n value,\n sourcePath: toPortableSourcePath(moduleRoot, sourceRoot, filePath),\n })\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n }\n return facts.sort((left, right) => left.value.localeCompare(right.value))\n}\n\nfunction extractAiTools(moduleRoot: string, sourceRoot: string): ModuleAiToolFact[] {\n const files = new Set<string>()\n const rootFile = resolveConventionFile(moduleRoot, 'ai-tools')\n if (rootFile) files.add(rootFile)\n const toolsDirectory = path.join(moduleRoot, 'ai-tools')\n if (fs.existsSync(toolsDirectory)) {\n for (const filePath of listSourceFilesRecursive(toolsDirectory)) files.add(filePath)\n }\n return extractNamedAiFacts([...files], moduleRoot, sourceRoot, 'name')\n .map((fact) => ({ name: fact.value, sourcePath: fact.sourcePath }))\n}\n\nfunction extractAiAgents(moduleRoot: string, sourceRoot: string): ModuleAiAgentFact[] {\n const agentsFile = resolveConventionFile(moduleRoot, 'ai-agents')\n if (!agentsFile) return []\n return extractNamedAiFacts([agentsFile], moduleRoot, sourceRoot, 'id')\n .map((fact) => ({ id: fact.value, sourcePath: fact.sourcePath }))\n}\n\nfunction extractTableIds(moduleRoot: string): string[] {\n if (!fs.existsSync(moduleRoot)) return []\n\n const tableIds: string[] = []\n const seen = new Set<string>()\n const collectLiteralValues = (expression: ts.Expression): string[] => {\n const current = unwrapExpression(expression)\n if (ts.isStringLiteralLike(current)) return [current.text]\n if (ts.isConditionalExpression(current)) {\n return [\n ...collectLiteralValues(current.whenTrue),\n ...collectLiteralValues(current.whenFalse),\n ]\n }\n return []\n }\n\n for (const filePath of listSourceFilesRecursive(moduleRoot)) {\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAssignment(node)) {\n const propertyName = getPropertyName(node)\n if (propertyName === 'tableId' || propertyName === 'extensionTableId') {\n for (const value of collectLiteralValues(node.initializer)) {\n if (value && !seen.has(value)) {\n seen.add(value)\n tableIds.push(value)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n }\n tableIds.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))\n return tableIds\n}\n\nfunction extractHostEntityIds(entities: ModuleEntityFact[]): string[] {\n return entities.filter((entity) => entity.id.endsWith('_entity')).map((entity) => entity.id)\n}\n\nfunction extractModuleMeta(indexFilePath: string | null): { title: string | null; description: string | null } {\n if (!indexFilePath) return { title: null, description: null }\n const sourceFile = readSourceFile(indexFilePath)\n if (!sourceFile) return { title: null, description: null }\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) return { title: null, description: null }\n return {\n title: readStringPropertyInitializer(metadata, 'title') ?? null,\n description: readStringPropertyInitializer(metadata, 'description') ?? null,\n }\n}\n\nfunction nodeLine(sourceFile: ts.SourceFile, node: ts.Node): number {\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1\n}\n\nfunction readPropertyNameText(name: ts.PropertyName): string | undefined {\n if (ts.isIdentifier(name) || ts.isStringLiteralLike(name)) return name.text\n return undefined\n}\n\nfunction readMethodBearingPropertyNames(objectLiteral: ts.ObjectLiteralExpression): string[] {\n const names: string[] = []\n for (const property of objectLiteral.properties) {\n if (ts.isMethodDeclaration(property)) {\n const name = readPropertyNameText(property.name)\n if (name) names.push(name)\n continue\n }\n if (ts.isPropertyAssignment(property)) {\n const name = readPropertyNameText(property.name)\n if (!name) continue\n const initializer = unwrapExpression(property.initializer)\n if (ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer)) names.push(name)\n }\n }\n return names.sort((left, right) => left.localeCompare(right))\n}\n\nfunction readObjectKeyNames(objectLiteral: ts.ObjectLiteralExpression): string[] {\n const names: string[] = []\n for (const property of objectLiteral.properties) {\n const name = getPropertyName(property)\n if (name) names.push(name)\n }\n return names.sort((left, right) => left.localeCompare(right))\n}\n\nfunction mapDiRegistrationKind(base: string | null): ModuleDiRegistrationFact['registrationKind'] | null {\n switch (base) {\n case 'asFunction':\n return 'function'\n case 'asClass':\n return 'class'\n case 'asValue':\n return 'value'\n case 'aliasTo':\n return 'alias'\n default:\n return null\n }\n}\n\nfunction readDiChainMetadata(initializer: ts.Expression): {\n lifetime?: ModuleDiRegistrationFact['lifetime']\n injectionMode?: ModuleDiRegistrationFact['injectionMode']\n} {\n const result: {\n lifetime?: ModuleDiRegistrationFact['lifetime']\n injectionMode?: ModuleDiRegistrationFact['injectionMode']\n } = {}\n let current: ts.Expression = unwrapExpression(initializer)\n while (ts.isCallExpression(current) && ts.isPropertyAccessExpression(current.expression)) {\n const method = current.expression.name.text\n if ((method === 'singleton' || method === 'scoped' || method === 'transient') && !result.lifetime) {\n result.lifetime = method\n } else if (method === 'proxy' && !result.injectionMode) {\n result.injectionMode = 'proxy'\n } else if (method === 'classic' && !result.injectionMode) {\n result.injectionMode = 'classic'\n }\n current = unwrapExpression(current.expression.expression)\n }\n return result\n}\n\nfunction readDiProviderSymbol(\n initializer: ts.Expression,\n kind: ModuleDiRegistrationFact['registrationKind'],\n): string | undefined {\n let current: ts.Expression = unwrapExpression(initializer)\n while (ts.isCallExpression(current) && ts.isPropertyAccessExpression(current.expression)) {\n current = unwrapExpression(current.expression.expression)\n }\n if (!ts.isCallExpression(current)) return undefined\n const argument = current.arguments[0]\n if (!argument) return undefined\n if (kind === 'value') return undefined\n if (kind === 'alias' && ts.isStringLiteralLike(argument)) return argument.text\n if ((kind === 'function' || kind === 'class') && ts.isIdentifier(argument)) return argument.text\n return undefined\n}\n\nfunction extractDiRegistrationFacts(\n diFilePath: string | null,\n sourcePath: string,\n): { facts: ModuleDiRegistrationFact[]; unresolvedTokens: string[] } {\n if (!diFilePath) return { facts: [], unresolvedTokens: [] }\n const sourceFile = readSourceFile(diFilePath)\n if (!sourceFile) return { facts: [], unresolvedTokens: [] }\n\n const facts: ModuleDiRegistrationFact[] = []\n const unresolvedTokens: string[] = []\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'register'\n ) {\n const argument = node.arguments[0]\n if (argument && ts.isObjectLiteralExpression(argument)) {\n for (const property of argument.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const token = getPropertyName(property)\n if (!token) continue\n const kind = mapDiRegistrationKind(detectAwilixRegistrationKind(property.initializer))\n if (!kind) {\n if (!unresolvedTokens.includes(token)) unresolvedTokens.push(token)\n continue\n }\n const chain = readDiChainMetadata(property.initializer)\n const providerSymbol = readDiProviderSymbol(property.initializer, kind)\n facts.push({\n token,\n registrationKind: kind,\n ...(providerSymbol ? { providerSymbol } : {}),\n ...(chain.lifetime ? { lifetime: chain.lifetime } : {}),\n ...(chain.injectionMode ? { injectionMode: chain.injectionMode } : {}),\n source: { sourcePath, exportName: token, line: nodeLine(sourceFile, property) },\n })\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return { facts, unresolvedTokens }\n}\n\nfunction deriveLegacyDiTokens(facts: readonly ModuleDiRegistrationFact[]): string[] {\n const tokens: string[] = []\n const seen = new Set<string>()\n for (const fact of facts) {\n if (fact.registrationKind !== 'function' && fact.registrationKind !== 'class') continue\n if (seen.has(fact.token)) continue\n seen.add(fact.token)\n tokens.push(fact.token)\n }\n return tokens\n}\n\nfunction dedupeOwnedContractFacts(facts: readonly ModuleOwnedContractFact[]): ModuleOwnedContractFact[] {\n const byId = new Map<string, ModuleOwnedContractFact>()\n for (const fact of facts) {\n const existing = byId.get(fact.id)\n if (!existing) {\n byId.set(fact.id, fact)\n continue\n }\n if (fact.source.sourcePath.localeCompare(existing.source.sourcePath) < 0) byId.set(fact.id, fact)\n }\n return [...byId.values()].sort((left, right) => left.id.localeCompare(right.id))\n}\n\nconst PAGE_CONTEXT_VALUES = new Set(['main', 'admin', 'settings', 'profile'])\n\nfunction readAliasedStringProperty(\n metadata: ts.ObjectLiteralExpression,\n preferred: string,\n fallback: string,\n): string | undefined {\n return readStringPropertyInitializer(metadata, preferred) ?? readStringPropertyInitializer(metadata, fallback)\n}\n\nfunction readNumericProperty(metadata: ts.ObjectLiteralExpression, propertyName: string): number | undefined {\n const initializer = getObjectPropertyInitializer(metadata, propertyName)\n if (!initializer || !ts.isNumericLiteral(initializer)) return undefined\n return Number(initializer.text)\n}\n\nfunction readPageMetadata(sourceFile: ts.SourceFile): ModulePageMetadata | undefined {\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) return undefined\n const result: ModulePageMetadata = {}\n const requireAuth = readBooleanPropertyInitializer(metadata, 'requireAuth')\n if (requireAuth !== undefined) result.requireAuth = requireAuth\n const requireCustomerAuth = readBooleanPropertyInitializer(metadata, 'requireCustomerAuth')\n if (requireCustomerAuth !== undefined) result.requireCustomerAuth = requireCustomerAuth\n const requireFeatures = readStringArrayPropertyInitializer(metadata, 'requireFeatures')\n if (requireFeatures && requireFeatures.length > 0) result.requireFeatures = requireFeatures\n const requireCustomerFeatures = readStringArrayPropertyInitializer(metadata, 'requireCustomerFeatures')\n if (requireCustomerFeatures && requireCustomerFeatures.length > 0) {\n result.requireCustomerFeatures = requireCustomerFeatures\n }\n const navHidden = readBooleanPropertyInitializer(metadata, 'navHidden')\n if (navHidden !== undefined) result.navHidden = navHidden\n const navGroup = readAliasedStringProperty(metadata, 'pageGroup', 'group')\n if (navGroup) result.navGroup = navGroup\n const navGroupKey = readAliasedStringProperty(metadata, 'pageGroupKey', 'groupKey')\n if (navGroupKey) result.navGroupKey = navGroupKey\n const navOrder = readNumericProperty(metadata, 'pageOrder') ?? readNumericProperty(metadata, 'order')\n if (navOrder !== undefined) result.navOrder = navOrder\n const pageContext = readStringPropertyInitializer(metadata, 'pageContext')\n if (pageContext && PAGE_CONTEXT_VALUES.has(pageContext)) {\n result.pageContext = pageContext as ModulePageMetadata['pageContext']\n }\n return Object.keys(result).length > 0 ? result : undefined\n}\n\n/**\n * Mirrors the runtime companion-file convention: a page's metadata comes from\n * `page.meta.*` (or `meta.*`) in the page directory when one exists, and only\n * otherwise from the page component itself.\n */\nfunction resolvePageMetadataFile(pageDirectory: string): string | null {\n for (const baseName of ['page.meta', 'meta']) {\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const candidate = path.join(pageDirectory, `${baseName}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n }\n return null\n}\n\nfunction extractModuleMetadataContract(\n indexFilePath: string | null,\n moduleId: string,\n sourcePath: string | null,\n): ModuleOwnedContractFact | null {\n if (!indexFilePath || !sourcePath) return null\n const sourceFile = readSourceFile(indexFilePath)\n if (!sourceFile) return null\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) return null\n const facts: Record<string, ModuleFactSafeScalar | ModuleFactSafeScalar[]> = {}\n const name = readStringPropertyInitializer(metadata, 'name')\n if (name) facts.name = name\n const version = readStringPropertyInitializer(metadata, 'version')\n if (version) facts.version = version\n const requires = readStringArrayPropertyInitializer(metadata, 'requires')\n if (requires && requires.length > 0) facts.requires = requires\n const ejectable = readBooleanPropertyInitializer(metadata, 'ejectable')\n if (ejectable !== undefined) facts.ejectable = ejectable\n return {\n kind: 'module-metadata',\n id: moduleId,\n source: { sourcePath, exportName: 'metadata', line: nodeLine(sourceFile, metadata) },\n ...(Object.keys(facts).length > 0 ? { metadata: facts } : {}),\n }\n}\n\nfunction extractCommandContractCandidates(\n moduleId: string,\n moduleRoot: string,\n sourceRoot: string,\n): Array<{ id: string; sourcePath: string }> {\n const commandsRoot = path.join(moduleRoot, 'commands')\n if (!fs.existsSync(commandsRoot)) return []\n const candidates: Array<{ id: string; sourcePath: string }> = []\n for (const filePath of listSourceFilesRecursive(commandsRoot)) {\n if (path.basename(filePath).replace(/\\.tsx?$/, '') === 'interceptors') continue\n const sourcePath = toPortableSourcePath(moduleRoot, sourceRoot, filePath)\n for (const id of extractCommandIdsFromSource(filePath)) candidates.push({ id, sourcePath })\n }\n return candidates\n}\n\n/**\n * Runtime worker id: `metadata.id` when declared, otherwise the path-derived\n * `<moduleId>:workers:<...segments>:<fileStem>` that `discoverWorkers` builds.\n */\nfunction deriveWorkerId(moduleId: string, workersRoot: string, filePath: string): string {\n const relativePath = path.relative(workersRoot, filePath).split(path.sep).join('/')\n const segments = relativePath.split('/')\n const fileName = segments.pop() as string\n const fileStem = fileName.replace(/\\.tsx?$/, '')\n return [moduleId, 'workers', ...segments, fileStem].filter(Boolean).join(':')\n}\n\n/** Resolves a string property directly or through a local `const` in the same file. */\nfunction readResolvedStringProperty(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n initializers: Map<string, ts.Expression>,\n): string | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n const resolved = unwrapExpression(initializer)\n if (ts.isStringLiteralLike(resolved)) return resolved.text\n if (ts.isIdentifier(resolved)) {\n const declaration = initializers.get(resolved.text)\n if (declaration) {\n const declarationValue = unwrapExpression(declaration)\n if (ts.isStringLiteralLike(declarationValue)) return declarationValue.text\n }\n }\n return undefined\n}\n\nfunction extractWorkerContracts(\n moduleId: string,\n moduleRoot: string,\n sourceRoot: string,\n): { facts: ModuleOwnedContractFact[]; unresolved: ModuleFactDiagnostic[] } {\n const workersRoot = path.join(moduleRoot, 'workers')\n if (!fs.existsSync(workersRoot)) return { facts: [], unresolved: [] }\n const facts: ModuleOwnedContractFact[] = []\n const unresolved: ModuleFactDiagnostic[] = []\n for (const filePath of listSourceFilesRecursive(workersRoot)) {\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) continue\n const sourcePath = toPortableSourcePath(moduleRoot, sourceRoot, filePath)\n const source = { sourcePath, exportName: 'metadata', line: nodeLine(sourceFile, metadata) }\n const initializers = buildVariableInitializerMap(sourceFile)\n const workerId = readResolvedStringProperty(metadata, 'id', initializers)\n ?? deriveWorkerId(moduleId, workersRoot, filePath)\n\n // Runtime skips any worker without a queue, so a worker missing the required\n // property is not a contract; a present-but-dynamic queue is reported instead.\n const hasQueueProperty = getObjectPropertyInitializer(metadata, 'queue') !== undefined\n const queue = readResolvedStringProperty(metadata, 'queue', initializers)\n if (!hasQueueProperty) {\n unresolved.push({ code: 'unresolved-static-contract', kind: 'worker', id: workerId, source })\n continue\n }\n\n const workerMetadata: Record<string, ModuleFactSafeScalar | ModuleFactSafeScalar[]> = {}\n if (queue) workerMetadata.queue = queue\n else unresolved.push({ code: 'unresolved-static-contract', kind: 'worker', id: workerId, source })\n const name = readResolvedStringProperty(metadata, 'name', initializers)\n if (name) workerMetadata.name = name\n const concurrencyInitializer = getObjectPropertyInitializer(metadata, 'concurrency')\n if (concurrencyInitializer && ts.isNumericLiteral(concurrencyInitializer)) {\n workerMetadata.concurrency = Number(concurrencyInitializer.text)\n }\n facts.push({\n kind: 'worker',\n id: workerId,\n source,\n ...(Object.keys(workerMetadata).length > 0 ? { metadata: workerMetadata } : {}),\n })\n }\n return { facts: dedupeOwnedContractFacts(facts), unresolved }\n}\n\nfunction extractPageMiddlewareContracts(\n moduleRoot: string,\n sourceRoot: string,\n): { facts: ModuleOwnedContractFact[]; unresolved: ModuleFactDiagnostic[] } {\n const facts: ModuleOwnedContractFact[] = []\n const unresolved: ModuleFactDiagnostic[] = []\n for (const surface of ['backend', 'frontend'] as const) {\n const filePath = resolveConventionFile(path.join(moduleRoot, surface), 'middleware')\n if (!filePath) continue\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const sourcePath = toPortableSourcePath(moduleRoot, sourceRoot, filePath)\n const middlewareArray =\n findArrayLiteralDeclaration(sourceFile, 'middleware') ??\n (() => {\n const defaultExport = findDefaultExportExpression(sourceFile)\n return defaultExport ? unwrapArrayLiteral(defaultExport) : null\n })()\n if (!middlewareArray) continue\n let index = 0\n for (const element of middlewareArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const middlewareId = readStringPropertyInitializer(element, 'id')\n if (!middlewareId) {\n unresolved.push({\n code: 'unresolved-static-contract',\n kind: 'page-middleware',\n id: `${sourcePath}#${index}`,\n source: { sourcePath, line: nodeLine(sourceFile, element) },\n })\n index += 1\n continue\n }\n const metadata: Record<string, ModuleFactSafeScalar | ModuleFactSafeScalar[]> = { surface }\n const mode = readStringPropertyInitializer(element, 'mode')\n if (mode) metadata.mode = mode\n const priorityInitializer = getObjectPropertyInitializer(element, 'priority')\n if (priorityInitializer && ts.isNumericLiteral(priorityInitializer)) {\n metadata.priority = Number(priorityInitializer.text)\n }\n facts.push({\n kind: 'page-middleware',\n id: middlewareId,\n source: { sourcePath, exportName: 'middleware', line: nodeLine(sourceFile, element) },\n metadata,\n })\n index += 1\n }\n }\n return { facts: dedupeOwnedContractFacts(facts), unresolved }\n}\n\nfunction extractSetupContract(\n moduleId: string,\n setupFilePath: string | null,\n sourcePath: string | null,\n): ModuleOwnedContractFact | null {\n if (!setupFilePath || !sourcePath) return null\n const sourceFile = readSourceFile(setupFilePath)\n if (!sourceFile) return null\n const setupObject =\n findObjectLiteralDeclaration(sourceFile, 'setup') ??\n (() => {\n const defaultExport = findDefaultExportExpression(sourceFile)\n if (!defaultExport) return null\n const unwrapped = unwrapExpression(defaultExport)\n return ts.isObjectLiteralExpression(unwrapped) ? unwrapped : null\n })()\n if (!setupObject) return null\n const hooks = readMethodBearingPropertyNames(setupObject)\n const metadata: Record<string, ModuleFactSafeScalar | ModuleFactSafeScalar[]> = {}\n if (hooks.length > 0) metadata.hooks = hooks\n const roleFeatures = getObjectPropertyInitializer(setupObject, 'defaultRoleFeatures')\n if (roleFeatures && ts.isObjectLiteralExpression(roleFeatures)) {\n const roles = readObjectKeyNames(roleFeatures)\n if (roles.length > 0) metadata.roles = roles\n }\n const customerRoleFeatures = getObjectPropertyInitializer(setupObject, 'defaultCustomerRoleFeatures')\n if (customerRoleFeatures && ts.isObjectLiteralExpression(customerRoleFeatures)) {\n const customerRoles = readObjectKeyNames(customerRoleFeatures)\n if (customerRoles.length > 0) metadata.customerRoles = customerRoles\n }\n return {\n kind: 'setup',\n id: `${moduleId}:setup`,\n source: { sourcePath, exportName: 'setup', line: nodeLine(sourceFile, setupObject) },\n ...(Object.keys(metadata).length > 0 ? { metadata } : {}),\n }\n}\n\nfunction extractEncryptionContracts(\n encryptionFilePath: string | null,\n sourcePath: string | null,\n): ModuleOwnedContractFact[] {\n if (!encryptionFilePath || !sourcePath) return []\n const sourceFile = readSourceFile(encryptionFilePath)\n if (!sourceFile) return []\n const mapsArray =\n findArrayLiteralDeclaration(sourceFile, 'defaultEncryptionMaps') ??\n findArrayLiteralDeclaration(sourceFile, 'encryptionMaps')\n if (!mapsArray) return []\n const facts: ModuleOwnedContractFact[] = []\n for (const element of mapsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const entityId = readStringPropertyInitializer(element, 'entityId')\n if (!entityId) continue\n const fieldsInitializer = getObjectPropertyInitializer(element, 'fields')\n const fields: string[] = []\n if (fieldsInitializer) {\n const fieldsArray = unwrapArrayLiteral(fieldsInitializer)\n if (fieldsArray) {\n for (const fieldElement of fieldsArray.elements) {\n if (!ts.isObjectLiteralExpression(fieldElement)) continue\n const field = readStringPropertyInitializer(fieldElement, 'field')\n if (field) fields.push(field)\n }\n }\n }\n facts.push({\n kind: 'encryption',\n id: entityId,\n source: { sourcePath, exportName: 'defaultEncryptionMaps', line: nodeLine(sourceFile, element) },\n ...(fields.length > 0 ? { metadata: { fields: fields.sort((left, right) => left.localeCompare(right)) } } : {}),\n })\n }\n return dedupeOwnedContractFacts(facts)\n}\n\nfunction extractCustomEntityContracts(\n ceFilePath: string | null,\n sourcePath: string | null,\n): ModuleOwnedContractFact[] {\n if (!ceFilePath || !sourcePath) return []\n const entityIds = [...collectCustomFieldEntityIds(ceFilePath)].sort((left, right) => left.localeCompare(right))\n return entityIds.map((id) => ({\n kind: 'custom-entity' as const,\n id,\n source: { sourcePath, exportName: 'default' },\n }))\n}\n\n/**\n * Keyed AI override exports. Agent *extensions* (`aiAgentExtensions`) patch an agent\n * additively and belong to the `ai.extensions` array; these two replace or disable an\n * entry by key and map to exact `ai.agents.<id>` / `ai.tools.<id>` override targets.\n */\nconst AI_OVERRIDE_EXPORTS = [\n { exportName: 'aiAgentOverrides', target: 'agent' },\n { exportName: 'aiToolOverrides', target: 'tool' },\n] as const\n\nfunction extractAiExtensionContracts(\n moduleRoot: string,\n sourceRoot: string,\n): ModuleOwnedContractFact[] {\n const facts: ModuleOwnedContractFact[] = []\n const sources: Array<{ basename: string; relativeDir: string }> = [\n { basename: 'ai-agents', relativeDir: '.' },\n { basename: 'ai-tools', relativeDir: '.' },\n { basename: 'ai-agents.extensions', relativeDir: '.' },\n { basename: 'ai-tools.extensions', relativeDir: '.' },\n ]\n for (const entry of sources) {\n const filePath = resolveConventionFile(path.join(moduleRoot, entry.relativeDir), entry.basename)\n if (!filePath) continue\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const sourcePath = toPortableSourcePath(moduleRoot, sourceRoot, filePath)\n const extensionsArray = findArrayLiteralDeclaration(sourceFile, 'aiAgentExtensions')\n if (extensionsArray) {\n for (const element of extensionsArray.elements) {\n const objectLiteral = ts.isObjectLiteralExpression(element)\n ? element\n : ts.isCallExpression(element) && element.arguments[0] && ts.isObjectLiteralExpression(element.arguments[0])\n ? element.arguments[0]\n : null\n if (!objectLiteral) continue\n const targetAgentId = readStringPropertyInitializer(objectLiteral, 'targetAgentId')\n if (!targetAgentId) continue\n facts.push({\n kind: 'ai-extension',\n id: `agent-extension:${targetAgentId}`,\n source: { sourcePath, exportName: 'aiAgentExtensions', line: nodeLine(sourceFile, objectLiteral) },\n metadata: { target: 'agent', mode: 'extension', targetAgentId },\n })\n }\n }\n // `aiAgentOverrides` / `aiToolOverrides` are keyed replace-or-disable maps; only\n // their keys are contract facts. Values (agent/tool definitions, `null` disables)\n // are never read or serialized.\n for (const { exportName, target } of AI_OVERRIDE_EXPORTS) {\n const overridesObject = findObjectLiteralDeclaration(sourceFile, exportName)\n if (!overridesObject) continue\n for (const property of overridesObject.properties) {\n const overrideId = getPropertyName(property)\n if (!overrideId) continue\n facts.push({\n kind: 'ai-extension',\n id: `${target}-override:${overrideId}`,\n source: { sourcePath, exportName, line: nodeLine(sourceFile, property) },\n metadata: { target, mode: 'override', overrideKey: overrideId },\n })\n }\n }\n }\n return dedupeOwnedContractFacts(facts)\n}\n\nfunction extractGeneratorPluginContracts(\n moduleRoot: string,\n sourceRoot: string,\n): { facts: ModuleOwnedContractFact[]; unresolved: ModuleFactDiagnostic[] } {\n const filePath = resolveConventionFile(moduleRoot, 'generators')\n if (!filePath) return { facts: [], unresolved: [] }\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) return { facts: [], unresolved: [] }\n const pluginsArray = findArrayLiteralDeclaration(sourceFile, 'generatorPlugins')\n if (!pluginsArray) return { facts: [], unresolved: [] }\n const sourcePath = toPortableSourcePath(moduleRoot, sourceRoot, filePath)\n const initializers = buildVariableInitializerMap(sourceFile)\n const facts: ModuleOwnedContractFact[] = []\n const unresolved: ModuleFactDiagnostic[] = []\n let index = 0\n for (const element of pluginsArray.elements) {\n const objectLiteral = resolveToObjectLiteral(element, initializers)\n if (!objectLiteral) {\n index += 1\n continue\n }\n const pluginId = readStringPropertyInitializer(objectLiteral, 'id')\n if (!pluginId) {\n unresolved.push({\n code: 'unresolved-static-contract',\n kind: 'generator-plugin',\n id: `${sourcePath}#${index}`,\n source: { sourcePath, exportName: 'generatorPlugins', line: nodeLine(sourceFile, objectLiteral) },\n })\n index += 1\n continue\n }\n const metadata: Record<string, ModuleFactSafeScalar | ModuleFactSafeScalar[]> = {}\n const conventionFile = readStringPropertyInitializer(objectLiteral, 'conventionFile')\n if (conventionFile) metadata.conventionFile = conventionFile\n const outputFileName = readStringPropertyInitializer(objectLiteral, 'outputFileName')\n if (outputFileName) metadata.outputFileName = outputFileName\n facts.push({\n kind: 'generator-plugin',\n id: pluginId,\n source: { sourcePath, exportName: 'generatorPlugins', line: nodeLine(sourceFile, objectLiteral) },\n ...(Object.keys(metadata).length > 0 ? { metadata } : {}),\n })\n index += 1\n }\n return { facts: dedupeOwnedContractFacts(facts), unresolved }\n}\n\nfunction compareSourceRefs(left: ModuleFactSourceRef, right: ModuleFactSourceRef): number {\n return (\n left.sourcePath.localeCompare(right.sourcePath) ||\n (left.line ?? 0) - (right.line ?? 0) ||\n (left.exportName ?? '').localeCompare(right.exportName ?? '')\n )\n}\n\nfunction sameSourceRef(left: ModuleFactSourceRef, right: ModuleFactSourceRef): boolean {\n return (\n left.sourcePath === right.sourcePath &&\n (left.line ?? null) === (right.line ?? null) &&\n (left.exportName ?? null) === (right.exportName ?? null)\n )\n}\n\n// Every proven `(kind, id)` reaches `factSources`. Facts whose declaration site is already\n// serialized inline (pages, CLI commands, routes, AI tools/agents, reused contributions) and\n// the owned families (which carry `source` inside `ownedContracts`) are emitted as a typed\n// `factRef` pointer instead of a duplicated source ref, so the index stays uniform without\n// copying provenance payloads past the determinism byte guard. Duplicate detection runs over\n// ALL candidates regardless of which projection they take.\ntype ProvenanceCandidate = {\n kind: ModuleFactSourceKind\n id: string\n source?: ModuleFactSourceRef\n factRef?: ModuleFactRef\n}\n\nfunction provenanceCandidateOrderKey(candidate: ProvenanceCandidate): string {\n if (candidate.source) {\n return JSON.stringify([\n 0,\n candidate.source.sourcePath,\n candidate.source.line ?? 0,\n candidate.source.exportName ?? '',\n ])\n }\n return JSON.stringify([1, candidate.factRef?.factSection ?? '', candidate.factRef?.factKey ?? ''])\n}\n\nfunction buildProvenanceIndex(candidates: readonly ProvenanceCandidate[]): {\n factSources: ModuleFactSourceEntry[]\n diagnostics: ModuleFactDiagnostic[]\n} {\n const grouped = new Map<string, ProvenanceCandidate[]>()\n for (const candidate of candidates) {\n const key = JSON.stringify([candidate.kind, candidate.id])\n const group = grouped.get(key) ?? []\n group.push(candidate)\n grouped.set(key, group)\n }\n // Keep the provenance index compact: sourcePath is the provenance and (kind,id) the\n // stable identity, so exportName and line (recoverable from source) are dropped here.\n // Owned families retain the richer source ref inside `ownedContracts`.\n const factSources: ModuleFactSourceEntry[] = []\n const diagnostics: ModuleFactDiagnostic[] = []\n for (const group of grouped.values()) {\n const sorted = [...group].sort(\n (left, right) => provenanceCandidateOrderKey(left).localeCompare(provenanceCandidateOrderKey(right)),\n )\n const canonical = sorted[0]\n factSources.push(\n canonical.factRef\n ? {\n kind: canonical.kind,\n id: canonical.id,\n factRef: {\n factSection: canonical.factRef.factSection,\n ...(canonical.factRef.factKey === canonical.id\n ? {}\n : { factKey: canonical.factRef.factKey }),\n },\n }\n : {\n kind: canonical.kind,\n id: canonical.id,\n source: { sourcePath: (canonical.source as ModuleFactSourceRef).sourcePath },\n },\n )\n const canonicalKey = provenanceCandidateOrderKey(canonical)\n for (const rejected of sorted.slice(1)) {\n if (provenanceCandidateOrderKey(rejected) === canonicalKey) continue\n diagnostics.push({\n code: 'duplicate-source',\n kind: rejected.kind,\n id: rejected.id,\n ...(rejected.source ? { source: rejected.source } : {}),\n })\n }\n }\n factSources.sort(\n (left, right) => left.kind.localeCompare(right.kind) || left.id.localeCompare(right.id),\n )\n diagnostics.sort(\n (left, right) =>\n left.code.localeCompare(right.code) ||\n left.kind.localeCompare(right.kind) ||\n left.id.localeCompare(right.id) ||\n compareSourceRefs(left.source ?? { sourcePath: '' }, right.source ?? { sourcePath: '' }),\n )\n return { factSources, diagnostics }\n}\n\nfunction buildOwnedContracts(\n families: ReadonlyArray<[ModuleOwnedContractKind, ModuleOwnedContractFact[]]>,\n): ModuleOwnedContracts | undefined {\n const result: ModuleOwnedContracts = {}\n for (const [kind, facts] of families) {\n if (facts.length === 0) continue\n // Drop the (constant/redundant) exportName from the emitted source ref; the line\n // anchor plus sourcePath already pin the declaration and keep the JSON compact.\n result[kind] = facts.map((fact) => ({\n ...fact,\n source: {\n sourcePath: fact.source.sourcePath,\n ...(fact.source.line ? { line: fact.source.line } : {}),\n },\n }))\n }\n return Object.keys(result).length > 0 ? result : undefined\n}\n\nconst CONTRIBUTION_KIND_TO_SOURCE_KIND: Partial<Record<string, ModuleFactSourceKind>> = {\n subscriber: 'subscriber',\n}\n\nconst REGISTRY_TO_SOURCE_KIND: Partial<Record<string, ModuleFactSourceKind>> = {\n vector: 'vector',\n integration: 'integration',\n payment: 'integration',\n shipping: 'integration',\n currency: 'integration',\n}\n\nexport function extractModuleFacts(options: ExtractModuleFactsOptions): ModuleFacts {\n const { moduleId, coreVersion = null, sourcePackage = null, sourceVersion = null } = options\n const moduleRoot = options.moduleRoot\n ?? (options.coreSrcRoot ? path.join(options.coreSrcRoot, moduleId) : null)\n if (!moduleRoot) {\n throw new Error(`[internal] extractModuleFacts requires moduleRoot or coreSrcRoot for module \"${moduleId}\"`)\n }\n const sourceRoot = toPortableSourceRoot(moduleId, sourcePackage)\n\n const entitiesFilePath =\n resolveConventionFile(path.join(moduleRoot, 'data'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'db'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'data'), 'schema')\n const ceFilePath = resolveConventionFile(moduleRoot, 'ce')\n const eventsFilePath = resolveConventionFile(moduleRoot, 'events')\n const aclFilePath = resolveConventionFile(moduleRoot, 'acl')\n const diFilePath = resolveConventionFile(moduleRoot, 'di')\n const searchFilePath = resolveConventionFile(moduleRoot, 'search')\n const notificationsFilePath = resolveConventionFile(moduleRoot, 'notifications')\n const cliFilePath = resolveConventionFile(moduleRoot, 'cli')\n const indexFilePath = resolveConventionFile(moduleRoot, 'index')\n const setupFilePath = resolveConventionFile(moduleRoot, 'setup')\n const encryptionFilePath = resolveConventionFile(moduleRoot, 'encryption')\n\n const portableOf = (filePath: string | null): string | null =>\n filePath ? toPortableSourcePath(moduleRoot, sourceRoot, filePath) : null\n\n const warnings: string[] = []\n const { title, description } = extractModuleMeta(indexFilePath)\n const customFieldEntityIds = collectCustomFieldEntityIds(ceFilePath)\n const entities = extractEntities(moduleId, entitiesFilePath, customFieldEntityIds)\n const events = extractEvents(eventsFilePath)\n const aclFeatures = extractAclFeatures(aclFilePath)\n\n const { source: registrySource, description: registryDescription } = resolveRegistrySource(options)\n const apiRouteSourcePaths = extractApiRouteSourcePaths(moduleId, moduleRoot, sourceRoot)\n const apiRoutes = extractApiRoutes(moduleId, registrySource, registryDescription, apiRouteSourcePaths, warnings)\n const diRegistrations = extractDiRegistrationFacts(diFilePath, portableOf(diFilePath) ?? '')\n const diTokens = deriveLegacyDiTokens(diRegistrations.facts)\n for (const legacyToken of extractDiTokens(diFilePath)) {\n if (!diTokens.includes(legacyToken)) diTokens.push(legacyToken)\n }\n const searchEntities = extractSearchEntities(searchFilePath, warnings)\n const notifications = extractNotifications(notificationsFilePath, warnings)\n const cli = extractCli(cliFilePath, warnings)\n const cliCommands = cliFilePath\n ? cli.map((command) => ({\n command,\n sourcePath: toPortableSourcePath(moduleRoot, sourceRoot, cliFilePath),\n }))\n : []\n const backendPages = extractModulePages(moduleId, moduleRoot, sourceRoot, 'backend')\n const frontendPages = extractModulePages(moduleId, moduleRoot, sourceRoot, 'frontend')\n const aiTools = extractAiTools(moduleRoot, sourceRoot)\n const aiAgents = extractAiAgents(moduleRoot, sourceRoot)\n const hostTokens: ModuleHostTokens = {\n entityIds: extractHostEntityIds(entities),\n tableIds: extractTableIds(moduleRoot),\n }\n const extensionSurfaces = extractModuleExtensionFacts({\n moduleId,\n moduleRoot,\n sourceRoot,\n entities,\n events,\n apiRoutes,\n searchEntities,\n notifications,\n aiTools,\n aiAgents,\n })\n\n const indexSourcePath = portableOf(indexFilePath)\n const diSourcePath = portableOf(diFilePath)\n const moduleMetadataFact = extractModuleMetadataContract(indexFilePath, moduleId, indexSourcePath)\n const commandCandidates = extractCommandContractCandidates(moduleId, moduleRoot, sourceRoot)\n const commandFacts = dedupeOwnedContractFacts(\n commandCandidates.map((candidate) => ({\n kind: 'command' as const,\n id: candidate.id,\n source: { sourcePath: candidate.sourcePath },\n })),\n )\n const workers = extractWorkerContracts(moduleId, moduleRoot, sourceRoot)\n const pageMiddleware = extractPageMiddlewareContracts(moduleRoot, sourceRoot)\n const setupFact = extractSetupContract(moduleId, setupFilePath, portableOf(setupFilePath))\n const encryptionFacts = extractEncryptionContracts(encryptionFilePath, portableOf(encryptionFilePath))\n const customEntityFacts = extractCustomEntityContracts(ceFilePath, portableOf(ceFilePath))\n const aiExtensionFacts = extractAiExtensionContracts(moduleRoot, sourceRoot)\n const generatorPlugins = extractGeneratorPluginContracts(moduleRoot, sourceRoot)\n const diContractFacts = dedupeOwnedContractFacts(\n diRegistrations.facts.map((fact) => ({\n kind: 'di-registration' as const,\n id: fact.token,\n source: fact.source,\n metadata: {\n registrationKind: fact.registrationKind,\n ...(fact.providerSymbol ? { providerSymbol: fact.providerSymbol } : {}),\n ...(fact.lifetime ? { lifetime: fact.lifetime } : {}),\n ...(fact.injectionMode ? { injectionMode: fact.injectionMode } : {}),\n },\n })),\n )\n\n const ownedContracts = buildOwnedContracts([\n ['module-metadata', moduleMetadataFact ? [moduleMetadataFact] : []],\n ['command', commandFacts],\n ['worker', workers.facts],\n ['page-middleware', pageMiddleware.facts],\n ['setup', setupFact ? [setupFact] : []],\n ['encryption', encryptionFacts],\n ['di-registration', diContractFacts],\n ['custom-entity', customEntityFacts],\n ['ai-extension', aiExtensionFacts],\n ['generator-plugin', generatorPlugins.facts],\n ])\n\n const provenanceCandidates: ProvenanceCandidate[] = []\n const pushSource = (kind: ModuleFactSourceKind, id: string, source: ModuleFactSourceRef): void => {\n provenanceCandidates.push({ kind, id, source })\n }\n const pushRef = (\n kind: ModuleFactSourceKind,\n id: string,\n source: ModuleFactSourceRef,\n factSection: string,\n factKey: string,\n ): void => {\n provenanceCandidates.push({ kind, id, source, factRef: { factSection, factKey } })\n }\n const pushOwnedRefs = (kind: ModuleOwnedContractKind, facts: readonly ModuleOwnedContractFact[]): void => {\n for (const fact of facts) pushRef(kind, fact.id, fact.source, `ownedContracts.${kind}`, fact.id)\n }\n if (moduleMetadataFact) {\n pushRef(\n 'module-metadata',\n moduleId,\n moduleMetadataFact.source,\n 'ownedContracts.module-metadata',\n moduleMetadataFact.id,\n )\n }\n if (entitiesFilePath) {\n const entitiesSourcePath = portableOf(entitiesFilePath) as string\n for (const entity of entities) {\n pushSource('entity', entity.id, { sourcePath: entitiesSourcePath, exportName: entity.class })\n }\n }\n if (eventsFilePath) {\n const eventsSourcePath = portableOf(eventsFilePath) as string\n for (const event of events) pushSource('event', event.id, { sourcePath: eventsSourcePath, exportName: 'events' })\n }\n if (aclFilePath) {\n const aclSourcePath = portableOf(aclFilePath) as string\n for (const feature of aclFeatures) pushSource('acl-feature', feature, { sourcePath: aclSourcePath, exportName: 'features' })\n }\n for (const route of apiRoutes) {\n if (route.sourcePath) {\n pushRef('api-route', route.path, { sourcePath: route.sourcePath }, 'apiRoutes', route.path)\n }\n }\n if (searchFilePath) {\n const searchSourcePath = portableOf(searchFilePath) as string\n for (const entityId of searchEntities) pushSource('search', entityId, { sourcePath: searchSourcePath, exportName: 'searchConfig' })\n }\n if (notificationsFilePath) {\n const notificationsSourcePath = portableOf(notificationsFilePath) as string\n for (const id of notifications) pushSource('notification', id, { sourcePath: notificationsSourcePath })\n }\n for (const command of cliCommands) {\n pushRef('cli-command', command.command, { sourcePath: command.sourcePath }, 'cliCommands', command.command)\n }\n for (const page of backendPages) {\n pushRef('backend-page', page.path, { sourcePath: page.sourcePath }, 'backendPages', page.path)\n }\n for (const page of frontendPages) {\n pushRef('frontend-page', page.path, { sourcePath: page.sourcePath }, 'frontendPages', page.path)\n }\n for (const tool of aiTools) pushRef('ai-tool', tool.name, { sourcePath: tool.sourcePath }, 'aiTools', tool.name)\n for (const agent of aiAgents) pushRef('ai-agent', agent.id, { sourcePath: agent.sourcePath }, 'aiAgents', agent.id)\n for (const candidate of commandCandidates) {\n pushRef('command', candidate.id, { sourcePath: candidate.sourcePath }, 'ownedContracts.command', candidate.id)\n }\n pushOwnedRefs('worker', workers.facts)\n pushOwnedRefs('page-middleware', pageMiddleware.facts)\n if (setupFact) pushOwnedRefs('setup', [setupFact])\n pushOwnedRefs('encryption', encryptionFacts)\n for (const fact of diRegistrations.facts) {\n pushRef('di-registration', fact.token, fact.source, 'ownedContracts.di-registration', fact.token)\n }\n pushOwnedRefs('custom-entity', customEntityFacts)\n pushOwnedRefs('ai-extension', aiExtensionFacts)\n pushOwnedRefs('generator-plugin', generatorPlugins.facts)\n const contributionRef = (contributionId: string): { factSection: string; factKey: string } => ({\n factSection: 'extensionSurfaces.contributions',\n factKey: contributionId,\n })\n for (const contribution of extensionSurfaces.contributions) {\n const contributionSource: ModuleFactSourceRef = {\n sourcePath: contribution.source.path,\n ...(contribution.source.symbol ? { exportName: contribution.source.symbol } : {}),\n }\n const ref = contributionRef(contribution.id)\n if (contribution.kind === 'subscriber') {\n pushRef('subscriber', contribution.id, contributionSource, ref.factSection, ref.factKey)\n continue\n }\n if (contribution.kind === 'specialized-registry') {\n const details = contribution.details as { registry?: string; registryId?: string }\n const sourceKind = details.registry ? REGISTRY_TO_SOURCE_KIND[details.registry] : undefined\n if (sourceKind) {\n pushRef(\n sourceKind,\n details.registryId ?? contribution.id,\n contributionSource,\n ref.factSection,\n ref.factKey,\n )\n }\n continue\n }\n const mapped = CONTRIBUTION_KIND_TO_SOURCE_KIND[contribution.kind]\n if (mapped) pushRef(mapped, contribution.id, contributionSource, ref.factSection, ref.factKey)\n }\n // extension-host / extension-contribution provenance is emitted as typed `factRef` pointers\n // rather than duplicated source refs: those facts already carry their own `source` inside\n // `extensionSurfaces.{hosts,contributions}`, and copying every declared host spot (hundreds\n // per large module) would push the shared JSON past the determinism byte guard asserted in\n // `module-facts.bc-guard.test.ts`.\n // Hosts are indexed by their registry `key`: `id` repeats across families (an entity id is\n // also an api-entity id), while `key` is unique inside a module.\n for (const host of extensionSurfaces.hosts) {\n provenanceCandidates.push({\n kind: 'extension-host',\n id: host.key,\n ...(host.source.kind === 'fact-ref' ? {} : { source: { sourcePath: host.source.path } }),\n factRef: { factSection: 'extensionSurfaces.hosts', factKey: host.key },\n })\n }\n for (const contribution of extensionSurfaces.contributions) {\n pushRef(\n 'extension-contribution',\n contribution.id,\n { sourcePath: contribution.source.path },\n 'extensionSurfaces.contributions',\n contribution.id,\n )\n }\n\n const provenance = buildProvenanceIndex(provenanceCandidates)\n const factDiagnostics = [\n ...provenance.diagnostics,\n ...workers.unresolved,\n ...pageMiddleware.unresolved,\n ...generatorPlugins.unresolved,\n ...diRegistrations.unresolvedTokens.map((token): ModuleFactDiagnostic => ({\n code: 'unresolved-static-contract',\n kind: 'di-registration',\n id: token,\n ...(diSourcePath ? { source: { sourcePath: diSourcePath, exportName: token } } : {}),\n })),\n ].sort(\n (left, right) =>\n left.code.localeCompare(right.code) ||\n left.kind.localeCompare(right.kind) ||\n left.id.localeCompare(right.id),\n )\n\n const facts: ModuleFacts = {\n module: moduleId,\n title,\n description,\n coreVersion,\n sourcePackage,\n sourceVersion,\n sourceRoot,\n entities,\n events,\n aclFeatures,\n apiRoutes,\n diTokens,\n searchEntities,\n hostTokens,\n notifications,\n cli,\n backendPages,\n frontendPages,\n cliCommands,\n aiTools,\n aiAgents,\n extensionSurfaces,\n ...(provenance.factSources.length > 0 ? { factSources: provenance.factSources } : {}),\n ...(ownedContracts ? { ownedContracts } : {}),\n ...(factDiagnostics.length > 0 ? { factDiagnostics } : {}),\n warnings,\n }\n\n // Exact unified override targets (spec 2026-08-02-module-facts-exact-override-targets).\n // Adapters consume the fully-populated owned facts + contributions above.\n const overrides = collectModuleOverrideTargets(facts, buildFactSourceLookup(facts))\n if (overrides.overrideTargets.length > 0) facts.overrideTargets = overrides.overrideTargets\n if (overrides.overrideTargetDiagnostics.length > 0) {\n facts.overrideTargetDiagnostics = overrides.overrideTargetDiagnostics\n }\n return facts\n}\n\nexport interface ModuleFactsJsonEvent {\n id: string\n category: string | null\n entity: string | null\n clientBroadcast?: boolean\n portalBroadcast?: boolean\n}\n\nexport interface ModuleFactsJsonEntry {\n title: string | null\n description: string | null\n coreVersion: string | null\n sourcePackage: string | null\n sourceVersion: string | null\n sourceRoot: string\n entities: ModuleEntityFact[]\n events: ModuleFactsJsonEvent[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n backendPages: ModulePageFact[]\n frontendPages: ModulePageFact[]\n cliCommands: ModuleCliCommandFact[]\n aiTools: ModuleAiToolFact[]\n aiAgents: ModuleAiAgentFact[]\n extensionSurfaces?: ModuleExtensionSurfaceFacts\n factSources?: ModuleFactSourceEntry[]\n ownedContracts?: ModuleOwnedContracts\n factDiagnostics?: ModuleFactDiagnostic[]\n overrideTargets?: ModuleOverrideTarget[]\n overrideTargetDiagnostics?: ModuleOverrideTargetDiagnostic[]\n}\n\nconst EMPTY_SECTION_MARKER = '_none_'\n\nfunction renderVersionStamp(\n coreVersion: string | null,\n sourcePackage: string | null,\n sourceVersion: string | null,\n): string {\n if (sourcePackage) {\n return `<!-- generated from ${sourcePackage} ${sourceVersion || '<unknown>'}; core ${coreVersion || '<unknown>'} \u2014 R1 staleness stamp -->`\n }\n const version = coreVersion && coreVersion.length > 0 ? coreVersion : '<unknown>'\n return `<!-- generated from @open-mercato/core ${version} \u2014 R1 staleness stamp -->`\n}\n\nfunction renderEntitiesSection(entities: ModuleEntityFact[], lookup: FactSourceLookup): string {\n if (entities.length === 0) return `## Entities\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Entity ID | Class | Table | Editable | CustomFields | Source |'\n const divider = '|---|---|---|---|---|---|'\n const rows = entities.map(\n (entity) =>\n `| ${entity.id} | ${entity.class} | ${entity.table} | ${entity.editable ? 'yes' : 'no'} | ${entity.customFields ? 'yes' : 'no'} | ${renderLookedUpSource(lookup, 'entity', entity.id)} |`,\n )\n return ['## Entities', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderEventsSection(events: ModuleEventFact[], lookup: FactSourceLookup): string {\n const heading = `## Events (${events.length})`\n if (events.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| ID | Category | Entity | Browser transport | Source |'\n const divider = '|---|---|---|---|---|'\n const rows = events.map((event) => {\n const transports = [event.clientBroadcast ? 'client' : null, event.portalBroadcast ? 'portal' : null]\n .filter((value): value is string => value !== null)\n return `| ${event.id} | ${event.category ?? '\u2014'} | ${event.entity ?? '\u2014'} | ${transports.join(', ') || '\u2014'} | ${renderLookedUpSource(lookup, 'event', event.id)} |`\n })\n return [heading, '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderInlineListSection(heading: string, values: string[]): string {\n if (values.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n return `${heading}\\n\\n${values.join(' \u00B7 ')}`\n}\n\nfunction renderSourceLinkedListSection(\n heading: string,\n values: readonly string[],\n lookup: FactSourceLookup,\n kind: ModuleFactSourceKind,\n idColumnLabel: string,\n): string {\n if (values.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = values.map((value) => `| ${value} | ${renderLookedUpSource(lookup, kind, value)} |`)\n return [heading, '', `| ${idColumnLabel} | Source |`, '|---|---|', ...rows].join('\\n')\n}\n\nfunction renderSourceLink(sourcePath: string): string {\n return `[${sourcePath}](../../../${sourcePath})`\n}\n\nfunction renderSourceRefLink(source: ModuleFactSourceRef): string {\n const anchor = source.line ? `#L${source.line}` : ''\n const label = source.line ? `${source.sourcePath}:${source.line}` : source.sourcePath\n return `[${label}](../../../${source.sourcePath}${anchor})`\n}\n\n\nfunction renderLookedUpSource(lookup: FactSourceLookup, kind: ModuleFactSourceKind, id: string): string {\n const source = lookup(kind, id)\n return source ? renderSourceRefLink(source) : '\u2014'\n}\n\nfunction renderSafeScalar(value: ModuleFactSafeScalar | ModuleFactSafeScalar[] | undefined): string {\n if (value === undefined || value === null) return '\u2014'\n if (Array.isArray(value)) return value.length > 0 ? value.map((entry) => String(entry)).join(', ') : '\u2014'\n return String(value)\n}\n\nfunction renderOwnedContractMetadata(metadata: ModuleOwnedContractFact['metadata']): string {\n if (!metadata) return '\u2014'\n const keys = Object.keys(metadata).sort((left, right) => left.localeCompare(right))\n if (keys.length === 0) return '\u2014'\n return keys.map((key) => `${key}=${renderSafeScalar(metadata[key])}`).join('; ')\n}\n\nfunction renderOwnedContractSection(\n heading: string,\n facts: readonly ModuleOwnedContractFact[] | undefined,\n): string {\n if (!facts || facts.length === 0) return ''\n const rows = facts.map(\n (fact) => `| ${fact.id} | ${renderOwnedContractMetadata(fact.metadata)} | ${renderSourceRefLink(fact.source)} |`,\n )\n return [heading, '', '| ID | Metadata | Source |', '|---|---|---|', ...rows].join('\\n')\n}\n\nfunction renderDiRegistrationsSection(facts: readonly ModuleOwnedContractFact[] | undefined): string {\n if (!facts || facts.length === 0) return ''\n const rows = facts.map((fact) => {\n const metadata = fact.metadata ?? {}\n return `| ${fact.id} | ${renderSafeScalar(metadata.registrationKind)} | ${renderSafeScalar(metadata.lifetime)} | ${renderSafeScalar(metadata.injectionMode)} | ${renderSafeScalar(metadata.providerSymbol)} | ${renderSourceRefLink(fact.source)} |`\n })\n return [\n '## DI registrations (rich)',\n '',\n '| Token | Kind | Lifetime | Injection | Provider | Source |',\n '|---|---|---|---|---|---|',\n ...rows,\n ].join('\\n')\n}\n\nfunction describeAuthRule(rule: ApiRouteAuthRule | undefined): string {\n if (!rule) return 'public'\n if (rule.requireFeatures && rule.requireFeatures.length > 0) return rule.requireFeatures.join(', ')\n if (rule.requireRoles && rule.requireRoles.length > 0) return rule.requireRoles.join(', ')\n if (rule.requireAuth) return 'auth'\n return 'public'\n}\n\nfunction renderApiRouteAuthCell(route: ModuleApiRouteFact): string {\n if (route.methods.length === 0) return '\u2014'\n const groups: Array<{ label: string; methods: string[] }> = []\n for (const method of route.methods) {\n const label = describeAuthRule(route.auth[method])\n const existing = groups.find((group) => group.label === label)\n if (existing) existing.methods.push(method)\n else groups.push({ label, methods: [method] })\n }\n return groups.map((group) => `${group.methods.join('/')} \u2192 ${group.label}`).join(' \u00B7 ')\n}\n\nfunction renderApiRoutesSection(routes: ModuleApiRouteFact[]): string {\n if (routes.length === 0) return `## API routes\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Path | Methods | Auth (per-method requireFeatures) | Source |'\n const divider = '|---|---|---|---|'\n const rows = routes.map(\n (route) => `| ${route.path} | ${route.methods.join(' ')} | ${renderApiRouteAuthCell(route)} | ${route.sourcePath ? renderSourceLink(route.sourcePath) : '\u2014'} |`,\n )\n return ['## API routes', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderLinkedFactsSection(\n heading: string,\n facts: ReadonlyArray<{ label: string; sourcePath: string }>,\n): string {\n if (facts.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = facts.map((fact) => `| ${fact.label} | ${renderSourceLink(fact.sourcePath)} |`)\n return [heading, '', '| ID / path | Source |', '|---|---|', ...rows].join('\\n')\n}\n\nfunction renderHostTokensSection(hostTokens: ModuleHostTokens): string {\n const entityIdsLine = hostTokens.entityIds.length > 0 ? hostTokens.entityIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n const tableIdsLine = hostTokens.tableIds.length > 0 ? hostTokens.tableIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n return ['## Host extension points', '', `- Entity IDs: ${entityIdsLine}`, `- Table IDs: ${tableIdsLine}`].join('\\n')\n}\n\nfunction renderExtensionHostContext(host: ModuleExtensionSurfaceFacts['hosts'][number]): string {\n return host.contextContract ?? host.runtimeContract ?? host.scopeContract ?? '\u2014'\n}\n\nfunction renderExtensionHostSource(host: ModuleExtensionHostFact): string {\n if (host.source.kind === 'fact-ref') return `${host.source.factSection}:${host.source.factKey}`\n return renderSourceRefLink({ sourcePath: host.source.path })\n}\n\nfunction renderExtensionHostsSection(extensionSurfaces: ModuleExtensionSurfaceFacts): string {\n const boundHosts = extensionSurfaces.hosts.filter((host) => host.bound)\n if (boundHosts.length === 0) return `## UMES hosts\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = boundHosts.map((host) =>\n `| ${host.id} | ${host.family} | ${host.capabilities.join(', ') || '\u2014'} | ${renderExtensionHostContext(host)} | ${host.stability.toUpperCase()} | ${renderExtensionHostSource(host)} |`,\n )\n return [\n '## UMES hosts',\n '',\n '| ID / pattern | Family | Supports | Context | Stability | Source |',\n '|---|---|---|---|---|---|',\n ...rows,\n ].join('\\n')\n}\n\nfunction compactContributionDetails(contribution: ModuleExtensionContributionFact): string {\n const details = contribution.details as unknown as Record<string, unknown>\n return Object.keys(details).sort((left, right) => left.localeCompare(right)).flatMap((key) => {\n const value = details[key]\n if (value === undefined) return []\n if (Array.isArray(value)) return [`${key}=${value.join(',') || 'none'}`]\n if (value && typeof value === 'object') {\n const nested = Object.keys(value as Record<string, unknown>).sort((left, right) => left.localeCompare(right)).map((nestedKey) => {\n const nestedValue = (value as Record<string, unknown>)[nestedKey]\n return `${nestedKey}:${Array.isArray(nestedValue) ? nestedValue.join(',') : String(nestedValue)}`\n })\n return [`${key}={${nested.join(';')}}`]\n }\n return [`${key}=${String(value)}`]\n }).join('; ')\n}\n\nfunction renderExtensionContributionsSection(extensionSurfaces: ModuleExtensionSurfaceFacts): string {\n if (extensionSurfaces.contributions.length === 0) return `## UMES contributions\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = extensionSurfaces.contributions.map((contribution) => {\n const targets = contribution.targets.map((entry) => entry.id).join(', ')\n const resolution = contribution.targets.map((entry) => entry.resolution).join(', ')\n const phases = [...(contribution.phases ?? []), ...(contribution.operations ?? [])].join(', ') || '\u2014'\n const source = renderSourceRefLink({ sourcePath: contribution.source.path })\n return `| ${contribution.id} | ${contribution.kind} | ${targets || '\u2014'} | ${phases} | ${compactContributionDetails(contribution)} | ${resolution || '\u2014'} | ${source} |`\n })\n return [\n '## UMES contributions',\n '',\n '| ID | Kind | Target | Phase / operations | Contract | Resolution | Source |',\n '|---|---|---|---|---|---|---|',\n ...rows,\n ].join('\\n')\n}\n\nfunction renderExtensionDiagnosticsSection(extensionSurfaces: ModuleExtensionSurfaceFacts): string {\n const unbound = extensionSurfaces.hosts.filter((host) => !host.bound)\n if (unbound.length === 0 && extensionSurfaces.unresolved.length === 0) return ''\n const diagnostics = [\n ...unbound.map((host) => `- unbound-helper: ${host.id}`),\n ...extensionSurfaces.unresolved.map((entry) => `- ${entry.reason}: ${entry.key} (${entry.source.path})`),\n ]\n return ['## UMES diagnostics', '', ...diagnostics].join('\\n')\n}\n\nfunction renderExtensionTargetRef(target: ModuleExtensionTargetRef): string {\n const method = target.method ? ` ${target.method}` : ''\n const owner = target.moduleId ? ` @${target.moduleId}` : ''\n return `${target.kind}:${target.id}${method}${owner}`\n}\n\nfunction renderActivationBindingsSection(extensionSurfaces: ModuleExtensionSurfaceFacts): string {\n const activations = extensionSurfaces.activations ?? []\n if (activations.length === 0) return `## Active extension bindings\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = activations.map((activation) => {\n const phases = activation.phases && activation.phases.length > 0 ? activation.phases.join(', ') : '\u2014'\n const source = activation.source ? renderSourceRefLink(activation.source) : '\u2014'\n const bridge = activation.bridge ? `${activation.bridge.factSection}:${activation.bridge.factKey}` : '\u2014'\n return `| ${activation.id} | ${activation.kind} | ${renderExtensionTargetRef(activation.host)} | ${activation.contributionKinds.join(', ') || '\u2014'} | ${phases} | ${bridge} | ${source} |`\n })\n return [\n '## Active extension bindings',\n '',\n '| Activation | Kind | Host | Contribution kinds | Phases | Bridge | Source |',\n '|---|---|---|---|---|---|---|',\n ...rows,\n ].join('\\n')\n}\n\nfunction renderIncomingContributionsSection(extensionSurfaces: ModuleExtensionSurfaceFacts): string {\n const incoming = extensionSurfaces.incoming ?? []\n if (incoming.length === 0) return `## Incoming installed contributions\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = incoming.map((entry) => {\n const activation = entry.activationId ?? '\u2014'\n const source = entry.source ? renderSourceRefLink(entry.source) : '\u2014'\n return `| ${entry.contributorModuleId} | ${entry.contributionKind} | ${renderExtensionTargetRef(entry.target)} | ${entry.resolution} | ${activation} | ${entry.contributionId} \u00B7 ${source} |`\n })\n return [\n '## Incoming installed contributions',\n '',\n '| Contributor | Kind | Target | Resolution | Activation | Contribution \u00B7 Source |',\n '|---|---|---|---|---|---|',\n ...rows,\n ].join('\\n')\n}\n\nfunction renderContributionResolutionsSection(\n extensionSurfaces: ModuleExtensionSurfaceFacts,\n lookup: FactSourceLookup,\n): string {\n const resolutions = extensionSurfaces.contributionResolutions ?? []\n if (resolutions.length === 0) return `## Contribution resolutions\\n\\n${EMPTY_SECTION_MARKER}`\n const rows = resolutions.map((resolution) => {\n const activations = resolution.activationIds.length > 0 ? resolution.activationIds.join(', ') : '\u2014'\n const source = renderLookedUpSource(lookup, 'extension-contribution', resolution.contributionId)\n return `| ${resolution.contributionId} | ${renderExtensionTargetRef(resolution.target)} | ${resolution.resolution} | ${activations} | ${source} |`\n })\n return [\n '## Contribution resolutions',\n '',\n '| Contribution | Target | Resolution | Activations | Source |',\n '|---|---|---|---|---|',\n ...rows,\n ].join('\\n')\n}\n\nfunction renderOverrideTargetPath(target: ModuleOverrideTarget): string {\n let display = 'overrides'\n for (let index = 0; index < target.path.length; index += 1) {\n const segment = target.path[index]\n const isKeyedTerminal = target.key !== undefined && index === target.path.length - 1\n display += isKeyedTerminal ? `[${JSON.stringify(segment)}]` : `.${segment}`\n }\n return display\n}\n\nfunction renderOverrideTargetsSection(targets: readonly ModuleOverrideTarget[] | undefined): string {\n if (!targets || targets.length === 0) return `## Exact override targets\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Domain | Path / key | Supported modes | Referenced fact | Source |'\n const divider = '|---|---|---|---|---|'\n const rows = targets.map((target) => {\n const path = `\\`${renderOverrideTargetPath(target)}\\``\n const modes = target.modes.join(', ') || '\u2014'\n const fact = `${target.factRef.factSection}:${target.factRef.factKey}`\n return `| ${target.domain} | ${path} | ${modes} | ${fact} | ${renderSourceRefLink(target.source)} |`\n })\n return ['## Exact override targets', '', header, divider, ...rows].join('\\n')\n}\n\nexport function renderModuleFactsMarkdown(facts: ModuleFacts): string {\n const extensionSurfaces = facts.extensionSurfaces ?? { hosts: [], contributions: [], unresolved: [] }\n const lookup = buildFactSourceLookup(facts)\n const sections = [\n `# ${facts.module} \u2014 module facts (generated, do not edit)`,\n renderVersionStamp(facts.coreVersion, facts.sourcePackage, facts.sourceVersion),\n `Source root: ${renderSourceLink(facts.sourceRoot)}`,\n '',\n renderEntitiesSection(facts.entities, lookup),\n '',\n renderEventsSection(facts.events, lookup),\n '',\n renderSourceLinkedListSection(\n `## ACL features (${facts.aclFeatures.length})`,\n facts.aclFeatures,\n lookup,\n 'acl-feature',\n 'Feature',\n ),\n '',\n renderApiRoutesSection(facts.apiRoutes),\n '',\n renderLinkedFactsSection('## Backend pages', facts.backendPages.map((page) => ({ label: page.path, sourcePath: page.sourcePath }))),\n '',\n renderLinkedFactsSection('## Frontend pages', facts.frontendPages.map((page) => ({ label: page.path, sourcePath: page.sourcePath }))),\n '',\n renderSourceLinkedListSection('## DI service tokens', facts.diTokens, lookup, 'di-registration', 'Token'),\n '',\n renderSourceLinkedListSection('## Search entities', facts.searchEntities, lookup, 'search', 'Entity ID'),\n '',\n renderHostTokensSection(facts.hostTokens),\n '',\n renderExtensionHostsSection(extensionSurfaces),\n '',\n renderExtensionContributionsSection(extensionSurfaces),\n '',\n renderActivationBindingsSection(extensionSurfaces),\n '',\n renderIncomingContributionsSection(extensionSurfaces),\n '',\n renderContributionResolutionsSection(extensionSurfaces, lookup),\n '',\n renderExtensionDiagnosticsSection(extensionSurfaces),\n '',\n renderSourceLinkedListSection('## Notifications', facts.notifications, lookup, 'notification', 'Notification ID'),\n '',\n renderLinkedFactsSection('## CLI commands', facts.cliCommands.map((command) => ({ label: command.command, sourcePath: command.sourcePath }))),\n '',\n renderLinkedFactsSection('## AI tools / MCP capabilities', facts.aiTools.map((tool) => ({ label: tool.name, sourcePath: tool.sourcePath }))),\n '',\n renderLinkedFactsSection('## AI agents', facts.aiAgents.map((agent) => ({ label: agent.id, sourcePath: agent.sourcePath }))),\n '',\n renderOverrideTargetsSection(facts.overrideTargets),\n '',\n ]\n const owned = facts.ownedContracts ?? {}\n const ownedSections = [\n renderOwnedContractSection('## Owned contract \u2014 module metadata', owned['module-metadata']),\n renderOwnedContractSection('## Domain commands', owned.command),\n renderOwnedContractSection('## Workers', owned.worker),\n renderOwnedContractSection('## Page middleware', owned['page-middleware']),\n renderOwnedContractSection('## Setup', owned.setup),\n renderOwnedContractSection('## Encryption', owned.encryption),\n renderDiRegistrationsSection(owned['di-registration']),\n renderOwnedContractSection('## Custom entities', owned['custom-entity']),\n renderOwnedContractSection('## AI extensions', owned['ai-extension']),\n renderOwnedContractSection('## Generator plugins', owned['generator-plugin']),\n ].filter((section) => section.length > 0)\n for (const section of ownedSections) {\n sections.push(section, '')\n }\n return sections.join('\\n')\n}\n\nexport function toModuleFactsJsonEntry(facts: ModuleFacts): ModuleFactsJsonEntry {\n return {\n title: facts.title,\n description: facts.description,\n coreVersion: facts.coreVersion,\n sourcePackage: facts.sourcePackage,\n sourceVersion: facts.sourceVersion,\n sourceRoot: facts.sourceRoot,\n entities: facts.entities,\n events: facts.events.map((event) => ({\n id: event.id,\n category: event.category,\n entity: event.entity,\n ...(event.clientBroadcast !== undefined ? { clientBroadcast: event.clientBroadcast } : {}),\n ...(event.portalBroadcast !== undefined ? { portalBroadcast: event.portalBroadcast } : {}),\n })),\n aclFeatures: facts.aclFeatures,\n apiRoutes: facts.apiRoutes,\n diTokens: facts.diTokens,\n searchEntities: facts.searchEntities,\n hostTokens: facts.hostTokens,\n notifications: facts.notifications,\n cli: facts.cli,\n backendPages: facts.backendPages,\n frontendPages: facts.frontendPages,\n cliCommands: facts.cliCommands,\n aiTools: facts.aiTools,\n aiAgents: facts.aiAgents,\n ...(facts.extensionSurfaces ? { extensionSurfaces: facts.extensionSurfaces } : {}),\n ...(facts.factSources && facts.factSources.length > 0 ? { factSources: facts.factSources } : {}),\n ...(facts.ownedContracts && Object.keys(facts.ownedContracts).length > 0\n ? { ownedContracts: facts.ownedContracts }\n : {}),\n ...(facts.factDiagnostics && facts.factDiagnostics.length > 0\n ? { factDiagnostics: facts.factDiagnostics }\n : {}),\n ...(facts.overrideTargets && facts.overrideTargets.length > 0\n ? { overrideTargets: facts.overrideTargets }\n : {}),\n ...(facts.overrideTargetDiagnostics && facts.overrideTargetDiagnostics.length > 0\n ? { overrideTargetDiagnostics: facts.overrideTargetDiagnostics }\n : {}),\n }\n}\n\nexport function buildModuleFactsJsonObject(\n factsByModule: Record<string, ModuleFacts>,\n): Record<string, ModuleFactsJsonEntry> {\n const result: Record<string, ModuleFactsJsonEntry> = {}\n for (const moduleId of Object.keys(factsByModule).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))) {\n result[moduleId] = toModuleFactsJsonEntry(factsByModule[moduleId])\n }\n return result\n}\n\nexport function renderModuleFactsJson(factsByModule: Record<string, ModuleFacts>): string {\n return `${JSON.stringify(buildModuleFactsJsonObject(factsByModule), null, 2)}\\n`\n}\n\nexport interface ExtractAllModuleFactsOptions {\n /**\n * Discovered module sources (auto-discovery path). When provided, each entry's\n * explicit `moduleRoot` is used and `coreSrcRoot`/`moduleIds` are ignored.\n */\n sources?: readonly ModuleFactSource[]\n /** Legacy shared-root path. Used only when `sources` is not provided. */\n coreSrcRoot?: string\n registryPath?: string | null\n registrySource?: string | null\n coreVersion?: string | null\n /** @deprecated Legacy explicit module-id list; only consulted when `sources` is absent. */\n moduleIds?: readonly string[]\n}\n\nexport interface ExtractAllModuleFactsResult {\n factsByModule: Record<string, ModuleFacts>\n markdownByModule: Record<string, string>\n warnings: string[]\n frameworkMarkdown: string\n}\n\nexport function extractAllModuleFacts(options: ExtractAllModuleFactsOptions): ExtractAllModuleFactsResult {\n return withModuleExtensionFactExtractionCache(() => extractAllModuleFactsWithCache(options))\n}\n\nfunction extractAllModuleFactsWithCache(options: ExtractAllModuleFactsOptions): ExtractAllModuleFactsResult {\n const sources: ModuleFactSource[] = options.sources\n ? [...options.sources]\n : (options.coreSrcRoot\n ? (options.moduleIds ?? []).map((moduleId) => ({\n moduleId,\n moduleRoot: path.join(options.coreSrcRoot as string, moduleId),\n }))\n : [])\n\n const factsByModule: Record<string, ModuleFacts> = {}\n const markdownByModule: Record<string, string> = {}\n const warnings: string[] = []\n for (const source of sources) {\n const facts = extractModuleFacts({\n moduleId: source.moduleId,\n moduleRoot: source.moduleRoot,\n coreVersion: options.coreVersion ?? null,\n sourcePackage: source.from ?? null,\n sourceVersion: source.packageVersion ?? null,\n registryPath: options.registryPath ?? null,\n registrySource: options.registrySource ?? null,\n })\n factsByModule[source.moduleId] = facts\n warnings.push(...facts.warnings)\n }\n const surfacesByModule = Object.fromEntries(\n Object.entries(factsByModule).map(([moduleId, facts]) => [\n moduleId,\n facts.extensionSurfaces ?? { hosts: [], contributions: [], unresolved: [] },\n ]),\n )\n const correlated = correlateModuleExtensionFacts({\n surfacesByModule,\n entityIds: new Set(Object.values(factsByModule).flatMap((facts) => facts.entities.map((entity) => entity.id))),\n eventIds: new Set(Object.values(factsByModule).flatMap((facts) => facts.events.map((event) => event.id))),\n apiRoutes: new Set([\n ...Object.values(factsByModule).flatMap((facts) => facts.apiRoutes.map((route) => route.path)),\n ...sources.flatMap((source) => extractKnownApiRouteIds(source.moduleId, source.moduleRoot)),\n ]),\n commandIds: new Set(sources.flatMap((source) => extractKnownCommandIds(source.moduleId, source.moduleRoot))),\n })\n assertNoUnresolvedExtensionTargets(correlated)\n const apiRouteOwners = new Map<string, {\n moduleId: string\n source: ModuleFactSourceRef\n bridges: ApiRouteInterceptorBridge[]\n }>()\n const commandOwners = new Map<string, { moduleId: string; source: ModuleFactSourceRef }>()\n for (const source of [...sources].sort((left, right) => left.moduleId.localeCompare(right.moduleId))) {\n const facts = factsByModule[source.moduleId]\n const sourceRoot = facts ? facts.sourceRoot : source.moduleId\n const owners = extractActivationTargetOwners({\n moduleId: source.moduleId,\n moduleRoot: source.moduleRoot,\n sourceRoot,\n })\n for (const route of owners.apiRoutes) {\n if (!apiRouteOwners.has(route.id)) {\n apiRouteOwners.set(route.id, { moduleId: source.moduleId, source: route.source, bridges: route.bridges })\n }\n }\n for (const command of owners.commands) {\n if (!commandOwners.has(command.id)) commandOwners.set(command.id, { moduleId: source.moduleId, source: command.source })\n }\n }\n const withIncoming = correlateIncomingExtensions({\n surfacesByModule: correlated,\n apiRouteOwners,\n commandOwners,\n })\n for (const moduleId of Object.keys(factsByModule).sort((left, right) => left.localeCompare(right))) {\n factsByModule[moduleId].extensionSurfaces = withIncoming[moduleId]\n markdownByModule[moduleId] = renderModuleFactsMarkdown(factsByModule[moduleId])\n warnings.push(...correlated[moduleId].unresolved.map((entry) =>\n `[module-facts] ${moduleId} ${entry.reason}: ${entry.key} (${entry.source.path})`,\n ))\n }\n return { factsByModule, markdownByModule, warnings, frameworkMarkdown: renderFrameworkExtensionPointsMarkdown() }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AAOf,SAAS,eAAe;AACxB,SAAS,mCAAmC;AAC5C,SAAS,8BAA8B;AAEvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAGK;AACP,SAAS,6BAAoD;AA8O7D,SAAS,eAAe,UAAwC;AAC9D,MAAI,CAAC,GAAG,WAAW,QAAQ,EAAG,QAAO;AACrC,QAAM,SAAS,GAAG,aAAa,UAAU,MAAM;AAC/C,QAAM,aAAa,SAAS,SAAS,MAAM,IAAI,GAAG,WAAW,MAAM,GAAG,WAAW;AACjF,SAAO,GAAG,iBAAiB,UAAU,QAAQ,GAAG,aAAa,QAAQ,MAAM,UAAU;AACvF;AAEA,SAAS,sBAAsB,SAAiB,UAAiC;AAC/E,aAAW,aAAa,CAAC,OAAO,MAAM,GAAG;AACvC,UAAM,YAAY,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9D,QAAI,GAAG,WAAW,SAAS,EAAG,QAAO;AAAA,EACvC;AACA,SAAO;AACT;AAEA,SAAS,8BACP,eACA,cACoB;AACpB,aAAW,YAAY,cAAc,YAAY;AAC/C,QAAI,CAAC,GAAG,qBAAqB,QAAQ,EAAG;AACxC,UAAM,OAAO,GAAG,aAAa,SAAS,IAAI,IACtC,SAAS,KAAK,OACd,GAAG,oBAAoB,SAAS,IAAI,IAClC,SAAS,KAAK,OACd;AACN,QAAI,SAAS,aAAc;AAC3B,QAAI,GAAG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node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport { toSnake } from '../utils'\n\nexport interface ModuleEntityFact {\n id: string\n class: string\n table: string\n editable: boolean\n customFields: boolean\n}\n\nexport interface ApiRouteAuthRule {\n requireAuth?: boolean\n requireFeatures?: string[]\n requireRoles?: string[]\n}\n\nexport interface ModuleApiRouteFact {\n path: string\n methods: string[]\n auth: Record<string, ApiRouteAuthRule>\n}\n\nexport interface ModuleEventFact {\n id: string\n label?: string\n category: string | null\n entity: string | null\n}\n\nexport interface ModuleHostTokens {\n entityIds: string[]\n tableIds: string[]\n}\n\nexport interface ModuleFacts {\n module: string\n title: string | null\n description: string | null\n coreVersion: string | null\n entities: ModuleEntityFact[]\n events: ModuleEventFact[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n warnings: string[]\n}\n\nexport interface ExtractModuleFactsOptions {\n moduleId: string\n /**\n * Parent modules directory joined with `moduleId` to locate the module source.\n * Legacy input; prefer the explicit per-module `moduleRoot` for modules that do\n * not live under a single shared root (auto-discovery). One of `moduleRoot` /\n * `coreSrcRoot` must be provided.\n */\n coreSrcRoot?: string\n /** Explicit module source directory. When set it overrides `coreSrcRoot + moduleId`. */\n moduleRoot?: string\n coreVersion?: string | null\n registryPath?: string | null\n registrySource?: string | null\n}\n\n/** A discovered module and the source directory its facts are extracted from. */\nexport interface ModuleFactSource {\n moduleId: string\n moduleRoot: string\n from?: string\n}\n\nfunction readSourceFile(filePath: string): ts.SourceFile | null {\n if (!fs.existsSync(filePath)) return null\n const source = fs.readFileSync(filePath, 'utf8')\n const scriptKind = filePath.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS\n return ts.createSourceFile(filePath, source, ts.ScriptTarget.ES2020, true, scriptKind)\n}\n\nfunction resolveConventionFile(baseDir: string, basename: string): string | null {\n for (const extension of ['.ts', '.tsx']) {\n const candidate = path.join(baseDir, `${basename}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nfunction readStringPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const name = ts.isIdentifier(property.name)\n ? property.name.text\n : ts.isStringLiteralLike(property.name)\n ? property.name.text\n : undefined\n if (name !== propertyName) continue\n if (ts.isStringLiteralLike(property.initializer)) return property.initializer.text\n return undefined\n }\n return undefined\n}\n\nfunction getClassDecoratorCall(node: ts.ClassDeclaration, decoratorName: string): ts.CallExpression | undefined {\n const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n if (ts.isIdentifier(expression.expression) && expression.expression.text === decoratorName) {\n return expression\n }\n }\n return undefined\n}\n\nfunction readDecoratorTableName(decoratorCall: ts.CallExpression): string | undefined {\n const firstArgument = decoratorCall.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) return undefined\n return readStringPropertyInitializer(firstArgument, 'tableName')\n}\n\nfunction getPropertyDecoratorName(member: ts.PropertyDeclaration): string | undefined {\n const decorators = ts.canHaveDecorators(member) ? ts.getDecorators(member) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n const firstArgument = expression.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) continue\n const columnName = readStringPropertyInitializer(firstArgument, 'name')\n if (columnName) return columnName\n }\n return undefined\n}\n\nfunction classHasUpdatedAtColumn(node: ts.ClassDeclaration): boolean {\n for (const member of node.members) {\n if (!ts.isPropertyDeclaration(member) || !member.name) continue\n const propertyName = ts.isIdentifier(member.name)\n ? member.name.text\n : ts.isStringLiteralLike(member.name)\n ? member.name.text\n : undefined\n if (propertyName === 'updatedAt') return true\n if (getPropertyDecoratorName(member) === 'updated_at') return true\n }\n return false\n}\n\nfunction collectCustomFieldEntityIds(ceFilePath: string | null): Set<string> {\n const result = new Set<string>()\n if (!ceFilePath) return result\n const sourceFile = readSourceFile(ceFilePath)\n if (!sourceFile) return result\n\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node)) {\n const id = readStringPropertyInitializer(node, 'id')\n if (id && id.includes(':')) result.add(id)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEntities(\n moduleId: string,\n entitiesFilePath: string | null,\n customFieldEntityIds: Set<string>,\n): ModuleEntityFact[] {\n const sourceFile = entitiesFilePath ? readSourceFile(entitiesFilePath) : null\n if (!sourceFile) return []\n\n const facts: ModuleEntityFact[] = []\n sourceFile.forEachChild((node) => {\n if (!ts.isClassDeclaration(node) || !node.name) return\n const isExported = node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n if (!isExported) return\n const entityDecorator = getClassDecoratorCall(node, 'Entity')\n if (!entityDecorator) return\n\n const className = node.name.text\n const table = readDecoratorTableName(entityDecorator)\n if (!table) return\n\n const entityId = `${moduleId}:${toSnake(className)}`\n facts.push({\n id: entityId,\n class: className,\n table,\n editable: classHasUpdatedAtColumn(node),\n customFields: customFieldEntityIds.has(entityId),\n })\n })\n\n return facts\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression\n while (ts.isAsExpression(current) || ts.isParenthesizedExpression(current) || ts.isTypeAssertionExpression(current)) {\n current = current.expression\n }\n return current\n}\n\nfunction unwrapArrayLiteral(expression: ts.Expression): ts.ArrayLiteralExpression | null {\n const current = unwrapExpression(expression)\n return ts.isArrayLiteralExpression(current) ? current : null\n}\n\nfunction getPropertyName(property: ts.ObjectLiteralElementLike): string | undefined {\n if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) return undefined\n const name = property.name\n if (!name) return undefined\n if (ts.isIdentifier(name)) return name.text\n if (ts.isStringLiteralLike(name)) return name.text\n return undefined\n}\n\nfunction getObjectPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): ts.Expression | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n if (getPropertyName(property) === propertyName) return property.initializer\n }\n return undefined\n}\n\nfunction findObjectLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ObjectLiteralExpression | null {\n let result: ts.ObjectLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const unwrapped = unwrapExpression(node.initializer)\n if (ts.isObjectLiteralExpression(unwrapped)) {\n result = unwrapped\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction buildVariableInitializerMap(sourceFile: ts.SourceFile): Map<string, ts.Expression> {\n const initializers = new Map<string, ts.Expression>()\n const visit = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {\n if (!initializers.has(node.name.text)) initializers.set(node.name.text, node.initializer)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return initializers\n}\n\nfunction resolveToObjectLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ObjectLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isObjectLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToObjectLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction resolveToArrayLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ArrayLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isArrayLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToArrayLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction findDefaultExportExpression(sourceFile: ts.SourceFile): ts.Expression | null {\n for (const statement of sourceFile.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) return statement.expression\n }\n return null\n}\n\nfunction findArrayLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ArrayLiteralExpression | null {\n let result: ts.ArrayLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const arrayLiteral = unwrapArrayLiteral(node.initializer)\n if (arrayLiteral) {\n result = arrayLiteral\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEvents(eventsFilePath: string | null): ModuleEventFact[] {\n const sourceFile = eventsFilePath ? readSourceFile(eventsFilePath) : null\n if (!sourceFile) return []\n\n const eventsArray = findArrayLiteralDeclaration(sourceFile, 'events')\n if (!eventsArray) return []\n\n const facts: ModuleEventFact[] = []\n for (const element of eventsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const id = readStringPropertyInitializer(element, 'id')\n if (!id) continue\n const label = readStringPropertyInitializer(element, 'label')\n const category = readStringPropertyInitializer(element, 'category')\n const entity = readStringPropertyInitializer(element, 'entity')\n const fact: ModuleEventFact = {\n id,\n category: category ?? null,\n entity: entity ?? null,\n }\n if (label !== undefined) fact.label = label\n facts.push(fact)\n }\n\n return facts\n}\n\nfunction extractAclFeatures(aclFilePath: string | null): string[] {\n const sourceFile = aclFilePath ? readSourceFile(aclFilePath) : null\n if (!sourceFile) return []\n\n const featuresArray = findArrayLiteralDeclaration(sourceFile, 'features')\n if (!featuresArray) return []\n\n const featureIds: string[] = []\n const seen = new Set<string>()\n for (const element of featuresArray.elements) {\n let featureId: string | undefined\n if (ts.isObjectLiteralExpression(element)) {\n featureId = readStringPropertyInitializer(element, 'id')\n } else if (ts.isStringLiteralLike(element)) {\n featureId = element.text\n }\n if (!featureId || seen.has(featureId)) continue\n seen.add(featureId)\n featureIds.push(featureId)\n }\n\n return featureIds\n}\n\nfunction readBooleanPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): boolean | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n if (initializer.kind === ts.SyntaxKind.TrueKeyword) return true\n if (initializer.kind === ts.SyntaxKind.FalseKeyword) return false\n return undefined\n}\n\nfunction readStringArrayPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string[] | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n const arrayLiteral = unwrapArrayLiteral(initializer)\n if (!arrayLiteral) return undefined\n const values: string[] = []\n for (const element of arrayLiteral.elements) {\n if (ts.isStringLiteralLike(element)) values.push(element.text)\n }\n return values\n}\n\nfunction parseApiRouteAuthRule(metadataLiteral: ts.ObjectLiteralExpression): ApiRouteAuthRule {\n const rule: ApiRouteAuthRule = {}\n const requireAuth = readBooleanPropertyInitializer(metadataLiteral, 'requireAuth')\n if (requireAuth !== undefined) rule.requireAuth = requireAuth\n const requireFeatures = readStringArrayPropertyInitializer(metadataLiteral, 'requireFeatures')\n if (requireFeatures && requireFeatures.length > 0) rule.requireFeatures = requireFeatures\n const requireRoles = readStringArrayPropertyInitializer(metadataLiteral, 'requireRoles')\n if (requireRoles && requireRoles.length > 0) rule.requireRoles = requireRoles\n return rule\n}\n\nfunction parseApiRouteEntry(entryLiteral: ts.ObjectLiteralExpression): ModuleApiRouteFact | null {\n const routePath = readStringPropertyInitializer(entryLiteral, 'path')\n if (!routePath) return null\n\n const methods: string[] = []\n const seenMethods = new Set<string>()\n const handlersInitializer = getObjectPropertyInitializer(entryLiteral, 'handlers')\n if (handlersInitializer && ts.isObjectLiteralExpression(handlersInitializer)) {\n for (const property of handlersInitializer.properties) {\n const methodName = getPropertyName(property)\n if (methodName && !seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n } else {\n const singleMethod = readStringPropertyInitializer(entryLiteral, 'method')\n if (singleMethod && !seenMethods.has(singleMethod)) {\n seenMethods.add(singleMethod)\n methods.push(singleMethod)\n }\n }\n\n const auth: Record<string, ApiRouteAuthRule> = {}\n const metadataInitializer = getObjectPropertyInitializer(entryLiteral, 'metadata')\n if (metadataInitializer && ts.isObjectLiteralExpression(metadataInitializer)) {\n for (const property of metadataInitializer.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const methodName = getPropertyName(property)\n if (!methodName) continue\n const methodMetadata = unwrapExpression(property.initializer)\n if (!ts.isObjectLiteralExpression(methodMetadata)) continue\n auth[methodName] = parseApiRouteAuthRule(methodMetadata)\n if (!seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n }\n\n return { path: routePath, methods, auth }\n}\n\nfunction extractApiRoutes(\n moduleId: string,\n registrySource: string | null,\n registryDescription: string,\n warnings: string[],\n): ModuleApiRouteFact[] {\n if (registrySource == null) {\n warnings.push(`[module-facts] module registry unavailable (${registryDescription}); API route auth omitted for ${moduleId}`)\n return []\n }\n\n const sourceFile = ts.createSourceFile(\n 'module-registry.generated.ts',\n registrySource,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS,\n )\n\n const routes: ModuleApiRouteFact[] = []\n const seenPaths = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node) && readStringPropertyInitializer(node, 'id') === moduleId) {\n const apisInitializer = getObjectPropertyInitializer(node, 'apis')\n const apisArray = apisInitializer ? unwrapArrayLiteral(apisInitializer) : null\n if (apisArray) {\n for (const element of apisArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const route = parseApiRouteEntry(element)\n if (route && !seenPaths.has(route.path)) {\n seenPaths.add(route.path)\n routes.push(route)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return routes\n}\n\nfunction resolveRegistrySource(options: ExtractModuleFactsOptions): { source: string | null; description: string } {\n if (typeof options.registrySource === 'string') {\n return { source: options.registrySource, description: 'registrySource' }\n }\n if (options.registryPath) {\n if (!fs.existsSync(options.registryPath)) {\n return { source: null, description: options.registryPath }\n }\n return { source: fs.readFileSync(options.registryPath, 'utf8'), description: options.registryPath }\n }\n return { source: null, description: 'registryPath not provided' }\n}\n\nfunction detectAwilixRegistrationKind(expression: ts.Expression): string | null {\n let current: ts.Expression = unwrapExpression(expression)\n while (ts.isCallExpression(current)) {\n const callee = current.expression\n if (ts.isIdentifier(callee)) return callee.text\n if (ts.isPropertyAccessExpression(callee)) {\n current = callee.expression\n continue\n }\n break\n }\n return null\n}\n\nfunction extractDiTokens(diFilePath: string | null): string[] {\n if (!diFilePath) return []\n const sourceFile = readSourceFile(diFilePath)\n if (!sourceFile) return []\n\n const tokens: string[] = []\n const seen = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'register'\n ) {\n const argument = node.arguments[0]\n if (argument && ts.isObjectLiteralExpression(argument)) {\n for (const property of argument.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const kind = detectAwilixRegistrationKind(property.initializer)\n if (kind !== 'asFunction' && kind !== 'asClass') continue\n const tokenName = getPropertyName(property)\n if (tokenName && !seen.has(tokenName)) {\n seen.add(tokenName)\n tokens.push(tokenName)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return tokens\n}\n\nfunction extractSearchEntities(searchFilePath: string | null, warnings: string[]): string[] {\n if (!searchFilePath) return []\n const sourceFile = readSourceFile(searchFilePath)\n if (!sourceFile) return []\n\n const searchConfig = findObjectLiteralDeclaration(sourceFile, 'searchConfig')\n if (!searchConfig) {\n warnings.push(`[module-facts] search.ts present but no searchConfig object literal: ${searchFilePath}`)\n return []\n }\n const entitiesInitializer = getObjectPropertyInitializer(searchConfig, 'entities')\n const entitiesArray = entitiesInitializer ? unwrapArrayLiteral(entitiesInitializer) : null\n if (!entitiesArray) {\n warnings.push(`[module-facts] searchConfig.entities is not an array literal: ${searchFilePath}`)\n return []\n }\n\n const entityIds: string[] = []\n const seen = new Set<string>()\n for (const element of entitiesArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const entityId = readStringPropertyInitializer(element, 'entityId')\n if (entityId && !seen.has(entityId)) {\n seen.add(entityId)\n entityIds.push(entityId)\n }\n }\n return entityIds\n}\n\nfunction extractNotifications(notificationsFilePath: string | null, warnings: string[]): string[] {\n if (!notificationsFilePath) return []\n const sourceFile = readSourceFile(notificationsFilePath)\n if (!sourceFile) return []\n\n const notificationsArray =\n findArrayLiteralDeclaration(sourceFile, 'notificationTypes') ??\n findArrayLiteralDeclaration(sourceFile, 'notifications')\n if (!notificationsArray) {\n warnings.push(`[module-facts] notifications.ts present but no notificationTypes array literal: ${notificationsFilePath}`)\n return []\n }\n\n const notificationIds: string[] = []\n const seen = new Set<string>()\n for (const element of notificationsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const notificationId = readStringPropertyInitializer(element, 'type')\n if (notificationId && !seen.has(notificationId)) {\n seen.add(notificationId)\n notificationIds.push(notificationId)\n }\n }\n return notificationIds\n}\n\nfunction extractCli(cliFilePath: string | null, warnings: string[]): string[] {\n if (!cliFilePath) return []\n const sourceFile = readSourceFile(cliFilePath)\n if (!sourceFile) return []\n\n const defaultExport = findDefaultExportExpression(sourceFile)\n if (!defaultExport) {\n warnings.push(`[module-facts] cli.ts present but no default export: ${cliFilePath}`)\n return []\n }\n\n const initializers = buildVariableInitializerMap(sourceFile)\n const collectCommand = (objectLiteral: ts.ObjectLiteralExpression): string | undefined =>\n readStringPropertyInitializer(objectLiteral, 'command')\n\n const commands: string[] = []\n const seen = new Set<string>()\n const pushCommand = (command: string | undefined): void => {\n if (command && !seen.has(command)) {\n seen.add(command)\n commands.push(command)\n }\n }\n\n const arrayLiteral = resolveToArrayLiteral(defaultExport, initializers)\n if (arrayLiteral) {\n for (const element of arrayLiteral.elements) {\n const objectLiteral = resolveToObjectLiteral(element, initializers)\n if (objectLiteral) pushCommand(collectCommand(objectLiteral))\n }\n return commands\n }\n\n const singleObject = resolveToObjectLiteral(defaultExport, initializers)\n if (singleObject) {\n pushCommand(collectCommand(singleObject))\n return commands\n }\n\n warnings.push(`[module-facts] cli.ts default export is neither an array nor an object literal: ${cliFilePath}`)\n return commands\n}\n\nfunction listSourceFilesRecursive(directory: string): string[] {\n const files: string[] = []\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.name === '__tests__' || entry.name === 'node_modules') continue\n const fullPath = path.join(directory, entry.name)\n if (entry.isDirectory()) {\n files.push(...listSourceFilesRecursive(fullPath))\n } else if (/\\.tsx?$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(fullPath)\n }\n }\n return files\n}\n\nfunction extractTableIds(backendDir: string): string[] {\n if (!fs.existsSync(backendDir)) return []\n\n const tableIds: string[] = []\n const seen = new Set<string>()\n for (const filePath of listSourceFilesRecursive(backendDir)) {\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAssignment(node)) {\n const propertyName = getPropertyName(node)\n if (\n (propertyName === 'tableId' || propertyName === 'extensionTableId') &&\n ts.isStringLiteralLike(node.initializer)\n ) {\n const value = node.initializer.text\n if (value && !seen.has(value)) {\n seen.add(value)\n tableIds.push(value)\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n }\n tableIds.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))\n return tableIds\n}\n\nfunction extractHostEntityIds(entities: ModuleEntityFact[]): string[] {\n return entities.filter((entity) => entity.id.endsWith('_entity')).map((entity) => entity.id)\n}\n\nfunction extractModuleMeta(indexFilePath: string | null): { title: string | null; description: string | null } {\n if (!indexFilePath) return { title: null, description: null }\n const sourceFile = readSourceFile(indexFilePath)\n if (!sourceFile) return { title: null, description: null }\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) return { title: null, description: null }\n return {\n title: readStringPropertyInitializer(metadata, 'title') ?? null,\n description: readStringPropertyInitializer(metadata, 'description') ?? null,\n }\n}\n\nexport function extractModuleFacts(options: ExtractModuleFactsOptions): ModuleFacts {\n const { moduleId, coreVersion = null } = options\n const moduleRoot = options.moduleRoot\n ?? (options.coreSrcRoot ? path.join(options.coreSrcRoot, moduleId) : null)\n if (!moduleRoot) {\n throw new Error(`[internal] extractModuleFacts requires moduleRoot or coreSrcRoot for module \"${moduleId}\"`)\n }\n\n const entitiesFilePath =\n resolveConventionFile(path.join(moduleRoot, 'data'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'db'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'data'), 'schema')\n const ceFilePath = resolveConventionFile(moduleRoot, 'ce')\n const eventsFilePath = resolveConventionFile(moduleRoot, 'events')\n const aclFilePath = resolveConventionFile(moduleRoot, 'acl')\n const diFilePath = resolveConventionFile(moduleRoot, 'di')\n const searchFilePath = resolveConventionFile(moduleRoot, 'search')\n const notificationsFilePath = resolveConventionFile(moduleRoot, 'notifications')\n const cliFilePath = resolveConventionFile(moduleRoot, 'cli')\n const indexFilePath = resolveConventionFile(moduleRoot, 'index')\n const backendDir = path.join(moduleRoot, 'backend')\n\n const warnings: string[] = []\n const { title, description } = extractModuleMeta(indexFilePath)\n const customFieldEntityIds = collectCustomFieldEntityIds(ceFilePath)\n const entities = extractEntities(moduleId, entitiesFilePath, customFieldEntityIds)\n const events = extractEvents(eventsFilePath)\n const aclFeatures = extractAclFeatures(aclFilePath)\n\n const { source: registrySource, description: registryDescription } = resolveRegistrySource(options)\n const apiRoutes = extractApiRoutes(moduleId, registrySource, registryDescription, warnings)\n const diTokens = extractDiTokens(diFilePath)\n const searchEntities = extractSearchEntities(searchFilePath, warnings)\n const notifications = extractNotifications(notificationsFilePath, warnings)\n const cli = extractCli(cliFilePath, warnings)\n const hostTokens: ModuleHostTokens = {\n entityIds: extractHostEntityIds(entities),\n tableIds: extractTableIds(backendDir),\n }\n\n return {\n module: moduleId,\n title,\n description,\n coreVersion,\n entities,\n events,\n aclFeatures,\n apiRoutes,\n diTokens,\n searchEntities,\n hostTokens,\n notifications,\n cli,\n warnings,\n }\n}\n\nexport interface ModuleFactsJsonEvent {\n id: string\n category: string | null\n entity: string | null\n}\n\nexport interface ModuleFactsJsonEntry {\n title: string | null\n description: string | null\n coreVersion: string | null\n entities: ModuleEntityFact[]\n events: ModuleFactsJsonEvent[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n}\n\nconst EMPTY_SECTION_MARKER = '_none_'\n\nfunction renderVersionStamp(coreVersion: string | null): string {\n const version = coreVersion && coreVersion.length > 0 ? coreVersion : '<unknown>'\n return `<!-- generated from @open-mercato/core ${version} \u2014 R1 staleness stamp -->`\n}\n\nfunction renderEntitiesSection(entities: ModuleEntityFact[]): string {\n if (entities.length === 0) return `## Entities\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Entity ID | Class | Table | Editable | CustomFields |'\n const divider = '|---|---|---|---|---|'\n const rows = entities.map(\n (entity) =>\n `| ${entity.id} | ${entity.class} | ${entity.table} | ${entity.editable ? 'yes' : 'no'} | ${entity.customFields ? 'yes' : 'no'} |`,\n )\n return ['## Entities', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderEventsSection(events: ModuleEventFact[]): string {\n const heading = `## Events (${events.length})`\n if (events.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| ID | Category | Entity |'\n const divider = '|---|---|---|'\n const rows = events.map((event) => `| ${event.id} | ${event.category ?? '\u2014'} | ${event.entity ?? '\u2014'} |`)\n return [heading, '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderInlineListSection(heading: string, values: string[]): string {\n if (values.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n return `${heading}\\n\\n${values.join(' \u00B7 ')}`\n}\n\nfunction describeAuthRule(rule: ApiRouteAuthRule | undefined): string {\n if (!rule) return 'public'\n if (rule.requireFeatures && rule.requireFeatures.length > 0) return rule.requireFeatures.join(', ')\n if (rule.requireRoles && rule.requireRoles.length > 0) return rule.requireRoles.join(', ')\n if (rule.requireAuth) return 'auth'\n return 'public'\n}\n\nfunction renderApiRouteAuthCell(route: ModuleApiRouteFact): string {\n if (route.methods.length === 0) return '\u2014'\n const groups: Array<{ label: string; methods: string[] }> = []\n for (const method of route.methods) {\n const label = describeAuthRule(route.auth[method])\n const existing = groups.find((group) => group.label === label)\n if (existing) existing.methods.push(method)\n else groups.push({ label, methods: [method] })\n }\n return groups.map((group) => `${group.methods.join('/')} \u2192 ${group.label}`).join(' \u00B7 ')\n}\n\nfunction renderApiRoutesSection(routes: ModuleApiRouteFact[]): string {\n if (routes.length === 0) return `## API routes\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Path | Methods | Auth (per-method requireFeatures) |'\n const divider = '|---|---|---|'\n const rows = routes.map(\n (route) => `| ${route.path} | ${route.methods.join(' ')} | ${renderApiRouteAuthCell(route)} |`,\n )\n return ['## API routes', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderHostTokensSection(hostTokens: ModuleHostTokens): string {\n const entityIdsLine = hostTokens.entityIds.length > 0 ? hostTokens.entityIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n const tableIdsLine = hostTokens.tableIds.length > 0 ? hostTokens.tableIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n return ['## Host extension points', '', `- Entity IDs: ${entityIdsLine}`, `- Table IDs: ${tableIdsLine}`].join('\\n')\n}\n\nexport function renderModuleFactsMarkdown(facts: ModuleFacts): string {\n const sections = [\n `# ${facts.module} \u2014 module facts (generated, do not edit)`,\n renderVersionStamp(facts.coreVersion),\n '',\n renderEntitiesSection(facts.entities),\n '',\n renderEventsSection(facts.events),\n '',\n renderInlineListSection(`## ACL features (${facts.aclFeatures.length})`, facts.aclFeatures),\n '',\n renderApiRoutesSection(facts.apiRoutes),\n '',\n renderInlineListSection('## DI service tokens', facts.diTokens),\n '',\n renderInlineListSection('## Search entities', facts.searchEntities),\n '',\n renderHostTokensSection(facts.hostTokens),\n '',\n renderInlineListSection('## Notifications', facts.notifications),\n '',\n renderInlineListSection('## CLI', facts.cli),\n '',\n ]\n return sections.join('\\n')\n}\n\nexport function toModuleFactsJsonEntry(facts: ModuleFacts): ModuleFactsJsonEntry {\n return {\n title: facts.title,\n description: facts.description,\n coreVersion: facts.coreVersion,\n entities: facts.entities,\n events: facts.events.map((event) => ({ id: event.id, category: event.category, entity: event.entity })),\n aclFeatures: facts.aclFeatures,\n apiRoutes: facts.apiRoutes,\n diTokens: facts.diTokens,\n searchEntities: facts.searchEntities,\n hostTokens: facts.hostTokens,\n notifications: facts.notifications,\n cli: facts.cli,\n }\n}\n\nexport function buildModuleFactsJsonObject(\n factsByModule: Record<string, ModuleFacts>,\n): Record<string, ModuleFactsJsonEntry> {\n const result: Record<string, ModuleFactsJsonEntry> = {}\n for (const moduleId of Object.keys(factsByModule).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))) {\n result[moduleId] = toModuleFactsJsonEntry(factsByModule[moduleId])\n }\n return result\n}\n\nexport function renderModuleFactsJson(factsByModule: Record<string, ModuleFacts>): string {\n return `${JSON.stringify(buildModuleFactsJsonObject(factsByModule), null, 2)}\\n`\n}\n\nexport interface ExtractAllModuleFactsOptions {\n /**\n * Discovered module sources (auto-discovery path). When provided, each entry's\n * explicit `moduleRoot` is used and `coreSrcRoot`/`moduleIds` are ignored.\n */\n sources?: readonly ModuleFactSource[]\n /** Legacy shared-root path. Used only when `sources` is not provided. */\n coreSrcRoot?: string\n registryPath?: string | null\n registrySource?: string | null\n coreVersion?: string | null\n /** @deprecated Legacy explicit module-id list; only consulted when `sources` is absent. */\n moduleIds?: readonly string[]\n}\n\nexport interface ExtractAllModuleFactsResult {\n factsByModule: Record<string, ModuleFacts>\n markdownByModule: Record<string, string>\n warnings: string[]\n}\n\nexport function extractAllModuleFacts(options: ExtractAllModuleFactsOptions): ExtractAllModuleFactsResult {\n const sources: ModuleFactSource[] = options.sources\n ? [...options.sources]\n : (options.coreSrcRoot\n ? (options.moduleIds ?? []).map((moduleId) => ({\n moduleId,\n moduleRoot: path.join(options.coreSrcRoot as string, moduleId),\n }))\n : [])\n\n const factsByModule: Record<string, ModuleFacts> = {}\n const markdownByModule: Record<string, string> = {}\n const warnings: string[] = []\n for (const source of sources) {\n const facts = extractModuleFacts({\n moduleId: source.moduleId,\n moduleRoot: source.moduleRoot,\n coreVersion: options.coreVersion ?? null,\n registryPath: options.registryPath ?? null,\n registrySource: options.registrySource ?? null,\n })\n factsByModule[source.moduleId] = facts\n markdownByModule[source.moduleId] = renderModuleFactsMarkdown(facts)\n warnings.push(...facts.warnings)\n }\n return { factsByModule, markdownByModule, warnings }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,eAAe;AA0ExB,SAAS,eAAe,UAAwC;AAC9D,MAAI,CAAC,GAAG,WAAW,QAAQ,EAAG,QAAO;AACrC,QAAM,SAAS,GAAG,aAAa,UAAU,MAAM;AAC/C,QAAM,aAAa,SAAS,SAAS,MAAM,IAAI,GAAG,WAAW,MAAM,GAAG,WAAW;AACjF,SAAO,GAAG,iBAAiB,UAAU,QAAQ,GAAG,aAAa,QAAQ,MAAM,UAAU;AACvF;AAEA,SAAS,sBAAsB,SAAiB,UAAiC;AAC/E,aAAW,aAAa,CAAC,OAAO,MAAM,GAAG;AACvC,UAAM,YAAY,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9D,QAAI,GAA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