DiffGuard

lint-staged for AI agents — block dangerous diffs before they land

npx -y github:Isco0819/diffguard

Ever run into this?

AI agents auto-commit code constantly, but lint-staged (13k+ GitHub stars, proven demand for pre-commit diff hooks) has no opinionated mode for LLM footguns: mass file deletions, silently removed auth checks, newly hardcoded secrets, or deleted test files with no source change. Engineers burn hours in post-mortems catching what a 5-second gate should have stopped.

The fix

npx CLI that installs as a git pre-commit hook and scans staged diffs against a ruleset of known AI-agent footguns, blocking commits with a clear line-level report. Ships with an MCP server mode so agents can self-check before calling git commit.

What it does

npx -y github:Isco0819/diffguard