@hexaijs/plugin-contracts-generator 0.2.0 → 0.2.1
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/README.md +33 -25
- package/dist/{cli-CPg-O4OY.d.ts → cli-DajurpEQ.d.ts} +70 -7
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +95 -101
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -77
- package/dist/index.js +96 -123
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/package.json +3 -7
- package/dist/decorators/index.d.ts +0 -144
- package/dist/decorators/index.js +0 -28
- package/dist/decorators/index.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/domain/types.ts","../src/decorators/index.ts","../src/errors.ts","../src/file-system.ts","../src/scanner.ts","../src/ast-utils.ts","../src/class-analyzer.ts","../src/import-analyzer.ts","../src/parser.ts","../src/file-graph-resolver.ts","../src/file-copier.ts","../src/context-config.ts","../src/config-loader.ts","../src/registry-generator.ts","../src/reexport-generator.ts","../src/logger.ts","../src/pipeline.ts","../src/cli.ts","../src/hexai-plugin.ts","../src/index.ts"],"names":["path","ts","ts2","ts3","path2","TYPESCRIPT_EXTENSIONS","INDEX_FILE","dirname","exports","relative","path4","ts9","join","resolve","VALID_MESSAGE_TYPES","parseMessageTypes"],"mappings":";;;;;;;;;;;;AAyMO,IAAM,uBAAA,GAAoD;AAAA,EAC/D,KAAA,EAAO,aAAA;AAAA,EACP,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAA;AAGO,SAAS,oBAAoB,OAAA,EAAoD;AACtF,EAAA,OAAO;AAAA,IACL,GAAG,uBAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF;AAiBO,SAAS,gBAAgB,IAAA,EAAsC;AACpE,EAAA,OAAO,KAAK,IAAA,KAAS,WAAA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c,KAAK,YAAA,GACbC,kBAAAA,CAAkB,OAAO,IAAA,CAAK,YAAY,CAAC,CAAA,GAC3C,MAAA;AAAA,MACN,uBAAA,EAAyB,KAAK,uBAAA,KAA4B;AAAA,KAC9D;AAEA,IAAA,MAAM,aAAA,CAAc,SAAS,MAAM,CAAA;AAAA,EACvC;AACJ;;;AC8EA,eAAsB,eAClB,OAAA,EAC6B;AAC7B,EAAA,MAAM;AAAA,IACF,WAAA;AAAA,IACA,IAAA,EAAM,WAAA;AAAA,IACN,SAAA;AAAA,IACA,SAAA;AAAA,IACA,iBAAA;AAAA,IACA,YAAA;AAAA,IACA,yBAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA,GAAa,cAAA;AAAA,IACb,MAAA,GAAS;AAAA,GACb,GAAI,OAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,MAAM,aAAA,CAAc,MAAA;AAAA,IACtC;AAAA,MACI,IAAA,EAAM,WAAA;AAAA,MACN,IAAA,EAAM,WAAA;AAAA,MACN,SAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACJ;AAAA,IACA,QAAQ,GAAA,EAAI;AAAA,IACZ;AAAA,GACJ;AAEA,EAAA,OAAO,kBAAkB,MAAA,CAAO;AAAA,IAC5B,aAAA;AAAA,IACA,yBAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACH,EAAE,OAAA,CAAQ;AAAA,IACP,WAAA;AAAA,IACA,WAAW,aAAA,CAAc,SAAA;AAAA,IACzB,SAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACH,CAAA;AACL","file":"index.js","sourcesContent":["export interface SourceFile {\n readonly absolutePath: string;\n readonly relativePath: string;\n readonly packageName?: string;\n}\n\nexport type TypeRef =\n | PrimitiveType\n | ArrayType\n | ObjectType\n | UnionType\n | IntersectionType\n | ReferenceType\n | LiteralType\n | TupleType\n | FunctionType;\n\nexport interface PrimitiveType {\n readonly kind: 'primitive';\n readonly name:\n | 'string'\n | 'number'\n | 'boolean'\n | 'null'\n | 'undefined'\n | 'void'\n | 'any'\n | 'unknown'\n | 'never'\n | 'bigint'\n | 'symbol';\n}\n\nexport interface ArrayType {\n readonly kind: 'array';\n readonly elementType: TypeRef;\n}\n\nexport interface ObjectType {\n readonly kind: 'object';\n readonly fields: readonly Field[];\n}\n\nexport interface UnionType {\n readonly kind: 'union';\n readonly types: readonly TypeRef[];\n}\n\nexport interface IntersectionType {\n readonly kind: 'intersection';\n readonly types: readonly TypeRef[];\n}\n\nexport interface ReferenceType {\n readonly kind: 'reference';\n readonly name: string;\n readonly typeArguments?: readonly TypeRef[];\n}\n\nexport interface LiteralType {\n readonly kind: 'literal';\n readonly value: string | number | boolean;\n}\n\nexport interface TupleType {\n readonly kind: 'tuple';\n readonly elements: readonly TypeRef[];\n}\n\nexport interface FunctionType {\n readonly kind: 'function';\n readonly parameters: readonly FunctionParameter[];\n readonly returnType: TypeRef;\n}\n\nexport interface FunctionParameter {\n readonly name: string;\n readonly type: TypeRef;\n readonly optional: boolean;\n}\n\nexport interface Field {\n readonly name: string;\n readonly type: TypeRef;\n readonly optional: boolean;\n readonly readonly: boolean;\n}\n\nexport type TypeDefinitionKind = 'interface' | 'type' | 'enum' | 'class';\n\nexport interface TypeDefinition {\n readonly name: string;\n readonly kind: TypeDefinitionKind;\n readonly sourceFile: SourceFile;\n readonly body: TypeRef;\n readonly typeParameters?: readonly string[];\n readonly exported: boolean;\n}\n\nexport interface EnumMember {\n readonly name: string;\n readonly value?: string | number;\n}\n\nexport interface EnumDefinition extends Omit<TypeDefinition, 'kind' | 'body'> {\n readonly kind: 'enum';\n readonly members: readonly EnumMember[];\n}\n\nexport interface ClassImport {\n readonly names: readonly string[];\n readonly source: string;\n readonly isTypeOnly: boolean;\n readonly isExternal: boolean;\n}\n\nexport interface ClassDefinition {\n readonly name: string;\n readonly kind: 'class';\n readonly sourceFile: SourceFile;\n readonly sourceText: string;\n readonly imports: readonly ClassImport[];\n readonly dependencies: readonly string[];\n readonly baseClass?: string;\n readonly exported: boolean;\n}\n\nexport interface MessageBase {\n readonly name: string;\n readonly sourceFile: SourceFile;\n readonly fields: readonly Field[];\n readonly baseClass?: string;\n readonly sourceText: string;\n readonly imports: readonly ClassImport[];\n}\n\nexport interface DomainEvent extends MessageBase {\n readonly messageType: 'event';\n readonly version?: number;\n readonly context?: string;\n readonly payloadType?: TypeRef;\n}\n\nexport interface Command extends MessageBase {\n readonly messageType: 'command';\n readonly resultType?: TypeRef;\n readonly context?: string;\n readonly payloadType?: TypeRef;\n}\n\nexport interface Query extends MessageBase {\n readonly messageType: 'query';\n readonly resultType?: TypeRef;\n readonly context?: string;\n readonly payloadType?: TypeRef;\n}\n\nexport type Message = DomainEvent | Command | Query;\n\n/** Used to filter which decorators the scanner should look for. */\nexport type MessageType = Message['messageType'];\n\nexport type ImportSource =\n | { readonly type: 'local'; readonly path: string }\n | { readonly type: 'external'; readonly package: string };\n\nexport type DependencyKind = 'type' | 'value' | 'class';\n\nexport interface Dependency {\n readonly name: string;\n readonly source: ImportSource;\n readonly kind: DependencyKind;\n readonly definition?: TypeDefinition;\n}\n\nexport interface SourceLocation {\n readonly file: string;\n readonly message: string;\n readonly line?: number;\n readonly column?: number;\n}\n\nexport type ExtractionError = SourceLocation;\nexport type ExtractionWarning = SourceLocation;\n\nexport interface ExtractionResult {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly types: readonly TypeDefinition[];\n readonly dependencies: readonly Dependency[];\n readonly errors: readonly ExtractionError[];\n readonly warnings: readonly ExtractionWarning[];\n}\n\n/** Customizes decorator names used to identify public messages. Unspecified names use defaults. */\nexport interface DecoratorNames {\n event?: string;\n command?: string;\n query?: string;\n}\n\nexport const DEFAULT_DECORATOR_NAMES: Required<DecoratorNames> = {\n event: \"PublicEvent\",\n command: \"PublicCommand\",\n query: \"PublicQuery\",\n};\n\n/** Merges partial decorator names with defaults for backward compatibility. */\nexport function mergeDecoratorNames(partial?: DecoratorNames): Required<DecoratorNames> {\n return {\n ...DEFAULT_DECORATOR_NAMES,\n ...partial,\n };\n}\n\nexport interface ResponseNamingConvention {\n readonly messageSuffix: string;\n readonly responseSuffix: string;\n}\n\nexport interface Config {\n readonly sourceDir: string;\n readonly outputDir: string;\n readonly include?: readonly string[];\n readonly exclude?: readonly string[];\n readonly externalPackages?: Readonly<Record<string, string>>;\n readonly decoratorNames?: DecoratorNames;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n}\n\nexport function isPrimitiveType(type: TypeRef): type is PrimitiveType {\n return type.kind === 'primitive';\n}\n\nexport function isArrayType(type: TypeRef): type is ArrayType {\n return type.kind === 'array';\n}\n\nexport function isObjectType(type: TypeRef): type is ObjectType {\n return type.kind === 'object';\n}\n\nexport function isUnionType(type: TypeRef): type is UnionType {\n return type.kind === 'union';\n}\n\nexport function isIntersectionType(type: TypeRef): type is IntersectionType {\n return type.kind === 'intersection';\n}\n\nexport function isReferenceType(type: TypeRef): type is ReferenceType {\n return type.kind === 'reference';\n}\n\nexport function isLiteralType(type: TypeRef): type is LiteralType {\n return type.kind === 'literal';\n}\n\nexport function isTupleType(type: TypeRef): type is TupleType {\n return type.kind === 'tuple';\n}\n\nexport function isFunctionType(type: TypeRef): type is FunctionType {\n return type.kind === 'function';\n}\n\nexport function isDomainEvent(message: Message): message is DomainEvent {\n return message.messageType === 'event';\n}\n\nexport function isCommand(message: Message): message is Command {\n return message.messageType === 'command';\n}\n\nexport function isQuery(message: Message): message is Query {\n return message.messageType === 'query';\n}\n","/**\n * Decorators for marking Domain Events and Commands.\n * These decorators have no runtime effect - the Message Parser\n * statically analyzes source code to find and extract them.\n */\nimport \"reflect-metadata\";\n\nexport interface PublicEventOptions {\n /**\n * Event version for versioned events\n * @example @PublicEvent({ version: 2 })\n */\n version?: number;\n\n /**\n * Business context this event belongs to\n * If not specified, inferred from package name\n * @example @PublicEvent({ context: 'lecture' })\n */\n context?: string;\n}\n\nexport interface PublicCommandOptions {\n /**\n * Business context this command belongs to\n * If not specified, inferred from package name\n * @example @PublicCommand({ context: 'auth' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this command\n * If specified, the parser will look for this type in the same file\n * @example @PublicCommand({ response: 'CreateUserResult' })\n */\n response?: string;\n}\n\n\nexport interface PublicQueryOptions {\n /**\n * Business context this query belongs to\n * If not specified, inferred from package name\n * @example @PublicQuery({ context: 'catalog' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this query\n * If specified, the parser will look for this type in the same file\n * @example @PublicQuery({ response: 'UserProfile' })\n */\n response?: string;\n}\n\nexport const PUBLIC_EVENT_METADATA = Symbol('publicEvent');\nexport const PUBLIC_COMMAND_METADATA = Symbol('publicCommand');\nexport const PUBLIC_QUERY_METADATA = Symbol('publicQuery');\n\n/**\n * Marks a class as a Domain Event for extraction to public contracts\n *\n * @example\n * ```typescript\n * @PublicEvent()\n * export class UserRegistered extends Message {\n * constructor(\n * public readonly userId: string,\n * public readonly email: string,\n * ) {\n * super();\n * }\n * }\n * ```\n *\n * @example With options\n * ```typescript\n * @PublicEvent({ version: 2, context: 'auth' })\n * export class UserRegisteredV2 extends Message {\n * // ...\n * }\n * ```\n */\nexport function PublicEvent(options: PublicEventOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(PUBLIC_EVENT_METADATA, options, target);\n return target;\n };\n}\n\n/**\n * Marks a class as a Command for extraction to public contracts\n *\n * @example\n * ```typescript\n * @PublicCommand()\n * export class CreateUser extends Request<CreateUserResult> {\n * constructor(\n * public readonly email: string,\n * public readonly name: string,\n * ) {\n * super();\n * }\n * }\n * ```\n *\n * @example With context option\n * ```typescript\n * @PublicCommand({ context: 'auth' })\n * export class CreateUser extends Request<CreateUserResult> {\n * // ...\n * }\n * ```\n *\n * @example With explicit response type\n * ```typescript\n * @PublicCommand({ response: 'DialogueCreatedResult' })\n * export class BeginDialogueRequest extends Request<DialogueCreatedResult> {\n * // ...\n * }\n * export type DialogueCreatedResult = { dialogueId: string };\n * ```\n */\nexport function PublicCommand(options: PublicCommandOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(PUBLIC_COMMAND_METADATA, options, target);\n return target;\n };\n}\n\n\n/**\n * Marks a class as a Query for extraction to public contracts\n *\n * @example\n * ```typescript\n * @PublicQuery()\n * export class GetUserProfile extends Request<UserProfile> {\n * constructor(\n * public readonly userId: string,\n * ) {\n * super();\n * }\n * }\n * ```\n *\n * @example With context option\n * ```typescript\n * @PublicQuery({ context: 'catalog' })\n * export class GetProductDetails extends Request<ProductDetails> {\n * // ...\n * }\n * ```\n *\n * @example With explicit response type\n * ```typescript\n * @PublicQuery({ response: 'UserProfileResult' })\n * export class GetUserProfile extends Request<UserProfileResult> {\n * // ...\n * }\n * export type UserProfileResult = { name: string; email: string };\n * ```\n */\nexport function PublicQuery(options: PublicQueryOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(PUBLIC_QUERY_METADATA, options, target);\n return target;\n };\n}\n","/**\n * Base error class for all contracts-generator errors.\n * Allows catching all library errors with `instanceof MessageParserError`.\n */\nexport class MessageParserError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"MessageParserError\";\n }\n}\n\n/**\n * Base class for configuration-related errors.\n */\nexport class ConfigurationError extends MessageParserError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ConfigurationError\";\n }\n}\n\n/**\n * Error thrown when loading application.config.ts fails.\n */\nexport class ConfigLoadError extends ConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ConfigLoadError\";\n }\n}\n\n/**\n * Base class for file system operation errors.\n */\nexport class FileSystemError extends MessageParserError {\n readonly path: string;\n\n constructor(message: string, path: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"FileSystemError\";\n this.path = path;\n }\n}\n\n/**\n * Error thrown when a required file is not found.\n */\nexport class FileNotFoundError extends FileSystemError {\n constructor(path: string, options?: ErrorOptions) {\n super(`File not found: ${path}`, path, options);\n this.name = \"FileNotFoundError\";\n }\n}\n\n/**\n * Error thrown when reading a file fails.\n */\nexport class FileReadError extends FileSystemError {\n constructor(path: string, options?: ErrorOptions) {\n super(`Failed to read file: ${path}`, path, options);\n this.name = \"FileReadError\";\n }\n}\n\n/**\n * Error thrown when writing a file fails.\n */\nexport class FileWriteError extends FileSystemError {\n constructor(path: string, options?: ErrorOptions) {\n super(`Failed to write file: ${path}`, path, options);\n this.name = \"FileWriteError\";\n }\n}\n\n/**\n * Base class for parsing errors.\n */\nexport class ParseError extends MessageParserError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ParseError\";\n }\n}\n\n/**\n * Error thrown when JSON parsing fails.\n */\nexport class JsonParseError extends ParseError {\n readonly filePath?: string;\n\n constructor(message: string, filePath?: string, options?: ErrorOptions) {\n const fullMessage = filePath\n ? `Failed to parse JSON in ${filePath}: ${message}`\n : `Failed to parse JSON: ${message}`;\n super(fullMessage, options);\n this.name = \"JsonParseError\";\n this.filePath = filePath;\n }\n}\n\n/**\n * Base class for module/path resolution errors.\n */\nexport class ResolutionError extends MessageParserError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ResolutionError\";\n }\n}\n\n/**\n * Error thrown when module resolution fails.\n */\nexport class ModuleResolutionError extends ResolutionError {\n readonly moduleSpecifier: string;\n readonly fromFile: string;\n\n constructor(moduleSpecifier: string, fromFile: string, options?: ErrorOptions) {\n super(\n `Failed to resolve module '${moduleSpecifier}' from '${fromFile}'`,\n options\n );\n this.name = \"ModuleResolutionError\";\n this.moduleSpecifier = moduleSpecifier;\n this.fromFile = fromFile;\n }\n}\n","import { readFile, writeFile, mkdir, readdir, stat, access } from \"fs/promises\";\nimport { constants } from \"fs\";\n\nexport interface FileStats {\n isDirectory(): boolean;\n isFile(): boolean;\n}\n\nexport interface FileSystem {\n readFile(path: string): Promise<string>;\n readdir(path: string): Promise<string[]>;\n writeFile(path: string, content: string): Promise<void>;\n mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;\n exists(path: string): Promise<boolean>;\n stat(path: string): Promise<FileStats>;\n}\n\nexport class NodeFileSystem implements FileSystem {\n async readFile(path: string): Promise<string> {\n return readFile(path, \"utf-8\");\n }\n\n async readdir(path: string): Promise<string[]> {\n return readdir(path);\n }\n\n async writeFile(path: string, content: string): Promise<void> {\n await writeFile(path, content);\n }\n\n async mkdir(path: string, options?: { recursive?: boolean }): Promise<void> {\n await mkdir(path, options);\n }\n\n async exists(path: string): Promise<boolean> {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n async stat(path: string): Promise<FileStats> {\n return stat(path);\n }\n}\n\nexport const nodeFileSystem = new NodeFileSystem();\n","import { glob } from \"glob\";\n\nimport { FileReadError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\nimport type { DecoratorNames, MessageType } from \"./domain\";\nimport { mergeDecoratorNames } from \"./domain\";\n\nconst DEFAULT_EXCLUDE_PATTERNS = [\n \"**/node_modules/**\",\n \"**/dist/**\",\n \"**/*.d.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.ts\",\n];\n\nexport interface ScannerOptions {\n exclude?: string[];\n fileSystem?: FileSystem;\n decoratorNames?: DecoratorNames;\n /**\n * Filter which message types to scan for.\n * Defaults to all types: ['event', 'command', 'query']\n */\n messageTypes?: MessageType[];\n}\n\nexport class Scanner {\n private readonly exclude: string[];\n private readonly fs: FileSystem;\n private readonly decoratorPatterns: string[];\n\n constructor(options: ScannerOptions = {}) {\n this.exclude = options.exclude ?? DEFAULT_EXCLUDE_PATTERNS;\n this.fs = options.fileSystem ?? nodeFileSystem;\n\n const names = mergeDecoratorNames(options.decoratorNames);\n const messageTypes = options.messageTypes ?? ['event', 'command', 'query'];\n\n this.decoratorPatterns = messageTypes.map((type) => {\n const decoratorName = names[type];\n return `@${decoratorName}(`;\n });\n }\n\n async scan(sourceDir: string): Promise<string[]> {\n const files = await glob(`${sourceDir}/**/*.ts`, {\n ignore: this.exclude,\n });\n const result: string[] = [];\n\n for (const file of files) {\n let content: string;\n try {\n content = await this.fs.readFile(file);\n } catch (error) {\n throw new FileReadError(file, { cause: error });\n }\n\n if (this.containsPublicDecorator(content)) {\n result.push(file);\n }\n }\n\n return result;\n }\n\n private containsPublicDecorator(content: string): boolean {\n return this.decoratorPatterns.some(pattern => content.includes(pattern));\n }\n}\n","import * as ts from \"typescript\";\n\nimport type {\n TypeRef,\n PrimitiveType,\n ReferenceType,\n ArrayType,\n ObjectType,\n UnionType,\n IntersectionType,\n Field,\n} from \"./domain\";\n\nconst PRIMITIVE_TYPE_NAMES = new Set([\n \"string\",\n \"number\",\n \"boolean\",\n \"void\",\n \"null\",\n \"undefined\",\n \"any\",\n \"unknown\",\n \"never\",\n \"bigint\",\n \"symbol\",\n]);\n\nexport function isPrimitiveTypeName(name: string): boolean {\n return PRIMITIVE_TYPE_NAMES.has(name);\n}\n\nexport function parseTypeNode(typeNode: ts.TypeNode): TypeRef {\n if (typeNode.kind === ts.SyntaxKind.StringKeyword) {\n return { kind: \"primitive\", name: \"string\" } as PrimitiveType;\n }\n if (typeNode.kind === ts.SyntaxKind.NumberKeyword) {\n return { kind: \"primitive\", name: \"number\" } as PrimitiveType;\n }\n if (typeNode.kind === ts.SyntaxKind.BooleanKeyword) {\n return { kind: \"primitive\", name: \"boolean\" } as PrimitiveType;\n }\n\n if (ts.isArrayTypeNode(typeNode)) {\n const elementType = parseTypeNode(typeNode.elementType);\n return { kind: \"array\", elementType } as ArrayType;\n }\n\n if (ts.isTypeReferenceNode(typeNode)) {\n const name = typeNode.typeName.getText();\n const typeArguments = typeNode.typeArguments\n ? typeNode.typeArguments.map((t) => parseTypeNode(t))\n : undefined;\n return { kind: \"reference\", name, typeArguments } as ReferenceType;\n }\n\n if (ts.isIntersectionTypeNode(typeNode)) {\n const types = typeNode.types.map((t) => parseTypeNode(t));\n return { kind: \"intersection\", types } as IntersectionType;\n }\n\n if (ts.isUnionTypeNode(typeNode)) {\n const types = typeNode.types.map((t) => parseTypeNode(t));\n return { kind: \"union\", types } as UnionType;\n }\n\n if (ts.isTypeLiteralNode(typeNode)) {\n const fields = extractFieldsFromMembers(typeNode.members);\n return { kind: \"object\", fields } as ObjectType;\n }\n\n return { kind: \"reference\", name: typeNode.getText() } as ReferenceType;\n}\n\nexport function extractFieldsFromMembers(\n members: ts.NodeArray<ts.TypeElement>\n): Field[] {\n const fields: Field[] = [];\n for (const member of members) {\n if (ts.isPropertySignature(member) && member.name) {\n const fieldName = member.name.getText();\n const fieldType = member.type\n ? parseTypeNode(member.type)\n : ({ kind: \"primitive\", name: \"any\" } as PrimitiveType);\n const optional = !!member.questionToken;\n const readonly =\n member.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.ReadonlyKeyword\n ) ?? false;\n fields.push({\n name: fieldName,\n type: fieldType,\n optional,\n readonly,\n });\n }\n }\n return fields;\n}\n","import * as ts from \"typescript\";\n\nimport { isPrimitiveTypeName } from \"./ast-utils\";\n\nexport function hasDecorator(\n node: ts.ClassDeclaration,\n decoratorName: string\n): boolean {\n const decorators = ts.getDecorators(node);\n if (!decorators) return false;\n\n return decorators.some((decorator) => {\n if (ts.isCallExpression(decorator.expression)) {\n const expr = decorator.expression.expression;\n if (ts.isIdentifier(expr)) {\n return expr.text === decoratorName;\n }\n }\n return false;\n });\n}\n\nexport interface DecoratorOptions {\n response?: string;\n context?: string;\n}\n\n/**\n * Extracts options from a decorator call expression.\n * For example, @PublicCommand({ response: 'CreateUserResult' }) returns { response: 'CreateUserResult' }\n */\nexport function getDecoratorOptions(\n node: ts.ClassDeclaration,\n decoratorName: string\n): DecoratorOptions | undefined {\n const decorators = ts.getDecorators(node);\n if (!decorators) return undefined;\n\n for (const decorator of decorators) {\n if (!ts.isCallExpression(decorator.expression)) continue;\n\n const expr = decorator.expression.expression;\n if (!ts.isIdentifier(expr) || expr.text !== decoratorName) continue;\n\n // Found the decorator, now extract options from the first argument\n const args = decorator.expression.arguments;\n if (args.length === 0) return {};\n\n const firstArg = args[0];\n if (!ts.isObjectLiteralExpression(firstArg)) return {};\n\n const options: DecoratorOptions = {};\n\n for (const prop of firstArg.properties) {\n if (!ts.isPropertyAssignment(prop)) continue;\n if (!ts.isIdentifier(prop.name)) continue;\n\n const propName = prop.name.text;\n if (propName === \"response\" && ts.isStringLiteral(prop.initializer)) {\n options.response = prop.initializer.text;\n } else if (propName === \"context\" && ts.isStringLiteral(prop.initializer)) {\n options.context = prop.initializer.text;\n }\n }\n\n return options;\n }\n\n return undefined;\n}\n\nexport function hasExportModifier(node: ts.Node): boolean {\n const modifiers = ts.canHaveModifiers(node)\n ? ts.getModifiers(node)\n : undefined;\n return (\n modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) ?? false\n );\n}\n\nexport function extractClassSourceText(\n node: ts.ClassDeclaration,\n sourceCode: string\n): string {\n const fullStart = node.getFullStart();\n const end = node.getEnd();\n let sourceText = sourceCode.slice(fullStart, end);\n sourceText = sourceText.replace(/^\\s*\\n/, \"\");\n return sourceText;\n}\n\nexport function getBaseClassName(node: ts.ClassDeclaration): string | undefined {\n if (!node.heritageClauses) return undefined;\n\n for (const clause of node.heritageClauses) {\n if (clause.token === ts.SyntaxKind.ExtendsKeyword) {\n const firstType = clause.types[0];\n if (firstType && ts.isExpressionWithTypeArguments(firstType)) {\n const expr = firstType.expression;\n if (ts.isIdentifier(expr)) {\n return expr.text;\n }\n }\n }\n }\n return undefined;\n}\n\nexport function collectClassReferences(node: ts.ClassDeclaration): Set<string> {\n const references = new Set<string>();\n\n const baseClass = getBaseClassName(node);\n if (baseClass) {\n references.add(baseClass);\n }\n\n const visitNode = (child: ts.Node): void => {\n if (ts.isTypeReferenceNode(child)) {\n const name = child.typeName.getText();\n if (!isPrimitiveTypeName(name)) {\n references.add(name);\n }\n } else if (ts.isIdentifier(child)) {\n const parent = child.parent;\n if (\n parent &&\n (ts.isTypeReferenceNode(parent) ||\n ts.isExpressionWithTypeArguments(parent))\n ) {\n const name = child.text;\n if (!isPrimitiveTypeName(name)) {\n references.add(name);\n }\n }\n }\n ts.forEachChild(child, visitNode);\n };\n\n ts.forEachChild(node, visitNode);\n return references;\n}\n","import * as ts from \"typescript\";\n\nimport type { ClassImport } from \"./domain\";\n\nexport function isExternalModule(moduleSpecifier: string): boolean {\n return !moduleSpecifier.startsWith(\".\");\n}\n\nexport function extractImports(sourceFile: ts.SourceFile): ClassImport[] {\n const imports: ClassImport[] = [];\n\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node) && node.importClause) {\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n const isExternal = isExternalModule(moduleSpecifier);\n const isTypeOnly = node.importClause.isTypeOnly ?? false;\n const importedNames = extractImportedNames(node.importClause);\n\n if (importedNames.length > 0) {\n imports.push({\n names: importedNames,\n source: moduleSpecifier,\n isTypeOnly,\n isExternal,\n });\n }\n }\n });\n\n return imports;\n}\n\nexport function extractImportedNames(importClause: ts.ImportClause): string[] {\n const names: string[] = [];\n\n if (importClause.name) {\n names.push(importClause.name.text);\n }\n\n if (importClause.namedBindings) {\n if (ts.isNamedImports(importClause.namedBindings)) {\n for (const element of importClause.namedBindings.elements) {\n names.push(element.name.text);\n }\n }\n }\n\n return names;\n}\n","import ts from \"typescript\";\n\nimport type {\n ClassImport,\n Command,\n DecoratorNames,\n DomainEvent,\n Field,\n IntersectionType,\n Message,\n MessageType,\n ObjectType,\n Query,\n ResponseNamingConvention,\n SourceFile,\n TypeDefinition,\n TypeDefinitionKind,\n TypeRef,\n} from \"./domain\";\nimport { mergeDecoratorNames } from \"./domain\";\nimport { extractFieldsFromMembers, parseTypeNode } from \"./ast-utils\";\nimport {\n extractClassSourceText,\n getBaseClassName,\n getDecoratorOptions,\n hasDecorator,\n hasExportModifier,\n} from \"./class-analyzer\";\nimport { extractImports } from \"./import-analyzer\";\n\nexport type { MessageType };\n\nconst PAYLOAD_TYPE_ARGUMENT_INDEX = 0;\n\nexport interface ParseResult {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries: readonly Query[];\n readonly typeDefinitions: readonly TypeDefinition[];\n}\n\nexport interface ParserOptions {\n decoratorNames?: DecoratorNames;\n responseNamingConventions?: readonly ResponseNamingConvention[];\n messageTypes?: readonly MessageType[];\n}\n\ninterface ExtractedPayload {\n fields: Field[];\n payloadType?: TypeRef;\n}\n\ninterface ExtractedMessage extends ExtractedPayload {\n sourceText: string;\n imports: ClassImport[];\n baseClass?: string;\n}\n\ninterface DecoratorMapping {\n decorator: string;\n messageType: MessageType;\n}\n\nfunction buildDecoratorMappings(decoratorNames: Required<DecoratorNames>): DecoratorMapping[] {\n return [\n { decorator: decoratorNames.event, messageType: \"event\" },\n { decorator: decoratorNames.command, messageType: \"command\" },\n { decorator: decoratorNames.query, messageType: \"query\" },\n ];\n}\n\n\nfunction extractTypeParameterNames(\n typeParameters: ts.NodeArray<ts.TypeParameterDeclaration> | undefined\n): string[] | undefined {\n if (!typeParameters) return undefined;\n return typeParameters.map(tp => tp.name.text);\n}\n\nexport class Parser {\n private readonly decoratorMappings: DecoratorMapping[];\n private readonly responseNamingConventions: readonly ResponseNamingConvention[];\n private readonly messageTypes: readonly MessageType[] | undefined;\n\n constructor(options: ParserOptions = {}) {\n const names = mergeDecoratorNames(options.decoratorNames);\n this.decoratorMappings = buildDecoratorMappings(names);\n this.responseNamingConventions = options.responseNamingConventions ?? [];\n this.messageTypes = options.messageTypes;\n }\n\n parse(sourceCode: string, sourceFileInfo: SourceFile): ParseResult {\n const tsSourceFile = ts.createSourceFile(\n sourceFileInfo.absolutePath,\n sourceCode,\n ts.ScriptTarget.Latest,\n true\n );\n\n const events: DomainEvent[] = [];\n const commands: Command[] = [];\n const queries: Query[] = [];\n const typeDefinitions: TypeDefinition[] = [];\n\n const messageCollectors: Record<MessageType, (message: Message) => void> = {\n event: (m) => events.push(m as DomainEvent),\n command: (m) => commands.push(m as Command),\n query: (m) => queries.push(m as Query),\n };\n\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name) {\n this.collectMessagesFromClass(node, sourceCode, tsSourceFile, sourceFileInfo, messageCollectors);\n }\n\n if (ts.isTypeAliasDeclaration(node) && node.name) {\n typeDefinitions.push(this.extractTypeDefinition(node, sourceFileInfo));\n }\n\n if (ts.isInterfaceDeclaration(node) && node.name) {\n typeDefinitions.push(this.extractInterfaceDefinition(node, sourceFileInfo));\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(tsSourceFile);\n\n this.applyNamingConventionMatching(commands, typeDefinitions);\n this.applyNamingConventionMatching(queries, typeDefinitions);\n\n return { events, commands, queries, typeDefinitions };\n }\n\n private collectMessagesFromClass(\n node: ts.ClassDeclaration,\n sourceCode: string,\n tsSourceFile: ts.SourceFile,\n sourceFileInfo: SourceFile,\n collectors: Record<MessageType, (message: Message) => void>\n ): void {\n for (const { decorator, messageType } of this.decoratorMappings) {\n if (!hasDecorator(node, decorator)) continue;\n if (this.messageTypes && !this.messageTypes.includes(messageType)) continue;\n\n const message = this.buildMessage(node, sourceCode, tsSourceFile, sourceFileInfo, messageType, decorator);\n collectors[messageType](message);\n }\n }\n\n private applyNamingConventionMatching(\n messages: (Command | Query)[],\n typeDefinitions: TypeDefinition[]\n ): void {\n for (const message of messages) {\n const hasExplicitResultType = Boolean(message.resultType);\n if (hasExplicitResultType) continue;\n\n const matchedTypeName = this.findMatchingResponseType(message.name, typeDefinitions);\n if (matchedTypeName) {\n (message as { resultType?: TypeRef }).resultType = {\n kind: \"reference\",\n name: matchedTypeName,\n };\n }\n }\n }\n\n private findMatchingResponseType(\n messageName: string,\n typeDefinitions: TypeDefinition[]\n ): string | undefined {\n for (const convention of this.responseNamingConventions) {\n const hasSuffix = messageName.endsWith(convention.messageSuffix);\n if (!hasSuffix) continue;\n\n const messagePrefix = messageName.slice(0, -convention.messageSuffix.length);\n const expectedResponseName = messagePrefix + convention.responseSuffix;\n\n const matchingType = typeDefinitions.find(t => t.name === expectedResponseName);\n if (matchingType) return matchingType.name;\n }\n return undefined;\n }\n\n private buildMessage(\n node: ts.ClassDeclaration,\n sourceCode: string,\n tsSourceFile: ts.SourceFile,\n sourceFileInfo: SourceFile,\n messageType: MessageType,\n decoratorName: string\n ): Message {\n const extracted = this.extractMessageDetails(node, sourceCode, tsSourceFile);\n const decoratorOptions = getDecoratorOptions(node, decoratorName);\n\n const baseMessage = {\n name: node.name!.text,\n messageType,\n sourceFile: sourceFileInfo,\n fields: extracted.fields,\n payloadType: extracted.payloadType,\n sourceText: extracted.sourceText,\n imports: extracted.imports,\n baseClass: extracted.baseClass,\n };\n\n const explicitResponseName = decoratorOptions?.response;\n const supportsResultType = messageType === \"command\" || messageType === \"query\";\n if (!supportsResultType || !explicitResponseName) {\n return baseMessage;\n }\n\n return {\n ...baseMessage,\n resultType: {\n kind: \"reference\" as const,\n name: explicitResponseName,\n },\n };\n }\n\n private extractMessageDetails(\n node: ts.ClassDeclaration,\n sourceCode: string,\n tsSourceFile: ts.SourceFile\n ): ExtractedMessage {\n const { fields, payloadType } = this.extractPayload(node);\n const sourceText = extractClassSourceText(node, sourceCode);\n const imports = extractImports(tsSourceFile);\n const baseClass = getBaseClassName(node);\n\n return {\n fields,\n payloadType,\n sourceText,\n imports,\n baseClass,\n };\n }\n\n private extractPayload(node: ts.ClassDeclaration): ExtractedPayload {\n const emptyPayload: ExtractedPayload = { fields: [] };\n if (!node.heritageClauses) return emptyPayload;\n\n const extendsClause = node.heritageClauses.find(\n clause => clause.token === ts.SyntaxKind.ExtendsKeyword\n );\n if (!extendsClause) return emptyPayload;\n\n for (const type of extendsClause.types) {\n const typeArgs = type.typeArguments;\n if (!typeArgs || typeArgs.length === 0) continue;\n\n const payloadTypeArg = typeArgs[PAYLOAD_TYPE_ARGUMENT_INDEX];\n const extractedPayload = this.parsePayloadTypeArgument(payloadTypeArg);\n if (extractedPayload) return extractedPayload;\n }\n\n return emptyPayload;\n }\n\n private parsePayloadTypeArgument(typeArg: ts.TypeNode): ExtractedPayload | undefined {\n if (ts.isTypeReferenceNode(typeArg) && ts.isIdentifier(typeArg.typeName)) {\n return {\n fields: [],\n payloadType: parseTypeNode(typeArg),\n };\n }\n\n if (ts.isTypeLiteralNode(typeArg)) {\n return {\n fields: extractFieldsFromMembers(typeArg.members),\n };\n }\n\n if (ts.isIntersectionTypeNode(typeArg)) {\n const parsedType = parseTypeNode(typeArg) as IntersectionType;\n return {\n fields: this.flattenIntersectionToFields(parsedType),\n payloadType: parsedType,\n };\n }\n\n return undefined;\n }\n\n private flattenIntersectionToFields(intersection: IntersectionType): Field[] {\n const fields: Field[] = [];\n\n for (const type of intersection.types) {\n if (type.kind === \"object\") {\n fields.push(...(type as ObjectType).fields);\n }\n }\n\n return fields;\n }\n\n private extractTypeDefinition(\n node: ts.TypeAliasDeclaration,\n sourceFileInfo: SourceFile\n ): TypeDefinition {\n return this.buildTypeDefinition(\n node.name.text,\n \"type\",\n sourceFileInfo,\n parseTypeNode(node.type),\n node.typeParameters,\n node\n );\n }\n\n private extractInterfaceDefinition(\n node: ts.InterfaceDeclaration,\n sourceFileInfo: SourceFile\n ): TypeDefinition {\n const body: ObjectType = {\n kind: \"object\",\n fields: extractFieldsFromMembers(node.members),\n };\n\n return this.buildTypeDefinition(\n node.name.text,\n \"interface\",\n sourceFileInfo,\n body,\n node.typeParameters,\n node\n );\n }\n\n private buildTypeDefinition(\n name: string,\n kind: TypeDefinitionKind,\n sourceFile: SourceFile,\n body: TypeRef,\n typeParameters: ts.NodeArray<ts.TypeParameterDeclaration> | undefined,\n node: ts.Node\n ): TypeDefinition {\n return {\n name,\n kind,\n sourceFile,\n body,\n typeParameters: extractTypeParameterNames(typeParameters),\n exported: hasExportModifier(node),\n };\n }\n}\n","import ts from \"typescript\";\nimport path from \"path\";\nimport { minimatch } from \"minimatch\";\n\nimport { extractImportedNames } from \"./import-analyzer\";\nimport { ContextConfig } from \"./context-config\";\nimport { FileReadError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\n\nconst TYPESCRIPT_EXTENSIONS = [\".ts\", \".tsx\"];\nconst INDEX_FILE = \"index.ts\";\n\nexport interface ImportInfo {\n moduleSpecifier: string;\n resolvedPath: string | null;\n isExternal: boolean;\n importedNames: string[];\n}\n\nexport interface FileNode {\n absolutePath: string;\n relativePath: string;\n imports: ImportInfo[];\n isEntryPoint: boolean;\n}\n\nexport interface FileGraph {\n nodes: Map<string, FileNode>;\n entryPoints: Set<string>;\n excludedPaths: Set<string>;\n}\n\nexport interface FileGraphResolverOptions {\n contextConfig: ContextConfig;\n fileSystem?: FileSystem;\n excludeDependencies?: string[];\n}\n\nexport class FileGraphResolver {\n private readonly contextConfig: ContextConfig;\n private readonly fs: FileSystem;\n private readonly excludeDependencies: string[];\n\n private constructor(\n contextConfig: ContextConfig,\n fileSystem: FileSystem,\n excludeDependencies: string[]\n ) {\n this.contextConfig = contextConfig;\n this.fs = fileSystem;\n this.excludeDependencies = excludeDependencies;\n }\n\n static create(options: FileGraphResolverOptions): FileGraphResolver {\n const fs = options.fileSystem ?? nodeFileSystem;\n const excludeDependencies = options.excludeDependencies ?? [];\n return new FileGraphResolver(options.contextConfig, fs, excludeDependencies);\n }\n\n async buildGraph(entryPoints: string[], sourceRoot: string): Promise<FileGraph> {\n const nodes = new Map<string, FileNode>();\n const entryPointSet = new Set<string>(entryPoints);\n const excludedPaths = new Set<string>();\n const visited = new Set<string>();\n const queue = [...entryPoints];\n\n while (queue.length > 0) {\n const filePath = queue.shift()!;\n\n if (visited.has(filePath)) {\n continue;\n }\n visited.add(filePath);\n\n const imports = await this.extractImports(filePath);\n\n const node: FileNode = {\n absolutePath: filePath,\n relativePath: path.relative(sourceRoot, filePath),\n imports,\n isEntryPoint: entryPointSet.has(filePath),\n };\n nodes.set(filePath, node);\n\n this.queueUnvisitedLocalDependencies(imports, visited, queue, excludedPaths);\n }\n\n return {\n nodes,\n entryPoints: entryPointSet,\n excludedPaths,\n };\n }\n\n private async extractImports(filePath: string): Promise<ImportInfo[]> {\n const sourceCode = await this.readSourceFile(filePath);\n const sourceFile = ts.createSourceFile(\n filePath,\n sourceCode,\n ts.ScriptTarget.Latest,\n true\n );\n\n const imports: ImportInfo[] = [];\n\n for (const node of sourceFile.statements) {\n const moduleSpecifier = this.extractModuleSpecifier(node);\n if (!moduleSpecifier) {\n continue;\n }\n\n const resolution = await this.resolveModule(moduleSpecifier, filePath);\n\n const importedNames = this.extractImportedNamesFromNode(node);\n\n imports.push({\n moduleSpecifier,\n resolvedPath: resolution.resolvedPath,\n isExternal: resolution.isExternal,\n importedNames,\n });\n }\n\n return imports;\n }\n\n private async readSourceFile(filePath: string): Promise<string> {\n try {\n return await this.fs.readFile(filePath);\n } catch (error) {\n throw new FileReadError(filePath, { cause: error });\n }\n }\n\n private extractModuleSpecifier(node: ts.Statement): string | null {\n if (ts.isImportDeclaration(node)) {\n return (node.moduleSpecifier as ts.StringLiteral).text;\n }\n if (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n return (node.moduleSpecifier as ts.StringLiteral).text;\n }\n return null;\n }\n\n private extractImportedNamesFromNode(node: ts.Statement): string[] {\n if (ts.isImportDeclaration(node) && node.importClause) {\n return extractImportedNames(node.importClause);\n }\n // Re-exports don't have named imports in the traditional sense\n return [];\n }\n\n private async resolveModule(\n moduleSpecifier: string,\n fromFile: string\n ): Promise<{ resolvedPath: string | null; isExternal: boolean }> {\n if (moduleSpecifier.startsWith(\".\")) {\n const resolvedPath = await this.resolveRelativeModule(\n moduleSpecifier,\n fromFile\n );\n return { resolvedPath, isExternal: false };\n }\n\n return this.contextConfig.resolvePath(moduleSpecifier);\n }\n\n private queueUnvisitedLocalDependencies(\n imports: ImportInfo[],\n visited: Set<string>,\n queue: string[],\n excludedPaths: Set<string>\n ): void {\n const localImports = imports.filter(\n (importInfo) => !importInfo.isExternal && importInfo.resolvedPath !== null\n );\n\n for (const importInfo of localImports) {\n const resolvedPath = importInfo.resolvedPath!;\n\n if (this.shouldExclude(resolvedPath)) {\n excludedPaths.add(resolvedPath);\n continue;\n }\n\n if (!visited.has(resolvedPath)) {\n queue.push(resolvedPath);\n }\n }\n }\n\n private shouldExclude(filePath: string): boolean {\n if (this.excludeDependencies.length === 0) {\n return false;\n }\n return this.excludeDependencies.some((pattern) =>\n minimatch(filePath, pattern, { matchBase: true })\n );\n }\n\n private async resolveRelativeModule(\n moduleSpecifier: string,\n fromFile: string\n ): Promise<string | null> {\n const dir = path.dirname(fromFile);\n const basePath = path.resolve(dir, moduleSpecifier);\n\n return this.tryResolveWithExtensions(basePath);\n }\n\n private async tryResolveWithExtensions(basePath: string): Promise<string | null> {\n const extensionCandidates = TYPESCRIPT_EXTENSIONS.map(ext => basePath + ext);\n const indexCandidate = path.join(basePath, INDEX_FILE);\n const candidates = [...extensionCandidates, indexCandidate];\n\n for (const candidate of candidates) {\n if (await this.fs.exists(candidate)) {\n return candidate;\n }\n }\n\n return null;\n }\n}\n","import * as path from \"path\";\nimport * as ts from \"typescript\";\n\nimport type { FileGraph, FileNode } from \"./file-graph-resolver\";\nimport { FileReadError, FileWriteError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\nimport type { MessageType, DecoratorNames } from \"./domain\";\nimport { DEFAULT_DECORATOR_NAMES } from \"./domain\";\nimport { hasDecorator } from \"./class-analyzer\";\n\nconst CONTRACTS_GENERATOR_MODULE = \"@hexaijs/plugin-contracts-generator\";\nconst CONTRACT_DECORATORS = new Set([\n \"PublicCommand\",\n \"PublicEvent\",\n \"PublicQuery\",\n]);\nconst TS_EXTENSION_PATTERN = /\\.ts$/;\nconst TS_EXTENSION = \".ts\";\nconst REQUEST_SUFFIX = \"Request\";\nconst QUERY_SUFFIX = \"Query\";\n\nexport interface CopyOptions {\n sourceRoot: string;\n outputDir: string;\n fileGraph: FileGraph;\n pathAliasRewrites?: Map<string, string>;\n removeDecorators?: boolean;\n responseTypesToExport?: Map<string, string[]>;\n messageTypes?: readonly MessageType[];\n decoratorNames?: DecoratorNames;\n}\n\nexport interface CopyResult {\n copiedFiles: string[];\n rewrittenImports: Map<string, string[]>;\n}\n\nexport interface FileCopierOptions {\n fileSystem?: FileSystem;\n}\n\ninterface TransformResult<T extends string> {\n content: string;\n changes: T[];\n}\n\ntype VisitorFunction = (node: ts.Node) => ts.Node | undefined;\n\ninterface SymbolExtractionContext {\n sourceFile: ts.SourceFile;\n content: string;\n messageTypes: readonly MessageType[];\n decoratorToMessageType: Record<string, MessageType>;\n}\n\ninterface ExtractedSymbols {\n targetClassNames: Set<string>;\n targetClasses: ts.ClassDeclaration[];\n usedIdentifiers: Set<string>;\n includedLocalTypes: Set<string>;\n localTypeDeclarations: Map<string, ts.Node[]>;\n}\n\ninterface ImportInfo {\n moduleSpecifier: string;\n isTypeOnly: boolean;\n}\n\nexport class FileCopier {\n private readonly fs: FileSystem;\n\n constructor(options: FileCopierOptions = {}) {\n this.fs = options.fileSystem ?? nodeFileSystem;\n }\n\n async copyFiles(options: CopyOptions): Promise<CopyResult> {\n const {\n sourceRoot,\n outputDir,\n fileGraph,\n pathAliasRewrites,\n removeDecorators,\n responseTypesToExport,\n messageTypes,\n decoratorNames,\n } = options;\n const copiedFiles: string[] = [];\n const rewrittenImports = new Map<string, string[]>();\n\n const { entryContents, usedLocalImports } =\n await this.preprocessEntryFiles(\n fileGraph,\n messageTypes,\n decoratorNames,\n sourceRoot\n );\n\n this.expandTransitiveDependencies(usedLocalImports, fileGraph);\n\n for (const node of fileGraph.nodes.values()) {\n const content = await this.resolveNodeContent(\n node,\n entryContents,\n usedLocalImports,\n messageTypes\n );\n\n if (content === null) {\n continue;\n }\n\n const transformedContent = this.applyTransformations(\n content,\n node,\n fileGraph,\n sourceRoot,\n removeDecorators,\n responseTypesToExport,\n pathAliasRewrites\n );\n\n const outputPath = await this.writeOutputFile(\n outputDir,\n node.relativePath,\n transformedContent.content\n );\n copiedFiles.push(outputPath);\n\n if (transformedContent.rewrites.length > 0) {\n rewrittenImports.set(outputPath, transformedContent.rewrites);\n }\n }\n\n return { copiedFiles, rewrittenImports };\n }\n\n private async preprocessEntryFiles(\n fileGraph: FileGraph,\n messageTypes: readonly MessageType[] | undefined,\n decoratorNames: DecoratorNames | undefined,\n sourceRoot: string\n ): Promise<{\n entryContents: Map<string, string>;\n usedLocalImports: Set<string>;\n }> {\n const entryContents = new Map<string, string>();\n const usedLocalImports = new Set<string>();\n\n if (!messageTypes?.length) {\n return { entryContents, usedLocalImports };\n }\n\n for (const node of fileGraph.nodes.values()) {\n if (!node.isEntryPoint) {\n continue;\n }\n\n const rawContent = await this.readFileContent(node.absolutePath);\n const { content: extractedContent, usedModuleSpecifiers } =\n this.extractSymbolsFromEntry(\n rawContent,\n node.absolutePath,\n messageTypes,\n decoratorNames\n );\n entryContents.set(node.absolutePath, extractedContent);\n\n for (const specifier of usedModuleSpecifiers) {\n const importInfo = node.imports.find(\n (i) => i.moduleSpecifier === specifier\n );\n if (importInfo?.resolvedPath && !importInfo.isExternal) {\n usedLocalImports.add(importInfo.resolvedPath);\n }\n }\n }\n\n return { entryContents, usedLocalImports };\n }\n\n private expandTransitiveDependencies(\n usedLocalImports: Set<string>,\n fileGraph: FileGraph\n ): void {\n let changed = true;\n while (changed) {\n changed = false;\n for (const importPath of usedLocalImports) {\n const node = fileGraph.nodes.get(importPath);\n if (!node) continue;\n\n for (const imp of node.imports) {\n const isUnusedLocalImport =\n imp.resolvedPath &&\n !imp.isExternal &&\n !usedLocalImports.has(imp.resolvedPath);\n\n if (isUnusedLocalImport) {\n usedLocalImports.add(imp.resolvedPath!);\n changed = true;\n }\n }\n }\n }\n }\n\n private async resolveNodeContent(\n node: FileNode,\n entryContents: Map<string, string>,\n usedLocalImports: Set<string>,\n messageTypes: readonly MessageType[] | undefined\n ): Promise<string | null> {\n if (node.isEntryPoint && messageTypes?.length) {\n return (\n entryContents.get(node.absolutePath) ??\n (await this.readFileContent(node.absolutePath))\n );\n }\n\n const isUnusedDependency =\n messageTypes?.length && !usedLocalImports.has(node.absolutePath);\n\n if (isUnusedDependency) {\n return null;\n }\n\n return await this.readFileContent(node.absolutePath);\n }\n\n private applyTransformations(\n content: string,\n node: FileNode,\n fileGraph: FileGraph,\n sourceRoot: string,\n removeDecorators: boolean | undefined,\n responseTypesToExport: Map<string, string[]> | undefined,\n pathAliasRewrites: Map<string, string> | undefined\n ): { content: string; rewrites: string[] } {\n const rewrites: string[] = [];\n let transformedContent = content;\n\n transformedContent = this.processExcludedImports(\n transformedContent,\n node,\n fileGraph.excludedPaths,\n rewrites\n );\n transformedContent = this.processDecoratorRemoval(\n transformedContent,\n node.absolutePath,\n removeDecorators,\n rewrites\n );\n transformedContent = this.processTypeExports(\n transformedContent,\n node.absolutePath,\n responseTypesToExport?.get(node.absolutePath),\n rewrites\n );\n transformedContent = this.processInternalPathAliases(\n transformedContent,\n node,\n fileGraph,\n sourceRoot,\n rewrites\n );\n transformedContent = this.processExternalPathAliases(\n transformedContent,\n pathAliasRewrites,\n rewrites\n );\n\n return { content: transformedContent, rewrites };\n }\n\n \n\n generateBarrelExport(copiedFiles: string[], outputDir: string): string {\n const lines: string[] = [];\n for (const filePath of copiedFiles) {\n const relativePath = path.relative(outputDir, filePath);\n lines.push(this.createExportStatement(relativePath));\n }\n return lines.join(\"\\n\");\n }\n\n private async readFileContent(absolutePath: string): Promise<string> {\n try {\n return await this.fs.readFile(absolutePath);\n } catch (error) {\n throw new FileReadError(absolutePath, { cause: error });\n }\n }\n\n private async writeOutputFile(\n outputDir: string,\n relativePath: string,\n content: string\n ): Promise<string> {\n const outputPath = path.join(outputDir, relativePath);\n const outputDirPath = path.dirname(outputPath);\n\n await this.fs.mkdir(outputDirPath, { recursive: true });\n\n try {\n await this.fs.writeFile(outputPath, content);\n } catch (error) {\n throw new FileWriteError(outputPath, { cause: error });\n }\n\n return outputPath;\n }\n\n private processExcludedImports(\n content: string,\n node: FileNode,\n excludedPaths: Set<string>,\n rewrites: string[]\n ): string {\n if (excludedPaths.size === 0) {\n return content;\n }\n\n const excludedResult = this.removeExcludedImports(\n content,\n node,\n excludedPaths\n );\n rewrites.push(...excludedResult.changes);\n return excludedResult.content;\n }\n\n private processDecoratorRemoval(\n content: string,\n filePath: string,\n removeDecorators: boolean | undefined,\n rewrites: string[]\n ): string {\n if (!removeDecorators) {\n return content;\n }\n\n const decoratorResult = this.removeContractDecorators(\n content,\n filePath\n );\n rewrites.push(...decoratorResult.changes);\n return decoratorResult.content;\n }\n\n private processTypeExports(\n content: string,\n filePath: string,\n typesToExport: string[] | undefined,\n rewrites: string[]\n ): string {\n if (!typesToExport || typesToExport.length === 0) {\n return content;\n }\n\n const exportResult = this.addExportToTypes(\n content,\n filePath,\n typesToExport\n );\n rewrites.push(...exportResult.changes);\n return exportResult.content;\n }\n\n private processInternalPathAliases(\n content: string,\n node: FileNode,\n fileGraph: FileGraph,\n sourceRoot: string,\n rewrites: string[]\n ): string {\n const internalResult = this.rewriteInternalPathAliases(\n content,\n node,\n fileGraph,\n sourceRoot\n );\n rewrites.push(...internalResult.rewrites);\n return internalResult.content;\n }\n\n private processExternalPathAliases(\n content: string,\n pathAliasRewrites: Map<string, string> | undefined,\n rewrites: string[]\n ): string {\n if (!pathAliasRewrites) {\n return content;\n }\n\n const aliasResult = this.applyPathAliasRewrites(\n content,\n pathAliasRewrites\n );\n rewrites.push(...aliasResult.rewrites);\n return aliasResult.content;\n }\n\n private createExportStatement(relativePath: string): string {\n const exportPath =\n \"./\" + relativePath.replace(TS_EXTENSION_PATTERN, \"\");\n return `export * from '${exportPath}'`;\n }\n\n private rewriteInternalPathAliases(\n content: string,\n node: FileNode,\n fileGraph: FileGraph,\n sourceRoot: string\n ): { content: string; rewrites: string[] } {\n let transformedContent = content;\n const appliedRewrites: string[] = [];\n\n for (const importInfo of node.imports) {\n if (this.isExternalOrRelativeImport(importInfo)) {\n continue;\n }\n\n const targetNode = this.resolveInternalImport(\n importInfo,\n fileGraph\n );\n if (!targetNode) {\n continue;\n }\n\n const relativePath = this.computeRelativePath(\n node.relativePath,\n targetNode.relativePath\n );\n const rewriteResult = this.rewriteModuleSpecifier(\n transformedContent,\n importInfo.moduleSpecifier,\n relativePath\n );\n\n if (rewriteResult.wasRewritten) {\n transformedContent = rewriteResult.content;\n appliedRewrites.push(\n `${importInfo.moduleSpecifier} → ${relativePath}`\n );\n }\n }\n\n return { content: transformedContent, rewrites: appliedRewrites };\n }\n\n private isExternalOrRelativeImport(importInfo: {\n isExternal: boolean;\n moduleSpecifier: string;\n }): boolean {\n return (\n importInfo.isExternal || importInfo.moduleSpecifier.startsWith(\".\")\n );\n }\n\n private resolveInternalImport(\n importInfo: { resolvedPath?: string | null },\n fileGraph: FileGraph\n ): FileNode | undefined {\n if (\n !importInfo.resolvedPath ||\n !fileGraph.nodes.has(importInfo.resolvedPath)\n ) {\n return undefined;\n }\n return fileGraph.nodes.get(importInfo.resolvedPath);\n }\n\n private rewriteModuleSpecifier(\n content: string,\n originalSpecifier: string,\n newSpecifier: string\n ): { content: string; wasRewritten: boolean } {\n const importPattern = new RegExp(\n `(from\\\\s+['\"])${this.escapeRegex(originalSpecifier)}(['\"])`,\n \"g\"\n );\n\n if (!importPattern.test(content)) {\n return { content, wasRewritten: false };\n }\n\n const rewrittenContent = content.replace(\n importPattern,\n `$1${newSpecifier}$2`\n );\n return { content: rewrittenContent, wasRewritten: true };\n }\n\n private computeRelativePath(\n fromRelative: string,\n toRelative: string\n ): string {\n const fromDir = path.dirname(fromRelative);\n let relativePath = path.relative(fromDir, toRelative);\n\n relativePath = relativePath.replace(TS_EXTENSION_PATTERN, \"\");\n\n if (!relativePath.startsWith(\".\")) {\n relativePath = \"./\" + relativePath;\n }\n\n return relativePath;\n }\n\n private applyPathAliasRewrites(\n content: string,\n rewrites: Map<string, string>\n ): { content: string; rewrites: string[] } {\n let transformedContent = content;\n const appliedRewrites: string[] = [];\n\n for (const [from, to] of rewrites) {\n if (transformedContent.includes(from)) {\n transformedContent = transformedContent.replace(\n new RegExp(this.escapeRegex(from), \"g\"),\n to\n );\n appliedRewrites.push(`${from} → ${to}`);\n }\n }\n\n return { content: transformedContent, rewrites: appliedRewrites };\n }\n\n private escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n\n private removeExcludedImports(\n content: string,\n node: FileNode,\n excludedPaths: Set<string>\n ): TransformResult<string> {\n const excludedModuleSpecifiers = this.findExcludedModuleSpecifiers(\n node,\n excludedPaths\n );\n\n if (excludedModuleSpecifiers.size === 0) {\n return { content, changes: [] };\n }\n\n const changes = Array.from(excludedModuleSpecifiers).map(\n (specifier) => `removed import: ${specifier}`\n );\n\n const visitorFactory = this.createExcludedImportsVisitor(\n excludedModuleSpecifiers\n );\n const transformedContent = this.transformSourceFile(\n content,\n node.absolutePath,\n visitorFactory\n );\n\n return { content: transformedContent, changes };\n }\n\n private findExcludedModuleSpecifiers(\n node: FileNode,\n excludedPaths: Set<string>\n ): Set<string> {\n const excludedModuleSpecifiers = new Set<string>();\n for (const importInfo of node.imports) {\n if (\n importInfo.resolvedPath &&\n excludedPaths.has(importInfo.resolvedPath)\n ) {\n excludedModuleSpecifiers.add(importInfo.moduleSpecifier);\n }\n }\n return excludedModuleSpecifiers;\n }\n\n private createExcludedImportsVisitor(\n excludedModuleSpecifiers: Set<string>\n ): (context: ts.TransformationContext) => VisitorFunction {\n return (context: ts.TransformationContext) => {\n const visit: VisitorFunction = (\n node: ts.Node\n ): ts.Node | undefined => {\n if (\n this.isImportFromExcludedModule(\n node,\n excludedModuleSpecifiers\n )\n ) {\n return undefined;\n }\n\n if (\n this.isExportFromExcludedModule(\n node,\n excludedModuleSpecifiers\n )\n ) {\n return undefined;\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return visit;\n };\n }\n\n private isImportFromExcludedModule(\n node: ts.Node,\n excludedModules: Set<string>\n ): boolean {\n if (!ts.isImportDeclaration(node)) {\n return false;\n }\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n return excludedModules.has(moduleSpecifier);\n }\n\n private isExportFromExcludedModule(\n node: ts.Node,\n excludedModules: Set<string>\n ): boolean {\n if (!ts.isExportDeclaration(node) || !node.moduleSpecifier) {\n return false;\n }\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n return excludedModules.has(moduleSpecifier);\n }\n\n private removeContractDecorators(\n content: string,\n filePath: string\n ): TransformResult<string> {\n const changes: string[] = [];\n\n const visitorFactory = this.createDecoratorRemovalVisitor(changes);\n const transformedContent = this.transformSourceFile(\n content,\n filePath,\n visitorFactory\n );\n\n return { content: transformedContent, changes };\n }\n\n private createDecoratorRemovalVisitor(\n changes: string[]\n ): (context: ts.TransformationContext) => VisitorFunction {\n return (context: ts.TransformationContext) => {\n const visit: VisitorFunction = (\n node: ts.Node\n ): ts.Node | undefined => {\n if (ts.isImportDeclaration(node)) {\n return this.processContractGeneratorImport(node, changes);\n }\n\n if (ts.isClassDeclaration(node) && node.modifiers) {\n return this.removeContractDecoratorsFromClass(\n node,\n changes\n );\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return visit;\n };\n }\n\n private processContractGeneratorImport(\n node: ts.ImportDeclaration,\n changes: string[]\n ): ts.ImportDeclaration | undefined {\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n\n const isContractGeneratorModule =\n moduleSpecifier === CONTRACTS_GENERATOR_MODULE ||\n moduleSpecifier.startsWith(CONTRACTS_GENERATOR_MODULE + \"/\");\n\n if (!isContractGeneratorModule) {\n return node;\n }\n\n const namedBindings = node.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) {\n return node;\n }\n\n const remainingElements = namedBindings.elements.filter(\n (el) => !CONTRACT_DECORATORS.has(el.name.text)\n );\n\n if (remainingElements.length === 0) {\n changes.push(`removed import: ${moduleSpecifier}`);\n return undefined;\n }\n\n if (remainingElements.length < namedBindings.elements.length) {\n changes.push(`removed decorators from import: ${moduleSpecifier}`);\n return this.createImportWithFilteredBindings(\n node,\n remainingElements\n );\n }\n\n return node;\n }\n\n private createImportWithFilteredBindings(\n originalImport: ts.ImportDeclaration,\n remainingElements: ts.ImportSpecifier[]\n ): ts.ImportDeclaration {\n const newNamedImports =\n ts.factory.createNamedImports(remainingElements);\n const newImportClause = ts.factory.createImportClause(\n originalImport.importClause!.isTypeOnly,\n originalImport.importClause!.name,\n newNamedImports\n );\n return ts.factory.createImportDeclaration(\n originalImport.modifiers,\n newImportClause,\n originalImport.moduleSpecifier,\n originalImport.attributes\n );\n }\n\n private removeContractDecoratorsFromClass(\n node: ts.ClassDeclaration,\n changes: string[]\n ): ts.ClassDeclaration {\n const filteredModifiers = node.modifiers!.filter((modifier) => {\n if (!ts.isDecorator(modifier)) {\n return true;\n }\n\n const decoratorName = this.extractDecoratorName(modifier);\n if (decoratorName && CONTRACT_DECORATORS.has(decoratorName)) {\n const decoratorSuffix = this.isDecoratorCallExpression(modifier)\n ? \"()\"\n : \"\";\n changes.push(\n `removed decorator: @${decoratorName}${decoratorSuffix}`\n );\n return false;\n }\n\n return true;\n });\n\n if (filteredModifiers.length === node.modifiers!.length) {\n return node;\n }\n\n return ts.factory.createClassDeclaration(\n filteredModifiers,\n node.name,\n node.typeParameters,\n node.heritageClauses,\n node.members\n );\n }\n\n private extractDecoratorName(decorator: ts.Decorator): string | undefined {\n const expression = decorator.expression;\n\n if (\n ts.isCallExpression(expression) &&\n ts.isIdentifier(expression.expression)\n ) {\n return expression.expression.text;\n }\n\n if (ts.isIdentifier(expression)) {\n return expression.text;\n }\n\n return undefined;\n }\n\n private isDecoratorCallExpression(decorator: ts.Decorator): boolean {\n return ts.isCallExpression(decorator.expression);\n }\n\n private hasExportModifier(\n node: ts.Node & { modifiers?: ts.NodeArray<ts.ModifierLike> }\n ): boolean {\n return (\n node.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.ExportKeyword\n ) ?? false\n );\n }\n\n private prependExportModifier(\n modifiers: ts.NodeArray<ts.ModifierLike> | undefined\n ): ts.ModifierLike[] {\n const exportModifier = ts.factory.createModifier(\n ts.SyntaxKind.ExportKeyword\n );\n return modifiers ? [exportModifier, ...modifiers] : [exportModifier];\n }\n\n private addExportToTypes(\n content: string,\n filePath: string,\n typeNames: string[]\n ): TransformResult<string> {\n const changes: string[] = [];\n const typeNamesSet = new Set(typeNames);\n\n const visitorFactory = this.createExportAdditionVisitor(\n typeNamesSet,\n changes\n );\n const transformedContent = this.transformSourceFile(\n content,\n filePath,\n visitorFactory\n );\n\n return { content: transformedContent, changes };\n }\n\n private createExportAdditionVisitor(\n typeNamesSet: Set<string>,\n changes: string[]\n ): (context: ts.TransformationContext) => VisitorFunction {\n return (context: ts.TransformationContext) => {\n const visit: VisitorFunction = (node: ts.Node): ts.Node => {\n if (ts.isTypeAliasDeclaration(node)) {\n return this.addExportToTypeAlias(\n node,\n typeNamesSet,\n changes\n );\n }\n\n if (ts.isInterfaceDeclaration(node)) {\n return this.addExportToInterface(\n node,\n typeNamesSet,\n changes\n );\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return visit;\n };\n }\n\n private addExportToTypeAlias(\n node: ts.TypeAliasDeclaration,\n typeNamesSet: Set<string>,\n changes: string[]\n ): ts.TypeAliasDeclaration {\n const typeName = node.name.text;\n\n if (!typeNamesSet.has(typeName) || this.hasExportModifier(node)) {\n return node;\n }\n\n changes.push(`added export: type ${typeName}`);\n return ts.factory.createTypeAliasDeclaration(\n this.prependExportModifier(node.modifiers),\n node.name,\n node.typeParameters,\n node.type\n );\n }\n\n private addExportToInterface(\n node: ts.InterfaceDeclaration,\n typeNamesSet: Set<string>,\n changes: string[]\n ): ts.InterfaceDeclaration {\n const typeName = node.name.text;\n\n if (!typeNamesSet.has(typeName) || this.hasExportModifier(node)) {\n return node;\n }\n\n changes.push(`added export: interface ${typeName}`);\n return ts.factory.createInterfaceDeclaration(\n this.prependExportModifier(node.modifiers),\n node.name,\n node.typeParameters,\n node.heritageClauses,\n node.members\n );\n }\n\n private transformSourceFile(\n content: string,\n filePath: string,\n visitorFactory: (context: ts.TransformationContext) => VisitorFunction\n ): string {\n const sourceFile = ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS\n );\n\n const transformer: ts.TransformerFactory<ts.SourceFile> = (context) => {\n return (sf) => {\n const visitor = visitorFactory(context);\n return ts.visitNode(sf, visitor) as ts.SourceFile;\n };\n };\n\n const result = ts.transform(sourceFile, [transformer]);\n const transformedSourceFile = result.transformed[0];\n\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n const transformedContent = printer.printFile(transformedSourceFile);\n\n result.dispose();\n\n return transformedContent;\n }\n\n private extractSymbolsFromEntry(\n content: string,\n filePath: string,\n messageTypes: readonly MessageType[],\n decoratorNames?: DecoratorNames\n ): { content: string; usedModuleSpecifiers: Set<string> } {\n const sourceFile = ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS\n );\n\n const decoratorToMessageType =\n this.buildDecoratorToMessageTypeMap(decoratorNames);\n const context: SymbolExtractionContext = {\n sourceFile,\n content,\n messageTypes,\n decoratorToMessageType,\n };\n\n const { targetClassNames, targetClasses } =\n this.findTargetClasses(context);\n\n if (targetClasses.length === 0) {\n return { content, usedModuleSpecifiers: new Set() };\n }\n\n const relatedTypeNames = this.computeRelatedTypeNames(targetClassNames);\n const usedIdentifiers = this.collectUsedIdentifiers(targetClasses);\n const localTypeDeclarations =\n this.collectLocalTypeDeclarations(sourceFile);\n const includedLocalTypes = this.resolveIncludedLocalTypes(\n usedIdentifiers,\n relatedTypeNames,\n localTypeDeclarations\n );\n\n const extractedSymbols: ExtractedSymbols = {\n targetClassNames,\n targetClasses,\n usedIdentifiers,\n includedLocalTypes,\n localTypeDeclarations,\n };\n\n return this.generateExtractedOutput(context, extractedSymbols);\n }\n\n private buildDecoratorToMessageTypeMap(\n decoratorNames?: DecoratorNames\n ): Record<string, MessageType> {\n const names = { ...DEFAULT_DECORATOR_NAMES, ...decoratorNames };\n return {\n [names.event]: \"event\",\n [names.command]: \"command\",\n [names.query]: \"query\",\n };\n }\n\n private findTargetClasses(context: SymbolExtractionContext): {\n targetClassNames: Set<string>;\n targetClasses: ts.ClassDeclaration[];\n } {\n const targetClassNames = new Set<string>();\n const targetClasses: ts.ClassDeclaration[] = [];\n\n const findClasses = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name) {\n for (const [decoratorName, messageType] of Object.entries(\n context.decoratorToMessageType\n )) {\n if (\n hasDecorator(node, decoratorName) &&\n context.messageTypes.includes(messageType)\n ) {\n targetClassNames.add(node.name.text);\n targetClasses.push(node);\n break;\n }\n }\n }\n ts.forEachChild(node, findClasses);\n };\n findClasses(context.sourceFile);\n\n return { targetClassNames, targetClasses };\n }\n\n private computeRelatedTypeNames(\n targetClassNames: Set<string>\n ): Set<string> {\n const relatedTypeNames = new Set<string>();\n\n for (const className of targetClassNames) {\n if (className.endsWith(REQUEST_SUFFIX)) {\n const baseName = className.slice(0, -REQUEST_SUFFIX.length);\n relatedTypeNames.add(baseName + \"Response\");\n relatedTypeNames.add(baseName + \"Payload\");\n } else if (className.endsWith(QUERY_SUFFIX)) {\n const baseName = className.slice(0, -QUERY_SUFFIX.length);\n relatedTypeNames.add(baseName + \"QueryResult\");\n relatedTypeNames.add(baseName + \"Payload\");\n }\n\n relatedTypeNames.add(className + \"Response\");\n relatedTypeNames.add(className + \"Payload\");\n }\n\n return relatedTypeNames;\n }\n\n private collectUsedIdentifiers(\n targetClasses: ts.ClassDeclaration[]\n ): Set<string> {\n const usedIdentifiers = new Set<string>();\n\n const collectIdentifiers = (node: ts.Node): void => {\n if (\n ts.isTypeReferenceNode(node) &&\n ts.isIdentifier(node.typeName)\n ) {\n usedIdentifiers.add(node.typeName.text);\n }\n if (\n ts.isExpressionWithTypeArguments(node) &&\n ts.isIdentifier(node.expression)\n ) {\n usedIdentifiers.add(node.expression.text);\n }\n if (ts.isIdentifier(node) && node.parent) {\n const isHeritageOrTypeRef =\n ts.isHeritageClause(node.parent.parent) ||\n ts.isTypeReferenceNode(node.parent);\n if (isHeritageOrTypeRef) {\n usedIdentifiers.add(node.text);\n }\n }\n if (ts.isDecorator(node)) {\n this.collectDecoratorIdentifier(node, usedIdentifiers);\n }\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n usedIdentifiers.add(node.expression.text);\n }\n ts.forEachChild(node, collectIdentifiers);\n };\n\n for (const cls of targetClasses) {\n collectIdentifiers(cls);\n }\n\n return usedIdentifiers;\n }\n\n private collectDecoratorIdentifier(\n decorator: ts.Decorator,\n usedIdentifiers: Set<string>\n ): void {\n const expr = decorator.expression;\n if (ts.isIdentifier(expr)) {\n usedIdentifiers.add(expr.text);\n } else if (\n ts.isCallExpression(expr) &&\n ts.isIdentifier(expr.expression)\n ) {\n usedIdentifiers.add(expr.expression.text);\n }\n }\n\n private collectLocalTypeDeclarations(\n sourceFile: ts.SourceFile\n ): Map<string, ts.Node[]> {\n const localTypeDeclarations = new Map<string, ts.Node[]>();\n\n const collectLocalTypes = (node: ts.Node): void => {\n if (ts.isInterfaceDeclaration(node) && node.name) {\n this.addToDeclarationMap(\n localTypeDeclarations,\n node.name.text,\n node\n );\n }\n if (ts.isTypeAliasDeclaration(node) && node.name) {\n this.addToDeclarationMap(\n localTypeDeclarations,\n node.name.text,\n node\n );\n }\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name)) {\n this.addToDeclarationMap(\n localTypeDeclarations,\n decl.name.text,\n node\n );\n }\n }\n }\n ts.forEachChild(node, collectLocalTypes);\n };\n collectLocalTypes(sourceFile);\n\n return localTypeDeclarations;\n }\n\n private addToDeclarationMap(\n map: Map<string, ts.Node[]>,\n name: string,\n node: ts.Node\n ): void {\n const existing = map.get(name) ?? [];\n existing.push(node);\n map.set(name, existing);\n }\n\n private resolveIncludedLocalTypes(\n usedIdentifiers: Set<string>,\n relatedTypeNames: Set<string>,\n localTypeDeclarations: Map<string, ts.Node[]>\n ): Set<string> {\n const includedLocalTypes = new Set<string>();\n const queue = [...usedIdentifiers, ...relatedTypeNames];\n\n while (queue.length > 0) {\n const identifier = queue.shift()!;\n if (includedLocalTypes.has(identifier)) continue;\n\n const typeNodes = localTypeDeclarations.get(identifier);\n if (!typeNodes || typeNodes.length === 0) continue;\n\n includedLocalTypes.add(identifier);\n\n const typeIdentifiers =\n this.collectTypeIdentifiersFromNodes(typeNodes);\n for (const id of typeIdentifiers) {\n if (!includedLocalTypes.has(id)) {\n queue.push(id);\n usedIdentifiers.add(id);\n }\n }\n }\n\n return includedLocalTypes;\n }\n\n private collectTypeIdentifiersFromNodes(nodes: ts.Node[]): Set<string> {\n const typeIdentifiers = new Set<string>();\n\n const collectFromType = (node: ts.Node): void => {\n if (\n ts.isTypeReferenceNode(node) &&\n ts.isIdentifier(node.typeName)\n ) {\n typeIdentifiers.add(node.typeName.text);\n }\n if (\n ts.isExpressionWithTypeArguments(node) &&\n ts.isIdentifier(node.expression)\n ) {\n typeIdentifiers.add(node.expression.text);\n }\n if (ts.isComputedPropertyName(node)) {\n this.collectComputedPropertyIdentifier(node, typeIdentifiers);\n }\n ts.forEachChild(node, collectFromType);\n };\n\n for (const typeNode of nodes) {\n collectFromType(typeNode);\n }\n\n return typeIdentifiers;\n }\n\n private collectComputedPropertyIdentifier(\n node: ts.ComputedPropertyName,\n typeIdentifiers: Set<string>\n ): void {\n const expr = node.expression;\n if (\n ts.isPropertyAccessExpression(expr) &&\n ts.isIdentifier(expr.expression)\n ) {\n typeIdentifiers.add(expr.expression.text);\n }\n if (ts.isIdentifier(expr)) {\n typeIdentifiers.add(expr.text);\n }\n }\n\n private generateExtractedOutput(\n context: SymbolExtractionContext,\n symbols: ExtractedSymbols\n ): { content: string; usedModuleSpecifiers: Set<string> } {\n const output: string[] = [];\n\n const importMap = this.buildImportMap(context.sourceFile);\n const filteredImports = this.filterImports(\n symbols.usedIdentifiers,\n importMap,\n symbols.includedLocalTypes\n );\n\n this.appendImportStatements(output, filteredImports);\n this.appendLocalTypeDeclarations(output, context, symbols);\n this.appendTargetClasses(output, context, symbols.targetClasses);\n\n const usedModuleSpecifiers = new Set(filteredImports.keys());\n\n return {\n content: output.join(\"\\n\"),\n usedModuleSpecifiers,\n };\n }\n\n private buildImportMap(sourceFile: ts.SourceFile): Map<string, ImportInfo> {\n const importMap = new Map<string, ImportInfo>();\n\n const collectImports = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) {\n const moduleSpecifier = (\n node.moduleSpecifier as ts.StringLiteral\n ).text;\n const namedBindings = node.importClause?.namedBindings;\n const isTypeOnly = node.importClause?.isTypeOnly ?? false;\n\n if (namedBindings && ts.isNamedImports(namedBindings)) {\n for (const element of namedBindings.elements) {\n importMap.set(element.name.text, {\n moduleSpecifier,\n isTypeOnly,\n });\n }\n }\n }\n ts.forEachChild(node, collectImports);\n };\n collectImports(sourceFile);\n\n return importMap;\n }\n\n private filterImports(\n usedIdentifiers: Set<string>,\n importMap: Map<string, ImportInfo>,\n includedLocalTypes: Set<string>\n ): Map<string, { identifiers: Set<string>; isTypeOnly: boolean }> {\n const filteredImports = new Map<\n string,\n { identifiers: Set<string>; isTypeOnly: boolean }\n >();\n\n for (const identifier of usedIdentifiers) {\n const importInfo = importMap.get(identifier);\n if (!importInfo || includedLocalTypes.has(identifier)) {\n continue;\n }\n\n const existing = filteredImports.get(importInfo.moduleSpecifier);\n if (existing) {\n existing.identifiers.add(identifier);\n } else {\n filteredImports.set(importInfo.moduleSpecifier, {\n identifiers: new Set([identifier]),\n isTypeOnly: importInfo.isTypeOnly,\n });\n }\n }\n\n return filteredImports;\n }\n\n private appendImportStatements(\n output: string[],\n filteredImports: Map<\n string,\n { identifiers: Set<string>; isTypeOnly: boolean }\n >\n ): void {\n for (const [moduleSpecifier, info] of filteredImports) {\n const identifiers = [...info.identifiers].sort().join(\", \");\n const typeOnlyPrefix = info.isTypeOnly ? \"type \" : \"\";\n output.push(\n `import ${typeOnlyPrefix}{ ${identifiers} } from \"${moduleSpecifier}\";`\n );\n }\n\n if (output.length > 0) {\n output.push(\"\");\n }\n }\n\n private appendLocalTypeDeclarations(\n output: string[],\n context: SymbolExtractionContext,\n symbols: ExtractedSymbols\n ): void {\n const outputNodes = new Set<ts.Node>();\n\n for (const typeName of symbols.includedLocalTypes) {\n const typeNodes = symbols.localTypeDeclarations.get(typeName);\n if (!typeNodes) continue;\n\n for (const typeNode of typeNodes) {\n if (outputNodes.has(typeNode)) continue;\n outputNodes.add(typeNode);\n\n this.appendNodeWithExport(output, context, typeNode);\n }\n }\n }\n\n private appendTargetClasses(\n output: string[],\n context: SymbolExtractionContext,\n targetClasses: ts.ClassDeclaration[]\n ): void {\n for (const cls of targetClasses) {\n this.appendNodeWithExport(output, context, cls);\n }\n }\n\n private appendNodeWithExport(\n output: string[],\n context: SymbolExtractionContext,\n node: ts.Node\n ): void {\n const nodeText = context.content\n .substring(node.getStart(context.sourceFile), node.end)\n .trim();\n\n const hasExport = this.nodeHasExportKeyword(node);\n\n if (hasExport) {\n output.push(nodeText);\n } else {\n output.push(\"export \" + nodeText);\n }\n output.push(\"\");\n }\n\n private nodeHasExportKeyword(node: ts.Node): boolean {\n const isExportableDeclaration =\n ts.isInterfaceDeclaration(node) ||\n ts.isTypeAliasDeclaration(node) ||\n ts.isVariableStatement(node) ||\n ts.isClassDeclaration(node);\n\n if (!isExportableDeclaration) {\n return false;\n }\n\n const declarationNode = node as\n | ts.InterfaceDeclaration\n | ts.TypeAliasDeclaration\n | ts.VariableStatement\n | ts.ClassDeclaration;\n\n return (\n declarationNode.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.ExportKeyword\n ) ?? false\n );\n }\n}\n","import path from \"path\";\nimport ts from \"typescript\";\n\nimport type { FileSystem } from \"./file-system\";\nimport { nodeFileSystem } from \"./file-system\";\nimport type { ResponseNamingConvention } from \"./domain/types\";\n\nconst TYPESCRIPT_EXTENSIONS = [\".ts\", \".tsx\", \".d.ts\"];\nconst INDEX_FILE = \"index.ts\";\n\n/**\n * Internal class for handling tsconfig path alias resolution.\n * Uses Null Object pattern - NONE instance handles missing tsconfig case.\n */\nclass Tsconfig {\n static readonly NONE = new Tsconfig(new Map());\n\n private constructor(private readonly paths: Map<string, string[]>) {}\n\n static async load(tsconfigPath: string, fs: FileSystem): Promise<Tsconfig> {\n const absolutePath = path.resolve(tsconfigPath);\n const configDir = path.dirname(absolutePath);\n\n const content = await fs.readFile(absolutePath);\n const { config, error } = ts.parseConfigFileTextToJson(absolutePath, content);\n\n if (error) {\n throw new Error(\n `Failed to parse tsconfig: ${ts.flattenDiagnosticMessageText(error.messageText, \"\\n\")}`\n );\n }\n\n const parsed = ts.parseJsonConfigFileContent(config, ts.sys, configDir);\n\n const baseUrl = parsed.options.baseUrl ?? configDir;\n const paths = new Map<string, string[]>();\n\n if (parsed.options.paths) {\n for (const [alias, targets] of Object.entries(parsed.options.paths)) {\n const resolvedTargets = (targets as string[]).map((target) =>\n path.join(baseUrl, target)\n );\n paths.set(alias, resolvedTargets);\n }\n }\n\n return new Tsconfig(paths);\n }\n\n /**\n * Pure string transformation: resolves path alias to potential file paths.\n * Returns null if no alias matches.\n */\n resolvePath(importPath: string): string[] | null {\n for (const [pattern, targets] of this.paths) {\n const wildcardMatch = this.matchPathPattern(importPath, pattern);\n if (wildcardMatch === null) {\n continue;\n }\n\n return targets.map((target) => target.replace(\"*\", wildcardMatch));\n }\n\n return null;\n }\n\n private matchPathPattern(moduleSpecifier: string, pattern: string): string | null {\n if (pattern.endsWith(\"*\")) {\n const prefix = pattern.slice(0, -1);\n if (moduleSpecifier.startsWith(prefix)) {\n return moduleSpecifier.slice(prefix.length);\n }\n } else if (moduleSpecifier === pattern) {\n return \"\";\n }\n return null;\n }\n}\n\nexport interface InputContextConfig {\n readonly name: string;\n readonly path: string;\n readonly sourceDir?: string;\n readonly tsconfigPath?: string;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n}\n\n/**\n * Encapsulates context configuration with path resolution capabilities.\n * Created via factory method to ensure proper initialization.\n */\nexport class ContextConfig {\n private readonly fs: FileSystem;\n private readonly tsconfig: Tsconfig;\n\n readonly name: string;\n readonly sourceDir: string;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n\n private constructor(\n name: string,\n sourceDir: string,\n tsconfig: Tsconfig,\n fs: FileSystem,\n responseNamingConventions?: readonly ResponseNamingConvention[]\n ) {\n this.name = name;\n this.sourceDir = sourceDir;\n this.tsconfig = tsconfig;\n this.fs = fs;\n this.responseNamingConventions = responseNamingConventions;\n }\n\n /**\n * Factory method to create ContextConfig with properly loaded tsconfig.\n */\n static async create(\n input: InputContextConfig,\n configDir: string,\n fs: FileSystem = nodeFileSystem\n ): Promise<ContextConfig> {\n if (!input.name) {\n throw new Error(\"ContextConfig requires 'name'\");\n }\n if (!input.path) {\n throw new Error(`ContextConfig '${input.name}' requires 'path'`);\n }\n\n const basePath = path.resolve(configDir, input.path);\n const sourceDir = path.resolve(basePath, input.sourceDir ?? \"src\");\n const tsconfig = await this.loadTsconfig(basePath, input.tsconfigPath, fs);\n\n return new ContextConfig(\n input.name,\n sourceDir,\n tsconfig,\n fs,\n input.responseNamingConventions\n );\n }\n\n private static async loadTsconfig(\n basePath: string,\n inputPath: string | undefined,\n fs: FileSystem\n ): Promise<Tsconfig> {\n const tsconfigPath = path.resolve(basePath, inputPath ?? \"tsconfig.json\");\n if (!await fs.exists(tsconfigPath)) {\n return Tsconfig.NONE;\n }\n return Tsconfig.load(tsconfigPath, fs);\n }\n\n /**\n * Creates a ContextConfig without async loading (for cases where tsconfig is not needed\n * or already handled externally).\n */\n static createSync(\n name: string,\n sourceDir: string,\n fs: FileSystem = nodeFileSystem,\n responseNamingConventions?: readonly ResponseNamingConvention[]\n ): ContextConfig {\n return new ContextConfig(\n name,\n sourceDir,\n Tsconfig.NONE,\n fs,\n responseNamingConventions\n );\n }\n\n /**\n * Resolves a module specifier (path alias) to actual file path.\n * Only handles non-relative imports (path aliases).\n *\n * @param moduleSpecifier - The import path to resolve (e.g., \"@/utils/helper\")\n * @returns Object with resolvedPath (null if external) and isExternal flag\n */\n async resolvePath(\n moduleSpecifier: string\n ): Promise<{ resolvedPath: string | null; isExternal: boolean }> {\n const resolvedPaths = this.tsconfig.resolvePath(moduleSpecifier);\n if (!resolvedPaths) {\n return { resolvedPath: null, isExternal: true };\n }\n\n for (const resolvedPath of resolvedPaths) {\n const filePath = await this.tryResolveWithExtensions(resolvedPath);\n if (filePath && filePath.startsWith(this.sourceDir)) {\n return { resolvedPath: filePath, isExternal: false };\n }\n }\n\n return { resolvedPath: null, isExternal: true };\n }\n\n private async tryResolveWithExtensions(basePath: string): Promise<string | null> {\n const extensionCandidates = TYPESCRIPT_EXTENSIONS.map((ext) => basePath + ext);\n const indexCandidate = path.join(basePath, INDEX_FILE);\n const candidates = [...extensionCandidates, indexCandidate];\n\n for (const candidate of candidates) {\n if (await this.fs.exists(candidate)) {\n return candidate;\n }\n }\n\n return null;\n }\n}\n","import { resolve, dirname, basename, relative } from \"path\";\nimport ts from \"typescript\";\n\nimport { ConfigLoadError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\nimport type { DecoratorNames, ResponseNamingConvention } from \"./domain\";\nimport { mergeDecoratorNames } from \"./domain\";\nimport { ContextConfig, type InputContextConfig } from \"./context-config\";\n\nconst SUPPORTED_GLOB_PARTS_COUNT = 2;\n\nexport interface ContractsConfig {\n readonly contexts: readonly ContextConfig[];\n readonly pathAliasRewrites?: Readonly<Record<string, string>>;\n readonly externalDependencies?: Readonly<Record<string, string>>;\n readonly decoratorNames: Required<DecoratorNames>;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n readonly removeDecorators?: boolean;\n}\n\ninterface ApplicationConfig {\n contracts?: {\n contexts?: string[] | InputContextConfig[];\n pathAliasRewrites?: Record<string, string>;\n externalDependencies?: Record<string, string>;\n decoratorNames?: DecoratorNames;\n responseNamingConventions?: ResponseNamingConvention[];\n removeDecorators?: boolean;\n };\n}\n\nexport interface ConfigLoaderOptions {\n fileSystem?: FileSystem;\n}\n\nexport class ConfigLoader {\n private readonly fs: FileSystem;\n\n constructor(options: ConfigLoaderOptions = {}) {\n this.fs = options.fileSystem ?? nodeFileSystem;\n }\n\n async load(configPath: string): Promise<ContractsConfig> {\n const absolutePath = resolve(configPath);\n const config = await this.loadTypeScriptConfig(absolutePath);\n\n return this.extractContractsConfig(config, dirname(absolutePath));\n }\n\n private async loadTypeScriptConfig(absolutePath: string): Promise<ApplicationConfig> {\n const source = await this.fs.readFile(absolutePath);\n const result = ts.transpileModule(source, {\n compilerOptions: {\n module: ts.ModuleKind.CommonJS,\n target: ts.ScriptTarget.ES2020,\n esModuleInterop: true,\n },\n });\n\n const exports: { default?: ApplicationConfig } = {};\n const moduleWrapper = new Function(\"exports\", result.outputText);\n moduleWrapper(exports);\n\n return exports.default ?? (exports as unknown as ApplicationConfig);\n }\n\n private async extractContractsConfig(\n config: ApplicationConfig,\n configDir: string\n ): Promise<ContractsConfig> {\n const contracts = config.contracts;\n\n if (!contracts) {\n throw new ConfigLoadError(\"Missing 'contracts' section in config\");\n }\n\n if (!contracts.contexts || !Array.isArray(contracts.contexts)) {\n throw new ConfigLoadError(\"Missing 'contracts.contexts' in config\");\n }\n\n const contexts = await this.resolveContexts(contracts.contexts, configDir);\n\n if (contexts.length === 0) {\n throw new ConfigLoadError(\"No contexts found from 'contexts'\");\n }\n\n const decoratorNames = mergeDecoratorNames(contracts.decoratorNames);\n\n return {\n contexts,\n pathAliasRewrites: contracts.pathAliasRewrites,\n externalDependencies: contracts.externalDependencies,\n decoratorNames,\n responseNamingConventions: contracts.responseNamingConventions,\n removeDecorators: contracts.removeDecorators ?? true,\n };\n }\n\n private async resolveContexts(\n contextsConfig: string[] | InputContextConfig[],\n configDir: string\n ): Promise<ContextConfig[]> {\n const contexts: ContextConfig[] = [];\n\n for (let i = 0; i < contextsConfig.length; i++) {\n const item = contextsConfig[i];\n\n if (typeof item === \"string\") {\n const resolvedContexts = await this.resolveStringContext(item, configDir);\n contexts.push(...resolvedContexts);\n } else {\n const contextConfig = await this.createObjectContext(item, i, configDir);\n contexts.push(contextConfig);\n }\n }\n\n return contexts;\n }\n\n private async resolveStringContext(\n contextPath: string,\n configDir: string\n ): Promise<ContextConfig[]> {\n if (contextPath.includes(\"*\")) {\n return this.expandGlobPattern(contextPath, configDir);\n }\n\n const basePath = resolve(configDir, contextPath);\n const name = basename(basePath);\n\n return [await ContextConfig.create(\n { name, path: contextPath },\n configDir,\n this.fs\n )];\n }\n\n private async expandGlobPattern(pattern: string, configDir: string): Promise<ContextConfig[]> {\n const packageDirs = await this.matchGlobPattern(pattern, configDir);\n\n return Promise.all(\n packageDirs.map((dir) => {\n const name = basename(dir);\n const relativePath = relative(configDir, dir);\n\n return ContextConfig.create(\n { name, path: relativePath },\n configDir,\n this.fs\n );\n })\n );\n }\n\n private async createObjectContext(\n ctx: InputContextConfig,\n index: number,\n configDir: string\n ): Promise<ContextConfig> {\n if (!ctx.name || typeof ctx.name !== \"string\") {\n throw new ConfigLoadError(\n `Invalid context at index ${index}: missing 'name'`\n );\n }\n if (!ctx.path || typeof ctx.path !== \"string\") {\n throw new ConfigLoadError(\n `Invalid context at index ${index}: missing 'path'`\n );\n }\n\n return ContextConfig.create(ctx, configDir, this.fs);\n }\n\n private async matchGlobPattern(pattern: string, configDir: string): Promise<string[]> {\n const globParts = pattern.split(\"*\");\n\n if (globParts.length !== SUPPORTED_GLOB_PARTS_COUNT) {\n throw new ConfigLoadError(\n `Invalid glob pattern: \"${pattern}\". Only single wildcard patterns like \"packages/*\" are supported.`\n );\n }\n\n const [prefix, suffix] = globParts;\n const baseDir = resolve(configDir, prefix);\n\n if (!await this.fs.exists(baseDir)) {\n return [];\n }\n\n const entries = await this.fs.readdir(baseDir);\n const matchedDirs: string[] = [];\n\n for (const entry of entries) {\n const fullPath = resolve(baseDir, entry);\n const stats = await this.fs.stat(fullPath);\n\n if (!stats.isDirectory()) {\n continue;\n }\n\n if (suffix) {\n const suffixPath = resolve(fullPath, suffix.replace(/^\\//, \"\"));\n if (await this.fs.exists(suffixPath)) {\n matchedDirs.push(fullPath);\n }\n } else {\n matchedDirs.push(fullPath);\n }\n }\n\n return matchedDirs.sort();\n }\n}\n\nexport { ConfigLoadError } from \"./errors\";\n","import type { DomainEvent, Command, Query } from \"./domain/types\";\n\ntype Message = DomainEvent | Command | Query;\n\nexport interface RegistryGeneratorOptions {\n readonly messageRegistryImport: string;\n readonly useNamespace?: boolean;\n}\n\nexport interface ContextMessages {\n readonly contextName: string;\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries?: readonly Query[];\n readonly importPath?: string;\n}\n\nconst DEFAULT_OPTIONS: RegistryGeneratorOptions = {\n messageRegistryImport: \"@hexaijs/plugin-contracts-generator/runtime\",\n};\n\nfunction hasMessages(ctx: ContextMessages): boolean {\n return (\n ctx.events.length > 0 ||\n ctx.commands.length > 0 ||\n (ctx.queries?.length ?? 0) > 0\n );\n}\n\nfunction getAllMessages(ctx: ContextMessages): readonly Message[] {\n return [...ctx.events, ...ctx.commands, ...(ctx.queries ?? [])];\n}\n\nexport class RegistryGenerator {\n private readonly options: RegistryGeneratorOptions;\n\n constructor(options: Partial<RegistryGeneratorOptions> = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n generate(contexts: readonly ContextMessages[]): string {\n const allMessages = contexts.flatMap((ctx) =>\n getAllMessages(ctx).map((message) => ({\n message,\n contextName: ctx.contextName,\n }))\n );\n\n if (allMessages.length === 0) {\n return this.generateEmptyRegistry();\n }\n\n if (this.options.useNamespace) {\n return this.generateWithNamespace(contexts, allMessages);\n }\n\n const imports = this.generateImports(contexts);\n const registrations = this.generateRegistrations(allMessages);\n\n return [\n imports,\n \"\",\n \"export const messageRegistry = new MessageRegistry()\",\n registrations,\n ].join(\"\\n\");\n }\n\n private generateEmptyRegistry(): string {\n return [\n `import { MessageRegistry } from \"${this.options.messageRegistryImport}\";`,\n \"\",\n \"export const messageRegistry = new MessageRegistry();\",\n \"\",\n ].join(\"\\n\");\n }\n\n private generateWithNamespace(\n contexts: readonly ContextMessages[],\n allMessages: readonly { message: Message; contextName: string }[]\n ): string {\n const imports = this.generateNamespaceImports(contexts);\n const exports = this.generateNamespaceExports(contexts);\n const registrations = this.generateNamespaceRegistrations(allMessages);\n\n return [\n imports,\n \"\",\n exports,\n \"\",\n \"export const messageRegistry = new MessageRegistry()\",\n registrations,\n ].join(\"\\n\");\n }\n\n private getNamespaceInfos(\n contexts: readonly ContextMessages[]\n ): Array<{ importPath: string; namespace: string }> {\n return contexts.filter(hasMessages).map((ctx) => ({\n importPath: ctx.importPath ?? `./${ctx.contextName}`,\n namespace: this.toNamespace(ctx.contextName),\n }));\n }\n\n private generateNamespaceImports(\n contexts: readonly ContextMessages[]\n ): string {\n return [\n `import { MessageRegistry } from \"${this.options.messageRegistryImport}\";`,\n ...this.getNamespaceInfos(contexts).map(\n ({ importPath, namespace }) =>\n `import * as ${namespace} from \"${importPath}\";`\n ),\n ].join(\"\\n\");\n }\n\n private generateNamespaceExports(\n contexts: readonly ContextMessages[]\n ): string {\n return this.getNamespaceInfos(contexts)\n .map(\n ({ importPath, namespace }) =>\n `export * as ${namespace} from \"${importPath}\";`\n )\n .join(\"\\n\");\n }\n\n private generateNamespaceRegistrations(\n messages: readonly { message: Message; contextName: string }[]\n ): string {\n const lines = messages.map(({ message, contextName }) => {\n const namespace = this.toNamespace(contextName);\n return ` .register(${namespace}.${message.name})`;\n });\n return lines.join(\"\\n\") + \";\\n\";\n }\n\n private toNamespace(contextName: string): string {\n // kebab-case to camelCase\n return contextName.replace(/-([a-z])/g, (_, letter) =>\n letter.toUpperCase()\n );\n }\n\n private generateImports(contexts: readonly ContextMessages[]): string {\n const lines: string[] = [\n `import { MessageRegistry } from \"${this.options.messageRegistryImport}\";`,\n ];\n\n for (const ctx of contexts) {\n const messageNames = getAllMessages(ctx).map((m) => m.name);\n\n if (messageNames.length > 0) {\n const importPath = ctx.importPath ?? `./${ctx.contextName}`;\n lines.push(\n `import { ${messageNames.join(\", \")} } from \"${importPath}\";`\n );\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n private generateRegistrations(\n messages: readonly { message: Message; contextName: string }[]\n ): string {\n const lines = messages.map(\n ({ message }) => ` .register(${message.name})`\n );\n return lines.join(\"\\n\") + \";\\n\";\n }\n}\n","import * as ts from \"typescript\";\nimport * as path from \"path\";\n\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\n\n/**\n * Represents an import that was rewritten via pathAliasRewrites\n */\nexport interface RewrittenImport {\n /** The rewritten module specifier (e.g., \"@libera/contracts/common/request\") */\n readonly rewrittenPath: string;\n /** The original module specifier before rewrite (e.g., \"@libera/common/request\") */\n readonly originalPath: string;\n /** The imported symbol names */\n readonly symbols: readonly string[];\n /** Whether this is a type-only import */\n readonly isTypeOnly: boolean;\n}\n\n/**\n * Represents a re-export file to be generated\n */\nexport interface ReexportFile {\n /** Relative path within contracts output dir (e.g., \"common/request.ts\") */\n readonly relativePath: string;\n /** The original module to re-export from */\n readonly originalModule: string;\n /** Symbols to re-export */\n readonly symbols: readonly string[];\n /** Whether all symbols are type-only */\n readonly isTypeOnly: boolean;\n}\n\nexport interface ReexportGeneratorOptions {\n fileSystem?: FileSystem;\n}\n\nexport interface AnalyzeOptions {\n /** The files to analyze (absolute paths) */\n readonly files: readonly string[];\n /** Map of original path prefix -> rewritten path prefix */\n readonly pathAliasRewrites: ReadonlyMap<string, string>;\n}\n\nexport interface GenerateOptions {\n /** The output directory for re-export files */\n readonly outputDir: string;\n /** The re-export files to generate */\n readonly reexportFiles: readonly ReexportFile[];\n}\n\n/**\n * Generates re-export files for pathAliasRewrites\n */\nexport class ReexportGenerator {\n private readonly fs: FileSystem;\n\n constructor(options: ReexportGeneratorOptions = {}) {\n this.fs = options.fileSystem ?? nodeFileSystem;\n }\n\n /**\n * Analyzes files to find imports that match pathAliasRewrites\n * and groups them by rewritten path\n */\n async analyze(options: AnalyzeOptions): Promise<ReexportFile[]> {\n const { files, pathAliasRewrites } = options;\n\n // Invert the map: rewritten prefix -> original prefix\n const rewrittenToOriginal = new Map<string, string>();\n for (const [original, rewritten] of pathAliasRewrites) {\n rewrittenToOriginal.set(rewritten, original);\n }\n\n // Collect all rewritten imports across all files\n const allImports: RewrittenImport[] = [];\n\n for (const file of files) {\n const content = await this.fs.readFile(file);\n const imports = this.extractRewrittenImports(content, rewrittenToOriginal);\n allImports.push(...imports);\n }\n\n // Group by rewritten path and merge symbols\n return this.groupImportsByPath(allImports);\n }\n\n /**\n * Generates re-export files\n */\n async generate(options: GenerateOptions): Promise<string[]> {\n const { outputDir, reexportFiles } = options;\n const generatedFiles: string[] = [];\n\n for (const reexport of reexportFiles) {\n const filePath = path.join(outputDir, reexport.relativePath);\n const content = this.generateReexportContent(reexport);\n\n await this.fs.mkdir(path.dirname(filePath), { recursive: true });\n await this.fs.writeFile(filePath, content);\n generatedFiles.push(filePath);\n }\n\n return generatedFiles;\n }\n\n /**\n * Extracts imports from source content that match rewritten prefixes\n */\n private extractRewrittenImports(\n content: string,\n rewrittenToOriginal: ReadonlyMap<string, string>\n ): RewrittenImport[] {\n const sourceFile = ts.createSourceFile(\n \"temp.ts\",\n content,\n ts.ScriptTarget.Latest,\n true\n );\n\n const imports: RewrittenImport[] = [];\n\n ts.forEachChild(sourceFile, (node) => {\n if (!ts.isImportDeclaration(node) || !node.importClause) {\n return;\n }\n\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n\n // Check if this import matches any rewritten prefix\n for (const [rewrittenPrefix, originalPrefix] of rewrittenToOriginal) {\n if (moduleSpecifier.startsWith(rewrittenPrefix)) {\n const symbols = this.extractSymbolNames(node.importClause);\n if (symbols.length > 0) {\n // Calculate the original path\n const suffix = moduleSpecifier.slice(rewrittenPrefix.length);\n const originalPath = originalPrefix + suffix;\n\n imports.push({\n rewrittenPath: moduleSpecifier,\n originalPath,\n symbols,\n isTypeOnly: node.importClause.isTypeOnly ?? false,\n });\n }\n break;\n }\n }\n });\n\n return imports;\n }\n\n /**\n * Extracts symbol names from import clause\n */\n private extractSymbolNames(importClause: ts.ImportClause): string[] {\n const names: string[] = [];\n\n // Default import\n if (importClause.name) {\n names.push(importClause.name.text);\n }\n\n // Named imports\n if (importClause.namedBindings && ts.isNamedImports(importClause.namedBindings)) {\n for (const element of importClause.namedBindings.elements) {\n // Use the original name if aliased, otherwise use the imported name\n const originalName = element.propertyName?.text ?? element.name.text;\n names.push(originalName);\n }\n }\n\n return names;\n }\n\n /**\n * Groups imports by rewritten path and merges symbols\n */\n private groupImportsByPath(imports: RewrittenImport[]): ReexportFile[] {\n const grouped = new Map<string, {\n originalPath: string;\n symbols: Set<string>;\n hasValueImport: boolean;\n }>();\n\n for (const imp of imports) {\n const existing = grouped.get(imp.rewrittenPath);\n if (existing) {\n for (const symbol of imp.symbols) {\n existing.symbols.add(symbol);\n }\n if (!imp.isTypeOnly) {\n existing.hasValueImport = true;\n }\n } else {\n grouped.set(imp.rewrittenPath, {\n originalPath: imp.originalPath,\n symbols: new Set(imp.symbols),\n hasValueImport: !imp.isTypeOnly,\n });\n }\n }\n\n // Convert to ReexportFile array\n const result: ReexportFile[] = [];\n for (const [rewrittenPath, data] of grouped) {\n // Convert rewritten package path to relative file path\n // e.g., \"@libera/contracts/common/request\" -> \"common/request.ts\"\n const relativePath = this.rewrittenPathToRelativePath(rewrittenPath);\n\n result.push({\n relativePath,\n originalModule: data.originalPath,\n symbols: Array.from(data.symbols).sort(),\n isTypeOnly: !data.hasValueImport,\n });\n }\n\n return result.sort((a, b) => a.relativePath.localeCompare(b.relativePath));\n }\n\n /**\n * Converts a rewritten package path to a relative file path\n * e.g., \"@libera/contracts/common/request\" with prefix \"@libera/contracts\"\n * -> \"common/request.ts\"\n */\n private rewrittenPathToRelativePath(rewrittenPath: string): string {\n // Find the subpath after the package name\n // Assume format: @scope/package/subpath or package/subpath\n const parts = rewrittenPath.split(\"/\");\n\n let subpathStart: number;\n if (parts[0].startsWith(\"@\")) {\n // Scoped package: @scope/package/subpath\n subpathStart = 2;\n } else {\n // Regular package: package/subpath\n subpathStart = 1;\n }\n\n const subpath = parts.slice(subpathStart).join(\"/\");\n\n // If no subpath, use index.ts\n if (!subpath) {\n return \"index.ts\";\n }\n\n return subpath + \".ts\";\n }\n\n /**\n * Generates the content for a re-export file\n */\n private generateReexportContent(reexport: ReexportFile): string {\n const exportKeyword = reexport.isTypeOnly ? \"export type\" : \"export\";\n const symbols = reexport.symbols.join(\", \");\n return `${exportKeyword} { ${symbols} } from \"${reexport.originalModule}\";\\n`;\n }\n}\n","export type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nexport interface Logger {\n debug(message: string): void;\n info(message: string): void;\n warn(message: string): void;\n error(message: string): void;\n}\n\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\nexport interface ConsoleLoggerOptions {\n level?: LogLevel;\n}\n\nexport class ConsoleLogger implements Logger {\n private readonly level: LogLevel;\n\n constructor(options: ConsoleLoggerOptions = {}) {\n this.level = options.level ?? \"info\";\n }\n\n debug(message: string): void {\n if (this.shouldLog(\"debug\")) {\n console.debug(message);\n }\n }\n\n info(message: string): void {\n if (this.shouldLog(\"info\")) {\n console.info(message);\n }\n }\n\n warn(message: string): void {\n if (this.shouldLog(\"warn\")) {\n console.warn(message);\n }\n }\n\n error(message: string): void {\n if (this.shouldLog(\"error\")) {\n console.error(message);\n }\n }\n\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];\n }\n}\n\nclass NoopLogger implements Logger {\n debug(): void {}\n info(): void {}\n warn(): void {}\n error(): void {}\n}\n\nexport const noopLogger: Logger = new NoopLogger();\n","import { join, relative } from \"path\";\nimport { Scanner } from \"./scanner\";\nimport { Parser } from \"./parser\";\nimport { FileGraphResolver, type FileGraph } from \"./file-graph-resolver\";\nimport { FileCopier } from \"./file-copier\";\nimport { ContextConfig } from \"./context-config\";\nimport type { DomainEvent, Command, Query, TypeDefinition, ResponseNamingConvention, MessageType } from \"./domain/types\";\nimport { type FileSystem, nodeFileSystem } from \"./file-system\";\nimport { type Logger, noopLogger } from \"./logger\";\n\nconst DEFAULT_EXCLUDE_DEPENDENCIES = [\n \"**/*.test.ts\",\n \"**/*.spec.ts\",\n \"**/*.eh.ts\",\n \"**/db.ts\",\n \"**/infra/**\",\n];\n\nexport interface PipelineDependencies {\n readonly scanner: Scanner;\n readonly parser: Parser;\n readonly fileGraphResolver: FileGraphResolver;\n readonly fileCopier: FileCopier;\n readonly fileSystem: FileSystem;\n readonly logger: Logger;\n}\n\nexport interface PipelineOptions {\n readonly contextName: string;\n readonly sourceDir: string;\n readonly outputDir: string;\n readonly pathAliasRewrites?: Map<string, string>;\n readonly removeDecorators?: boolean;\n}\n\nexport interface PipelineResult {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries: readonly Query[];\n readonly copiedFiles: string[];\n}\n\nexport interface ParsedMessages {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries: readonly Query[];\n readonly typeDefinitions: readonly TypeDefinition[];\n}\n\nexport class ContractsPipeline {\n private readonly messageTypes?: readonly MessageType[];\n\n private constructor(\n private readonly deps: PipelineDependencies,\n messageTypes?: readonly MessageType[]\n ) {\n this.messageTypes = messageTypes;\n }\n\n static create(options: {\n contextConfig: ContextConfig;\n responseNamingConventions?: readonly ResponseNamingConvention[];\n fileSystem?: FileSystem;\n logger?: Logger;\n excludeDependencies?: string[];\n messageTypes?: MessageType[];\n }): ContractsPipeline {\n const fileSystem = options.fileSystem ?? nodeFileSystem;\n const logger = options.logger ?? noopLogger;\n const excludeDependencies = options.excludeDependencies ?? DEFAULT_EXCLUDE_DEPENDENCIES;\n const scanner = new Scanner({ fileSystem, messageTypes: options.messageTypes });\n const parser = new Parser({\n responseNamingConventions: options.responseNamingConventions ?? options.contextConfig.responseNamingConventions,\n messageTypes: options.messageTypes,\n });\n const fileGraphResolver = FileGraphResolver.create({\n contextConfig: options.contextConfig,\n fileSystem,\n excludeDependencies,\n });\n const fileCopier = new FileCopier({ fileSystem });\n\n return new ContractsPipeline(\n {\n scanner,\n parser,\n fileGraphResolver,\n fileCopier,\n fileSystem,\n logger,\n },\n options.messageTypes\n );\n }\n\n static fromDependencies(deps: PipelineDependencies): ContractsPipeline {\n return new ContractsPipeline(deps);\n }\n\n async execute(options: PipelineOptions): Promise<PipelineResult> {\n const { contextName, sourceDir, outputDir, pathAliasRewrites, removeDecorators } = options;\n const contextOutputDir = join(outputDir, contextName);\n\n this.deps.logger.info(`Processing context: ${contextName}`);\n this.deps.logger.debug(` Source: ${sourceDir}`);\n this.deps.logger.debug(` Output: ${contextOutputDir}`);\n\n const decoratedFiles = await this.scan(sourceDir);\n const messages = await this.parse(decoratedFiles, sourceDir);\n const fileGraph = await this.resolve(decoratedFiles, sourceDir);\n const responseTypesToExport = this.collectResponseTypesToExport(messages);\n const copiedFiles = await this.copy(fileGraph, sourceDir, contextOutputDir, pathAliasRewrites, responseTypesToExport, removeDecorators, this.messageTypes);\n await this.exportBarrel(copiedFiles, contextOutputDir);\n\n this.deps.logger.info(`Completed context: ${contextName} (${messages.events.length} events, ${messages.commands.length} commands, ${messages.queries.length} queries, ${copiedFiles.length} files)`);\n\n return {\n events: messages.events,\n commands: messages.commands,\n queries: messages.queries,\n copiedFiles,\n };\n }\n\n private collectResponseTypesToExport(messages: ParsedMessages): Map<string, string[]> {\n const result = new Map<string, string[]>();\n const allMessages = [...messages.commands, ...messages.queries];\n\n for (const message of allMessages) {\n if (message.resultType?.kind !== \"reference\") continue;\n\n const typeName = message.resultType.name;\n const sourceFile = message.sourceFile.absolutePath;\n\n // Check if this type exists and is not exported\n const typeDef = messages.typeDefinitions.find(\n (t) =>\n t.name === typeName &&\n t.sourceFile.absolutePath === sourceFile &&\n !t.exported\n );\n\n if (typeDef) {\n const existing = result.get(sourceFile) ?? [];\n if (!existing.includes(typeName)) {\n existing.push(typeName);\n result.set(sourceFile, existing);\n }\n }\n }\n\n if (result.size > 0) {\n this.deps.logger.debug(`Found ${result.size} file(s) with unexported response types`);\n }\n\n return result;\n }\n\n async scan(sourceDir: string): Promise<string[]> {\n this.deps.logger.debug(`Scanning for decorated files in ${sourceDir}`);\n const files = await this.deps.scanner.scan(sourceDir);\n this.deps.logger.debug(`Found ${files.length} decorated file(s)`);\n return files;\n }\n\n async parse(files: string[], sourceRoot: string): Promise<ParsedMessages> {\n this.deps.logger.debug(`Parsing ${files.length} file(s)`);\n const events: DomainEvent[] = [];\n const commands: Command[] = [];\n const queries: Query[] = [];\n const typeDefinitions: TypeDefinition[] = [];\n\n for (const file of files) {\n const content = await this.deps.fileSystem.readFile(file);\n const sourceFileInfo = {\n absolutePath: file,\n relativePath: relative(sourceRoot, file),\n };\n const result = this.deps.parser.parse(content, sourceFileInfo);\n events.push(...result.events);\n commands.push(...result.commands);\n queries.push(...result.queries);\n typeDefinitions.push(...result.typeDefinitions);\n }\n\n this.deps.logger.debug(`Parsed ${events.length} event(s), ${commands.length} command(s), ${queries.length} query(s), ${typeDefinitions.length} type(s)`);\n return { events, commands, queries, typeDefinitions };\n }\n\n async resolve(entryPoints: string[], sourceRoot: string): Promise<FileGraph> {\n this.deps.logger.debug(`Resolving dependencies for ${entryPoints.length} entry point(s)`);\n const graph = await this.deps.fileGraphResolver.buildGraph(entryPoints, sourceRoot);\n this.deps.logger.debug(`Resolved ${graph.nodes.size} file(s) in dependency graph`);\n return graph;\n }\n\n async copy(\n fileGraph: FileGraph,\n sourceRoot: string,\n outputDir: string,\n pathAliasRewrites?: Map<string, string>,\n responseTypesToExport?: Map<string, string[]>,\n removeDecorators?: boolean,\n messageTypes?: readonly MessageType[]\n ): Promise<string[]> {\n this.deps.logger.debug(`Copying files to ${outputDir}`);\n await this.deps.fileSystem.mkdir(outputDir, { recursive: true });\n\n const result = await this.deps.fileCopier.copyFiles({\n sourceRoot,\n outputDir,\n fileGraph,\n pathAliasRewrites,\n responseTypesToExport,\n removeDecorators,\n messageTypes,\n });\n\n this.deps.logger.debug(`Copied ${result.copiedFiles.length} file(s)`);\n return result.copiedFiles;\n }\n\n async exportBarrel(copiedFiles: string[], outputDir: string): Promise<void> {\n this.deps.logger.debug(`Generating barrel export at ${outputDir}/index.ts`);\n const indexContent = this.deps.fileCopier.generateBarrelExport(copiedFiles, outputDir);\n await this.deps.fileSystem.writeFile(join(outputDir, \"index.ts\"), indexContent);\n }\n}\n","#!/usr/bin/env node\n\nimport { fileURLToPath } from \"node:url\";\nimport { resolve, dirname, join, relative } from \"node:path\";\nimport { ConfigLoader, type ContractsConfig } from \"./config-loader\";\nimport { ContextConfig } from \"./context-config\";\nimport { ContractsPipeline, type PipelineResult, ConsoleLogger, type Logger } from \"./index\";\nimport { RegistryGenerator, ContextMessages } from \"./registry-generator\";\nimport { ReexportGenerator } from \"./reexport-generator\";\nimport { nodeFileSystem } from \"./file-system\";\nimport type { MessageType, DecoratorNames, ResponseNamingConvention } from \"./domain/types\";\nimport { mergeDecoratorNames } from \"./domain\";\n\nconst DEFAULT_CONFIG_PATH = \"application.config.ts\";\nconst EXIT_CODE_ERROR = 1;\nconst VALID_MESSAGE_TYPES: MessageType[] = [\"event\", \"command\", \"query\"];\n\nconst CLI_OPTIONS = {\n config: { short: \"-c\", long: \"--config\", requiresValue: true },\n outputDir: { short: \"-o\", long: \"--output-dir\", requiresValue: true },\n messageTypes: { short: \"-m\", long: \"--message-types\", requiresValue: true },\n generateMessageRegistry: { short: null, long: \"--generate-message-registry\", requiresValue: false },\n help: { short: \"-h\", long: \"--help\", requiresValue: false },\n} as const;\n\ninterface CliOptions {\n config: string;\n outputDir: string;\n messageTypes?: MessageType[];\n generateMessageRegistry?: boolean;\n}\n\n/**\n * Options for runWithConfig when config is provided directly.\n */\nexport interface RunWithConfigOptions {\n outputDir: string;\n messageTypes?: MessageType[];\n generateMessageRegistry?: boolean;\n}\n\n/**\n * Plugin configuration structure for contracts generator.\n * This is the config passed from hexai.config.ts.\n */\nexport interface ContractsPluginConfig {\n contexts: Array<{\n name: string;\n path: string;\n sourceDir?: string;\n tsconfigPath?: string;\n }>;\n pathAliasRewrites?: Record<string, string>;\n externalDependencies?: Record<string, string>;\n decoratorNames?: DecoratorNames;\n responseNamingConventions?: ResponseNamingConvention[];\n removeDecorators?: boolean;\n}\n\ninterface ContextProcessingResult {\n name: string;\n result: PipelineResult;\n outputDir: string;\n}\n\nfunction parseMessageTypes(value: string): MessageType[] {\n const types = value.split(\",\").map((type) => type.trim().toLowerCase());\n const invalidTypes = types.filter((type) => !VALID_MESSAGE_TYPES.includes(type as MessageType));\n\n if (invalidTypes.length > 0) {\n throw new Error(\n `Invalid message type(s): ${invalidTypes.join(\", \")}. ` +\n `Valid types are: ${VALID_MESSAGE_TYPES.join(\", \")}`\n );\n }\n\n return types as MessageType[];\n}\n\nfunction extractOptionValue(args: string[], currentIndex: number, optionName: string): { value: string; nextIndex: number } {\n const currentArg = args[currentIndex];\n\n const equalsIndex = currentArg.indexOf(\"=\");\n if (equalsIndex !== -1) {\n return {\n value: currentArg.slice(equalsIndex + 1),\n nextIndex: currentIndex,\n };\n }\n\n const nextValue = args[currentIndex + 1];\n if (!nextValue) {\n throw new Error(`Missing value for ${optionName} option`);\n }\n\n return {\n value: nextValue,\n nextIndex: currentIndex + 1,\n };\n}\n\nfunction matchesOption(arg: string, option: typeof CLI_OPTIONS[keyof typeof CLI_OPTIONS]): boolean {\n const matchesShortOrLong = arg === option.short || arg === option.long;\n const matchesLongWithValue = option.long !== null && arg.startsWith(`${option.long}=`);\n return matchesShortOrLong || matchesLongWithValue;\n}\n\nfunction parseArgs(args: string[]): CliOptions {\n const options: Partial<CliOptions> = {\n config: DEFAULT_CONFIG_PATH,\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n\n if (matchesOption(arg, CLI_OPTIONS.config)) {\n const { value, nextIndex } = extractOptionValue(args, i, \"--config\");\n options.config = value;\n i = nextIndex;\n } else if (matchesOption(arg, CLI_OPTIONS.outputDir)) {\n const { value, nextIndex } = extractOptionValue(args, i, \"--output-dir\");\n options.outputDir = value;\n i = nextIndex;\n } else if (matchesOption(arg, CLI_OPTIONS.messageTypes)) {\n const { value, nextIndex } = extractOptionValue(args, i, \"--message-types\");\n options.messageTypes = parseMessageTypes(value);\n i = nextIndex;\n } else if (matchesOption(arg, CLI_OPTIONS.generateMessageRegistry)) {\n options.generateMessageRegistry = true;\n } else if (matchesOption(arg, CLI_OPTIONS.help)) {\n printHelp();\n process.exit(0);\n }\n }\n\n if (!options.outputDir) {\n throw new Error(\"Missing required option: --output-dir\");\n }\n\n return options as CliOptions;\n}\n\nfunction printHelp(): void {\n console.log(`\ncontracts-generator - Extract domain events and commands from TypeScript source\n\nUsage:\n contracts-generator --output-dir <path> [options]\n\nRequired:\n -o, --output-dir <path> Output directory for generated contracts\n\nOptions:\n -c, --config <path> Path to config file (default: ${DEFAULT_CONFIG_PATH})\n -m, --message-types <types> Filter message types to extract (comma-separated)\n Valid types: ${VALID_MESSAGE_TYPES.join(\", \")}\n Default: all types\n --generate-message-registry Generate message registry index.ts file\n Default: not generated\n -h, --help Show this help message\n\nConfig file format:\n export default {\n contracts: {\n contexts: [\n {\n name: \"lecture\",\n sourceDir: \"packages/lecture/src\",\n },\n ],\n pathAliasRewrites: {\n \"@/\": \"@libera/\",\n },\n },\n };\n\nExamples:\n # Extract all message types\n contracts-generator --output-dir packages/contracts/src\n\n # Extract only commands and queries\n contracts-generator -o packages/contracts/requests -m command,query\n\n # Extract only events\n contracts-generator -o packages/contracts/events --message-types event\n\n # Generate with message registry (index.ts)\n contracts-generator -o packages/contracts/src --generate-message-registry\n\n # Use with custom config\n contracts-generator -c app.config.ts -o packages/contracts/src\n`);\n}\n\ninterface SummaryTotals {\n events: number;\n commands: number;\n files: number;\n}\n\nfunction calculateSummaryTotals(results: ContextProcessingResult[]): SummaryTotals {\n return results.reduce(\n (totals, contextResult) => ({\n events: totals.events + contextResult.result.events.length,\n commands: totals.commands + contextResult.result.commands.length,\n files: totals.files + contextResult.result.copiedFiles.length,\n }),\n { events: 0, commands: 0, files: 0 }\n );\n}\n\nfunction countTotalMessages(totals: SummaryTotals): number {\n return totals.events + totals.commands;\n}\n\nfunction logSummary(logger: Logger, totals: SummaryTotals): void {\n logger.info(\"\\n--- Summary ---\");\n logger.info(`Total events: ${totals.events}`);\n logger.info(`Total commands: ${totals.commands}`);\n logger.info(`Total files copied: ${totals.files}`);\n}\n\nexport async function run(args: string[]): Promise<void> {\n const options = parseArgs(args);\n const configPath = resolve(options.config);\n const configDir = dirname(configPath);\n const outputDir = resolve(configDir, options.outputDir);\n const logger = new ConsoleLogger({ level: \"info\" });\n\n logger.info(`Loading config from: ${configPath}`);\n\n const configLoader = new ConfigLoader();\n const config = await configLoader.load(configPath);\n\n logger.info(`Found ${config.contexts.length} context(s) to process`);\n logger.info(`Output directory: ${outputDir}`);\n if (options.messageTypes) {\n logger.info(`Message types filter: ${options.messageTypes.join(\", \")}`);\n }\n\n const pathAliasRewrites = config.pathAliasRewrites\n ? new Map(Object.entries(config.pathAliasRewrites))\n : undefined;\n\n const results: ContextProcessingResult[] = [];\n\n for (const contextConfig of config.contexts) {\n const pipeline = ContractsPipeline.create({\n contextConfig,\n messageTypes: options.messageTypes,\n logger,\n });\n\n const result = await pipeline.execute({\n contextName: contextConfig.name,\n sourceDir: contextConfig.sourceDir,\n outputDir,\n pathAliasRewrites,\n removeDecorators: config.removeDecorators,\n });\n\n results.push({ name: contextConfig.name, result, outputDir });\n }\n\n const totals = calculateSummaryTotals(results);\n logSummary(logger, totals);\n\n if (options.generateMessageRegistry) {\n await generateRegistry(outputDir, results, totals, logger);\n }\n\n if (config.pathAliasRewrites) {\n await generateReexports(config, outputDir, results, logger);\n }\n}\n\n/**\n * Converts plugin config to internal ContractsConfig format.\n */\nasync function toContractsConfig(pluginConfig: ContractsPluginConfig): Promise<ContractsConfig> {\n const contexts = await Promise.all(\n pluginConfig.contexts.map((ctx) =>\n ContextConfig.create(\n {\n name: ctx.name,\n path: ctx.path,\n sourceDir: ctx.sourceDir,\n tsconfigPath: ctx.tsconfigPath,\n },\n process.cwd(),\n nodeFileSystem\n )\n )\n );\n\n return {\n contexts,\n pathAliasRewrites: pluginConfig.pathAliasRewrites,\n externalDependencies: pluginConfig.externalDependencies,\n decoratorNames: mergeDecoratorNames(pluginConfig.decoratorNames),\n responseNamingConventions: pluginConfig.responseNamingConventions,\n removeDecorators: pluginConfig.removeDecorators ?? true,\n };\n}\n\n/**\n * Run contracts generator with config provided directly.\n * This is used by the hexai CLI integration where config comes from hexai.config.ts.\n *\n * @param options - CLI options (outputDir, messageTypes, generateMessageRegistry)\n * @param pluginConfig - Plugin configuration from hexai.config.ts\n */\nexport async function runWithConfig(\n options: RunWithConfigOptions,\n pluginConfig: ContractsPluginConfig\n): Promise<void> {\n const outputDir = resolve(options.outputDir);\n const logger = new ConsoleLogger({ level: \"info\" });\n const config = await toContractsConfig(pluginConfig);\n\n logger.info(`Found ${config.contexts.length} context(s) to process`);\n logger.info(`Output directory: ${outputDir}`);\n if (options.messageTypes) {\n logger.info(`Message types filter: ${options.messageTypes.join(\", \")}`);\n }\n\n const pathAliasRewrites = config.pathAliasRewrites\n ? new Map(Object.entries(config.pathAliasRewrites))\n : undefined;\n\n const results: ContextProcessingResult[] = [];\n\n for (const contextConfig of config.contexts) {\n const pipeline = ContractsPipeline.create({\n contextConfig,\n messageTypes: options.messageTypes,\n logger,\n });\n\n const result = await pipeline.execute({\n contextName: contextConfig.name,\n sourceDir: contextConfig.sourceDir,\n outputDir,\n pathAliasRewrites,\n removeDecorators: config.removeDecorators,\n });\n\n results.push({ name: contextConfig.name, result, outputDir });\n }\n\n const totals = calculateSummaryTotals(results);\n logSummary(logger, totals);\n\n if (options.generateMessageRegistry) {\n await generateRegistry(outputDir, results, totals, logger);\n }\n\n if (config.pathAliasRewrites) {\n await generateReexports(config, outputDir, results, logger);\n }\n}\n\nasync function generateRegistry(\n outputDir: string,\n results: ContextProcessingResult[],\n totals: SummaryTotals,\n logger: Logger\n): Promise<void> {\n const contextMessages: ContextMessages[] = results.map((contextResult) => {\n const contextOutputDir = join(contextResult.outputDir, contextResult.name);\n const importPath = \"./\" + relative(outputDir, contextOutputDir).replace(/\\\\/g, \"/\");\n\n return {\n contextName: contextResult.name,\n events: contextResult.result.events,\n commands: contextResult.result.commands,\n queries: contextResult.result.queries,\n importPath,\n };\n });\n\n const generator = new RegistryGenerator({ useNamespace: true });\n const registryContent = generator.generate(contextMessages);\n\n await nodeFileSystem.mkdir(outputDir, { recursive: true });\n const indexPath = join(outputDir, \"index.ts\");\n await nodeFileSystem.writeFile(indexPath, registryContent);\n\n logger.info(` Generated index.ts with ${countTotalMessages(totals)} message(s)`);\n}\n\nasync function generateReexports(\n config: ContractsConfig,\n outputDir: string,\n results: ContextProcessingResult[],\n logger: Logger\n): Promise<void> {\n logger.info(\"\\n--- Generating re-exports for pathAliasRewrites ---\");\n\n const pathAliasRewrites = new Map(Object.entries(config.pathAliasRewrites!));\n const allCopiedFiles = results.flatMap((contextResult) => contextResult.result.copiedFiles);\n\n const generator = new ReexportGenerator({ fileSystem: nodeFileSystem });\n\n const reexportFiles = await generator.analyze({\n files: allCopiedFiles,\n pathAliasRewrites,\n });\n\n if (reexportFiles.length === 0) {\n logger.info(\" No re-export files needed\");\n return;\n }\n\n const generatedFiles = await generator.generate({\n outputDir,\n reexportFiles,\n });\n\n logger.info(` Generated ${generatedFiles.length} re-export file(s):`);\n for (const file of generatedFiles) {\n logger.info(` - ${relative(outputDir, file)}`);\n }\n}\n\nasync function main(): Promise<void> {\n try {\n await run(process.argv.slice(2));\n } catch (error) {\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n } else {\n console.error(\"Unknown error occurred\");\n }\n process.exit(EXIT_CODE_ERROR);\n }\n}\n\nif (process.argv[1] === fileURLToPath(import.meta.url)) {\n main();\n}\n","import type { HexaiCliPlugin, CliOption } from \"@hexaijs/cli\";\nimport {\n runWithConfig,\n ContractsPluginConfig,\n RunWithConfigOptions,\n} from \"./cli\";\nimport type { MessageType } from \"./domain/types\";\n\nconst VALID_MESSAGE_TYPES: MessageType[] = [\"event\", \"command\", \"query\"];\n\n/**\n * Parses comma-separated message types string into MessageType array.\n */\nfunction parseMessageTypes(value: string): MessageType[] {\n const types = value.split(\",\").map((type) => type.trim().toLowerCase());\n const invalidTypes = types.filter(\n (type) => !VALID_MESSAGE_TYPES.includes(type as MessageType)\n );\n\n if (invalidTypes.length > 0) {\n throw new Error(\n `Invalid message type(s): ${invalidTypes.join(\", \")}. ` +\n `Valid types are: ${VALID_MESSAGE_TYPES.join(\", \")}`\n );\n }\n\n return types as MessageType[];\n}\n\n/**\n * CLI plugin definition for hexai integration.\n *\n * This allows the contracts generator to be invoked via `pnpm hexai generate-contracts`.\n * Configuration is provided via hexai.config.ts.\n *\n * @example\n * ```bash\n * pnpm hexai generate-contracts -o packages/contracts/src\n * pnpm hexai generate-contracts -o packages/contracts/src -m event,command\n * ```\n */\nexport const cliPlugin: HexaiCliPlugin<ContractsPluginConfig> = {\n name: \"generate-contracts\",\n description:\n \"Extract domain events, commands, and queries from bounded contexts\",\n options: [\n {\n flags: \"-o, --output-dir <path>\",\n description: \"Output directory for generated contracts\",\n required: true,\n },\n {\n flags: \"-m, --message-types <types>\",\n description:\n \"Filter message types (comma-separated: event,command,query)\",\n },\n {\n flags: \"--generate-message-registry\",\n description: \"Generate message registry index.ts file\",\n },\n ] satisfies CliOption[],\n run: async (\n args: Record<string, unknown>,\n config: ContractsPluginConfig\n ): Promise<void> => {\n const options: RunWithConfigOptions = {\n outputDir: String(args.outputDir),\n messageTypes: args.messageTypes\n ? parseMessageTypes(String(args.messageTypes))\n : undefined,\n generateMessageRegistry: args.generateMessageRegistry === true,\n };\n\n await runWithConfig(options, config);\n },\n};\n","/**\n * Contracts Generator\n *\n * Extract Domain Events and Commands from TypeScript source code using decorators.\n *\n * @example\n * ```typescript\n * import { extract } from '@hexaijs/plugin-contracts-generator';\n *\n * const result = await extract({\n * sourceDir: 'packages',\n * outputDir: 'packages/contracts',\n * });\n *\n * console.log(`Extracted ${result.events.length} events and ${result.commands.length} commands`);\n * ```\n */\n\nexport type {\n SourceFile,\n TypeRef,\n PrimitiveType,\n ArrayType,\n ObjectType,\n UnionType,\n IntersectionType,\n ReferenceType,\n LiteralType,\n TupleType,\n FunctionType,\n FunctionParameter,\n Field,\n TypeDefinition,\n TypeDefinitionKind,\n EnumMember,\n EnumDefinition,\n ClassDefinition,\n ClassImport,\n Message,\n MessageBase,\n DomainEvent,\n Command,\n Dependency,\n DependencyKind,\n ImportSource,\n ExtractionResult,\n ExtractionError,\n ExtractionWarning,\n Config,\n} from \"./domain/types\";\n\nexport {\n isPrimitiveType,\n isArrayType,\n isObjectType,\n isUnionType,\n isIntersectionType,\n isReferenceType,\n isLiteralType,\n isTupleType,\n isFunctionType,\n isDomainEvent,\n isCommand,\n} from \"./domain/types\";\n\nexport {\n PublicEvent,\n PublicCommand,\n PublicQuery,\n type PublicEventOptions,\n type PublicCommandOptions,\n type PublicQueryOptions,\n} from \"./decorators\";\n\nexport { Scanner, type ScannerOptions } from \"./scanner\";\nexport { Parser, type ParseResult } from \"./parser\";\nexport { FileGraphResolver } from \"./file-graph-resolver\";\nexport { FileCopier } from \"./file-copier\";\nexport { ConfigLoader, type ContractsConfig } from \"./config-loader\";\n\nexport {\n MessageParserError,\n ConfigurationError,\n ConfigLoadError,\n FileSystemError,\n FileNotFoundError,\n FileReadError,\n FileWriteError,\n ParseError,\n JsonParseError,\n ResolutionError,\n ModuleResolutionError,\n} from \"./errors\";\n\nexport {\n RegistryGenerator,\n type RegistryGeneratorOptions,\n type ContextMessages,\n} from \"./registry-generator\";\n\nexport {\n ReexportGenerator,\n type ReexportGeneratorOptions,\n type AnalyzeOptions,\n type GenerateOptions,\n type RewrittenImport,\n type ReexportFile,\n} from \"./reexport-generator\";\n\nimport { type FileSystem, nodeFileSystem } from \"./file-system\";\nimport { type Logger, noopLogger } from \"./logger\";\nimport { ContractsPipeline } from \"./pipeline\";\n\nexport type { FileSystem, FileStats } from \"./file-system\";\nexport { nodeFileSystem } from \"./file-system\";\n\nexport type { Logger, LogLevel, ConsoleLoggerOptions } from \"./logger\";\nexport { ConsoleLogger, noopLogger } from \"./logger\";\n\nexport {\n ContractsPipeline,\n type PipelineDependencies,\n type PipelineOptions,\n type PipelineResult,\n type ParsedMessages,\n} from \"./pipeline\";\n\nexport { ContextConfig, type InputContextConfig } from \"./context-config\";\n\nimport { ContextConfig } from \"./context-config\";\nimport type { ResponseNamingConvention, MessageType } from \"./domain/types\";\n\nexport interface ProcessContextOptions {\n contextName: string;\n path: string;\n sourceDir?: string;\n outputDir: string;\n pathAliasRewrites?: Map<string, string>;\n tsconfigPath?: string;\n responseNamingConventions?: readonly ResponseNamingConvention[];\n removeDecorators?: boolean;\n messageTypes?: MessageType[];\n fileSystem?: FileSystem;\n logger?: Logger;\n}\n\nexport interface ProcessContextResult {\n events: readonly import(\"./domain/types\").DomainEvent[];\n commands: readonly import(\"./domain/types\").Command[];\n queries: readonly import(\"./domain/types\").Query[];\n copiedFiles: string[];\n}\n\nexport async function processContext(\n options: ProcessContextOptions\n): Promise<ProcessContextResult> {\n const {\n contextName,\n path: contextPath,\n sourceDir,\n outputDir,\n pathAliasRewrites,\n tsconfigPath,\n responseNamingConventions,\n removeDecorators,\n messageTypes,\n fileSystem = nodeFileSystem,\n logger = noopLogger,\n } = options;\n\n const contextConfig = await ContextConfig.create(\n {\n name: contextName,\n path: contextPath,\n sourceDir,\n tsconfigPath,\n responseNamingConventions,\n },\n process.cwd(),\n fileSystem\n );\n\n return ContractsPipeline.create({\n contextConfig,\n responseNamingConventions,\n messageTypes,\n fileSystem,\n logger,\n }).execute({\n contextName,\n sourceDir: contextConfig.sourceDir,\n outputDir,\n pathAliasRewrites,\n removeDecorators,\n });\n}\n\n// Hexai CLI plugin integration\nexport { cliPlugin } from \"./hexai-plugin\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/domain/types.ts","../src/errors.ts","../src/file-system.ts","../src/scanner.ts","../src/ast-utils.ts","../src/class-analyzer.ts","../src/import-analyzer.ts","../src/parser.ts","../src/file-graph-resolver.ts","../src/file-copier.ts","../src/context-config.ts","../src/config-loader.ts","../src/registry-generator.ts","../src/reexport-generator.ts","../src/logger.ts","../src/pipeline.ts","../src/cli.ts","../src/hexai-plugin.ts","../src/index.ts"],"names":["path","ts","ts2","ts3","path2","TYPESCRIPT_EXTENSIONS","INDEX_FILE","relative","dirname","exports","path4","ts9","join","resolve","VALID_MESSAGE_TYPES","parseMessageTypes"],"mappings":";;;;;;;;;;;;AAyMO,IAAM,uBAAA,GAAoD;AAAA,EAC/D,KAAA,EAAO,aAAA;AAAA,EACP,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAA;AAGO,SAAS,oBAAoB,OAAA,EAAoD;AACtF,EAAA,OAAO;AAAA,IACL,GAAG,uBAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF;AAiBO,SAAS,gBAAgB,IAAA,EAAsC;AACpE,EAAA,OAAO,KAAK,IAAA,KAAS,WAAA;AACvB;AAEO,SAAS,YAAY,IAAA,EAAkC;AAC5D,EAAA,OAAO,KAAK,IAAA,KAAS,OAAA;AACvB;AAEO,SAAS,aAAa,IAAA,EAAmC;AAC9D,EAAA,OAAO,KAAK,IAAA,KAAS,QAAA;AACvB;AAEO,SAAS,YAAY,IAAA,EAAkC;AAC5D,EAAA,OAAO,KAAK,IAAA,KAAS,OAAA;AACvB;AAEO,SAAS,mBAAmB,IAAA,EAAyC;AAC1E,EAAA,OAAO,KAAK,IAAA,KAAS,cAAA;AACvB;AAEO,SAAS,gBAAgB,IAAA,EAAsC;AACpE,EAAA,OAAO,KAAK,IAAA,KAAS,WAAA;AACvB;AAEO,SAAS,cAAc,IAAA,EAAoC;AAChE,EAAA,OAAO,KAAK,IAAA,KAAS,SAAA;AACvB;AAEO,SAAS,YA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AAA;AAAA,IACN,SAAA;AAAA,IACA,SAAA;AAAA,IACA,iBAAA;AAAA,IACA,YAAA;AAAA,IACA,yBAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA,GAAa,cAAA;AAAA,IACb,MAAA,GAAS;AAAA,GACb,GAAI,OAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,MAAM,aAAA,CAAc,MAAA;AAAA,IACtC;AAAA,MACI,IAAA,EAAM,WAAA;AAAA,MACN,IAAA,EAAM,WAAA;AAAA,MACN,SAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACJ;AAAA,IACA,QAAQ,GAAA,EAAI;AAAA,IACZ;AAAA,GACJ;AAEA,EAAA,OAAO,kBAAkB,MAAA,CAAO;AAAA,IAC5B,aAAA;AAAA,IACA,yBAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACH,EAAE,OAAA,CAAQ;AAAA,IACP,WAAA;AAAA,IACA,WAAW,aAAA,CAAc,SAAA;AAAA,IACzB,SAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACH,CAAA;AACL","file":"index.js","sourcesContent":["export interface SourceFile {\n readonly absolutePath: string;\n readonly relativePath: string;\n readonly packageName?: string;\n}\n\nexport type TypeRef =\n | PrimitiveType\n | ArrayType\n | ObjectType\n | UnionType\n | IntersectionType\n | ReferenceType\n | LiteralType\n | TupleType\n | FunctionType;\n\nexport interface PrimitiveType {\n readonly kind: 'primitive';\n readonly name:\n | 'string'\n | 'number'\n | 'boolean'\n | 'null'\n | 'undefined'\n | 'void'\n | 'any'\n | 'unknown'\n | 'never'\n | 'bigint'\n | 'symbol';\n}\n\nexport interface ArrayType {\n readonly kind: 'array';\n readonly elementType: TypeRef;\n}\n\nexport interface ObjectType {\n readonly kind: 'object';\n readonly fields: readonly Field[];\n}\n\nexport interface UnionType {\n readonly kind: 'union';\n readonly types: readonly TypeRef[];\n}\n\nexport interface IntersectionType {\n readonly kind: 'intersection';\n readonly types: readonly TypeRef[];\n}\n\nexport interface ReferenceType {\n readonly kind: 'reference';\n readonly name: string;\n readonly typeArguments?: readonly TypeRef[];\n}\n\nexport interface LiteralType {\n readonly kind: 'literal';\n readonly value: string | number | boolean;\n}\n\nexport interface TupleType {\n readonly kind: 'tuple';\n readonly elements: readonly TypeRef[];\n}\n\nexport interface FunctionType {\n readonly kind: 'function';\n readonly parameters: readonly FunctionParameter[];\n readonly returnType: TypeRef;\n}\n\nexport interface FunctionParameter {\n readonly name: string;\n readonly type: TypeRef;\n readonly optional: boolean;\n}\n\nexport interface Field {\n readonly name: string;\n readonly type: TypeRef;\n readonly optional: boolean;\n readonly readonly: boolean;\n}\n\nexport type TypeDefinitionKind = 'interface' | 'type' | 'enum' | 'class';\n\nexport interface TypeDefinition {\n readonly name: string;\n readonly kind: TypeDefinitionKind;\n readonly sourceFile: SourceFile;\n readonly body: TypeRef;\n readonly typeParameters?: readonly string[];\n readonly exported: boolean;\n}\n\nexport interface EnumMember {\n readonly name: string;\n readonly value?: string | number;\n}\n\nexport interface EnumDefinition extends Omit<TypeDefinition, 'kind' | 'body'> {\n readonly kind: 'enum';\n readonly members: readonly EnumMember[];\n}\n\nexport interface ClassImport {\n readonly names: readonly string[];\n readonly source: string;\n readonly isTypeOnly: boolean;\n readonly isExternal: boolean;\n}\n\nexport interface ClassDefinition {\n readonly name: string;\n readonly kind: 'class';\n readonly sourceFile: SourceFile;\n readonly sourceText: string;\n readonly imports: readonly ClassImport[];\n readonly dependencies: readonly string[];\n readonly baseClass?: string;\n readonly exported: boolean;\n}\n\nexport interface MessageBase {\n readonly name: string;\n readonly sourceFile: SourceFile;\n readonly fields: readonly Field[];\n readonly baseClass?: string;\n readonly sourceText: string;\n readonly imports: readonly ClassImport[];\n}\n\nexport interface DomainEvent extends MessageBase {\n readonly messageType: 'event';\n readonly version?: number;\n readonly context?: string;\n readonly payloadType?: TypeRef;\n}\n\nexport interface Command extends MessageBase {\n readonly messageType: 'command';\n readonly resultType?: TypeRef;\n readonly context?: string;\n readonly payloadType?: TypeRef;\n}\n\nexport interface Query extends MessageBase {\n readonly messageType: 'query';\n readonly resultType?: TypeRef;\n readonly context?: string;\n readonly payloadType?: TypeRef;\n}\n\nexport type Message = DomainEvent | Command | Query;\n\n/** Used to filter which decorators the scanner should look for. */\nexport type MessageType = Message['messageType'];\n\nexport type ImportSource =\n | { readonly type: 'local'; readonly path: string }\n | { readonly type: 'external'; readonly package: string };\n\nexport type DependencyKind = 'type' | 'value' | 'class';\n\nexport interface Dependency {\n readonly name: string;\n readonly source: ImportSource;\n readonly kind: DependencyKind;\n readonly definition?: TypeDefinition;\n}\n\nexport interface SourceLocation {\n readonly file: string;\n readonly message: string;\n readonly line?: number;\n readonly column?: number;\n}\n\nexport type ExtractionError = SourceLocation;\nexport type ExtractionWarning = SourceLocation;\n\nexport interface ExtractionResult {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly types: readonly TypeDefinition[];\n readonly dependencies: readonly Dependency[];\n readonly errors: readonly ExtractionError[];\n readonly warnings: readonly ExtractionWarning[];\n}\n\n/** Customizes decorator names used to identify public messages. Unspecified names use defaults. */\nexport interface DecoratorNames {\n event?: string;\n command?: string;\n query?: string;\n}\n\nexport const DEFAULT_DECORATOR_NAMES: Required<DecoratorNames> = {\n event: \"PublicEvent\",\n command: \"PublicCommand\",\n query: \"PublicQuery\",\n};\n\n/** Merges partial decorator names with defaults for backward compatibility. */\nexport function mergeDecoratorNames(partial?: DecoratorNames): Required<DecoratorNames> {\n return {\n ...DEFAULT_DECORATOR_NAMES,\n ...partial,\n };\n}\n\nexport interface ResponseNamingConvention {\n readonly messageSuffix: string;\n readonly responseSuffix: string;\n}\n\nexport interface Config {\n readonly sourceDir: string;\n readonly outputDir: string;\n readonly include?: readonly string[];\n readonly exclude?: readonly string[];\n readonly externalPackages?: Readonly<Record<string, string>>;\n readonly decoratorNames?: DecoratorNames;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n}\n\nexport function isPrimitiveType(type: TypeRef): type is PrimitiveType {\n return type.kind === 'primitive';\n}\n\nexport function isArrayType(type: TypeRef): type is ArrayType {\n return type.kind === 'array';\n}\n\nexport function isObjectType(type: TypeRef): type is ObjectType {\n return type.kind === 'object';\n}\n\nexport function isUnionType(type: TypeRef): type is UnionType {\n return type.kind === 'union';\n}\n\nexport function isIntersectionType(type: TypeRef): type is IntersectionType {\n return type.kind === 'intersection';\n}\n\nexport function isReferenceType(type: TypeRef): type is ReferenceType {\n return type.kind === 'reference';\n}\n\nexport function isLiteralType(type: TypeRef): type is LiteralType {\n return type.kind === 'literal';\n}\n\nexport function isTupleType(type: TypeRef): type is TupleType {\n return type.kind === 'tuple';\n}\n\nexport function isFunctionType(type: TypeRef): type is FunctionType {\n return type.kind === 'function';\n}\n\nexport function isDomainEvent(message: Message): message is DomainEvent {\n return message.messageType === 'event';\n}\n\nexport function isCommand(message: Message): message is Command {\n return message.messageType === 'command';\n}\n\nexport function isQuery(message: Message): message is Query {\n return message.messageType === 'query';\n}\n","/**\n * Base error class for all contracts-generator errors.\n * Allows catching all library errors with `instanceof MessageParserError`.\n */\nexport class MessageParserError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"MessageParserError\";\n }\n}\n\n/**\n * Base class for configuration-related errors.\n */\nexport class ConfigurationError extends MessageParserError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ConfigurationError\";\n }\n}\n\n/**\n * Error thrown when loading application.config.ts fails.\n */\nexport class ConfigLoadError extends ConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ConfigLoadError\";\n }\n}\n\n/**\n * Base class for file system operation errors.\n */\nexport class FileSystemError extends MessageParserError {\n readonly path: string;\n\n constructor(message: string, path: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"FileSystemError\";\n this.path = path;\n }\n}\n\n/**\n * Error thrown when a required file is not found.\n */\nexport class FileNotFoundError extends FileSystemError {\n constructor(path: string, options?: ErrorOptions) {\n super(`File not found: ${path}`, path, options);\n this.name = \"FileNotFoundError\";\n }\n}\n\n/**\n * Error thrown when reading a file fails.\n */\nexport class FileReadError extends FileSystemError {\n constructor(path: string, options?: ErrorOptions) {\n super(`Failed to read file: ${path}`, path, options);\n this.name = \"FileReadError\";\n }\n}\n\n/**\n * Error thrown when writing a file fails.\n */\nexport class FileWriteError extends FileSystemError {\n constructor(path: string, options?: ErrorOptions) {\n super(`Failed to write file: ${path}`, path, options);\n this.name = \"FileWriteError\";\n }\n}\n\n/**\n * Base class for parsing errors.\n */\nexport class ParseError extends MessageParserError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ParseError\";\n }\n}\n\n/**\n * Error thrown when JSON parsing fails.\n */\nexport class JsonParseError extends ParseError {\n readonly filePath?: string;\n\n constructor(message: string, filePath?: string, options?: ErrorOptions) {\n const fullMessage = filePath\n ? `Failed to parse JSON in ${filePath}: ${message}`\n : `Failed to parse JSON: ${message}`;\n super(fullMessage, options);\n this.name = \"JsonParseError\";\n this.filePath = filePath;\n }\n}\n\n/**\n * Base class for module/path resolution errors.\n */\nexport class ResolutionError extends MessageParserError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ResolutionError\";\n }\n}\n\n/**\n * Error thrown when module resolution fails.\n */\nexport class ModuleResolutionError extends ResolutionError {\n readonly moduleSpecifier: string;\n readonly fromFile: string;\n\n constructor(moduleSpecifier: string, fromFile: string, options?: ErrorOptions) {\n super(\n `Failed to resolve module '${moduleSpecifier}' from '${fromFile}'`,\n options\n );\n this.name = \"ModuleResolutionError\";\n this.moduleSpecifier = moduleSpecifier;\n this.fromFile = fromFile;\n }\n}\n","import { readFile, writeFile, mkdir, readdir, stat, access } from \"fs/promises\";\nimport { constants } from \"fs\";\n\nexport interface FileStats {\n isDirectory(): boolean;\n isFile(): boolean;\n}\n\nexport interface FileSystem {\n readFile(path: string): Promise<string>;\n readdir(path: string): Promise<string[]>;\n writeFile(path: string, content: string): Promise<void>;\n mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;\n exists(path: string): Promise<boolean>;\n stat(path: string): Promise<FileStats>;\n}\n\nexport class NodeFileSystem implements FileSystem {\n async readFile(path: string): Promise<string> {\n return readFile(path, \"utf-8\");\n }\n\n async readdir(path: string): Promise<string[]> {\n return readdir(path);\n }\n\n async writeFile(path: string, content: string): Promise<void> {\n await writeFile(path, content);\n }\n\n async mkdir(path: string, options?: { recursive?: boolean }): Promise<void> {\n await mkdir(path, options);\n }\n\n async exists(path: string): Promise<boolean> {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n async stat(path: string): Promise<FileStats> {\n return stat(path);\n }\n}\n\nexport const nodeFileSystem = new NodeFileSystem();\n","import { glob } from \"glob\";\n\nimport { FileReadError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\nimport type { DecoratorNames, MessageType } from \"./domain\";\nimport { mergeDecoratorNames } from \"./domain\";\n\nconst DEFAULT_EXCLUDE_PATTERNS = [\n \"**/node_modules/**\",\n \"**/dist/**\",\n \"**/*.d.ts\",\n \"**/*.test.ts\",\n \"**/*.spec.ts\",\n];\n\nexport interface ScannerOptions {\n exclude?: string[];\n fileSystem?: FileSystem;\n decoratorNames?: DecoratorNames;\n /**\n * Filter which message types to scan for.\n * Defaults to all types: ['event', 'command', 'query']\n */\n messageTypes?: MessageType[];\n}\n\nexport class Scanner {\n private readonly exclude: string[];\n private readonly fs: FileSystem;\n private readonly decoratorPatterns: string[];\n\n constructor(options: ScannerOptions = {}) {\n this.exclude = options.exclude ?? DEFAULT_EXCLUDE_PATTERNS;\n this.fs = options.fileSystem ?? nodeFileSystem;\n\n const names = mergeDecoratorNames(options.decoratorNames);\n const messageTypes = options.messageTypes ?? ['event', 'command', 'query'];\n\n this.decoratorPatterns = messageTypes.map((type) => {\n const decoratorName = names[type];\n return `@${decoratorName}(`;\n });\n }\n\n async scan(sourceDir: string): Promise<string[]> {\n const files = await glob(`${sourceDir}/**/*.ts`, {\n ignore: this.exclude,\n });\n const result: string[] = [];\n\n for (const file of files) {\n let content: string;\n try {\n content = await this.fs.readFile(file);\n } catch (error) {\n throw new FileReadError(file, { cause: error });\n }\n\n if (this.containsPublicDecorator(content)) {\n result.push(file);\n }\n }\n\n return result;\n }\n\n private containsPublicDecorator(content: string): boolean {\n return this.decoratorPatterns.some(pattern => content.includes(pattern));\n }\n}\n","import * as ts from \"typescript\";\n\nimport type {\n TypeRef,\n PrimitiveType,\n ReferenceType,\n ArrayType,\n ObjectType,\n UnionType,\n IntersectionType,\n Field,\n} from \"./domain\";\n\nconst PRIMITIVE_TYPE_NAMES = new Set([\n \"string\",\n \"number\",\n \"boolean\",\n \"void\",\n \"null\",\n \"undefined\",\n \"any\",\n \"unknown\",\n \"never\",\n \"bigint\",\n \"symbol\",\n]);\n\nexport function isPrimitiveTypeName(name: string): boolean {\n return PRIMITIVE_TYPE_NAMES.has(name);\n}\n\nexport function parseTypeNode(typeNode: ts.TypeNode): TypeRef {\n if (typeNode.kind === ts.SyntaxKind.StringKeyword) {\n return { kind: \"primitive\", name: \"string\" } as PrimitiveType;\n }\n if (typeNode.kind === ts.SyntaxKind.NumberKeyword) {\n return { kind: \"primitive\", name: \"number\" } as PrimitiveType;\n }\n if (typeNode.kind === ts.SyntaxKind.BooleanKeyword) {\n return { kind: \"primitive\", name: \"boolean\" } as PrimitiveType;\n }\n\n if (ts.isArrayTypeNode(typeNode)) {\n const elementType = parseTypeNode(typeNode.elementType);\n return { kind: \"array\", elementType } as ArrayType;\n }\n\n if (ts.isTypeReferenceNode(typeNode)) {\n const name = typeNode.typeName.getText();\n const typeArguments = typeNode.typeArguments\n ? typeNode.typeArguments.map((t) => parseTypeNode(t))\n : undefined;\n return { kind: \"reference\", name, typeArguments } as ReferenceType;\n }\n\n if (ts.isIntersectionTypeNode(typeNode)) {\n const types = typeNode.types.map((t) => parseTypeNode(t));\n return { kind: \"intersection\", types } as IntersectionType;\n }\n\n if (ts.isUnionTypeNode(typeNode)) {\n const types = typeNode.types.map((t) => parseTypeNode(t));\n return { kind: \"union\", types } as UnionType;\n }\n\n if (ts.isTypeLiteralNode(typeNode)) {\n const fields = extractFieldsFromMembers(typeNode.members);\n return { kind: \"object\", fields } as ObjectType;\n }\n\n return { kind: \"reference\", name: typeNode.getText() } as ReferenceType;\n}\n\nexport function extractFieldsFromMembers(\n members: ts.NodeArray<ts.TypeElement>\n): Field[] {\n const fields: Field[] = [];\n for (const member of members) {\n if (ts.isPropertySignature(member) && member.name) {\n const fieldName = member.name.getText();\n const fieldType = member.type\n ? parseTypeNode(member.type)\n : ({ kind: \"primitive\", name: \"any\" } as PrimitiveType);\n const optional = !!member.questionToken;\n const readonly =\n member.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.ReadonlyKeyword\n ) ?? false;\n fields.push({\n name: fieldName,\n type: fieldType,\n optional,\n readonly,\n });\n }\n }\n return fields;\n}\n","import * as ts from \"typescript\";\n\nimport { isPrimitiveTypeName } from \"./ast-utils\";\n\nexport function hasDecorator(\n node: ts.ClassDeclaration,\n decoratorName: string\n): boolean {\n const decorators = ts.getDecorators(node);\n if (!decorators) return false;\n\n return decorators.some((decorator) => {\n if (ts.isCallExpression(decorator.expression)) {\n const expr = decorator.expression.expression;\n if (ts.isIdentifier(expr)) {\n return expr.text === decoratorName;\n }\n }\n return false;\n });\n}\n\nexport interface DecoratorOptions {\n response?: string;\n context?: string;\n}\n\n/**\n * Extracts options from a decorator call expression.\n * For example, @PublicCommand({ response: 'CreateUserResult' }) returns { response: 'CreateUserResult' }\n */\nexport function getDecoratorOptions(\n node: ts.ClassDeclaration,\n decoratorName: string\n): DecoratorOptions | undefined {\n const decorators = ts.getDecorators(node);\n if (!decorators) return undefined;\n\n for (const decorator of decorators) {\n if (!ts.isCallExpression(decorator.expression)) continue;\n\n const expr = decorator.expression.expression;\n if (!ts.isIdentifier(expr) || expr.text !== decoratorName) continue;\n\n // Found the decorator, now extract options from the first argument\n const args = decorator.expression.arguments;\n if (args.length === 0) return {};\n\n const firstArg = args[0];\n if (!ts.isObjectLiteralExpression(firstArg)) return {};\n\n const options: DecoratorOptions = {};\n\n for (const prop of firstArg.properties) {\n if (!ts.isPropertyAssignment(prop)) continue;\n if (!ts.isIdentifier(prop.name)) continue;\n\n const propName = prop.name.text;\n if (propName === \"response\" && ts.isStringLiteral(prop.initializer)) {\n options.response = prop.initializer.text;\n } else if (propName === \"context\" && ts.isStringLiteral(prop.initializer)) {\n options.context = prop.initializer.text;\n }\n }\n\n return options;\n }\n\n return undefined;\n}\n\nexport function hasExportModifier(node: ts.Node): boolean {\n const modifiers = ts.canHaveModifiers(node)\n ? ts.getModifiers(node)\n : undefined;\n return (\n modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) ?? false\n );\n}\n\nexport function extractClassSourceText(\n node: ts.ClassDeclaration,\n sourceCode: string\n): string {\n const fullStart = node.getFullStart();\n const end = node.getEnd();\n let sourceText = sourceCode.slice(fullStart, end);\n sourceText = sourceText.replace(/^\\s*\\n/, \"\");\n return sourceText;\n}\n\nexport function getBaseClassName(node: ts.ClassDeclaration): string | undefined {\n if (!node.heritageClauses) return undefined;\n\n for (const clause of node.heritageClauses) {\n if (clause.token === ts.SyntaxKind.ExtendsKeyword) {\n const firstType = clause.types[0];\n if (firstType && ts.isExpressionWithTypeArguments(firstType)) {\n const expr = firstType.expression;\n if (ts.isIdentifier(expr)) {\n return expr.text;\n }\n }\n }\n }\n return undefined;\n}\n\nexport function collectClassReferences(node: ts.ClassDeclaration): Set<string> {\n const references = new Set<string>();\n\n const baseClass = getBaseClassName(node);\n if (baseClass) {\n references.add(baseClass);\n }\n\n const visitNode = (child: ts.Node): void => {\n if (ts.isTypeReferenceNode(child)) {\n const name = child.typeName.getText();\n if (!isPrimitiveTypeName(name)) {\n references.add(name);\n }\n } else if (ts.isIdentifier(child)) {\n const parent = child.parent;\n if (\n parent &&\n (ts.isTypeReferenceNode(parent) ||\n ts.isExpressionWithTypeArguments(parent))\n ) {\n const name = child.text;\n if (!isPrimitiveTypeName(name)) {\n references.add(name);\n }\n }\n }\n ts.forEachChild(child, visitNode);\n };\n\n ts.forEachChild(node, visitNode);\n return references;\n}\n","import * as ts from \"typescript\";\n\nimport type { ClassImport } from \"./domain\";\n\nexport function isExternalModule(moduleSpecifier: string): boolean {\n return !moduleSpecifier.startsWith(\".\");\n}\n\nexport function extractImports(sourceFile: ts.SourceFile): ClassImport[] {\n const imports: ClassImport[] = [];\n\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node) && node.importClause) {\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n const isExternal = isExternalModule(moduleSpecifier);\n const isTypeOnly = node.importClause.isTypeOnly ?? false;\n const importedNames = extractImportedNames(node.importClause);\n\n if (importedNames.length > 0) {\n imports.push({\n names: importedNames,\n source: moduleSpecifier,\n isTypeOnly,\n isExternal,\n });\n }\n }\n });\n\n return imports;\n}\n\nexport function extractImportedNames(importClause: ts.ImportClause): string[] {\n const names: string[] = [];\n\n if (importClause.name) {\n names.push(importClause.name.text);\n }\n\n if (importClause.namedBindings) {\n if (ts.isNamedImports(importClause.namedBindings)) {\n for (const element of importClause.namedBindings.elements) {\n names.push(element.name.text);\n }\n }\n }\n\n return names;\n}\n","import ts from \"typescript\";\n\nimport type {\n ClassImport,\n Command,\n DecoratorNames,\n DomainEvent,\n Field,\n IntersectionType,\n Message,\n MessageType,\n ObjectType,\n Query,\n ResponseNamingConvention,\n SourceFile,\n TypeDefinition,\n TypeDefinitionKind,\n TypeRef,\n} from \"./domain\";\nimport { mergeDecoratorNames } from \"./domain\";\nimport { extractFieldsFromMembers, parseTypeNode } from \"./ast-utils\";\nimport {\n extractClassSourceText,\n getBaseClassName,\n getDecoratorOptions,\n hasDecorator,\n hasExportModifier,\n} from \"./class-analyzer\";\nimport { extractImports } from \"./import-analyzer\";\n\nexport type { MessageType };\n\nconst PAYLOAD_TYPE_ARGUMENT_INDEX = 0;\n\nexport interface ParseResult {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries: readonly Query[];\n readonly typeDefinitions: readonly TypeDefinition[];\n}\n\nexport interface ParserOptions {\n decoratorNames?: DecoratorNames;\n responseNamingConventions?: readonly ResponseNamingConvention[];\n messageTypes?: readonly MessageType[];\n}\n\ninterface ExtractedPayload {\n fields: Field[];\n payloadType?: TypeRef;\n}\n\ninterface ExtractedMessage extends ExtractedPayload {\n sourceText: string;\n imports: ClassImport[];\n baseClass?: string;\n}\n\ninterface DecoratorMapping {\n decorator: string;\n messageType: MessageType;\n}\n\nfunction buildDecoratorMappings(decoratorNames: Required<DecoratorNames>): DecoratorMapping[] {\n return [\n { decorator: decoratorNames.event, messageType: \"event\" },\n { decorator: decoratorNames.command, messageType: \"command\" },\n { decorator: decoratorNames.query, messageType: \"query\" },\n ];\n}\n\n\nfunction extractTypeParameterNames(\n typeParameters: ts.NodeArray<ts.TypeParameterDeclaration> | undefined\n): string[] | undefined {\n if (!typeParameters) return undefined;\n return typeParameters.map(tp => tp.name.text);\n}\n\nexport class Parser {\n private readonly decoratorMappings: DecoratorMapping[];\n private readonly responseNamingConventions: readonly ResponseNamingConvention[];\n private readonly messageTypes: readonly MessageType[] | undefined;\n\n constructor(options: ParserOptions = {}) {\n const names = mergeDecoratorNames(options.decoratorNames);\n this.decoratorMappings = buildDecoratorMappings(names);\n this.responseNamingConventions = options.responseNamingConventions ?? [];\n this.messageTypes = options.messageTypes;\n }\n\n parse(sourceCode: string, sourceFileInfo: SourceFile): ParseResult {\n const tsSourceFile = ts.createSourceFile(\n sourceFileInfo.absolutePath,\n sourceCode,\n ts.ScriptTarget.Latest,\n true\n );\n\n const events: DomainEvent[] = [];\n const commands: Command[] = [];\n const queries: Query[] = [];\n const typeDefinitions: TypeDefinition[] = [];\n\n const messageCollectors: Record<MessageType, (message: Message) => void> = {\n event: (m) => events.push(m as DomainEvent),\n command: (m) => commands.push(m as Command),\n query: (m) => queries.push(m as Query),\n };\n\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name) {\n this.collectMessagesFromClass(node, sourceCode, tsSourceFile, sourceFileInfo, messageCollectors);\n }\n\n if (ts.isTypeAliasDeclaration(node) && node.name) {\n typeDefinitions.push(this.extractTypeDefinition(node, sourceFileInfo));\n }\n\n if (ts.isInterfaceDeclaration(node) && node.name) {\n typeDefinitions.push(this.extractInterfaceDefinition(node, sourceFileInfo));\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(tsSourceFile);\n\n this.applyNamingConventionMatching(commands, typeDefinitions);\n this.applyNamingConventionMatching(queries, typeDefinitions);\n\n return { events, commands, queries, typeDefinitions };\n }\n\n private collectMessagesFromClass(\n node: ts.ClassDeclaration,\n sourceCode: string,\n tsSourceFile: ts.SourceFile,\n sourceFileInfo: SourceFile,\n collectors: Record<MessageType, (message: Message) => void>\n ): void {\n for (const { decorator, messageType } of this.decoratorMappings) {\n if (!hasDecorator(node, decorator)) continue;\n if (this.messageTypes && !this.messageTypes.includes(messageType)) continue;\n\n const message = this.buildMessage(node, sourceCode, tsSourceFile, sourceFileInfo, messageType, decorator);\n collectors[messageType](message);\n }\n }\n\n private applyNamingConventionMatching(\n messages: (Command | Query)[],\n typeDefinitions: TypeDefinition[]\n ): void {\n for (const message of messages) {\n const hasExplicitResultType = Boolean(message.resultType);\n if (hasExplicitResultType) continue;\n\n const matchedTypeName = this.findMatchingResponseType(message.name, typeDefinitions);\n if (matchedTypeName) {\n (message as { resultType?: TypeRef }).resultType = {\n kind: \"reference\",\n name: matchedTypeName,\n };\n }\n }\n }\n\n private findMatchingResponseType(\n messageName: string,\n typeDefinitions: TypeDefinition[]\n ): string | undefined {\n for (const convention of this.responseNamingConventions) {\n const hasSuffix = messageName.endsWith(convention.messageSuffix);\n if (!hasSuffix) continue;\n\n const messagePrefix = messageName.slice(0, -convention.messageSuffix.length);\n const expectedResponseName = messagePrefix + convention.responseSuffix;\n\n const matchingType = typeDefinitions.find(t => t.name === expectedResponseName);\n if (matchingType) return matchingType.name;\n }\n return undefined;\n }\n\n private buildMessage(\n node: ts.ClassDeclaration,\n sourceCode: string,\n tsSourceFile: ts.SourceFile,\n sourceFileInfo: SourceFile,\n messageType: MessageType,\n decoratorName: string\n ): Message {\n const extracted = this.extractMessageDetails(node, sourceCode, tsSourceFile);\n const decoratorOptions = getDecoratorOptions(node, decoratorName);\n\n const baseMessage = {\n name: node.name!.text,\n messageType,\n sourceFile: sourceFileInfo,\n fields: extracted.fields,\n payloadType: extracted.payloadType,\n sourceText: extracted.sourceText,\n imports: extracted.imports,\n baseClass: extracted.baseClass,\n };\n\n const explicitResponseName = decoratorOptions?.response;\n const supportsResultType = messageType === \"command\" || messageType === \"query\";\n if (!supportsResultType || !explicitResponseName) {\n return baseMessage;\n }\n\n return {\n ...baseMessage,\n resultType: {\n kind: \"reference\" as const,\n name: explicitResponseName,\n },\n };\n }\n\n private extractMessageDetails(\n node: ts.ClassDeclaration,\n sourceCode: string,\n tsSourceFile: ts.SourceFile\n ): ExtractedMessage {\n const { fields, payloadType } = this.extractPayload(node);\n const sourceText = extractClassSourceText(node, sourceCode);\n const imports = extractImports(tsSourceFile);\n const baseClass = getBaseClassName(node);\n\n return {\n fields,\n payloadType,\n sourceText,\n imports,\n baseClass,\n };\n }\n\n private extractPayload(node: ts.ClassDeclaration): ExtractedPayload {\n const emptyPayload: ExtractedPayload = { fields: [] };\n if (!node.heritageClauses) return emptyPayload;\n\n const extendsClause = node.heritageClauses.find(\n clause => clause.token === ts.SyntaxKind.ExtendsKeyword\n );\n if (!extendsClause) return emptyPayload;\n\n for (const type of extendsClause.types) {\n const typeArgs = type.typeArguments;\n if (!typeArgs || typeArgs.length === 0) continue;\n\n const payloadTypeArg = typeArgs[PAYLOAD_TYPE_ARGUMENT_INDEX];\n const extractedPayload = this.parsePayloadTypeArgument(payloadTypeArg);\n if (extractedPayload) return extractedPayload;\n }\n\n return emptyPayload;\n }\n\n private parsePayloadTypeArgument(typeArg: ts.TypeNode): ExtractedPayload | undefined {\n if (ts.isTypeReferenceNode(typeArg) && ts.isIdentifier(typeArg.typeName)) {\n return {\n fields: [],\n payloadType: parseTypeNode(typeArg),\n };\n }\n\n if (ts.isTypeLiteralNode(typeArg)) {\n return {\n fields: extractFieldsFromMembers(typeArg.members),\n };\n }\n\n if (ts.isIntersectionTypeNode(typeArg)) {\n const parsedType = parseTypeNode(typeArg) as IntersectionType;\n return {\n fields: this.flattenIntersectionToFields(parsedType),\n payloadType: parsedType,\n };\n }\n\n return undefined;\n }\n\n private flattenIntersectionToFields(intersection: IntersectionType): Field[] {\n const fields: Field[] = [];\n\n for (const type of intersection.types) {\n if (type.kind === \"object\") {\n fields.push(...(type as ObjectType).fields);\n }\n }\n\n return fields;\n }\n\n private extractTypeDefinition(\n node: ts.TypeAliasDeclaration,\n sourceFileInfo: SourceFile\n ): TypeDefinition {\n return this.buildTypeDefinition(\n node.name.text,\n \"type\",\n sourceFileInfo,\n parseTypeNode(node.type),\n node.typeParameters,\n node\n );\n }\n\n private extractInterfaceDefinition(\n node: ts.InterfaceDeclaration,\n sourceFileInfo: SourceFile\n ): TypeDefinition {\n const body: ObjectType = {\n kind: \"object\",\n fields: extractFieldsFromMembers(node.members),\n };\n\n return this.buildTypeDefinition(\n node.name.text,\n \"interface\",\n sourceFileInfo,\n body,\n node.typeParameters,\n node\n );\n }\n\n private buildTypeDefinition(\n name: string,\n kind: TypeDefinitionKind,\n sourceFile: SourceFile,\n body: TypeRef,\n typeParameters: ts.NodeArray<ts.TypeParameterDeclaration> | undefined,\n node: ts.Node\n ): TypeDefinition {\n return {\n name,\n kind,\n sourceFile,\n body,\n typeParameters: extractTypeParameterNames(typeParameters),\n exported: hasExportModifier(node),\n };\n }\n}\n","import ts from \"typescript\";\nimport path from \"path\";\nimport { minimatch } from \"minimatch\";\n\nimport { extractImportedNames } from \"./import-analyzer\";\nimport { ContextConfig } from \"./context-config\";\nimport { FileReadError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\n\nconst TYPESCRIPT_EXTENSIONS = [\".ts\", \".tsx\"];\nconst INDEX_FILE = \"index.ts\";\n\nexport interface ImportInfo {\n moduleSpecifier: string;\n resolvedPath: string | null;\n isExternal: boolean;\n importedNames: string[];\n}\n\nexport interface FileNode {\n absolutePath: string;\n relativePath: string;\n imports: ImportInfo[];\n isEntryPoint: boolean;\n}\n\nexport interface FileGraph {\n nodes: Map<string, FileNode>;\n entryPoints: Set<string>;\n excludedPaths: Set<string>;\n}\n\nexport interface FileGraphResolverOptions {\n contextConfig: ContextConfig;\n fileSystem?: FileSystem;\n excludeDependencies?: string[];\n}\n\nexport class FileGraphResolver {\n private readonly contextConfig: ContextConfig;\n private readonly fs: FileSystem;\n private readonly excludeDependencies: string[];\n\n private constructor(\n contextConfig: ContextConfig,\n fileSystem: FileSystem,\n excludeDependencies: string[]\n ) {\n this.contextConfig = contextConfig;\n this.fs = fileSystem;\n this.excludeDependencies = excludeDependencies;\n }\n\n static create(options: FileGraphResolverOptions): FileGraphResolver {\n const fs = options.fileSystem ?? nodeFileSystem;\n const excludeDependencies = options.excludeDependencies ?? [];\n return new FileGraphResolver(options.contextConfig, fs, excludeDependencies);\n }\n\n async buildGraph(entryPoints: string[], sourceRoot: string): Promise<FileGraph> {\n const nodes = new Map<string, FileNode>();\n const entryPointSet = new Set<string>(entryPoints);\n const excludedPaths = new Set<string>();\n const visited = new Set<string>();\n const queue = [...entryPoints];\n\n while (queue.length > 0) {\n const filePath = queue.shift()!;\n\n if (visited.has(filePath)) {\n continue;\n }\n visited.add(filePath);\n\n const imports = await this.extractImports(filePath);\n\n const node: FileNode = {\n absolutePath: filePath,\n relativePath: path.relative(sourceRoot, filePath),\n imports,\n isEntryPoint: entryPointSet.has(filePath),\n };\n nodes.set(filePath, node);\n\n this.queueUnvisitedLocalDependencies(imports, visited, queue, excludedPaths);\n }\n\n return {\n nodes,\n entryPoints: entryPointSet,\n excludedPaths,\n };\n }\n\n private async extractImports(filePath: string): Promise<ImportInfo[]> {\n const sourceCode = await this.readSourceFile(filePath);\n const sourceFile = ts.createSourceFile(\n filePath,\n sourceCode,\n ts.ScriptTarget.Latest,\n true\n );\n\n const imports: ImportInfo[] = [];\n\n for (const node of sourceFile.statements) {\n const moduleSpecifier = this.extractModuleSpecifier(node);\n if (!moduleSpecifier) {\n continue;\n }\n\n const resolution = await this.resolveModule(moduleSpecifier, filePath);\n\n const importedNames = this.extractImportedNamesFromNode(node);\n\n imports.push({\n moduleSpecifier,\n resolvedPath: resolution.resolvedPath,\n isExternal: resolution.isExternal,\n importedNames,\n });\n }\n\n return imports;\n }\n\n private async readSourceFile(filePath: string): Promise<string> {\n try {\n return await this.fs.readFile(filePath);\n } catch (error) {\n throw new FileReadError(filePath, { cause: error });\n }\n }\n\n private extractModuleSpecifier(node: ts.Statement): string | null {\n if (ts.isImportDeclaration(node)) {\n return (node.moduleSpecifier as ts.StringLiteral).text;\n }\n if (ts.isExportDeclaration(node) && node.moduleSpecifier) {\n return (node.moduleSpecifier as ts.StringLiteral).text;\n }\n return null;\n }\n\n private extractImportedNamesFromNode(node: ts.Statement): string[] {\n if (ts.isImportDeclaration(node) && node.importClause) {\n return extractImportedNames(node.importClause);\n }\n // Re-exports don't have named imports in the traditional sense\n return [];\n }\n\n private async resolveModule(\n moduleSpecifier: string,\n fromFile: string\n ): Promise<{ resolvedPath: string | null; isExternal: boolean }> {\n if (moduleSpecifier.startsWith(\".\")) {\n const resolvedPath = await this.resolveRelativeModule(\n moduleSpecifier,\n fromFile\n );\n return { resolvedPath, isExternal: false };\n }\n\n return this.contextConfig.resolvePath(moduleSpecifier);\n }\n\n private queueUnvisitedLocalDependencies(\n imports: ImportInfo[],\n visited: Set<string>,\n queue: string[],\n excludedPaths: Set<string>\n ): void {\n const localImports = imports.filter(\n (importInfo) => !importInfo.isExternal && importInfo.resolvedPath !== null\n );\n\n for (const importInfo of localImports) {\n const resolvedPath = importInfo.resolvedPath!;\n\n if (this.shouldExclude(resolvedPath)) {\n excludedPaths.add(resolvedPath);\n continue;\n }\n\n if (!visited.has(resolvedPath)) {\n queue.push(resolvedPath);\n }\n }\n }\n\n private shouldExclude(filePath: string): boolean {\n if (this.excludeDependencies.length === 0) {\n return false;\n }\n return this.excludeDependencies.some((pattern) =>\n minimatch(filePath, pattern, { matchBase: true })\n );\n }\n\n private async resolveRelativeModule(\n moduleSpecifier: string,\n fromFile: string\n ): Promise<string | null> {\n const dir = path.dirname(fromFile);\n const basePath = path.resolve(dir, moduleSpecifier);\n\n return this.tryResolveWithExtensions(basePath);\n }\n\n private async tryResolveWithExtensions(basePath: string): Promise<string | null> {\n const extensionCandidates = TYPESCRIPT_EXTENSIONS.map(ext => basePath + ext);\n const indexCandidate = path.join(basePath, INDEX_FILE);\n const candidates = [...extensionCandidates, indexCandidate];\n\n for (const candidate of candidates) {\n if (await this.fs.exists(candidate)) {\n return candidate;\n }\n }\n\n return null;\n }\n}\n","import * as path from \"path\";\nimport * as ts from \"typescript\";\n\nimport type { FileGraph, FileNode } from \"./file-graph-resolver\";\nimport { FileReadError, FileWriteError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\nimport type { MessageType, DecoratorNames } from \"./domain\";\nimport { DEFAULT_DECORATOR_NAMES } from \"./domain\";\nimport { hasDecorator } from \"./class-analyzer\";\n\nconst CONTRACTS_GENERATOR_MODULE = \"@hexaijs/plugin-contracts-generator\";\nconst CONTRACT_DECORATORS = new Set([\n \"PublicCommand\",\n \"PublicEvent\",\n \"PublicQuery\",\n]);\nconst TS_EXTENSION_PATTERN = /\\.ts$/;\nconst TS_EXTENSION = \".ts\";\nconst REQUEST_SUFFIX = \"Request\";\nconst QUERY_SUFFIX = \"Query\";\n\nexport interface CopyOptions {\n sourceRoot: string;\n outputDir: string;\n fileGraph: FileGraph;\n pathAliasRewrites?: Map<string, string>;\n removeDecorators?: boolean;\n responseTypesToExport?: Map<string, string[]>;\n messageTypes?: readonly MessageType[];\n decoratorNames?: DecoratorNames;\n}\n\nexport interface CopyResult {\n copiedFiles: string[];\n rewrittenImports: Map<string, string[]>;\n}\n\nexport interface FileCopierOptions {\n fileSystem?: FileSystem;\n}\n\ninterface TransformResult<T extends string> {\n content: string;\n changes: T[];\n}\n\ntype VisitorFunction = (node: ts.Node) => ts.Node | undefined;\n\ninterface SymbolExtractionContext {\n sourceFile: ts.SourceFile;\n content: string;\n messageTypes: readonly MessageType[];\n decoratorToMessageType: Record<string, MessageType>;\n}\n\ninterface ExtractedSymbols {\n targetClassNames: Set<string>;\n targetClasses: ts.ClassDeclaration[];\n usedIdentifiers: Set<string>;\n includedLocalTypes: Set<string>;\n localTypeDeclarations: Map<string, ts.Node[]>;\n}\n\ninterface ImportInfo {\n moduleSpecifier: string;\n isTypeOnly: boolean;\n}\n\nexport class FileCopier {\n private readonly fs: FileSystem;\n\n constructor(options: FileCopierOptions = {}) {\n this.fs = options.fileSystem ?? nodeFileSystem;\n }\n\n async copyFiles(options: CopyOptions): Promise<CopyResult> {\n const {\n sourceRoot,\n outputDir,\n fileGraph,\n pathAliasRewrites,\n removeDecorators,\n responseTypesToExport,\n messageTypes,\n decoratorNames,\n } = options;\n const copiedFiles: string[] = [];\n const rewrittenImports = new Map<string, string[]>();\n\n const { entryContents, usedLocalImports } =\n await this.preprocessEntryFiles(\n fileGraph,\n messageTypes,\n decoratorNames,\n sourceRoot\n );\n\n this.expandTransitiveDependencies(usedLocalImports, fileGraph);\n\n for (const node of fileGraph.nodes.values()) {\n const content = await this.resolveNodeContent(\n node,\n entryContents,\n usedLocalImports,\n messageTypes\n );\n\n if (content === null) {\n continue;\n }\n\n const transformedContent = this.applyTransformations(\n content,\n node,\n fileGraph,\n sourceRoot,\n removeDecorators,\n responseTypesToExport,\n pathAliasRewrites\n );\n\n const outputPath = await this.writeOutputFile(\n outputDir,\n node.relativePath,\n transformedContent.content\n );\n copiedFiles.push(outputPath);\n\n if (transformedContent.rewrites.length > 0) {\n rewrittenImports.set(outputPath, transformedContent.rewrites);\n }\n }\n\n return { copiedFiles, rewrittenImports };\n }\n\n private async preprocessEntryFiles(\n fileGraph: FileGraph,\n messageTypes: readonly MessageType[] | undefined,\n decoratorNames: DecoratorNames | undefined,\n sourceRoot: string\n ): Promise<{\n entryContents: Map<string, string>;\n usedLocalImports: Set<string>;\n }> {\n const entryContents = new Map<string, string>();\n const usedLocalImports = new Set<string>();\n\n if (!messageTypes?.length) {\n return { entryContents, usedLocalImports };\n }\n\n for (const node of fileGraph.nodes.values()) {\n if (!node.isEntryPoint) {\n continue;\n }\n\n const rawContent = await this.readFileContent(node.absolutePath);\n const { content: extractedContent, usedModuleSpecifiers } =\n this.extractSymbolsFromEntry(\n rawContent,\n node.absolutePath,\n messageTypes,\n decoratorNames\n );\n entryContents.set(node.absolutePath, extractedContent);\n\n for (const specifier of usedModuleSpecifiers) {\n const importInfo = node.imports.find(\n (i) => i.moduleSpecifier === specifier\n );\n if (importInfo?.resolvedPath && !importInfo.isExternal) {\n usedLocalImports.add(importInfo.resolvedPath);\n }\n }\n }\n\n return { entryContents, usedLocalImports };\n }\n\n private expandTransitiveDependencies(\n usedLocalImports: Set<string>,\n fileGraph: FileGraph\n ): void {\n let changed = true;\n while (changed) {\n changed = false;\n for (const importPath of usedLocalImports) {\n const node = fileGraph.nodes.get(importPath);\n if (!node) continue;\n\n for (const imp of node.imports) {\n const isUnusedLocalImport =\n imp.resolvedPath &&\n !imp.isExternal &&\n !usedLocalImports.has(imp.resolvedPath);\n\n if (isUnusedLocalImport) {\n usedLocalImports.add(imp.resolvedPath!);\n changed = true;\n }\n }\n }\n }\n }\n\n private async resolveNodeContent(\n node: FileNode,\n entryContents: Map<string, string>,\n usedLocalImports: Set<string>,\n messageTypes: readonly MessageType[] | undefined\n ): Promise<string | null> {\n if (node.isEntryPoint && messageTypes?.length) {\n return (\n entryContents.get(node.absolutePath) ??\n (await this.readFileContent(node.absolutePath))\n );\n }\n\n const isUnusedDependency =\n messageTypes?.length && !usedLocalImports.has(node.absolutePath);\n\n if (isUnusedDependency) {\n return null;\n }\n\n return await this.readFileContent(node.absolutePath);\n }\n\n private applyTransformations(\n content: string,\n node: FileNode,\n fileGraph: FileGraph,\n sourceRoot: string,\n removeDecorators: boolean | undefined,\n responseTypesToExport: Map<string, string[]> | undefined,\n pathAliasRewrites: Map<string, string> | undefined\n ): { content: string; rewrites: string[] } {\n const rewrites: string[] = [];\n let transformedContent = content;\n\n transformedContent = this.processExcludedImports(\n transformedContent,\n node,\n fileGraph.excludedPaths,\n rewrites\n );\n transformedContent = this.processDecoratorRemoval(\n transformedContent,\n node.absolutePath,\n removeDecorators,\n rewrites\n );\n transformedContent = this.processTypeExports(\n transformedContent,\n node.absolutePath,\n responseTypesToExport?.get(node.absolutePath),\n rewrites\n );\n transformedContent = this.processInternalPathAliases(\n transformedContent,\n node,\n fileGraph,\n sourceRoot,\n rewrites\n );\n transformedContent = this.processExternalPathAliases(\n transformedContent,\n pathAliasRewrites,\n rewrites\n );\n\n return { content: transformedContent, rewrites };\n }\n\n \n\n generateBarrelExport(copiedFiles: string[], outputDir: string): string {\n const lines: string[] = [];\n for (const filePath of copiedFiles) {\n const relativePath = path.relative(outputDir, filePath);\n lines.push(this.createExportStatement(relativePath));\n }\n return lines.join(\"\\n\");\n }\n\n private async readFileContent(absolutePath: string): Promise<string> {\n try {\n return await this.fs.readFile(absolutePath);\n } catch (error) {\n throw new FileReadError(absolutePath, { cause: error });\n }\n }\n\n private async writeOutputFile(\n outputDir: string,\n relativePath: string,\n content: string\n ): Promise<string> {\n const outputPath = path.join(outputDir, relativePath);\n const outputDirPath = path.dirname(outputPath);\n\n await this.fs.mkdir(outputDirPath, { recursive: true });\n\n try {\n await this.fs.writeFile(outputPath, content);\n } catch (error) {\n throw new FileWriteError(outputPath, { cause: error });\n }\n\n return outputPath;\n }\n\n private processExcludedImports(\n content: string,\n node: FileNode,\n excludedPaths: Set<string>,\n rewrites: string[]\n ): string {\n if (excludedPaths.size === 0) {\n return content;\n }\n\n const excludedResult = this.removeExcludedImports(\n content,\n node,\n excludedPaths\n );\n rewrites.push(...excludedResult.changes);\n return excludedResult.content;\n }\n\n private processDecoratorRemoval(\n content: string,\n filePath: string,\n removeDecorators: boolean | undefined,\n rewrites: string[]\n ): string {\n if (!removeDecorators) {\n return content;\n }\n\n const decoratorResult = this.removeContractDecorators(\n content,\n filePath\n );\n rewrites.push(...decoratorResult.changes);\n return decoratorResult.content;\n }\n\n private processTypeExports(\n content: string,\n filePath: string,\n typesToExport: string[] | undefined,\n rewrites: string[]\n ): string {\n if (!typesToExport || typesToExport.length === 0) {\n return content;\n }\n\n const exportResult = this.addExportToTypes(\n content,\n filePath,\n typesToExport\n );\n rewrites.push(...exportResult.changes);\n return exportResult.content;\n }\n\n private processInternalPathAliases(\n content: string,\n node: FileNode,\n fileGraph: FileGraph,\n sourceRoot: string,\n rewrites: string[]\n ): string {\n const internalResult = this.rewriteInternalPathAliases(\n content,\n node,\n fileGraph,\n sourceRoot\n );\n rewrites.push(...internalResult.rewrites);\n return internalResult.content;\n }\n\n private processExternalPathAliases(\n content: string,\n pathAliasRewrites: Map<string, string> | undefined,\n rewrites: string[]\n ): string {\n if (!pathAliasRewrites) {\n return content;\n }\n\n const aliasResult = this.applyPathAliasRewrites(\n content,\n pathAliasRewrites\n );\n rewrites.push(...aliasResult.rewrites);\n return aliasResult.content;\n }\n\n private createExportStatement(relativePath: string): string {\n const exportPath =\n \"./\" + relativePath.replace(TS_EXTENSION_PATTERN, \"\");\n return `export * from '${exportPath}'`;\n }\n\n private rewriteInternalPathAliases(\n content: string,\n node: FileNode,\n fileGraph: FileGraph,\n sourceRoot: string\n ): { content: string; rewrites: string[] } {\n let transformedContent = content;\n const appliedRewrites: string[] = [];\n\n for (const importInfo of node.imports) {\n if (this.isExternalOrRelativeImport(importInfo)) {\n continue;\n }\n\n const targetNode = this.resolveInternalImport(\n importInfo,\n fileGraph\n );\n if (!targetNode) {\n continue;\n }\n\n const relativePath = this.computeRelativePath(\n node.relativePath,\n targetNode.relativePath\n );\n const rewriteResult = this.rewriteModuleSpecifier(\n transformedContent,\n importInfo.moduleSpecifier,\n relativePath\n );\n\n if (rewriteResult.wasRewritten) {\n transformedContent = rewriteResult.content;\n appliedRewrites.push(\n `${importInfo.moduleSpecifier} → ${relativePath}`\n );\n }\n }\n\n return { content: transformedContent, rewrites: appliedRewrites };\n }\n\n private isExternalOrRelativeImport(importInfo: {\n isExternal: boolean;\n moduleSpecifier: string;\n }): boolean {\n return (\n importInfo.isExternal || importInfo.moduleSpecifier.startsWith(\".\")\n );\n }\n\n private resolveInternalImport(\n importInfo: { resolvedPath?: string | null },\n fileGraph: FileGraph\n ): FileNode | undefined {\n if (\n !importInfo.resolvedPath ||\n !fileGraph.nodes.has(importInfo.resolvedPath)\n ) {\n return undefined;\n }\n return fileGraph.nodes.get(importInfo.resolvedPath);\n }\n\n private rewriteModuleSpecifier(\n content: string,\n originalSpecifier: string,\n newSpecifier: string\n ): { content: string; wasRewritten: boolean } {\n const importPattern = new RegExp(\n `(from\\\\s+['\"])${this.escapeRegex(originalSpecifier)}(['\"])`,\n \"g\"\n );\n\n if (!importPattern.test(content)) {\n return { content, wasRewritten: false };\n }\n\n const rewrittenContent = content.replace(\n importPattern,\n `$1${newSpecifier}$2`\n );\n return { content: rewrittenContent, wasRewritten: true };\n }\n\n private computeRelativePath(\n fromRelative: string,\n toRelative: string\n ): string {\n const fromDir = path.dirname(fromRelative);\n let relativePath = path.relative(fromDir, toRelative);\n\n relativePath = relativePath.replace(TS_EXTENSION_PATTERN, \"\");\n\n if (!relativePath.startsWith(\".\")) {\n relativePath = \"./\" + relativePath;\n }\n\n return relativePath;\n }\n\n private applyPathAliasRewrites(\n content: string,\n rewrites: Map<string, string>\n ): { content: string; rewrites: string[] } {\n let transformedContent = content;\n const appliedRewrites: string[] = [];\n\n for (const [from, to] of rewrites) {\n if (transformedContent.includes(from)) {\n transformedContent = transformedContent.replace(\n new RegExp(this.escapeRegex(from), \"g\"),\n to\n );\n appliedRewrites.push(`${from} → ${to}`);\n }\n }\n\n return { content: transformedContent, rewrites: appliedRewrites };\n }\n\n private escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n\n private removeExcludedImports(\n content: string,\n node: FileNode,\n excludedPaths: Set<string>\n ): TransformResult<string> {\n const excludedModuleSpecifiers = this.findExcludedModuleSpecifiers(\n node,\n excludedPaths\n );\n\n if (excludedModuleSpecifiers.size === 0) {\n return { content, changes: [] };\n }\n\n const changes = Array.from(excludedModuleSpecifiers).map(\n (specifier) => `removed import: ${specifier}`\n );\n\n const visitorFactory = this.createExcludedImportsVisitor(\n excludedModuleSpecifiers\n );\n const transformedContent = this.transformSourceFile(\n content,\n node.absolutePath,\n visitorFactory\n );\n\n return { content: transformedContent, changes };\n }\n\n private findExcludedModuleSpecifiers(\n node: FileNode,\n excludedPaths: Set<string>\n ): Set<string> {\n const excludedModuleSpecifiers = new Set<string>();\n for (const importInfo of node.imports) {\n if (\n importInfo.resolvedPath &&\n excludedPaths.has(importInfo.resolvedPath)\n ) {\n excludedModuleSpecifiers.add(importInfo.moduleSpecifier);\n }\n }\n return excludedModuleSpecifiers;\n }\n\n private createExcludedImportsVisitor(\n excludedModuleSpecifiers: Set<string>\n ): (context: ts.TransformationContext) => VisitorFunction {\n return (context: ts.TransformationContext) => {\n const visit: VisitorFunction = (\n node: ts.Node\n ): ts.Node | undefined => {\n if (\n this.isImportFromExcludedModule(\n node,\n excludedModuleSpecifiers\n )\n ) {\n return undefined;\n }\n\n if (\n this.isExportFromExcludedModule(\n node,\n excludedModuleSpecifiers\n )\n ) {\n return undefined;\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return visit;\n };\n }\n\n private isImportFromExcludedModule(\n node: ts.Node,\n excludedModules: Set<string>\n ): boolean {\n if (!ts.isImportDeclaration(node)) {\n return false;\n }\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n return excludedModules.has(moduleSpecifier);\n }\n\n private isExportFromExcludedModule(\n node: ts.Node,\n excludedModules: Set<string>\n ): boolean {\n if (!ts.isExportDeclaration(node) || !node.moduleSpecifier) {\n return false;\n }\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n return excludedModules.has(moduleSpecifier);\n }\n\n private removeContractDecorators(\n content: string,\n filePath: string\n ): TransformResult<string> {\n const changes: string[] = [];\n\n const visitorFactory = this.createDecoratorRemovalVisitor(changes);\n const transformedContent = this.transformSourceFile(\n content,\n filePath,\n visitorFactory\n );\n\n return { content: transformedContent, changes };\n }\n\n private createDecoratorRemovalVisitor(\n changes: string[]\n ): (context: ts.TransformationContext) => VisitorFunction {\n return (context: ts.TransformationContext) => {\n const visit: VisitorFunction = (\n node: ts.Node\n ): ts.Node | undefined => {\n if (ts.isImportDeclaration(node)) {\n return this.processContractGeneratorImport(node, changes);\n }\n\n if (ts.isClassDeclaration(node) && node.modifiers) {\n return this.removeContractDecoratorsFromClass(\n node,\n changes\n );\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return visit;\n };\n }\n\n private processContractGeneratorImport(\n node: ts.ImportDeclaration,\n changes: string[]\n ): ts.ImportDeclaration | undefined {\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n\n const isContractGeneratorModule =\n moduleSpecifier === CONTRACTS_GENERATOR_MODULE ||\n moduleSpecifier.startsWith(CONTRACTS_GENERATOR_MODULE + \"/\");\n\n if (!isContractGeneratorModule) {\n return node;\n }\n\n const namedBindings = node.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) {\n return node;\n }\n\n const remainingElements = namedBindings.elements.filter(\n (el) => !CONTRACT_DECORATORS.has(el.name.text)\n );\n\n if (remainingElements.length === 0) {\n changes.push(`removed import: ${moduleSpecifier}`);\n return undefined;\n }\n\n if (remainingElements.length < namedBindings.elements.length) {\n changes.push(`removed decorators from import: ${moduleSpecifier}`);\n return this.createImportWithFilteredBindings(\n node,\n remainingElements\n );\n }\n\n return node;\n }\n\n private createImportWithFilteredBindings(\n originalImport: ts.ImportDeclaration,\n remainingElements: ts.ImportSpecifier[]\n ): ts.ImportDeclaration {\n const newNamedImports =\n ts.factory.createNamedImports(remainingElements);\n const newImportClause = ts.factory.createImportClause(\n originalImport.importClause!.isTypeOnly,\n originalImport.importClause!.name,\n newNamedImports\n );\n return ts.factory.createImportDeclaration(\n originalImport.modifiers,\n newImportClause,\n originalImport.moduleSpecifier,\n originalImport.attributes\n );\n }\n\n private removeContractDecoratorsFromClass(\n node: ts.ClassDeclaration,\n changes: string[]\n ): ts.ClassDeclaration {\n const filteredModifiers = node.modifiers!.filter((modifier) => {\n if (!ts.isDecorator(modifier)) {\n return true;\n }\n\n const decoratorName = this.extractDecoratorName(modifier);\n if (decoratorName && CONTRACT_DECORATORS.has(decoratorName)) {\n const decoratorSuffix = this.isDecoratorCallExpression(modifier)\n ? \"()\"\n : \"\";\n changes.push(\n `removed decorator: @${decoratorName}${decoratorSuffix}`\n );\n return false;\n }\n\n return true;\n });\n\n if (filteredModifiers.length === node.modifiers!.length) {\n return node;\n }\n\n return ts.factory.createClassDeclaration(\n filteredModifiers,\n node.name,\n node.typeParameters,\n node.heritageClauses,\n node.members\n );\n }\n\n private extractDecoratorName(decorator: ts.Decorator): string | undefined {\n const expression = decorator.expression;\n\n if (\n ts.isCallExpression(expression) &&\n ts.isIdentifier(expression.expression)\n ) {\n return expression.expression.text;\n }\n\n if (ts.isIdentifier(expression)) {\n return expression.text;\n }\n\n return undefined;\n }\n\n private isDecoratorCallExpression(decorator: ts.Decorator): boolean {\n return ts.isCallExpression(decorator.expression);\n }\n\n private hasExportModifier(\n node: ts.Node & { modifiers?: ts.NodeArray<ts.ModifierLike> }\n ): boolean {\n return (\n node.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.ExportKeyword\n ) ?? false\n );\n }\n\n private prependExportModifier(\n modifiers: ts.NodeArray<ts.ModifierLike> | undefined\n ): ts.ModifierLike[] {\n const exportModifier = ts.factory.createModifier(\n ts.SyntaxKind.ExportKeyword\n );\n return modifiers ? [exportModifier, ...modifiers] : [exportModifier];\n }\n\n private addExportToTypes(\n content: string,\n filePath: string,\n typeNames: string[]\n ): TransformResult<string> {\n const changes: string[] = [];\n const typeNamesSet = new Set(typeNames);\n\n const visitorFactory = this.createExportAdditionVisitor(\n typeNamesSet,\n changes\n );\n const transformedContent = this.transformSourceFile(\n content,\n filePath,\n visitorFactory\n );\n\n return { content: transformedContent, changes };\n }\n\n private createExportAdditionVisitor(\n typeNamesSet: Set<string>,\n changes: string[]\n ): (context: ts.TransformationContext) => VisitorFunction {\n return (context: ts.TransformationContext) => {\n const visit: VisitorFunction = (node: ts.Node): ts.Node => {\n if (ts.isTypeAliasDeclaration(node)) {\n return this.addExportToTypeAlias(\n node,\n typeNamesSet,\n changes\n );\n }\n\n if (ts.isInterfaceDeclaration(node)) {\n return this.addExportToInterface(\n node,\n typeNamesSet,\n changes\n );\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return visit;\n };\n }\n\n private addExportToTypeAlias(\n node: ts.TypeAliasDeclaration,\n typeNamesSet: Set<string>,\n changes: string[]\n ): ts.TypeAliasDeclaration {\n const typeName = node.name.text;\n\n if (!typeNamesSet.has(typeName) || this.hasExportModifier(node)) {\n return node;\n }\n\n changes.push(`added export: type ${typeName}`);\n return ts.factory.createTypeAliasDeclaration(\n this.prependExportModifier(node.modifiers),\n node.name,\n node.typeParameters,\n node.type\n );\n }\n\n private addExportToInterface(\n node: ts.InterfaceDeclaration,\n typeNamesSet: Set<string>,\n changes: string[]\n ): ts.InterfaceDeclaration {\n const typeName = node.name.text;\n\n if (!typeNamesSet.has(typeName) || this.hasExportModifier(node)) {\n return node;\n }\n\n changes.push(`added export: interface ${typeName}`);\n return ts.factory.createInterfaceDeclaration(\n this.prependExportModifier(node.modifiers),\n node.name,\n node.typeParameters,\n node.heritageClauses,\n node.members\n );\n }\n\n private transformSourceFile(\n content: string,\n filePath: string,\n visitorFactory: (context: ts.TransformationContext) => VisitorFunction\n ): string {\n const sourceFile = ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS\n );\n\n const transformer: ts.TransformerFactory<ts.SourceFile> = (context) => {\n return (sf) => {\n const visitor = visitorFactory(context);\n return ts.visitNode(sf, visitor) as ts.SourceFile;\n };\n };\n\n const result = ts.transform(sourceFile, [transformer]);\n const transformedSourceFile = result.transformed[0];\n\n const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });\n const transformedContent = printer.printFile(transformedSourceFile);\n\n result.dispose();\n\n return transformedContent;\n }\n\n private extractSymbolsFromEntry(\n content: string,\n filePath: string,\n messageTypes: readonly MessageType[],\n decoratorNames?: DecoratorNames\n ): { content: string; usedModuleSpecifiers: Set<string> } {\n const sourceFile = ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS\n );\n\n const decoratorToMessageType =\n this.buildDecoratorToMessageTypeMap(decoratorNames);\n const context: SymbolExtractionContext = {\n sourceFile,\n content,\n messageTypes,\n decoratorToMessageType,\n };\n\n const { targetClassNames, targetClasses } =\n this.findTargetClasses(context);\n\n if (targetClasses.length === 0) {\n return { content, usedModuleSpecifiers: new Set() };\n }\n\n const relatedTypeNames = this.computeRelatedTypeNames(targetClassNames);\n const usedIdentifiers = this.collectUsedIdentifiers(targetClasses);\n const localTypeDeclarations =\n this.collectLocalTypeDeclarations(sourceFile);\n const includedLocalTypes = this.resolveIncludedLocalTypes(\n usedIdentifiers,\n relatedTypeNames,\n localTypeDeclarations\n );\n\n const extractedSymbols: ExtractedSymbols = {\n targetClassNames,\n targetClasses,\n usedIdentifiers,\n includedLocalTypes,\n localTypeDeclarations,\n };\n\n return this.generateExtractedOutput(context, extractedSymbols);\n }\n\n private buildDecoratorToMessageTypeMap(\n decoratorNames?: DecoratorNames\n ): Record<string, MessageType> {\n const names = { ...DEFAULT_DECORATOR_NAMES, ...decoratorNames };\n return {\n [names.event]: \"event\",\n [names.command]: \"command\",\n [names.query]: \"query\",\n };\n }\n\n private findTargetClasses(context: SymbolExtractionContext): {\n targetClassNames: Set<string>;\n targetClasses: ts.ClassDeclaration[];\n } {\n const targetClassNames = new Set<string>();\n const targetClasses: ts.ClassDeclaration[] = [];\n\n const findClasses = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name) {\n for (const [decoratorName, messageType] of Object.entries(\n context.decoratorToMessageType\n )) {\n if (\n hasDecorator(node, decoratorName) &&\n context.messageTypes.includes(messageType)\n ) {\n targetClassNames.add(node.name.text);\n targetClasses.push(node);\n break;\n }\n }\n }\n ts.forEachChild(node, findClasses);\n };\n findClasses(context.sourceFile);\n\n return { targetClassNames, targetClasses };\n }\n\n private computeRelatedTypeNames(\n targetClassNames: Set<string>\n ): Set<string> {\n const relatedTypeNames = new Set<string>();\n\n for (const className of targetClassNames) {\n if (className.endsWith(REQUEST_SUFFIX)) {\n const baseName = className.slice(0, -REQUEST_SUFFIX.length);\n relatedTypeNames.add(baseName + \"Response\");\n relatedTypeNames.add(baseName + \"Payload\");\n } else if (className.endsWith(QUERY_SUFFIX)) {\n const baseName = className.slice(0, -QUERY_SUFFIX.length);\n relatedTypeNames.add(baseName + \"QueryResult\");\n relatedTypeNames.add(baseName + \"Payload\");\n }\n\n relatedTypeNames.add(className + \"Response\");\n relatedTypeNames.add(className + \"Payload\");\n }\n\n return relatedTypeNames;\n }\n\n private collectUsedIdentifiers(\n targetClasses: ts.ClassDeclaration[]\n ): Set<string> {\n const usedIdentifiers = new Set<string>();\n\n const collectIdentifiers = (node: ts.Node): void => {\n if (\n ts.isTypeReferenceNode(node) &&\n ts.isIdentifier(node.typeName)\n ) {\n usedIdentifiers.add(node.typeName.text);\n }\n if (\n ts.isExpressionWithTypeArguments(node) &&\n ts.isIdentifier(node.expression)\n ) {\n usedIdentifiers.add(node.expression.text);\n }\n if (ts.isIdentifier(node) && node.parent) {\n const isHeritageOrTypeRef =\n ts.isHeritageClause(node.parent.parent) ||\n ts.isTypeReferenceNode(node.parent);\n if (isHeritageOrTypeRef) {\n usedIdentifiers.add(node.text);\n }\n }\n if (ts.isDecorator(node)) {\n this.collectDecoratorIdentifier(node, usedIdentifiers);\n }\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n usedIdentifiers.add(node.expression.text);\n }\n ts.forEachChild(node, collectIdentifiers);\n };\n\n for (const cls of targetClasses) {\n collectIdentifiers(cls);\n }\n\n return usedIdentifiers;\n }\n\n private collectDecoratorIdentifier(\n decorator: ts.Decorator,\n usedIdentifiers: Set<string>\n ): void {\n const expr = decorator.expression;\n if (ts.isIdentifier(expr)) {\n usedIdentifiers.add(expr.text);\n } else if (\n ts.isCallExpression(expr) &&\n ts.isIdentifier(expr.expression)\n ) {\n usedIdentifiers.add(expr.expression.text);\n }\n }\n\n private collectLocalTypeDeclarations(\n sourceFile: ts.SourceFile\n ): Map<string, ts.Node[]> {\n const localTypeDeclarations = new Map<string, ts.Node[]>();\n\n const collectLocalTypes = (node: ts.Node): void => {\n if (ts.isInterfaceDeclaration(node) && node.name) {\n this.addToDeclarationMap(\n localTypeDeclarations,\n node.name.text,\n node\n );\n }\n if (ts.isTypeAliasDeclaration(node) && node.name) {\n this.addToDeclarationMap(\n localTypeDeclarations,\n node.name.text,\n node\n );\n }\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name)) {\n this.addToDeclarationMap(\n localTypeDeclarations,\n decl.name.text,\n node\n );\n }\n }\n }\n ts.forEachChild(node, collectLocalTypes);\n };\n collectLocalTypes(sourceFile);\n\n return localTypeDeclarations;\n }\n\n private addToDeclarationMap(\n map: Map<string, ts.Node[]>,\n name: string,\n node: ts.Node\n ): void {\n const existing = map.get(name) ?? [];\n existing.push(node);\n map.set(name, existing);\n }\n\n private resolveIncludedLocalTypes(\n usedIdentifiers: Set<string>,\n relatedTypeNames: Set<string>,\n localTypeDeclarations: Map<string, ts.Node[]>\n ): Set<string> {\n const includedLocalTypes = new Set<string>();\n const queue = [...usedIdentifiers, ...relatedTypeNames];\n\n while (queue.length > 0) {\n const identifier = queue.shift()!;\n if (includedLocalTypes.has(identifier)) continue;\n\n const typeNodes = localTypeDeclarations.get(identifier);\n if (!typeNodes || typeNodes.length === 0) continue;\n\n includedLocalTypes.add(identifier);\n\n const typeIdentifiers =\n this.collectTypeIdentifiersFromNodes(typeNodes);\n for (const id of typeIdentifiers) {\n if (!includedLocalTypes.has(id)) {\n queue.push(id);\n usedIdentifiers.add(id);\n }\n }\n }\n\n return includedLocalTypes;\n }\n\n private collectTypeIdentifiersFromNodes(nodes: ts.Node[]): Set<string> {\n const typeIdentifiers = new Set<string>();\n\n const collectFromType = (node: ts.Node): void => {\n if (\n ts.isTypeReferenceNode(node) &&\n ts.isIdentifier(node.typeName)\n ) {\n typeIdentifiers.add(node.typeName.text);\n }\n if (\n ts.isExpressionWithTypeArguments(node) &&\n ts.isIdentifier(node.expression)\n ) {\n typeIdentifiers.add(node.expression.text);\n }\n if (ts.isComputedPropertyName(node)) {\n this.collectComputedPropertyIdentifier(node, typeIdentifiers);\n }\n ts.forEachChild(node, collectFromType);\n };\n\n for (const typeNode of nodes) {\n collectFromType(typeNode);\n }\n\n return typeIdentifiers;\n }\n\n private collectComputedPropertyIdentifier(\n node: ts.ComputedPropertyName,\n typeIdentifiers: Set<string>\n ): void {\n const expr = node.expression;\n if (\n ts.isPropertyAccessExpression(expr) &&\n ts.isIdentifier(expr.expression)\n ) {\n typeIdentifiers.add(expr.expression.text);\n }\n if (ts.isIdentifier(expr)) {\n typeIdentifiers.add(expr.text);\n }\n }\n\n private generateExtractedOutput(\n context: SymbolExtractionContext,\n symbols: ExtractedSymbols\n ): { content: string; usedModuleSpecifiers: Set<string> } {\n const output: string[] = [];\n\n const importMap = this.buildImportMap(context.sourceFile);\n const filteredImports = this.filterImports(\n symbols.usedIdentifiers,\n importMap,\n symbols.includedLocalTypes\n );\n\n this.appendImportStatements(output, filteredImports);\n this.appendLocalTypeDeclarations(output, context, symbols);\n this.appendTargetClasses(output, context, symbols.targetClasses);\n\n const usedModuleSpecifiers = new Set(filteredImports.keys());\n\n return {\n content: output.join(\"\\n\"),\n usedModuleSpecifiers,\n };\n }\n\n private buildImportMap(sourceFile: ts.SourceFile): Map<string, ImportInfo> {\n const importMap = new Map<string, ImportInfo>();\n\n const collectImports = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) {\n const moduleSpecifier = (\n node.moduleSpecifier as ts.StringLiteral\n ).text;\n const namedBindings = node.importClause?.namedBindings;\n const isTypeOnly = node.importClause?.isTypeOnly ?? false;\n\n if (namedBindings && ts.isNamedImports(namedBindings)) {\n for (const element of namedBindings.elements) {\n importMap.set(element.name.text, {\n moduleSpecifier,\n isTypeOnly,\n });\n }\n }\n }\n ts.forEachChild(node, collectImports);\n };\n collectImports(sourceFile);\n\n return importMap;\n }\n\n private filterImports(\n usedIdentifiers: Set<string>,\n importMap: Map<string, ImportInfo>,\n includedLocalTypes: Set<string>\n ): Map<string, { identifiers: Set<string>; isTypeOnly: boolean }> {\n const filteredImports = new Map<\n string,\n { identifiers: Set<string>; isTypeOnly: boolean }\n >();\n\n for (const identifier of usedIdentifiers) {\n const importInfo = importMap.get(identifier);\n if (!importInfo || includedLocalTypes.has(identifier)) {\n continue;\n }\n\n const existing = filteredImports.get(importInfo.moduleSpecifier);\n if (existing) {\n existing.identifiers.add(identifier);\n } else {\n filteredImports.set(importInfo.moduleSpecifier, {\n identifiers: new Set([identifier]),\n isTypeOnly: importInfo.isTypeOnly,\n });\n }\n }\n\n return filteredImports;\n }\n\n private appendImportStatements(\n output: string[],\n filteredImports: Map<\n string,\n { identifiers: Set<string>; isTypeOnly: boolean }\n >\n ): void {\n for (const [moduleSpecifier, info] of filteredImports) {\n const identifiers = [...info.identifiers].sort().join(\", \");\n const typeOnlyPrefix = info.isTypeOnly ? \"type \" : \"\";\n output.push(\n `import ${typeOnlyPrefix}{ ${identifiers} } from \"${moduleSpecifier}\";`\n );\n }\n\n if (output.length > 0) {\n output.push(\"\");\n }\n }\n\n private appendLocalTypeDeclarations(\n output: string[],\n context: SymbolExtractionContext,\n symbols: ExtractedSymbols\n ): void {\n const outputNodes = new Set<ts.Node>();\n\n for (const typeName of symbols.includedLocalTypes) {\n const typeNodes = symbols.localTypeDeclarations.get(typeName);\n if (!typeNodes) continue;\n\n for (const typeNode of typeNodes) {\n if (outputNodes.has(typeNode)) continue;\n outputNodes.add(typeNode);\n\n this.appendNodeWithExport(output, context, typeNode);\n }\n }\n }\n\n private appendTargetClasses(\n output: string[],\n context: SymbolExtractionContext,\n targetClasses: ts.ClassDeclaration[]\n ): void {\n for (const cls of targetClasses) {\n this.appendNodeWithExport(output, context, cls);\n }\n }\n\n private appendNodeWithExport(\n output: string[],\n context: SymbolExtractionContext,\n node: ts.Node\n ): void {\n const nodeText = context.content\n .substring(node.getStart(context.sourceFile), node.end)\n .trim();\n\n const hasExport = this.nodeHasExportKeyword(node);\n\n if (hasExport) {\n output.push(nodeText);\n } else {\n output.push(\"export \" + nodeText);\n }\n output.push(\"\");\n }\n\n private nodeHasExportKeyword(node: ts.Node): boolean {\n const isExportableDeclaration =\n ts.isInterfaceDeclaration(node) ||\n ts.isTypeAliasDeclaration(node) ||\n ts.isVariableStatement(node) ||\n ts.isClassDeclaration(node);\n\n if (!isExportableDeclaration) {\n return false;\n }\n\n const declarationNode = node as\n | ts.InterfaceDeclaration\n | ts.TypeAliasDeclaration\n | ts.VariableStatement\n | ts.ClassDeclaration;\n\n return (\n declarationNode.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.ExportKeyword\n ) ?? false\n );\n }\n}\n","import path from \"path\";\nimport ts from \"typescript\";\n\nimport type { FileSystem } from \"./file-system\";\nimport { nodeFileSystem } from \"./file-system\";\nimport type { ResponseNamingConvention } from \"./domain/types\";\n\nconst TYPESCRIPT_EXTENSIONS = [\".ts\", \".tsx\", \".d.ts\"];\nconst INDEX_FILE = \"index.ts\";\n\n/**\n * Internal class for handling tsconfig path alias resolution.\n * Uses Null Object pattern - NONE instance handles missing tsconfig case.\n */\nclass Tsconfig {\n static readonly NONE = new Tsconfig(new Map());\n\n private constructor(private readonly paths: Map<string, string[]>) {}\n\n static async load(tsconfigPath: string, fs: FileSystem): Promise<Tsconfig> {\n const absolutePath = path.resolve(tsconfigPath);\n const configDir = path.dirname(absolutePath);\n\n const content = await fs.readFile(absolutePath);\n const { config, error } = ts.parseConfigFileTextToJson(absolutePath, content);\n\n if (error) {\n throw new Error(\n `Failed to parse tsconfig: ${ts.flattenDiagnosticMessageText(error.messageText, \"\\n\")}`\n );\n }\n\n const parsed = ts.parseJsonConfigFileContent(config, ts.sys, configDir);\n\n const baseUrl = parsed.options.baseUrl ?? configDir;\n const paths = new Map<string, string[]>();\n\n if (parsed.options.paths) {\n for (const [alias, targets] of Object.entries(parsed.options.paths)) {\n const resolvedTargets = (targets as string[]).map((target) =>\n path.join(baseUrl, target)\n );\n paths.set(alias, resolvedTargets);\n }\n }\n\n return new Tsconfig(paths);\n }\n\n /**\n * Pure string transformation: resolves path alias to potential file paths.\n * Returns null if no alias matches.\n */\n resolvePath(importPath: string): string[] | null {\n for (const [pattern, targets] of this.paths) {\n const wildcardMatch = this.matchPathPattern(importPath, pattern);\n if (wildcardMatch === null) {\n continue;\n }\n\n return targets.map((target) => target.replace(\"*\", wildcardMatch));\n }\n\n return null;\n }\n\n private matchPathPattern(moduleSpecifier: string, pattern: string): string | null {\n if (pattern.endsWith(\"*\")) {\n const prefix = pattern.slice(0, -1);\n if (moduleSpecifier.startsWith(prefix)) {\n return moduleSpecifier.slice(prefix.length);\n }\n } else if (moduleSpecifier === pattern) {\n return \"\";\n }\n return null;\n }\n}\n\nexport interface InputContextConfig {\n readonly name: string;\n readonly path: string;\n readonly sourceDir?: string;\n readonly tsconfigPath?: string;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n}\n\n/**\n * Encapsulates context configuration with path resolution capabilities.\n * Created via factory method to ensure proper initialization.\n */\nexport class ContextConfig {\n private readonly fs: FileSystem;\n private readonly tsconfig: Tsconfig;\n\n readonly name: string;\n readonly sourceDir: string;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n\n private constructor(\n name: string,\n sourceDir: string,\n tsconfig: Tsconfig,\n fs: FileSystem,\n responseNamingConventions?: readonly ResponseNamingConvention[]\n ) {\n this.name = name;\n this.sourceDir = sourceDir;\n this.tsconfig = tsconfig;\n this.fs = fs;\n this.responseNamingConventions = responseNamingConventions;\n }\n\n /**\n * Factory method to create ContextConfig with properly loaded tsconfig.\n */\n static async create(\n input: InputContextConfig,\n configDir: string,\n fs: FileSystem = nodeFileSystem\n ): Promise<ContextConfig> {\n if (!input.name) {\n throw new Error(\"ContextConfig requires 'name'\");\n }\n if (!input.path) {\n throw new Error(`ContextConfig '${input.name}' requires 'path'`);\n }\n\n const basePath = path.resolve(configDir, input.path);\n const sourceDir = path.resolve(basePath, input.sourceDir ?? \"src\");\n const tsconfig = await this.loadTsconfig(basePath, input.tsconfigPath, fs);\n\n return new ContextConfig(\n input.name,\n sourceDir,\n tsconfig,\n fs,\n input.responseNamingConventions\n );\n }\n\n private static async loadTsconfig(\n basePath: string,\n inputPath: string | undefined,\n fs: FileSystem\n ): Promise<Tsconfig> {\n const tsconfigPath = path.resolve(basePath, inputPath ?? \"tsconfig.json\");\n if (!await fs.exists(tsconfigPath)) {\n return Tsconfig.NONE;\n }\n return Tsconfig.load(tsconfigPath, fs);\n }\n\n /**\n * Creates a ContextConfig without async loading (for cases where tsconfig is not needed\n * or already handled externally).\n */\n static createSync(\n name: string,\n sourceDir: string,\n fs: FileSystem = nodeFileSystem,\n responseNamingConventions?: readonly ResponseNamingConvention[]\n ): ContextConfig {\n return new ContextConfig(\n name,\n sourceDir,\n Tsconfig.NONE,\n fs,\n responseNamingConventions\n );\n }\n\n /**\n * Resolves a module specifier (path alias) to actual file path.\n * Only handles non-relative imports (path aliases).\n *\n * @param moduleSpecifier - The import path to resolve (e.g., \"@/utils/helper\")\n * @returns Object with resolvedPath (null if external) and isExternal flag\n */\n async resolvePath(\n moduleSpecifier: string\n ): Promise<{ resolvedPath: string | null; isExternal: boolean }> {\n const resolvedPaths = this.tsconfig.resolvePath(moduleSpecifier);\n if (!resolvedPaths) {\n return { resolvedPath: null, isExternal: true };\n }\n\n for (const resolvedPath of resolvedPaths) {\n const filePath = await this.tryResolveWithExtensions(resolvedPath);\n if (filePath && filePath.startsWith(this.sourceDir)) {\n return { resolvedPath: filePath, isExternal: false };\n }\n }\n\n return { resolvedPath: null, isExternal: true };\n }\n\n private async tryResolveWithExtensions(basePath: string): Promise<string | null> {\n const extensionCandidates = TYPESCRIPT_EXTENSIONS.map((ext) => basePath + ext);\n const indexCandidate = path.join(basePath, INDEX_FILE);\n const candidates = [...extensionCandidates, indexCandidate];\n\n for (const candidate of candidates) {\n if (await this.fs.exists(candidate)) {\n return candidate;\n }\n }\n\n return null;\n }\n}\n","import { resolve, dirname, basename, relative } from \"path\";\nimport ts from \"typescript\";\n\nimport { ConfigLoadError } from \"./errors\";\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\nimport type { DecoratorNames, ResponseNamingConvention } from \"./domain\";\nimport { mergeDecoratorNames } from \"./domain\";\nimport { ContextConfig, type InputContextConfig } from \"./context-config\";\n\nconst SUPPORTED_GLOB_PARTS_COUNT = 2;\n\nexport interface ContractsConfig {\n readonly contexts: readonly ContextConfig[];\n readonly pathAliasRewrites?: Readonly<Record<string, string>>;\n readonly externalDependencies?: Readonly<Record<string, string>>;\n readonly decoratorNames: Required<DecoratorNames>;\n readonly responseNamingConventions?: readonly ResponseNamingConvention[];\n readonly removeDecorators?: boolean;\n}\n\ninterface ApplicationConfig {\n contracts?: {\n contexts?: readonly (string | InputContextConfig)[];\n pathAliasRewrites?: Record<string, string>;\n externalDependencies?: Record<string, string>;\n decoratorNames?: DecoratorNames;\n responseNamingConventions?: ResponseNamingConvention[];\n removeDecorators?: boolean;\n };\n}\n\nexport interface ConfigLoaderOptions {\n fileSystem?: FileSystem;\n}\n\nexport async function resolveContextEntries(\n entries: readonly (string | InputContextConfig)[],\n configDir: string,\n fs: FileSystem = nodeFileSystem\n): Promise<ContextConfig[]> {\n const contexts: ContextConfig[] = [];\n\n for (let i = 0; i < entries.length; i++) {\n const item = entries[i];\n\n if (typeof item === \"string\") {\n const resolved = await resolveStringEntry(item, configDir, fs);\n contexts.push(...resolved);\n } else {\n const contextConfig = await createObjectContext(item, i, configDir, fs);\n contexts.push(contextConfig);\n }\n }\n\n return contexts;\n}\n\nasync function resolveStringEntry(\n contextPath: string,\n configDir: string,\n fs: FileSystem\n): Promise<ContextConfig[]> {\n if (contextPath.includes(\"*\")) {\n return expandGlobPattern(contextPath, configDir, fs);\n }\n\n const basePath = resolve(configDir, contextPath);\n const name = basename(basePath);\n\n return [await ContextConfig.create(\n { name, path: contextPath },\n configDir,\n fs\n )];\n}\n\nasync function expandGlobPattern(\n pattern: string,\n configDir: string,\n fs: FileSystem\n): Promise<ContextConfig[]> {\n const packageDirs = await matchGlobPattern(pattern, configDir, fs);\n\n return Promise.all(\n packageDirs.map((dir) => {\n const name = basename(dir);\n const relativePath = relative(configDir, dir);\n\n return ContextConfig.create(\n { name, path: relativePath },\n configDir,\n fs\n );\n })\n );\n}\n\nasync function createObjectContext(\n ctx: InputContextConfig,\n index: number,\n configDir: string,\n fs: FileSystem\n): Promise<ContextConfig> {\n if (!ctx.name || typeof ctx.name !== \"string\") {\n throw new ConfigLoadError(\n `Invalid context at index ${index}: missing 'name'`\n );\n }\n if (!ctx.path || typeof ctx.path !== \"string\") {\n throw new ConfigLoadError(\n `Invalid context at index ${index}: missing 'path'`\n );\n }\n\n return ContextConfig.create(ctx, configDir, fs);\n}\n\nasync function matchGlobPattern(\n pattern: string,\n configDir: string,\n fs: FileSystem\n): Promise<string[]> {\n const globParts = pattern.split(\"*\");\n\n if (globParts.length !== SUPPORTED_GLOB_PARTS_COUNT) {\n throw new ConfigLoadError(\n `Invalid glob pattern: \"${pattern}\". Only single wildcard patterns like \"packages/*\" are supported.`\n );\n }\n\n const [prefix, suffix] = globParts;\n const baseDir = resolve(configDir, prefix);\n\n if (!await fs.exists(baseDir)) {\n return [];\n }\n\n const entries = await fs.readdir(baseDir);\n const matchedDirs: string[] = [];\n\n for (const entry of entries) {\n const fullPath = resolve(baseDir, entry);\n const stats = await fs.stat(fullPath);\n\n if (!stats.isDirectory()) {\n continue;\n }\n\n if (suffix) {\n const suffixPath = resolve(fullPath, suffix.replace(/^\\//, \"\"));\n if (await fs.exists(suffixPath)) {\n matchedDirs.push(fullPath);\n }\n } else {\n matchedDirs.push(fullPath);\n }\n }\n\n return matchedDirs.sort();\n}\n\nexport class ConfigLoader {\n private readonly fs: FileSystem;\n\n constructor(options: ConfigLoaderOptions = {}) {\n this.fs = options.fileSystem ?? nodeFileSystem;\n }\n\n async load(configPath: string): Promise<ContractsConfig> {\n const absolutePath = resolve(configPath);\n const config = await this.loadTypeScriptConfig(absolutePath);\n\n return this.extractContractsConfig(config, dirname(absolutePath));\n }\n\n private async loadTypeScriptConfig(absolutePath: string): Promise<ApplicationConfig> {\n const source = await this.fs.readFile(absolutePath);\n const result = ts.transpileModule(source, {\n compilerOptions: {\n module: ts.ModuleKind.CommonJS,\n target: ts.ScriptTarget.ES2020,\n esModuleInterop: true,\n },\n });\n\n const exports: { default?: ApplicationConfig } = {};\n const moduleWrapper = new Function(\"exports\", result.outputText);\n moduleWrapper(exports);\n\n return exports.default ?? (exports as unknown as ApplicationConfig);\n }\n\n private async extractContractsConfig(\n config: ApplicationConfig,\n configDir: string\n ): Promise<ContractsConfig> {\n const contracts = config.contracts;\n\n if (!contracts) {\n throw new ConfigLoadError(\"Missing 'contracts' section in config\");\n }\n\n if (!contracts.contexts || !Array.isArray(contracts.contexts)) {\n throw new ConfigLoadError(\"Missing 'contracts.contexts' in config\");\n }\n\n const contexts = await resolveContextEntries(contracts.contexts, configDir, this.fs);\n\n if (contexts.length === 0) {\n throw new ConfigLoadError(\"No contexts found from 'contexts'\");\n }\n\n const decoratorNames = mergeDecoratorNames(contracts.decoratorNames);\n\n return {\n contexts,\n pathAliasRewrites: contracts.pathAliasRewrites,\n externalDependencies: contracts.externalDependencies,\n decoratorNames,\n responseNamingConventions: contracts.responseNamingConventions,\n removeDecorators: contracts.removeDecorators ?? true,\n };\n }\n}\n\nexport { ConfigLoadError } from \"./errors\";\n","import type { DomainEvent, Command, Query } from \"./domain/types\";\n\ntype Message = DomainEvent | Command | Query;\n\nexport interface RegistryGeneratorOptions {\n readonly messageRegistryImport: string;\n readonly useNamespace?: boolean;\n}\n\nexport interface ContextMessages {\n readonly contextName: string;\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries?: readonly Query[];\n readonly importPath?: string;\n}\n\nconst DEFAULT_OPTIONS: RegistryGeneratorOptions = {\n messageRegistryImport: \"@hexaijs/plugin-contracts-generator/runtime\",\n};\n\nfunction hasMessages(ctx: ContextMessages): boolean {\n return (\n ctx.events.length > 0 ||\n ctx.commands.length > 0 ||\n (ctx.queries?.length ?? 0) > 0\n );\n}\n\nfunction getAllMessages(ctx: ContextMessages): readonly Message[] {\n return [...ctx.events, ...ctx.commands, ...(ctx.queries ?? [])];\n}\n\nexport class RegistryGenerator {\n private readonly options: RegistryGeneratorOptions;\n\n constructor(options: Partial<RegistryGeneratorOptions> = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n generate(contexts: readonly ContextMessages[]): string {\n const allMessages = contexts.flatMap((ctx) =>\n getAllMessages(ctx).map((message) => ({\n message,\n contextName: ctx.contextName,\n }))\n );\n\n if (allMessages.length === 0) {\n return this.generateEmptyRegistry();\n }\n\n if (this.options.useNamespace) {\n return this.generateWithNamespace(contexts, allMessages);\n }\n\n const imports = this.generateImports(contexts);\n const registrations = this.generateRegistrations(allMessages);\n\n return [\n imports,\n \"\",\n \"export const messageRegistry = new MessageRegistry()\",\n registrations,\n ].join(\"\\n\");\n }\n\n private generateEmptyRegistry(): string {\n return [\n `import { MessageRegistry } from \"${this.options.messageRegistryImport}\";`,\n \"\",\n \"export const messageRegistry = new MessageRegistry();\",\n \"\",\n ].join(\"\\n\");\n }\n\n private generateWithNamespace(\n contexts: readonly ContextMessages[],\n allMessages: readonly { message: Message; contextName: string }[]\n ): string {\n const imports = this.generateNamespaceImports(contexts);\n const exports = this.generateNamespaceExports(contexts);\n const registrations = this.generateNamespaceRegistrations(allMessages);\n\n return [\n imports,\n \"\",\n exports,\n \"\",\n \"export const messageRegistry = new MessageRegistry()\",\n registrations,\n ].join(\"\\n\");\n }\n\n private getNamespaceInfos(\n contexts: readonly ContextMessages[]\n ): Array<{ importPath: string; namespace: string }> {\n return contexts.filter(hasMessages).map((ctx) => ({\n importPath: ctx.importPath ?? `./${ctx.contextName}`,\n namespace: this.toNamespace(ctx.contextName),\n }));\n }\n\n private generateNamespaceImports(\n contexts: readonly ContextMessages[]\n ): string {\n return [\n `import { MessageRegistry } from \"${this.options.messageRegistryImport}\";`,\n ...this.getNamespaceInfos(contexts).map(\n ({ importPath, namespace }) =>\n `import * as ${namespace} from \"${importPath}\";`\n ),\n ].join(\"\\n\");\n }\n\n private generateNamespaceExports(\n contexts: readonly ContextMessages[]\n ): string {\n return this.getNamespaceInfos(contexts)\n .map(\n ({ importPath, namespace }) =>\n `export * as ${namespace} from \"${importPath}\";`\n )\n .join(\"\\n\");\n }\n\n private generateNamespaceRegistrations(\n messages: readonly { message: Message; contextName: string }[]\n ): string {\n const lines = messages.map(({ message, contextName }) => {\n const namespace = this.toNamespace(contextName);\n return ` .register(${namespace}.${message.name})`;\n });\n return lines.join(\"\\n\") + \";\\n\";\n }\n\n private toNamespace(contextName: string): string {\n // kebab-case to camelCase\n return contextName.replace(/-([a-z])/g, (_, letter) =>\n letter.toUpperCase()\n );\n }\n\n private generateImports(contexts: readonly ContextMessages[]): string {\n const lines: string[] = [\n `import { MessageRegistry } from \"${this.options.messageRegistryImport}\";`,\n ];\n\n for (const ctx of contexts) {\n const messageNames = getAllMessages(ctx).map((m) => m.name);\n\n if (messageNames.length > 0) {\n const importPath = ctx.importPath ?? `./${ctx.contextName}`;\n lines.push(\n `import { ${messageNames.join(\", \")} } from \"${importPath}\";`\n );\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n private generateRegistrations(\n messages: readonly { message: Message; contextName: string }[]\n ): string {\n const lines = messages.map(\n ({ message }) => ` .register(${message.name})`\n );\n return lines.join(\"\\n\") + \";\\n\";\n }\n}\n","import * as ts from \"typescript\";\nimport * as path from \"path\";\n\nimport { FileSystem, nodeFileSystem } from \"./file-system\";\n\n/**\n * Represents an import that was rewritten via pathAliasRewrites\n */\nexport interface RewrittenImport {\n /** The rewritten module specifier (e.g., \"@libera/contracts/common/request\") */\n readonly rewrittenPath: string;\n /** The original module specifier before rewrite (e.g., \"@libera/common/request\") */\n readonly originalPath: string;\n /** The imported symbol names */\n readonly symbols: readonly string[];\n /** Whether this is a type-only import */\n readonly isTypeOnly: boolean;\n}\n\n/**\n * Represents a re-export file to be generated\n */\nexport interface ReexportFile {\n /** Relative path within contracts output dir (e.g., \"common/request.ts\") */\n readonly relativePath: string;\n /** The original module to re-export from */\n readonly originalModule: string;\n /** Symbols to re-export */\n readonly symbols: readonly string[];\n /** Whether all symbols are type-only */\n readonly isTypeOnly: boolean;\n}\n\nexport interface ReexportGeneratorOptions {\n fileSystem?: FileSystem;\n}\n\nexport interface AnalyzeOptions {\n /** The files to analyze (absolute paths) */\n readonly files: readonly string[];\n /** Map of original path prefix -> rewritten path prefix */\n readonly pathAliasRewrites: ReadonlyMap<string, string>;\n}\n\nexport interface GenerateOptions {\n /** The output directory for re-export files */\n readonly outputDir: string;\n /** The re-export files to generate */\n readonly reexportFiles: readonly ReexportFile[];\n}\n\n/**\n * Generates re-export files for pathAliasRewrites\n */\nexport class ReexportGenerator {\n private readonly fs: FileSystem;\n\n constructor(options: ReexportGeneratorOptions = {}) {\n this.fs = options.fileSystem ?? nodeFileSystem;\n }\n\n /**\n * Analyzes files to find imports that match pathAliasRewrites\n * and groups them by rewritten path\n */\n async analyze(options: AnalyzeOptions): Promise<ReexportFile[]> {\n const { files, pathAliasRewrites } = options;\n\n // Invert the map: rewritten prefix -> original prefix\n const rewrittenToOriginal = new Map<string, string>();\n for (const [original, rewritten] of pathAliasRewrites) {\n rewrittenToOriginal.set(rewritten, original);\n }\n\n // Collect all rewritten imports across all files\n const allImports: RewrittenImport[] = [];\n\n for (const file of files) {\n const content = await this.fs.readFile(file);\n const imports = this.extractRewrittenImports(content, rewrittenToOriginal);\n allImports.push(...imports);\n }\n\n // Group by rewritten path and merge symbols\n return this.groupImportsByPath(allImports);\n }\n\n /**\n * Generates re-export files\n */\n async generate(options: GenerateOptions): Promise<string[]> {\n const { outputDir, reexportFiles } = options;\n const generatedFiles: string[] = [];\n\n for (const reexport of reexportFiles) {\n const filePath = path.join(outputDir, reexport.relativePath);\n const content = this.generateReexportContent(reexport);\n\n await this.fs.mkdir(path.dirname(filePath), { recursive: true });\n await this.fs.writeFile(filePath, content);\n generatedFiles.push(filePath);\n }\n\n return generatedFiles;\n }\n\n /**\n * Extracts imports from source content that match rewritten prefixes\n */\n private extractRewrittenImports(\n content: string,\n rewrittenToOriginal: ReadonlyMap<string, string>\n ): RewrittenImport[] {\n const sourceFile = ts.createSourceFile(\n \"temp.ts\",\n content,\n ts.ScriptTarget.Latest,\n true\n );\n\n const imports: RewrittenImport[] = [];\n\n ts.forEachChild(sourceFile, (node) => {\n if (!ts.isImportDeclaration(node) || !node.importClause) {\n return;\n }\n\n const moduleSpecifier = (node.moduleSpecifier as ts.StringLiteral).text;\n\n // Check if this import matches any rewritten prefix\n for (const [rewrittenPrefix, originalPrefix] of rewrittenToOriginal) {\n if (moduleSpecifier.startsWith(rewrittenPrefix)) {\n const symbols = this.extractSymbolNames(node.importClause);\n if (symbols.length > 0) {\n // Calculate the original path\n const suffix = moduleSpecifier.slice(rewrittenPrefix.length);\n const originalPath = originalPrefix + suffix;\n\n imports.push({\n rewrittenPath: moduleSpecifier,\n originalPath,\n symbols,\n isTypeOnly: node.importClause.isTypeOnly ?? false,\n });\n }\n break;\n }\n }\n });\n\n return imports;\n }\n\n /**\n * Extracts symbol names from import clause\n */\n private extractSymbolNames(importClause: ts.ImportClause): string[] {\n const names: string[] = [];\n\n // Default import\n if (importClause.name) {\n names.push(importClause.name.text);\n }\n\n // Named imports\n if (importClause.namedBindings && ts.isNamedImports(importClause.namedBindings)) {\n for (const element of importClause.namedBindings.elements) {\n // Use the original name if aliased, otherwise use the imported name\n const originalName = element.propertyName?.text ?? element.name.text;\n names.push(originalName);\n }\n }\n\n return names;\n }\n\n /**\n * Groups imports by rewritten path and merges symbols\n */\n private groupImportsByPath(imports: RewrittenImport[]): ReexportFile[] {\n const grouped = new Map<string, {\n originalPath: string;\n symbols: Set<string>;\n hasValueImport: boolean;\n }>();\n\n for (const imp of imports) {\n const existing = grouped.get(imp.rewrittenPath);\n if (existing) {\n for (const symbol of imp.symbols) {\n existing.symbols.add(symbol);\n }\n if (!imp.isTypeOnly) {\n existing.hasValueImport = true;\n }\n } else {\n grouped.set(imp.rewrittenPath, {\n originalPath: imp.originalPath,\n symbols: new Set(imp.symbols),\n hasValueImport: !imp.isTypeOnly,\n });\n }\n }\n\n // Convert to ReexportFile array\n const result: ReexportFile[] = [];\n for (const [rewrittenPath, data] of grouped) {\n // Convert rewritten package path to relative file path\n // e.g., \"@libera/contracts/common/request\" -> \"common/request.ts\"\n const relativePath = this.rewrittenPathToRelativePath(rewrittenPath);\n\n result.push({\n relativePath,\n originalModule: data.originalPath,\n symbols: Array.from(data.symbols).sort(),\n isTypeOnly: !data.hasValueImport,\n });\n }\n\n return result.sort((a, b) => a.relativePath.localeCompare(b.relativePath));\n }\n\n /**\n * Converts a rewritten package path to a relative file path\n * e.g., \"@libera/contracts/common/request\" with prefix \"@libera/contracts\"\n * -> \"common/request.ts\"\n */\n private rewrittenPathToRelativePath(rewrittenPath: string): string {\n // Find the subpath after the package name\n // Assume format: @scope/package/subpath or package/subpath\n const parts = rewrittenPath.split(\"/\");\n\n let subpathStart: number;\n if (parts[0].startsWith(\"@\")) {\n // Scoped package: @scope/package/subpath\n subpathStart = 2;\n } else {\n // Regular package: package/subpath\n subpathStart = 1;\n }\n\n const subpath = parts.slice(subpathStart).join(\"/\");\n\n // If no subpath, use index.ts\n if (!subpath) {\n return \"index.ts\";\n }\n\n return subpath + \".ts\";\n }\n\n /**\n * Generates the content for a re-export file\n */\n private generateReexportContent(reexport: ReexportFile): string {\n const exportKeyword = reexport.isTypeOnly ? \"export type\" : \"export\";\n const symbols = reexport.symbols.join(\", \");\n return `${exportKeyword} { ${symbols} } from \"${reexport.originalModule}\";\\n`;\n }\n}\n","export type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nexport interface Logger {\n debug(message: string): void;\n info(message: string): void;\n warn(message: string): void;\n error(message: string): void;\n}\n\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\nexport interface ConsoleLoggerOptions {\n level?: LogLevel;\n}\n\nexport class ConsoleLogger implements Logger {\n private readonly level: LogLevel;\n\n constructor(options: ConsoleLoggerOptions = {}) {\n this.level = options.level ?? \"info\";\n }\n\n debug(message: string): void {\n if (this.shouldLog(\"debug\")) {\n console.debug(message);\n }\n }\n\n info(message: string): void {\n if (this.shouldLog(\"info\")) {\n console.info(message);\n }\n }\n\n warn(message: string): void {\n if (this.shouldLog(\"warn\")) {\n console.warn(message);\n }\n }\n\n error(message: string): void {\n if (this.shouldLog(\"error\")) {\n console.error(message);\n }\n }\n\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];\n }\n}\n\nclass NoopLogger implements Logger {\n debug(): void {}\n info(): void {}\n warn(): void {}\n error(): void {}\n}\n\nexport const noopLogger: Logger = new NoopLogger();\n","import { join, relative } from \"path\";\nimport { Scanner } from \"./scanner\";\nimport { Parser } from \"./parser\";\nimport { FileGraphResolver, type FileGraph } from \"./file-graph-resolver\";\nimport { FileCopier } from \"./file-copier\";\nimport { ContextConfig } from \"./context-config\";\nimport type { DomainEvent, Command, Query, TypeDefinition, ResponseNamingConvention, MessageType } from \"./domain/types\";\nimport { type FileSystem, nodeFileSystem } from \"./file-system\";\nimport { type Logger, noopLogger } from \"./logger\";\n\nconst DEFAULT_EXCLUDE_DEPENDENCIES = [\n \"**/*.test.ts\",\n \"**/*.spec.ts\",\n \"**/*.eh.ts\",\n \"**/db.ts\",\n \"**/infra/**\",\n];\n\nexport interface PipelineDependencies {\n readonly scanner: Scanner;\n readonly parser: Parser;\n readonly fileGraphResolver: FileGraphResolver;\n readonly fileCopier: FileCopier;\n readonly fileSystem: FileSystem;\n readonly logger: Logger;\n}\n\nexport interface PipelineOptions {\n readonly contextName: string;\n readonly sourceDir: string;\n readonly outputDir: string;\n readonly pathAliasRewrites?: Map<string, string>;\n readonly removeDecorators?: boolean;\n}\n\nexport interface PipelineResult {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries: readonly Query[];\n readonly copiedFiles: string[];\n}\n\nexport interface ParsedMessages {\n readonly events: readonly DomainEvent[];\n readonly commands: readonly Command[];\n readonly queries: readonly Query[];\n readonly typeDefinitions: readonly TypeDefinition[];\n}\n\nexport class ContractsPipeline {\n private readonly messageTypes?: readonly MessageType[];\n\n private constructor(\n private readonly deps: PipelineDependencies,\n messageTypes?: readonly MessageType[]\n ) {\n this.messageTypes = messageTypes;\n }\n\n static create(options: {\n contextConfig: ContextConfig;\n responseNamingConventions?: readonly ResponseNamingConvention[];\n fileSystem?: FileSystem;\n logger?: Logger;\n excludeDependencies?: string[];\n messageTypes?: MessageType[];\n }): ContractsPipeline {\n const fileSystem = options.fileSystem ?? nodeFileSystem;\n const logger = options.logger ?? noopLogger;\n const excludeDependencies = options.excludeDependencies ?? DEFAULT_EXCLUDE_DEPENDENCIES;\n const scanner = new Scanner({ fileSystem, messageTypes: options.messageTypes });\n const parser = new Parser({\n responseNamingConventions: options.responseNamingConventions ?? options.contextConfig.responseNamingConventions,\n messageTypes: options.messageTypes,\n });\n const fileGraphResolver = FileGraphResolver.create({\n contextConfig: options.contextConfig,\n fileSystem,\n excludeDependencies,\n });\n const fileCopier = new FileCopier({ fileSystem });\n\n return new ContractsPipeline(\n {\n scanner,\n parser,\n fileGraphResolver,\n fileCopier,\n fileSystem,\n logger,\n },\n options.messageTypes\n );\n }\n\n static fromDependencies(deps: PipelineDependencies): ContractsPipeline {\n return new ContractsPipeline(deps);\n }\n\n async execute(options: PipelineOptions): Promise<PipelineResult> {\n const { contextName, sourceDir, outputDir, pathAliasRewrites, removeDecorators } = options;\n const contextOutputDir = join(outputDir, contextName);\n\n this.deps.logger.info(`Processing context: ${contextName}`);\n this.deps.logger.debug(` Source: ${sourceDir}`);\n this.deps.logger.debug(` Output: ${contextOutputDir}`);\n\n const decoratedFiles = await this.scan(sourceDir);\n const messages = await this.parse(decoratedFiles, sourceDir);\n const fileGraph = await this.resolve(decoratedFiles, sourceDir);\n const responseTypesToExport = this.collectResponseTypesToExport(messages);\n const copiedFiles = await this.copy(fileGraph, sourceDir, contextOutputDir, pathAliasRewrites, responseTypesToExport, removeDecorators, this.messageTypes);\n await this.exportBarrel(copiedFiles, contextOutputDir);\n\n this.deps.logger.info(`Completed context: ${contextName} (${messages.events.length} events, ${messages.commands.length} commands, ${messages.queries.length} queries, ${copiedFiles.length} files)`);\n\n return {\n events: messages.events,\n commands: messages.commands,\n queries: messages.queries,\n copiedFiles,\n };\n }\n\n private collectResponseTypesToExport(messages: ParsedMessages): Map<string, string[]> {\n const result = new Map<string, string[]>();\n const allMessages = [...messages.commands, ...messages.queries];\n\n for (const message of allMessages) {\n if (message.resultType?.kind !== \"reference\") continue;\n\n const typeName = message.resultType.name;\n const sourceFile = message.sourceFile.absolutePath;\n\n // Check if this type exists and is not exported\n const typeDef = messages.typeDefinitions.find(\n (t) =>\n t.name === typeName &&\n t.sourceFile.absolutePath === sourceFile &&\n !t.exported\n );\n\n if (typeDef) {\n const existing = result.get(sourceFile) ?? [];\n if (!existing.includes(typeName)) {\n existing.push(typeName);\n result.set(sourceFile, existing);\n }\n }\n }\n\n if (result.size > 0) {\n this.deps.logger.debug(`Found ${result.size} file(s) with unexported response types`);\n }\n\n return result;\n }\n\n async scan(sourceDir: string): Promise<string[]> {\n this.deps.logger.debug(`Scanning for decorated files in ${sourceDir}`);\n const files = await this.deps.scanner.scan(sourceDir);\n this.deps.logger.debug(`Found ${files.length} decorated file(s)`);\n return files;\n }\n\n async parse(files: string[], sourceRoot: string): Promise<ParsedMessages> {\n this.deps.logger.debug(`Parsing ${files.length} file(s)`);\n const events: DomainEvent[] = [];\n const commands: Command[] = [];\n const queries: Query[] = [];\n const typeDefinitions: TypeDefinition[] = [];\n\n for (const file of files) {\n const content = await this.deps.fileSystem.readFile(file);\n const sourceFileInfo = {\n absolutePath: file,\n relativePath: relative(sourceRoot, file),\n };\n const result = this.deps.parser.parse(content, sourceFileInfo);\n events.push(...result.events);\n commands.push(...result.commands);\n queries.push(...result.queries);\n typeDefinitions.push(...result.typeDefinitions);\n }\n\n this.deps.logger.debug(`Parsed ${events.length} event(s), ${commands.length} command(s), ${queries.length} query(s), ${typeDefinitions.length} type(s)`);\n return { events, commands, queries, typeDefinitions };\n }\n\n async resolve(entryPoints: string[], sourceRoot: string): Promise<FileGraph> {\n this.deps.logger.debug(`Resolving dependencies for ${entryPoints.length} entry point(s)`);\n const graph = await this.deps.fileGraphResolver.buildGraph(entryPoints, sourceRoot);\n this.deps.logger.debug(`Resolved ${graph.nodes.size} file(s) in dependency graph`);\n return graph;\n }\n\n async copy(\n fileGraph: FileGraph,\n sourceRoot: string,\n outputDir: string,\n pathAliasRewrites?: Map<string, string>,\n responseTypesToExport?: Map<string, string[]>,\n removeDecorators?: boolean,\n messageTypes?: readonly MessageType[]\n ): Promise<string[]> {\n this.deps.logger.debug(`Copying files to ${outputDir}`);\n await this.deps.fileSystem.mkdir(outputDir, { recursive: true });\n\n const result = await this.deps.fileCopier.copyFiles({\n sourceRoot,\n outputDir,\n fileGraph,\n pathAliasRewrites,\n responseTypesToExport,\n removeDecorators,\n messageTypes,\n });\n\n this.deps.logger.debug(`Copied ${result.copiedFiles.length} file(s)`);\n return result.copiedFiles;\n }\n\n async exportBarrel(copiedFiles: string[], outputDir: string): Promise<void> {\n this.deps.logger.debug(`Generating barrel export at ${outputDir}/index.ts`);\n const indexContent = this.deps.fileCopier.generateBarrelExport(copiedFiles, outputDir);\n await this.deps.fileSystem.writeFile(join(outputDir, \"index.ts\"), indexContent);\n }\n}\n","#!/usr/bin/env node\n\nimport { fileURLToPath } from \"node:url\";\nimport { resolve, dirname, join, relative } from \"node:path\";\nimport { ConfigLoader, type ContractsConfig, resolveContextEntries } from \"./config-loader\";\nimport type { InputContextConfig } from \"./context-config\";\nimport { ContractsPipeline, type PipelineResult, ConsoleLogger, type Logger } from \"./index\";\nimport { RegistryGenerator, ContextMessages } from \"./registry-generator\";\nimport { ReexportGenerator } from \"./reexport-generator\";\nimport { nodeFileSystem } from \"./file-system\";\nimport type { MessageType, DecoratorNames, ResponseNamingConvention } from \"./domain/types\";\nimport { mergeDecoratorNames } from \"./domain\";\n\nconst DEFAULT_CONFIG_PATH = \"application.config.ts\";\nconst EXIT_CODE_ERROR = 1;\nconst VALID_MESSAGE_TYPES: MessageType[] = [\"event\", \"command\", \"query\"];\n\nconst CLI_OPTIONS = {\n config: { short: \"-c\", long: \"--config\", requiresValue: true },\n outputDir: { short: \"-o\", long: \"--output-dir\", requiresValue: true },\n messageTypes: { short: \"-m\", long: \"--message-types\", requiresValue: true },\n generateMessageRegistry: { short: null, long: \"--generate-message-registry\", requiresValue: false },\n help: { short: \"-h\", long: \"--help\", requiresValue: false },\n} as const;\n\ninterface CliOptions {\n config: string;\n outputDir: string;\n messageTypes?: MessageType[];\n generateMessageRegistry?: boolean;\n}\n\n/**\n * Options for runWithConfig when config is provided directly.\n */\nexport interface RunWithConfigOptions {\n outputDir: string;\n messageTypes?: MessageType[];\n generateMessageRegistry?: boolean;\n}\n\n/**\n * Plugin configuration structure for contracts generator.\n * This is the config passed from hexai.config.ts.\n */\nexport interface ContractsPluginConfig {\n contexts: Array<string | InputContextConfig>;\n pathAliasRewrites?: Record<string, string>;\n externalDependencies?: Record<string, string>;\n decoratorNames?: DecoratorNames;\n responseNamingConventions?: ResponseNamingConvention[];\n removeDecorators?: boolean;\n}\n\ninterface ContextProcessingResult {\n name: string;\n result: PipelineResult;\n outputDir: string;\n}\n\nfunction parseMessageTypes(value: string): MessageType[] {\n const types = value.split(\",\").map((type) => type.trim().toLowerCase());\n const invalidTypes = types.filter((type) => !VALID_MESSAGE_TYPES.includes(type as MessageType));\n\n if (invalidTypes.length > 0) {\n throw new Error(\n `Invalid message type(s): ${invalidTypes.join(\", \")}. ` +\n `Valid types are: ${VALID_MESSAGE_TYPES.join(\", \")}`\n );\n }\n\n return types as MessageType[];\n}\n\nfunction extractOptionValue(args: string[], currentIndex: number, optionName: string): { value: string; nextIndex: number } {\n const currentArg = args[currentIndex];\n\n const equalsIndex = currentArg.indexOf(\"=\");\n if (equalsIndex !== -1) {\n return {\n value: currentArg.slice(equalsIndex + 1),\n nextIndex: currentIndex,\n };\n }\n\n const nextValue = args[currentIndex + 1];\n if (!nextValue) {\n throw new Error(`Missing value for ${optionName} option`);\n }\n\n return {\n value: nextValue,\n nextIndex: currentIndex + 1,\n };\n}\n\nfunction matchesOption(arg: string, option: typeof CLI_OPTIONS[keyof typeof CLI_OPTIONS]): boolean {\n const matchesShortOrLong = arg === option.short || arg === option.long;\n const matchesLongWithValue = option.long !== null && arg.startsWith(`${option.long}=`);\n return matchesShortOrLong || matchesLongWithValue;\n}\n\nfunction parseArgs(args: string[]): CliOptions {\n const options: Partial<CliOptions> = {\n config: DEFAULT_CONFIG_PATH,\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n\n if (matchesOption(arg, CLI_OPTIONS.config)) {\n const { value, nextIndex } = extractOptionValue(args, i, \"--config\");\n options.config = value;\n i = nextIndex;\n } else if (matchesOption(arg, CLI_OPTIONS.outputDir)) {\n const { value, nextIndex } = extractOptionValue(args, i, \"--output-dir\");\n options.outputDir = value;\n i = nextIndex;\n } else if (matchesOption(arg, CLI_OPTIONS.messageTypes)) {\n const { value, nextIndex } = extractOptionValue(args, i, \"--message-types\");\n options.messageTypes = parseMessageTypes(value);\n i = nextIndex;\n } else if (matchesOption(arg, CLI_OPTIONS.generateMessageRegistry)) {\n options.generateMessageRegistry = true;\n } else if (matchesOption(arg, CLI_OPTIONS.help)) {\n printHelp();\n process.exit(0);\n }\n }\n\n if (!options.outputDir) {\n throw new Error(\"Missing required option: --output-dir\");\n }\n\n return options as CliOptions;\n}\n\nfunction printHelp(): void {\n console.log(`\ncontracts-generator - Extract domain events and commands from TypeScript source\n\nUsage:\n contracts-generator --output-dir <path> [options]\n\nRequired:\n -o, --output-dir <path> Output directory for generated contracts\n\nOptions:\n -c, --config <path> Path to config file (default: ${DEFAULT_CONFIG_PATH})\n -m, --message-types <types> Filter message types to extract (comma-separated)\n Valid types: ${VALID_MESSAGE_TYPES.join(\", \")}\n Default: all types\n --generate-message-registry Generate message registry index.ts file\n Default: not generated\n -h, --help Show this help message\n\nConfig file format:\n export default {\n contracts: {\n contexts: [\n \"packages/*\", // glob: auto-discover all contexts\n \"packages/auth\", // string: name inferred from directory\n {\n name: \"lecture\",\n path: \"packages/lecture\", // required: base directory\n sourceDir: \"src\", // optional, default: \"src\"\n },\n ],\n pathAliasRewrites: {\n \"@/\": \"@libera/\",\n },\n },\n };\n\nExamples:\n # Extract all message types\n contracts-generator --output-dir packages/contracts/src\n\n # Extract only commands and queries\n contracts-generator -o packages/contracts/requests -m command,query\n\n # Extract only events\n contracts-generator -o packages/contracts/events --message-types event\n\n # Generate with message registry (index.ts)\n contracts-generator -o packages/contracts/src --generate-message-registry\n\n # Use with custom config\n contracts-generator -c app.config.ts -o packages/contracts/src\n`);\n}\n\ninterface SummaryTotals {\n events: number;\n commands: number;\n files: number;\n}\n\nfunction calculateSummaryTotals(results: ContextProcessingResult[]): SummaryTotals {\n return results.reduce(\n (totals, contextResult) => ({\n events: totals.events + contextResult.result.events.length,\n commands: totals.commands + contextResult.result.commands.length,\n files: totals.files + contextResult.result.copiedFiles.length,\n }),\n { events: 0, commands: 0, files: 0 }\n );\n}\n\nfunction countTotalMessages(totals: SummaryTotals): number {\n return totals.events + totals.commands;\n}\n\nfunction logSummary(logger: Logger, totals: SummaryTotals): void {\n logger.info(\"\\n--- Summary ---\");\n logger.info(`Total events: ${totals.events}`);\n logger.info(`Total commands: ${totals.commands}`);\n logger.info(`Total files copied: ${totals.files}`);\n}\n\nexport async function run(args: string[]): Promise<void> {\n const options = parseArgs(args);\n const configPath = resolve(options.config);\n const configDir = dirname(configPath);\n const outputDir = resolve(configDir, options.outputDir);\n const logger = new ConsoleLogger({ level: \"info\" });\n\n logger.info(`Loading config from: ${configPath}`);\n\n const configLoader = new ConfigLoader();\n const config = await configLoader.load(configPath);\n\n logger.info(`Found ${config.contexts.length} context(s) to process`);\n logger.info(`Output directory: ${outputDir}`);\n if (options.messageTypes) {\n logger.info(`Message types filter: ${options.messageTypes.join(\", \")}`);\n }\n\n const pathAliasRewrites = config.pathAliasRewrites\n ? new Map(Object.entries(config.pathAliasRewrites))\n : undefined;\n\n const results: ContextProcessingResult[] = [];\n\n for (const contextConfig of config.contexts) {\n const pipeline = ContractsPipeline.create({\n contextConfig,\n messageTypes: options.messageTypes,\n logger,\n });\n\n const result = await pipeline.execute({\n contextName: contextConfig.name,\n sourceDir: contextConfig.sourceDir,\n outputDir,\n pathAliasRewrites,\n removeDecorators: config.removeDecorators,\n });\n\n results.push({ name: contextConfig.name, result, outputDir });\n }\n\n const totals = calculateSummaryTotals(results);\n logSummary(logger, totals);\n\n if (options.generateMessageRegistry) {\n await generateRegistry(outputDir, results, totals, logger);\n }\n\n if (config.pathAliasRewrites) {\n await generateReexports(config, outputDir, results, logger);\n }\n}\n\n/**\n * Converts plugin config to internal ContractsConfig format.\n */\nasync function toContractsConfig(pluginConfig: ContractsPluginConfig): Promise<ContractsConfig> {\n const contexts = await resolveContextEntries(\n pluginConfig.contexts,\n process.cwd(),\n nodeFileSystem\n );\n\n return {\n contexts,\n pathAliasRewrites: pluginConfig.pathAliasRewrites,\n externalDependencies: pluginConfig.externalDependencies,\n decoratorNames: mergeDecoratorNames(pluginConfig.decoratorNames),\n responseNamingConventions: pluginConfig.responseNamingConventions,\n removeDecorators: pluginConfig.removeDecorators ?? true,\n };\n}\n\n/**\n * Run contracts generator with config provided directly.\n * This is used by the hexai CLI integration where config comes from hexai.config.ts.\n *\n * @param options - CLI options (outputDir, messageTypes, generateMessageRegistry)\n * @param pluginConfig - Plugin configuration from hexai.config.ts\n */\nexport async function runWithConfig(\n options: RunWithConfigOptions,\n pluginConfig: ContractsPluginConfig\n): Promise<void> {\n const outputDir = resolve(options.outputDir);\n const logger = new ConsoleLogger({ level: \"info\" });\n const config = await toContractsConfig(pluginConfig);\n\n logger.info(`Found ${config.contexts.length} context(s) to process`);\n logger.info(`Output directory: ${outputDir}`);\n if (options.messageTypes) {\n logger.info(`Message types filter: ${options.messageTypes.join(\", \")}`);\n }\n\n const pathAliasRewrites = config.pathAliasRewrites\n ? new Map(Object.entries(config.pathAliasRewrites))\n : undefined;\n\n const results: ContextProcessingResult[] = [];\n\n for (const contextConfig of config.contexts) {\n const pipeline = ContractsPipeline.create({\n contextConfig,\n messageTypes: options.messageTypes,\n logger,\n });\n\n const result = await pipeline.execute({\n contextName: contextConfig.name,\n sourceDir: contextConfig.sourceDir,\n outputDir,\n pathAliasRewrites,\n removeDecorators: config.removeDecorators,\n });\n\n results.push({ name: contextConfig.name, result, outputDir });\n }\n\n const totals = calculateSummaryTotals(results);\n logSummary(logger, totals);\n\n if (options.generateMessageRegistry) {\n await generateRegistry(outputDir, results, totals, logger);\n }\n\n if (config.pathAliasRewrites) {\n await generateReexports(config, outputDir, results, logger);\n }\n}\n\nasync function generateRegistry(\n outputDir: string,\n results: ContextProcessingResult[],\n totals: SummaryTotals,\n logger: Logger\n): Promise<void> {\n const contextMessages: ContextMessages[] = results.map((contextResult) => {\n const contextOutputDir = join(contextResult.outputDir, contextResult.name);\n const importPath = \"./\" + relative(outputDir, contextOutputDir).replace(/\\\\/g, \"/\");\n\n return {\n contextName: contextResult.name,\n events: contextResult.result.events,\n commands: contextResult.result.commands,\n queries: contextResult.result.queries,\n importPath,\n };\n });\n\n const generator = new RegistryGenerator({ useNamespace: true });\n const registryContent = generator.generate(contextMessages);\n\n await nodeFileSystem.mkdir(outputDir, { recursive: true });\n const indexPath = join(outputDir, \"index.ts\");\n await nodeFileSystem.writeFile(indexPath, registryContent);\n\n logger.info(` Generated index.ts with ${countTotalMessages(totals)} message(s)`);\n}\n\nasync function generateReexports(\n config: ContractsConfig,\n outputDir: string,\n results: ContextProcessingResult[],\n logger: Logger\n): Promise<void> {\n logger.info(\"\\n--- Generating re-exports for pathAliasRewrites ---\");\n\n const pathAliasRewrites = new Map(Object.entries(config.pathAliasRewrites!));\n const allCopiedFiles = results.flatMap((contextResult) => contextResult.result.copiedFiles);\n\n const generator = new ReexportGenerator({ fileSystem: nodeFileSystem });\n\n const reexportFiles = await generator.analyze({\n files: allCopiedFiles,\n pathAliasRewrites,\n });\n\n if (reexportFiles.length === 0) {\n logger.info(\" No re-export files needed\");\n return;\n }\n\n const generatedFiles = await generator.generate({\n outputDir,\n reexportFiles,\n });\n\n logger.info(` Generated ${generatedFiles.length} re-export file(s):`);\n for (const file of generatedFiles) {\n logger.info(` - ${relative(outputDir, file)}`);\n }\n}\n\nasync function main(): Promise<void> {\n try {\n await run(process.argv.slice(2));\n } catch (error) {\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n } else {\n console.error(\"Unknown error occurred\");\n }\n process.exit(EXIT_CODE_ERROR);\n }\n}\n\nif (process.argv[1] === fileURLToPath(import.meta.url)) {\n main();\n}\n","import type { HexaiCliPlugin, CliOption } from \"@hexaijs/cli\";\nimport {\n runWithConfig,\n ContractsPluginConfig,\n RunWithConfigOptions,\n} from \"./cli\";\nimport type { MessageType } from \"./domain/types\";\n\nconst VALID_MESSAGE_TYPES: MessageType[] = [\"event\", \"command\", \"query\"];\n\n/**\n * Parses comma-separated message types string into MessageType array.\n */\nfunction parseMessageTypes(value: string): MessageType[] {\n const types = value.split(\",\").map((type) => type.trim().toLowerCase());\n const invalidTypes = types.filter(\n (type) => !VALID_MESSAGE_TYPES.includes(type as MessageType)\n );\n\n if (invalidTypes.length > 0) {\n throw new Error(\n `Invalid message type(s): ${invalidTypes.join(\", \")}. ` +\n `Valid types are: ${VALID_MESSAGE_TYPES.join(\", \")}`\n );\n }\n\n return types as MessageType[];\n}\n\n/**\n * CLI plugin definition for hexai integration.\n *\n * This allows the contracts generator to be invoked via `pnpm hexai generate-contracts`.\n * Configuration is provided via hexai.config.ts.\n *\n * @example\n * ```bash\n * pnpm hexai generate-contracts -o packages/contracts/src\n * pnpm hexai generate-contracts -o packages/contracts/src -m event,command\n * ```\n */\nexport const cliPlugin: HexaiCliPlugin<ContractsPluginConfig> = {\n name: \"generate-contracts\",\n description:\n \"Extract domain events, commands, and queries from bounded contexts\",\n options: [\n {\n flags: \"-o, --output-dir <path>\",\n description: \"Output directory for generated contracts\",\n required: true,\n },\n {\n flags: \"-m, --message-types <types>\",\n description:\n \"Filter message types (comma-separated: event,command,query)\",\n },\n {\n flags: \"--generate-message-registry\",\n description: \"Generate message registry index.ts file\",\n },\n ] satisfies CliOption[],\n run: async (\n args: Record<string, unknown>,\n config: ContractsPluginConfig\n ): Promise<void> => {\n const options: RunWithConfigOptions = {\n outputDir: String(args.outputDir),\n messageTypes: args.messageTypes\n ? parseMessageTypes(String(args.messageTypes))\n : undefined,\n generateMessageRegistry: args.generateMessageRegistry === true,\n };\n\n await runWithConfig(options, config);\n },\n};\n","/**\n * Contracts Generator\n *\n * Extract Domain Events and Commands from TypeScript source code using decorators.\n *\n * @example\n * ```typescript\n * import { extract } from '@hexaijs/plugin-contracts-generator';\n *\n * const result = await extract({\n * sourceDir: 'packages',\n * outputDir: 'packages/contracts',\n * });\n *\n * console.log(`Extracted ${result.events.length} events and ${result.commands.length} commands`);\n * ```\n */\n\nexport type {\n SourceFile,\n TypeRef,\n PrimitiveType,\n ArrayType,\n ObjectType,\n UnionType,\n IntersectionType,\n ReferenceType,\n LiteralType,\n TupleType,\n FunctionType,\n FunctionParameter,\n Field,\n TypeDefinition,\n TypeDefinitionKind,\n EnumMember,\n EnumDefinition,\n ClassDefinition,\n ClassImport,\n Message,\n MessageBase,\n DomainEvent,\n Command,\n Dependency,\n DependencyKind,\n ImportSource,\n ExtractionResult,\n ExtractionError,\n ExtractionWarning,\n Config,\n} from \"./domain/types\";\n\nexport {\n isPrimitiveType,\n isArrayType,\n isObjectType,\n isUnionType,\n isIntersectionType,\n isReferenceType,\n isLiteralType,\n isTupleType,\n isFunctionType,\n isDomainEvent,\n isCommand,\n} from \"./domain/types\";\n\nexport {\n PublicEvent,\n PublicCommand,\n PublicQuery,\n type PublicEventOptions,\n type PublicCommandOptions,\n type PublicQueryOptions,\n} from \"@hexaijs/contracts/decorators\";\n\nexport { Scanner, type ScannerOptions } from \"./scanner\";\nexport { Parser, type ParseResult } from \"./parser\";\nexport { FileGraphResolver } from \"./file-graph-resolver\";\nexport { FileCopier } from \"./file-copier\";\nexport { ConfigLoader, resolveContextEntries, type ContractsConfig } from \"./config-loader\";\n\nexport {\n MessageParserError,\n ConfigurationError,\n ConfigLoadError,\n FileSystemError,\n FileNotFoundError,\n FileReadError,\n FileWriteError,\n ParseError,\n JsonParseError,\n ResolutionError,\n ModuleResolutionError,\n} from \"./errors\";\n\nexport {\n RegistryGenerator,\n type RegistryGeneratorOptions,\n type ContextMessages,\n} from \"./registry-generator\";\n\nexport {\n ReexportGenerator,\n type ReexportGeneratorOptions,\n type AnalyzeOptions,\n type GenerateOptions,\n type RewrittenImport,\n type ReexportFile,\n} from \"./reexport-generator\";\n\nimport { type FileSystem, nodeFileSystem } from \"./file-system\";\nimport { type Logger, noopLogger } from \"./logger\";\nimport { ContractsPipeline } from \"./pipeline\";\n\nexport type { FileSystem, FileStats } from \"./file-system\";\nexport { nodeFileSystem } from \"./file-system\";\n\nexport type { Logger, LogLevel, ConsoleLoggerOptions } from \"./logger\";\nexport { ConsoleLogger, noopLogger } from \"./logger\";\n\nexport {\n ContractsPipeline,\n type PipelineDependencies,\n type PipelineOptions,\n type PipelineResult,\n type ParsedMessages,\n} from \"./pipeline\";\n\nexport { ContextConfig, type InputContextConfig } from \"./context-config\";\n\nimport { ContextConfig } from \"./context-config\";\nimport type { ResponseNamingConvention, MessageType } from \"./domain/types\";\n\nexport interface ProcessContextOptions {\n contextName: string;\n path: string;\n sourceDir?: string;\n outputDir: string;\n pathAliasRewrites?: Map<string, string>;\n tsconfigPath?: string;\n responseNamingConventions?: readonly ResponseNamingConvention[];\n removeDecorators?: boolean;\n messageTypes?: MessageType[];\n fileSystem?: FileSystem;\n logger?: Logger;\n}\n\nexport interface ProcessContextResult {\n events: readonly import(\"./domain/types\").DomainEvent[];\n commands: readonly import(\"./domain/types\").Command[];\n queries: readonly import(\"./domain/types\").Query[];\n copiedFiles: string[];\n}\n\nexport async function processContext(\n options: ProcessContextOptions\n): Promise<ProcessContextResult> {\n const {\n contextName,\n path: contextPath,\n sourceDir,\n outputDir,\n pathAliasRewrites,\n tsconfigPath,\n responseNamingConventions,\n removeDecorators,\n messageTypes,\n fileSystem = nodeFileSystem,\n logger = noopLogger,\n } = options;\n\n const contextConfig = await ContextConfig.create(\n {\n name: contextName,\n path: contextPath,\n sourceDir,\n tsconfigPath,\n responseNamingConventions,\n },\n process.cwd(),\n fileSystem\n );\n\n return ContractsPipeline.create({\n contextConfig,\n responseNamingConventions,\n messageTypes,\n fileSystem,\n logger,\n }).execute({\n contextName,\n sourceDir: contextConfig.sourceDir,\n outputDir,\n pathAliasRewrites,\n removeDecorators,\n });\n}\n\n// Hexai CLI plugin integration\nexport { cliPlugin } from \"./hexai-plugin\";\n"]}
|