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

fselect

$ fselect 社区开源 低风险
jhspetersson · 文件检索与编辑 · MIT OR Apache-2.0 · macos / linux / windows

fselect 通过类似 SQL 的 SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT ... INTO json 语法检索文件系统。它在一个严格只读的 Rust CLI 中支持文件大小、时间戳、权限、哈希、EXIF/媒体属性以及 .gitignore 过滤。

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

fselect ... into json 单条命令即可在本地完成元数据、哈希与 EXIF 查询,无需 MCP 服务。

Agent 友好度体检单

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

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

FCRS-1.0 六维评分拆解

Agent 友好度 22 / 25

支持 into json、SQL 列投影(field_filtering)、limit 限制与非交互执行。

  • Native into json output formatter and SQL select/where/limit projection
安全与权限边界 24 / 25

严格只读的 SQL 查询引擎,不提供 -delete 或 -exec 等修改动作。

  • Read-only filesystem metadata and content inspection
安装与运行摩擦 14 / 15

静态 Rust 二进制,可通过 brew install fselect、cargo install fselect 与 GitHub Releases 安装。

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

将 find、stat、sha256、归档读取与媒体/EXIF 字段整合为一条声明式查询。

  • Rich built-in functions (sha256, line_count, width, duration)
维护与来源背书 8 / 10

社区活跃维护的 Rust 项目(jhspetersson/fselect),采用 MIT/Apache-2.0 双许可。

  • Consistent updates on GitHub
文档与可验证性 8 / 10

仓库中的 docs/usage.md 详细记录了可用字段、函数与 into json 用法。

  • Detailed SQL syntax and field docs in repository

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

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

无需凭据;本地只读文件系统查询工具。

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

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

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# fselect Agent Rules
- Always append `limit <N> into json` to queries so results stay bounded and machine-parseable.
- Add `depth <= <N>` or `gitignore` when scanning large trees to avoid traversing `node_modules` or `target`.

Agent 高频安全命令配方

只读查询(安全推荐)

以 JSON 查找体积最大的 Rust 源文件
fselect "path, size, modified from . where ext = 'rs' order by size desc limit 20 into json"

按文件大小降序检索 .rs 文件,并通过 into json 输出结构化 JSON 数组。

遵循 .gitignore 查找近期修改的文件
fselect "path, hsize from . gitignore where is_file = true and modified >= '2026-01-01' limit 50 into json"

利用 gitignore 关键字过滤文件,并以 JSON 返回人类可读体积字段(hsize)。

核心优势

  • + 声明式字段投影配合 into json 可精准返回所需文件属性。
  • + 严格只读,不像 find 那样存在 -delete 或 -exec 误操作风险。

注意事项与踩坑点

  • ! 除非在根路径后显式添加 gitignore 关键字,否则默认不会跳过 .gitignore 中的目录。
  • ! 若缺少 depth 或 limit 限制,调用 sha256 等高开销函数可能较慢。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI