@open-mercato/cli 0.6.7-develop.6756.1.5300c41145 → 0.6.7-develop.6766.1.40c9011995
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 +1 -1
- package/build.mjs +2 -1
- package/dist/agentic/guides/extensions.md +20 -3
- package/dist/agentic/guides/framework-extension-points.md +36 -0
- package/dist/agentic/guides/module-facts.json +39708 -230
- package/dist/agentic/guides/modules/ai_assistant.md +49 -9
- package/dist/agentic/guides/modules/api_docs.md +11 -1
- package/dist/agentic/guides/modules/api_keys.md +24 -1
- package/dist/agentic/guides/modules/attachments.md +22 -6
- package/dist/agentic/guides/modules/audit_logs.md +35 -1
- package/dist/agentic/guides/modules/auth.md +79 -15
- package/dist/agentic/guides/modules/business_rules.md +36 -3
- package/dist/agentic/guides/modules/catalog.md +160 -22
- package/dist/agentic/guides/modules/channel_gmail.md +14 -1
- package/dist/agentic/guides/modules/channel_imap.md +14 -1
- package/dist/agentic/guides/modules/checkout.md +134 -19
- package/dist/agentic/guides/modules/communication_channels.md +110 -20
- package/dist/agentic/guides/modules/configs.md +15 -1
- package/dist/agentic/guides/modules/content.md +11 -1
- package/dist/agentic/guides/modules/currencies.md +50 -9
- package/dist/agentic/guides/modules/customer_accounts.md +151 -28
- package/dist/agentic/guides/modules/customers.md +299 -52
- package/dist/agentic/guides/modules/dashboards.md +30 -1
- package/dist/agentic/guides/modules/data_sync.md +40 -7
- package/dist/agentic/guides/modules/dictionaries.md +24 -6
- package/dist/agentic/guides/modules/directory.md +52 -9
- package/dist/agentic/guides/modules/entities.md +41 -1
- package/dist/agentic/guides/modules/events.md +11 -1
- package/dist/agentic/guides/modules/feature_toggles.md +15 -1
- package/dist/agentic/guides/modules/gateway_stripe.md +14 -1
- package/dist/agentic/guides/modules/generators.md +11 -1
- package/dist/agentic/guides/modules/inbox_ops.md +58 -16
- package/dist/agentic/guides/modules/integrations.md +30 -7
- package/dist/agentic/guides/modules/messages.md +68 -13
- package/dist/agentic/guides/modules/notifications.md +13 -1
- package/dist/agentic/guides/modules/onboarding.md +13 -1
- package/dist/agentic/guides/modules/payment_gateways.md +51 -12
- package/dist/agentic/guides/modules/perspectives.md +16 -1
- package/dist/agentic/guides/modules/planner.md +33 -9
- package/dist/agentic/guides/modules/portal.md +24 -1
- package/dist/agentic/guides/modules/progress.md +34 -9
- package/dist/agentic/guides/modules/query_index.md +56 -3
- package/dist/agentic/guides/modules/record_locks.md +60 -13
- package/dist/agentic/guides/modules/resources.md +79 -18
- package/dist/agentic/guides/modules/sales.md +238 -48
- package/dist/agentic/guides/modules/scheduler.md +23 -7
- package/dist/agentic/guides/modules/search.md +28 -3
- package/dist/agentic/guides/modules/security.md +106 -23
- package/dist/agentic/guides/modules/shipping_carriers.md +38 -10
- package/dist/agentic/guides/modules/sso.md +47 -15
- package/dist/agentic/guides/modules/staff.md +117 -38
- package/dist/agentic/guides/modules/storage_s3.md +13 -1
- package/dist/agentic/guides/modules/sync_akeneo.md +13 -1
- package/dist/agentic/guides/modules/sync_excel.md +15 -1
- package/dist/agentic/guides/modules/system_status_overlays.md +14 -1
- package/dist/agentic/guides/modules/translations.md +25 -5
- package/dist/agentic/guides/modules/webhooks.md +85 -15
- package/dist/agentic/guides/modules/wms.md +234 -31
- package/dist/agentic/guides/modules/workflows.md +114 -30
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +7 -0
- package/dist/agentic/guides/upstream/manifest.json +2 -2
- package/dist/agentic/shared/AGENTS.md.template +2 -2
- package/dist/agentic/shared/ai/harness/README.md +2 -0
- package/dist/agentic/shared/ai/harness/cases.json +80 -39
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +3 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -1
- package/dist/agentic/shared/scripts/framework-context.mjs +3 -9
- package/dist/lib/generators/module-extension-facts.js +1185 -0
- package/dist/lib/generators/module-extension-facts.js.map +7 -0
- package/dist/lib/generators/module-facts.js +134 -7
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-registry.js +1 -0
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/package.json +5 -5
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +402 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +39 -2
- package/src/lib/generators/module-extension-facts.ts +1428 -0
- package/src/lib/generators/module-facts.ts +143 -6
- package/src/lib/generators/module-registry.ts +1 -1
|
@@ -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 { 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 sourcePath: string | null\n}\n\nexport interface ModulePageFact {\n path: string\n sourcePath: string\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}\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 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 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 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, 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.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 pages.push({\n path: routePath,\n sourcePath: toPortableSourcePath(moduleRoot, sourceRoot, filePath),\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\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\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 diTokens = extractDiTokens(diFilePath)\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\n return {\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 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 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}\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[]): 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 renderSourceLink(sourcePath: string): string {\n return `[${sourcePath}](../../../${sourcePath})`\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\nexport function renderModuleFactsMarkdown(facts: ModuleFacts): string {\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),\n '',\n renderEventsSection(facts.events),\n '',\n renderInlineListSection(`## ACL features (${facts.aclFeatures.length})`, facts.aclFeatures),\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 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 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 ]\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) => ({ 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 backendPages: facts.backendPages,\n frontendPages: facts.frontendPages,\n cliCommands: facts.cliCommands,\n aiTools: facts.aiTools,\n aiAgents: facts.aiAgents,\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 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 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;AA0GxB,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,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KAAK,KAAK,QAAQ,aAAuB,QAAQ;AAAA,EAC/D,EAAE,IACF,CAAC;AAET,QAAM,gBAA6C,CAAC;AACpD,QAAM,mBAA2C,CAAC;AAClD,QAAM,WAAqB,CAAC;AAC5B,aAAW,UAAU,SAAS;AAC5B,UAAM,QAAQ,mBAAmB;AAAA,MAC/B,UAAU,OAAO;AAAA,MACjB,YAAY,OAAO;AAAA,MACnB,aAAa,QAAQ,eAAe;AAAA,MACpC,eAAe,OAAO,QAAQ;AAAA,MAC9B,eAAe,OAAO,kBAAkB;AAAA,MACxC,cAAc,QAAQ,gBAAgB;AAAA,MACtC,gBAAgB,QAAQ,kBAAkB;AAAA,IAC5C,CAAC;AACD,kBAAc,OAAO,QAAQ,IAAI;AACjC,qBAAiB,OAAO,QAAQ,IAAI,0BAA0B,KAAK;AACnE,aAAS,KAAK,GAAG,MAAM,QAAQ;AAAA,EACjC;AACA,SAAO,EAAE,eAAe,kBAAkB,SAAS;AACrD;",
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport type { ModuleExtensionContributionFact, ModuleExtensionSurfaceFacts } from '@open-mercato/shared/modules/widgets/extension-points'\nimport { toSnake } from '../utils'\nimport {\n assertNoUnresolvedExtensionTargets,\n correlateModuleExtensionFacts,\n extractKnownApiRouteIds,\n extractKnownCommandIds,\n extractModuleExtensionFacts,\n renderFrameworkExtensionPointsMarkdown,\n} from './module-extension-facts'\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\nexport interface ModulePageFact {\n path: string\n sourcePath: string\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 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 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.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 pages.push({\n path: routePath,\n sourcePath: toPortableSourcePath(moduleRoot, sourceRoot, filePath),\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\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\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 diTokens = extractDiTokens(diFilePath)\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 return {\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 warnings,\n }\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}\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[]): 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 | Browser transport |'\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'} |`\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 renderSourceLink(sourcePath: string): string {\n return `[${sourcePath}](../../../${sourcePath})`\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 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()} |`,\n )\n return [\n '## UMES hosts',\n '',\n '| ID / pattern | Family | Supports | Context | Stability |',\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 return `| ${contribution.id} | ${contribution.kind} | ${targets || '\u2014'} | ${phases} | ${compactContributionDetails(contribution)} | ${resolution || '\u2014'} |`\n })\n return [\n '## UMES contributions',\n '',\n '| ID | Kind | Target | Phase / operations | Contract | Resolution |',\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\nexport function renderModuleFactsMarkdown(facts: ModuleFacts): string {\n const extensionSurfaces = facts.extensionSurfaces ?? { hosts: [], contributions: [], unresolved: [] }\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),\n '',\n renderEventsSection(facts.events),\n '',\n renderInlineListSection(`## ACL features (${facts.aclFeatures.length})`, facts.aclFeatures),\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 renderInlineListSection('## DI service tokens', facts.diTokens),\n '',\n renderInlineListSection('## Search entities', facts.searchEntities),\n '',\n renderHostTokensSection(facts.hostTokens),\n '',\n renderExtensionHostsSection(extensionSurfaces),\n '',\n renderExtensionContributionsSection(extensionSurfaces),\n '',\n renderExtensionDiagnosticsSection(extensionSurfaces),\n '',\n renderInlineListSection('## Notifications', facts.notifications),\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 ]\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 }\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 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 for (const moduleId of Object.keys(factsByModule).sort((left, right) => left.localeCompare(right))) {\n factsByModule[moduleId].extensionSurfaces = correlated[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;AAEf,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6GP,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,MA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