Skip to content

Releases

MutantGate v1.0.0

Choose a tag to compare

@luckystore1 luckystore1 released this 04 Dec 08:07
f5b3859

Diff-scoped mutation testing for pull requests and coding agents. MutantGate mutates only the lines a pull request changed, reports a mutation score for that diff, and lists the mutants your tests failed to notice. Coverage says a line ran; MutantGate says whether a test would fail if the logic changed.

This is the first tagged release. The package version is 1.0.0; the CLI/Action/MCP interfaces below are what shipped.

What it does

  1. Computes the changed line spans with git diff -U0 against the merge base.
  2. Runs Stryker with --mutate scoped to exactly those spans (src/pricing.ts:5-6), with --incremental for speed.
  3. Re-reads the Stryker JSON report and keeps only the mutants whose whole location falls inside a changed span, using the same comparison Stryker uses for --mutate ranges.
  4. Reports the diff mutation score, the surviving mutants, and (Pro) a PR comment plus a fix prompt for Claude Code / Cursor / Codex.

Highlights

  • Three entry points, one engine: CLI (mutantgate), GitHub Action (action.yml), and an MCP stdio server (mutantgate_scope, mutantgate_scan, mutantgate_fix_prompt) with no runtime dependencies.
  • PR gate that is safe to put in CI: block / warning modes, threshold (default 70%), step outputs (score, detected, undetected, verdict, passed, plan, scope, report paths), step summary, and precise exit codes — 0 pass, 1 below threshold, 2 usage/configuration including a shallow clone with no merge base, 3 infrastructure (only fails the step with fail-on-error: true). A run that could not compute a score does not report green.
  • Configuration: .mutantgate.yml / .mutantgate.json; every key also has an environment variable and a CLI flag, with flags > env > file precedence. Monorepo profiles (per-path thresholds), reportPathPrefix for reports rooted in a subdirectory, and a Team-only policy floor.
  • Stryker compatibility: detects the installed Stryker major version and uses the matching interface — Stryker ≤ 9 (--configFile, --jsonReporterFile) and Stryker 10+ (positional config file, jsonReporter.fileName through a generated overlay config). Tested against 10.1.1.
  • License handling built for CI: Polar license keys are validated, never activated, so CI runs do not consume activations; successful validations are cached for 24 h by SHA-256 hash; if Polar is unreachable the cached plan is used for up to 7 days and then the run degrades to Free with a warning. A license outage never blocks a merge. Self-hosted plans can use offline mg1. Ed25519-signed licenses instead of a key.
  • Agent skill: npx skills add luckystore1/mutantgate installs a skill describing when to scan, how to read the diff score, and what to do with each survivor.

Measured on a real pull request

unjs/defu #111 (fix: only merge plain objects), full write-up with commands and raw output in docs/benchmark-real.md:

Measurement Result
Whole-package Stryker score (same commit) 70.21% (94 mutants)
Diff mutation score on the PR's 19 changed lines 52.9% (34 mutants) — exit 1, verdict weak
After 6 tests written against the survivor list 91.2% — exit 0, verdict pass
Cold diff run / warm incremental run 19 s / 10 s

Stryker alone would have reported 70.21% for the package while the lines this PR added scored 52.9%. That gap is the reason the tool exists. Every number in that document comes from a command that was run; it is one repository, one PR, one test framework (vitest), and the "after" tests were written by us, not by a live agent session.

Plans

Free Solo Pro Team Self-hosted
Price $0 $12/repo/month or $99/repo/year $49/month (5 repos) $299/month
Diff score, threshold gate, exit codes, --mutate-args, MCP scan/scope ✅ ✅ ✅ ✅
PR comment with survivor table, agent fix prompt – ✅ ✅ ✅
Monorepo profiles, policy floor, forced block mode – – ✅ ✅
Air-gapped signed licenses, GitHub Enterprise – – – ✅

Free is a real gate: it fails the build, prints the score, and lists survivors in the log.

Install

# GitHub Action
- uses: luckystore1/mutantgate@v1
  with:
    threshold: '70'
    mode: block
    license-key: ${{ secrets.MUTANTGATE_LICENSE_KEY }}   # optional; Free works without

# CLI (node >= 20.11; no runtime dependencies)
npx mutantgate --base origin/main --threshold 70

# MCP client (Claude Code, Cursor, Codex, …)
claude mcp add mutantgate -- npx -y mutantgate mcp

The package is not published to npm yet, so npx mutantgate currently resolves only for the Action; run the CLI straight from this repository with npx -y github:luckystore1/mutantgate until the npm publish lands. The Action (uses: luckystore1/mutantgate@v1) works as written. StrykerJS is not bundled — install @stryker-mutator/core and a runner in your own repository, and use fetch-depth: 0 in actions/checkout so the merge base is available.

Known limitations

  • A high score is evidence, not proof. Equivalent mutants survive forever; read the survivor list rather than chasing 100%.
  • Only changed lines are mutated, so untouched weak tests stay weak.
  • TypeScript/JavaScript only in this release (via StrykerJS). Python/Go/Java adapters are not shipped.
  • Speed is your suite's speed. A 20-line diff still runs every test that covers those lines.

Details

  • MIT license. MutantGate orchestrates Stryker Mutator (Apache-2.0), which you install yourself; Stryker is not bundled. Third-party notice is in LICENSE.
  • Your code never leaves the runner: MutantGate calls Polar only to validate a license key, and no source, report, or mutant detail is uploaded. The Action needs contents: read and, for comments, pull-requests: write.
  • 143 unit, integration and MCP tests (npm test).
  • Docs: README · real-repository benchmark · agent snippets · agent skill