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

fd

$ fd 社区开源 低风险
sharkdp (OSS) · 文件检索与编辑 · MIT / Apache-2.0 · macos / linux / windows

fd 可并行遍历本地目录树,并在默认情况下自动尊重 .gitignore 与隐藏文件规则。其精简的逐行路径输出、--type / --extension 过滤及 --print0 参数让 Agent 的仓库探索高效且可控。

FCRS-1.0 综合评分
94 /100
极佳 (Excellent)
中置信度 (源码/文档)
零摩擦安装命令
brew install fd
CLI vs MCP 选型建议 优先选 CLI

本地 fd 能在毫秒级列出数千条路径,零 RPC 往返且无 MCP Schema 开销。

Agent 友好度体检单

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

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

FCRS-1.0 六维评分拆解

Agent 友好度 21 / 25

非 TTY 管道下自动剥离 ANSI 色彩,支持 --color never 与 --print0,虽无 --json 但逐行路径输出极为规整。

  • Supports --color never, -0/--print0, and clean non-TTY stdout
安全与权限边界 25 / 25

默认严格只读遍历本地文件,自动跳过 .git 与 .gitignore 条目且无网络请求。

  • Pure local file enumeration; no network or credential access
安装与运行摩擦 15 / 15

单文件 Rust 静态二进制,广泛覆盖 brew、cargo 及主流 Linux/Windows 包管理器。

  • Cross-platform static binary for macOS, Linux, and Windows
能力覆盖与边际价值 15 / 15

凭借智能默认规则和 -e/-t/-d 参数,速度与 Token 效率远超传统 find。

  • Parallel directory traversal with built-in ignore filtering
维护与来源背书 9 / 10

由 sharkdp/fd 长期维护,社区生态成熟稳定。

  • Active OSS repository under MIT / Apache-2.0
文档与可验证性 9 / 10

具备清晰的 --help、man 手册与 README 示例。

  • Comprehensive README and built-in --help documentation

安全边界、鉴权与放权指南

鉴权方式
无需鉴权
凭证存储位置

无需任何凭证;仅对本地可读文件系统路径执行操作。

潜在副作用
只读查询
费用与配额提示

100% 免费、离线且开源(MIT / Apache-2.0)。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# fd Agent Rules
- Always scope searches with `--max-depth` (`-d`) or target subdirectories to avoid flooding context.
- Pass `--color never` (or rely on non-TTY pipe detection) and avoid `-x`/`-X` command execution unless explicitly needed.

Agent 高频安全命令配方

只读查询(安全推荐)

按深度限制列出 TypeScript 源文件
fd -t f -e ts -d 4 --color never src/

返回 src/ 下最多 4 层深度的 .ts 文件,且不附带 ANSI 颜色转义符。

包含隐藏 dotfiles 查找配置文件
fd -H -t f -d 2 '\.ya?ml$' .

通过 -H 纳入隐藏文件,同时继续遵循 .gitignore 排除规则。

核心优势

  • + 毫秒级并行文件检索,自动过滤 .gitignore 与 .git 目录。
  • + 紧凑的 --type、--extension 和 --max-depth 参数有助于控制上下文长度。

注意事项与踩坑点

  • ! 未提供原生 --json 输出,但逐行路径和 --print0 已极易解析。
  • ! 在 Debian/Ubuntu 上包内二进制名为 fdfind,需确认别名或 PATH 映射。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI