← 返回 CLI 目录 抓取的
rsync
$ rsync 社区开源 高风险 Samba / Wayne Davison (OSS) · 文件检索与编辑 · GPL-3.0 · macos / linux / windows
rsync 通过增量差异压缩高效同步本地或 SSH 远端目录。由于源路径末尾斜杠语义以及 --delete 参数极易误删目标文件,Agent 执行前必须先用 --dry-run --itemize-changes 预览。
FCRS-1.0 综合评分
83 /100
良好 (Good)
高置信度 (实测)
零摩擦安装命令
brew install rsync CLI vs MCP 选型建议 仅 CLI 可用
大批量文件增量同步应直接走 rsync 二进制差异流,不适合经由 MCP 序列化传输。
Agent 友好度体检单
本地探针实测证据 — 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
✓ 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
openrsync: protocol version 29
冷启动耗时
4 ms
退出码 (help / 非法参数)
0 / 1
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
usage: rsync [-0468BCDEFHIKLOPRSTWVabcdghiklnopqrtuvxyz] [-e program] [-f filter] [--8-bit-output] [--address=sourceaddr] [--append] [--backup-dir=dir] [--bwlimit=limit] [--cache | --no-cache] [--checksum-seed=NUM] [--chmod=mode] [--compare-dest=dir] [--compress] [--compress-level=NUM] [--contimeout] [--copy-dest=dir] [--copy-unsafe-links] [--del] [--delete-after | --delete-before | --delete-delay | --delete-during] [--delete-excluded] [--delay-updates] [--dirs] [--no-dirs] [--existing] [--exclude=pattern] [--exclude-from=file] [--executability] [--extended-attributes] [--existing] [--files-from=filespec] [--force] [--ignore-errors] [--ignore-existing] [--ignore-non-existing] [--include=pattern] [--include-from=file] [--inplace] [--itemize-changes] [--keep-dirlinks] [--link-dest=dir] [--list-only] [--max-delete=NUM] [--max-size=SIZE] [--min-size=SIZE] [--modify-window=sec] [--no-implied-dirs] [--no-motd] [--numeric-ids] [--out-format=FMT] [--partial] [--partial-dir] [--password-file=pwfile] [--port=portnumber] [--progress] [--protocol=NUM] [--prune-empty-dirs] [--read-batch=file] [--remove-source-files] [--rsync-path=program] [--safe-links] [--size-only] [--sockopts=sockopts] [--specials] [--stats] [--suffix] [--super] [--timeout=seconds] [--only-write-batch=file | --write-batch=file] source ... directory
FCRS-1.0 六维评分拆解
Agent 友好度 18 / 25
支持 --dry-run 与 --itemize-changes,但缺少 --json 输出且受路径末尾斜杠语义影响大。
--dry-run(-n) and--itemize-changes(-i) preview exact file ops
安全与权限边界 17 / 25
一旦误用 --delete 或写错末尾斜杠,可能不可逆地覆盖或清空目标目录。
- High blast radius when
--deleteis combined with wrong path slashes
安装与运行摩擦 14 / 15
macOS 与 Linux 默认预装(macOS 自带 openrsync 略旧,可用 brew install rsync 升级 3.x)。
- Ubiquitous Unix availability;
brew install rsyncprovides modern v3.x
能力覆盖与边际价值 15 / 15
本地及 SSH 目录增量传输的压缩与带宽效率无可替代。
- Industry-standard incremental file synchronization
维护与来源背书 10 / 10
由 Samba/Rsync 项目持续维护数十年的基础工具。
- GPL-3.0 upstream project with multi-decade track record
文档与可验证性 9 / 10
man 手册详尽阐明了路径斜杠、过滤规则与 --itemize-changes 状态码含义。
- Detailed man page and samba.org documentation
安全边界、鉴权与放权指南
鉴权方式
无需鉴权 本地配置文件
凭证存储位置
本地拷贝无需凭证;远端同步依赖 SSH 密钥或 ssh-agent(~/.ssh/)。
潜在副作用
只读查询 本地写入 远端写入 破坏性删除
费用与配额提示
100% 免费、支持离线或 SSH,开源协议 GPL-3.0。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# rsync Agent Rules - ALWAYS run `rsync --dry-run --itemize-changes` before executing any real transfer—especially when using `--delete`. - Double-check trailing slashes on source paths (`src/` copies contents; `src` copies the directory itself).
Agent 高频安全命令配方
只读查询(安全推荐)
只读预览同步与删除计划
rsync -av --dry-run --itemize-changes --delete src/ dest/
使用 -i 逐项列出新建、更新与待删除条目,不改动 dest/。
受控写入与预演
不启用删除的增量镜像同步
rsync -av --itemize-changes --exclude='.git/' src/ dest/
排除 .git/ 并增量复制变更文件,省去 --delete 以防误删数据。
核心优势
- + 一流的
--dry-run+--itemize-changes组合,可精确预览每项待执行操作。 - + 支持本地与 SSH 断点续传级的高效差异同步。
注意事项与踩坑点
- ! 源路径斜杠(
src/与src)及--delete误用会造成目标数据损毁。 - ! 不支持
--json输出;macOS 默认内置旧版openrsync,建议通过brew install rsync升级新版。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI