trash-cli
$ trash-put 社区开源 中风险trash-cli 通过一组独立命令实现 FreeDesktop.org 回收站规范:trash-put 非交互式地将文件移入回收站,trash-list 查看已删除路径,trash-restore 恢复文件,trash-empty 永久清空。用 trash-put 替代 rm 可让编码 Agent 实现可逆删除。
brew install trash-cli 直接调用 trash-put 即可为 Agent 提供瞬时、可逆的本地文件删除,无需任何 MCP 层。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
trash-put 与 trash-list 可非交互运行并返回清晰退出码,但 trash-list 仅输出纯文本(无 --json),且 trash-restore 默认会交互提示。
trash-putandtrash-listwork headlessly- No
--jsonoutput;trash-restoreis interactive by default
放入回收站的可逆机制远比 rm 安全,但 trash-empty 与 trash-rm 会执行永久删除。
trash-putpreserves recovery path and timestamptrash-emptypermanently deletes trashed items
可通过 brew install trash-cli、pip install trash-cli 或 Linux 发行版仓库轻松安装;不支持原生 Windows。
- Available on PyPI, Homebrew, and Linux repositories
在 Agent 清理工作流中零配置替代 rm,大幅降低误删风险。
- Single-command reversible deletion via
trash-put
长期维护的 GPL-2.0 Python 开源项目(andreafrancia/trash-cli),各大发行版均有收录。
- Stable GitHub repository with distro packaging
README 与各命令的 --help / 手册页清晰覆盖 trash-put、trash-list、trash-restore 与 trash-empty。
- Man pages and README examples for all subcommands
安全边界、鉴权与放权指南
无需凭据;FreeDesktop 回收站元数据写入 ~/.local/share/Trash/。
100% 免费、离线、开源(GPL-2.0)。
# trash-cli Agent Rules - Prefer `trash-put` over `rm` for reversible cleanup. - NEVER run `trash-empty` or `trash-rm` without explicit user approval—they permanently purge files. - Avoid bare `trash-restore` in headless shells since it prompts interactively for a row index.
Agent 高频安全命令配方
只读查询(安全推荐)
trash-list
只读打印 FreeDesktop 回收站目录中的删除时间戳与原始文件路径。
受控写入与预演
trash-put build/old-artifact.tar.gz
将文件移至 ~/.local/share/Trash/,而不是像 rm 那样直接永久解除链接。
核心优势
- +
trash-put为 Agent 提供了非交互、可逆的rm替代方案。 - +
trash-list完整记录删除时间戳与原始文件路径。
注意事项与踩坑点
- !
trash-list不支持--json输出。 - !
trash-restore默认需要交互选择行号;trash-empty会永久删除文件。