CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Sapling

$ sl 官方出品 中风险
Meta · 代码托管与研发协同 · GPL-2.0 · macos / linux / windows

Meta 开源的可扩展分布式版本控制 CLI(sl),专为超大规模 Monorepo 与堆叠提交工作流打造,并兼容 Git 仓库。除可视化 smartlog 外,还支持机器可读的 -T json 模板与 --noninteractive 无交互模式。

FCRS-1.0 综合评分
79 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install sapling
CLI vs MCP 选型建议 仅 CLI 可用

核心版本控制 CLI;直接调用带 -T json 的 sl 命令比通过 MCP 暴露更精简高效。

Agent 友好度体检单

✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 19 / 25

继承自 Mercurial 的 -T json 模板引擎、revset 查询与 --noninteractive 参数,但默认 smartlog/status 输出包含 Unicode 树状字符。

  • -T json provides structured JSON across status and log
  • --noninteractive prevents blocking prompts
安全与权限边界 18 / 25

具备完整版本控制变更能力(rebase、hide、push),虽提供 sl undo 本地回退,但写操作缺少全局 --dry-run。

  • Supports sl undo for local history mistakes, but mutates remote/local stacks
安装与运行摩擦 12 / 15

支持 macOS、Linux 与 Windows,但二进制体积较大,且多数 CI 默认未像 git 那样预装 sl。

  • Available via Homebrew and releases, less ubiquitous than git
能力覆盖与边际价值 13 / 15

在大规模 Monorepo 中拥有出色的 revset 过滤与堆叠提交体验。

  • Revset filtering (draft(), ancestors()) reduces log inspection scope
维护与来源背书 9 / 10

Meta 官方开源项目(meta/sapling),持续针对 Monorepo 规模维护迭代。

  • First-party Meta engineering tool
文档与可验证性 8 / 10

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 工具,免费使用。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# 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 高频安全命令配方

只读查询(安全推荐)

以 JSON 格式检查工作区状态
sl status -T json --noninteractive

无提示返回已修改、新增、删除与未跟踪文件的结构化 JSON。

以 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 等交互模式或编辑器将会阻塞。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI