diffguard-0.2.0 is not a library.
diffguard
Command-line interface for diff-scoped governance linting.
This crate is the workspace I/O boundary. It owns:
- CLI parsing (
clap) - config loading/merge (
diffguard.toml, includes, env expansion) - git integration (
base/head,--staged, blame filtering) - invoking
diffguard-core - writing receipts/reports and returning stable exit codes
Install
# crates.io
# workspace source
Command Surface
diffguard commands:
check- evaluate rules on diff-scoped linesrules- print effective rules (toml/json)explain- show details for one rule IDvalidate- validate config regex/globs and optional strict checksinit- write starterdiffguard.tomltest- runrule.test_casesfrom configtrend- summarize trend-history filessarif/junit/csv- render existing receipt files
Quick Start
Non-git input is also supported:
|
check Highlights
Input selection:
--base <REF>(repeatable) and--head <REF>--staged--diff-file <PATH|->
Policy and filtering:
--scope added|changed|modified|deleted--fail-on error|warn|never--max-findings <N>--paths <GLOB>(repeatable)--only-tags/--enable-tags/--disable-tags--language <LANG>(force preprocessing language)--blame-author/--blame-max-age-days
Outputs:
--out(JSON receipt)--md--sarif--junit--csv/--tsv--sensor--rule-stats--false-positive-baseline--write-false-positive-baseline--trend-history/--trend-max-runs--github-annotations
Exit Codes
Stable exit code contract in standard mode:
0pass1tool/runtime error2policy fail3warn-fail (whenfail_on=warn)
--mode cockpit changes behavior to integration-focused semantics:
0when a receipt is successfully written1only on catastrophic failure
Presets
diffguard init --preset ... supports:
minimalrust-qualitysecretsjs-consolepython-debug
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.