DeltaScope 是一个离线优先的 SQL审核工具,支持 MySQL、TiDB、PostgreSQL 的 DDL/DML 上线审核。它返回 blocker、warning、notice 三级结构化结论。支持 CLI、CI 集成、HTTP 服务、Go SDK、MCP 服务五种入口。
$ deltascope audit --sql "ALTER TABLE users DROP COLUMN age;"
Verdict: reject
Statements: 1
Blockers: 1
Statement 1: ALTER TABLE
- [blocker] ddl.alter.drop.column: dropping column "age" is a destructive change
$ deltascope audit --sql "DELETE FROM users;"
Verdict: reject
Statements: 1
Blockers: 1
Statement 1: DELETE
- [blocker] dml.where.require: UPDATE and DELETE statements must include a WHERE clause
# GitHub Actions
- name: Audit SQL migrations
run: |
deltascope audit \
--file ./migrations.sql \
--format github-actions \
--fail-on blocker
# GitLab CI
- name: Audit SQL migrations
run: |
deltascope audit \
--file ./migrations.sql \
--format gitlab-codequality \
--fail-on warning
deltascope audit --file migrations.sqlPOST /v1/audit,启动 deltascope-serverdeltascope.Audit(ctx, req),导入 pkg/deltascopedeltascope-mcp,支持 Claude Code、Codex、Cursor 等 40+ AI 编码工具--dialect mysql|tidb|postgresql 选择方言。reject;如果只有 warning/notice,结论为 review;如果全部通过,结论为 pass。claude mcp add 或 npx launcher 添加。--config 指定。