Buf
$ buf Official Low RiskOfficial Buf CLI replacing brittle protoc invocations with deterministic Protobuf linting, backward-compatibility breaking checks, formatting, and managed code generation. Native --error-format=json and buf format --diff --exit-code make Protobuf workflows reliable for agents.
brew install buf Runs local Protobuf linting, breaking checks, and codegen directly in the workspace via buf.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
First-class --error-format=json, buf format --diff --exit-code, buf config ls-lint-rules --format json, and predictable subcommands.
--error-format=jsonsupported acrosslint,breaking, andbuildbuf format --diff --exit-codeprovides clean dry-run verification
Local lint, breaking, and format --diff are strictly read-only; remote buf push and local generate/format -w are explicit subcommands/flags.
- Clear separation between read-only checks and
-w/generate/push
Static Go binary distributed via Homebrew, npm, go install, Docker, and GitHub Releases.
- Zero external
protocdependency required for linting and breaking checks
Replaces fragile protoc flag chains with reproducible buf.yaml / buf.gen.yaml workflows.
- Fast Protobuf parsing, breaking-change detection, and remote/local codegen
Official Buf CLI (bufbuild/buf) under Apache-2.0 license with active releases.
- Official
bufbuild/bufrepository
Excellent CLI reference and rule catalog at buf.build/docs.
- Official CLI reference at buf.build/docs/reference/cli/buf/
Security, Auth & Guardrails
Offline for local lint/format/generate; optional Buf Schema Registry (BSR) credentials live in ~/.netrc or BUF_TOKEN.
Apache-2.0 open-source CLI; free locally (BSR private registry tiers are optional).
# Buf (buf) Agent Rules - Always pass `--error-format=json` to `buf lint` and `buf breaking`. - Run `buf format --diff --exit-code` before `buf format -w`, and never push to BSR (`buf push`) without explicit user consent.
Agent-Ready Command Recipes
Safe Read-Only Queries
buf lint --error-format=json
Validates .proto files against buf.yaml rules and emits one JSON diagnostic per line.
buf breaking --against '.git#branch=main' --error-format=json
Detects wire/source breaking .proto changes against main in JSON without modifying files.
Controlled Writes & Previews
buf format --diff --exit-code && buf format -w
Checks formatting diff first and applies -w in-place formatting when desired.
Strengths for Agents
- + Consistent
--error-format=jsonacrosslint,breaking, andbuildwith self-contained Protobuf compiler. - + Git-aware
buf breaking --against '.git#branch=main'catches subtle wire-compatibility regressions.
Caveats & Pitfalls
- ! Remote BSR dependencies or remote plugins in
buf.gen.yamlrequire network access (andBUF_TOKENfor private modules). - !
buf.yamlv1 vs v2 config syntax differs slightly across older and newer repos.