Skip to content
flipcyde101Public

About

Mutation-test only the lines your PR changed. Catches hollow AI-written tests in seconds. CLI, MCP server and GitHub Action for TS/JS, Python, Go and Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

killdiff

Zero-config polyglot diff-only mutation tester that catches hollow AI-generated tests in seconds. CLI, stdio MCP server (verify_diff_tests), and GitHub Action with zero runtime dependencies.

License: MIT Node >=24 Zero Dependencies M8ven Score

Watch the 15-second killdiff demo

Watch the 15-second killdiff demo (MP4)


The problem

An AI coding agent hands back a pull request with new code and new tests. The tests pass and coverage looks fine. But a test that runs a line is not a test that checks it: if you flip <= to < in the new code and every test still passes, the tests prove nothing about that line.

killdiff finds those hollow tests. It makes small logic changes (mutants) to only the lines your diff touched, reruns your tests against each one in an isolated copy of the repo, and lists every change your tests failed to notice. Because it only looks at the diff, it finishes in seconds instead of the minutes or hours a whole-repo mutation run takes.

30-second quick start

Needs Node 24 or newer and git. Nothing to configure.

npx killdiff --demo

The demo builds a throwaway git repo with a simulated refund-approval change (src/auth.mjs) and weak tests that pass, then mutates the changed lines. Real output from the v0.1.0 build (Windows 11, Node 24.19; timing varies by machine):

killdiff · range: HEAD~1...HEAD (demo) · 12 mutant(s) · 1.10s
Score: 25% (3 killed, 9 survived, 0 timeout)
  Surviving mutants (tests did not fail when logic broke):
    • SURVIVED [BOUNDARY] src/auth.mjs:3 (<= -> <) | if (amount <= 500 && role === 'support') return true;
    • SURVIVED [EQUALITY] src/auth.mjs:3 (=== -> !==) | if (amount <= 500 && role === 'support') return true;
    • SURVIVED [LOGICAL] src/auth.mjs:3 (&& -> ||) | if (amount <= 500 && role === 'support') return true;
    • SURVIVED [BOOLEAN] src/auth.mjs:3 (true -> false) | if (amount <= 500 && role === 'support') return true;
    • SURVIVED [BOUNDARY] src/auth.mjs:4 (>= -> >) | if (role === 'admin' && amount >= 0) return true;
    • SURVIVED [EQUALITY] src/auth.mjs:4 (=== -> !==) | if (role === 'admin' && amount >= 0) return true;
    • SURVIVED [LOGICAL] src/auth.mjs:4 (&& -> ||) | if (role === 'admin' && amount >= 0) return true;
    • SURVIVED [BOOLEAN] src/auth.mjs:4 (true -> false) | if (role === 'admin' && amount >= 0) return true;
    • SURVIVED [BOOLEAN] src/auth.mjs:5 (false -> true) | return false;

Nine of twelve logic changes went unnoticed, so those tests would not catch a real bug on those lines. The demo repo and its scenario are simulated; the mutation run and the numbers are real.

Then point it at your own branch:

npx killdiff main...HEAD

Install

How Command
Run without installing npx killdiff main...HEAD
Add to a project npm install --save-dev killdiff
Install globally npm install -g killdiff
From source git clone https://github.com/flipcyde101/killdiff && cd killdiff && npm ci && npm run build && node dist/cli.js --help

killdiff has no runtime dependencies. It auto-detects vitest, jest, pytest, go test and cargo test; pass --cmd for anything else.

More examples

# Enforce an 80% mutation score gate in CI with a Markdown PR table
npx killdiff origin/main...HEAD --max 25 --fail-under 80 --markdown

# Output SARIF 2.1.0 for GitHub Code Scanning
npx killdiff main...HEAD --sarif > killdiff.sarif

# Override the test runner explicitly
npx killdiff main...HEAD --cmd "pytest -q"

# Allow a slow suite (80 s baseline) up to 5 minutes per run
npx killdiff main...HEAD --cmd "go test ./..." --timeout 300000

Connect to Your Coding Agent (Stdio MCP)

killdiff mcp exposes verify_diff_tests so Antigravity, Claude Code, Codex, Cursor, and OpenCode can verify their own newly written tests actually kill logic mutations before handing a PR back to you. Arguments: range, testCmd, maxMutants and timeoutMs.

{
  "mcpServers": {
    "killdiff": {
      "command": "npx",
      "args": ["-y", "killdiff", "mcp"]
    }
  }
}

Reusable GitHub Action

- uses: flipcyde101/killdiff@v0.1.1
  with:
    range: origin/main...HEAD
    max-mutants: 25
    fail-under: 80

How killdiff Stays Fast & Safe

  • Diff-only scope: Parses git diff --unified=0 so only executable code on changed lines is mutated (skips test files, comments, strings, imports, and type declarations).
  • Polyglot on Day 1: Mutates TypeScript/JavaScript, Python, Go, and Rust across boundary (>=/>, <=/<), equality (===/!==, ==/!=), logical (&&/||, and/or), boolean (true/false, True/False), and arithmetic (+/-) operators.
  • Isolated parallel sandboxes: killdiff applies mutants only to temporary copies and removes them afterwards, unlinking links without following them. node_modules and .venv are linked. In pnpm projects each sandbox gets its own node_modules structure and pnpm's install-before-run check is turned off, so state files and workspace links stay in the sandbox. Install dependencies before running killdiff.
  • Rust and Maven: target folders next to Cargo.toml or pom.xml are not shared and CARGO_TARGET_DIR always points inside the sandbox. Every sandbox therefore builds from scratch, mutants run one at a time, and large projects may need --timeout.
  • Shared by design: package contents (and, outside pnpm projects, tool caches such as node_modules/.vite) are links to your real install, so a test that writes there, including through a linked workspace package, writes the real files. npm and Yarn workspace packages imported through node_modules resolve to the unmutated originals. In pnpm projects the same applies when a dependency stored in .pnpm (for example a file: plugin with a peer dependency) loads a workspace package: it gets the original, a second copy beside the sandbox one.
  • Baseline & timeout guards: Verifies baseline tests pass before mutating, caps runs with --max 25, and terminates infinite-loop mutants cleanly as TIMEOUT (counted as killed). The baseline limit defaults to 60 s and each mutant gets 2.5x the baseline time; --timeout <ms> replaces both limits, so set it comfortably above your slowest run.

Honest Comparison

Feature killdiff StrykerJS / mutmut cargo-mutants Static AI-slop linters
Languages TS/JS, Python, Go, Rust Single-language silos Rust only Regex/AST heuristics
Config required Zero config (auto-detects runner) Per-project config file Minimal Minimal
Closed-loop agent MCP (verify_diff_tests) Yes No No No
Mathematically proves tests fail on logic bugs Yes Yes Yes No
Where competitors win (Lexical diff-scoped speed) Full compiler-AST mutators across entire repositories Deep Rust compiler integration & AST mutants Instant millisecond feedback without running test suites

Architecture

flowchart LR
    Diff["git diff --unified=0\n(Changed lines only)"] --> Lexer["Comment & String-Aware\nPolyglot Mutator\n(TS/JS · Py · Go · Rust)"]
    Lexer --> Pool["Parallel Isolated Sandboxes\n(junction/symlink deps +\n2.5x baseline timeout)"]
    Pool --> Report["Terminal · Markdown PR · SARIF 2.1.0\n+ Stdio MCP (verify_diff_tests)"]
Loading

Local Agent Reliability Suite

  • kvdiff: Zero-code local proxy pinpointing the exact UTF-8 byte breaking your LLM prompt cache (Anthropic, OpenAI, Gemini/Antigravity, llama.cpp/vLLM).
  • boxcheck: Local DOM geometry, CSS cascade, and layout-collision oracle (CLI + MCP) over raw Node 24 WebSocket CDP.
  • killdiff (this repo): Zero-config polyglot diff-only mutation tester catching hollow AI-generated tests (CLI + MCP + GitHub Action).

Changelog

See CHANGELOG.md.

License

MIT

About

Mutation-test only the lines your PR changed. Catches hollow AI-written tests in seconds. CLI, MCP server and GitHub Action for TS/JS, Python, Go and Rust.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages