mergelock

io.github.sadayamuthu由 GitHub 账号 sadayamuthu 发布v0.1.5更新于 Oct 24, 2026

Finds merge conflicts git can't see between branches: changed signatures vs new callers.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

一个 git 原生的合并门禁,能发现 git 看不到的冲突(如签名变更与新增调用不匹配),并通过 MCP 提供给 AI 助手使用。

可以做什么
  • 在分支合并前比较两个分支,报告 git 不会提示的语义冲突
  • 检测一侧改了函数签名而另一侧新增了旧签名的调用、一侧删除的符号仍被另一侧使用、同一函数被写了两遍
  • 标记普通文本冲突、两个分支在同一路径新增文件、以及一方修改另一方删除的碰撞
  • 对 TypeScript、JavaScript(含 TSX/JSX)和 Python 做语义分析,其他语言仍做文本类检查
  • 输出带严重级别的结果和便于脚本、钩子与 CI 使用的退出码
适用场景
适合 AI 编码助手在将要合并的分支上工作时使用,让它在合并前发现跨分支的破坏,例如在 pre-push 钩子、CI 任务或审查并行分支时。
运行要求
以本地 stdio 进程运行;清单提供 OCI 镜像(ghcr.io/sadayamuthu/mergelock:0.1.5),需挂载仓库,也可通过 Homebrew、deb/rpm、预编译二进制或 Go 1.25+ 加 C 编译器安装。需要 git 2.38 或更新版本以及一个 git 仓库。未声明认证或环境变量。
安装前请注意
它只读取提交,不触碰工作区,属于只读操作。Docker 方式需要把仓库挂载进容器。在 macOS 上,浏览器下载的二进制会被 Gatekeeper 拦截,需清除隔离标记。结果仅供参考,退出码 1 和 2 分别表示警告或冲突。

安装

在 SourceWeft 中

  1. 打开 控制台中的 mergelock,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mergelock

[CI] [Release] [Homebrew] [Docker] [deb/rpm] [MCP Registry] [Glama] [License]

A git-native merge gate. mergelock check compares two branches before they meet and reports the conflicts git itself won't tell you about: a function whose signature changed on one branch while the other branch added calls to the old signature, a symbol deleted on one side but still used on the other, the same function written twice.

[Two agent branches merge cleanly in git; mergelock reports that checkout.ts still calls login() with the old signature]

It never touches your working tree. Everything is computed from commits with git merge-tree and tree-sitter parsers, so it is safe to run in a pre-push hook, in CI, or from an AI coding agent over MCP.

What it detects

RuleReportsSeverity
textualOrdinary git content conflictserror
add_addBoth branches add a file at the same patherror
modify_deleteOne branch edits a file or symbol the other deletes, or still calls a deleted symbolerror
signature_callerA signature changed on one branch; the other adds calls that no longer fiterror
duplicate_definitionBoth branches add the same function, by name or by near-identical bodywarning

Semantic rules understand TypeScript, JavaScript (incl. TSX/JSX) and Python. Files in other languages still get the textual, add/add and modify/delete checks.

Install

mergelock needs git 2.38 or newer (for git merge-tree --write-tree).

Homebrew (macOS and Linux):

sh
brew install sadayamuthu/tap/mergelock

Debian / Ubuntu (.deb, amd64 and arm64; needs a distribution with git 2.38+, such as Debian 12 or Ubuntu 24.04):

sh
VERSION=0.1.5   # latest release, without the vcurl -fLO "https://github.com/sadayamuthu/mergelock/releases/download/v${VERSION}/mergelock_${VERSION}_$(dpkg --print-architecture).deb"sudo apt install "./mergelock_${VERSION}_$(dpkg --print-architecture).deb"

Fedora / RHEL (.rpm, x86_64 and aarch64):

sh
VERSION=0.1.5sudo dnf install "https://github.com/sadayamuthu/mergelock/releases/download/v${VERSION}/mergelock-${VERSION}-1.$(uname -m).rpm"

Docker (linux/amd64 and linux/arm64; mount the repository at /repo):

sh
docker run --rm -v "$PWD":/repo ghcr.io/sadayamuthu/mergelock check my-branch main --format textdocker run -i --rm -v "$PWD":/repo ghcr.io/sadayamuthu/mergelock   # MCP server on stdio

GitHub Actions (checks each pull request against its base branch; see In CI):

yaml
- uses: actions/checkout@v4  with:    fetch-depth: 0- uses: sadayamuthu/mergelock@v0

Prebuilt binary (macOS and Linux, amd64 and arm64): download the archive for your platform from the latest release, then put mergelock on your PATH:

sh
tar -xzf mergelock_*_$(uname -s | tr A-Z a-z)_*.tar.gzsudo mv mergelock /usr/local/bin/

On macOS, a binary from an archive downloaded in a browser is blocked by Gatekeeper because it isn't signed yet (Homebrew installs aren't affected). Clear the quarantine flag once:

sh
xattr -d com.apple.quarantine /usr/local/bin/mergelock

With Go (needs Go 1.25 or newer and a C compiler, since cgo is used for tree-sitter; on macOS install the Xcode command-line tools, on Debian/Ubuntu build-essential):

sh
go install github.com/sadayamuthu/mergelock/cmd/mergelock@latest

Or build from source:

sh
git clone https://github.com/sadayamuthu/mergelock.gitcd mergelockgo build -ldflags "-X main.version=$(git describe --tags --always)" -o mergelock ./cmd/mergelock

Check it works:

sh
mergelock version

Quick start

Run inside any git repository:

sh
# Is my branch safe to merge into main?mergelock check my-feature main
# Compare against the configured target (main by default)mergelock check my-feature
# Will two in-flight branches collide with each other?mergelock check feat-a feat-b --format text

Exit codes make it easy to script:

CodeResult
0clean: no findings
1warnings: only warnings
2conflict: at least one error
3operational error (bad branch name, not a git repo, invalid config…)

See USAGE.md for the full command reference, the .mergelock.yml config, the JSON output schema, CI and git-hook recipes, and how to connect it to an AI agent over MCP. To report a missed conflict or add a language, see CONTRIBUTING.md; for a security problem, see SECURITY.md.

Development

sh
go test ./...          # full suite, incl. fixture gate and 5,000-file perf testgo test -short ./...   # skips the perf testgo vet ./...gofmt -l .

Rule behaviour is pinned by branch-pair fixtures in testdata/fixtures/*.txtar; each one is a tiny repo with a base, two branches and the expected findings.

License

Apache License 2.0

来源:README.md,提交 c816d3c

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v0.1.5最新Oct 17, 2026
  2. v0.1.4Oct 16, 2026
  3. v0.1.3Oct 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分