npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-plugin-local-deep-search

v0.1.0

Published

dsh plugin: multi-round mined deep search over local documents via the local_deep_search tool and /local-research, with agent fan-out and citation-traceable Markdown reports.

Readme

dsh-plugin-local-deep-search

对本地文档做多轮挖词迭代式深度检索,输出带行号、可回溯引用的 Markdown 报告。不联网。

模型回答「我本地/之前写的项目里关于 X 的记录」时,不再只靠 grep 命中一次就作答,而是像 dsh-plugin-deep-scan 那样自动多轮扩词、把散落在几十个文件里的证据收敛成一份报告。

它复用了什么

这个插件不新写搜索内核,两个能力都来自你已有的插件:

| 层 | 来源 | 说明 | |---|---|---| | 全文匹配 | dsh-plugin-transcript-search/src/search.ts:29-54 | 多词 AND + 大小写折叠 + CJK 行裁剪片段 | | 管道骨架 | dsh-plugin-deep-scan/src/deep-scan/pipeline.ts | 轮次编排 + 挖词轮止损判定 | | 排序结构 | dsh-plugin-deep-scan/src/deep-scan/rank.ts | 加权排序与渲染形态 |

差别只在挖掘信号:GitHub 靠 repo 的 topics:[] 计数,本地文档没有这个字段,改用文档频次(doc-spread) —— 一个词出现在越多不同文档里越值钱,重复次数其次。

匹配算法在 src/local-search/matcher.ts 里是按契约复制的(文件头注明了出处行号)。两边行为必须保持一致,否则本插件的检索结果会和 /find 对不上。

用法

命令:

/local-research 沙箱 权限

工具(模型自动调用):

{ "queries": ["sandbox"], "roots": ["C:/notes"], "mineRounds": 2, "topDocs": 10 }
  • queries — 数组,元素内多个词是 AND 关系
  • roots — 要扫描的目录,留空用配置默认(会话工作区)
  • mineRounds — 首轮之后的挖词轮数,默认 2(即最多 3 轮)
  • topDocs — 报告里保留的文档数

完整报告写到 outputDir(默认 %TEMP%/dsh-local-deep-search),聊天里只回摘要 + 路径,避免刷屏。

配置

local-deep-search:
  enabled: true
  roots: []              # 空 = 会话工作区
  mineRounds: 2
  topDocs: 10
  newKeepRatio: 0.3      # 挖词轮新增文档占比低于此值 → 止损
  maxFiles: 2000
  maxLines: 200000
  snippetLimit: 3
  snippetWidth: 200
  outputDir: ''          # 空 = %TEMP%/dsh-local-deep-search

行为约定

  • 中英文都能挖:CJK 无分词,按字符二元组(bigram)切分,所以「深度搜索」能挖出 深度/度搜/搜索
  • 止损:挖词轮新增文档占比 < newKeepRatio 即终止,报告会写明终止原因
  • 截断声明:超出 maxFiles/maxLines 时按修改时间倒序保留,并在报告里显式声明截断数量 —— 不静默丢结果
  • 噪声隔离:package-lock.json / *.lock / *.log 等生成物不进语料;version/false/const 这类结构性词不进挖词候选

开发

pnpm install
pnpm test        # 25 个用例
pnpm run build

Windows 沙箱下 node --test 需加 --experimental-test-isolation=none(子进程 spawn 被限制):

node --test --experimental-test-isolation=none "test/*.test.ts"

安装到 DSH

见 install.ps1。插件需要放在 C:\Users\lenovo\.zcode\workspace\default\ 下才能被 profile 的 link: 依赖解析到。

License

MIT