fselect
$ fselect 社区开源 低风险fselect 通过类似 SQL 的 SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT ... INTO json 语法检索文件系统。它在一个严格只读的 Rust CLI 中支持文件大小、时间戳、权限、哈希、EXIF/媒体属性以及 .gitignore 过滤。
brew install fselect fselect ... into json 单条命令即可在本地完成元数据、哈希与 EXIF 查询,无需 MCP 服务。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
支持 into json、SQL 列投影(field_filtering)、limit 限制与非交互执行。
- Native
into jsonoutput formatter and SQLselect/where/limitprojection
严格只读的 SQL 查询引擎,不提供 -delete 或 -exec 等修改动作。
- Read-only filesystem metadata and content inspection
静态 Rust 二进制,可通过 brew install fselect、cargo install fselect 与 GitHub Releases 安装。
- Cross-platform binary for macOS, Linux, and Windows
将 find、stat、sha256、归档读取与媒体/EXIF 字段整合为一条声明式查询。
- Rich built-in functions (
sha256,line_count,width,duration)
社区活跃维护的 Rust 项目(jhspetersson/fselect),采用 MIT/Apache-2.0 双许可。
- Consistent updates on GitHub
仓库中的 docs/usage.md 详细记录了可用字段、函数与 into json 用法。
- Detailed SQL syntax and field docs in repository
安全边界、鉴权与放权指南
无需凭据;本地只读文件系统查询工具。
100% 免费、离线、开源(MIT OR Apache-2.0)。
# 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 高频安全命令配方
只读查询(安全推荐)
fselect "path, size, modified from . where ext = 'rs' order by size desc limit 20 into json"
按文件大小降序检索 .rs 文件,并通过 into json 输出结构化 JSON 数组。
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等高开销函数可能较慢。