Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

diffsniffer

Flags git commits that were AI-authored, touch a configured risk-tier path, and never got a human review — before that gap turns into an incident.

The problem

Small teams (1-10 people) are shipping AI-generated code (Claude Code, Copilot, Cursor) straight into production with no review discipline, because there's no lightweight tool between "nothing" and an enterprise governance platform (SonarQube, Checkmarx, Quality Clouds — priced and built for orgs with compliance departments).

diffsniffer isn't a quality scanner or a linter. It's a provenance and accountability log: after the fact, which commits touching sensitive paths (auth/**, **/payments/**, your database layer — whatever you configure) were AI-authored and never got a second set of eyes on them?

Detection is entirely metadata-based — git trailers and path globs. No AI calls anywhere in the core tool: no API cost, no code leaves your machine, nothing to hallucinate. That's a design constraint, not a limitation.

How it decides

A commit is flagged when all three are true:

  1. AI-authored — a Co-Authored-By: trailer matches a known AI-tool signature (Claude, Copilot by default; extend the list yourself for Cursor or anything else your team uses).
  2. Touches a risk-tier path — the commit's changed files match a glob in your configured risk_paths.
  3. Not human-reviewed — no Reviewed-by: trailer in the commit message.

Only that exact combination flags. AI-authored-but-reviewed doesn't flag. Reviewed-but-not-risk-path doesn't flag. Risk-path-but-human-written doesn't flag.

Install

Download the binary for your platform from the latest release — no runtime dependency, no install step beyond putting the file somewhere on your PATH (or not; the git hook works either way, see below).

Platform Binary
Windows x64 diffsniffer-win-x64.exe
Linux x64 diffsniffer-linux-x64

Usage

Local git hook (log-only, zero infrastructure)

diffsniffer install-hook

Installs a post-commit hook in the current repo. From then on, every commit triggers a scan of everything since the last one it looked at, and appends any newly-flagged commits to the log. This can't block a push — post-commit hooks run after the commit already exists — it's purely a running record, and it's entirely local to your machine.

Worked example:

$ git commit -m "$(cat <<'EOF'
fix: tighten session check

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
diffsniffer: scanned 1 commit(s), flagged 1
  [flagged] a1b2c3d touches auth/session.cs (claude, no review)
            add 'Reviewed-by: Your Name <you@example.com>' to the commit message to clear this

To "clear" a flag on a commit you haven't pushed yet, amend it with a Reviewed-by: trailer — the tool suggests your own configured git identity (git config user.name/user.email) as a starting point.

CI (GitHub Action, real enforcement)

- uses: Coderb-dev/diffsniffer@v0.1.0
  with:
    version: v0.1.0

Unlike the local hook, this can actually gate a merge: it scans the exact commit range for the push/PR and exits non-zero if anything in it is newly flagged. Mark the check required in your branch protection rules to enforce it, or leave it informational if you'd rather just see it.

Config: .diffsniffer.toml

Lives at the repo root. Every field has a sane default if the file is absent entirely.

[risk_paths]
patterns = [
  "auth/**",
  "**/payments/**",
  "db/storage/**",
]

[ai_signatures]
# extend or override the built-in default list (Claude, Copilot)
extra_patterns = [
  "Co-Authored-By: .*Cursor.*",
]

[output]
log_path = ".diffsniffer/log.jsonl"
format = "jsonl"   # jsonl | markdown
  • risk_paths.patterns — glob patterns (*, **, ?) matched against changed file paths. Empty by default, meaning nothing flags until you configure this.
  • ai_signatures.extra_patterns — regexes matched against the full trailer line (e.g. Co-Authored-By: Claude <noreply@anthropic.com>), added on top of the built-in Claude/Copilot patterns.
  • output.log_path — where flagged commits get appended. Default .diffsniffer/log.jsonl.
  • output.format — jsonl (default, one JSON object per line) or markdown (a running table, readable without tooling).

What this is not

No dashboards, no accounts, no SaaS backend. No code-quality scoring, no probabilistic "is this AI-written" classifier — detection is deterministic and metadata-only. Git only, no other VCS. The log file is the product.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors