This tutorial uses the checked-in fixtures/simple-risk/sample.diff file to show how an agent or maintainer can score a patch before continuing.
npm install
bash demo/run-fixture-risk-scan.shThe demo writes:
.tmp/demo-fixture-risk-scan/diffbudget-report.md.tmp/demo-fixture-risk-scan/diffbudget-report.json
The Markdown report summarizes status, changed files, changed lines, risk score, and the riskiest files. In the fixture, the report calls out a dependency lockfile and an auth path.
Agents and CI jobs should read diffbudget-report.json for status and findings instead of scraping the Markdown report. Treat pass as a signal to continue with normal checks, not as permission to skip review.
For uncommitted work, use:
diffbudget scan --base HEAD --output .diffbudget/latest --strictWhen strict mode exits non-zero, capture the command, report path, and top findings before asking for maintainer review.
- DiffBudget scores unified diffs; it does not prove semantic correctness.
- Missing-test detection is heuristic.
- Branch protection, test execution, and release approval remain separate controls.