@alveolus/arch 0.2.0 → 0.4.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.
Files changed (60) hide show
  1. package/README.md +11 -0
  2. package/dist/bin.mjs +4 -2
  3. package/dist/bin.mjs.map +1 -1
  4. package/dist/{cli-P5PwH9OE.mjs → docs-DcFgskuN.mjs} +214 -43
  5. package/dist/docs-DcFgskuN.mjs.map +1 -0
  6. package/dist/index.d.mts +53 -12
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +2 -2
  9. package/docs/core/application/command-handlers.md +617 -0
  10. package/docs/core/application/event-publishers.md +234 -0
  11. package/docs/core/application/event-translators.md +329 -0
  12. package/docs/core/application/index.md +99 -0
  13. package/docs/core/application/integration-events.md +277 -0
  14. package/docs/core/application/outbox.md +416 -0
  15. package/docs/core/application/query-handlers.md +292 -0
  16. package/docs/core/application/unit-of-work.md +352 -0
  17. package/docs/core/domain/aggregates.md +822 -0
  18. package/docs/core/domain/domain-errors.md +251 -0
  19. package/docs/core/domain/domain-events.md +292 -0
  20. package/docs/core/domain/domain-services.md +249 -0
  21. package/docs/core/domain/entities.md +431 -0
  22. package/docs/core/domain/index.md +93 -0
  23. package/docs/core/domain/ports.md +284 -0
  24. package/docs/core/domain/repositories.md +335 -0
  25. package/docs/core/domain/value-objects.md +425 -0
  26. package/docs/core/domain/views.md +265 -0
  27. package/docs/core/index.md +108 -0
  28. package/docs/core/strategic/anti-corruption-layers.md +349 -0
  29. package/docs/core/strategic/index.md +83 -0
  30. package/docs/core/strategic/open-host-services.md +287 -0
  31. package/docs/core/strategic/published-language.md +265 -0
  32. package/docs/core/utilities/result.md +413 -0
  33. package/docs/guide/agents.md +68 -0
  34. package/docs/guide/existing-project.md +108 -0
  35. package/docs/guide/getting-started.md +286 -0
  36. package/docs/guide/learning-path.md +123 -0
  37. package/docs/guide/project-layout.md +324 -0
  38. package/docs/guide/versioning.md +42 -0
  39. package/docs/integrations/index.md +112 -0
  40. package/docs/integrations/nestjs.md +169 -0
  41. package/docs/rules/index.md +185 -0
  42. package/docs/rules/layers/no-driving-shortcut.md +119 -0
  43. package/docs/rules/layers/no-impure-domain.md +191 -0
  44. package/docs/rules/layers/no-outward-import.md +186 -0
  45. package/docs/rules/layers/no-portless-adapter.md +123 -0
  46. package/docs/rules/strategic/no-cross-context-import.md +140 -0
  47. package/docs/rules/strategic/no-fat-shared-kernel.md +81 -0
  48. package/docs/rules/strategic/no-leaky-host-service.md +107 -0
  49. package/docs/rules/strategic/no-unmapped-context.md +114 -0
  50. package/docs/rules/tactical/no-aggregate-reference.md +139 -0
  51. package/docs/rules/tactical/no-foreign-command-dependency.md +119 -0
  52. package/docs/rules/tactical/no-foreign-query-dependency.md +201 -0
  53. package/docs/rules/tactical/no-loose-code.md +171 -0
  54. package/docs/rules/tactical/no-misplaced-class.md +146 -0
  55. package/docs/rules/tactical/no-public-field.md +113 -0
  56. package/docs/rules/tactical/no-stateful-service.md +102 -0
  57. package/docs/rules/tactical/no-thrown-failure.md +162 -0
  58. package/docs/rules/tooling/no-loose-disable.md +98 -0
  59. package/package.json +4 -3
  60. package/dist/cli-P5PwH9OE.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-DcFgskuN.mjs","names":["Project","guarded","guarded","MorphProject","Project"],"sources":["../src/check/baseline.ts","../src/architecture/allowed-packages.ts","../src/model/classes/class-declaration.ts","../src/model/classes/class-type.ts","../src/model/classes/member.ts","../src/model/dependencies/dependency.ts","../src/model/dependencies/global-use.ts","../src/model/project.ts","../src/model/source-file.ts","../src/model/statements/disable-comment.ts","../src/model/statements/throw.ts","../src/model/statements/top-level-statement.ts","../src/conventions/building-blocks.ts","../src/conventions/core-api.ts","../src/conventions/layers.ts","../src/architecture/paths/place.ts","../src/architecture/building-blocks.ts","../src/architecture/core-api.ts","../src/architecture/layers.ts","../src/architecture/paths/layer-shape.ts","../src/architecture/paths/location.ts","../src/architecture/paths/layout.ts","../src/architecture/architecture.ts","../src/architecture/context-map.ts","../src/rules/framework/wording.ts","../src/rules/framework/rule.ts","../src/rules/framework/class-rule.ts","../src/rules/framework/import-rule.ts","../src/rules/framework/injection-rule.ts","../src/rules/layers/no-driving-shortcut.rule.ts","../src/rules/layers/no-impure-domain.rule.ts","../src/rules/layers/no-outward-import.rule.ts","../src/rules/layers/no-portless-adapter.rule.ts","../src/rules/strategic/no-cross-context-import.rule.ts","../src/rules/strategic/no-fat-shared-kernel.rule.ts","../src/rules/strategic/no-leaky-host-service.rule.ts","../src/rules/strategic/no-unmapped-context.rule.ts","../src/rules/tactical/aggregates/no-aggregate-reference.rule.ts","../src/rules/tactical/building-blocks/no-loose-code.rule.ts","../src/rules/tactical/building-blocks/no-misplaced-class.rule.ts","../src/rules/tactical/command-handlers/no-foreign-command-dependency.rule.ts","../src/rules/tactical/domain-errors/no-thrown-failure.rule.ts","../src/rules/tactical/domain-services/no-stateful-service.rule.ts","../src/rules/tactical/entities/no-public-field.rule.ts","../src/rules/tactical/query-handlers/no-foreign-query-dependency.rule.ts","../src/rules/tooling/disable-directive.ts","../src/rules/tooling/no-loose-disable.rule.ts","../src/rules/registry.ts","../src/check/fingerprint.ts","../src/check/checker.ts","../src/check/report.ts","../src/config/config.ts","../src/config/config-loader.ts","../src/importer/importer.ts","../src/importer/ts-morph/package-names.ts","../src/importer/ts-morph/readers/class-reader.ts","../src/importer/ts-morph/readers/dependency-reader.ts","../src/importer/ts-morph/readers/disable-reader.ts","../src/importer/ts-morph/readers/global-reader.ts","../src/importer/ts-morph/readers/statement-reader.ts","../src/importer/ts-morph/readers/throw-reader.ts","../src/importer/ts-morph/readers/type-reader.ts","../src/importer/ts-morph/ts-morph-importer.ts","../src/init/scaffold.ts","../src/init/init.ts","../src/cli/cli.ts","../src/docs/page.ts","../src/docs/docs.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\n\nimport type { Violation } from \"./violation.ts\";\n\ntype Entry = Pick<Violation, \"rule\" | \"file\" | \"symbol\"> & { readonly fingerprint?: string };\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, fingerprint, rule, symbol }) => ({ file, fingerprint, 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 get size(): number {\n\t\treturn this.entries.length;\n\t}\n\n\tpublic get outdatedEntries(): number {\n\t\treturn this.entries.filter((entry) => entry.fingerprint === undefined).length;\n\t}\n\n\tpublic newViolations(violations: readonly Violation[]): Violation[] {\n\t\treturn this.match(violations).fresh;\n\t}\n\n\tpublic staleEntries(violations: readonly Violation[]): number {\n\t\treturn this.match(violations).stale;\n\t}\n\n\tprivate match(violations: readonly Violation[]): { readonly fresh: Violation[]; readonly stale: number } {\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\tlet stale = 0;\n\t\tfor (const count of remaining.values()) {\n\t\t\tstale += count;\n\t\t}\n\t\treturn { fresh, stale };\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, entry.fingerprint ?? \"\"].join(\"\\n\");\n\t}\n}\n","export type PackageDependencies = Readonly<Record<string, true | readonly string[]>>;\n\nexport class AllowedPackages {\n\tpublic constructor(private readonly packages: PackageDependencies = {}) {}\n\n\tpublic has(packageName: string): boolean {\n\t\treturn Object.hasOwn(this.packages, packageName);\n\t}\n\n\tpublic forbiddenNames(packageName: string, names: readonly string[]): readonly string[] {\n\t\tconst allowed = this.packages[packageName];\n\t\tif (allowed === undefined) {\n\t\t\treturn names;\n\t\t}\n\t\tif (allowed === true) {\n\t\t\treturn [];\n\t\t}\n\t\treturn names.filter((name) => !allowed.includes(name));\n\t}\n\n\tpublic allowedNames(packageName: string): readonly string[] {\n\t\tconst allowed = this.packages[packageName];\n\t\tif (allowed === undefined || allowed === true) {\n\t\t\treturn [];\n\t\t}\n\t\treturn allowed;\n\t}\n\n\tpublic with(other: AllowedPackages): AllowedPackages {\n\t\tconst merged: Record<string, true | readonly string[]> = { ...this.packages };\n\t\tfor (const [packageName, allowed] of Object.entries(other.packages)) {\n\t\t\tconst existing = merged[packageName];\n\t\t\tif (existing === undefined) {\n\t\t\t\tmerged[packageName] = allowed;\n\t\t\t} else if (existing === true || allowed === true) {\n\t\t\t\tmerged[packageName] = true;\n\t\t\t} else {\n\t\t\t\tmerged[packageName] = [...existing, ...allowed];\n\t\t\t}\n\t\t}\n\t\treturn new AllowedPackages(merged);\n\t}\n}\n","import type { ClassType } from \"./class-type.ts\";\nimport type { Heritage, TypeArgument } from \"./heritage.ts\";\nimport type { Member } from \"./member.ts\";\nimport type { NamedType } from \"./named-type.ts\";\n\nexport interface ClassDeclarationProps {\n\treadonly name: string;\n\treadonly line: number;\n\treadonly isAbstract: boolean;\n\treadonly type: ClassType;\n\treadonly heritage: Heritage | undefined;\n\treadonly implemented: readonly NamedType[];\n\treadonly members: readonly Member[];\n}\n\nexport class ClassDeclaration {\n\tpublic readonly name: string;\n\tpublic readonly line: number;\n\tpublic readonly isAbstract: boolean;\n\tpublic readonly type: ClassType;\n\tpublic readonly heritage: Heritage | undefined;\n\tpublic readonly implemented: readonly NamedType[];\n\tpublic readonly members: readonly Member[];\n\n\tpublic constructor(props: ClassDeclarationProps) {\n\t\tthis.name = props.name;\n\t\tthis.line = props.line;\n\t\tthis.isAbstract = props.isAbstract;\n\t\tthis.type = props.type;\n\t\tthis.heritage = props.heritage;\n\t\tthis.implemented = props.implemented;\n\t\tthis.members = props.members;\n\t}\n\n\tpublic get heldMembers(): Member[] {\n\t\treturn this.members.filter((member) => member.kind === \"field\" || member.kind === \"constructor parameter\");\n\t}\n\n\tpublic get publicSurface(): Member[] {\n\t\treturn this.members.filter((member) => member.isPublicInstance && member.kind !== \"setter\" && this.isDeclared(member));\n\t}\n\n\tpublic get typeArguments(): readonly TypeArgument[] {\n\t\treturn this.heritage?.typeArguments ?? [];\n\t}\n\n\tpublic get extendsByName(): boolean {\n\t\treturn this.heritage === undefined || this.heritage.isByName;\n\t}\n\n\tpublic get isStaticOnly(): boolean {\n\t\tconst members = this.members.filter((member) => this.isDeclared(member));\n\t\treturn members.length > 0 && members.every((member) => member.isStatic);\n\t}\n\n\tprivate isDeclared(member: Member): boolean {\n\t\treturn member.kind !== \"constructor parameter\" || member.isParameterProperty;\n\t}\n}\n","import type { NamedType } from \"./named-type.ts\";\n\nexport class ClassType {\n\tpublic constructor(\n\t\tpublic readonly name: string,\n\t\tpublic readonly declaredIn: string | undefined,\n\t\tpublic readonly lineage: readonly NamedType[],\n\t) {}\n\n\tpublic get key(): string {\n\t\treturn `${this.declaredIn ?? \"\"}#${this.name}`;\n\t}\n\n\tpublic get isInstalled(): boolean {\n\t\tconst segments = (this.declaredIn ?? \"\").split(/[\\\\/]/);\n\t\treturn segments.includes(\"node_modules\");\n\t}\n}\n","import type { ClassType } from \"./class-type.ts\";\nimport type { ReturnShape } from \"./return-shape.ts\";\n\nexport type MemberKind = \"field\" | \"constructor parameter\" | \"method\" | \"getter\" | \"setter\";\n\nexport type Visibility = \"public\" | \"protected\" | \"private\";\n\nexport interface MemberProps {\n\treadonly name: string;\n\treadonly line: number;\n\treadonly kind: MemberKind;\n\treadonly visibility: Visibility;\n\treadonly isStatic: boolean;\n\treadonly isParameterProperty: boolean;\n\treadonly isCallable: boolean;\n\treadonly valueTypes: readonly ClassType[];\n\treadonly parameterTypes: readonly ClassType[];\n\treadonly returns: ReturnShape | undefined;\n}\n\nexport class Member {\n\tpublic readonly name: string;\n\tpublic readonly line: number;\n\tpublic readonly kind: MemberKind;\n\tpublic readonly visibility: Visibility;\n\tpublic readonly isStatic: boolean;\n\tpublic readonly isParameterProperty: boolean;\n\tpublic readonly isCallable: boolean;\n\tpublic readonly valueTypes: readonly ClassType[];\n\tpublic readonly parameterTypes: readonly ClassType[];\n\tpublic readonly returns: ReturnShape | undefined;\n\n\tpublic constructor(props: MemberProps) {\n\t\tthis.name = props.name;\n\t\tthis.line = props.line;\n\t\tthis.kind = props.kind;\n\t\tthis.visibility = props.visibility;\n\t\tthis.isStatic = props.isStatic;\n\t\tthis.isParameterProperty = props.isParameterProperty;\n\t\tthis.isCallable = props.isCallable;\n\t\tthis.valueTypes = props.valueTypes;\n\t\tthis.parameterTypes = props.parameterTypes;\n\t\tthis.returns = props.returns;\n\t}\n\n\tpublic get isPublicInstance(): boolean {\n\t\treturn this.visibility === \"public\" && !this.isStatic;\n\t}\n\n\tpublic get isField(): boolean {\n\t\treturn this.kind === \"field\" || this.isParameterProperty;\n\t}\n}\n","export type DependencyForm = \"import\" | \"re-export\" | \"inline type\" | \"dynamic import\" | \"require\" | \"global\";\n\ntype TargetVisibility = \"analysed\" | \"ignored\" | \"unresolved\";\n\nexport type DependencyTarget = { readonly kind: \"file\"; readonly path: string; readonly visibility: TargetVisibility } | { readonly kind: \"package\"; readonly name: string };\n\nexport class Dependency {\n\tpublic constructor(\n\t\tpublic readonly line: number,\n\t\tpublic readonly form: DependencyForm,\n\t\tpublic readonly specifier: string,\n\t\tpublic readonly names: readonly string[],\n\t\tpublic readonly target: DependencyTarget,\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 isOnPackage(name: string): boolean {\n\t\treturn this.target.kind === \"package\" && this.target.name === name;\n\t}\n}\n","export type GlobalOrigin = \"ecmascript\" | \"host\";\n\nexport type GlobalEffect = \"clock\" | \"randomness\";\n\nexport class GlobalUse {\n\tpublic constructor(\n\t\tpublic readonly line: number,\n\t\tpublic readonly name: string,\n\t\tpublic readonly origin: GlobalOrigin,\n\t\tpublic readonly effect: GlobalEffect | undefined,\n\t) {}\n}\n","import { relative, sep } from \"node:path\";\n\nimport type { ClassDeclaration } from \"./classes/class-declaration.ts\";\nimport type { ClassType } from \"./classes/class-type.ts\";\nimport type { SourceFile } from \"./source-file.ts\";\n\nexport class Project {\n\tprivate readonly filesByPath: ReadonlyMap<string, SourceFile>;\n\n\tpublic constructor(\n\t\tpublic readonly directory: string,\n\t\tpublic readonly files: readonly SourceFile[],\n\t) {\n\t\tthis.filesByPath = new Map(files.map((file) => [file.path, file]));\n\t}\n\n\tpublic file(path: string): SourceFile | undefined {\n\t\treturn this.filesByPath.get(path);\n\t}\n\n\tpublic classOf(type: ClassType): ClassDeclaration | undefined {\n\t\tif (type.declaredIn === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.file(type.declaredIn)?.classNamed(type.name);\n\t}\n\n\tpublic relativePath(path: string): string {\n\t\treturn relative(this.directory, path).split(sep).join(\"/\");\n\t}\n}\n","import type { ClassDeclaration } from \"./classes/class-declaration.ts\";\nimport type { Dependency } from \"./dependencies/dependency.ts\";\nimport type { GlobalUse } from \"./dependencies/global-use.ts\";\nimport type { DisableComment } from \"./statements/disable-comment.ts\";\nimport type { Throw } from \"./statements/throw.ts\";\nimport type { TopLevelStatement } from \"./statements/top-level-statement.ts\";\n\nexport interface SourceFileProps {\n\treadonly path: string;\n\treadonly text: string;\n\treadonly dependencies: readonly Dependency[];\n\treadonly classes: readonly ClassDeclaration[];\n\treadonly statements: readonly TopLevelStatement[];\n\treadonly throws: readonly Throw[];\n\treadonly globals: readonly GlobalUse[];\n\treadonly disables: readonly DisableComment[];\n}\n\nexport class SourceFile {\n\tpublic readonly path: string;\n\tpublic readonly dependencies: readonly Dependency[];\n\tpublic readonly classes: readonly ClassDeclaration[];\n\tpublic readonly statements: readonly TopLevelStatement[];\n\tpublic readonly throws: readonly Throw[];\n\tpublic readonly globals: readonly GlobalUse[];\n\tpublic readonly disables: readonly DisableComment[];\n\tprivate readonly lines: readonly string[];\n\n\tpublic constructor(props: SourceFileProps) {\n\t\tthis.path = props.path;\n\t\tthis.dependencies = props.dependencies;\n\t\tthis.classes = props.classes;\n\t\tthis.statements = props.statements;\n\t\tthis.throws = props.throws;\n\t\tthis.globals = props.globals;\n\t\tthis.disables = props.disables;\n\t\tthis.lines = props.text.split(/\\r?\\n/);\n\t}\n\n\tpublic lineText(line: number): string {\n\t\treturn this.lines[line - 1] ?? \"\";\n\t}\n\n\tpublic disableAbove(line: number): DisableComment | undefined {\n\t\treturn this.disables.find((comment) => comment.target === line);\n\t}\n\n\tpublic classNamed(name: string): ClassDeclaration | undefined {\n\t\treturn this.classes.find((candidate) => candidate.name === name);\n\t}\n}\n","export class DisableComment {\n\tpublic constructor(\n\t\tpublic readonly line: number,\n\t\tpublic readonly text: string,\n\t) {}\n\n\tpublic get target(): number {\n\t\treturn this.line + 1;\n\t}\n}\n","export type ThrowForm = \"throw\" | \"Promise.reject\";\n\nexport class Throw {\n\tpublic constructor(\n\t\tpublic readonly line: number,\n\t\tpublic readonly form: ThrowForm,\n\t) {}\n}\n","export type StatementKind = \"function\" | \"enum\" | \"namespace\" | \"mutable variable\" | \"computed constant\" | \"class expression\" | \"statement\";\n\nexport class TopLevelStatement {\n\tpublic constructor(\n\t\tpublic readonly kind: StatementKind,\n\t\tpublic readonly name: string,\n\t\tpublic readonly line: number,\n\t) {}\n}\n","import type { CoreKind, CoreMarker } from \"./core-api.ts\";\nimport type { Layer } from \"./layers.ts\";\n\nexport interface PlaceSpec {\n\treadonly layer: Layer;\n\treadonly folder?: string;\n\treadonly suffix?: string;\n}\n\nexport interface BuildingBlockPlace extends PlaceSpec {\n\treadonly kind: CoreKind;\n\treadonly concreteOnly?: boolean;\n}\n\nexport interface MarkerPlace extends PlaceSpec {\n\treadonly marker: CoreMarker;\n}\n\nexport const buildingBlockPlaces: readonly BuildingBlockPlace[] = [\n\t{ folder: \"aggregates\", kind: \"AggregateRoot\", layer: \"domain\", suffix: \".aggregate.ts\" },\n\t{ folder: \"entities\", kind: \"Entity\", layer: \"domain\", suffix: \".entity.ts\" },\n\t{ folder: \"value-objects\", kind: \"Identifier\", layer: \"domain\", suffix: \".identifier.ts\" },\n\t{ folder: \"value-objects\", kind: \"ValueObject\", layer: \"domain\", suffix: \".value-object.ts\" },\n\t{ folder: \"events\", kind: \"DomainEvent\", layer: \"domain\", suffix: \".event.ts\" },\n\t{ folder: \"errors\", kind: \"DomainError\", layer: \"domain\", suffix: \".error.ts\" },\n\t{ folder: \"services\", kind: \"DomainService\", layer: \"domain\", suffix: \".service.ts\" },\n\t{ folder: \"commands\", kind: \"CommandHandler\", layer: \"application\", suffix: \".command.ts\" },\n\t{ folder: \"queries\", kind: \"QueryHandler\", layer: \"application\", suffix: \".query.ts\" },\n\t{ folder: \"translators\", kind: \"EventTranslator\", layer: \"application\", suffix: \".translator.ts\" },\n\t{ concreteOnly: true, folder: \"adapters\", kind: \"Port\", layer: \"driven\", suffix: \".adapter.ts\" },\n\t{ folder: \"repositories\", kind: \"CommandRepository\", layer: \"domain\", suffix: \".repository.ts\" },\n\t{ folder: \"repositories\", kind: \"QueryRepository\", layer: \"domain\", suffix: \".repository.ts\" },\n\t{ folder: \"ports\", kind: \"Port\", layer: \"domain\", suffix: \".port.ts\" },\n];\n\nexport const markerPlaces: readonly MarkerPlace[] = [\n\t{ folder: \"adapters\", layer: \"driven\", marker: \"AntiCorruptionLayer\", suffix: \".adapter.ts\" },\n\t{ layer: \"driving\", marker: \"OpenHostService\" },\n];\n\nexport const extraDomainFolders: readonly string[] = [\"views\"];\n","export const corePackageName = \"@alveolus/core\";\n\nexport const coreKinds = [\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] as const;\n\nexport type CoreKind = (typeof coreKinds)[number];\n\nexport const coreMarkers = [\"OpenHostService\", \"AntiCorruptionLayer\"] as const;\n\nexport type CoreMarker = (typeof coreMarkers)[number];\n\nexport const coreDomainSymbols: readonly string[] = [\n\t\"AggregateRoot\",\n\t\"AnyAggregateRoot\",\n\t\"AnyDomainError\",\n\t\"AnyDomainEvent\",\n\t\"AnyEntity\",\n\t\"AnyIdentifier\",\n\t\"AnySnapshot\",\n\t\"AnyValueObject\",\n\t\"Clock\",\n\t\"CommandRepository\",\n\t\"DomainError\",\n\t\"DomainEvent\",\n\t\"DomainEventProps\",\n\t\"DomainService\",\n\t\"Entity\",\n\t\"Err\",\n\t\"IdGenerator\",\n\t\"Identifier\",\n\t\"IdentifierValue\",\n\t\"Ok\",\n\t\"Port\",\n\t\"QueryRepository\",\n\t\"Result\",\n\t\"SnapshotValue\",\n\t\"ValueObject\",\n\t\"View\",\n\t\"andThen\",\n\t\"combine\",\n\t\"err\",\n\t\"map\",\n\t\"mapErr\",\n\t\"ok\",\n];\n\nexport const corePublishedLanguageSymbols: readonly string[] = [\"AnyIntegrationEvent\", \"IntegrationEvent\", \"JsonValue\", \"PublishedLanguage\"];\n","export const layers = [\"domain\", \"application\", \"published-language\", \"driven\", \"driving\"] as const;\n\nexport type Layer = (typeof layers)[number];\n\nexport const layerImports: Readonly<Record<Exclude<Layer, \"domain\">, 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","import type { Layer, PlaceSpec } from \"../../conventions/index.ts\";\nimport type { Location } from \"./location.ts\";\n\nexport class Place {\n\tpublic readonly layer: Layer;\n\tpublic readonly folder: string | undefined;\n\tpublic readonly suffix: string | undefined;\n\n\tpublic constructor(spec: PlaceSpec) {\n\t\tthis.layer = spec.layer;\n\t\tthis.folder = spec.folder;\n\t\tthis.suffix = spec.suffix;\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","import type { CoreMarker } from \"../conventions/index.ts\";\nimport { buildingBlockPlaces, extraDomainFolders, markerPlaces } from \"../conventions/index.ts\";\nimport type { ClassDeclaration } from \"../model/index.ts\";\nimport type { CoreApi } from \"./core-api.ts\";\nimport { Place } from \"./paths/place.ts\";\n\nexport interface MarkedPlace {\n\treadonly marker: CoreMarker;\n\treadonly place: Place;\n}\n\nexport class BuildingBlocks {\n\tpublic constructor(private readonly core: CoreApi) {}\n\n\tpublic placeOf(declaration: ClassDeclaration): Place | undefined {\n\t\tconst kinds = this.core.kindsOf(declaration.type);\n\t\tfor (const entry of buildingBlockPlaces) {\n\t\t\tif (kinds.includes(entry.kind) && !(entry.concreteOnly === true && declaration.isAbstract)) {\n\t\t\t\treturn new Place(entry);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic markedPlacesOf(declaration: ClassDeclaration): MarkedPlace[] {\n\t\tconst markers = this.core.markersOf(declaration.implemented);\n\t\tconst places: MarkedPlace[] = [];\n\t\tfor (const entry of markerPlaces) {\n\t\t\tif (markers.includes(entry.marker)) {\n\t\t\t\tplaces.push({ marker: entry.marker, place: new Place(entry) });\n\t\t\t}\n\t\t}\n\t\treturn places;\n\t}\n\n\tpublic foldersOf(layer: \"domain\" | \"application\"): readonly string[] {\n\t\tconst folders: string[] = [];\n\t\tfor (const entry of buildingBlockPlaces) {\n\t\t\tif (entry.layer === layer && entry.folder !== undefined && !folders.includes(entry.folder)) {\n\t\t\t\tfolders.push(entry.folder);\n\t\t\t}\n\t\t}\n\t\tif (layer === \"domain\") {\n\t\t\tfolders.push(...extraDomainFolders);\n\t\t}\n\t\treturn folders;\n\t}\n}\n","import type { CoreKind, CoreMarker } from \"../conventions/index.ts\";\nimport { coreDomainSymbols, coreKinds, coreMarkers, corePackageName, corePublishedLanguageSymbols } from \"../conventions/index.ts\";\nimport type { ClassType, NamedType, ReturnShape } from \"../model/index.ts\";\n\nexport class CoreApi {\n\tpublic get packageName(): string {\n\t\treturn corePackageName;\n\t}\n\n\tpublic kindsOf(type: ClassType): CoreKind[] {\n\t\tconst kinds: CoreKind[] = [];\n\t\tfor (const ancestor of type.lineage) {\n\t\t\tif (this.isCore(ancestor) && this.isKind(ancestor.name)) {\n\t\t\t\tkinds.push(ancestor.name);\n\t\t\t}\n\t\t}\n\t\treturn kinds;\n\t}\n\n\tpublic markersOf(implemented: readonly NamedType[]): CoreMarker[] {\n\t\tconst markers: CoreMarker[] = [];\n\t\tfor (const type of implemented) {\n\t\t\tif (this.isCore(type) && this.isMarker(type.name)) {\n\t\t\t\tmarkers.push(type.name);\n\t\t\t}\n\t\t}\n\t\treturn markers;\n\t}\n\n\tpublic isResult(shape: ReturnShape): boolean {\n\t\tif (shape.alias !== undefined && shape.alias.name === \"Result\" && this.isCore(shape.alias)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn shape.union.every((member) => (member.name === \"Ok\" || member.name === \"Err\") && this.isCore(member));\n\t}\n\n\tpublic isDomainSymbol(name: string): boolean {\n\t\treturn coreDomainSymbols.includes(name);\n\t}\n\n\tpublic isPublishedLanguageSymbol(name: string): boolean {\n\t\treturn corePublishedLanguageSymbols.includes(name);\n\t}\n\n\tprivate isKind(name: string): name is CoreKind {\n\t\treturn (coreKinds as readonly string[]).includes(name);\n\t}\n\n\tprivate isMarker(name: string): name is CoreMarker {\n\t\treturn (coreMarkers as readonly string[]).includes(name);\n\t}\n\n\tprivate isCore(type: NamedType): boolean {\n\t\treturn type.packageName === corePackageName;\n\t}\n}\n","import type { Layer } from \"../conventions/index.ts\";\nimport { layerImports, layers } from \"../conventions/index.ts\";\n\nexport class Layers {\n\tpublic isLayer(name: string): name is Layer {\n\t\treturn (layers as readonly string[]).includes(name);\n\t}\n\n\tpublic importableFrom(layer: Exclude<Layer, \"domain\">): readonly Layer[] {\n\t\treturn layerImports[layer];\n\t}\n}\n","import type { BuildingBlocks } from \"../building-blocks.ts\";\nimport type { ExtraFolders } from \"../settings.ts\";\nimport type { Location } from \"./location.ts\";\n\nexport type ShapeIssue =\n\t| { readonly kind: \"directlyInLayer\" | \"tooDeep\"; readonly layer: \"domain\" | \"application\"; readonly example: string }\n\t| { readonly kind: \"unknownFolder\"; readonly layer: \"domain\" | \"application\"; readonly folder: string; readonly folders: readonly string[] }\n\t| { readonly kind: \"nestedPublishedLanguage\" | \"drivenWithoutTechnology\" | \"drivenTooDeep\" | \"drivingWithoutTechnology\" };\n\nexport class LayerShape {\n\tpublic constructor(\n\t\tprivate readonly blocks: BuildingBlocks,\n\t\tprivate readonly extraFolders: ExtraFolders,\n\t) {}\n\n\tpublic issueWith(location: Location): ShapeIssue | undefined {\n\t\tconst layer = location.layer;\n\t\tconst folders = location.foldersInLayer;\n\t\tif (layer === \"domain\" || layer === \"application\") {\n\t\t\treturn this.kindFolderIssue(layer, folders);\n\t\t}\n\t\tif (layer === \"published-language\" && folders.length > 0) {\n\t\t\treturn { kind: \"nestedPublishedLanguage\" };\n\t\t}\n\t\tif (layer === \"driven\" && folders.length < 2) {\n\t\t\treturn { kind: \"drivenWithoutTechnology\" };\n\t\t}\n\t\tif (layer === \"driven\" && folders.length > 2) {\n\t\t\treturn { kind: \"drivenTooDeep\" };\n\t\t}\n\t\tif (layer === \"driving\" && folders.length === 0) {\n\t\t\treturn { kind: \"drivingWithoutTechnology\" };\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate kindFolderIssue(layer: \"domain\" | \"application\", folders: readonly string[]): ShapeIssue | undefined {\n\t\tconst expected = [...this.blocks.foldersOf(layer), ...(this.extraFolders[layer] ?? [])];\n\t\tconst example = `${layer}/${expected[0]}/`;\n\t\tif (folders.length === 0) {\n\t\t\treturn { example, kind: \"directlyInLayer\", layer };\n\t\t}\n\t\tif (folders.length > 1) {\n\t\t\treturn { example, kind: \"tooDeep\", layer };\n\t\t}\n\t\tconst [folder] = folders;\n\t\tif (folder !== undefined && !expected.includes(folder)) {\n\t\t\treturn { folder, folders: expected, kind: \"unknownFolder\", layer };\n\t\t}\n\t\treturn undefined;\n\t}\n}\n","import type { Layer } from \"../../conventions/index.ts\";\nimport type { SubdomainType } from \"../settings.ts\";\n\nexport type Area = \"context\" | \"shared-kernel\" | \"root\" | \"outside\";\n\nexport type Unseen = \"ignored\" | \"unresolved\";\n\nexport interface LocationProps {\n\treadonly area: Area;\n\treadonly context?: string;\n\treadonly subdomain?: SubdomainType;\n\treadonly layer?: Layer;\n\treadonly folder?: string;\n\treadonly foldersInLayer?: readonly string[];\n\treadonly fileName: string;\n\treadonly isCompositionRoot?: boolean;\n\treadonly unseen?: Unseen;\n}\n\nexport class Location {\n\tpublic readonly area: Area;\n\tpublic readonly context: string | undefined;\n\tpublic readonly subdomain: SubdomainType | undefined;\n\tpublic readonly layer: Layer | undefined;\n\tpublic readonly folder: string | undefined;\n\tpublic readonly foldersInLayer: readonly string[];\n\tpublic readonly fileName: string;\n\tpublic readonly isCompositionRoot: boolean;\n\tpublic readonly unseen: Unseen | undefined;\n\n\tpublic constructor(props: LocationProps) {\n\t\tthis.area = props.area;\n\t\tthis.context = props.context;\n\t\tthis.subdomain = props.subdomain;\n\t\tthis.layer = props.layer;\n\t\tthis.folder = props.folder;\n\t\tthis.foldersInLayer = props.foldersInLayer ?? [];\n\t\tthis.fileName = props.fileName;\n\t\tthis.isCompositionRoot = props.isCompositionRoot ?? false;\n\t\tthis.unseen = props.unseen;\n\t}\n\n\tpublic get isInBoundedContext(): boolean {\n\t\treturn this.area === \"context\";\n\t}\n\n\tpublic get isInCoreDomain(): boolean {\n\t\treturn this.isInBoundedContext && this.subdomain === \"core\";\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","import { basename, dirname, isAbsolute, matchesGlob, relative, resolve, sep } from \"node:path\";\n\nimport type { Layer } from \"../../conventions/index.ts\";\nimport { layers } from \"../../conventions/index.ts\";\nimport type { ContextFolder, Settings } from \"../settings.ts\";\nimport type { LocationProps } from \"./location.ts\";\nimport { Location } from \"./location.ts\";\n\nexport class Layout {\n\tpublic constructor(private readonly settings: Settings) {}\n\n\tpublic locate(path: string): Location {\n\t\tconst file = resolve(path);\n\t\tconst fileName = basename(file);\n\t\tconst folder = this.contextFolderOf(file);\n\n\t\tif (folder === undefined) {\n\t\t\tconst isAtRoot = dirname(file) === this.settings.rootDir;\n\t\t\treturn new Location({ area: isAtRoot ? \"root\" : \"outside\", fileName });\n\t\t}\n\n\t\tconst inside = this.insideOf(folder);\n\t\tconst directories = this.directoriesBetween(folder.dir, file);\n\n\t\tif (directories.length === 0) {\n\t\t\treturn new Location({ ...inside, fileName, isCompositionRoot: this.isCompositionRoot(fileName) });\n\t\t}\n\n\t\tconst layerIndex = this.layerIndexOf(directories, folder.isSharedKernel);\n\t\tif (layerIndex === undefined) {\n\t\t\tconst isFeatureRoot = folder.isSharedKernel && directories.length === 1;\n\t\t\treturn new Location({ ...inside, fileName, isCompositionRoot: isFeatureRoot && this.isCompositionRoot(fileName) });\n\t\t}\n\n\t\tconst layer = directories[layerIndex];\n\t\tif (layer === undefined || !this.isLayer(layer)) {\n\t\t\treturn new Location({ ...inside, fileName });\n\t\t}\n\t\tconst foldersInLayer = directories.slice(layerIndex + 1);\n\t\tconst subfolder = foldersInLayer.at(-1);\n\t\treturn new Location({ ...inside, fileName, foldersInLayer, layer, ...(subfolder === undefined ? {} : { folder: subfolder }) });\n\t}\n\n\tprivate insideOf(folder: ContextFolder): Pick<LocationProps, \"area\" | \"context\" | \"subdomain\"> {\n\t\tconst area = folder.isSharedKernel ? \"shared-kernel\" : \"context\";\n\t\treturn { area, context: folder.name, ...(folder.subdomain === undefined ? {} : { subdomain: folder.subdomain }) };\n\t}\n\n\tprivate layerIndexOf(directories: readonly string[], isSharedKernel: boolean): number | undefined {\n\t\tif (this.isLayer(directories[0] ?? \"\")) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (isSharedKernel && this.isLayer(directories[1] ?? \"\")) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate isLayer(name: string): name is Layer {\n\t\treturn (layers as readonly string[]).includes(name);\n\t}\n\n\tprivate isCompositionRoot(fileName: string): boolean {\n\t\treturn matchesGlob(fileName, this.settings.compositionRoot);\n\t}\n\n\tprivate contextFolderOf(path: string): ContextFolder | undefined {\n\t\tconst containing = this.settings.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","import { basename } from \"node:path\";\n\nimport type { CoreKind, CoreMarker } from \"../conventions/index.ts\";\nimport type { ClassType, DependencyTarget, Member, Project, SourceFile } from \"../model/index.ts\";\nimport { ClassDeclaration } from \"../model/index.ts\";\nimport type { AllowedPackages } from \"./allowed-packages.ts\";\nimport { BuildingBlocks } from \"./building-blocks.ts\";\nimport type { ContextMap } from \"./context-map.ts\";\nimport { CoreApi } from \"./core-api.ts\";\nimport { Layers } from \"./layers.ts\";\nimport type { ShapeIssue } from \"./paths/layer-shape.ts\";\nimport { LayerShape } from \"./paths/layer-shape.ts\";\nimport { Layout } from \"./paths/layout.ts\";\nimport { Location } from \"./paths/location.ts\";\nimport type { Settings } from \"./settings.ts\";\n\ntype FileTarget = Extract<DependencyTarget, { kind: \"file\" }>;\n\nexport class Architecture {\n\tpublic readonly core: CoreApi = new CoreApi();\n\tpublic readonly layers: Layers = new Layers();\n\tpublic readonly blocks: BuildingBlocks = new BuildingBlocks(this.core);\n\tprivate readonly shape: LayerShape;\n\tprivate readonly layout: Layout;\n\tprivate readonly locations = new Map<string, Location>();\n\n\tpublic constructor(\n\t\tpublic readonly project: Project,\n\t\tprivate readonly settings: Settings,\n\t) {\n\t\tthis.layout = new Layout(settings);\n\t\tthis.shape = new LayerShape(this.blocks, settings.extraFolders);\n\t}\n\n\tpublic get files(): readonly SourceFile[] {\n\t\treturn this.project.files;\n\t}\n\n\tpublic get domainDependencies(): AllowedPackages {\n\t\treturn this.settings.domainDependencies;\n\t}\n\n\tpublic get applicationDependencies(): AllowedPackages {\n\t\treturn this.settings.applicationDependencies;\n\t}\n\n\tpublic get contextMap(): ContextMap {\n\t\treturn this.settings.contextMap;\n\t}\n\n\tpublic locationOf(file: SourceFile): Location {\n\t\treturn this.locate(file.path);\n\t}\n\n\tpublic locationOfTarget(target: FileTarget): Location {\n\t\tif (target.visibility !== \"analysed\") {\n\t\t\treturn new Location({ area: \"outside\", fileName: basename(target.path), unseen: target.visibility });\n\t\t}\n\t\treturn this.locate(target.path);\n\t}\n\n\tpublic shapeIssueOf(location: Location): ShapeIssue | undefined {\n\t\treturn this.shape.issueWith(location);\n\t}\n\n\tpublic relativePath(path: string): string {\n\t\treturn this.project.relativePath(path);\n\t}\n\n\tpublic kindsOf(subject: ClassType | ClassDeclaration): CoreKind[] {\n\t\treturn this.core.kindsOf(this.typeOf(subject));\n\t}\n\n\tpublic kindOf(subject: ClassType | ClassDeclaration): CoreKind | undefined {\n\t\treturn this.kindsOf(subject)[0];\n\t}\n\n\tpublic is(subject: ClassType | ClassDeclaration, kind: CoreKind): boolean {\n\t\treturn this.kindsOf(subject).includes(kind);\n\t}\n\n\tpublic isBuildingBlock(subject: ClassType | ClassDeclaration): boolean {\n\t\treturn this.kindsOf(subject).length > 0;\n\t}\n\n\tpublic implementsMarker(declaration: ClassDeclaration, marker: CoreMarker): boolean {\n\t\treturn this.core.markersOf(declaration.implemented).includes(marker);\n\t}\n\n\tpublic returnsResult(member: Member): boolean {\n\t\treturn member.returns !== undefined && this.core.isResult(member.returns);\n\t}\n\n\tpublic classOf(type: ClassType): ClassDeclaration | undefined {\n\t\treturn this.project.classOf(type);\n\t}\n\n\tprivate locate(path: string): Location {\n\t\tlet location = this.locations.get(path);\n\t\tif (location === undefined) {\n\t\t\tlocation = this.layout.locate(path);\n\t\t\tthis.locations.set(path, location);\n\t\t}\n\t\treturn location;\n\t}\n\n\tprivate typeOf(subject: ClassType | ClassDeclaration): ClassType {\n\t\treturn subject instanceof ClassDeclaration ? subject.type : subject;\n\t}\n}\n","export type Upstreams = Readonly<Record<string, readonly string[]>>;\n\nexport class ContextMap {\n\tpublic constructor(private readonly upstreams: Upstreams) {}\n\n\tpublic get contexts(): string[] {\n\t\treturn Object.keys(this.upstreams);\n\t}\n\n\tpublic get consumed(): string[] {\n\t\tconst names = new Set<string>();\n\t\tfor (const targets of Object.values(this.upstreams)) {\n\t\t\tfor (const target of targets) {\n\t\t\t\tnames.add(target);\n\t\t\t}\n\t\t}\n\t\treturn [...names];\n\t}\n\n\tpublic selfConsumers(): string[] {\n\t\treturn this.contexts.filter((context) => this.allows(context, context));\n\t}\n\n\tpublic allows(from: string, to: string): boolean {\n\t\treturn (this.upstreams[from] ?? []).includes(to);\n\t}\n\n\tpublic cycle(): string[] | undefined {\n\t\tconst visiting = new Set<string>();\n\t\tconst done = new Set<string>();\n\t\tfor (const start of this.contexts) {\n\t\t\tconst found = this.cycleFrom(start, [], visiting, done);\n\t\t\tif (found !== undefined) {\n\t\t\t\treturn found;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate cycleFrom(context: string, path: string[], visiting: Set<string>, done: Set<string>): string[] | undefined {\n\t\tif (done.has(context)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (visiting.has(context)) {\n\t\t\treturn [...path.slice(path.indexOf(context)), context];\n\t\t}\n\t\tvisiting.add(context);\n\t\tfor (const upstream of this.upstreams[context] ?? []) {\n\t\t\tconst found = this.cycleFrom(upstream, [...path, context], visiting, done);\n\t\t\tif (found !== undefined) {\n\t\t\t\treturn found;\n\t\t\t}\n\t\t}\n\t\tvisiting.delete(context);\n\t\tdone.add(context);\n\t\treturn undefined;\n\t}\n}\n","import type { Architecture, Location, Place } from \"../../architecture/index.ts\";\nimport type { DependencyTarget } from \"../../model/index.ts\";\n\ntype FileTarget = Extract<DependencyTarget, { kind: \"file\" }>;\n\nexport class Wording {\n\tpublic target(target: FileTarget, architecture: Architecture): string {\n\t\treturn `${architecture.relativePath(target.path)} (${this.location(architecture.locationOfTarget(target))})`;\n\t}\n\n\tpublic location(location: Location): string {\n\t\tif (location.unseen === \"ignored\") {\n\t\t\treturn \"ignored by the analysis\";\n\t\t}\n\t\tif (location.unseen === \"unresolved\") {\n\t\t\treturn \"not resolved by the analysis\";\n\t\t}\n\t\tif (location.isOutside) {\n\t\t\treturn \"outside the declared bounded contexts and shared kernel\";\n\t\t}\n\t\tif (location.isAtRoot) {\n\t\t\treturn \"at the root\";\n\t\t}\n\t\tconst role = location.isCompositionRoot ? \"composition root\" : (location.layer ?? \"outside the layers\");\n\t\treturn `${location.context} ${role}`;\n\t}\n\n\tpublic place(place: Place): string {\n\t\treturn place.folder === undefined ? `${place.layer}/` : `${place.layer}/${place.folder}/*${place.suffix ?? \".ts\"}`;\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { SourceFile } from \"../../model/index.ts\";\nimport type { Finding, FindingData } from \"./finding.ts\";\nimport { Wording } from \"./wording.ts\";\n\ntype RuleContexts = \"every\" | \"core\";\n\nexport interface RuleMeta<Id extends string, MessageId extends string> {\n\treadonly id: Id;\n\treadonly contexts: RuleContexts;\n\treadonly description: string;\n\treadonly messages: Readonly<Record<MessageId, string>>;\n}\n\nexport abstract class Rule<Id extends string = string, MessageId extends string = string> {\n\tpublic abstract readonly meta: RuleMeta<Id, MessageId>;\n\n\tprotected readonly wording: Wording = new Wording();\n\n\tpublic abstract check(architecture: Architecture): Finding<MessageId>[];\n\n\tprotected filesOf(architecture: Architecture): SourceFile[] {\n\t\tconst files: SourceFile[] = [];\n\t\tfor (const file of architecture.files) {\n\t\t\tif (this.checks(file, architecture)) {\n\t\t\t\tfiles.push(file);\n\t\t\t}\n\t\t}\n\t\treturn files;\n\t}\n\n\tprivate checks(file: SourceFile, architecture: Architecture): boolean {\n\t\tif (this.meta.contexts === \"every\") {\n\t\t\treturn true;\n\t\t}\n\t\tconst location = architecture.locationOf(file);\n\t\treturn !location.isInBoundedContext || location.isInCoreDomain;\n\t}\n\n\tprotected finding(file: SourceFile, line: number, symbol: string, messageId: MessageId, data: FindingData = {}): Finding<MessageId> {\n\t\treturn { data, file, line, messageId, symbol };\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { ClassDeclaration, SourceFile } from \"../../model/index.ts\";\nimport type { Finding } from \"./finding.ts\";\nimport { Rule } from \"./rule.ts\";\n\nexport abstract class ClassRule<Id extends string = string, MessageId extends string = string> extends Rule<Id, MessageId> {\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tfor (const codeClass of file.classes) {\n\t\t\t\tfindings.push(...this.findingsFor(codeClass, file, architecture));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprotected abstract findingsFor(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<MessageId>[];\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { Dependency, SourceFile } from \"../../model/index.ts\";\nimport type { Finding } from \"./finding.ts\";\nimport { Rule } from \"./rule.ts\";\n\nexport abstract class ImportRule<Id extends string = string, MessageId extends string = string> extends Rule<Id, MessageId> {\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tif (!this.appliesTo(file, architecture)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const dependency of file.dependencies) {\n\t\t\t\tconst finding = this.findingFor(dependency, file, architecture);\n\t\t\t\tif (finding !== undefined) {\n\t\t\t\t\tfindings.push(finding);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprotected abstract appliesTo(file: SourceFile, architecture: Architecture): boolean;\n\n\tprotected abstract findingFor(dependency: Dependency, file: SourceFile, architecture: Architecture): Finding<MessageId> | undefined;\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { CoreKind } from \"../../conventions/index.ts\";\nimport type { ClassDeclaration, ClassType, SourceFile } from \"../../model/index.ts\";\nimport { ClassRule } from \"./class-rule.ts\";\nimport type { Finding } from \"./finding.ts\";\n\nexport abstract class InjectionRule<Id extends string = string> extends ClassRule<Id, \"foreign\"> {\n\tprotected abstract readonly holder: CoreKind;\n\n\tprotected abstract readonly forbidden: readonly CoreKind[];\n\n\tprotected abstract readonly allowed: readonly CoreKind[];\n\n\tprotected findingsFor(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<\"foreign\">[] {\n\t\tif (!architecture.is(codeClass, this.holder)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst findings: Finding<\"foreign\">[] = [];\n\t\tfor (const member of codeClass.heldMembers) {\n\t\t\tfor (const type of member.valueTypes) {\n\t\t\t\tif (!this.accepts(type, architecture)) {\n\t\t\t\t\tconst data = { class: codeClass.name, kind: this.describeKind(type, architecture), type: type.name };\n\t\t\t\t\tfindings.push(this.finding(file, member.line, `${codeClass.name}.${member.name}`, \"foreign\", data));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate accepts(type: ClassType, architecture: Architecture): boolean {\n\t\tif (this.forbidden.some((kind) => architecture.is(type, kind))) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.allowed.some((kind) => architecture.is(type, kind))) {\n\t\t\treturn true;\n\t\t}\n\t\treturn type.isInstalled && !architecture.isBuildingBlock(type);\n\t}\n\n\tprivate describeKind(type: ClassType, architecture: Architecture): string {\n\t\tconst kind = architecture.kindOf(type);\n\t\tif (kind === undefined) {\n\t\t\treturn \"a class that extends no building block\";\n\t\t}\n\t\tconst article = /^[AEIO]/.test(kind) ? \"an\" : \"a\";\n\t\treturn `${article} ${kind}`;\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { CoreKind } from \"../../conventions/index.ts\";\nimport type { ClassDeclaration, Dependency, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { ImportRule } from \"../framework/index.ts\";\n\nconst shortcuts: readonly CoreKind[] = [\"CommandRepository\", \"QueryRepository\", \"Port\", \"AggregateRoot\", \"Entity\", \"DomainService\"];\n\nexport class NoDrivingShortcutRule extends ImportRule<\"layers/no-driving-shortcut\", \"shortcut\"> {\n\tpublic readonly meta: RuleMeta<\"layers/no-driving-shortcut\", \"shortcut\"> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A driving adapter importing a port, a repository, an aggregate, an entity or a domain service instead of calling a handler.\",\n\t\tid: \"layers/no-driving-shortcut\",\n\t\tmessages: {\n\t\t\tshortcut: \"Imports {name}, {kind}: a driving adapter calls the command and query handlers, never the ports, repositories or aggregates of the domain.\",\n\t\t},\n\t};\n\n\tprotected appliesTo(file: SourceFile, architecture: Architecture): boolean {\n\t\treturn architecture.locationOf(file).layer === \"driving\";\n\t}\n\n\tprotected findingFor(dependency: Dependency, file: SourceFile, architecture: Architecture): Finding<\"shortcut\"> | undefined {\n\t\tif (dependency.target.kind !== \"file\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst target = architecture.project.file(dependency.target.path);\n\t\tif (target === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tfor (const codeClass of this.importedClasses(dependency, target)) {\n\t\t\tconst kind = this.shortcutKindOf(codeClass, architecture);\n\t\t\tif (kind !== undefined) {\n\t\t\t\tconst article = /^[AEIO]/.test(kind) ? \"an\" : \"a\";\n\t\t\t\treturn this.finding(file, dependency.line, codeClass.name, \"shortcut\", { kind: `${article} ${kind}`, name: codeClass.name });\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate importedClasses(dependency: Dependency, target: SourceFile): ClassDeclaration[] {\n\t\tif (dependency.names.includes(\"*\")) {\n\t\t\treturn [...target.classes];\n\t\t}\n\t\tconst classes: ClassDeclaration[] = [];\n\t\tfor (const name of dependency.names) {\n\t\t\tconst codeClass = target.classNamed(name);\n\t\t\tif (codeClass !== undefined) {\n\t\t\t\tclasses.push(codeClass);\n\t\t\t}\n\t\t}\n\t\treturn classes;\n\t}\n\n\tprivate shortcutKindOf(codeClass: ClassDeclaration, architecture: Architecture): CoreKind | undefined {\n\t\treturn architecture.kindsOf(codeClass).find((kind) => shortcuts.includes(kind));\n\t}\n}\n","import type { Architecture, Location } from \"../../architecture/index.ts\";\nimport type { Dependency, GlobalUse, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { ImportRule } from \"../framework/index.ts\";\n\ntype MessageId = \"otherLayer\" | \"coreSymbol\" | \"undeclaredPackage\" | \"packageName\" | \"hostGlobal\" | \"clock\" | \"randomness\";\n\nexport class NoImpureDomainRule extends ImportRule<\"layers/no-impure-domain\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"layers/no-impure-domain\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"The domain importing a framework, a database, another layer or a package not allowed, or using the host, the clock or randomness.\",\n\t\tid: \"layers/no-impure-domain\",\n\t\tmessages: {\n\t\t\tclock: \"The domain reads the system clock with {name}: receive the time from the Clock port.\",\n\t\t\tcoreSymbol: \"The domain imports {names} from @alveolus/core: only domain building blocks and Result are allowed.\",\n\t\t\thostGlobal: \"The domain uses {name}, a global of the host: reach it through a port.\",\n\t\t\totherLayer: \"The domain imports {target}: it may only import the domain.\",\n\t\t\tpackageName: \"The domain imports {names} from {package}: domainDependencies only allows {allowed}.\",\n\t\t\trandomness: \"The domain draws a random value with {name}: receive it from a port, such as IdGenerator.\",\n\t\t\tundeclaredPackage: \"The domain imports {package}: add it to domainDependencies if the domain really needs it.\",\n\t\t},\n\t};\n\n\tpublic override check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings = super.check(architecture);\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tif (this.appliesTo(file, architecture)) {\n\t\t\t\tfindings.push(...this.impureGlobals(file));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprotected appliesTo(file: SourceFile, architecture: Architecture): boolean {\n\t\treturn architecture.locationOf(file).layer === \"domain\";\n\t}\n\n\tprotected findingFor(dependency: Dependency, file: SourceFile, architecture: Architecture): Finding<MessageId> | undefined {\n\t\tconst { line, label } = dependency;\n\t\tconst target = dependency.target;\n\t\tif (target.kind === \"file\") {\n\t\t\tif (this.isDomainReachable(architecture.locationOfTarget(target), architecture.locationOf(file))) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn this.finding(file, line, label, \"otherLayer\", { target: this.wording.target(target, architecture) });\n\t\t}\n\t\tif (target.name === architecture.core.packageName) {\n\t\t\tconst forbidden = dependency.names.filter((name) => !architecture.core.isDomainSymbol(name));\n\t\t\treturn forbidden.length === 0 ? undefined : this.finding(file, line, label, \"coreSymbol\", { names: forbidden.join(\", \") });\n\t\t}\n\t\tconst allowed = architecture.domainDependencies;\n\t\tif (!allowed.has(target.name)) {\n\t\t\treturn this.finding(file, line, label, \"undeclaredPackage\", { package: target.name });\n\t\t}\n\t\tconst forbidden = allowed.forbiddenNames(target.name, dependency.names);\n\t\tif (forbidden.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.finding(file, line, label, \"packageName\", { allowed: allowed.allowedNames(target.name).join(\", \"), names: forbidden.join(\", \"), package: target.name });\n\t}\n\n\tprivate impureGlobals(file: SourceFile): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const use of file.globals) {\n\t\t\tconst messageId = this.messageFor(use);\n\t\t\tif (messageId !== undefined) {\n\t\t\t\tfindings.push(this.finding(file, use.line, use.name, messageId, { name: use.name }));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate messageFor(use: GlobalUse): MessageId | undefined {\n\t\tif (use.origin === \"host\") {\n\t\t\treturn \"hostGlobal\";\n\t\t}\n\t\treturn use.effect;\n\t}\n\n\tprivate isDomainReachable(to: Location, from: Location): boolean {\n\t\treturn to.layer === \"domain\" && (to.isSameContextAs(from) || to.isInSharedKernel);\n\t}\n}\n","import { basename, dirname } from \"node:path\";\n\nimport type { Architecture, Location, ShapeIssue } from \"../../architecture/index.ts\";\nimport type { Dependency, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, FindingData, RuleMeta } from \"../framework/index.ts\";\nimport { ImportRule } from \"../framework/index.ts\";\n\ntype MessageId =\n\t| ShapeIssue[\"kind\"]\n\t| \"outsideContexts\"\n\t| \"outsideLayers\"\n\t| \"compositionRoots\"\n\t| \"rootImport\"\n\t| \"wiring\"\n\t| \"outwardLayer\"\n\t| \"publishedLanguageCore\"\n\t| \"undeclaredPackage\"\n\t| \"packageName\";\n\ninterface LayerProblem {\n\treadonly messageId: MessageId;\n\treadonly data: FindingData;\n}\n\nexport class NoOutwardImportRule extends ImportRule<\"layers/no-outward-import\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"layers/no-outward-import\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A dependency pointing away from the domain, a file outside the layers or in the wrong folder of its layer.\",\n\t\tid: \"layers/no-outward-import\",\n\t\tmessages: {\n\t\t\tcompositionRoots: \"{context} has {count} composition roots ({names}): keep one, and move the rest into the layers.\",\n\t\t\tdirectlyInLayer: \"The file sits directly in {layer}/: put it in the folder of its kind, such as {example}.\",\n\t\t\tdrivenTooDeep: \"The file is nested too deep: driven/ holds driven/<technology>/<folder>/, such as driven/pg/adapters/.\",\n\t\t\tdrivenWithoutTechnology: \"The file is not under a technology: driven/ holds driven/<technology>/<folder>/, such as driven/pg/adapters/.\",\n\t\t\tdrivingWithoutTechnology: \"The file is not under a technology: driving/ holds driving/<technology>/, such as driving/http/.\",\n\t\t\tnestedPublishedLanguage: \"The file is nested in published-language/: the published language holds its files directly.\",\n\t\t\toutsideContexts: \"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\toutsideLayers: \"The file is outside the layers: move it to domain/, application/, published-language/, driven/ or driving/.\",\n\t\t\toutwardLayer: \"The {layer} layer imports {target}: it may only import {allowed}.\",\n\t\t\tpackageName: \"The application imports {names} from {package}: applicationDependencies only allows {allowed}.\",\n\t\t\tpublishedLanguageCore: \"The published language imports {names} from @alveolus/core: only published-language types are allowed.\",\n\t\t\trootImport: \"Files at the root import composition roots only, not {target}.\",\n\t\t\ttooDeep: \"The file is nested too deep: {layer}/ holds one folder per kind, such as {example}.\",\n\t\t\tundeclaredPackage: \"The application imports {package}: add it to applicationDependencies if the application really needs it.\",\n\t\t\tunknownFolder: \"{layer}/{folder}/ is no folder of the {layer}: use {folders}.\",\n\t\t\twiring: \"Imports {target}: only the composition root wires the layers.\",\n\t\t},\n\t};\n\n\tpublic override check(architecture: Architecture): Finding<MessageId>[] {\n\t\treturn [...this.misplacedFiles(architecture), ...this.extraCompositionRoots(architecture), ...super.check(architecture)];\n\t}\n\n\tprotected appliesTo(file: SourceFile, architecture: Architecture): boolean {\n\t\tconst location = architecture.locationOf(file);\n\t\treturn location.isAtRoot || location.isCompositionRoot || (location.isInLayer && location.layer !== \"domain\");\n\t}\n\n\tprotected findingFor(dependency: Dependency, file: SourceFile, architecture: Architecture): Finding<MessageId> | undefined {\n\t\tconst from = architecture.locationOf(file);\n\t\tconst target = dependency.target;\n\t\tif (target.kind === \"file\") {\n\t\t\tconst problem = this.layerProblem(from, architecture.locationOfTarget(target), architecture);\n\t\t\tif (problem === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn this.finding(file, dependency.line, dependency.label, problem.messageId, { ...problem.data, target: this.wording.target(target, architecture) });\n\t\t}\n\t\tif (from.layer === \"application\") {\n\t\t\treturn this.applicationPackageFinding(dependency, target.name, file, architecture);\n\t\t}\n\t\tif (from.layer === \"published-language\" && target.name === architecture.core.packageName) {\n\t\t\tconst forbidden = dependency.names.filter((name) => !architecture.core.isPublishedLanguageSymbol(name));\n\t\t\treturn forbidden.length === 0 ? undefined : this.finding(file, dependency.line, dependency.label, \"publishedLanguageCore\", { names: forbidden.join(\", \") });\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate misplacedFiles(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tconst location = architecture.locationOf(file);\n\t\t\tif (location.isOutside) {\n\t\t\t\tfindings.push(this.finding(file, 1, location.fileName, \"outsideContexts\"));\n\t\t\t} else if (!location.isAtRoot && !location.isInLayer && !location.isCompositionRoot) {\n\t\t\t\tfindings.push(this.finding(file, 1, location.fileName, \"outsideLayers\"));\n\t\t\t} else if (location.isInLayer) {\n\t\t\t\tconst issue = architecture.shapeIssueOf(location);\n\t\t\t\tif (issue !== undefined) {\n\t\t\t\t\tfindings.push(this.finding(file, 1, location.fileName, issue.kind, this.shapeData(issue)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate shapeData(issue: ShapeIssue): FindingData {\n\t\tif (issue.kind === \"unknownFolder\") {\n\t\t\treturn { folder: issue.folder, folders: issue.folders.map((name) => `${name}/`).join(\", \"), layer: issue.layer };\n\t\t}\n\t\tif (issue.kind === \"directlyInLayer\" || issue.kind === \"tooDeep\") {\n\t\t\treturn { example: issue.example, layer: issue.layer };\n\t\t}\n\t\treturn {};\n\t}\n\n\tprivate extraCompositionRoots(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst byFolder = new Map<string, SourceFile[]>();\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tif (architecture.locationOf(file).isCompositionRoot) {\n\t\t\t\tconst folder = dirname(file.path);\n\t\t\t\tbyFolder.set(folder, [...(byFolder.get(folder) ?? []), file]);\n\t\t\t}\n\t\t}\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const roots of byFolder.values()) {\n\t\t\tif (roots.length < 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst names = roots.map((root) => basename(root.path)).sort();\n\t\t\tfor (const root of roots) {\n\t\t\t\tconst location = architecture.locationOf(root);\n\t\t\t\tconst data = { context: location.context ?? \"\", count: roots.length, names: names.join(\", \") };\n\t\t\t\tfindings.push(this.finding(root, 1, location.fileName, \"compositionRoots\", data));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate layerProblem(from: Location, to: Location, architecture: Architecture): LayerProblem | undefined {\n\t\tif (from.isAtRoot) {\n\t\t\treturn to.isInBoundedContext && !to.isCompositionRoot ? { data: {}, messageId: \"rootImport\" } : 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 { data: {}, messageId: \"wiring\" };\n\t\t}\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 = architecture.layers.importableFrom(layer);\n\t\tif (to.layer !== undefined && allowed.includes(to.layer)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn { data: { allowed: allowed.join(\", \"), layer }, messageId: \"outwardLayer\" };\n\t}\n\n\tprivate applicationPackageFinding(dependency: Dependency, packageName: string, file: SourceFile, architecture: Architecture): Finding<MessageId> | undefined {\n\t\tif (packageName === architecture.core.packageName) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst { line, label } = dependency;\n\t\tconst allowed = architecture.applicationDependencies;\n\t\tif (!allowed.has(packageName)) {\n\t\t\treturn this.finding(file, line, label, \"undeclaredPackage\", { package: packageName });\n\t\t}\n\t\tconst forbidden = allowed.forbiddenNames(packageName, dependency.names);\n\t\tif (forbidden.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.finding(file, line, label, \"packageName\", { allowed: allowed.allowedNames(packageName).join(\", \"), names: forbidden.join(\", \"), package: packageName });\n\t}\n}\n","import type { Architecture, Location } from \"../../architecture/index.ts\";\nimport type { ClassDeclaration, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { ClassRule } from \"../framework/index.ts\";\n\ntype MessageId = \"portless\" | \"portOutsideDomain\";\n\nexport class NoPortlessAdapterRule extends ClassRule<\"layers/no-portless-adapter\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"layers/no-portless-adapter\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A driven adapter that extends no port, a port declared outside the domain.\",\n\t\tid: \"layers/no-portless-adapter\",\n\t\tmessages: {\n\t\t\tportless: \"{class} is a driven adapter but extends no Port: extend the port it implements.\",\n\t\t\tportOutsideDomain: \"The port {class} is declared outside the domain: move it to domain/ports/ or domain/repositories/.\",\n\t\t},\n\t};\n\n\tprotected findingsFor(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<MessageId>[] {\n\t\tconst location = architecture.locationOf(file);\n\t\tconst isPort = architecture.is(codeClass, \"Port\");\n\t\tif (this.isAdaptersFolder(location) && !isPort) {\n\t\t\treturn [this.finding(file, codeClass.line, codeClass.name, \"portless\", { class: codeClass.name })];\n\t\t}\n\t\tif (isPort && codeClass.isAbstract && !this.isPortsFolder(location) && !this.isAdaptersFolder(location)) {\n\t\t\treturn [this.finding(file, codeClass.line, codeClass.name, \"portOutsideDomain\", { class: 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 { Architecture } from \"../../architecture/index.ts\";\nimport type { Dependency, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { ImportRule } from \"../framework/index.ts\";\n\ntype MessageId = \"reexport\" | \"sharedKernel\" | \"publishedLanguage\" | \"notOpenHostService\" | \"outsideAntiCorruptionLayer\";\n\nexport class NoCrossContextImportRule extends ImportRule<\"strategic/no-cross-context-import\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"strategic/no-cross-context-import\", MessageId> = {\n\t\tcontexts: \"every\",\n\t\tdescription: \"An import from another bounded context that is not its open host service, a composition root that re-exports.\",\n\t\tid: \"strategic/no-cross-context-import\",\n\t\tmessages: {\n\t\t\tnotOpenHostService: \"Imports {target}: only an OpenHostService of another bounded context may be imported.\",\n\t\t\toutsideAntiCorruptionLayer: \"Uses the open host service of {context} outside an AntiCorruptionLayer: a core context translates what it consumes in an anti-corruption layer.\",\n\t\t\tpublishedLanguage: \"Imports the published language of {context}: redeclare the fields you read in your own published-language/.\",\n\t\t\treexport: \"The composition root re-exports {names}: it exports its own module only, so that no other context reaches through it.\",\n\t\t\tsharedKernel: \"The shared kernel imports no bounded context, but imports {target}.\",\n\t\t},\n\t};\n\n\tprotected appliesTo(file: SourceFile, architecture: Architecture): boolean {\n\t\tconst location = architecture.locationOf(file);\n\t\treturn location.isInBoundedContext || location.isInSharedKernel;\n\t}\n\n\tprotected findingFor(dependency: Dependency, file: SourceFile, architecture: Architecture): Finding<MessageId> | undefined {\n\t\tconst from = architecture.locationOf(file);\n\t\tif (from.isCompositionRoot && dependency.form === \"re-export\") {\n\t\t\treturn this.finding(file, dependency.line, dependency.label, \"reexport\", { names: dependency.label });\n\t\t}\n\t\tconst target = dependency.target;\n\t\tif (target.kind !== \"file\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst to = architecture.locationOfTarget(target);\n\t\tif (!to.isOtherBoundedContextThan(from)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (from.isInSharedKernel) {\n\t\t\treturn this.finding(file, dependency.line, dependency.label, \"sharedKernel\", { target: this.wording.target(target, architecture) });\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 this.finding(file, dependency.line, dependency.label, \"publishedLanguage\", { context: to.context ?? \"\" });\n\t\t}\n\t\tif (!this.importsOnlyOpenHostServices(dependency, target.path, architecture)) {\n\t\t\treturn this.finding(file, dependency.line, dependency.label, \"notOpenHostService\", { target: this.wording.target(target, architecture) });\n\t\t}\n\t\tif (from.isInCoreDomain && !from.isCompositionRoot && !this.declaresAntiCorruptionLayer(file, architecture)) {\n\t\t\treturn this.finding(file, dependency.line, dependency.label, \"outsideAntiCorruptionLayer\", { context: to.context ?? \"\" });\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate importsOnlyOpenHostServices(dependency: Dependency, path: string, architecture: Architecture): boolean {\n\t\tconst target = architecture.project.file(path);\n\t\tif (target === undefined || dependency.names.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\treturn dependency.names.every((name) => {\n\t\t\tconst declaration = target.classNamed(name);\n\t\t\treturn declaration !== undefined && architecture.implementsMarker(declaration, \"OpenHostService\");\n\t\t});\n\t}\n\n\tprivate declaresAntiCorruptionLayer(file: SourceFile, architecture: Architecture): boolean {\n\t\treturn file.classes.some((codeClass) => architecture.implementsMarker(codeClass, \"AntiCorruptionLayer\"));\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { CoreKind } from \"../../conventions/index.ts\";\nimport type { ClassDeclaration, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { ClassRule } from \"../framework/index.ts\";\n\nconst owned: readonly CoreKind[] = [\"AggregateRoot\", \"Entity\", \"DomainEvent\", \"DomainService\", \"CommandRepository\", \"QueryRepository\", \"CommandHandler\", \"QueryHandler\", \"EventTranslator\"];\n\nexport class NoFatSharedKernelRule extends ClassRule<\"strategic/no-fat-shared-kernel\", \"owned\"> {\n\tpublic readonly meta: RuleMeta<\"strategic/no-fat-shared-kernel\", \"owned\"> = {\n\t\tcontexts: \"every\",\n\t\tdescription: \"An aggregate, an entity, an event, a domain service, a repository or a handler in the shared kernel.\",\n\t\tid: \"strategic/no-fat-shared-kernel\",\n\t\tmessages: {\n\t\t\towned: \"{class} is {kind} in the shared kernel: it belongs to one bounded context; the shared kernel holds value objects, ports and their adapters.\",\n\t\t},\n\t};\n\n\tprotected findingsFor(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<\"owned\">[] {\n\t\tif (!architecture.locationOf(file).isInSharedKernel) {\n\t\t\treturn [];\n\t\t}\n\t\tconst kind = architecture.kindsOf(codeClass).find((candidate) => owned.includes(candidate));\n\t\tif (kind === undefined) {\n\t\t\treturn [];\n\t\t}\n\t\tconst article = /^[AEIO]/.test(kind) ? \"an\" : \"a\";\n\t\treturn [this.finding(file, codeClass.line, codeClass.name, \"owned\", { class: codeClass.name, kind: `${article} ${kind}` })];\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { ClassDeclaration, ClassType, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, FindingData, RuleMeta } from \"../framework/index.ts\";\nimport { ClassRule } from \"../framework/index.ts\";\n\nexport class NoLeakyHostServiceRule extends ClassRule<\"strategic/no-leaky-host-service\", \"exposes\"> {\n\tpublic readonly meta: RuleMeta<\"strategic/no-leaky-host-service\", \"exposes\"> = {\n\t\tcontexts: \"every\",\n\t\tdescription: \"An open host service that exposes a class of its context instead of the published language.\",\n\t\tid: \"strategic/no-leaky-host-service\",\n\t\tmessages: {\n\t\t\texposes: \"{member} exposes {type}, {kind}{owner}: an open host service speaks the published language.\",\n\t\t},\n\t};\n\n\tprotected findingsFor(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<\"exposes\">[] {\n\t\tif (!architecture.implementsMarker(codeClass, \"OpenHostService\")) {\n\t\t\treturn [];\n\t\t}\n\t\tconst findings = new Map<string, Finding<\"exposes\">>();\n\t\tfor (const member of codeClass.publicSurface) {\n\t\t\tconst symbol = `${codeClass.name}.${member.name}`;\n\t\t\tfor (const type of [...member.parameterTypes, ...member.valueTypes]) {\n\t\t\t\tconst key = `${symbol}:${type.name}`;\n\t\t\t\tif (this.leaks(type, architecture) && !findings.has(key)) {\n\t\t\t\t\tfindings.set(key, this.finding(file, member.line, symbol, \"exposes\", this.describe(symbol, type, architecture)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [...findings.values()];\n\t}\n\n\tprivate leaks(type: ClassType, architecture: Architecture): boolean {\n\t\tif (type.isInstalled) {\n\t\t\treturn false;\n\t\t}\n\t\tconst declaringFile = type.declaredIn === undefined ? undefined : architecture.project.file(type.declaredIn);\n\t\treturn declaringFile === undefined || !architecture.locationOf(declaringFile).isInSharedKernel;\n\t}\n\n\tprivate describe(symbol: string, type: ClassType, architecture: Architecture): FindingData {\n\t\tconst kind = architecture.kindOf(type) ?? \"class\";\n\t\tconst article = /^[AEIO]/.test(kind) ? \"an\" : \"a\";\n\t\tconst declaringFile = type.declaredIn === undefined ? undefined : architecture.project.file(type.declaredIn);\n\t\tconst context = declaringFile === undefined ? undefined : architecture.locationOf(declaringFile).context;\n\t\treturn { kind: `${article} ${kind}`, member: symbol, owner: context === undefined ? \"\" : ` of ${context}`, type: type.name };\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { Dependency, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { Rule } from \"../framework/index.ts\";\n\ntype MessageId = \"unmapped\";\n\ninterface Consumption {\n\treadonly file: SourceFile;\n\treadonly dependency: Dependency;\n\treadonly from: string;\n\treadonly to: string;\n}\n\nexport class NoUnmappedContextRule extends Rule<\"strategic/no-unmapped-context\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"strategic/no-unmapped-context\", MessageId> = {\n\t\tcontexts: \"every\",\n\t\tdescription: \"A bounded context consuming one the context map does not allow.\",\n\t\tid: \"strategic/no-unmapped-context\",\n\t\tmessages: {\n\t\t\tunmapped: \"{from} consumes {to}, which the context map does not allow: reverse the dependency, or if {from} really is downstream of {to}, add {to} to contextMap.{from}.consumes.\",\n\t\t},\n\t};\n\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const consumption of this.consumptionsIn(architecture)) {\n\t\t\tif (!architecture.contextMap.allows(consumption.from, consumption.to)) {\n\t\t\t\tfindings.push(this.consumptionFinding(consumption));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate consumptionsIn(architecture: Architecture): Consumption[] {\n\t\tconst consumptions: Consumption[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tconst from = architecture.locationOf(file);\n\t\t\tif (!from.isInBoundedContext || from.context === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const dependency of file.dependencies) {\n\t\t\t\tif (dependency.target.kind !== \"file\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst to = architecture.locationOfTarget(dependency.target);\n\t\t\t\tif (to.isOtherBoundedContextThan(from) && to.context !== undefined) {\n\t\t\t\t\tconsumptions.push({ dependency, file, from: from.context, to: to.context });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn consumptions;\n\t}\n\n\tprivate consumptionFinding(consumption: Consumption): Finding<MessageId> {\n\t\tconst { dependency, file, from, to } = consumption;\n\t\treturn this.finding(file, dependency.line, dependency.label, \"unmapped\", { from, to });\n\t}\n}\n","import type { Architecture } from \"../../../architecture/index.ts\";\nimport type { CoreKind } from \"../../../conventions/index.ts\";\nimport type { ClassDeclaration, ClassType, SourceFile } from \"../../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../../framework/index.ts\";\nimport { Rule } from \"../../framework/index.ts\";\n\ntype MessageId = \"heldAggregate\" | \"aggregateInTypeArgument\" | \"sharedEntity\";\n\ninterface Held {\n\treadonly name: string;\n\treadonly line: number;\n\treadonly types: readonly ClassType[];\n}\n\ninterface Holding {\n\treadonly aggregate: ClassDeclaration;\n\treadonly file: SourceFile;\n\treadonly through: Held;\n\treadonly entity: ClassType;\n}\n\nconst holders: readonly CoreKind[] = [\"Entity\", \"ValueObject\", \"DomainEvent\"];\n\nexport class NoAggregateReferenceRule extends Rule<\"tactical/no-aggregate-reference\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-aggregate-reference\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"An aggregate holding another aggregate instead of its identifier, an entity held by two aggregates.\",\n\t\tid: \"tactical/no-aggregate-reference\",\n\t\tmessages: {\n\t\t\taggregateInTypeArgument: \"{class} holds the aggregate {type} in its {parameter}: reference it by its identifier instead.\",\n\t\t\theldAggregate: \"{member} holds the aggregate {type}: reference it by its identifier instead.\",\n\t\t\tsharedEntity: \"{member} holds the entity {entity}, which {others} {verb} too: an entity belongs to one aggregate.\",\n\t\t},\n\t};\n\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tfor (const codeClass of file.classes) {\n\t\t\t\tfindings.push(...this.heldAggregates(codeClass, file, architecture));\n\t\t\t}\n\t\t}\n\t\tfindings.push(...this.sharedEntities(architecture));\n\t\treturn findings;\n\t}\n\n\tprivate heldAggregates(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<MessageId>[] {\n\t\tif (!holders.some((kind) => architecture.is(codeClass, kind))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const member of codeClass.heldMembers) {\n\t\t\tfor (const type of member.valueTypes) {\n\t\t\t\tif (architecture.is(type, \"AggregateRoot\")) {\n\t\t\t\t\tconst symbol = `${codeClass.name}.${member.name}`;\n\t\t\t\t\tfindings.push(this.finding(file, member.line, symbol, \"heldAggregate\", { member: symbol, type: type.name }));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const argument of codeClass.typeArguments) {\n\t\t\tfor (const type of argument.types) {\n\t\t\t\tif (architecture.is(type, \"AggregateRoot\")) {\n\t\t\t\t\tconst data = { class: codeClass.name, parameter: argument.parameter, type: type.name };\n\t\t\t\t\tfindings.push(this.finding(file, argument.line, `${codeClass.name}.${argument.parameter}`, \"aggregateInTypeArgument\", data));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate sharedEntities(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst holdings = this.holdingsIn(architecture);\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const holding of holdings) {\n\t\t\tconst others = this.otherOwners(holding, holdings);\n\t\t\tif (others.length > 0) {\n\t\t\t\tconst symbol = `${holding.aggregate.name}.${holding.through.name}`;\n\t\t\t\tconst data = { entity: holding.entity.name, member: symbol, others: others.join(\" and \"), verb: others.length === 1 ? \"holds\" : \"hold\" };\n\t\t\t\tfindings.push(this.finding(holding.file, holding.through.line, symbol, \"sharedEntity\", data));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate otherOwners(holding: Holding, holdings: readonly Holding[]): string[] {\n\t\tconst others = new Set<string>();\n\t\tfor (const other of holdings) {\n\t\t\tif (other.aggregate !== holding.aggregate && other.entity.key === holding.entity.key) {\n\t\t\t\tothers.add(other.aggregate.name);\n\t\t\t}\n\t\t}\n\t\treturn [...others].sort();\n\t}\n\n\tprivate holdingsIn(architecture: Architecture): Holding[] {\n\t\tconst holdings: Holding[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tfor (const aggregate of file.classes) {\n\t\t\t\tif (!architecture.is(aggregate, \"AggregateRoot\")) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst visited = new Set<string>();\n\t\t\t\tfor (const through of this.heldBy(aggregate)) {\n\t\t\t\t\tfor (const type of through.types) {\n\t\t\t\t\t\tfor (const entity of this.entitiesReachedFrom(type, architecture, visited)) {\n\t\t\t\t\t\t\tholdings.push({ aggregate, entity, file, through });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn holdings;\n\t}\n\n\tprivate entitiesReachedFrom(type: ClassType, architecture: Architecture, visited: Set<string>): ClassType[] {\n\t\tif (architecture.is(type, \"AggregateRoot\") || visited.has(type.key)) {\n\t\t\treturn [];\n\t\t}\n\t\tvisited.add(type.key);\n\n\t\tconst isEntity = architecture.is(type, \"Entity\");\n\t\tconst reached = isEntity ? [type] : [];\n\t\tconst declaration = architecture.classOf(type);\n\t\tif (declaration === undefined || !(isEntity || architecture.is(type, \"ValueObject\"))) {\n\t\t\treturn reached;\n\t\t}\n\t\tfor (const held of this.heldBy(declaration)) {\n\t\t\tfor (const inner of held.types) {\n\t\t\t\treached.push(...this.entitiesReachedFrom(inner, architecture, visited));\n\t\t\t}\n\t\t}\n\t\treturn reached;\n\t}\n\n\tprivate heldBy(codeClass: ClassDeclaration): Held[] {\n\t\tconst held: Held[] = codeClass.heldMembers.map((member) => ({ line: member.line, name: member.name, types: member.valueTypes }));\n\t\tfor (const argument of codeClass.typeArguments) {\n\t\t\theld.push({ line: argument.line, name: argument.parameter, types: argument.types });\n\t\t}\n\t\treturn held;\n\t}\n}\n","import type { Architecture } from \"../../../architecture/index.ts\";\nimport type { Layer } from \"../../../conventions/index.ts\";\nimport type { ClassDeclaration, SourceFile, StatementKind, TopLevelStatement } from \"../../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../../framework/index.ts\";\nimport { Rule } from \"../../framework/index.ts\";\n\ntype MessageId =\n\t| \"extendsExpression\"\n\t| \"plainClass\"\n\t| \"staticOnly\"\n\t| \"classExpression\"\n\t| \"computedConstant\"\n\t| \"enum\"\n\t| \"function\"\n\t| \"mutableVariable\"\n\t| \"namespace\"\n\t| \"statement\"\n\t| \"compositionRootDeclaration\"\n\t| \"compositionRootStatement\"\n\t| \"adapterDeclaration\"\n\t| \"adapterStatement\";\n\nconst guarded: ReadonlySet<Layer | undefined> = new Set<Layer>([\"domain\", \"application\"]);\n\nconst adapters: ReadonlySet<Layer | undefined> = new Set<Layer>([\"driven\", \"driving\"]);\n\nconst expectedBlocks: Readonly<Record<string, string>> = {\n\tapplication: \"CommandHandler, QueryHandler or EventTranslator\",\n\tdomain: \"AggregateRoot, Entity, ValueObject, Identifier, DomainEvent, DomainError, DomainService or a Port\",\n};\n\nconst statementMessages: Readonly<Record<StatementKind, MessageId>> = {\n\t\"class expression\": \"classExpression\",\n\t\"computed constant\": \"computedConstant\",\n\tenum: \"enum\",\n\tfunction: \"function\",\n\t\"mutable variable\": \"mutableVariable\",\n\tnamespace: \"namespace\",\n\tstatement: \"statement\",\n};\n\nexport class NoLooseCodeRule extends Rule<\"tactical/no-loose-code\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-loose-code\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"Code outside a building block in the domain or the application, outside a class in an adapter layer, anything but the module class in a composition root.\",\n\t\tid: \"tactical/no-loose-code\",\n\t\tmessages: {\n\t\t\tadapterDeclaration: \"The {kind} {name} has no place in an adapter layer: adapters are classes; make it a method of the adapter, or a mapper class of its own.\",\n\t\t\tadapterStatement: \"A statement runs when the module loads: an adapter layer holds classes, which the composition root wires.\",\n\t\t\tclassExpression: \"{name} is a class expression: declare it as a class that extends a building block.\",\n\t\t\tcompositionRootDeclaration: \"The {kind} {name} has no place in a composition root: it holds its module class only.\",\n\t\t\tcompositionRootStatement: \"A statement runs when the module loads: the composition root holds its module class only.\",\n\t\t\tcomputedConstant: \"The constant {name} is computed when the module loads: keep top-level constants to plain data.\",\n\t\t\tenum: \"The enum {name} has no place here: use a union of literal types, or a ValueObject when it has behaviour.\",\n\t\t\textendsExpression: \"{name} extends an expression: extend a class by its name, so that what it is stays readable.\",\n\t\t\tfunction: \"The function {name} floats outside any class: make it a method of a value object or of a DomainService.\",\n\t\t\tmutableVariable: \"{name} is module state: keep state in aggregates, not in modules.\",\n\t\t\tnamespace: \"The namespace {name} groups loose code: make it a method of a value object or of a DomainService.\",\n\t\t\tplainClass: \"{name} extends no building block: extend {blocks}.\",\n\t\t\tstatement: \"A statement runs when the module loads: move it into a method.\",\n\t\t\tstaticOnly: \"{name} only has static members: a class of functions is no building block; make them methods of the value object they work on, or of a DomainService.\",\n\t\t},\n\t};\n\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tconst location = architecture.locationOf(file);\n\t\t\tif (guarded.has(location.layer)) {\n\t\t\t\tfindings.push(...this.looseClasses(file, location.layer ?? \"domain\", architecture));\n\t\t\t\tfindings.push(...this.looseStatements(file));\n\t\t\t} else if (location.isCompositionRoot && location.isInBoundedContext) {\n\t\t\t\tfindings.push(...this.compositionRootStatements(file));\n\t\t\t} else if (adapters.has(location.layer)) {\n\t\t\t\tfindings.push(...this.adapterStatements(file));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate looseClasses(file: SourceFile, layer: Layer, architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const codeClass of file.classes) {\n\t\t\tconst messageId = this.classMessage(codeClass, architecture);\n\t\t\tif (messageId !== undefined) {\n\t\t\t\tfindings.push(this.finding(file, codeClass.line, codeClass.name, messageId, { blocks: expectedBlocks[layer] ?? \"\", name: codeClass.name }));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate classMessage(codeClass: ClassDeclaration, architecture: Architecture): MessageId | undefined {\n\t\tif (!codeClass.extendsByName) {\n\t\t\treturn \"extendsExpression\";\n\t\t}\n\t\tif (!architecture.isBuildingBlock(codeClass)) {\n\t\t\treturn \"plainClass\";\n\t\t}\n\t\treturn codeClass.isStaticOnly ? \"staticOnly\" : undefined;\n\t}\n\n\tprivate looseStatements(file: SourceFile): Finding<MessageId>[] {\n\t\treturn file.statements.map((statement) => this.statementFinding(file, statement, statementMessages[statement.kind]));\n\t}\n\n\tprivate compositionRootStatements(file: SourceFile): Finding<MessageId>[] {\n\t\treturn file.statements.map((statement) => this.statementFinding(file, statement, statement.kind === \"statement\" ? \"compositionRootStatement\" : \"compositionRootDeclaration\"));\n\t}\n\n\tprivate adapterStatements(file: SourceFile): Finding<MessageId>[] {\n\t\treturn file.statements.map((statement) => this.statementFinding(file, statement, statement.kind === \"statement\" ? \"adapterStatement\" : \"adapterDeclaration\"));\n\t}\n\n\tprivate statementFinding(file: SourceFile, statement: TopLevelStatement, messageId: MessageId): Finding<MessageId> {\n\t\treturn this.finding(file, statement.line, statement.name, messageId, { kind: statement.kind, name: statement.name });\n\t}\n}\n","import type { Architecture, Location } from \"../../../architecture/index.ts\";\nimport type { CoreMarker } from \"../../../conventions/index.ts\";\nimport type { ClassDeclaration, SourceFile } from \"../../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../../framework/index.ts\";\nimport { Rule } from \"../../framework/index.ts\";\n\ntype MessageId = \"sharedFile\" | \"misplacedMarker\" | \"misplacedKind\";\n\nconst markerWording: Readonly<Record<CoreMarker, string>> = {\n\tAntiCorruptionLayer: \"driven/<technology>/adapters/*.adapter.ts, as an adapter of a port\",\n\tOpenHostService: \"driving/<technology>/\",\n};\n\nexport class NoMisplacedClassRule extends Rule<\"tactical/no-misplaced-class\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-misplaced-class\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A class in the wrong folder or file, two classes in one file.\",\n\t\tid: \"tactical/no-misplaced-class\",\n\t\tmessages: {\n\t\t\tmisplacedKind: \"{name} belongs in {place}.\",\n\t\t\tmisplacedMarker: \"{name} implements {marker}: it belongs in {place}.\",\n\t\t\tsharedFile: \"{name} shares its file with {first}: one class per file.\",\n\t\t},\n\t};\n\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tfindings.push(...this.extraClasses(file));\n\t\t\tconst [first] = file.classes;\n\t\t\tconst finding = first === undefined ? undefined : this.misplacement(first, file, architecture.locationOf(file), architecture);\n\t\t\tif (finding !== undefined) {\n\t\t\t\tfindings.push(finding);\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate extraClasses(file: SourceFile): Finding<MessageId>[] {\n\t\tconst [first, ...others] = file.classes;\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const codeClass of others) {\n\t\t\tfindings.push(this.finding(file, codeClass.line, codeClass.name, \"sharedFile\", { first: first?.name ?? \"\", name: codeClass.name }));\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate misplacement(codeClass: ClassDeclaration, file: SourceFile, location: Location, architecture: Architecture): Finding<MessageId> | undefined {\n\t\tfor (const { marker, place } of architecture.blocks.markedPlacesOf(codeClass)) {\n\t\t\tif (!place.fits(location)) {\n\t\t\t\treturn this.finding(file, codeClass.line, codeClass.name, \"misplacedMarker\", { marker, name: codeClass.name, place: markerWording[marker] });\n\t\t\t}\n\t\t}\n\t\tconst place = architecture.blocks.placeOf(codeClass);\n\t\tif (place === undefined || place.fits(location)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.finding(file, codeClass.line, codeClass.name, \"misplacedKind\", { name: codeClass.name, place: this.wording.place(place) });\n\t}\n}\n","import type { CoreKind } from \"../../../conventions/index.ts\";\nimport type { RuleMeta } from \"../../framework/index.ts\";\nimport { InjectionRule } from \"../../framework/index.ts\";\n\nexport class NoForeignCommandDependencyRule extends InjectionRule<\"tactical/no-foreign-command-dependency\"> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-foreign-command-dependency\", \"foreign\"> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A command handler receiving a query repository, an event publisher, another handler or a plain class.\",\n\t\tid: \"tactical/no-foreign-command-dependency\",\n\t\tmessages: {\n\t\t\tforeign:\n\t\t\t\t\"The CommandHandler {class} receives {type}, {kind}: a command handler receives command repositories, ports, event translators, domain services and value objects; events leave through the outbox, never a publisher.\",\n\t\t},\n\t};\n\n\tprotected readonly holder: CoreKind = \"CommandHandler\";\n\tprotected readonly forbidden: readonly CoreKind[] = [\"QueryRepository\", \"EventPublisher\"];\n\tprotected readonly allowed: readonly CoreKind[] = [\"CommandRepository\", \"Port\", \"EventTranslator\", \"DomainService\", \"ValueObject\", \"Identifier\"];\n}\n","import type { Architecture } from \"../../../architecture/index.ts\";\nimport type { Layer } from \"../../../conventions/index.ts\";\nimport type { Member, SourceFile } from \"../../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../../framework/index.ts\";\nimport { Rule } from \"../../framework/index.ts\";\n\ntype MessageId = \"noResult\" | \"setter\" | \"thrown\" | \"rejected\";\n\nconst exempt: ReadonlySet<string> = new Set([\"equals\", \"toSnapshot\", \"toString\", \"toJSON\", \"valueOf\"]);\n\nconst guarded: ReadonlySet<Layer | undefined> = new Set<Layer>([\"domain\", \"application\"]);\n\nexport class NoThrownFailureRule extends Rule<\"tactical/no-thrown-failure\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-thrown-failure\", MessageId> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A business failure thrown instead of returned, an entity method without a Result, a setter.\",\n\t\tid: \"tactical/no-thrown-failure\",\n\t\tmessages: {\n\t\t\tnoResult: \"{member} must return a Result: expose reads as getters and return business failures as values.\",\n\t\t\trejected: \"A failure is rejected: return it in a Result instead.\",\n\t\t\tsetter: \"{member} is a setter: change the state through a business method that returns a Result.\",\n\t\t\tthrown: \"A failure is thrown: return it in a Result instead.\",\n\t\t},\n\t};\n\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tfindings.push(...this.operationsWithoutResult(file, architecture));\n\t\t\tif (guarded.has(architecture.locationOf(file).layer)) {\n\t\t\t\tfindings.push(...this.raisedFailures(file));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate operationsWithoutResult(file: SourceFile, architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const codeClass of file.classes) {\n\t\t\tif (!architecture.is(codeClass, \"Entity\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const member of codeClass.members) {\n\t\t\t\tconst messageId = this.messageFor(member, architecture);\n\t\t\t\tif (messageId !== undefined) {\n\t\t\t\t\tconst symbol = `${codeClass.name}.${member.name}`;\n\t\t\t\t\tfindings.push(this.finding(file, member.line, symbol, messageId, { member: symbol }));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tprivate messageFor(member: Member, architecture: Architecture): MessageId | undefined {\n\t\tif (!member.isPublicInstance || exempt.has(member.name) || member.name.startsWith(\"[\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (member.kind === \"setter\") {\n\t\t\treturn \"setter\";\n\t\t}\n\t\tconst isOperation = member.kind === \"method\" || (member.kind === \"field\" && member.isCallable);\n\t\treturn isOperation && !architecture.returnsResult(member) ? \"noResult\" : undefined;\n\t}\n\n\tprivate raisedFailures(file: SourceFile): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const thrown of file.throws) {\n\t\t\tfindings.push(this.finding(file, thrown.line, thrown.form, thrown.form === \"throw\" ? \"thrown\" : \"rejected\"));\n\t\t}\n\t\treturn findings;\n\t}\n}\n","import type { CoreKind } from \"../../../conventions/index.ts\";\nimport type { RuleMeta } from \"../../framework/index.ts\";\nimport { InjectionRule } from \"../../framework/index.ts\";\n\nexport class NoStatefulServiceRule extends InjectionRule<\"tactical/no-stateful-service\"> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-stateful-service\", \"foreign\"> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A domain service holding a port, a repository or another service.\",\n\t\tid: \"tactical/no-stateful-service\",\n\t\tmessages: {\n\t\t\tforeign: \"The DomainService {class} holds {type}, {kind}: a domain service holds configuration only; the command handler passes it what it needs.\",\n\t\t},\n\t};\n\n\tprotected readonly holder: CoreKind = \"DomainService\";\n\tprotected readonly forbidden: readonly CoreKind[] = [];\n\tprotected readonly allowed: readonly CoreKind[] = [\"ValueObject\", \"Identifier\"];\n}\n","import type { Architecture } from \"../../../architecture/index.ts\";\nimport type { CoreKind } from \"../../../conventions/index.ts\";\nimport type { ClassDeclaration, SourceFile } from \"../../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../../framework/index.ts\";\nimport { ClassRule } from \"../../framework/index.ts\";\n\nconst guarded: readonly CoreKind[] = [\"Entity\", \"ValueObject\", \"Identifier\"];\n\nexport class NoPublicFieldRule extends ClassRule<\"tactical/no-public-field\", \"publicField\"> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-public-field\", \"publicField\"> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A public field on an aggregate, an entity, a value object or an identifier.\",\n\t\tid: \"tactical/no-public-field\",\n\t\tmessages: {\n\t\t\tpublicField: \"{member} is a public field: keep the state private, and expose what callers need through a getter.\",\n\t\t},\n\t};\n\n\tprotected findingsFor(codeClass: ClassDeclaration, file: SourceFile, architecture: Architecture): Finding<\"publicField\">[] {\n\t\tif (!guarded.some((kind) => architecture.is(codeClass, kind))) {\n\t\t\treturn [];\n\t\t}\n\t\tconst findings: Finding<\"publicField\">[] = [];\n\t\tfor (const member of codeClass.members) {\n\t\t\tif (member.isField && member.visibility === \"public\" && !member.isStatic) {\n\t\t\t\tconst symbol = `${codeClass.name}.${member.name}`;\n\t\t\t\tfindings.push(this.finding(file, member.line, symbol, \"publicField\", { member: symbol }));\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n}\n","import type { CoreKind } from \"../../../conventions/index.ts\";\nimport type { RuleMeta } from \"../../framework/index.ts\";\nimport { InjectionRule } from \"../../framework/index.ts\";\n\nexport class NoForeignQueryDependencyRule extends InjectionRule<\"tactical/no-foreign-query-dependency\"> {\n\tpublic readonly meta: RuleMeta<\"tactical/no-foreign-query-dependency\", \"foreign\"> = {\n\t\tcontexts: \"core\",\n\t\tdescription: \"A query handler receiving what writes or changes state.\",\n\t\tid: \"tactical/no-foreign-query-dependency\",\n\t\tmessages: {\n\t\t\tforeign: \"The QueryHandler {class} receives {type}, {kind}: a query handler receives query repositories, ports that do not write, and value objects.\",\n\t\t},\n\t};\n\n\tprotected readonly holder: CoreKind = \"QueryHandler\";\n\tprotected readonly forbidden: readonly CoreKind[] = [\"CommandRepository\", \"Outbox\", \"UnitOfWork\", \"EventPublisher\"];\n\tprotected readonly allowed: readonly CoreKind[] = [\"QueryRepository\", \"Port\", \"ValueObject\", \"Identifier\"];\n}\n","export class DisableDirective {\n\tpublic readonly rule: string | undefined;\n\tpublic readonly reason: string | undefined;\n\n\tpublic constructor(text: string) {\n\t\tconst match = /^([a-z]+\\/[a-z-]+)?\\s*(?::\\s*(.+?))?\\s*$/.exec(text);\n\t\tthis.rule = match?.[1];\n\t\tthis.reason = match?.[2];\n\t}\n\n\tpublic get isComplete(): boolean {\n\t\treturn this.rule !== undefined && this.reason !== undefined;\n\t}\n}\n","import type { Architecture } from \"../../architecture/index.ts\";\nimport type { DisableComment, SourceFile } from \"../../model/index.ts\";\nimport type { Finding, RuleMeta } from \"../framework/index.ts\";\nimport { Rule } from \"../framework/index.ts\";\nimport { DisableDirective } from \"./disable-directive.ts\";\n\ntype MessageId = \"noRule\" | \"unknownRule\" | \"noReason\" | \"unused\";\n\nexport class NoLooseDisableRule extends Rule<\"tooling/no-loose-disable\", MessageId> {\n\tpublic readonly meta: RuleMeta<\"tooling/no-loose-disable\", MessageId> = {\n\t\tcontexts: \"every\",\n\t\tdescription: \"A disable comment that names no known rule, gives no reason, or disables nothing.\",\n\t\tid: \"tooling/no-loose-disable\",\n\t\tmessages: {\n\t\t\tnoReason: \"The disable comment gives no reason: write `// alveolus-disable-next-line {rule}: <why this line keeps its violation>`.\",\n\t\t\tnoRule: \"The disable comment names no rule: write `// alveolus-disable-next-line <rule-id>: <reason>`.\",\n\t\t\tunknownRule: \"The disable comment names {rule}, which is no rule: check the id on the rules page.\",\n\t\t\tunused: \"The disable comment disables nothing: the line below breaks {rule} no more; remove the comment.\",\n\t\t},\n\t};\n\n\tpublic constructor(private readonly knownRules: readonly string[]) {\n\t\tsuper();\n\t}\n\n\tpublic check(architecture: Architecture): Finding<MessageId>[] {\n\t\tconst findings: Finding<MessageId>[] = [];\n\t\tfor (const file of this.filesOf(architecture)) {\n\t\t\tfor (const comment of file.disables) {\n\t\t\t\tconst finding = this.malformed(file, comment);\n\t\t\t\tif (finding !== undefined) {\n\t\t\t\t\tfindings.push(finding);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn findings;\n\t}\n\n\tpublic unused(file: SourceFile, comment: DisableComment): Finding<MessageId> {\n\t\tconst directive = new DisableDirective(comment.text);\n\t\treturn this.finding(file, comment.line, \"alveolus-disable-next-line\", \"unused\", { rule: directive.rule ?? \"\" });\n\t}\n\n\tprivate malformed(file: SourceFile, comment: DisableComment): Finding<MessageId> | undefined {\n\t\tconst directive = new DisableDirective(comment.text);\n\t\tif (directive.rule === undefined) {\n\t\t\treturn this.finding(file, comment.line, \"alveolus-disable-next-line\", \"noRule\");\n\t\t}\n\t\tif (!this.knownRules.includes(directive.rule)) {\n\t\t\treturn this.finding(file, comment.line, \"alveolus-disable-next-line\", \"unknownRule\", { rule: directive.rule });\n\t\t}\n\t\tif (directive.reason === undefined) {\n\t\t\treturn this.finding(file, comment.line, \"alveolus-disable-next-line\", \"noReason\", { rule: directive.rule });\n\t\t}\n\t\treturn undefined;\n\t}\n}\n","import type { Rule } from \"./framework/index.ts\";\nimport { NoDrivingShortcutRule } from \"./layers/no-driving-shortcut.rule.ts\";\nimport { NoImpureDomainRule } from \"./layers/no-impure-domain.rule.ts\";\nimport { NoOutwardImportRule } from \"./layers/no-outward-import.rule.ts\";\nimport { NoPortlessAdapterRule } from \"./layers/no-portless-adapter.rule.ts\";\nimport { NoCrossContextImportRule } from \"./strategic/no-cross-context-import.rule.ts\";\nimport { NoFatSharedKernelRule } from \"./strategic/no-fat-shared-kernel.rule.ts\";\nimport { NoLeakyHostServiceRule } from \"./strategic/no-leaky-host-service.rule.ts\";\nimport { NoUnmappedContextRule } from \"./strategic/no-unmapped-context.rule.ts\";\nimport { NoAggregateReferenceRule } from \"./tactical/aggregates/no-aggregate-reference.rule.ts\";\nimport { NoLooseCodeRule } from \"./tactical/building-blocks/no-loose-code.rule.ts\";\nimport { NoMisplacedClassRule } from \"./tactical/building-blocks/no-misplaced-class.rule.ts\";\nimport { NoForeignCommandDependencyRule } from \"./tactical/command-handlers/no-foreign-command-dependency.rule.ts\";\nimport { NoThrownFailureRule } from \"./tactical/domain-errors/no-thrown-failure.rule.ts\";\nimport { NoStatefulServiceRule } from \"./tactical/domain-services/no-stateful-service.rule.ts\";\nimport { NoPublicFieldRule } from \"./tactical/entities/no-public-field.rule.ts\";\nimport { NoForeignQueryDependencyRule } from \"./tactical/query-handlers/no-foreign-query-dependency.rule.ts\";\nimport { NoLooseDisableRule } from \"./tooling/no-loose-disable.rule.ts\";\n\nexport const ruleIds = [\n\t\"strategic/no-cross-context-import\",\n\t\"strategic/no-leaky-host-service\",\n\t\"strategic/no-unmapped-context\",\n\t\"strategic/no-fat-shared-kernel\",\n\t\"layers/no-impure-domain\",\n\t\"layers/no-outward-import\",\n\t\"layers/no-portless-adapter\",\n\t\"layers/no-driving-shortcut\",\n\t\"tactical/no-aggregate-reference\",\n\t\"tactical/no-public-field\",\n\t\"tactical/no-foreign-command-dependency\",\n\t\"tactical/no-foreign-query-dependency\",\n\t\"tactical/no-stateful-service\",\n\t\"tactical/no-thrown-failure\",\n\t\"tactical/no-misplaced-class\",\n\t\"tactical/no-loose-code\",\n\t\"tooling/no-loose-disable\",\n] as const;\n\nexport type RuleId = (typeof ruleIds)[number];\n\nexport class RuleRegistry {\n\tpublic readonly rules: readonly Rule<RuleId>[] = [\n\t\tnew NoCrossContextImportRule(),\n\t\tnew NoLeakyHostServiceRule(),\n\t\tnew NoUnmappedContextRule(),\n\t\tnew NoFatSharedKernelRule(),\n\t\tnew NoImpureDomainRule(),\n\t\tnew NoOutwardImportRule(),\n\t\tnew NoPortlessAdapterRule(),\n\t\tnew NoDrivingShortcutRule(),\n\t\tnew NoAggregateReferenceRule(),\n\t\tnew NoPublicFieldRule(),\n\t\tnew NoForeignCommandDependencyRule(),\n\t\tnew NoForeignQueryDependencyRule(),\n\t\tnew NoStatefulServiceRule(),\n\t\tnew NoThrownFailureRule(),\n\t\tnew NoMisplacedClassRule(),\n\t\tnew NoLooseCodeRule(),\n\t\tnew NoLooseDisableRule(ruleIds),\n\t];\n\n\tpublic get looseDisable(): NoLooseDisableRule {\n\t\treturn this.rules.find((rule) => rule instanceof NoLooseDisableRule) as NoLooseDisableRule;\n\t}\n\n\tpublic get ids(): RuleId[] {\n\t\treturn this.rules.map((rule) => rule.meta.id);\n\t}\n}\n","import { createHash } from \"node:crypto\";\n\nconst length = 8;\n\nexport class Fingerprint {\n\tpublic of(text: string): string {\n\t\tconst normalized = text.trim().replace(/\\s+/g, \" \");\n\t\treturn createHash(\"sha1\").update(normalized).digest(\"hex\").slice(0, length);\n\t}\n}\n","import type { Settings } from \"../architecture/index.ts\";\nimport { Architecture } from \"../architecture/index.ts\";\nimport { corePackageName } from \"../conventions/index.ts\";\nimport type { Importer, ImportScope } from \"../importer/index.ts\";\nimport type { Finding, Rule, RuleId } from \"../rules/index.ts\";\nimport { DisableDirective, NoLooseDisableRule } from \"../rules/index.ts\";\nimport { Fingerprint } from \"./fingerprint.ts\";\nimport type { Severity, Violation } from \"./violation.ts\";\n\nexport interface CheckSettings extends ImportScope, Settings {\n\tseverityOf(rule: RuleId): Severity | \"off\";\n}\n\nexport interface Suppressed {\n\treadonly violation: Violation;\n\treadonly reason: string;\n}\n\nexport interface CheckOutcome {\n\treadonly files: number;\n\treadonly violations: Violation[];\n\treadonly suppressed: Suppressed[];\n}\n\nexport class Checker {\n\tprivate readonly fingerprint = new Fingerprint();\n\n\tpublic constructor(\n\t\tprivate readonly importer: Importer,\n\t\tprivate readonly rules: readonly Rule<RuleId>[],\n\t) {}\n\n\tpublic check(settings: CheckSettings): CheckOutcome {\n\t\tconst project = this.importer.read(settings);\n\t\tif (project.files.length === 0) {\n\t\t\tthrow new Error(`No file to analyse under ${settings.rootDir}: check root and ignore in alveolus.config.ts, and include in your tsconfig.`);\n\t\t}\n\t\tif (!this.importer.resolves(corePackageName, settings)) {\n\t\t\tthrow new Error(`${corePackageName} cannot be imported from ${settings.rootDir}: install it, or map it in the paths of your tsconfig. Without it, no building block can be recognised.`);\n\t\t}\n\t\tconst architecture = new Architecture(project, settings);\n\t\tconst outcome: CheckOutcome = { files: project.files.length, suppressed: [], violations: [] };\n\t\tconst used = new Set<string>();\n\t\tfor (const rule of this.rules) {\n\t\t\tconst severity = settings.severityOf(rule.meta.id);\n\t\t\tif (severity !== \"off\") {\n\t\t\t\tthis.collect(rule, severity, architecture, outcome, used);\n\t\t\t}\n\t\t}\n\t\tthis.collectUnusedDisables(architecture, settings, outcome, used);\n\t\toutcome.violations.sort((left, right) => this.compare(left, right));\n\t\treturn outcome;\n\t}\n\n\tpublic run(rule: Rule<RuleId>, architecture: Architecture): Violation[] {\n\t\treturn rule.check(architecture).map((finding) => this.violationOf(rule, \"error\", finding, architecture));\n\t}\n\n\tprivate collect(rule: Rule<RuleId>, severity: Severity, architecture: Architecture, outcome: CheckOutcome, used: Set<string>): void {\n\t\tfor (const finding of rule.check(architecture)) {\n\t\t\tconst violation = this.violationOf(rule, severity, finding, architecture);\n\t\t\tconst comment = finding.file.disableAbove(finding.line);\n\t\t\tconst directive = comment === undefined ? undefined : new DisableDirective(comment.text);\n\t\t\tif (comment !== undefined && directive?.isComplete === true && directive.rule === rule.meta.id) {\n\t\t\t\tused.add(`${finding.file.path}:${comment.line}`);\n\t\t\t\toutcome.suppressed.push({ reason: directive.reason ?? \"\", violation });\n\t\t\t} else {\n\t\t\t\toutcome.violations.push(violation);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate collectUnusedDisables(architecture: Architecture, settings: CheckSettings, outcome: CheckOutcome, used: Set<string>): void {\n\t\tconst rule = this.rules.find((candidate) => candidate instanceof NoLooseDisableRule);\n\t\tif (!(rule instanceof NoLooseDisableRule)) {\n\t\t\treturn;\n\t\t}\n\t\tconst severity = settings.severityOf(rule.meta.id);\n\t\tif (severity === \"off\") {\n\t\t\treturn;\n\t\t}\n\t\tfor (const file of architecture.files) {\n\t\t\tfor (const comment of file.disables) {\n\t\t\t\tif (new DisableDirective(comment.text).isComplete && !used.has(`${file.path}:${comment.line}`)) {\n\t\t\t\t\toutcome.violations.push(this.violationOf(rule, severity, rule.unused(file, comment), architecture));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate violationOf(rule: Rule<RuleId>, severity: Severity, finding: Finding, architecture: Architecture): Violation {\n\t\treturn {\n\t\t\tfile: architecture.relativePath(finding.file.path),\n\t\t\tfingerprint: this.fingerprint.of(finding.file.lineText(finding.line)),\n\t\t\tline: finding.line,\n\t\t\tmessage: this.messageOf(rule, finding),\n\t\t\trule: rule.meta.id,\n\t\t\tseverity,\n\t\t\tsymbol: finding.symbol,\n\t\t};\n\t}\n\n\tprivate messageOf(rule: Rule<RuleId>, finding: Finding): string {\n\t\tconst template = rule.meta.messages[finding.messageId];\n\t\tif (template === undefined) {\n\t\t\tthrow new Error(`${rule.meta.id} has no message \"${finding.messageId}\".`);\n\t\t}\n\t\treturn template.replace(/\\{(\\w+)\\}/g, (placeholder, key: string) => this.fill(rule, finding, key, placeholder));\n\t}\n\n\tprivate fill(rule: Rule<RuleId>, finding: Finding, key: string, placeholder: string): string {\n\t\tconst value = finding.data[key];\n\t\tif (value === undefined) {\n\t\t\tthrow new Error(`${rule.meta.id}: the message \"${finding.messageId}\" needs ${placeholder}, which the finding does not give.`);\n\t\t}\n\t\treturn String(value);\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 picocolors from \"picocolors\";\n\nimport type { RuleMeta } from \"../rules/index.ts\";\nimport type { Suppressed } from \"./checker.ts\";\nimport type { Severity, Violation } from \"./violation.ts\";\n\nexport interface ReportInput {\n\treadonly files: number;\n\treadonly violations: readonly Violation[];\n\treadonly suppressed: readonly Suppressed[];\n\treadonly baselined: number;\n\treadonly stale: number;\n}\n\nconst docsUrl = \"https://alveolus.dev/\";\n\nconst sarifLevels: Readonly<Record<Severity, string>> = { error: \"error\", info: \"note\", warn: \"warning\" };\n\nexport class Report {\n\tprivate readonly colors: ReturnType<typeof picocolors.createColors>;\n\n\tpublic constructor(\n\t\tprivate readonly input: ReportInput,\n\t\tcolored = false,\n\t) {\n\t\tthis.colors = picocolors.createColors(colored);\n\t}\n\n\tpublic text(): string {\n\t\tconst blocks: string[] = [];\n\t\tfor (const [file, violations] of this.byFile()) {\n\t\t\tblocks.push(this.block(file, violations));\n\t\t}\n\t\tconst parts = [...blocks, this.summary()];\n\t\tif (blocks.length > 0) {\n\t\t\tparts.push(this.colors.dim(\"Why, and how to fix it: npx alveolus explain <rule>\"));\n\t\t}\n\t\treturn `${parts.join(\"\\n\\n\")}\\n`;\n\t}\n\n\tpublic json(): string {\n\t\tconst { baselined, files, stale, suppressed, violations } = this.input;\n\t\tconst disabled = suppressed.map(({ reason, violation }) => ({ ...violation, reason }));\n\t\treturn `${JSON.stringify({ baselined, files, stale, suppressed: disabled, violations }, null, \"\\t\")}\\n`;\n\t}\n\n\tpublic sarif(rules: readonly RuleMeta<string, string>[]): string {\n\t\tconst driver = {\n\t\t\tinformationUri: docsUrl,\n\t\t\tname: \"alveolus\",\n\t\t\trules: rules.map((rule) => ({ helpUri: `${docsUrl}rules/${rule.id}`, id: rule.id, shortDescription: { text: rule.description } })),\n\t\t};\n\t\tconst results = this.input.violations.map((violation) => ({\n\t\t\tlevel: sarifLevels[violation.severity],\n\t\t\tlocations: [{ physicalLocation: { artifactLocation: { uri: violation.file, uriBaseId: \"%SRCROOT%\" }, region: { startLine: violation.line } } }],\n\t\t\tmessage: { text: violation.message },\n\t\t\tpartialFingerprints: { \"alveolus/v1\": violation.fingerprint },\n\t\t\truleId: violation.rule,\n\t\t}));\n\t\tconst log = { $schema: \"https://json.schemastore.org/sarif-2.1.0.json\", runs: [{ results, tool: { driver } }], version: \"2.1.0\" };\n\t\treturn `${JSON.stringify(log, null, \"\\t\")}\\n`;\n\t}\n\n\tprivate byFile(): Map<string, Violation[]> {\n\t\tconst byFile = new Map<string, Violation[]>();\n\t\tfor (const violation of this.input.violations) {\n\t\t\tbyFile.set(violation.file, [...(byFile.get(violation.file) ?? []), violation]);\n\t\t}\n\t\treturn byFile;\n\t}\n\n\tprivate block(file: string, violations: readonly Violation[]): string {\n\t\tconst lines = violations.map((violation) => ` ${violation.line} ${this.severity(violation.severity)} ${violation.rule}: ${violation.message}`);\n\t\treturn [this.colors.bold(file), ...lines].join(\"\\n\");\n\t}\n\n\tprivate severity(severity: Severity): string {\n\t\tconst { dim, red, yellow } = this.colors;\n\t\tif (severity === \"error\") {\n\t\t\treturn red(\"error\");\n\t\t}\n\t\tif (severity === \"warn\") {\n\t\t\treturn yellow(\"warn\");\n\t\t}\n\t\treturn dim(\"info\");\n\t}\n\n\tprivate summary(): string {\n\t\tconst { dim, green } = this.colors;\n\t\tconst counted = this.counts();\n\t\tconst head = counted.length === 0 ? green(\"No violation\") : counted.join(\", \");\n\t\tconst parts: string[] = [];\n\t\tif (this.input.baselined > 0) {\n\t\t\tparts.push(`${this.input.baselined} in the baseline`);\n\t\t}\n\t\tif (this.input.stale > 0) {\n\t\t\tparts.push(`${this.input.stale} fixed`);\n\t\t}\n\t\tif (this.input.suppressed.length > 0) {\n\t\t\tparts.push(`${this.input.suppressed.length} disabled`);\n\t\t}\n\t\tconst where = ` in ${this.input.files} file${this.input.files === 1 ? \"\" : \"s\"}`;\n\t\treturn parts.length === 0 ? `${head}${where}` : `${head}${where}${dim(` (${parts.join(\", \")})`)}`;\n\t}\n\n\tprivate counts(): string[] {\n\t\tconst { dim, red, yellow } = this.colors;\n\t\tconst errors = this.input.violations.filter((violation) => violation.severity === \"error\").length;\n\t\tconst warnings = this.input.violations.filter((violation) => violation.severity === \"warn\").length;\n\t\tconst infos = this.input.violations.filter((violation) => violation.severity === \"info\").length;\n\t\tconst counted: string[] = [];\n\t\tif (errors > 0) {\n\t\t\tcounted.push(red(`${errors} error${errors === 1 ? \"\" : \"s\"}`));\n\t\t}\n\t\tif (warnings > 0) {\n\t\t\tcounted.push(yellow(`${warnings} warning${warnings === 1 ? \"\" : \"s\"}`));\n\t\t}\n\t\tif (infos > 0) {\n\t\t\tcounted.push(dim(`${infos} info${infos === 1 ? \"\" : \"s\"}`));\n\t\t}\n\t\treturn counted;\n\t}\n}\n","import { matchesGlob, relative, resolve, sep } from \"node:path\";\n\nimport type { ContextFolder, ExtraFolders, Subdomains, SubdomainType } from \"../architecture/index.ts\";\nimport { AllowedPackages, ContextMap } from \"../architecture/index.ts\";\nimport type { CheckSettings, Severity } from \"../check/index.ts\";\nimport type { RuleId } from \"../rules/index.ts\";\nimport type { AlveolusConfig, ContextMapConfig } from \"./alveolus-config.ts\";\n\nconst testFiles: readonly string[] = [\"**/*.spec.ts\", \"**/*.test.ts\", \"**/*.e2e-spec.ts\", \"**/*.fixture.ts\", \"**/*.fixtures.ts\", \"**/*.stories.ts\", \"**/__tests__/**\", \"**/__mocks__/**\"];\n\nexport class Config implements CheckSettings {\n\tpublic readonly projectDir: string;\n\tpublic readonly rootDir: string;\n\tpublic readonly tsConfigPath: string;\n\tpublic readonly compositionRoot: string;\n\tpublic readonly domainDependencies: AllowedPackages;\n\tpublic readonly applicationDependencies: AllowedPackages;\n\tpublic readonly contextFolders: readonly ContextFolder[];\n\tpublic readonly extraFolders: ExtraFolders;\n\tpublic readonly contextMap: ContextMap;\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.tsConfigPath = resolve(projectDir, config.tsconfig ?? \"tsconfig.json\");\n\t\tthis.compositionRoot = config.compositionRoot ?? \"*.module.ts\";\n\t\tthis.domainDependencies = new AllowedPackages(config.domainDependencies);\n\t\tthis.applicationDependencies = this.domainDependencies.with(new AllowedPackages(config.applicationDependencies));\n\t\tthis.ignored = [...testFiles, ...(config.ignore ?? [])];\n\t\tthis.extraFolders = config.layout?.extraFolders ?? {};\n\t\tthis.contextMap = this.validContextMap(config.contextMap, Object.keys(config.boundedContexts));\n\t\tthis.rules = config.rules;\n\n\t\tconst sharedKernel = config.sharedKernel ?? \"shared-kernel\";\n\t\tthis.contextFolders = [...this.classifiedContexts(config.subdomains ?? {}, config.boundedContexts), { dir: resolve(this.rootDir, sharedKernel), isSharedKernel: true, name: \"shared kernel\" }];\n\t}\n\n\tprivate classifiedContexts(subdomains: Subdomains, boundedContexts: AlveolusConfig[\"boundedContexts\"]): ContextFolder[] {\n\t\tconst types: readonly SubdomainType[] = [\"core\", \"supporting\", \"generic\"];\n\t\tconst classified = new Map<string, SubdomainType>();\n\t\tconst folders: ContextFolder[] = [];\n\t\tfor (const type of types) {\n\t\t\tfor (const name of subdomains[type] ?? []) {\n\t\t\t\tconst folder = boundedContexts[name];\n\t\t\t\tif (folder === undefined) {\n\t\t\t\t\tthrow new Error(`subdomains names ${name}, which boundedContexts does not declare.`);\n\t\t\t\t}\n\t\t\t\tconst already = classified.get(name);\n\t\t\t\tif (already !== undefined) {\n\t\t\t\t\tthrow new Error(`subdomains lists ${name} as ${already} and as ${type}: a bounded context implements one subdomain.`);\n\t\t\t\t}\n\t\t\t\tclassified.set(name, type);\n\t\t\t\tfolders.push({ dir: resolve(this.rootDir, folder), isSharedKernel: false, name, subdomain: type });\n\t\t\t}\n\t\t}\n\t\tconst unclassified = Object.keys(boundedContexts).filter((name) => !classified.has(name));\n\t\tif (unclassified.length > 0) {\n\t\t\tthrow new Error(`boundedContexts declares ${unclassified.join(\", \")}, which subdomains does not classify: list each context under subdomains.core, subdomains.supporting or subdomains.generic.`);\n\t\t}\n\t\treturn folders;\n\t}\n\n\tprivate validContextMap(relations: ContextMapConfig, contexts: readonly string[]): ContextMap {\n\t\tconst upstreams: Record<string, readonly string[]> = {};\n\t\tfor (const [name, { consumes }] of Object.entries(relations)) {\n\t\t\tupstreams[name] = consumes;\n\t\t}\n\t\tconst map = new ContextMap(upstreams);\n\t\tconst named = new Set([...map.contexts, ...map.consumed]);\n\t\tconst unknown = [...named].filter((name) => !contexts.includes(name));\n\t\tif (unknown.length > 0) {\n\t\t\tthrow new Error(`contextMap names ${unknown.join(\", \")}, which boundedContexts does not declare.`);\n\t\t}\n\t\tconst unlisted = contexts.filter((name) => !map.contexts.includes(name));\n\t\tif (unlisted.length > 0) {\n\t\t\tthrow new Error(`contextMap does not list ${unlisted.join(\", \")}: every bounded context lists the contexts it consumes, consumes: [] when none.`);\n\t\t}\n\t\tconst selfConsumers = map.selfConsumers();\n\t\tif (selfConsumers.length > 0) {\n\t\t\tthrow new Error(`contextMap lists ${selfConsumers.join(\", \")} as consuming itself: a context consumes other contexts only.`);\n\t\t}\n\t\tconst cycle = map.cycle();\n\t\tif (cycle !== undefined) {\n\t\t\tthrow new Error(`contextMap has a cycle: ${cycle.join(\" → \")}. Two contexts that depend on each other can no longer change alone: reverse one dependency.`);\n\t\t}\n\t\treturn map;\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 severityOf(rule: RuleId): Severity | \"off\" {\n\t\treturn this.rules?.[rule] ?? \"error\";\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 { RuleRegistry } from \"../rules/index.ts\";\nimport type { AlveolusConfig } from \"./alveolus-config.ts\";\nimport { Config } from \"./config.ts\";\n\nconst packageDependencies = z.record(z.string(), z.union([z.literal(true), z.array(z.string())]));\n\nconst ruleSetting = z.enum([\"error\", \"warn\", \"info\", \"off\"]);\n\nconst contextNames = z.array(z.string()).exactOptional();\n\nconst schema = z.strictObject({\n\tapplicationDependencies: packageDependencies.exactOptional(),\n\tboundedContexts: z.record(z.string(), z.string()),\n\tcompositionRoot: z.string().exactOptional(),\n\tcontextMap: z.record(z.string(), z.strictObject({ consumes: z.array(z.string()) })),\n\tdomainDependencies: packageDependencies.exactOptional(),\n\tignore: z.array(z.string()).exactOptional(),\n\tlayout: z.strictObject({ extraFolders: z.strictObject({ application: z.array(z.string()).exactOptional(), domain: z.array(z.string()).exactOptional() }).exactOptional() }).exactOptional(),\n\troot: z.string(),\n\trules: z.strictObject(Object.fromEntries(new RuleRegistry().ids.map((id) => [id, ruleSetting.exactOptional()]))).exactOptional(),\n\tsharedKernel: z.string().exactOptional(),\n\tsubdomains: z.strictObject({ core: contextNames, generic: contextNames, supporting: contextNames }).exactOptional(),\n\ttsconfig: 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 type { Project } from \"../model/index.ts\";\n\nexport interface ImportScope {\n\treadonly projectDir: string;\n\treadonly rootDir: string;\n\tisIgnored(path: string): boolean;\n}\n\nexport abstract class Importer {\n\tpublic abstract read(scope: ImportScope): Project;\n\n\tpublic abstract resolves(packageName: string, scope: ImportScope): boolean;\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 { Node, Scope } from \"ts-morph\";\nimport type { ClassMemberTypes, ConstructorDeclaration, ClassDeclaration as MorphClass, ParameterDeclaration } from \"ts-morph\";\n\nimport type { ClassType, Heritage, ReturnShape, TypeArgument, Visibility } from \"../../../model/index.ts\";\nimport { ClassDeclaration, Member } from \"../../../model/index.ts\";\nimport type { TypeReader } from \"./type-reader.ts\";\n\ninterface MemberTypes {\n\treadonly isCallable?: boolean;\n\treadonly parameterTypes?: readonly ClassType[];\n\treadonly returns?: ReturnShape | undefined;\n\treadonly valueTypes?: readonly ClassType[];\n}\n\nexport class ClassReader {\n\tpublic constructor(private readonly types: TypeReader) {}\n\n\tpublic read(declaration: MorphClass): ClassDeclaration {\n\t\treturn new ClassDeclaration({\n\t\t\theritage: this.heritageOf(declaration),\n\t\t\timplemented: declaration.getImplements().map((clause) => this.types.namedTypeOf(clause.getType())),\n\t\t\tisAbstract: declaration.isAbstract(),\n\t\t\tline: declaration.getStartLineNumber(),\n\t\t\tmembers: declaration.getMembers().flatMap((member) => this.membersOf(member)),\n\t\t\tname: declaration.getName() ?? \"default\",\n\t\t\ttype: this.types.classTypeOf(declaration.getType()),\n\t\t});\n\t}\n\n\tprivate membersOf(member: ClassMemberTypes): Member[] {\n\t\tif (Node.isConstructorDeclaration(member)) {\n\t\t\treturn this.constructorParametersOf(member);\n\t\t}\n\t\tif (Node.isPropertyDeclaration(member)) {\n\t\t\tconst type = member.getType();\n\t\t\tconst [signature] = type.getCallSignatures();\n\t\t\treturn [\n\t\t\t\tthis.member(member, \"field\", {\n\t\t\t\t\tisCallable: signature !== undefined,\n\t\t\t\t\treturns: signature === undefined ? undefined : this.types.returnShapeOf(signature.getReturnType()),\n\t\t\t\t\tvalueTypes: this.types.classTypesIn(type),\n\t\t\t\t}),\n\t\t\t];\n\t\t}\n\t\tif (Node.isMethodDeclaration(member)) {\n\t\t\tconst returnType = member.getReturnType();\n\t\t\tconst parameterTypes = member.getParameters().flatMap((parameter) => this.types.classTypesIn(parameter.getType()));\n\t\t\treturn [this.member(member, \"method\", { parameterTypes, returns: this.types.returnShapeOf(returnType), valueTypes: this.types.classTypesIn(returnType) })];\n\t\t}\n\t\tif (Node.isGetAccessorDeclaration(member)) {\n\t\t\tconst returnType = member.getReturnType();\n\t\t\treturn [this.member(member, \"getter\", { returns: this.types.returnShapeOf(returnType), valueTypes: this.types.classTypesIn(returnType) })];\n\t\t}\n\t\tif (Node.isSetAccessorDeclaration(member)) {\n\t\t\treturn [this.member(member, \"setter\", {})];\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate member(member: Exclude<ClassMemberTypes, ConstructorDeclaration>, kind: Member[\"kind\"], types: MemberTypes): Member {\n\t\tconst name = Node.hasName(member) ? member.getName() : \"\";\n\t\tconst isStatic = Node.isStaticable(member) && member.isStatic();\n\t\tconst scope = Node.isScoped(member) ? member.getScope() : Scope.Public;\n\t\treturn new Member({\n\t\t\tisCallable: types.isCallable ?? false,\n\t\t\tisParameterProperty: false,\n\t\t\tisStatic,\n\t\t\tkind,\n\t\t\tline: member.getStartLineNumber(),\n\t\t\tname,\n\t\t\tparameterTypes: types.parameterTypes ?? [],\n\t\t\treturns: types.returns,\n\t\t\tvalueTypes: types.valueTypes ?? [],\n\t\t\tvisibility: name.startsWith(\"#\") ? \"private\" : this.visibilityOf(scope),\n\t\t});\n\t}\n\n\tprivate constructorParametersOf(declaration: ConstructorDeclaration): Member[] {\n\t\treturn declaration.getParameters().map((parameter) => this.constructorParameter(parameter));\n\t}\n\n\tprivate constructorParameter(parameter: ParameterDeclaration): Member {\n\t\treturn new Member({\n\t\t\tisCallable: false,\n\t\t\tisParameterProperty: parameter.isParameterProperty(),\n\t\t\tisStatic: false,\n\t\t\tkind: \"constructor parameter\",\n\t\t\tline: parameter.getStartLineNumber(),\n\t\t\tname: parameter.getName(),\n\t\t\tparameterTypes: [],\n\t\t\treturns: undefined,\n\t\t\tvalueTypes: this.types.classTypesIn(parameter.getType()),\n\t\t\tvisibility: this.visibilityOf(parameter.getScope() ?? Scope.Public),\n\t\t});\n\t}\n\n\tprivate heritageOf(declaration: MorphClass): Heritage | undefined {\n\t\tconst clause = declaration.getExtends();\n\t\tif (clause === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst parameters = declaration.getBaseClass()?.getTypeParameters() ?? [];\n\t\tconst typeArguments: TypeArgument[] = clause.getTypeArguments().map((argument, index) => ({\n\t\t\tline: argument.getStartLineNumber(),\n\t\t\tparameter: parameters[index]?.getName() ?? argument.getText(),\n\t\t\ttypes: this.types.classTypesIn(argument.getType()),\n\t\t}));\n\t\treturn { isByName: this.namesAClass(clause.getExpression()), typeArguments };\n\t}\n\n\tprivate namesAClass(expression: Node): boolean {\n\t\tif (!Node.isIdentifier(expression) && !Node.isPropertyAccessExpression(expression)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst symbol = expression.getSymbol();\n\t\tconst target = symbol?.getAliasedSymbol() ?? symbol;\n\t\tconst declarations = target?.getDeclarations() ?? [];\n\t\treturn declarations.length === 0 || declarations.some((candidate) => Node.isClassDeclaration(candidate));\n\t}\n\n\tprivate visibilityOf(scope: Scope): Visibility {\n\t\tif (scope === Scope.Private) {\n\t\t\treturn \"private\";\n\t\t}\n\t\tif (scope === Scope.Protected) {\n\t\t\treturn \"protected\";\n\t\t}\n\t\treturn \"public\";\n\t}\n}\n","import { SyntaxKind, ts } from \"ts-morph\";\nimport type { CallExpression, ExportDeclaration, ImportDeclaration, ImportEqualsDeclaration, ImportTypeNode, Node, Project, SourceFile } from \"ts-morph\";\n\nimport { isAbsolute, join, normalize, relative } from \"node:path\";\n\nimport type { DependencyForm, DependencyTarget } from \"../../../model/index.ts\";\nimport { Dependency } from \"../../../model/index.ts\";\nimport type { ImportScope } from \"../../importer.ts\";\nimport type { GlobalReference } from \"./global-reference.ts\";\n\ninterface ModuleReference {\n\treadonly line: number;\n\treadonly form: DependencyForm;\n\treadonly specifier: string | undefined;\n\treadonly text: string;\n\treadonly names: readonly string[];\n}\n\nconst everything: readonly string[] = [\"*\"];\n\nexport class DependencyReader {\n\tpublic constructor(\n\t\tprivate readonly project: Project,\n\t\tprivate readonly scope: ImportScope,\n\t) {}\n\n\tpublic read(file: SourceFile, globals: readonly GlobalReference[]): Dependency[] {\n\t\tconst dependencies: Dependency[] = [];\n\t\tfor (const reference of this.referencesOf(file)) {\n\t\t\tdependencies.push(new Dependency(reference.line, reference.form, reference.specifier ?? reference.text, reference.names, this.targetOf(reference, file)));\n\t\t}\n\t\tfor (const global of globals) {\n\t\t\tif (global.origin === \"project\") {\n\t\t\t\tdependencies.push(new Dependency(global.line, \"global\", global.declaredIn, [global.name], this.fileTarget(normalize(global.declaredIn))));\n\t\t\t}\n\t\t}\n\t\treturn dependencies.sort((left, right) => left.line - right.line);\n\t}\n\n\tprivate referencesOf(file: SourceFile): ModuleReference[] {\n\t\tconst references: ModuleReference[] = [];\n\t\tfor (const declaration of file.getImportDeclarations()) {\n\t\t\treferences.push(this.fromDeclaration(declaration, \"import\"));\n\t\t}\n\t\tfor (const declaration of file.getExportDeclarations()) {\n\t\t\tif (declaration.hasModuleSpecifier()) {\n\t\t\t\treferences.push(this.fromDeclaration(declaration, \"re-export\"));\n\t\t\t}\n\t\t}\n\t\tfor (const declaration of file.getDescendantsOfKind(SyntaxKind.ImportEqualsDeclaration)) {\n\t\t\treferences.push(...this.fromImportEquals(declaration));\n\t\t}\n\t\tfor (const node of file.getDescendantsOfKind(SyntaxKind.ImportType)) {\n\t\t\treferences.push(this.fromImportType(node));\n\t\t}\n\t\tfor (const call of file.getDescendantsOfKind(SyntaxKind.CallExpression)) {\n\t\t\treferences.push(...this.fromCall(call));\n\t\t}\n\t\treturn references;\n\t}\n\n\tprivate fromDeclaration(declaration: ImportDeclaration | ExportDeclaration, form: DependencyForm): ModuleReference {\n\t\tconst specifier = declaration.getModuleSpecifierValue() ?? \"\";\n\t\treturn { form, line: declaration.getStartLineNumber(), names: this.declaredNames(declaration), specifier, text: specifier };\n\t}\n\n\tprivate declaredNames(declaration: ImportDeclaration | ExportDeclaration): string[] {\n\t\tif (declaration.isKind(SyntaxKind.ExportDeclaration)) {\n\t\t\treturn declaration.isNamespaceExport() ? [...everything] : 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 fromImportEquals(declaration: ImportEqualsDeclaration): ModuleReference[] {\n\t\tconst reference = declaration.getModuleReference();\n\t\tif (!reference.isKind(SyntaxKind.ExternalModuleReference)) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [this.reference(declaration, \"require\", reference.getExpressionOrThrow(), everything)];\n\t}\n\n\tprivate fromImportType(node: ImportTypeNode): ModuleReference {\n\t\tconst argument = node.getArgument();\n\t\tconst literal = argument.isKind(SyntaxKind.LiteralType) ? argument.getLiteral() : argument;\n\t\tconst qualifier = node.getQualifier();\n\t\tconst names = qualifier === undefined ? everything : [qualifier.getText().split(\".\")[0] ?? \"*\"];\n\t\treturn this.reference(node, \"inline type\", literal, names);\n\t}\n\n\tprivate fromCall(call: CallExpression): ModuleReference[] {\n\t\tconst callee = call.getExpression();\n\t\tconst [argument] = call.getArguments();\n\t\tif (argument === undefined) {\n\t\t\treturn [];\n\t\t}\n\t\tif (callee.isKind(SyntaxKind.ImportKeyword)) {\n\t\t\treturn [this.reference(call, \"dynamic import\", argument, everything)];\n\t\t}\n\t\tif (callee.isKind(SyntaxKind.Identifier) && callee.getText() === \"require\") {\n\t\t\treturn [this.reference(call, \"require\", argument, everything)];\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate reference(node: Node, form: DependencyForm, specifierNode: Node, names: readonly string[]): ModuleReference {\n\t\tconst isLiteral = specifierNode.isKind(SyntaxKind.StringLiteral) || specifierNode.isKind(SyntaxKind.NoSubstitutionTemplateLiteral);\n\t\treturn { form, line: node.getStartLineNumber(), names, specifier: isLiteral ? specifierNode.getLiteralValue() : undefined, text: specifierNode.getText() };\n\t}\n\n\tprivate targetOf(reference: ModuleReference, file: SourceFile): DependencyTarget {\n\t\tconst directory = file.getDirectoryPath();\n\t\tif (reference.specifier === undefined) {\n\t\t\treturn { kind: \"file\", path: normalize(join(directory, reference.text)), visibility: \"unresolved\" };\n\t\t}\n\t\tconst resolved = this.resolve(reference.specifier, file);\n\t\tif (resolved !== undefined && this.isInsideProject(resolved)) {\n\t\t\treturn this.fileTarget(resolved);\n\t\t}\n\t\tif (reference.specifier.startsWith(\".\")) {\n\t\t\treturn { kind: \"file\", path: normalize(join(directory, reference.specifier)), visibility: \"unresolved\" };\n\t\t}\n\t\treturn { kind: \"package\", name: this.packageNameOf(reference.specifier) };\n\t}\n\n\tprivate fileTarget(path: string): DependencyTarget {\n\t\treturn { kind: \"file\", path, visibility: this.scope.isIgnored(path) ? \"ignored\" : \"analysed\" };\n\t}\n\n\tprivate resolve(specifier: string, file: SourceFile): string | undefined {\n\t\tconst resolution = ts.resolveModuleName(specifier, file.getFilePath(), this.project.getCompilerOptions(), this.project.getModuleResolutionHost());\n\t\tconst resolved = resolution.resolvedModule?.resolvedFileName;\n\t\treturn resolved === undefined ? undefined : normalize(resolved);\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 isInsideProject(path: string): boolean {\n\t\tconst offset = relative(this.scope.projectDir, path);\n\t\treturn offset !== \"\" && !offset.startsWith(\"..\") && !isAbsolute(offset) && !offset.split(/[\\\\/]/).includes(\"node_modules\");\n\t}\n}\n","import type { SourceFile } from \"ts-morph\";\n\nimport { DisableComment } from \"../../../model/index.ts\";\n\nconst marker = /^\\s*\\/\\/\\s*alveolus-disable-next-line\\b\\s*(.*?)\\s*$/;\n\nexport class DisableReader {\n\tpublic read(file: SourceFile): DisableComment[] {\n\t\tconst comments: DisableComment[] = [];\n\t\tconst lines = file.getFullText().split(/\\r?\\n/);\n\t\tfor (const [index, line] of lines.entries()) {\n\t\t\tconst text = marker.exec(line)?.[1];\n\t\t\tif (text !== undefined) {\n\t\t\t\tcomments.push(new DisableComment(index + 1, text));\n\t\t\t}\n\t\t}\n\t\treturn comments;\n\t}\n}\n","import { ModuleDeclarationKind, Node, SyntaxKind, ts } from \"ts-morph\";\nimport type { Identifier, SourceFile } from \"ts-morph\";\n\nimport { basename, isAbsolute, relative } from \"node:path\";\n\nimport type { GlobalEffect } from \"../../../model/index.ts\";\nimport type { GlobalReference } from \"./global-reference.ts\";\n\ninterface Effect {\n\treadonly name: string;\n\treadonly effect: GlobalEffect;\n}\n\nconst ecmaScriptLibrary = /^lib\\.(es|decorators).*\\.d\\.ts$/;\n\nexport class GlobalReader {\n\tpublic constructor(private readonly projectDir: string) {}\n\n\tpublic read(file: SourceFile): GlobalReference[] {\n\t\tconst references: GlobalReference[] = [];\n\t\tfor (const identifier of file.getDescendantsOfKind(SyntaxKind.Identifier)) {\n\t\t\tconst declaringFile = this.globalDeclaringFileOf(identifier);\n\t\t\tif (declaringFile === undefined || declaringFile === file) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst origin = this.originOf(declaringFile.getFilePath());\n\t\t\tconst effect = origin === \"ecmascript\" ? this.effectOf(identifier) : undefined;\n\t\t\treferences.push({\n\t\t\t\tdeclaredIn: declaringFile.getFilePath(),\n\t\t\t\teffect: effect?.effect,\n\t\t\t\tline: identifier.getStartLineNumber(),\n\t\t\t\tname: effect?.name ?? identifier.getText(),\n\t\t\t\torigin,\n\t\t\t});\n\t\t}\n\t\treturn references;\n\t}\n\n\tprivate globalDeclaringFileOf(identifier: Identifier): SourceFile | undefined {\n\t\tconst symbol = identifier.getSymbol();\n\t\tconst declaration = symbol?.getValueDeclaration() ?? symbol?.getDeclarations()[0];\n\t\tif (declaration === undefined || !this.isGlobalScope(declaration)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn declaration.getSourceFile();\n\t}\n\n\tprivate isGlobalScope(declaration: Node): boolean {\n\t\tconst statement = Node.isVariableDeclaration(declaration) ? declaration.getVariableStatement() : declaration;\n\t\tconst container = statement?.getParent();\n\t\tif (Node.isSourceFile(container)) {\n\t\t\treturn !ts.isExternalModule(container.compilerNode);\n\t\t}\n\t\tconst module = container?.getParent();\n\t\treturn Node.isModuleBlock(container) && Node.isModuleDeclaration(module) && module.getDeclarationKind() === ModuleDeclarationKind.Global;\n\t}\n\n\tprivate originOf(path: string): GlobalReference[\"origin\"] {\n\t\tif (this.isInsideProject(path)) {\n\t\t\treturn \"project\";\n\t\t}\n\t\treturn ecmaScriptLibrary.test(basename(path)) ? \"ecmascript\" : \"host\";\n\t}\n\n\tprivate effectOf(identifier: Identifier): Effect | undefined {\n\t\tconst name = identifier.getText();\n\t\tconst parent = identifier.getParent();\n\t\tif (name === \"Date\") {\n\t\t\tif (Node.isNewExpression(parent) && parent.getExpression() === identifier && parent.getArguments().length === 0) {\n\t\t\t\treturn { effect: \"clock\", name: \"new Date()\" };\n\t\t\t}\n\t\t\tif (Node.isCallExpression(parent) && parent.getExpression() === identifier) {\n\t\t\t\treturn { effect: \"clock\", name: \"Date()\" };\n\t\t\t}\n\t\t\tif (this.isMemberAccess(parent, identifier, \"now\")) {\n\t\t\t\treturn { effect: \"clock\", name: \"Date.now\" };\n\t\t\t}\n\t\t}\n\t\tif (name === \"Math\" && this.isMemberAccess(parent, identifier, \"random\")) {\n\t\t\treturn { effect: \"randomness\", name: \"Math.random\" };\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate isMemberAccess(parent: Node | undefined, object: Identifier, member: string): boolean {\n\t\treturn Node.isPropertyAccessExpression(parent) && parent.getExpression() === object && parent.getName() === member;\n\t}\n\n\tprivate isInsideProject(path: string): boolean {\n\t\tconst offset = relative(this.projectDir, path);\n\t\treturn offset !== \"\" && !offset.startsWith(\"..\") && !isAbsolute(offset) && !offset.split(/[\\\\/]/).includes(\"node_modules\");\n\t}\n}\n","import { ModuleDeclarationKind, Node, SyntaxKind, VariableDeclarationKind } from \"ts-morph\";\nimport type { Expression, SourceFile, Statement, VariableDeclaration, VariableStatement } from \"ts-morph\";\n\nimport type { StatementKind } from \"../../../model/index.ts\";\nimport { TopLevelStatement } from \"../../../model/index.ts\";\n\nconst declarative: ReadonlySet<SyntaxKind> = new Set([\n\tSyntaxKind.ImportDeclaration,\n\tSyntaxKind.ImportEqualsDeclaration,\n\tSyntaxKind.ExportDeclaration,\n\tSyntaxKind.ClassDeclaration,\n\tSyntaxKind.InterfaceDeclaration,\n\tSyntaxKind.TypeAliasDeclaration,\n\tSyntaxKind.EmptyStatement,\n]);\n\nconst literals: ReadonlySet<SyntaxKind> = new Set([\n\tSyntaxKind.StringLiteral,\n\tSyntaxKind.NumericLiteral,\n\tSyntaxKind.BigIntLiteral,\n\tSyntaxKind.NoSubstitutionTemplateLiteral,\n\tSyntaxKind.RegularExpressionLiteral,\n\tSyntaxKind.TrueKeyword,\n\tSyntaxKind.FalseKeyword,\n\tSyntaxKind.NullKeyword,\n]);\n\nexport class StatementReader {\n\tpublic read(file: SourceFile): TopLevelStatement[] {\n\t\treturn file.getStatements().flatMap((statement) => this.declarationsOf(statement));\n\t}\n\n\tprivate declarationsOf(statement: Statement): TopLevelStatement[] {\n\t\tif (declarative.has(statement.getKind())) {\n\t\t\treturn [];\n\t\t}\n\t\tconst line = statement.getStartLineNumber();\n\t\tif (Node.isFunctionDeclaration(statement)) {\n\t\t\treturn [new TopLevelStatement(\"function\", statement.getName() ?? \"default\", line)];\n\t\t}\n\t\tif (Node.isEnumDeclaration(statement)) {\n\t\t\treturn [new TopLevelStatement(\"enum\", statement.getName(), line)];\n\t\t}\n\t\tif (Node.isModuleDeclaration(statement)) {\n\t\t\treturn statement.getDeclarationKind() === ModuleDeclarationKind.Global ? [] : [new TopLevelStatement(\"namespace\", statement.getName(), line)];\n\t\t}\n\t\tif (Node.isVariableStatement(statement)) {\n\t\t\treturn this.variablesOf(statement);\n\t\t}\n\t\tif (Node.isExportAssignment(statement)) {\n\t\t\treturn this.isData(statement.getExpression()) ? [] : [new TopLevelStatement(\"computed constant\", \"default\", line)];\n\t\t}\n\t\treturn [new TopLevelStatement(\"statement\", statement.getKindName(), line)];\n\t}\n\n\tprivate variablesOf(statement: VariableStatement): TopLevelStatement[] {\n\t\tconst isConstant = statement.getDeclarationKind() === VariableDeclarationKind.Const;\n\t\tconst declarations: TopLevelStatement[] = [];\n\t\tfor (const variable of statement.getDeclarations()) {\n\t\t\tconst kind = isConstant ? this.constantKindOf(variable) : \"mutable variable\";\n\t\t\tif (kind !== undefined) {\n\t\t\t\tdeclarations.push(new TopLevelStatement(kind, variable.getName(), variable.getStartLineNumber()));\n\t\t\t}\n\t\t}\n\t\treturn declarations;\n\t}\n\n\tprivate constantKindOf(variable: VariableDeclaration): StatementKind | undefined {\n\t\tconst initializer = variable.getInitializer();\n\t\tif (initializer === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst value = this.unwrapped(initializer);\n\t\tif (Node.isClassExpression(value)) {\n\t\t\treturn \"class expression\";\n\t\t}\n\t\tif (value.getType().getCallSignatures().length > 0) {\n\t\t\treturn \"function\";\n\t\t}\n\t\treturn this.isData(initializer) ? undefined : \"computed constant\";\n\t}\n\n\tprivate isData(expression: Expression): boolean {\n\t\tconst value = this.unwrapped(expression);\n\t\tif (literals.has(value.getKind())) {\n\t\t\treturn true;\n\t\t}\n\t\tif (Node.isPrefixUnaryExpression(value)) {\n\t\t\treturn this.isData(value.getOperand());\n\t\t}\n\t\tif (Node.isBinaryExpression(value)) {\n\t\t\treturn this.isData(value.getLeft()) && this.isData(value.getRight());\n\t\t}\n\t\tif (Node.isTemplateExpression(value)) {\n\t\t\treturn value.getTemplateSpans().every((span) => this.isData(span.getExpression()));\n\t\t}\n\t\tif (Node.isArrayLiteralExpression(value)) {\n\t\t\treturn value.getElements().every((element) => this.isData(Node.isSpreadElement(element) ? element.getExpression() : element));\n\t\t}\n\t\tif (Node.isObjectLiteralExpression(value)) {\n\t\t\treturn value.getProperties().every((property) => this.isDataProperty(property));\n\t\t}\n\t\tif (Node.isIdentifier(value) || Node.isPropertyAccessExpression(value)) {\n\t\t\treturn value.getType().getCallSignatures().length === 0;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate isDataProperty(property: Node): boolean {\n\t\tif (Node.isPropertyAssignment(property)) {\n\t\t\tconst initializer = property.getInitializer();\n\t\t\treturn initializer !== undefined && this.isData(initializer);\n\t\t}\n\t\tif (Node.isShorthandPropertyAssignment(property)) {\n\t\t\treturn property.getNameNode().getType().getCallSignatures().length === 0;\n\t\t}\n\t\tif (Node.isSpreadAssignment(property)) {\n\t\t\treturn this.isData(property.getExpression());\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate unwrapped(expression: Expression): Expression {\n\t\tif (Node.isParenthesizedExpression(expression) || Node.isAsExpression(expression) || Node.isSatisfiesExpression(expression) || Node.isNonNullExpression(expression)) {\n\t\t\treturn this.unwrapped(expression.getExpression());\n\t\t}\n\t\tif (Node.isTypeAssertion(expression)) {\n\t\t\treturn this.unwrapped(expression.getExpression());\n\t\t}\n\t\treturn expression;\n\t}\n}\n","import { SyntaxKind } from \"ts-morph\";\nimport type { SourceFile } from \"ts-morph\";\n\nimport { Throw } from \"../../../model/index.ts\";\n\nexport class ThrowReader {\n\tpublic read(file: SourceFile): Throw[] {\n\t\tconst throws: Throw[] = [];\n\t\tfor (const statement of file.getDescendantsOfKind(SyntaxKind.ThrowStatement)) {\n\t\t\tthrows.push(new Throw(statement.getStartLineNumber(), \"throw\"));\n\t\t}\n\t\tfor (const call of file.getDescendantsOfKind(SyntaxKind.CallExpression)) {\n\t\t\tif (call.getExpression().getText() === \"Promise.reject\") {\n\t\t\t\tthrows.push(new Throw(call.getStartLineNumber(), \"Promise.reject\"));\n\t\t\t}\n\t\t}\n\t\treturn throws.sort((left, right) => left.line - right.line);\n\t}\n}\n","import type { Symbol as MorphSymbol, Type, ts } from \"ts-morph\";\n\nimport { normalize } from \"node:path\";\n\nimport type { NamedType, ReturnShape } from \"../../../model/index.ts\";\nimport { ClassType } from \"../../../model/index.ts\";\nimport type { PackageNames } from \"../package-names.ts\";\n\nexport class TypeReader {\n\tpublic constructor(private readonly packageNames: PackageNames) {}\n\n\tpublic classTypesIn(type: Type): ClassType[] {\n\t\tconst found: ClassType[] = [];\n\t\tthis.collectClassTypes(type, found, new Set());\n\t\treturn found;\n\t}\n\n\tpublic classTypeOf(type: Type): ClassType {\n\t\tconst symbol = type.getSymbol();\n\t\tconst declaredIn = symbol?.getDeclarations()[0]?.getSourceFile().getFilePath();\n\t\treturn new ClassType(symbol?.getName() ?? type.getText(), declaredIn === undefined ? undefined : normalize(declaredIn), this.lineageOf(type));\n\t}\n\n\tpublic namedTypeOf(type: Type): NamedType {\n\t\tconst symbol = type.getSymbol() ?? type.getAliasSymbol();\n\t\treturn symbol === undefined ? { name: type.getText(), packageName: undefined } : this.namedSymbol(symbol);\n\t}\n\n\tpublic returnShapeOf(type: Type): ReturnShape {\n\t\tif (type.getSymbol()?.getName() === \"Promise\") {\n\t\t\tconst [inner] = type.getTypeArguments();\n\t\t\tif (inner !== undefined) {\n\t\t\t\treturn this.returnShapeOf(inner);\n\t\t\t}\n\t\t}\n\t\tconst alias = type.getAliasSymbol();\n\t\tconst members = type.isUnion() ? type.getUnionTypes() : [type];\n\t\treturn {\n\t\t\talias: alias === undefined ? undefined : this.namedSymbol(alias),\n\t\t\tunion: members.map((member) => this.namedTypeOf(member)),\n\t\t};\n\t}\n\n\tprivate lineageOf(type: Type): NamedType[] {\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\t\tconst lineage = [this.namedSymbol(symbol)];\n\t\tfor (const base of classType.getBaseTypes()) {\n\t\t\tlineage.push(...this.lineageOf(base));\n\t\t}\n\t\treturn lineage;\n\t}\n\n\tprivate namedSymbol(symbol: MorphSymbol): NamedType {\n\t\tconst declaration = symbol.getDeclarations()[0];\n\t\tconst packageName = declaration === undefined ? undefined : this.packageNames.ofFile(declaration.getSourceFile().getFilePath());\n\t\treturn { name: symbol.getName(), packageName };\n\t}\n\n\tprivate collectClassTypes(type: Type, found: ClassType[], seen: Set<ts.Type>): void {\n\t\tif (seen.has(type.compilerType)) {\n\t\t\treturn;\n\t\t}\n\t\tseen.add(type.compilerType);\n\n\t\tif (type.isUnion()) {\n\t\t\tfor (const member of type.getUnionTypes()) {\n\t\t\t\tthis.collectClassTypes(member, found, seen);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (type.isIntersection()) {\n\t\t\tfor (const member of type.getIntersectionTypes()) {\n\t\t\t\tthis.collectClassTypes(member, found, seen);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (type.isClass()) {\n\t\t\tfound.push(this.classTypeOf(type));\n\t\t}\n\t\tfor (const inner of this.innerTypesOf(type)) {\n\t\t\tthis.collectClassTypes(inner, found, seen);\n\t\t}\n\t}\n\n\tprivate innerTypesOf(type: Type): Type[] {\n\t\tconst inner = [...type.getTypeArguments(), ...type.getAliasTypeArguments(), ...type.getTupleElements()];\n\t\tfor (const signature of type.getCallSignatures()) {\n\t\t\tinner.push(signature.getReturnType());\n\t\t}\n\t\tif (this.isDeclaredByProject(type)) {\n\t\t\tfor (const property of type.getProperties()) {\n\t\t\t\tconst declaration = property.getDeclarations()[0];\n\t\t\t\tif (declaration !== undefined) {\n\t\t\t\t\tinner.push(declaration.getType());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn inner;\n\t}\n\n\tprivate isDeclaredByProject(type: Type): boolean {\n\t\tif (!type.isObject() || type.isClass()) {\n\t\t\treturn false;\n\t\t}\n\t\tconst declaration = (type.getSymbol() ?? type.getAliasSymbol())?.getDeclarations()[0];\n\t\tif (declaration === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tconst file = declaration.getSourceFile();\n\t\treturn !file.isInNodeModules() && !file.isDeclarationFile();\n\t}\n}\n","import { Project as MorphProject, ts } from \"ts-morph\";\nimport type { SourceFile as MorphFile } from \"ts-morph\";\n\nimport { existsSync } from \"node:fs\";\nimport { isAbsolute, join, normalize, relative } from \"node:path\";\n\nimport { GlobalUse, Project, SourceFile } from \"../../model/index.ts\";\nimport type { ImportScope } from \"../importer.ts\";\nimport { Importer } from \"../importer.ts\";\nimport { PackageNames } from \"./package-names.ts\";\nimport { ClassReader } from \"./readers/class-reader.ts\";\nimport { DependencyReader } from \"./readers/dependency-reader.ts\";\nimport { DisableReader } from \"./readers/disable-reader.ts\";\nimport { GlobalReader } from \"./readers/global-reader.ts\";\nimport type { GlobalReference } from \"./readers/global-reference.ts\";\nimport { StatementReader } from \"./readers/statement-reader.ts\";\nimport { ThrowReader } from \"./readers/throw-reader.ts\";\nimport { TypeReader } from \"./readers/type-reader.ts\";\n\nexport class TsMorphImporter extends Importer {\n\tprivate readonly classes: ClassReader;\n\tprivate readonly statements = new StatementReader();\n\tprivate readonly disables = new DisableReader();\n\tprivate readonly throws = new ThrowReader();\n\n\tpublic constructor(private readonly sources: MorphProject) {\n\t\tsuper();\n\t\tthis.classes = new ClassReader(new TypeReader(new PackageNames(sources.getFileSystem())));\n\t}\n\n\tpublic static fromTsConfig(tsConfigFilePath: string): TsMorphImporter {\n\t\tif (!existsSync(tsConfigFilePath)) {\n\t\t\tthrow new Error(`No TypeScript configuration found at ${tsConfigFilePath}: pass --tsconfig, or set tsconfig in alveolus.config.ts.`);\n\t\t}\n\t\treturn new TsMorphImporter(new MorphProject({ tsConfigFilePath }));\n\t}\n\n\tpublic resolves(packageName: string, scope: ImportScope): boolean {\n\t\tconst from = join(scope.rootDir, \"index.ts\");\n\t\tconst resolution = ts.resolveModuleName(packageName, from, this.sources.getCompilerOptions(), this.sources.getModuleResolutionHost());\n\t\treturn resolution.resolvedModule !== undefined;\n\t}\n\n\tpublic read(scope: ImportScope): Project {\n\t\tconst dependencies = new DependencyReader(this.sources, scope);\n\t\tconst globals = new GlobalReader(scope.projectDir);\n\t\tconst files: SourceFile[] = [];\n\t\tfor (const file of this.sources.getSourceFiles()) {\n\t\t\tif (this.isInside(scope.rootDir, file.getFilePath()) && !scope.isIgnored(file.getFilePath())) {\n\t\t\t\tfiles.push(this.readFile(file, dependencies, globals));\n\t\t\t}\n\t\t}\n\t\treturn new Project(scope.projectDir, files);\n\t}\n\n\tprivate readFile(file: MorphFile, dependencies: DependencyReader, globals: GlobalReader): SourceFile {\n\t\tconst globalReferences = globals.read(file);\n\t\treturn new SourceFile({\n\t\t\tclasses: file.getClasses().map((declaration) => this.classes.read(declaration)),\n\t\t\tdependencies: dependencies.read(file, globalReferences),\n\t\t\tdisables: this.disables.read(file),\n\t\t\tglobals: this.globalUsesOf(globalReferences),\n\t\t\tpath: normalize(file.getFilePath()),\n\t\t\tstatements: this.statements.read(file),\n\t\t\ttext: file.getFullText(),\n\t\t\tthrows: this.throws.read(file),\n\t\t});\n\t}\n\n\tprivate globalUsesOf(references: readonly GlobalReference[]): GlobalUse[] {\n\t\tconst uses: GlobalUse[] = [];\n\t\tfor (const reference of references) {\n\t\t\tif (reference.origin !== \"project\") {\n\t\t\t\tuses.push(new GlobalUse(reference.line, reference.name, reference.origin, reference.effect));\n\t\t\t}\n\t\t}\n\t\treturn uses;\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","export interface Scaffold {\n\treadonly path: string;\n\treadonly content: string;\n\treadonly marker?: string;\n}\n\nconst config = `import { defineConfig } from \"@alveolus/arch\";\n\nexport default defineConfig({\n\tboundedContexts: {},\n\tcontextMap: {},\n\troot: \"src\",\n});\n`;\n\nconst skill = `---\nname: alveolus\ndescription: Domain-Driven Design with @alveolus/core and @alveolus/arch. Use when writing or changing a class of the domain, the application or an adapter, when a class extends an Alveolus building block, or when alveolus arch check reports a violation.\n---\n\n# Alveolus\n\nThe documentation is installed with the package: read it with \\`npx alveolus explain <topic>\\`, not on the web. \\`npx alveolus explain\\` lists every topic.\n\n1. Before writing a class, read its building block: \\`npx alveolus explain aggregates\\`, \\`entities\\`, \\`value-objects\\`, \\`domain-events\\`, \\`domain-errors\\`, \\`ports\\`, \\`repositories\\`, \\`command-handlers\\`, \\`query-handlers\\`, \\`result\\`.\n2. Where a file goes and what each layer may import: \\`npx alveolus explain project-layout\\`.\n3. After each change, run \\`npx alveolus arch check\\`.\n4. On a violation, read the rule before changing the code: \\`npx alveolus explain <rule>\\`, with the rule id of the report, such as \\`layers/no-impure-domain\\`. Fix the cause: never turn a rule off, add a disable comment, add a context to \\`contextMap\\` or edit \\`alveolus.baseline.json\\` by hand without asking.\n`;\n\nconst agents = `## Alveolus\n\nThis project uses Alveolus for Domain-Driven Design: the building blocks of \\`@alveolus/core\\` and the architecture checks of \\`@alveolus/arch\\`. The documentation is installed with the package: \\`npx alveolus explain\\` lists the topics and \\`npx alveolus explain <topic>\\` prints one, so do not look for it on the web. Run \\`npx alveolus arch check\\` after each change, and read the rule reported with \\`npx alveolus explain <rule>\\` before fixing. See \\`.claude/skills/alveolus/SKILL.md\\`.\n`;\n\nexport const scaffolds: readonly Scaffold[] = [\n\t{ content: config, path: \"alveolus.config.ts\" },\n\t{ content: skill, path: \".claude/skills/alveolus/SKILL.md\" },\n\t{ content: agents, marker: \"npx alveolus explain\", path: \"AGENTS.md\" },\n];\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport type { Scaffold } from \"./scaffold.ts\";\nimport { scaffolds } from \"./scaffold.ts\";\n\nexport type Outcome = \"created\" | \"appended\" | \"kept\";\n\nexport interface Written {\n\treadonly path: string;\n\treadonly outcome: Outcome;\n}\n\nexport class Init {\n\tpublic constructor(private readonly projectDir: string) {}\n\n\tpublic run(): Written[] {\n\t\tconst written: Written[] = [];\n\t\tfor (const scaffold of scaffolds) {\n\t\t\twritten.push({ outcome: this.write(scaffold), path: scaffold.path });\n\t\t}\n\t\treturn written;\n\t}\n\n\tpublic get hint(): string | undefined {\n\t\tconst claude = join(this.projectDir, \"CLAUDE.md\");\n\t\tif (!existsSync(claude)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn \"CLAUDE.md exists: Claude Code reads it instead of AGENTS.md, so add a line with @AGENTS.md to it.\";\n\t}\n\n\tprivate write(scaffold: Scaffold): Outcome {\n\t\tconst path = join(this.projectDir, scaffold.path);\n\t\tif (!existsSync(path)) {\n\t\t\tmkdirSync(dirname(path), { recursive: true });\n\t\t\twriteFileSync(path, scaffold.content);\n\t\t\treturn \"created\";\n\t\t}\n\t\tif (scaffold.marker === undefined) {\n\t\t\treturn \"kept\";\n\t\t}\n\t\tconst existing = readFileSync(path, \"utf8\");\n\t\tif (existing.includes(scaffold.marker)) {\n\t\t\treturn \"kept\";\n\t\t}\n\t\twriteFileSync(path, `${existing.trimEnd()}\\n\\n${scaffold.content}`);\n\t\treturn \"appended\";\n\t}\n}\n","import { Command, CommanderError, Option } from \"commander\";\n\nimport { existsSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\n\nimport type { CheckOutcome } from \"../check/index.ts\";\nimport { Baseline, Checker, Report } from \"../check/index.ts\";\nimport type { Config } from \"../config/index.ts\";\nimport { ConfigLoader } from \"../config/index.ts\";\nimport type { Docs } from \"../docs/index.ts\";\nimport { TsMorphImporter } from \"../importer/index.ts\";\nimport { Init } from \"../init/index.ts\";\nimport { RuleRegistry } 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 tsconfig?: string;\n\treadonly allowGrowth?: boolean;\n\treadonly format: \"text\" | \"json\" | \"sarif\";\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 docs: Docs,\n\t\tprivate readonly colored = false,\n\t) {}\n\n\tpublic async run(args: readonly string[]): Promise<number> {\n\t\tthis.exitCode = 0;\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}`))\n\t\t\t.option(\"--allow-growth\", \"write the baseline even when it holds more entries than before\")\n\t\t\t.action((options: Options) => this.baseline(options));\n\n\t\tprogram\n\t\t\t.command(\"explain\")\n\t\t\t.description(\"Print a page of the documentation: a rule, a building block or a guide\")\n\t\t\t.argument(\"[topic]\", \"a rule id, a building block or a guide; without it, the list of topics\")\n\t\t\t.action((topic?: string) => this.explain(topic));\n\t\tprogram\n\t\t\t.command(\"init\")\n\t\t\t.description(`Write ${ConfigLoader.fileName}, and the instructions that tell a coding agent to read the documentation installed with the package`)\n\t\t\t.option(\"--project <dir>\", \"project directory\", \".\")\n\t\t\t.action((options: Pick<Options, \"project\">) => this.init(options));\n\n\t\treturn program;\n\t}\n\n\tprivate explain(topic?: string): void {\n\t\tif (topic === undefined) {\n\t\t\tthis.stdout.write(`${this.docs.topics().join(\"\\n\")}\\n`);\n\t\t\treturn;\n\t\t}\n\t\tconst match = this.docs.find(topic);\n\t\tif (\"page\" in match) {\n\t\t\tthis.stdout.write(match.page.text());\n\t\t\treturn;\n\t\t}\n\t\tconst list = match.candidates.length === 0 ? \"alveolus explain lists the topics.\" : `Did you mean ${match.candidates.join(\", \")}?`;\n\t\tthis.stderr.write(`No page for ${topic}: ${list}\\n`);\n\t\tthis.exitCode = 1;\n\t}\n\n\tprivate init(options: Pick<Options, \"project\">): void {\n\t\tconst init = new Init(resolve(this.cwd, options.project));\n\t\tfor (const { outcome, path } of init.run()) {\n\t\t\tthis.stdout.write(`${outcome} ${path}\\n`);\n\t\t}\n\t\tthis.stdout.write(`Name your bounded contexts in ${ConfigLoader.fileName}, then run alveolus arch check.\\n`);\n\t\tif (init.hint !== undefined) {\n\t\t\tthis.stderr.write(`${init.hint}\\n`);\n\t\t}\n\t}\n\n\tprivate withOptions(command: Command): Command {\n\t\treturn command\n\t\t\t.option(\"--project <dir>\", \"project directory\", \".\")\n\t\t\t.option(\"--config <file>\", \"configuration file\", ConfigLoader.fileName)\n\t\t\t.option(\"--tsconfig <file>\", \"TypeScript configuration, tsconfig.json or the one set in the configuration file\")\n\t\t\t.addOption(new Option(\"--format <format>\", \"how violations are printed\").choices([\"text\", \"json\", \"sarif\"]).default(\"text\"));\n\t}\n\n\tprivate async check(options: Options): Promise<void> {\n\t\tconst { config, registry, outcome } = await this.analyze(options);\n\t\tconst baseline = await Baseline.load(join(config.projectDir, Baseline.fileName));\n\t\tconst fresh = baseline.newViolations(outcome.violations);\n\t\tconst stale = baseline.staleEntries(outcome.violations);\n\t\tif (baseline.outdatedEntries > 0) {\n\t\t\tthis.warnOutdated(baseline.outdatedEntries);\n\t\t}\n\t\tif (stale > 0) {\n\t\t\tthis.stderr.write(`${stale} ${stale === 1 ? \"entry\" : \"entries\"} of the baseline match nothing any more: run alveolus arch baseline to drop ${stale === 1 ? \"it\" : \"them\"}.\\n`);\n\t\t}\n\t\tconst report = new Report({ baselined: outcome.violations.length - fresh.length, files: outcome.files, stale, suppressed: outcome.suppressed, violations: fresh }, this.colored);\n\n\t\tthis.stdout.write(this.render(report, options.format, registry));\n\t\tthis.exitCode = fresh.some((violation) => violation.severity === \"error\") ? 1 : 0;\n\t}\n\n\tprivate render(report: Report, format: Options[\"format\"], registry: RuleRegistry): string {\n\t\tif (format === \"json\") {\n\t\t\treturn report.json();\n\t\t}\n\t\tif (format === \"sarif\") {\n\t\t\treturn report.sarif(registry.rules.map((rule) => rule.meta));\n\t\t}\n\t\treturn report.text();\n\t}\n\n\tprivate warnOutdated(count: number): void {\n\t\tconst entries = count === 1 ? \"1 entry of the baseline has no fingerprint and matches\" : `${count} entries of the baseline have no fingerprint and match`;\n\t\tthis.stderr.write(`${entries} nothing: run alveolus arch baseline to write ${Baseline.fileName} again.\\n`);\n\t}\n\n\tprivate async baseline(options: Options): Promise<void> {\n\t\tconst { config, outcome } = await this.analyze(options);\n\t\tconst path = join(config.projectDir, Baseline.fileName);\n\t\tconst previous = (await Baseline.load(path)).size;\n\t\tif (existsSync(path) && outcome.violations.length > previous && options.allowGrowth !== true) {\n\t\t\tthis.stderr.write(`The baseline would grow from ${previous} to ${outcome.violations.length} entries: fix the new violations, or pass --allow-growth.\\n`);\n\t\t\tthis.exitCode = 1;\n\t\t\treturn;\n\t\t}\n\t\tawait Baseline.of(outcome.violations).save(path);\n\t\tthis.stdout.write(`${outcome.violations.length} violations written to ${Baseline.fileName}\\n`);\n\t}\n\n\tprivate async analyze(options: Options): Promise<{ config: Config; registry: RuleRegistry; outcome: CheckOutcome }> {\n\t\tconst projectDir = resolve(this.cwd, options.project);\n\t\tconst config = await new ConfigLoader().load(projectDir, options.config);\n\t\tconst tsConfigPath = options.tsconfig === undefined ? config.tsConfigPath : resolve(config.projectDir, options.tsconfig);\n\t\tconst registry = new RuleRegistry();\n\t\tconst checker = new Checker(TsMorphImporter.fromTsConfig(tsConfigPath), registry.rules);\n\t\treturn { config, outcome: checker.check(config), registry };\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","interface Replacement {\n\treadonly pattern: RegExp;\n\treadonly text: string;\n}\n\nconst html: readonly Replacement[] = [\n\t{ pattern: /<dt>/g, text: \"- \" },\n\t{ pattern: /<\\/dt>\\s*<dd>/g, text: \": \" },\n\t{ pattern: /<[^>\\n]+>/g, text: \"\" },\n\t{ pattern: /^\\t+- /gm, text: \"- \" },\n\t{ pattern: /&lt;/g, text: \"<\" },\n\t{ pattern: /&gt;/g, text: \">\" },\n\t{ pattern: /&amp;/g, text: \"&\" },\n];\n\nconst frontmatter = /^---\\n([\\s\\S]*?)\\n---\\n/;\n\nexport class Page {\n\tpublic constructor(\n\t\tpublic readonly topic: string,\n\t\tprivate readonly source: string,\n\t) {}\n\n\tpublic get description(): string {\n\t\tconst header = frontmatter.exec(this.source)?.[1] ?? \"\";\n\t\tconst description = /^description: \"?(.*?)\"?$/m.exec(header)?.[1] ?? \"\";\n\t\treturn description;\n\t}\n\n\tpublic text(): string {\n\t\tlet text = this.source.replace(frontmatter, \"\");\n\t\tfor (const { pattern, text: replacement } of html) {\n\t\t\ttext = text.replace(pattern, replacement);\n\t\t}\n\t\treturn `${text.replace(/\\n{3,}/g, \"\\n\\n\").trim()}\\n`;\n\t}\n}\n","import { globSync, readFileSync } from \"node:fs\";\nimport { join, sep } from \"node:path\";\n\nimport { Page } from \"./page.ts\";\n\nexport type Match = { readonly page: Page } | { readonly candidates: readonly string[] };\n\nexport class Docs {\n\tpublic static readonly sections: readonly string[] = [\"guide\", \"integrations\", \"core\", \"rules\"];\n\n\tpublic constructor(private readonly dir: string) {}\n\n\tpublic topics(): string[] {\n\t\tconst topics: string[] = [];\n\t\tfor (const section of Docs.sections) {\n\t\t\tfor (const file of globSync(\"**/*.md\", { cwd: join(this.dir, section) }).sort()) {\n\t\t\t\ttopics.push(this.topicOf(join(section, file)));\n\t\t\t}\n\t\t}\n\t\treturn topics.sort();\n\t}\n\n\tpublic find(name: string): Match {\n\t\tconst wanted = name.replace(/\\.md$/, \"\").replace(/\\/$/, \"\").replace(/\\\\/g, \"/\");\n\t\tconst candidates = this.topics().filter((topic) => topic === wanted || topic.endsWith(`/${wanted}`));\n\t\tconst exact = candidates.find((topic) => topic === wanted);\n\t\tif (exact !== undefined) {\n\t\t\treturn { page: this.read(exact) };\n\t\t}\n\t\tif (candidates.length === 1 && candidates[0] !== undefined) {\n\t\t\treturn { page: this.read(candidates[0]) };\n\t\t}\n\t\treturn { candidates };\n\t}\n\n\tpublic read(topic: string): Page {\n\t\tconst path = join(this.dir, ...topic.split(\"/\"));\n\t\ttry {\n\t\t\treturn new Page(topic, readFileSync(`${path}.md`, \"utf8\"));\n\t\t} catch {\n\t\t\treturn new Page(topic, readFileSync(join(path, \"index.md\"), \"utf8\"));\n\t\t}\n\t}\n\n\tprivate topicOf(file: string): string {\n\t\treturn file\n\t\t\t.split(sep)\n\t\t\t.join(\"/\")\n\t\t\t.replace(/\\.md$/, \"\")\n\t\t\t.replace(/\\/index$/, \"\");\n\t}\n}\n"],"mappings":";;;;;;;;;;AAOA,IAAa,WAAb,MAAa,SAAS;CAGgB;CAFrC,OAAuB,WAAW;CAElC,YAAoB,SAA4C;EAA3B,KAAA,UAAA;CAA4B;CAEjE,OAAc,GAAG,YAA4C;EAC5D,OAAO,IAAI,SAAS,WAAW,KAAK,EAAE,MAAM,aAAa,MAAM,cAAc;GAAE;GAAM;GAAa;GAAM;EAAO,EAAE,CAAC;CACnH;CAEA,aAAoB,KAAK,MAAiC;EACzD,IAAI,CAAC,WAAW,IAAI,GACnB,OAAO,IAAI,SAAS,CAAC,CAAC;EAEvB,MAAM,UAAoC,KAAK,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC;EACjF,OAAO,IAAI,SAAS,QAAQ,cAAc,CAAC,CAAC;CAC7C;CAEA,IAAW,OAAe;EACzB,OAAO,KAAK,QAAQ;CACrB;CAEA,IAAW,kBAA0B;EACpC,OAAO,KAAK,QAAQ,QAAQ,UAAU,MAAM,gBAAgB,KAAA,CAAS,CAAC,CAAC;CACxE;CAEA,cAAqB,YAA+C;EACnE,OAAO,KAAK,MAAM,UAAU,CAAC,CAAC;CAC/B;CAEA,aAAoB,YAA0C;EAC7D,OAAO,KAAK,MAAM,UAAU,CAAC,CAAC;CAC/B;CAEA,MAAc,YAA2F;EACxG,MAAM,4BAAY,IAAI,IAAoB;EAC1C,KAAK,MAAM,SAAS,KAAK,SACxB,UAAU,IAAI,KAAK,MAAM,KAAK,IAA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