Bundle
dsh-fff
Fuzzy file finding and indexed content search for DSH: find_files / resolve_file / related_files / fff_grep. Pure-JS path index + subsequence scoring (no native dependencies). Port of pi-fff for the Pi coding agent.
- Source
- sleepinginsummer
- License
- MIT
- Updated
- Updated 7 days ago
Readme
# dsh-fff [](https://www.npmjs.com/package/dsh-fff) 模糊文件查找 + 索引内容搜索——DSH 插件,移植自 Pi Coding Agent 生态的 [pi-fff](https://github.com/denisshepelin/pi-fff)(FFF = fast fuzzy finder)。 ## 功能 | 工具 | 说明 | |---|---| | `find_files` | 模糊路径搜索(**fzf 风格多 token**:空格分隔、每个 token 必须命中;basename 计双倍、目录段计半,连续片段加分),返回排序路径列表 | | `resolve_file` | 模糊引用 → 单个精确路径(并列给出 runner-up,暴露歧义),结果可直接喂给 read/replace | | `related_files` | 相关文件:同 stem(`.test.ts`/`.spec.ts`/实现配对)→ 同目录 → 兄弟目录 | | `fff_grep` | ripgrep 内容搜索(regex/字面量、模糊 scope、glob 过滤),结果按文件分组带计数 | **索引**:纯 JS 递归遍历工作区(`fs.listDir`),跳过 `.git`/`node_modules`/`dist`/`build` 等目录,5 万文件 / 16 层上限;60 秒 TTL 缓存。**零 npm 依赖**(Pi 原版用原生 `@ff-labs/fff-node`,动态插件不能 require npm 包,故纯 JS 重写;中型项目性能足够)。 **内容搜索**:走 `subprocess` 服务调用 ripgrep(`rg --no-heading --line-number`);rg 未安装时给出明确错误并提示使用内置 grep 工具。 ## 安装 ```bash dsh plugin --profile <name> add dsh-fff ``` 安装后重启 DSH,`find_files` / `resolve_file` / `related_files` / `fff_grep` 对所有会话生效(`fff_grep` 需要本机装有 ripgrep)。 ## 开发 ```bash npm test # 15 用例:子序列打分、多 token、basename/目录权重、排序/截断、相关文件、搜索结果分组、静态求值、工具注册 ``` ## 与 pi-fff 的差异 - 无原生索引库:纯 JS 路径索引 + 子序列打分(原版为 C++ FFF 索引 + 后台 watcher); - 无编辑器 `@...` 补全(DSH 聊天输入没有该机制;如需浏览器端文件选择器 UI 可后续加 Client Slot); - `read`/`grep` 工具覆盖不做(DSH 内置工具行为不同,模糊解析通过 `resolve_file`/`fff_grep` 显式提供)。 ## 参考 - [pi-fff (GitHub)](https://github.com/denisshepelin/pi-fff) - [pi-fff (npm)](https://www.npmjs.com/package/pi-fff)
Install
dsh plugin --profile web add github:sleepinginsummer/dsh-fff#c8ff673f40815db31adf4b28d170150f5db09941
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-fff from the hub