Gavel
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**Bazel builds your monorepo. Gavel judges it. Order in the codebase!**
The quality gate for Bazel monorepos — build-graph-native, local, agent-ready.
Your monorepo builds green. That's not the same as innocent. Gavel gathers the
evidence as Bazel aspects, holds every change to the law you set in gavel.yaml,
and returns a verdict: the regression you just introduced stands charged, while a
decade of existing debt is not on trial. One verdict, handed to your CI, your
terminal, and your coding agent alike.
---
Install
Prebuilt binaries for every platform are on the releases page.
Gavel needs a Bazel **8.0+** (bzlmod) workspace; verify with gavel --version.
Build from source
How it works
*Every change gets its day in court.*
1. The evidence comes from the build graph
Analyzers — golangci-lint, PMD, CPD, SpotBugs, Error Prone, Ruff, Bandit,
ESLint, Clippy — run as Bazel **aspects**. They see the exact source tree,
dependency graph, and toolchains Bazel already resolves; no separate scanner, no
second config to drift. SonarQube re-scans the world; Gavel looks only at the
targets the graph says changed (--affected), so a run stays fast as the
monorepo grows. Every tool, every language, normalized to one format: **SARIF**.
2. You're only tried for what you changed
gavel.yaml **is** the quality gate — code, reviewed and versioned with the
repo, not clicked into a web UI. It evaluates only what you just added against a
committed baseline: new findings, coverage regressions, new architecture
violations. Adopt Gavel on ten years of debt and it blocks on today's diff,
never on the backlog.
Every run saves a fingerprint snapshot; the next shows the delta — new, fixed,
existing — plus the coverage trend. No server required.
3. A verdict your coding agent can request
Coding agents write code they can't see the consequences of — a lint regression,
a coverage drop, a layering violation land three commits later in CI. gavel mcp
starts a Model Context Protocol server that
exposes judge, lint_file, findings, coverage, and arch as tools. Point
Claude Code, Cursor, or Zed at it and the agent checks its own work against the
same Bazel-aware gate **as it writes** — a quality conscience, inline.
For editors and dashboards, gavel watch re-analyzes on every save and emits a
JSONL event stream. Both run fully local — no server, no network.
Gavel vs SonarQube: the case
| | SonarQube | Gavel |
|---|---|---|
| Build-graph awareness | None | Bazel aspects understand target dependencies |
| Monorepo model | One project, or a branch per project | Hierarchical: per-package, per-project, whole repo |
| Analysis scope | Full scan or file diff | Bazel-aware: changed files + affected targets |
| Local workflow | Server round-trip | Fully local, zero network |
| Coding-agent / editor loop | — | MCP server + watch event stream |
| Quality gate | Web-UI config | Code (gavel.yaml), versioned with the repo |
| Progress tracking | Server-backed | Local fingerprint snapshots, no infrastructure |
| Footprint | Java server + database + scanner | One static Go binary, runs inside Bazel |