@alveolus/arch 0.0.0-stage → 0.1.0-alpha.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-CW1zAnrP.mjs","names":[],"sources":["../src/analysis/code-analyzer.ts","../src/codebase/code-class.ts","../src/codebase/code-file.ts","../src/codebase/codebase.ts","../src/codebase/core-api.ts","../src/codebase/declaration.ts","../src/codebase/import.ts","../src/codebase/location.ts","../src/codebase/layout.ts","../src/codebase/method.ts","../src/codebase/type-usage.ts","../src/analysis/class-reader.ts","../src/analysis/package-names.ts","../src/analysis/type-inspector.ts","../src/analysis/ts-morph-analyzer.ts","../src/baseline/baseline.ts","../src/checker/arch-checker.ts","../src/config/config.ts","../src/config/config-loader.ts","../src/report/report.ts","../src/rules/rule.ts","../src/rules/import-rule.ts","../src/rules/bc-isolation.rule.ts","../src/rules/building-blocks-only.rule.ts","../src/rules/class-rule.ts","../src/rules/command-query-separation.rule.ts","../src/rules/domain-purity.rule.ts","../src/rules/driven-adapters-extend-port.rule.ts","../src/rules/errors-as-values.rule.ts","../src/rules/layer-direction.rule.ts","../src/rules/place.ts","../src/rules/placement.rule.ts","../src/rules/reference-by-identity.rule.ts","../src/rules/rules.ts","../src/cli/cli.ts"],"sourcesContent":["import type { Codebase } from \"../codebase/index.ts\";\nimport type { Config } from \"../config/index.ts\";\n\nexport abstract class CodeAnalyzer {\n\tpublic abstract analyze(config: Config): Codebase;\n}\n","import type { CoreKind, CoreMarker } from \"./core-api.ts\";\nimport type { Method } from \"./method.ts\";\nimport type { TypeUsage } from \"./type-usage.ts\";\n\nexport interface CodeClassProps {\n\treadonly name: string;\n\treadonly line: number;\n\treadonly isAbstract: boolean;\n\treadonly kinds: readonly CoreKind[];\n\treadonly markers: readonly CoreMarker[];\n\treadonly constructorParameters: readonly TypeUsage[];\n\treadonly fields: readonly TypeUsage[];\n\treadonly publicMethods: readonly Method[];\n}\n\nexport class CodeClass {\n\tpublic readonly name: string;\n\tpublic readonly line: number;\n\tpublic readonly isAbstract: boolean;\n\tpublic readonly constructorParameters: readonly TypeUsage[];\n\tpublic readonly fields: readonly TypeUsage[];\n\tpublic readonly publicMethods: readonly Method[];\n\tprivate readonly kinds: readonly CoreKind[];\n\tprivate readonly markers: readonly CoreMarker[];\n\n\tpublic constructor(props: CodeClassProps) {\n\t\tthis.name = props.name;\n\t\tthis.line = props.line;\n\t\tthis.isAbstract = props.isAbstract;\n\t\tthis.kinds = props.kinds;\n\t\tthis.markers = props.markers;\n\t\tthis.constructorParameters = props.constructorParameters;\n\t\tthis.fields = props.fields;\n\t\tthis.publicMethods = props.publicMethods;\n\t}\n\n\tpublic is(kind: CoreKind): boolean {\n\t\treturn this.kinds.includes(kind);\n\t}\n\n\tpublic implements(marker: CoreMarker): boolean {\n\t\treturn this.markers.includes(marker);\n\t}\n\n\tpublic get extendsBuildingBlock(): boolean {\n\t\treturn this.kinds.length > 0;\n\t}\n\n\tpublic get hasMarker(): boolean {\n\t\treturn this.markers.length > 0;\n\t}\n}\n","import type { CodeClass } from \"./code-class.ts\";\nimport type { Declaration } from \"./declaration.ts\";\nimport type { Import } from \"./import.ts\";\nimport type { Location } from \"./location.ts\";\n\nexport interface CodeFileProps {\n\treadonly path: string;\n\treadonly location: Location;\n\treadonly imports: readonly Import[];\n\treadonly classes: readonly CodeClass[];\n\treadonly declarations: readonly Declaration[];\n\treadonly domainErrorThrows: readonly number[];\n}\n\nexport class CodeFile {\n\tpublic readonly path: string;\n\tpublic readonly location: Location;\n\tpublic readonly imports: readonly Import[];\n\tpublic readonly classes: readonly CodeClass[];\n\tpublic readonly declarations: readonly Declaration[];\n\tpublic readonly domainErrorThrows: readonly number[];\n\n\tpublic constructor(props: CodeFileProps) {\n\t\tthis.path = props.path;\n\t\tthis.location = props.location;\n\t\tthis.imports = props.imports;\n\t\tthis.classes = props.classes;\n\t\tthis.declarations = props.declarations;\n\t\tthis.domainErrorThrows = props.domainErrorThrows;\n\t}\n\n\tpublic declaresOpenHostService(name: string): boolean {\n\t\treturn this.classes.some((codeClass) => codeClass.name === name && codeClass.implements(\"OpenHostService\"));\n\t}\n\n\tpublic get declaresAntiCorruptionLayer(): boolean {\n\t\treturn this.classes.some((codeClass) => codeClass.implements(\"AntiCorruptionLayer\"));\n\t}\n}\n","import { relative, sep } from \"node:path\";\n\nimport type { Config } from \"../config/index.ts\";\nimport type { CodeFile } from \"./code-file.ts\";\n\nexport class Codebase {\n\tprivate readonly filesByPath: ReadonlyMap<string, CodeFile>;\n\n\tpublic constructor(\n\t\tpublic readonly files: readonly CodeFile[],\n\t\tpublic readonly config: Config,\n\t) {\n\t\tthis.filesByPath = new Map(files.map((file) => [file.path, file]));\n\t}\n\n\tpublic file(path: string): CodeFile | undefined {\n\t\treturn this.filesByPath.get(path);\n\t}\n\n\tpublic relativePath(path: string): string {\n\t\treturn relative(this.config.projectDir, path).split(sep).join(\"/\");\n\t}\n}\n","export type CoreKind =\n\t| \"AggregateRoot\"\n\t| \"Entity\"\n\t| \"ValueObject\"\n\t| \"Identifier\"\n\t| \"DomainEvent\"\n\t| \"DomainError\"\n\t| \"DomainService\"\n\t| \"Port\"\n\t| \"CommandRepository\"\n\t| \"QueryRepository\"\n\t| \"CommandHandler\"\n\t| \"QueryHandler\"\n\t| \"EventTranslator\"\n\t| \"EventPublisher\"\n\t| \"Outbox\"\n\t| \"UnitOfWork\";\n\nexport type CoreMarker = \"OpenHostService\" | \"AntiCorruptionLayer\";\n\nexport class CoreApi {\n\tpublic static readonly packageName = \"@alveolus/core\";\n\n\tprivate static readonly domainSymbols: ReadonlySet<string> = new Set([\n\t\t\"AggregateRoot\",\n\t\t\"AnyAggregateRoot\",\n\t\t\"AnyDomainError\",\n\t\t\"AnyDomainEvent\",\n\t\t\"AnyEntity\",\n\t\t\"AnyIdentifier\",\n\t\t\"AnySnapshot\",\n\t\t\"AnyValueObject\",\n\t\t\"Clock\",\n\t\t\"CommandRepository\",\n\t\t\"DomainError\",\n\t\t\"DomainEvent\",\n\t\t\"DomainEventProps\",\n\t\t\"DomainService\",\n\t\t\"Entity\",\n\t\t\"Err\",\n\t\t\"IdGenerator\",\n\t\t\"Identifier\",\n\t\t\"IdentifierValue\",\n\t\t\"Ok\",\n\t\t\"Port\",\n\t\t\"QueryRepository\",\n\t\t\"Result\",\n\t\t\"SnapshotValue\",\n\t\t\"ValueObject\",\n\t\t\"View\",\n\t\t\"andThen\",\n\t\t\"combine\",\n\t\t\"err\",\n\t\t\"map\",\n\t\t\"mapErr\",\n\t\t\"ok\",\n\t]);\n\n\tprivate static readonly publishedLanguageSymbols: ReadonlySet<string> = new Set([\"AnyIntegrationEvent\", \"IntegrationEvent\", \"JsonValue\", \"PublishedLanguage\"]);\n\n\tprivate static readonly markers: ReadonlySet<string> = new Set<CoreMarker>([\"OpenHostService\", \"AntiCorruptionLayer\"]);\n\n\tprivate static readonly kinds: ReadonlySet<string> = new Set<CoreKind>([\n\t\t\"AggregateRoot\",\n\t\t\"Entity\",\n\t\t\"ValueObject\",\n\t\t\"Identifier\",\n\t\t\"DomainEvent\",\n\t\t\"DomainError\",\n\t\t\"DomainService\",\n\t\t\"Port\",\n\t\t\"CommandRepository\",\n\t\t\"QueryRepository\",\n\t\t\"CommandHandler\",\n\t\t\"QueryHandler\",\n\t\t\"EventTranslator\",\n\t\t\"EventPublisher\",\n\t\t\"Outbox\",\n\t\t\"UnitOfWork\",\n\t]);\n\n\tpublic static isDomainSymbol(name: string): boolean {\n\t\treturn CoreApi.domainSymbols.has(name);\n\t}\n\n\tpublic static isPublishedLanguageSymbol(name: string): boolean {\n\t\treturn CoreApi.publishedLanguageSymbols.has(name);\n\t}\n\n\tpublic static isKind(name: string): name is CoreKind {\n\t\treturn CoreApi.kinds.has(name);\n\t}\n\n\tpublic static isMarker(name: string): name is CoreMarker {\n\t\treturn CoreApi.markers.has(name);\n\t}\n}\n","export type DeclarationKind = \"function\" | \"enum\";\n\nexport class Declaration {\n\tpublic constructor(\n\t\tpublic readonly kind: DeclarationKind,\n\t\tpublic readonly name: string,\n\t\tpublic readonly line: number,\n\t) {}\n}\n","import type { Location } from \"./location.ts\";\n\nexport type ImportTarget = { readonly kind: \"file\"; readonly path: string; readonly location: Location } | { readonly kind: \"package\"; readonly name: string };\n\nexport class Import {\n\tpublic constructor(\n\t\tpublic readonly line: number,\n\t\tpublic readonly specifier: string,\n\t\tpublic readonly names: readonly string[],\n\t\tpublic readonly target: ImportTarget,\n\t) {}\n\n\tpublic get label(): string {\n\t\treturn this.names.length === 0 ? this.specifier : this.names.join(\", \");\n\t}\n\n\tpublic isFromPackage(name: string): boolean {\n\t\treturn this.target.kind === \"package\" && this.target.name === name;\n\t}\n}\n","export type Layer = \"domain\" | \"application\" | \"published-language\" | \"driven\" | \"driving\";\n\nexport type Area = \"context\" | \"shared-kernel\" | \"root\" | \"outside\";\n\nexport interface LocationProps {\n\treadonly area: Area;\n\treadonly context?: string;\n\treadonly layer?: Layer;\n\treadonly folder?: string;\n\treadonly fileName: string;\n\treadonly isCompositionRoot?: boolean;\n}\n\nexport class Location {\n\tpublic readonly area: Area;\n\tpublic readonly context: string | undefined;\n\tpublic readonly layer: Layer | undefined;\n\tpublic readonly folder: string | undefined;\n\tpublic readonly fileName: string;\n\tpublic readonly isCompositionRoot: boolean;\n\n\tpublic constructor(props: LocationProps) {\n\t\tthis.area = props.area;\n\t\tthis.context = props.context;\n\t\tthis.layer = props.layer;\n\t\tthis.folder = props.folder;\n\t\tthis.fileName = props.fileName;\n\t\tthis.isCompositionRoot = props.isCompositionRoot ?? false;\n\t}\n\n\tpublic get isInBoundedContext(): boolean {\n\t\treturn this.area === \"context\";\n\t}\n\n\tpublic get isInSharedKernel(): boolean {\n\t\treturn this.area === \"shared-kernel\";\n\t}\n\n\tpublic get isAtRoot(): boolean {\n\t\treturn this.area === \"root\";\n\t}\n\n\tpublic get isOutside(): boolean {\n\t\treturn this.area === \"outside\";\n\t}\n\n\tpublic get isInLayer(): boolean {\n\t\treturn this.layer !== undefined;\n\t}\n\n\tpublic isSameContextAs(other: Location): boolean {\n\t\treturn this.context !== undefined && this.context === other.context;\n\t}\n\n\tpublic isOtherBoundedContextThan(other: Location): boolean {\n\t\treturn this.isInBoundedContext && !this.isSameContextAs(other);\n\t}\n\n\tpublic describe(): string {\n\t\tif (this.isOutside) {\n\t\t\treturn \"outside the declared bounded contexts and shared kernel\";\n\t\t}\n\t\tif (this.isAtRoot) {\n\t\t\treturn \"at the root\";\n\t\t}\n\t\tconst role = this.isCompositionRoot ? \"composition root\" : (this.layer ?? \"outside the layers\");\n\t\treturn `${this.context} ${role}`;\n\t}\n}\n","import { basename, dirname, isAbsolute, matchesGlob, relative, sep } from \"node:path\";\n\nimport type { Config, ContextFolder } from \"../config/index.ts\";\nimport type { Layer } from \"./location.ts\";\nimport { Location } from \"./location.ts\";\n\nconst layers: ReadonlySet<string> = new Set<Layer>([\"domain\", \"application\", \"published-language\", \"driven\", \"driving\"]);\n\nexport class Layout {\n\tpublic constructor(private readonly config: Config) {}\n\n\tpublic locate(path: string): Location {\n\t\tconst fileName = basename(path);\n\t\tconst folder = this.contextFolderOf(path);\n\n\t\tif (folder === undefined) {\n\t\t\tconst isAtRoot = dirname(path) === this.config.rootDir;\n\t\t\treturn new Location({ area: isAtRoot ? \"root\" : \"outside\", fileName });\n\t\t}\n\n\t\tconst area = folder.isSharedKernel ? \"shared-kernel\" : \"context\";\n\t\tconst context = folder.name;\n\t\tconst directories = this.directoriesBetween(folder.dir, path);\n\n\t\tif (directories.length === 0) {\n\t\t\treturn new Location({ area, context, fileName, isCompositionRoot: this.isCompositionRoot(fileName) });\n\t\t}\n\n\t\tconst layerIndex = directories.findIndex((directory) => layers.has(directory));\n\t\tif (layerIndex === -1) {\n\t\t\tconst isFeatureRoot = folder.isSharedKernel && directories.length === 1;\n\t\t\treturn new Location({ area, context, fileName, isCompositionRoot: isFeatureRoot && this.isCompositionRoot(fileName) });\n\t\t}\n\n\t\tconst layer = directories[layerIndex] as Layer;\n\t\tconst subfolder = directories.length - 1 > layerIndex ? directories.at(-1) : undefined;\n\t\treturn new Location({ area, context, fileName, layer, ...(subfolder === undefined ? {} : { folder: subfolder }) });\n\t}\n\n\tprivate isCompositionRoot(fileName: string): boolean {\n\t\treturn matchesGlob(fileName, this.config.compositionRoot);\n\t}\n\n\tprivate contextFolderOf(path: string): ContextFolder | undefined {\n\t\tconst containing = this.config.contextFolders.filter((folder) => this.isInside(folder.dir, path));\n\t\treturn containing.sort((left, right) => right.dir.length - left.dir.length)[0];\n\t}\n\n\tprivate directoriesBetween(dir: string, path: string): string[] {\n\t\tconst between = relative(dir, dirname(path));\n\t\treturn between === \"\" ? [] : between.split(sep);\n\t}\n\n\tprivate isInside(dir: string, path: string): boolean {\n\t\tconst offset = relative(dir, path);\n\t\treturn offset !== \"\" && !offset.startsWith(\"..\") && !isAbsolute(offset);\n\t}\n}\n","export class Method {\n\tpublic constructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly line: number,\n\t\tpublic readonly returnsResult: boolean,\n\t) {}\n}\n","import type { CoreKind } from \"./core-api.ts\";\n\nexport class TypeUsage {\n\tpublic constructor(\n\t\tpublic readonly member: string,\n\t\tpublic readonly line: number,\n\t\tpublic readonly typeName: string,\n\t\tprivate readonly kinds: readonly CoreKind[],\n\t) {}\n\n\tpublic is(kind: CoreKind): boolean {\n\t\treturn this.kinds.includes(kind);\n\t}\n}\n","import { Scope } from \"ts-morph\";\nimport type { ClassDeclaration, ParameterDeclaration, PropertyDeclaration } from \"ts-morph\";\n\nimport type { CoreMarker } from \"../codebase/index.ts\";\nimport { CodeClass, Method, TypeUsage } from \"../codebase/index.ts\";\nimport type { TypeInspector } from \"./type-inspector.ts\";\n\nexport class ClassReader {\n\tpublic constructor(private readonly types: TypeInspector) {}\n\n\tpublic read(declaration: ClassDeclaration): CodeClass {\n\t\tconst parameters = declaration.getConstructors()[0]?.getParameters() ?? [];\n\t\tconst parameterProperties = parameters.filter((parameter) => parameter.isParameterProperty());\n\n\t\treturn new CodeClass({\n\t\t\tconstructorParameters: parameters.flatMap((parameter) => this.usagesOf(parameter)),\n\t\t\tfields: [...declaration.getProperties(), ...parameterProperties].flatMap((member) => this.usagesOf(member)),\n\t\t\tisAbstract: declaration.isAbstract(),\n\t\t\tkinds: this.types.kindsOf(declaration.getType()),\n\t\t\tline: declaration.getStartLineNumber(),\n\t\t\tmarkers: this.markersOf(declaration),\n\t\t\tname: declaration.getName() ?? \"default\",\n\t\t\tpublicMethods: this.publicMethodsOf(declaration),\n\t\t});\n\t}\n\n\tprivate markersOf(declaration: ClassDeclaration): CoreMarker[] {\n\t\tconst markers: CoreMarker[] = [];\n\t\tfor (const clause of declaration.getImplements()) {\n\t\t\tconst marker = this.types.markerOf(clause.getType());\n\t\t\tif (marker !== undefined) {\n\t\t\t\tmarkers.push(marker);\n\t\t\t}\n\t\t}\n\t\treturn markers;\n\t}\n\n\tprivate publicMethodsOf(declaration: ClassDeclaration): Method[] {\n\t\treturn declaration\n\t\t\t.getMethods()\n\t\t\t.filter((method) => !method.isStatic() && method.getScope() === Scope.Public)\n\t\t\t.map((method) => new Method(method.getName(), method.getStartLineNumber(), this.types.isResult(method.getReturnType())));\n\t}\n\n\tprivate usagesOf(member: PropertyDeclaration | ParameterDeclaration): TypeUsage[] {\n\t\treturn this.types\n\t\t\t.classTypesIn(member.getType())\n\t\t\t.map((type) => new TypeUsage(member.getName(), member.getStartLineNumber(), type.getSymbol()?.getName() ?? type.getText(), this.types.kindsOf(type)));\n\t}\n}\n","import type { FileSystemHost } from \"ts-morph\";\n\nimport { dirname, join } from \"node:path\";\n\nexport class PackageNames {\n\tprivate readonly cache = new Map<string, string | undefined>();\n\n\tpublic constructor(private readonly fileSystem: FileSystemHost) {}\n\n\tpublic ofFile(path: string): string | undefined {\n\t\treturn this.ofDirectory(dirname(path));\n\t}\n\n\tprivate ofDirectory(directory: string): string | undefined {\n\t\tif (this.cache.has(directory)) {\n\t\t\treturn this.cache.get(directory);\n\t\t}\n\t\tconst name = this.readManifest(directory) ?? this.ofParent(directory);\n\t\tthis.cache.set(directory, name);\n\t\treturn name;\n\t}\n\n\tprivate ofParent(directory: string): string | undefined {\n\t\tconst parent = dirname(directory);\n\t\treturn parent === directory ? undefined : this.ofDirectory(parent);\n\t}\n\n\tprivate readManifest(directory: string): string | undefined {\n\t\tconst manifest = join(directory, \"package.json\");\n\t\tif (!this.fileSystem.fileExistsSync(manifest)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst content: { name?: unknown } = JSON.parse(this.fileSystem.readFileSync(manifest));\n\t\treturn typeof content.name === \"string\" ? content.name : undefined;\n\t}\n}\n","import type { Symbol as MorphSymbol, Type } from \"ts-morph\";\n\nimport type { CoreKind, CoreMarker } from \"../codebase/index.ts\";\nimport { CoreApi } from \"../codebase/index.ts\";\nimport type { PackageNames } from \"./package-names.ts\";\n\nconst containers: ReadonlySet<string> = new Set([\"Array\", \"ReadonlyArray\", \"Map\", \"ReadonlyMap\", \"Set\", \"ReadonlySet\", \"Readonly\", \"Promise\"]);\n\nexport class TypeInspector {\n\tpublic constructor(private readonly packageNames: PackageNames) {}\n\n\tpublic kindsOf(type: Type): CoreKind[] {\n\t\tconst classType = type.getTargetType() ?? type;\n\t\tconst symbol = classType.getSymbol();\n\t\tif (symbol === undefined || !classType.isClass()) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst kinds: CoreKind[] = [];\n\t\tconst name = symbol.getName();\n\t\tif (CoreApi.isKind(name) && this.isCore(symbol)) {\n\t\t\tkinds.push(name);\n\t\t}\n\t\tfor (const base of classType.getBaseTypes()) {\n\t\t\tkinds.push(...this.kindsOf(base));\n\t\t}\n\t\treturn kinds;\n\t}\n\n\tpublic markerOf(type: Type): CoreMarker | undefined {\n\t\tconst symbol = type.getSymbol();\n\t\tif (symbol === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst name = symbol.getName();\n\t\treturn CoreApi.isMarker(name) && this.isCore(symbol) ? name : undefined;\n\t}\n\n\tpublic isResult(type: Type): boolean {\n\t\tconst alias = type.getAliasSymbol();\n\t\tif (alias !== undefined && alias.getName() === \"Result\" && this.isCore(alias)) {\n\t\t\treturn true;\n\t\t}\n\t\tconst members = type.isUnion() ? type.getUnionTypes() : [type];\n\t\treturn members.every((member) => this.isOkOrErr(member));\n\t}\n\n\tpublic classTypesIn(type: Type): Type[] {\n\t\tif (type.isUnion()) {\n\t\t\treturn type.getUnionTypes().flatMap((member) => this.classTypesIn(member));\n\t\t}\n\t\tif (type.isIntersection()) {\n\t\t\treturn type.getIntersectionTypes().flatMap((member) => this.classTypesIn(member));\n\t\t}\n\t\tconst element = type.getArrayElementType();\n\t\tif (element !== undefined) {\n\t\t\treturn this.classTypesIn(element);\n\t\t}\n\t\tif (this.isContainer(type)) {\n\t\t\treturn [...type.getTypeArguments(), ...type.getAliasTypeArguments()].flatMap((argument) => this.classTypesIn(argument));\n\t\t}\n\t\treturn type.isClass() ? [type] : [];\n\t}\n\n\tprivate isContainer(type: Type): boolean {\n\t\tconst name = type.getSymbol()?.getName() ?? type.getAliasSymbol()?.getName();\n\t\treturn name !== undefined && containers.has(name);\n\t}\n\n\tprivate isOkOrErr(type: Type): boolean {\n\t\tconst symbol = type.getSymbol();\n\t\tif (symbol === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tconst name = symbol.getName();\n\t\treturn (name === \"Ok\" || name === \"Err\") && this.isCore(symbol);\n\t}\n\n\tprivate isCore(symbol: MorphSymbol): boolean {\n\t\tconst declaration = symbol.getDeclarations()[0];\n\t\tif (declaration === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.packageNames.ofFile(declaration.getSourceFile().getFilePath()) === CoreApi.packageName;\n\t}\n}\n","import { Project, SyntaxKind } from \"ts-morph\";\nimport type { ExportDeclaration, ImportDeclaration, SourceFile } from \"ts-morph\";\n\nimport { isAbsolute, join, relative } from \"node:path\";\n\nimport type { ImportTarget } from \"../codebase/index.ts\";\nimport { Codebase, CodeFile, Declaration, Import, Layout } from \"../codebase/index.ts\";\nimport type { Config } from \"../config/index.ts\";\nimport { ClassReader } from \"./class-reader.ts\";\nimport { CodeAnalyzer } from \"./code-analyzer.ts\";\nimport { PackageNames } from \"./package-names.ts\";\nimport { TypeInspector } from \"./type-inspector.ts\";\n\ntype ModuleDeclaration = ImportDeclaration | ExportDeclaration;\n\nexport class TsMorphAnalyzer extends CodeAnalyzer {\n\tprivate readonly types: TypeInspector;\n\tprivate readonly classes: ClassReader;\n\n\tpublic constructor(private readonly project: Project) {\n\t\tsuper();\n\t\tthis.types = new TypeInspector(new PackageNames(project.getFileSystem()));\n\t\tthis.classes = new ClassReader(this.types);\n\t}\n\n\tpublic static fromTsConfig(projectDir: string): TsMorphAnalyzer {\n\t\treturn new TsMorphAnalyzer(new Project({ tsConfigFilePath: join(projectDir, \"tsconfig.json\") }));\n\t}\n\n\tpublic analyze(config: Config): Codebase {\n\t\tconst layout = new Layout(config);\n\t\tconst files = this.project\n\t\t\t.getSourceFiles()\n\t\t\t.filter((file) => this.isInside(config.rootDir, file.getFilePath()) && !config.isIgnored(file.getFilePath()))\n\t\t\t.map((file) => this.read(file, config, layout));\n\t\treturn new Codebase(files, config);\n\t}\n\n\tprivate read(file: SourceFile, config: Config, layout: Layout): CodeFile {\n\t\tconst path = file.getFilePath();\n\t\tconst imports = this.moduleDeclarationsOf(file).map((declaration) => this.readImport(declaration, config, layout));\n\t\tconst classes = file.getClasses().map((declaration) => this.classes.read(declaration));\n\t\treturn new CodeFile({\n\t\t\tclasses,\n\t\t\tdeclarations: this.declarationsOf(file),\n\t\t\tdomainErrorThrows: this.domainErrorThrowsOf(file),\n\t\t\timports,\n\t\t\tlocation: layout.locate(path),\n\t\t\tpath,\n\t\t});\n\t}\n\n\tprivate declarationsOf(file: SourceFile): Declaration[] {\n\t\tconst functions = file.getFunctions().map((declaration) => new Declaration(\"function\", declaration.getName() ?? \"default\", declaration.getStartLineNumber()));\n\t\tconst functionConstants = file\n\t\t\t.getVariableDeclarations()\n\t\t\t.filter((declaration) => declaration.getInitializerIfKind(SyntaxKind.ArrowFunction) !== undefined || declaration.getInitializerIfKind(SyntaxKind.FunctionExpression) !== undefined)\n\t\t\t.map((declaration) => new Declaration(\"function\", declaration.getName(), declaration.getStartLineNumber()));\n\t\tconst enums = file.getEnums().map((declaration) => new Declaration(\"enum\", declaration.getName(), declaration.getStartLineNumber()));\n\t\treturn [...functions, ...functionConstants, ...enums];\n\t}\n\n\tprivate moduleDeclarationsOf(file: SourceFile): ModuleDeclaration[] {\n\t\tconst reexports = file.getExportDeclarations().filter((declaration) => declaration.hasModuleSpecifier());\n\t\treturn [...file.getImportDeclarations(), ...reexports];\n\t}\n\n\tprivate readImport(declaration: ModuleDeclaration, config: Config, layout: Layout): Import {\n\t\tconst specifier = declaration.getModuleSpecifierValue() ?? \"\";\n\t\treturn new Import(declaration.getStartLineNumber(), specifier, this.importedNames(declaration), this.targetOf(declaration, specifier, config, layout));\n\t}\n\n\tprivate importedNames(declaration: ModuleDeclaration): string[] {\n\t\tif (declaration.isKind(SyntaxKind.ExportDeclaration)) {\n\t\t\treturn declaration.isNamespaceExport() ? [\"*\"] : declaration.getNamedExports().map((named) => named.getName());\n\t\t}\n\t\tconst names = declaration.getNamedImports().map((named) => named.getName());\n\t\tif (declaration.getDefaultImport() !== undefined) {\n\t\t\tnames.unshift(\"default\");\n\t\t}\n\t\tif (declaration.getNamespaceImport() !== undefined) {\n\t\t\tnames.unshift(\"*\");\n\t\t}\n\t\treturn names;\n\t}\n\n\tprivate targetOf(declaration: ModuleDeclaration, specifier: string, config: Config, layout: Layout): ImportTarget {\n\t\tconst resolved = declaration.getModuleSpecifierSourceFile()?.getFilePath();\n\t\tif (resolved !== undefined && this.isInside(config.projectDir, resolved)) {\n\t\t\treturn { kind: \"file\", location: layout.locate(resolved), path: resolved };\n\t\t}\n\t\tif (specifier.startsWith(\".\")) {\n\t\t\tconst path = join(declaration.getSourceFile().getDirectoryPath(), specifier);\n\t\t\treturn { kind: \"file\", location: layout.locate(path), path };\n\t\t}\n\t\treturn { kind: \"package\", name: this.packageNameOf(specifier) };\n\t}\n\n\tprivate packageNameOf(specifier: string): string {\n\t\tconst segments = specifier.split(\"/\");\n\t\tconst length = specifier.startsWith(\"@\") ? 2 : 1;\n\t\treturn segments.slice(0, length).join(\"/\");\n\t}\n\n\tprivate domainErrorThrowsOf(file: SourceFile): number[] {\n\t\treturn file\n\t\t\t.getDescendantsOfKind(SyntaxKind.ThrowStatement)\n\t\t\t.filter((statement) => this.types.kindsOf(statement.getExpression().getType()).includes(\"DomainError\"))\n\t\t\t.map((statement) => statement.getStartLineNumber());\n\t}\n\n\tprivate isInside(directory: string, path: string): boolean {\n\t\tconst offset = relative(directory, path);\n\t\treturn offset !== \"\" && !offset.startsWith(\"..\") && !isAbsolute(offset) && !offset.split(/[\\\\/]/).includes(\"node_modules\");\n\t}\n}\n","import { existsSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\n\nimport type { Violation } from \"../rules/index.ts\";\n\ntype Entry = Pick<Violation, \"rule\" | \"file\" | \"symbol\">;\n\nexport class Baseline {\n\tpublic static readonly fileName = \"alveolus.baseline.json\";\n\n\tprivate constructor(private readonly entries: readonly Entry[]) {}\n\n\tpublic static of(violations: readonly Violation[]): Baseline {\n\t\treturn new Baseline(violations.map(({ file, rule, symbol }) => ({ file, rule, symbol })));\n\t}\n\n\tpublic static async load(path: string): Promise<Baseline> {\n\t\tif (!existsSync(path)) {\n\t\t\treturn new Baseline([]);\n\t\t}\n\t\tconst content: { violations?: Entry[] } = JSON.parse(await readFile(path, \"utf8\"));\n\t\treturn new Baseline(content.violations ?? []);\n\t}\n\n\tpublic newViolations(violations: readonly Violation[]): Violation[] {\n\t\tconst remaining = new Map<string, number>();\n\t\tfor (const entry of this.entries) {\n\t\t\tremaining.set(this.keyOf(entry), (remaining.get(this.keyOf(entry)) ?? 0) + 1);\n\t\t}\n\n\t\tconst fresh: Violation[] = [];\n\t\tfor (const violation of violations) {\n\t\t\tconst key = this.keyOf(violation);\n\t\t\tconst count = remaining.get(key) ?? 0;\n\t\t\tif (count > 0) {\n\t\t\t\tremaining.set(key, count - 1);\n\t\t\t} else {\n\t\t\t\tfresh.push(violation);\n\t\t\t}\n\t\t}\n\t\treturn fresh;\n\t}\n\n\tpublic async save(path: string): Promise<void> {\n\t\tconst violations = [...this.entries].sort((left, right) => this.keyOf(left).localeCompare(this.keyOf(right)));\n\t\tawait writeFile(path, `${JSON.stringify({ violations }, null, \"\\t\")}\\n`);\n\t}\n\n\tprivate keyOf(entry: Entry): string {\n\t\treturn [entry.rule, entry.file, entry.symbol].join(\"\\n\");\n\t}\n}\n","import type { CodeAnalyzer } from \"../analysis/index.ts\";\nimport type { Config } from \"../config/index.ts\";\nimport type { Rule, Violation } from \"../rules/index.ts\";\n\nexport class ArchChecker {\n\tpublic constructor(\n\t\tprivate readonly analyzer: CodeAnalyzer,\n\t\tprivate readonly rules: readonly Rule[],\n\t) {}\n\n\tpublic check(config: Config): Violation[] {\n\t\tconst codebase = this.analyzer.analyze(config);\n\t\tconst enabled = this.rules.filter((rule) => config.isEnabled(rule.id));\n\t\treturn enabled.flatMap((rule) => rule.check(codebase)).sort((left, right) => this.compare(left, right));\n\t}\n\n\tprivate compare(left: Violation, right: Violation): number {\n\t\treturn left.file.localeCompare(right.file) || left.line - right.line || left.rule.localeCompare(right.rule);\n\t}\n}\n","import { matchesGlob, relative, resolve, sep } from \"node:path\";\n\nimport type { AlveolusConfig, RuleId } from \"./alveolus-config.ts\";\n\nexport interface ContextFolder {\n\treadonly name: string;\n\treadonly dir: string;\n\treadonly isSharedKernel: boolean;\n}\n\nconst testFiles: readonly string[] = [\"**/*.spec.ts\", \"**/*.test.ts\", \"**/__tests__/**\"];\n\nexport class Config {\n\tpublic readonly projectDir: string;\n\tpublic readonly rootDir: string;\n\tpublic readonly compositionRoot: string;\n\tpublic readonly domainDependencies: readonly string[];\n\tpublic readonly contextFolders: readonly ContextFolder[];\n\tprivate readonly ignored: readonly string[];\n\tprivate readonly rules: AlveolusConfig[\"rules\"];\n\n\tpublic constructor(config: AlveolusConfig, projectDir: string) {\n\t\tthis.projectDir = resolve(projectDir);\n\t\tthis.rootDir = resolve(projectDir, config.root);\n\t\tthis.compositionRoot = config.compositionRoot ?? \"*.module.ts\";\n\t\tthis.domainDependencies = config.domainDependencies ?? [];\n\t\tthis.ignored = [...testFiles, ...(config.ignore ?? [])];\n\t\tthis.rules = config.rules;\n\n\t\tconst sharedKernel = config.sharedKernel ?? \"shared-kernel\";\n\t\tthis.contextFolders = [\n\t\t\t...Object.entries(config.boundedContexts).map(([name, folder]) => ({ dir: resolve(this.rootDir, folder), isSharedKernel: false, name })),\n\t\t\t{ dir: resolve(this.rootDir, sharedKernel), isSharedKernel: true, name: \"shared kernel\" },\n\t\t];\n\t}\n\n\tpublic isIgnored(path: string): boolean {\n\t\tconst projectPath = relative(this.projectDir, path).split(sep).join(\"/\");\n\t\treturn this.ignored.some((glob) => matchesGlob(projectPath, glob));\n\t}\n\n\tpublic isEnabled(rule: RuleId): boolean {\n\t\treturn this.rules?.[rule] !== \"off\";\n\t}\n}\n","import { createJiti } from \"jiti\";\nimport { z } from \"zod\";\n\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport type { AlveolusConfig } from \"./alveolus-config.ts\";\nimport { Config } from \"./config.ts\";\n\nconst ruleSetting = z.enum([\"error\", \"off\"]);\n\nconst schema = z.strictObject({\n\tboundedContexts: z.record(z.string(), z.string()),\n\tcompositionRoot: z.string().exactOptional(),\n\tdomainDependencies: z.array(z.string()).exactOptional(),\n\tignore: z.array(z.string()).exactOptional(),\n\troot: z.string(),\n\trules: z\n\t\t.strictObject({\n\t\t\t\"bc-isolation\": ruleSetting.exactOptional(),\n\t\t\t\"building-blocks-only\": ruleSetting.exactOptional(),\n\t\t\t\"command-query-separation\": ruleSetting.exactOptional(),\n\t\t\t\"domain-purity\": ruleSetting.exactOptional(),\n\t\t\t\"driven-adapters-extend-port\": ruleSetting.exactOptional(),\n\t\t\t\"errors-as-values\": ruleSetting.exactOptional(),\n\t\t\t\"layer-direction\": ruleSetting.exactOptional(),\n\t\t\tplacement: ruleSetting.exactOptional(),\n\t\t\t\"reference-by-identity\": ruleSetting.exactOptional(),\n\t\t})\n\t\t.exactOptional(),\n\tsharedKernel: z.string().exactOptional(),\n});\n\nexport class ConfigLoader {\n\tpublic static readonly fileName = \"alveolus.config.ts\";\n\n\tpublic async load(projectDir: string, configFile: string = ConfigLoader.fileName): Promise<Config> {\n\t\tconst path = resolve(projectDir, configFile);\n\t\tif (!existsSync(path)) {\n\t\t\tthrow new Error(`No configuration found at ${path}.`);\n\t\t}\n\t\tconst exported = await createJiti(import.meta.url).import(path, { default: true });\n\t\treturn new Config(this.validate(exported, path), projectDir);\n\t}\n\n\tprivate validate(exported: unknown, path: string): AlveolusConfig {\n\t\tconst parsed = schema.safeParse(exported);\n\t\tif (!parsed.success) {\n\t\t\tthrow new Error(`Invalid configuration in ${path}:\\n${z.prettifyError(parsed.error)}`);\n\t\t}\n\t\treturn parsed.data;\n\t}\n}\n","import picocolors from \"picocolors\";\n\nimport type { Violation } from \"../rules/index.ts\";\n\nexport class Report {\n\tprivate readonly colors: ReturnType<typeof picocolors.createColors>;\n\n\tpublic constructor(\n\t\tprivate readonly violations: readonly Violation[],\n\t\tprivate readonly baselined: number,\n\t\tcolored = false,\n\t) {\n\t\tthis.colors = picocolors.createColors(colored);\n\t}\n\n\tpublic text(): string {\n\t\tconst blocks = this.violations.map((violation) => this.block(violation));\n\t\treturn `${[...blocks, this.summary()].join(\"\\n\\n\")}\\n`;\n\t}\n\n\tpublic json(): string {\n\t\treturn `${JSON.stringify({ baselined: this.baselined, violations: this.violations }, null, \"\\t\")}\\n`;\n\t}\n\n\tprivate block(violation: Violation): string {\n\t\tconst { bold, red } = this.colors;\n\t\treturn `${bold(`${violation.file}:${violation.line}`)}\\n ${red(violation.rule)}: ${violation.message}`;\n\t}\n\n\tprivate summary(): string {\n\t\tconst { dim, green, red } = this.colors;\n\t\tconst count = this.violations.length;\n\t\tconst baselined = this.baselined > 0 ? dim(` (${this.baselined} in the baseline)`) : \"\";\n\t\tif (count === 0) {\n\t\t\treturn `${green(\"No violation\")}${baselined}`;\n\t\t}\n\t\treturn `${red(`${count} violation${count === 1 ? \"\" : \"s\"}`)}${baselined}`;\n\t}\n}\n","import type { Codebase, CodeFile } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport type { Violation } from \"./violation.ts\";\n\nexport abstract class Rule {\n\tpublic abstract readonly id: RuleId;\n\n\tpublic abstract check(codebase: Codebase): Violation[];\n\n\tprotected violation(codebase: Codebase, file: CodeFile, problem: Problem): Violation {\n\t\treturn { file: codebase.relativePath(file.path), line: problem.line, message: problem.message, rule: this.id, symbol: problem.symbol };\n\t}\n}\n","import type { Codebase, CodeFile, Import } from \"../codebase/index.ts\";\nimport { Rule } from \"./rule.ts\";\nimport type { Violation } from \"./violation.ts\";\n\nexport abstract class ImportRule extends Rule {\n\tpublic check(codebase: Codebase): Violation[] {\n\t\tconst violations: Violation[] = [];\n\t\tfor (const file of codebase.files) {\n\t\t\tif (!this.appliesTo(file)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const imported of file.imports) {\n\t\t\t\tconst message = this.problemWith(imported, file, codebase);\n\t\t\t\tif (message !== undefined) {\n\t\t\t\t\tviolations.push(this.violation(codebase, file, { line: imported.line, message, symbol: imported.label }));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn violations;\n\t}\n\n\tprotected describeTarget(imported: Import, codebase: Codebase): string {\n\t\tif (imported.target.kind === \"package\") {\n\t\t\treturn imported.target.name;\n\t\t}\n\t\treturn `${codebase.relativePath(imported.target.path)} (${imported.target.location.describe()})`;\n\t}\n\n\tprotected abstract appliesTo(file: CodeFile): boolean;\n\n\tprotected abstract problemWith(imported: Import, file: CodeFile, codebase: Codebase): string | undefined;\n}\n","import type { Codebase, CodeFile, Import } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport { ImportRule } from \"./import-rule.ts\";\n\nexport class BcIsolationRule extends ImportRule {\n\tpublic readonly id: RuleId = \"bc-isolation\";\n\n\tprotected appliesTo(file: CodeFile): boolean {\n\t\treturn file.location.isInBoundedContext || file.location.isInSharedKernel;\n\t}\n\n\tprotected problemWith(imported: Import, file: CodeFile, codebase: Codebase): string | undefined {\n\t\tif (imported.target.kind !== \"file\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst from = file.location;\n\t\tconst to = imported.target.location;\n\n\t\tif (!to.isOtherBoundedContextThan(from)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (from.isInSharedKernel) {\n\t\t\treturn `The shared kernel imports no bounded context, but imports ${this.describeTarget(imported, codebase)}.`;\n\t\t}\n\t\tif (from.isCompositionRoot && to.isCompositionRoot) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (to.layer === \"published-language\") {\n\t\t\treturn `Imports the published language of ${to.context}: redeclare the fields you read in your own published-language/.`;\n\t\t}\n\t\tif (!this.importsOnlyOpenHostServices(imported, codebase)) {\n\t\t\treturn `Imports ${this.describeTarget(imported, codebase)}: only an OpenHostService of another bounded context may be imported.`;\n\t\t}\n\t\tif (!from.isCompositionRoot && !file.declaresAntiCorruptionLayer) {\n\t\t\treturn `Uses the open host service of ${to.context} outside an AntiCorruptionLayer: translate it in an anti-corruption layer.`;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate importsOnlyOpenHostServices(imported: Import, codebase: Codebase): boolean {\n\t\tif (imported.target.kind !== \"file\" || imported.names.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tconst target = codebase.file(imported.target.path);\n\t\treturn target !== undefined && imported.names.every((name) => target.declaresOpenHostService(name));\n\t}\n}\n","import type { Codebase, CodeFile, Layer } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { Rule } from \"./rule.ts\";\nimport type { Violation } from \"./violation.ts\";\n\nconst guarded: ReadonlySet<Layer | undefined> = new Set<Layer>([\"domain\", \"application\"]);\n\nconst blocksOf: Readonly<Record<string, string>> = {\n\tapplication: \"CommandHandler, QueryHandler or EventTranslator\",\n\tdomain: \"AggregateRoot, Entity, ValueObject, Identifier, DomainEvent, DomainError, DomainService or a Port\",\n};\n\nexport class BuildingBlocksOnlyRule extends Rule {\n\tpublic readonly id: RuleId = \"building-blocks-only\";\n\n\tpublic check(codebase: Codebase): Violation[] {\n\t\tconst violations: Violation[] = [];\n\t\tfor (const file of codebase.files) {\n\t\t\tif (!guarded.has(file.location.layer)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const problem of [...this.plainClasses(file), ...this.freeDeclarations(file)]) {\n\t\t\t\tviolations.push(this.violation(codebase, file, problem));\n\t\t\t}\n\t\t}\n\t\treturn violations;\n\t}\n\n\tprivate plainClasses(file: CodeFile): Problem[] {\n\t\tconst blocks = blocksOf[file.location.layer ?? \"\"];\n\t\treturn file.classes\n\t\t\t.filter((codeClass) => !codeClass.extendsBuildingBlock)\n\t\t\t.map((codeClass) => ({ line: codeClass.line, message: `${codeClass.name} extends no building block: extend ${blocks}.`, symbol: codeClass.name }));\n\t}\n\n\tprivate freeDeclarations(file: CodeFile): Problem[] {\n\t\treturn file.declarations.map((declaration) => {\n\t\t\tif (declaration.kind === \"enum\") {\n\t\t\t\treturn { line: declaration.line, message: `The enum ${declaration.name} has no place here: use a union of literal types, or a ValueObject when it has behaviour.`, symbol: declaration.name };\n\t\t\t}\n\t\t\treturn { line: declaration.line, message: `The function ${declaration.name} floats outside any class: make it a method of a value object or of a DomainService.`, symbol: declaration.name };\n\t\t});\n\t}\n}\n","import type { Codebase, CodeClass, CodeFile } from \"../codebase/index.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { Rule } from \"./rule.ts\";\nimport type { Violation } from \"./violation.ts\";\n\nexport abstract class ClassRule extends Rule {\n\tpublic check(codebase: Codebase): Violation[] {\n\t\tconst violations: Violation[] = [];\n\t\tfor (const file of codebase.files) {\n\t\t\tfor (const codeClass of file.classes) {\n\t\t\t\tfor (const problem of this.problemsWith(codeClass, file)) {\n\t\t\t\t\tviolations.push(this.violation(codebase, file, problem));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn violations;\n\t}\n\n\tprotected abstract problemsWith(codeClass: CodeClass, file: CodeFile): Problem[];\n}\n","import type { CodeClass, CoreKind } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport { ClassRule } from \"./class-rule.ts\";\nimport type { Problem } from \"./problem.ts\";\n\ninterface Separation {\n\treadonly handler: CoreKind;\n\treadonly forbidden: readonly CoreKind[];\n}\n\nconst separations: readonly Separation[] = [\n\t{ forbidden: [\"QueryRepository\"], handler: \"CommandHandler\" },\n\t{ forbidden: [\"CommandRepository\", \"Outbox\", \"UnitOfWork\", \"EventPublisher\"], handler: \"QueryHandler\" },\n];\n\nexport class CommandQuerySeparationRule extends ClassRule {\n\tpublic readonly id: RuleId = \"command-query-separation\";\n\n\tprotected problemsWith(codeClass: CodeClass): Problem[] {\n\t\tconst problems: Problem[] = [];\n\t\tfor (const { handler, forbidden } of separations) {\n\t\t\tif (!codeClass.is(handler)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const parameter of codeClass.constructorParameters) {\n\t\t\t\tconst kind = forbidden.find((candidate) => parameter.is(candidate));\n\t\t\t\tif (kind !== undefined) {\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tline: parameter.line,\n\t\t\t\t\t\tmessage: `The ${handler} ${codeClass.name} receives ${parameter.typeName}, a ${kind}: keep commands and queries apart.`,\n\t\t\t\t\t\tsymbol: `${codeClass.name}.${parameter.member}`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn problems;\n\t}\n}\n","import type { Codebase, CodeFile, Import, Location } from \"../codebase/index.ts\";\nimport { CoreApi } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport { ImportRule } from \"./import-rule.ts\";\n\nexport class DomainPurityRule extends ImportRule {\n\tpublic readonly id: RuleId = \"domain-purity\";\n\n\tprotected appliesTo(file: CodeFile): boolean {\n\t\treturn file.location.layer === \"domain\";\n\t}\n\n\tprotected problemWith(imported: Import, file: CodeFile, codebase: Codebase): string | undefined {\n\t\tconst target = imported.target;\n\n\t\tif (target.kind === \"file\") {\n\t\t\tif (this.isDomainReachableFrom(target.location, file.location)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn `The domain imports ${this.describeTarget(imported, codebase)}: it may only import the domain.`;\n\t\t}\n\n\t\tif (target.name === CoreApi.packageName) {\n\t\t\tconst forbidden = imported.names.filter((name) => !CoreApi.isDomainSymbol(name));\n\t\t\tif (forbidden.length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn `The domain imports ${forbidden.join(\", \")} from ${CoreApi.packageName}: only domain building blocks and Result are allowed.`;\n\t\t}\n\n\t\tif (codebase.config.domainDependencies.includes(target.name)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn `The domain imports ${target.name}: add it to domainDependencies if the domain really needs it.`;\n\t}\n\n\tprivate isDomainReachableFrom(to: Location, from: Location): boolean {\n\t\treturn to.layer === \"domain\" && (to.isSameContextAs(from) || to.isInSharedKernel);\n\t}\n}\n","import type { CodeClass, CodeFile, Location } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport { ClassRule } from \"./class-rule.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nexport class DrivenAdaptersExtendPortRule extends ClassRule {\n\tpublic readonly id: RuleId = \"driven-adapters-extend-port\";\n\n\tprotected problemsWith(codeClass: CodeClass, file: CodeFile): Problem[] {\n\t\tconst location = file.location;\n\n\t\tif (this.isAdaptersFolder(location) && !codeClass.is(\"Port\")) {\n\t\t\treturn [{ line: codeClass.line, message: `${codeClass.name} is a driven adapter but extends no Port: extend the port it implements.`, symbol: codeClass.name }];\n\t\t}\n\t\tif (codeClass.is(\"Port\") && codeClass.isAbstract && !this.isPortsFolder(location) && !this.isAdaptersFolder(location)) {\n\t\t\treturn [{ line: codeClass.line, message: `The port ${codeClass.name} is declared outside the domain: move it to domain/ports/ or domain/repositories/.`, symbol: codeClass.name }];\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate isAdaptersFolder(location: Location): boolean {\n\t\treturn location.layer === \"driven\" && location.folder === \"adapters\";\n\t}\n\n\tprivate isPortsFolder(location: Location): boolean {\n\t\treturn location.layer === \"domain\" && (location.folder === \"ports\" || location.folder === \"repositories\");\n\t}\n}\n","import type { Codebase, CodeFile } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { Rule } from \"./rule.ts\";\nimport type { Violation } from \"./violation.ts\";\n\nconst exempt: ReadonlySet<string> = new Set([\"equals\", \"toSnapshot\"]);\n\nexport class ErrorsAsValuesRule extends Rule {\n\tpublic readonly id: RuleId = \"errors-as-values\";\n\n\tpublic check(codebase: Codebase): Violation[] {\n\t\tconst violations: Violation[] = [];\n\t\tfor (const file of codebase.files) {\n\t\t\tfor (const problem of [...this.methodsWithoutResult(file), ...this.thrownErrors(file)]) {\n\t\t\t\tviolations.push(this.violation(codebase, file, problem));\n\t\t\t}\n\t\t}\n\t\treturn violations;\n\t}\n\n\tprivate methodsWithoutResult(file: CodeFile): Problem[] {\n\t\tconst problems: Problem[] = [];\n\t\tfor (const codeClass of file.classes.filter((candidate) => candidate.is(\"Entity\"))) {\n\t\t\tfor (const method of codeClass.publicMethods) {\n\t\t\t\tif (!exempt.has(method.name) && !method.returnsResult) {\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tline: method.line,\n\t\t\t\t\t\tmessage: `${codeClass.name}.${method.name} must return a Result: expose reads as getters and return business failures as values.`,\n\t\t\t\t\t\tsymbol: `${codeClass.name}.${method.name}`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn problems;\n\t}\n\n\tprivate thrownErrors(file: CodeFile): Problem[] {\n\t\treturn file.domainErrorThrows.map((line) => ({ line, message: \"A DomainError is thrown: return it in a Result instead.\", symbol: \"throw\" }));\n\t}\n}\n","import type { Codebase, CodeFile, Import, Layer, Location } from \"../codebase/index.ts\";\nimport { CoreApi } from \"../codebase/index.ts\";\nimport type { Config, RuleId } from \"../config/index.ts\";\nimport { ImportRule } from \"./import-rule.ts\";\nimport type { Violation } from \"./violation.ts\";\n\ntype OuterLayer = Exclude<Layer, \"domain\">;\n\nconst allowedLayers: Readonly<Record<OuterLayer, readonly Layer[]>> = {\n\tapplication: [\"domain\", \"application\", \"published-language\"],\n\tdriven: [\"domain\", \"application\", \"published-language\", \"driven\"],\n\tdriving: [\"domain\", \"application\", \"published-language\", \"driving\"],\n\t\"published-language\": [\"published-language\"],\n};\n\nexport class LayerDirectionRule extends ImportRule {\n\tpublic readonly id: RuleId = \"layer-direction\";\n\n\tpublic override check(codebase: Codebase): Violation[] {\n\t\treturn [...this.filesOutsideLayers(codebase), ...super.check(codebase)];\n\t}\n\n\tprotected appliesTo(file: CodeFile): boolean {\n\t\tconst location = file.location;\n\t\treturn location.isAtRoot || location.isCompositionRoot || (location.isInLayer && location.layer !== \"domain\");\n\t}\n\n\tprotected problemWith(imported: Import, file: CodeFile, codebase: Codebase): string | undefined {\n\t\tif (imported.target.kind === \"file\") {\n\t\t\treturn this.fileProblem(file.location, imported.target.location, this.describeTarget(imported, codebase));\n\t\t}\n\t\treturn this.packageProblem(file.location, imported, codebase.config);\n\t}\n\n\tprivate filesOutsideLayers(codebase: Codebase): Violation[] {\n\t\tconst violations: Violation[] = [];\n\t\tfor (const file of codebase.files) {\n\t\t\tconst location = file.location;\n\t\t\tif (location.isOutside) {\n\t\t\t\tviolations.push(\n\t\t\t\t\tthis.violation(codebase, file, {\n\t\t\t\t\t\tline: 1,\n\t\t\t\t\t\tmessage: \"The file is outside the bounded contexts and the shared kernel declared in alveolus.config.ts: move it, or add it to ignore.\",\n\t\t\t\t\t\tsymbol: location.fileName,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t} else if (!location.isAtRoot && !location.isInLayer && !location.isCompositionRoot) {\n\t\t\t\tviolations.push(\n\t\t\t\t\tthis.violation(codebase, file, {\n\t\t\t\t\t\tline: 1,\n\t\t\t\t\t\tmessage: \"The file is outside the layers: move it to domain/, application/, published-language/, driven/ or driving/.\",\n\t\t\t\t\t\tsymbol: location.fileName,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn violations;\n\t}\n\n\tprivate fileProblem(from: Location, to: Location, target: string): string | undefined {\n\t\tif (from.isAtRoot) {\n\t\t\treturn to.isInBoundedContext && !to.isCompositionRoot ? `Files at the root import composition roots only, not ${target}.` : undefined;\n\t\t}\n\t\tif (from.isCompositionRoot || to.isOtherBoundedContextThan(from)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (to.isCompositionRoot) {\n\t\t\treturn `Imports ${target}: only the composition root wires the layers.`;\n\t\t}\n\n\t\tconst layer = from.layer;\n\t\tif (layer === undefined || layer === \"domain\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst allowed = allowedLayers[layer];\n\t\tif (to.layer !== undefined && allowed.includes(to.layer)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn `The ${layer} layer imports ${target}: it may only import ${allowed.join(\", \")}.`;\n\t}\n\n\tprivate packageProblem(from: Location, imported: Import, config: Config): string | undefined {\n\t\tif (from.layer === \"application\") {\n\t\t\treturn this.applicationPackageProblem(imported, config);\n\t\t}\n\t\tif (from.layer === \"published-language\" && imported.isFromPackage(CoreApi.packageName)) {\n\t\t\tconst forbidden = imported.names.filter((name) => !CoreApi.isPublishedLanguageSymbol(name));\n\t\t\treturn forbidden.length === 0 ? undefined : `The published language imports ${forbidden.join(\", \")} from ${CoreApi.packageName}: only published-language types are allowed.`;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate applicationPackageProblem(imported: Import, config: Config): string | undefined {\n\t\tif (imported.target.kind !== \"package\" || imported.isFromPackage(CoreApi.packageName)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (imported.isFromPackage(\"@nestjs/common\")) {\n\t\t\tconst forbidden = imported.names.filter((name) => name !== \"Injectable\");\n\t\t\treturn forbidden.length === 0 ? undefined : `The application imports ${forbidden.join(\", \")} from @nestjs/common: only Injectable is allowed.`;\n\t\t}\n\t\tif (config.domainDependencies.includes(imported.target.name)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn `The application imports ${imported.target.name}: only ${CoreApi.packageName}, Injectable from @nestjs/common and domainDependencies are allowed.`;\n\t}\n}\n","import type { Layer, Location } from \"../codebase/index.ts\";\n\nexport class Place {\n\tpublic constructor(\n\t\tpublic readonly layer: Layer,\n\t\tpublic readonly folder?: string,\n\t\tpublic readonly suffix?: string,\n\t) {}\n\n\tpublic fits(location: Location): boolean {\n\t\tif (!location.isInBoundedContext && !location.isInSharedKernel) {\n\t\t\treturn false;\n\t\t}\n\t\tif (location.layer !== this.layer) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.folder !== undefined && location.folder !== this.folder) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.suffix === undefined || location.fileName.endsWith(this.suffix);\n\t}\n\n\tpublic describe(): string {\n\t\treturn this.folder === undefined ? `${this.layer}/` : `${this.layer}/${this.folder}/*${this.suffix ?? \".ts\"}`;\n\t}\n}\n","import type { Codebase, CodeClass, CodeFile, CoreKind } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport { Place } from \"./place.ts\";\nimport type { Problem } from \"./problem.ts\";\nimport { Rule } from \"./rule.ts\";\nimport type { Violation } from \"./violation.ts\";\n\ninterface KindPlace {\n\treadonly kind: CoreKind;\n\treadonly place: Place;\n\treadonly concreteOnly?: boolean;\n}\n\nconst repositories = new Place(\"domain\", \"repositories\", \".repository.ts\");\n\nconst kindPlaces: readonly KindPlace[] = [\n\t{ kind: \"AggregateRoot\", place: new Place(\"domain\", \"aggregates\", \".aggregate.ts\") },\n\t{ kind: \"Entity\", place: new Place(\"domain\", \"entities\", \".entity.ts\") },\n\t{ kind: \"Identifier\", place: new Place(\"domain\", \"value-objects\", \".identifier.ts\") },\n\t{ kind: \"ValueObject\", place: new Place(\"domain\", \"value-objects\", \".value-object.ts\") },\n\t{ kind: \"DomainEvent\", place: new Place(\"domain\", \"events\", \".event.ts\") },\n\t{ kind: \"DomainError\", place: new Place(\"domain\", \"errors\", \".error.ts\") },\n\t{ kind: \"DomainService\", place: new Place(\"domain\", \"services\", \".service.ts\") },\n\t{ kind: \"CommandHandler\", place: new Place(\"application\", \"commands\", \".command.ts\") },\n\t{ kind: \"QueryHandler\", place: new Place(\"application\", \"queries\", \".query.ts\") },\n\t{ kind: \"EventTranslator\", place: new Place(\"application\", \"translators\", \".translator.ts\") },\n\t{ concreteOnly: true, kind: \"Port\", place: new Place(\"driven\", \"adapters\", \".adapter.ts\") },\n\t{ kind: \"CommandRepository\", place: repositories },\n\t{ kind: \"QueryRepository\", place: repositories },\n\t{ kind: \"Port\", place: new Place(\"domain\", \"ports\", \".port.ts\") },\n];\n\nconst markedPlace = new Place(\"driving\");\n\nexport class PlacementRule extends Rule {\n\tpublic readonly id: RuleId = \"placement\";\n\n\tpublic check(codebase: Codebase): Violation[] {\n\t\tconst violations: Violation[] = [];\n\t\tfor (const file of codebase.files) {\n\t\t\tfor (const problem of [...this.extraClasses(file), ...this.misplacedClasses(file)]) {\n\t\t\t\tviolations.push(this.violation(codebase, file, problem));\n\t\t\t}\n\t\t}\n\t\treturn violations;\n\t}\n\n\tprivate extraClasses(file: CodeFile): Problem[] {\n\t\tconst [first, ...others] = file.classes;\n\t\treturn others.map((codeClass) => ({ line: codeClass.line, message: `${codeClass.name} shares its file with ${first?.name}: one class per file.`, symbol: codeClass.name }));\n\t}\n\n\tprivate misplacedClasses(file: CodeFile): Problem[] {\n\t\tconst problems: Problem[] = [];\n\t\tfor (const codeClass of file.classes) {\n\t\t\tconst place = this.placeOf(codeClass);\n\t\t\tif (place !== undefined && !place.fits(file.location)) {\n\t\t\t\tproblems.push({ line: codeClass.line, message: `${codeClass.name} belongs in ${place.describe()}.`, symbol: codeClass.name });\n\t\t\t}\n\t\t}\n\t\treturn problems;\n\t}\n\n\tprivate placeOf(codeClass: CodeClass): Place | undefined {\n\t\tconst match = kindPlaces.find((entry) => codeClass.is(entry.kind) && !(entry.concreteOnly === true && codeClass.isAbstract));\n\t\tif (match !== undefined) {\n\t\t\treturn match.place;\n\t\t}\n\t\treturn codeClass.hasMarker ? markedPlace : undefined;\n\t}\n}\n","import type { CodeClass, TypeUsage } from \"../codebase/index.ts\";\nimport type { RuleId } from \"../config/index.ts\";\nimport { ClassRule } from \"./class-rule.ts\";\nimport type { Problem } from \"./problem.ts\";\n\nexport class ReferenceByIdentityRule extends ClassRule {\n\tpublic readonly id: RuleId = \"reference-by-identity\";\n\n\tprotected problemsWith(codeClass: CodeClass): Problem[] {\n\t\tif (!codeClass.is(\"Entity\")) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this.membersOf(codeClass)\n\t\t\t.filter((member) => member.is(\"AggregateRoot\"))\n\t\t\t.map((member) => ({\n\t\t\t\tline: member.line,\n\t\t\t\tmessage: `${codeClass.name}.${member.member} holds the aggregate ${member.typeName}: reference it by its identifier instead.`,\n\t\t\t\tsymbol: `${codeClass.name}.${member.member}`,\n\t\t\t}));\n\t}\n\n\tprivate membersOf(codeClass: CodeClass): TypeUsage[] {\n\t\tconst byName = new Map<string, TypeUsage>();\n\t\tfor (const member of [...codeClass.fields, ...codeClass.constructorParameters]) {\n\t\t\tbyName.set(`${member.member}:${member.typeName}`, member);\n\t\t}\n\t\treturn [...byName.values()];\n\t}\n}\n","import { BcIsolationRule } from \"./bc-isolation.rule.ts\";\nimport { BuildingBlocksOnlyRule } from \"./building-blocks-only.rule.ts\";\nimport { CommandQuerySeparationRule } from \"./command-query-separation.rule.ts\";\nimport { DomainPurityRule } from \"./domain-purity.rule.ts\";\nimport { DrivenAdaptersExtendPortRule } from \"./driven-adapters-extend-port.rule.ts\";\nimport { ErrorsAsValuesRule } from \"./errors-as-values.rule.ts\";\nimport { LayerDirectionRule } from \"./layer-direction.rule.ts\";\nimport { PlacementRule } from \"./placement.rule.ts\";\nimport { ReferenceByIdentityRule } from \"./reference-by-identity.rule.ts\";\nimport type { Rule } from \"./rule.ts\";\n\nexport class Rules {\n\tpublic static all(): Rule[] {\n\t\treturn [\n\t\t\tnew BcIsolationRule(),\n\t\t\tnew DomainPurityRule(),\n\t\t\tnew LayerDirectionRule(),\n\t\t\tnew DrivenAdaptersExtendPortRule(),\n\t\t\tnew ReferenceByIdentityRule(),\n\t\t\tnew CommandQuerySeparationRule(),\n\t\t\tnew ErrorsAsValuesRule(),\n\t\t\tnew PlacementRule(),\n\t\t\tnew BuildingBlocksOnlyRule(),\n\t\t];\n\t}\n}\n","import { Command, CommanderError } from \"commander\";\n\nimport { join, resolve } from \"node:path\";\n\nimport { TsMorphAnalyzer } from \"../analysis/index.ts\";\nimport { Baseline } from \"../baseline/index.ts\";\nimport { ArchChecker } from \"../checker/index.ts\";\nimport type { Config } from \"../config/index.ts\";\nimport { ConfigLoader } from \"../config/index.ts\";\nimport { Report } from \"../report/index.ts\";\nimport type { Violation } from \"../rules/index.ts\";\nimport { Rules } from \"../rules/index.ts\";\n\ninterface Output {\n\twrite(text: string): unknown;\n}\n\ninterface Options {\n\treadonly project: string;\n\treadonly config?: string;\n\treadonly format: \"text\" | \"json\";\n}\n\nexport class Cli {\n\tprivate exitCode = 0;\n\n\tpublic constructor(\n\t\tprivate readonly stdout: Output,\n\t\tprivate readonly stderr: Output,\n\t\tprivate readonly cwd: string,\n\t\tprivate readonly colored = false,\n\t) {}\n\n\tpublic async run(args: readonly string[]): Promise<number> {\n\t\ttry {\n\t\t\tawait this.program().parseAsync([...args], { from: \"user\" });\n\t\t} catch (error) {\n\t\t\treturn this.fail(error);\n\t\t}\n\t\treturn this.exitCode;\n\t}\n\n\tprivate program(): Command {\n\t\tconst program = new Command(\"alveolus\").exitOverride().configureOutput({\n\t\t\twriteErr: (text) => this.stderr.write(text),\n\t\t\twriteOut: (text) => this.stdout.write(text),\n\t\t});\n\t\tconst arch = program.command(\"arch\").description(\"Check the architecture of a Domain-Driven Design project\");\n\n\t\tthis.withOptions(arch.command(\"check\").description(\"Report the violations that are not in the baseline\")).action((options: Options) => this.check(options));\n\t\tthis.withOptions(arch.command(\"baseline\").description(`Write the current violations to ${Baseline.fileName}`)).action((options: Options) => this.baseline(options));\n\n\t\treturn program;\n\t}\n\n\tprivate withOptions(command: Command): Command {\n\t\treturn command.option(\"--project <dir>\", \"project directory\", \".\").option(\"--config <file>\", \"configuration file\", ConfigLoader.fileName).option(\"--format <format>\", \"text or json\", \"text\");\n\t}\n\n\tprivate async check(options: Options): Promise<void> {\n\t\tconst { config, violations } = await this.analyze(options);\n\t\tconst baseline = await Baseline.load(join(config.projectDir, Baseline.fileName));\n\t\tconst fresh = baseline.newViolations(violations);\n\t\tconst report = new Report(fresh, violations.length - fresh.length, this.colored);\n\n\t\tthis.stdout.write(options.format === \"json\" ? report.json() : report.text());\n\t\tthis.exitCode = fresh.length === 0 ? 0 : 1;\n\t}\n\n\tprivate async baseline(options: Options): Promise<void> {\n\t\tconst { config, violations } = await this.analyze(options);\n\t\tawait Baseline.of(violations).save(join(config.projectDir, Baseline.fileName));\n\t\tthis.stdout.write(`${violations.length} violations written to ${Baseline.fileName}\\n`);\n\t}\n\n\tprivate async analyze(options: Options): Promise<{ config: Config; violations: Violation[] }> {\n\t\tconst projectDir = resolve(this.cwd, options.project);\n\t\tconst config = await new ConfigLoader().load(projectDir, options.config);\n\t\tconst checker = new ArchChecker(TsMorphAnalyzer.fromTsConfig(config.projectDir), Rules.all());\n\t\treturn { config, violations: checker.check(config) };\n\t}\n\n\tprivate fail(error: unknown): number {\n\t\tif (error instanceof CommanderError) {\n\t\t\treturn error.exitCode === 0 ? 0 : 2;\n\t\t}\n\t\tthis.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n\t\treturn 2;\n\t}\n}\n"],"mappings":";;;;;;;;;AAGA,IAAsB,eAAtB,MAAmC,CAEnC;;;ACUA,IAAa,YAAb,MAAuB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAmB,OAAuB;EACzC,KAAK,OAAO,MAAM;EAClB,KAAK,OAAO,MAAM;EAClB,KAAK,aAAa,MAAM;EACxB,KAAK,QAAQ,MAAM;EACnB,KAAK,UAAU,MAAM;EACrB,KAAK,wBAAwB,MAAM;EACnC,KAAK,SAAS,MAAM;EACpB,KAAK,gBAAgB,MAAM;CAC5B;CAEA,GAAU,MAAyB;EAClC,OAAO,KAAK,MAAM,SAAS,IAAI;CAChC;CAEA,WAAkB,QAA6B;EAC9C,OAAO,KAAK,QAAQ,SAAS,MAAM;CACpC;CAEA,IAAW,uBAAgC;EAC1C,OAAO,KAAK,MAAM,SAAS;CAC5B;CAEA,IAAW,YAAqB;EAC/B,OAAO,KAAK,QAAQ,SAAS;CAC9B;AACD;;;ACrCA,IAAa,WAAb,MAAsB;CACrB;CACA;CACA;CACA;CACA;CACA;CAEA,YAAmB,OAAsB;EACxC,KAAK,OAAO,MAAM;EAClB,KAAK,WAAW,MAAM;EACtB,KAAK,UAAU,MAAM;EACrB,KAAK,UAAU,MAAM;EACrB,KAAK,eAAe,MAAM;EAC1B,KAAK,oBAAoB,MAAM;CAChC;CAEA,wBAA+B,MAAuB;EACrD,OAAO,KAAK,QAAQ,MAAM,cAAc,UAAU,SAAS,QAAQ,UAAU,WAAW,iBAAiB,CAAC;CAC3G;CAEA,IAAW,8BAAuC;EACjD,OAAO,KAAK,QAAQ,MAAM,cAAc,UAAU,WAAW,qBAAqB,CAAC;CACpF;AACD;;;ACjCA,IAAa,WAAb,MAAsB;CAIJ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AAK,KAAK,OAAO,YAAY,SAAS,QAAQ,CAAC,EAAA,CACxD,cAAc,UAAU;EAC/C,MAAM,SAAS,IAAI,OAAO,OAAO,WAAW,SAAS,MAAM,QAAQ,KAAK,OAAO;EAE/E,KAAK,OAAO,MAAM,QAAQ,WAAW,SAAS,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC;EAC3E,KAAK,WAAW,MAAM,WAAW,IAAI,IAAI;CAC1C;CAEA,MAAc,SAAS,SAAiC;EACvD,MAAM,EAAE,QAAQ,eAAe,MAAM,KAAK,QAAQ,OAAO;EACzD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,KAAK,KAAK,OAAO,YAAY,SAAS,QAAQ,CAAC;EAC7E,KAAK,OAAO,MAAM,GAAG,WAAW,OAAO,yBAAyB,SAAS,SAAS,GAAG;CACtF;CAEA,MAAc,QAAQ,SAAwE;EAC7F,MAAM,aAAa,QAAQ,KAAK,KAAK,QAAQ,OAAO;EACpD,MAAM,SAAS,MAAM,IAAI,aAAa,CAAC,CAAC,KAAK,YAAY,QAAQ,MAAM;EAEvE,OAAO;GAAE;GAAQ,YAAY,IADT,YAAY,gBAAgB,aAAa,OAAO,UAAU,GAAG,MAAM,IAAI,CACxD,CAAC,CAAC,MAAM,MAAM;EAAE;CACpD;CAEA,KAAa,OAAwB;EACpC,IAAI,iBAAiB,gBACpB,OAAO,MAAM,aAAa,IAAI,IAAI;EAEnC,KAAK,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;EAC/E,OAAO;CACR;AACD"}
@@ -0,0 +1,287 @@
1
+ import { Project } from "ts-morph";
2
+ //#region src/codebase/core-api.d.ts
3
+ type CoreKind = "AggregateRoot" | "Entity" | "ValueObject" | "Identifier" | "DomainEvent" | "DomainError" | "DomainService" | "Port" | "CommandRepository" | "QueryRepository" | "CommandHandler" | "QueryHandler" | "EventTranslator" | "EventPublisher" | "Outbox" | "UnitOfWork";
4
+ type CoreMarker = "OpenHostService" | "AntiCorruptionLayer";
5
+ //#endregion
6
+ //#region src/codebase/method.d.ts
7
+ declare class Method {
8
+ readonly name: string;
9
+ readonly line: number;
10
+ readonly returnsResult: boolean;
11
+ constructor(name: string, line: number, returnsResult: boolean);
12
+ }
13
+ //#endregion
14
+ //#region src/codebase/type-usage.d.ts
15
+ declare class TypeUsage {
16
+ readonly member: string;
17
+ readonly line: number;
18
+ readonly typeName: string;
19
+ private readonly kinds;
20
+ constructor(member: string, line: number, typeName: string, kinds: readonly CoreKind[]);
21
+ is(kind: CoreKind): boolean;
22
+ }
23
+ //#endregion
24
+ //#region src/codebase/code-class.d.ts
25
+ interface CodeClassProps {
26
+ readonly name: string;
27
+ readonly line: number;
28
+ readonly isAbstract: boolean;
29
+ readonly kinds: readonly CoreKind[];
30
+ readonly markers: readonly CoreMarker[];
31
+ readonly constructorParameters: readonly TypeUsage[];
32
+ readonly fields: readonly TypeUsage[];
33
+ readonly publicMethods: readonly Method[];
34
+ }
35
+ declare class CodeClass {
36
+ readonly name: string;
37
+ readonly line: number;
38
+ readonly isAbstract: boolean;
39
+ readonly constructorParameters: readonly TypeUsage[];
40
+ readonly fields: readonly TypeUsage[];
41
+ readonly publicMethods: readonly Method[];
42
+ private readonly kinds;
43
+ private readonly markers;
44
+ constructor(props: CodeClassProps);
45
+ is(kind: CoreKind): boolean;
46
+ implements(marker: CoreMarker): boolean;
47
+ get extendsBuildingBlock(): boolean;
48
+ get hasMarker(): boolean;
49
+ }
50
+ //#endregion
51
+ //#region src/codebase/declaration.d.ts
52
+ type DeclarationKind = "function" | "enum";
53
+ declare class Declaration {
54
+ readonly kind: DeclarationKind;
55
+ readonly name: string;
56
+ readonly line: number;
57
+ constructor(kind: DeclarationKind, name: string, line: number);
58
+ }
59
+ //#endregion
60
+ //#region src/codebase/location.d.ts
61
+ type Layer = "domain" | "application" | "published-language" | "driven" | "driving";
62
+ type Area = "context" | "shared-kernel" | "root" | "outside";
63
+ interface LocationProps {
64
+ readonly area: Area;
65
+ readonly context?: string;
66
+ readonly layer?: Layer;
67
+ readonly folder?: string;
68
+ readonly fileName: string;
69
+ readonly isCompositionRoot?: boolean;
70
+ }
71
+ declare class Location {
72
+ readonly area: Area;
73
+ readonly context: string | undefined;
74
+ readonly layer: Layer | undefined;
75
+ readonly folder: string | undefined;
76
+ readonly fileName: string;
77
+ readonly isCompositionRoot: boolean;
78
+ constructor(props: LocationProps);
79
+ get isInBoundedContext(): boolean;
80
+ get isInSharedKernel(): boolean;
81
+ get isAtRoot(): boolean;
82
+ get isOutside(): boolean;
83
+ get isInLayer(): boolean;
84
+ isSameContextAs(other: Location): boolean;
85
+ isOtherBoundedContextThan(other: Location): boolean;
86
+ describe(): string;
87
+ }
88
+ //#endregion
89
+ //#region src/codebase/import.d.ts
90
+ type ImportTarget = {
91
+ readonly kind: "file";
92
+ readonly path: string;
93
+ readonly location: Location;
94
+ } | {
95
+ readonly kind: "package";
96
+ readonly name: string;
97
+ };
98
+ declare class Import {
99
+ readonly line: number;
100
+ readonly specifier: string;
101
+ readonly names: readonly string[];
102
+ readonly target: ImportTarget;
103
+ constructor(line: number, specifier: string, names: readonly string[], target: ImportTarget);
104
+ get label(): string;
105
+ isFromPackage(name: string): boolean;
106
+ }
107
+ //#endregion
108
+ //#region src/codebase/code-file.d.ts
109
+ interface CodeFileProps {
110
+ readonly path: string;
111
+ readonly location: Location;
112
+ readonly imports: readonly Import[];
113
+ readonly classes: readonly CodeClass[];
114
+ readonly declarations: readonly Declaration[];
115
+ readonly domainErrorThrows: readonly number[];
116
+ }
117
+ declare class CodeFile {
118
+ readonly path: string;
119
+ readonly location: Location;
120
+ readonly imports: readonly Import[];
121
+ readonly classes: readonly CodeClass[];
122
+ readonly declarations: readonly Declaration[];
123
+ readonly domainErrorThrows: readonly number[];
124
+ constructor(props: CodeFileProps);
125
+ declaresOpenHostService(name: string): boolean;
126
+ get declaresAntiCorruptionLayer(): boolean;
127
+ }
128
+ //#endregion
129
+ //#region src/config/alveolus-config.d.ts
130
+ type RuleId = "bc-isolation" | "domain-purity" | "layer-direction" | "driven-adapters-extend-port" | "reference-by-identity" | "command-query-separation" | "errors-as-values" | "placement" | "building-blocks-only";
131
+ type RuleSetting = "error" | "off";
132
+ interface AlveolusConfig {
133
+ readonly root: string;
134
+ readonly boundedContexts: Readonly<Record<string, string>>;
135
+ readonly sharedKernel?: string;
136
+ readonly compositionRoot?: string;
137
+ readonly domainDependencies?: readonly string[];
138
+ readonly ignore?: readonly string[];
139
+ readonly rules?: Readonly<Partial<Record<RuleId, RuleSetting>>>;
140
+ }
141
+ //#endregion
142
+ //#region src/config/config.d.ts
143
+ interface ContextFolder {
144
+ readonly name: string;
145
+ readonly dir: string;
146
+ readonly isSharedKernel: boolean;
147
+ }
148
+ export declare class Config {
149
+ readonly projectDir: string;
150
+ readonly rootDir: string;
151
+ readonly compositionRoot: string;
152
+ readonly domainDependencies: readonly string[];
153
+ readonly contextFolders: readonly ContextFolder[];
154
+ private readonly ignored;
155
+ private readonly rules;
156
+ constructor(config: AlveolusConfig, projectDir: string);
157
+ isIgnored(path: string): boolean;
158
+ isEnabled(rule: RuleId): boolean;
159
+ }
160
+ //#endregion
161
+ //#region src/config/config-loader.d.ts
162
+ export declare class ConfigLoader {
163
+ static readonly fileName = "alveolus.config.ts";
164
+ load(projectDir: string, configFile?: string): Promise<Config>;
165
+ private validate;
166
+ }
167
+ //#endregion
168
+ //#region src/config/define-config.d.ts
169
+ export declare function defineConfig(config: AlveolusConfig): AlveolusConfig;
170
+ //#endregion
171
+ //#region src/codebase/codebase.d.ts
172
+ declare class Codebase {
173
+ readonly files: readonly CodeFile[];
174
+ readonly config: Config;
175
+ private readonly filesByPath;
176
+ constructor(files: readonly CodeFile[], config: Config);
177
+ file(path: string): CodeFile | undefined;
178
+ relativePath(path: string): string;
179
+ }
180
+ //#endregion
181
+ //#region src/analysis/code-analyzer.d.ts
182
+ export declare abstract class CodeAnalyzer {
183
+ abstract analyze(config: Config): Codebase;
184
+ }
185
+ //#endregion
186
+ //#region src/analysis/ts-morph-analyzer.d.ts
187
+ export declare class TsMorphAnalyzer extends CodeAnalyzer {
188
+ private readonly project;
189
+ private readonly types;
190
+ private readonly classes;
191
+ constructor(project: Project);
192
+ static fromTsConfig(projectDir: string): TsMorphAnalyzer;
193
+ analyze(config: Config): Codebase;
194
+ private read;
195
+ private declarationsOf;
196
+ private moduleDeclarationsOf;
197
+ private readImport;
198
+ private importedNames;
199
+ private targetOf;
200
+ private packageNameOf;
201
+ private domainErrorThrowsOf;
202
+ private isInside;
203
+ }
204
+ //#endregion
205
+ //#region src/rules/problem.d.ts
206
+ interface Problem {
207
+ readonly line: number;
208
+ readonly symbol: string;
209
+ readonly message: string;
210
+ }
211
+ //#endregion
212
+ //#region src/rules/violation.d.ts
213
+ interface Violation {
214
+ readonly rule: RuleId;
215
+ readonly file: string;
216
+ readonly line: number;
217
+ readonly symbol: string;
218
+ readonly message: string;
219
+ }
220
+ //#endregion
221
+ //#region src/rules/rule.d.ts
222
+ export declare abstract class Rule {
223
+ abstract readonly id: RuleId;
224
+ abstract check(codebase: Codebase): Violation[];
225
+ protected violation(codebase: Codebase, file: CodeFile, problem: Problem): Violation;
226
+ }
227
+ //#endregion
228
+ //#region src/rules/rules.d.ts
229
+ export declare class Rules {
230
+ static all(): Rule[];
231
+ }
232
+ //#endregion
233
+ //#region src/baseline/baseline.d.ts
234
+ export declare class Baseline {
235
+ private readonly entries;
236
+ static readonly fileName = "alveolus.baseline.json";
237
+ private constructor();
238
+ static of(violations: readonly Violation[]): Baseline;
239
+ static load(path: string): Promise<Baseline>;
240
+ newViolations(violations: readonly Violation[]): Violation[];
241
+ save(path: string): Promise<void>;
242
+ private keyOf;
243
+ }
244
+ //#endregion
245
+ //#region src/checker/arch-checker.d.ts
246
+ export declare class ArchChecker {
247
+ private readonly analyzer;
248
+ private readonly rules;
249
+ constructor(analyzer: CodeAnalyzer, rules: readonly Rule[]);
250
+ check(config: Config): Violation[];
251
+ private compare;
252
+ }
253
+ //#endregion
254
+ //#region src/cli/cli.d.ts
255
+ interface Output {
256
+ write(text: string): unknown;
257
+ }
258
+ export declare class Cli {
259
+ private readonly stdout;
260
+ private readonly stderr;
261
+ private readonly cwd;
262
+ private readonly colored;
263
+ private exitCode;
264
+ constructor(stdout: Output, stderr: Output, cwd: string, colored?: boolean);
265
+ run(args: readonly string[]): Promise<number>;
266
+ private program;
267
+ private withOptions;
268
+ private check;
269
+ private baseline;
270
+ private analyze;
271
+ private fail;
272
+ }
273
+ //#endregion
274
+ //#region src/report/report.d.ts
275
+ export declare class Report {
276
+ private readonly violations;
277
+ private readonly baselined;
278
+ private readonly colors;
279
+ constructor(violations: readonly Violation[], baselined: number, colored?: boolean);
280
+ text(): string;
281
+ json(): string;
282
+ private block;
283
+ private summary;
284
+ }
285
+ //#endregion
286
+ export type { AlveolusConfig, RuleId, RuleSetting, Violation };
287
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/codebase/core-api.ts","../src/codebase/method.ts","../src/codebase/type-usage.ts","../src/codebase/code-class.ts","../src/codebase/declaration.ts","../src/codebase/location.ts","../src/codebase/import.ts","../src/codebase/code-file.ts","../src/config/alveolus-config.ts","../src/config/config.ts","../src/config/config-loader.ts","../src/config/define-config.ts","../src/codebase/codebase.ts","../src/analysis/code-analyzer.ts","../src/analysis/ts-morph-analyzer.ts","../src/rules/problem.ts","../src/rules/violation.ts","../src/rules/rule.ts","../src/rules/rules.ts","../src/baseline/baseline.ts","../src/checker/arch-checker.ts","../src/cli/cli.ts","../src/report/report.ts"],"mappings":";;KAAY;KAkBA;;;cClBC;WAEX;WACA;WACA;EAHD,YACC,cACA,cACA;;;;cCFW;WAEX;WACA;WACA;mBACA;EAJD,YACC,gBACA,cACA,kBACA,gBAAiC;EAGlC,GAAU,MAAM;;;;UCNA;WACP;WACA;WACA;WACA,gBAAgB;WAChB,kBAAkB;WAClB,gCAAgC;WAChC,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EAI3B,aAAoB;;;;8BChBC;WACL,QAAQ,QAAQ,SAAS;;;;qBCW7B,wBAAwB;mBAIjB;mBAHF;mBACA;EAEjB,YAAmB,SAA0B;SAM/B,aAAa,qBAAqB;EAIhD,QAAe,QAAQ,SAAS;UASxB;UAcA;UAUA;UAKA;UAKA;UAcA;UAYA;UAMA;UAOA;;;;UC/GQ;WACP;WACA;WACA;;;;UCDO;WACP,MAAM;WACN;WACA;WACA;WACA;;;;8BCFY;oBACI,IAAI;WAEb,MAAM,UAAU,WAAW;YAEjC,UAAU,UAAU,UAAU,MAAM,UAAU,SAAS,UAAU;;;;qBCC/D;SACE,OAAO;;;;qBCLT;mBAGQ;kBAFG;UAEf;SAEM,GAAG,qBAAqB,cAAc;SAIhC,KAAK,eAAe,QAAQ;EAQhD,cAAqB,qBAAqB,cAAc;EAmBxD,KAAkB,eAAe;UAKzB;;;;qBC5CI;mBAEX;mBACA;EAFD,YACC,UAA2B,cAC3B,gBAAiC;EAGlC,MAAa,QAAQ,SAAS;UAMtB;;;;UCHC;EACT,MAAM;;qBASM;mBAIX;mBACA;mBACA;mBACA;UANO;EAER,YACC,QAAyB,QACzB,QAAyB,QACzB,aACA;EAGD,IAAiB,0BAA0B;UASnC;UAaA;UAIM;UAUA;UAMA;UAON;;;;qBC9EI;mBAIX;mBACA;mBAJgB;EAEjB,YACC,qBAAsC,aACtC,mBACA;EAKD;EAKA;UAIQ;UAKA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import { a as ConfigLoader, c as Baseline, i as Report, l as TsMorphAnalyzer, n as Rules, o as Config, r as Rule, s as ArchChecker, t as Cli, u as CodeAnalyzer } from "./cli-CW1zAnrP.mjs";
2
+ //#region src/config/define-config.ts
3
+ function defineConfig(config) {
4
+ return config;
5
+ }
6
+ //#endregion
7
+ export { ArchChecker, Baseline, Cli, CodeAnalyzer, Config, ConfigLoader, Report, Rule, Rules, TsMorphAnalyzer, defineConfig };
8
+
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/config/define-config.ts"],"sourcesContent":["import type { AlveolusConfig } from \"./alveolus-config.ts\";\n\nexport function defineConfig(config: AlveolusConfig): AlveolusConfig {\n\treturn config;\n}\n"],"mappings":";;AAEA,SAAgB,aAAa,QAAwC;CACpE,OAAO;AACR"}
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
+ "bin": {
3
+ "alveolus": "./dist/bin.mjs"
4
+ },
5
+ "dependencies": {
6
+ "commander": "^15.0.0",
7
+ "jiti": "^2.7.0",
8
+ "picocolors": "^1.1.1",
9
+ "ts-morph": "^28.0.0",
10
+ "zod": "^4.6.5"
11
+ },
12
+ "description": "Architecture checks that keep a Domain-Driven Design project from drifting",
13
+ "devDependencies": {
14
+ "@alveolus/core": "0.1.0-alpha.0"
15
+ },
16
+ "exports": {
17
+ ".": "./dist/index.mjs",
18
+ "./bin": "./dist/bin.mjs",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "homepage": "https://alveolusjs.github.io/alveolus/",
25
+ "license": "MIT",
2
26
  "name": "@alveolus/arch",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
27
+ "repository": {
28
+ "directory": "packages/arch",
29
+ "type": "git",
30
+ "url": "git+https://github.com/alveolusjs/alveolus.git"
31
+ },
32
+ "type": "module",
33
+ "version": "0.1.0-alpha.0",
34
+ "scripts": {
35
+ "build": "tsdown",
36
+ "typecheck": "tsc -p tsconfig.json"
37
+ }
6
38
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.