SuperAPI AI Directory

gavel

Code-quality gate for Bazel monorepos: runs lint, coverage and architecture checks from the build graph and returns a pass/fail verdict.

Open website

About this tool

Gavel is a code quality gate tool for Bazel monorepos, positioned as a "build-graph-native, locally run, agent-friendly" quality decision layer. Its core claim is: a repository building successfully does not mean there are no problems. Gavel is responsible for judging changes under quality rules and giving a verdict, while handing it off for use by CI, terminals, and coding agents.

[Purpose and Positioning] Gavel targets Bazel monorepos, solving the problem that platforms like SonarQube are structurally ill-suited to answer: which packages in my Bazel monorepo are healthy, and whether this change made one of them worse. It uses the build graph as the unit of analysis, placing quality gating within the inner development loop. The project positions itself as an alpha version v0.1.0, under active development, with API and configuration formats subject to change; Gavel runs the gate on itself on every commit.

[Main Capabilities]

  1. Evidence comes from the build graph: analyzers (golangci-lint, PMD, CPD, SpotBugs, Error Prone, Ruff, Bandit, ESLint, Clippy) run as Bazel aspects and can see the exact source tree, dependency graph, and toolchain that Bazel has resolved, without needing a standalone scanner or a second set of configuration that may drift. It only looks at targets the graph considers changed (--affected), so it remains fast to run as the monorepo grows. All tools and languages are uniformly normalized to SARIF format.
  2. Judge only the changes: gavel.yaml is the quality gate, checked into version control as code, rather than configured by clicking in a web UI. It compares only what has just been added against the committed baseline: newly discovered issues, coverage regressions, new architecture violations. Therefore Gavel can be adopted in repositories with a decade of existing technical debt, and it will only be blocked by the current diff, not by historical backlog. Each run saves a fingerprint snapshot, and the next run shows the delta—new, fixed, existing—as well as coverage trends, without needing a server.
  3. Coding agents can request verdicts: gavel mcp starts a Model Context Protocol server, exposing the judge, lint_file, findings, coverage, and arch tools. Point Claude Code, Cursor, or Zed at it, and the agent can, while writing, work against the same Bazel-savvy gatekeeping checks its own work. For editors and dashboards, gavel watch re-analyzes on every save and outputs a JSONL event stream. Both run entirely locally, with no server and no network.

[Relationship with SonarQube] SonarQube is a mature platform with fifteen years of accumulated rules, and Gavel does not attempt to replace it. Gavel answers questions that SonarQube structurally cannot answer. If you are already using aspect's rules_lint, you can keep it; Gavel reads its output in SARIF in bazel-bin/ (gavel judge --findings-source=rules_lint) and turns it into gates—baseline deltas, coverage, architecture, verdicts—the layers that rules_lint intentionally leaves for you to handle yourself.

[Usage] Requires a Bazel 8.0+ (bzlmod) workspace; precompiled binaries are provided on the releases page for each platform. Verify with gavel --version. The main commands include:

  • gavel init: generates configuration and Bazel integration
  • gavel judge: analyzes, evaluates gates, and shows findings and deltas
  • gavel judge --project <name>, --quick, --summary, --affected: limit and shape the scope of the run
  • gavel judge --absolute: evaluates all findings (release gates, nightly runs)
  • gavel judge --json, --output-sarif report.sarif: structured output for CI, IDEs, and GitHub Code Scanning
  • gavel judge --server URL --token TOKEN: shared team baseline, fetch and submit
  • gavel watch: re-analyzes on changes and outputs a JSONL event stream
  • gavel mcp: Model Context Protocol server for editor/agent integration
  • gavel validate: checks the health of the Bazel integration

[Configuration and Baseline] The baseline mode is the default mode, performs new/fixed/existing classification based on fingerprints, and is committed to git for team use. The configuration files are gavel.yaml and architecture.yml, with the documentation explaining each field. An optional server provides a web dashboard, centralized history, team baselines, and API-token authentication.

[Applicable Scenarios] Suitable for teams using a Bazel 8.0+ (bzlmod) monorepo who want to enforce code quality gates incrementally by change locally and in CI; suitable for situations where rules_lint is already used and you want to supplement the baseline delta, coverage, architecture, and verdict layers; also suitable for scenarios where you want coding agents to self-check quality while writing.

[Limitations] Currently in alpha stage v0.1.0, and the API and configuration format may change. Requires a Bazel 8.0+ bzlmod workspace. The materials do not provide details such as pricing, charging model, or the specific number of rules, and none are currently provided.