Tests can pass while a change adds a forbidden dependency, a new cycle, or a copy of code another module owns.
archfit checks each change against the architecture policy of your repository, .archfit.yaml. When a rule is in your way, you ask an owner: ask once, and the answer is remembered for the next change.
A real run in pumba: #414 adds the dependency and fails the check, #415 is the request, and #418 is the owner's answer, one line in .archfit.yaml. The owner answers in the Archfit App. Without the App, archfit request prints the request for you to show an owner.
This record comes from a deliberate probe on archfit's own repository, at commit 954c72c8: one import from internal/scope to internal/policy, added to show the record and never committed.
$ archfit check
internal/scope/scope.go:12: graph: analysis-scope -> architecture-policy is not an allowed dependency
why: a new dependency between modules needs an owner
balance: 9/10 (min 7): contract, architecture-policy is high
next: archfit request -m "<why you need it>" (do not copy the code)
internal/scope/scope.go:12: layers: analysis-scope (support) -> architecture-policy (core) goes against the layer order
why: a module may depend only on its own layer or an inner one
next: fix the code
archfit: fail, 2 errors
policy: not protected
Each error says where, which rule, and what is wrong; then why, and the next step. The status line comes after the errors: pass, fail, or unknown, with exit code 0, 1, or 2. The check compares the change with its target branch and lists only the errors the change adds. policy: not protected means no workflow runs the Archfit Action, so the result is a local guide.
brew install coupling-dev/tap/archfit
archfit init # write .archfit.yaml from the code; today's errors become exceptions
archfit check # the change: pass, fail, or unknownThis is the local-only path. For checks on GitHub pull requests, run archfit setup instead: it writes the policy and the workflow and opens the setup pull request. See Try it on your pull request.
Read the policy init writes, then open a pull request with it. Getting started has the other ways to install (go install needs Go 1.27 or newer), the tools each language needs, the agent hooks, and CI.
archfit is a command-line check of one change against one policy file. The policy names the modules, their allowed dependencies, their layers, and your rules. archfit reads the imports and literals of Go, TypeScript, JavaScript, Python, Rust, and .NET code. The same command runs on your machine, in agent hooks, and in CI.
archfit is not a test framework, a linter for style, or a code reviewer. It does not run your tests. A missing tool makes the check unknown for the code it cannot read, never a pass.
| archfit | ArchUnit | import-linter | |
|---|---|---|---|
| Languages | Go, TypeScript, JavaScript, Python, Rust, .NET | Java and other JVM languages | Python |
| Rules live in | One policy file, .archfit.yaml |
Java test code | A configuration file of import contracts |
| Runs as | A command on the change against its target branch | Tests in your test runner | A command on the import graph |
| A rule in your way | archfit request asks an owner |
Change the code or the test | Change the code or the contract |
- Getting started — set up a repository and run your first check.
- Commands — command behavior, flags, and exit codes.
- Configuration — every policy field and default.
- Rules — built-in rules, custom rules, and exceptions.
- Results — the record, the statuses, JSON, and SARIF.
- Metrics and coupling — what the measurements mean.
- Language support — analyzers, tools, and coverage.
- CI and agents — automation workflows.
- Troubleshooting — common errors and recovery.
- Architecture and evidence — contributor references.
- Development — build and change the project.
- Changelog — release history.