Sapling
$ sl 官方出品 中风险Meta 开源的可扩展分布式版本控制 CLI(sl),专为超大规模 Monorepo 与堆叠提交工作流打造,并兼容 Git 仓库。除可视化 smartlog 外,还支持机器可读的 -T json 模板与 --noninteractive 无交互模式。
brew install sapling 核心版本控制 CLI;直接调用带 -T json 的 sl 命令比通过 MCP 暴露更精简高效。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
继承自 Mercurial 的 -T json 模板引擎、revset 查询与 --noninteractive 参数,但默认 smartlog/status 输出包含 Unicode 树状字符。
-T jsonprovides structured JSON acrossstatusandlog--noninteractiveprevents blocking prompts
具备完整版本控制变更能力(rebase、hide、push),虽提供 sl undo 本地回退,但写操作缺少全局 --dry-run。
- Supports
sl undofor local history mistakes, but mutates remote/local stacks
支持 macOS、Linux 与 Windows,但二进制体积较大,且多数 CI 默认未像 git 那样预装 sl。
- Available via Homebrew and releases, less ubiquitous than
git
在大规模 Monorepo 中拥有出色的 revset 过滤与堆叠提交体验。
- Revset filtering (
draft(),ancestors()) reduces log inspection scope
Meta 官方开源项目(meta/sapling),持续针对 Monorepo 规模维护迭代。
- First-party Meta engineering tool
sapling-scm.com 与内置 sl help 主题提供了清晰规范的参考文档。
- Official docs and
sl help -v <cmd>reference
安全边界、鉴权与放权指南
复用 Git/SSH 凭证以及 .sl/config 或 ~/.config/sapling/sapling.conf 配置。
Meta 开源的 GPL-2.0 工具,免费使用。
# Sapling (sl) Agent Rules - Always pass `--noninteractive` and `-T json` on read commands (`sl status`, `sl log`). - Avoid interactive commands like `sl commit -i` or `sl histedit` without explicit user oversight. - Pass `-m` on `sl commit` / `sl amend` so an editor is never launched.
Agent 高频安全命令配方
只读查询(安全推荐)
sl status -T json --noninteractive
无提示返回已修改、新增、删除与未跟踪文件的结构化 JSON。
sl log -r 'draft()' -T json --noninteractive
使用 revset 表达式与 JSON 模板列出本地草稿提交列表。
受控写入与预演
sl commit -m "feat: update module" --noninteractive
非交互方式创建提交,避免拉起文本编辑器。
核心优势
- +
-T json配合 revset 表达式(draft()、stack())让 Agent 无需正则即可精确查询提交栈。 - +
--noninteractive与sl undo提升了无头提交流程的可控性。
注意事项与踩坑点
- ! 多数编码 Agent 默认按
git习惯工作,使用sl需在仓库内配置明确规则。 - ! 若未同时传入
--noninteractive与-m,sl commit -i、sl isl等交互模式或编辑器将会阻塞。