#!/usr/bin/env python3 """Dependency-direction and size gate for the hexagonal architecture (LeaseVibe STRA-338, ADR on that item). Rules, read from `architecture.json` (the policy) and `architecture-baseline.json` (the debt that exists today): layers every workspace package has exactly one layer (L0 contract .. L4 host); a normal dependency must point to the same or a LOWER layer. adapters inside L3 a crate may depend on another L3 crate only through an edge listed in "adapter_edges". pure packages in "pure_layers" must not use the "forbidden_in_pure" external crates. size no .rs file over "max_lines"; a file already over it may not grow beyond its baseline entry. ratchet counts of "source_patterns" (env reads, Instant::now, #[path], process globals, dyn) may only fall. A violation listed in the baseline is debt and does not fail. The baseline can only be lowered with --update-baseline; raising it needs --allow-increase and is visible in review. Pure stdlib Python, no network, no GPU: a build-time check. Usage: scripts/check-architecture.py [--update-baseline [--allow-increase]] [--report] """ import pathlib import sys sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) from archcheck.cli import main # noqa: E402 if __name__ == "__main__": sys.exit(main(sys.argv[1:], pathlib.Path(__file__).resolve().parent.parent))