
Regressguard
io.github.Bharath-code由 GitHub 账号 Bharath-code 发布v0.2.4更新于 Oct 24, 2026
Deterministic API regression checks for AI agents: snapshot a baseline, catch broken contracts.
概览
一个本地 MCP 服务器,让 AI 编码代理针对已保存的基线执行确定性的 API 回归检查,并查看哪里出了问题。
- 可以做什么
- 执行回归检查,将当前测试结果、路由状态码和响应结构与记录的基线对比,返回带严重级别和可能原因的结构化结果。读取快速健康状态,涵盖快照时间、路由和钩子状态,不运行测试。结果与命令行工具的 JSON 输出一致,每次工具调用都会写入项目 .regressguard 目录下的仅追加审计日志。
- 适用场景
- 当 AI 代理修改基于 API 的应用、你希望它在交回改动前自行验证时使用;也适合作为提交前或 CI 的关卡,在接口契约被破坏时阻止提交。
- 运行要求
- 以本地进程运行,通过 regressguard mcp serve 命令启动,因此需先安装 regressguard 可执行文件(macOS 或 Linux 安装脚本)。项目需要包含测试命令和开发服务器地址的配置文件,且开发服务器应处于运行状态。支持的框架为 Next.js App Router、Express 和 Hono,测试运行器为 Vitest、Jest、Bun 或 npm test。
安装
在 SourceWeft 中
- 打开 控制台中的 Regressguard,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
RegressGuard
Before you commit, know what broke.
When an AI coding agent edits your app it can silently break an API contract — a removed field, a changed status code, a test that now fails — and still report success. RegressGuard records a known-good baseline and tells you (or the agent) exactly what regressed.
It is built to live inside the agent's own loop. RegressGuard ships as an MCP server, so agents like Claude Code and Cursor can verify their own work and self-correct before a human ever sees the diff — zero extra steps. The same engine also runs as a plain CLI for humans and CI.
Break → detect → fix → green. Reproduce it yourself: ./demo/demo.sh.
Install
macOS / Linux (recommended)
Verify
Upgrading from v0.1.x? The binary was renamed from
rgtoregressguardbecausergcollides with ripgrep. There is norgshim and the oldrg upgradecan't fetch v0.2.0: re-run the installer, delete the oldrg, then runregressguard hook install(old hooks callrg;regressguard doctorflags them).
Quickstart (3 minutes)
1. Initialize your project
RegressGuard detects your test command, framework, and dev server URL automatically.
2. Record the baseline before your AI session
Make sure your dev server is running, then:
Output:
3. Run your AI agent
Let Claude Code, Cursor, or Codex make its changes.
4. Check for regressions before committing
Clean — safe to commit:
Regression found — commit blocked:
Exit code 1 on critical — works with git hooks and CI.
Git Hook (auto-protect every commit)
Now regressguard check runs automatically before every git commit. When a critical regression is detected, the commit is blocked with a compact output:
Bypass with git commit --no-verify only when you accept the risk.
Agent-native verification (MCP)
This is RegressGuard's primary mode. Instead of waiting for a human to run regressguard check, the AI agent calls it as a tool inside its own edit loop — so it catches and fixes regressions it just introduced, before handing the change back to you.
Start the server (stdio transport):
Register with Claude Code:
Register with Cursor (.cursor/mcp.json):
The agent then has two tools:
The baseline is human-owned. Agents get no snapshot tool by default. If they
could re-record the baseline, an agent could accept its own regression
(check fails → snapshot → check passes). You record the baseline with
regressguard snapshot. To let agents re-baseline anyway, set this in
.regressguard/config.json and restart the MCP server:
Tool responses are the same machine-readable payload as regressguard check --json — see docs/json-contract.md. Every tool call is recorded to an append-only audit log under .regressguard/ (tool, status, duration, timestamp).
A typical loop: the agent edits code → calls check → reads the structured findings → fixes the regression → calls check again → only then reports done.
Commands
Run regressguard <command> --help for flags, examples, and exit codes.
Configuration
Config lives in .regressguard/config.json (human-readable, git-ignoreable).
Auth modes: bearer (Authorization header), cookie (Cookie header), or omit for public routes only.
ignoreFields: Fields to exclude from schema comparison — useful for volatile app-specific values like requestId or traceId.
How it works
-
regressguard snapshotruns your test suite and hits each configured route. It records pass/fail counts, HTTP status codes, and a normalized schema hash for each response. -
regressguard checkreruns the same tests and routes, then diffs against the snapshot:- CRITICAL: test suite newly failing, status code changed, response schema changed (e.g. field removed/added/changed)
- WARNING: response time increased >200ms and >50% of baseline
- PASS: everything within acceptable variance
-
Schema comparison automatically normalizes JSON payloads:
- Default Dynamic Keys: Strips 16 common dynamic keys (
id,uuid,token,nonce,timestamp,createdAt,updatedAt,deletedAt,created_at,updated_at,deleted_at,sessionId,accessToken,refreshToken,expiresAt,expires_at) before hashing. - Pattern Detection: Automatically detects ISO-8601 date strings, UUIDs, and JWTs, replacing them with generic type representations (
"date","uuid","token"). - User Customization: Respects custom
ignoreFieldsdefined in config.
This ensures the shape integrity of endpoints remains stable across runs even when database IDs and timestamps change.
- Default Dynamic Keys: Strips 16 common dynamic keys (
-
A route whose only change is a non-blocking WARNING (e.g. a timing regression) is reported on its own line and is not counted in the "Routes: N unchanged" summary or in
summary.passedof--jsonoutput.
Known limitations
These are deliberate trade-offs in v1 — favoring zero false positives over exhaustive detection. They are on the roadmap, not accidental:
- Test identity comparison is best-effort.
regressguard checkrecords failing test names (jest, vitest, bun, go test output) and flags a CRITICAL when a test that passed at baseline starts failing — even if the net failure count is unchanged. When names cannot be parsed from your runner's output (or the baseline predates name recording), it falls back to count comparison: a CRITICAL only when the number of failing tests increases. Pairregressguard checkwith your normal test runner in CI for exhaustive per-test assertions. - Array schemas are inferred from the first element. The schema normalizer represents a JSON array's shape using its first element. If later elements have a different shape (heterogeneous arrays), that divergence is not reflected in the schema hash and will not be flagged.
Exit codes
Scripting and CI
GitHub Action — runs regressguard check on every PR and comments the findings:
On pull requests the action compares against the snapshot committed on the base branch (regressguard check --base origin/main), so a PR that edits .regressguard/snapshot.json to hide a regression still fails. Require a human approval when the baseline changes with a CODEOWNERS rule:
Commit .regressguard/snapshot.json (regressguard init adds .regressguard/* + !.regressguard/snapshot.json to .gitignore); everything else in .regressguard/ stays local.
See action.yml for all inputs (version pinning, working directory, server URL).
Supported stacks (v1)
- Frameworks: Next.js App Router, Express, Hono
- Test runners: Vitest, Jest, Bun test, npm test
- Package managers: npm, pnpm, yarn, bun
- Auth: Bearer token, Cookie header, public routes
Python, FastAPI, and Django support is planned for v2.
Demo fixture
A minimal Next.js API fixture is included in fixtures/nextjs-app for demos and testing. See fixtures/README.md.
Open core
This repo — the CLI and MCP server — is free and MIT, forever. A hosted team layer
(cross-repo dashboard, history retention, compliance export) is scoped in
docs/paid-layer-spec.md. Anything that runs on one machine for
one repo stays free; the paid layer is strictly additive.
Changelog
See CHANGELOG.md for release history.
License
MIT — see LICENSE.
From the same developer as git-scope.
来源:README.md,提交 74a3c1f
工具
0版本历史
5- v0.2.4最新Oct 3, 2026
- v0.2.3Oct 3, 2026
- v0.2.1Oct 1, 2026
- v0.2.0Oct 1, 2026
- v0.1.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分