/** * Architecture invariant checker (spec-23). * * Deterministic, offline passes over the file-level dependency graph. Two entry * points: * - `scanViolations` — the full current-violations report (continuous reporting). * - `canImport` — the pre-edit query: "may a file under A import B?", answered * BEFORE the edge is written. Pure; writes nothing. * * The `layers` kind reuses `classifyLayerEdge` from the call-graph analyzer so the * layering convention has exactly one source of truth. */ import type { DependencyGraphResult } from '../analyzer/dependency-graph.js'; import type { ArchitectureRule, ArchitectureRules, RuleSource } from './rules.js'; /** A concrete dependency that breaks a declared rule. Paths are repo-relative. */ export interface Violation { kind: ArchitectureRule['kind']; from: string; to: string; reason: string; source: RuleSource; } /** Result of a full scan. */ export interface ScanResult { violations: Violation[]; warnings: string[]; checkedEdges: number; rulesApplied: number; } /** Verdict for a hypothetical (pre-edit) import. */ export interface ImportVerdict { allowed: boolean; /** The governing rule when disallowed (or the unresolved-target note). */ rule?: { kind: ArchitectureRule['kind'] | 'unresolved'; source?: RuleSource; reason: string; }; /** The resolved target file (relative) when a symbol was resolved to one. */ resolvedTo?: string; reason: string; } /** * Prefix/dir match: `pattern` is treated as a path prefix (a directory or an exact * file). Trailing `/`, `/*`, `/**`, or `*` are tolerated and stripped. Deterministic; * no full glob engine (kept to the well-understood dir-prefix vocabulary). */ export declare function pathMatches(rel: string, pattern: string): boolean; /** * Full violation scan over the dependency graph. Reports every edge that breaks a * declared rule, plus warnings for rule prefixes that match no file in the repo * (likely typos) — never a throw. */ export declare function scanViolations(depGraph: DependencyGraphResult, rules: ArchitectureRules): ScanResult; /** * Pre-edit query: would importing `to` from `fromFile` be allowed under the rules? * `to` may be a file path (relative or absolute) or a bare exported symbol — in the * latter case it is resolved to its declaring file via the dependency graph. When * the target cannot be resolved to a file, the verdict is permissive (`allowed: * true`) with an `unresolved` note: the checker only decides what it can ground. */ export declare function canImport(fromFile: string, to: string, rules: ArchitectureRules, depGraph?: DependencyGraphResult): ImportVerdict; //# sourceMappingURL=check.d.ts.map