/** * Architecture invariant checker (spec-23; change: widen-architecture-rule-vocabulary). * * 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; ruleId?: string; scope?: string; decision?: ArchitectureRule['decision']; /** Ordered path receipt for transitive and cycle findings. */ path?: string[]; /** Lower-confidence edge evidence when the verdict does not rest only on imports. */ confidence?: string; /** Derived instability values for `moreUnstable` findings. */ instability?: { dependent: number; dependency: number; }; /** The sibling conclusion that owns deletion/dead-code advice. */ relatedConclusion?: 'find_dead_code'; } /** Result of a full scan. */ export interface ScanResult { violations: Violation[]; warnings: string[]; checkedEdges: number; rulesApplied: number; assessmentComplete: boolean; incompleteKinds: ArchitectureRule['kind'][]; } /** 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; } 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