- Home
- Plugins
- Tools & Capabilities
- dsh-find-project
dsh-find-project
fansal/dsh-find-project
An opt-in agent tool that identifies the current project and searches GitHub for similar repositories, returning a comparison brief with README excerpts and top issues plus a four-part improvement report.
Install
dsh plugin --profile web add github:fansal/dsh-find-projectREADME
dsh-find-project
DSH 插件:一键识别当前会话的项目,自动在 GitHub 上找同类开源项目。
在会话输入框(composer dock)右侧会出现「找项目」开关——它是 agent 工具的开关(默认关闭):
开启后对话里的 agent 可直接调用 find_similar_repos,为任意项目目录搜索同类开源项目,
并把结果整理成与本项目逐条对比的中文报告(功能差距 / 踩坑预警 / 架构借鉴 / 改进建议)。
搜索前会先给项目归类(dsh 插件 / skill / 应用 / 未归类),再按分类选数据源:插件与 skill 查 DSH 插件目录、
应用查 npm registry、其余走 GitHub,分类源没命中才回落 GitHub。
搜索能力也以 Host API 的形式开放(POST /api/dsh-find/analyze 支持 limit / sort 逐调用覆盖,
sort 可取 relevance / stars / updated)。
界面文案中英双语(跟随 DSH 语言设置)。英文 quickstart 见下方 English。
早期版本提供过带结果列表的面板 UI(排序切换 / 加载更多 / 卡片对比按钮)与「对比咨询」报告链路。 这些入口与代码已先后移除(m07454 删面板入口、m09357 删对比链路),现在唯一的交互入口是 对话里的 agent 工具与 Host API。
English
A DSH plugin that identifies the project in your current session and finds similar open-source repositories on GitHub in one click.
Quick start
Or just tell DSH: "install the dsh-find-project plugin from https://github.com/Fansal/dsh-find-project, then restart" (experimental — fall back to the manual steps below if the model can't complete it).
-
Register the plugin in your DSH profile's
package.json(e.g.C:\Users\<you>\.dsh\profiles\desktop\package.json):{ "dependencies": { "dsh-find-project": "file:D:/path/to/dsh-find-project" }, "dsh": { "profile": { "bundles": ["dsh-find-project"] } } } -
Run
npm installin the profile directory, then restart DSH. -
Open a session inside a project; flip the 「找项目」/ "Find projects" toggle next to the composer to enable the agent tool (off by default).
-
Configure under DSH Settings → dsh-find-projects (GitHub token, proxy, LLM enhancement, result count/order, scoring weights, filters).
Highlights
- Relevance 0-100 shown next to ⭐ stars, driven by tunable scoring weights.
- Host API (
POST /api/dsh-find/analyze): per-calllimit/sortoverrides (relevance/stars/updated), no UI needed. - Bilingual UI (English / 中文) following the DSH language setting.
- Agent tool
find_similar_repos(opt-in): when enabled in settings, the conversation agent can call the tool for any local project directory. The output is a comparison brief — your project's profile, the ranked candidates, and README + top-issue evidence for the top 2 — and the agent turns it into a four-part Chinese report for you: 功能差距 / 踩坑预警 / 架构借鉴 / 改进建议. Off by default; the switch takes effect immediately. - Category-routed sources: before searching, the project is classified as dsh-plugin / skill / app / unknown and the category picks where to look — dsh plugins and skills in the DSH plugin catalog (no auth, no rate limit, 12h disk cache), apps in the npm registry (ranked by monthly downloads, framework repos demoted so real apps surface), unknown projects on GitHub. A category source that misses falls back to GitHub, and the brief names the sources it tried.
- Per-turn auto trigger: while the agent tool is on, the plugin appends one reminder per turn so the agent calls it for the current project without being asked. Turn the setting off and the reminders stop at once — no restart, and unrelated turns can still be skipped by the model.
- Cached and rate-limit aware: the agent tool shares the 10-minute result cache, and a
rate-limited GitHub response either waits out a short
Retry-Afteror reports 「(限流,约 N 秒后恢复)」 instead of blocking. - Chinese summaries generated by the current session model (falls back to the repo description; click a summary row to expand the original).
- Heuristic project detection with a child-directory fallback: if the session directory has no
package.json/ README / git remote, a real project one level down is adopted automatically. - Weighted, CJK-aware keyword extraction — one shared tokenizer feeds both the search
queries and the relevance scorer, so Chinese descriptions match instead of being dropped,
and keywords are ranked by source (
name>keywords>description). - Gradient queries — because GitHub search is AND semantics, one long query matches
nothing: the plugin sends up to 5 queries from precise (
name+ description words) to a wide fallback (top 2 keywords, nolanguage:qualifier), with duplicates removed. - Host-side GitHub proxy: the token never reaches the browser (devtools); search goes through
/api/dsh-find/analyzeon the DSH web server. - Results cached 10 minutes per (path + config); changing any setting invalidates the cache.
Configuration
Config file: ~/.dsh/dsh-find.config.json (edited from the settings page):
| Field | Meaning |
|---|---|
token | GitHub PAT (optional). Anonymous quota is low; a token is recommended |
proxy | Outbound proxy, e.g. http://127.0.0.1:7890 (undici ProxyAgent) |
tlsAllowUnauthorized | Skip HTTPS certificate verification (corporate MITM networks) |
llm.mode | 'dsh' (default) or 'openai'; dsh reuses the session model |
llm.baseUrl / llm.apiKey / llm.model | OpenAI-compatible endpoint for query refinement / reranking |
limit | Results per round, default 10, max 50 |
sort | Default result order: relevance / stars / updated |
scoring.weights | language(25) / keywordPerHit(5) / keywordCap(45) / stars(20) / recent(10) |
filters.minStars / excludeForks / excludeArchived / languages | Result filters |
agentTool.enabled | Conversation-agent tool find_similar_repos (default off; effective immediately, no restart) |
安装
方式零:一句话安装(实验性)
对 DSH 直接说:
「帮我安装 dsh-find-project 插件,从 GitHub 仓库 https://github.com/Fansal/dsh-find-project 装,装完重启。」
模型会去执行 dsh plugin --profile <你的 profile> add https://github.com/Fansal/dsh-find-project。安装话术未必一次成功(模型可能追问 profile 名,或先去插件市场里搜)——不行就退回下面的手动方式。
方式一:本地目录(开发/自用)
把本仓库放到任意位置,然后在 DSH profile 的 package.json
(如 C:\Users\<you>\.dsh\profiles\desktop\package.json)注册:
{
"dependencies": {
"dsh-find-project": "file:D:/path/to/dsh-find-project"
},
"dsh": {
"profile": {
"bundles": ["dsh-find-project"]
}
}
}
然后在 profile 目录里执行 npm install,再重启 DSH。
方式二:从 git 仓库安装
cd C:\Users\<you>\.dsh\profiles\desktop
npm install github:<your-account>/dsh-find-project
再把 "dsh-find-project" 加进 profile package.json 的 dsh.profile.bundles 数组,重启 DSH。
更新插件代码(重要)
file: 依赖在安装时会被复制进 profile 的 node_modules(不是符号链接)——
之后改本仓库代码不会自动生效。每次改完代码要重新同步:
robocopy "D:\path\to\dsh-find" ^
"C:\Users\<you>\.dsh\profiles\desktop\node_modules\dsh-find-project" ^
/MIR /XD node_modules test .git
同步后重启 DSH Desktop(client bundle 有内容哈希 rev 缓存,host 端插件也只在启动时加载)。
使用
- 打开一个项目里的会话(cwd 即项目根更准)。
- 把输入框旁的「找项目」开关打开(默认关闭)——之后在对话里让 agent「找同类项目」或「和同类项目对比一下、我该改什么」即可,它会调用
find_similar_repos并输出中文对比报告(功能差距 / 踩坑预警 / 架构借鉴 / 改进建议),也可显式指定目录。 - 除了对话,也可以直接调 Host API:
POST /api/dsh-find/analyze(body{ path, limit?, sort? })拿结果列表。 - 配置在 DSH 设置 → dsh-find-projects 页面填写(token / 代理 / LLM / 结果数量与排序 / 评分权重 / 结果过滤,分组展示,带当前值回显)。
结果说明:
- 相关度 0-100:按当前评分权重归一化(调整权重后重新搜索即更新)。语言分按扩展名/依赖推断,短名(
js)会自动映射成 GitHub 全名(JavaScript)。 - 中文简介:摘要由会话当前使用的模型自动生成中文简介(无需配置;会话模型不可用时自动回退为仓库原文摘要;点摘要行可展开查看英文原文)。
- 搜索词怎么来:先把项目意图(name / keywords / description / language / deps)分词成关键词——同一套分词器也用于打分,所以中文描述能参与匹配;关键词按来源加权(项目名 ×3 > keywords ×2 > 描述 ×1)取前 8 个。因为 GitHub 搜索是 AND 语义,一条 query 塞满关键词必然 0 命中,所以最多发 5 条精度递减的查询:① 项目名 + 4 个描述实词 → ② 仅项目名(工作马)→ ③ 关键词 3 个一组(
in:description,topics,最多 2 组)→ ④ 前两个关键词的宽查询(去掉language:限定,接住写在别的语言里的同类)→ ⑤ 依赖共现(in:readme,超上限时先丢)。 - Agent 工具:设置页「Agent 工具」开关(或输入框旁的「找项目」快捷开关)打开后,对话里的 agent 可以直接调用
find_similar_repos工具——传{ path, keywords?, limit?, evidence? }为任意本地项目目录搜同类 GitHub 仓库。输出不是单纯的列表,而是对比简报:先给「本项目」画像(描述 / 关键词 / 主要依赖 / 仓库 / 实际识别目录),再列同类候选(星数 / 相关度 / 语言 / 更新 / topics / 链接),并为前 2 个候选各拉一段 README 摘要与高频 issue 作证据;末尾附固定四节模板,agent 据此输出中文报告——功能差距 / 踩坑预警 / 架构借鉴 / 改进建议(每条先结论后依据,证据不足要明说)。agent 自带的关键词会替换启发式提取(适合 agent 比插件更懂项目语境的场景)。材料请求(evidence)在配置了 GitHub token 时默认开启(完整调用约 9 次 GitHub 请求),匿名(无 token)时默认只要列表(约 5 次),可用evidence: true/false显式覆盖;结果上限 20 条(默认 8);开关默认关闭,打开即时生效、无需重启。打开后每轮对话开始时会自动提醒 agent 调用一次(关掉即刻停止),因此不必每次手动说「找同类项目」。 - 按分类选数据源:搜索前先给项目归类——
dsh-plugin(有cordis.patch.yml/package.json的dsh字段 /@deepseek-ai/*依赖 / dsh 关键词)、skill(SKILL.md、skills/)、app(electron / tauri / react-native / expo 等应用依赖、bin、应用外壳)、其余为unknown。分类决定去哪找:dsh 插件与 skill 都走 DSH 插件目录(dsh-plugin-catalog,无需 token、无 GitHub 限流,本地缓存 12 小时;目录里有 221 条 skill 类条目)、应用走 npm registry 搜索(按月下载量排序,框架自身的仓库会被降权、同一仓库的多个平台包会合并,好让真实应用浮上来)、未归类仍走 GitHub。分类数据源没命中(或不可用)会回落到 GitHub,报告里会写明「分类 / 依据 / 数据源 / 依次尝试了哪些」。插件目录与 npm 的条目没有 README/issue,报告会用「材料说明」明确讲清,而不是假装有证据;这些条目会附带安装命令与下载量。目录与 npm 的匹配都按词的信息量(IDF)加权,常见词不会靠出现次数压过特征词。
配置
配置文件:~/.dsh/dsh-find.config.json。在 DSH 设置 → dsh-find-projects 页面填写(带当前值回显):
| 字段 | 说明 |
|---|---|
token | GitHub PAT(可选)。匿名额度低,建议配置 |
proxy | 出网代理(可选),如 http://127.0.0.1:7890;走 undici ProxyAgent |
tlsAllowUnauthorized | true 时跳过 HTTPS 证书校验。仅当报「证书校验失败」(本机防火墙/杀软 HTTPS 拦截重签证书,Node 不认 Windows 证书库)且信任该网络时开启;更彻底的系统级修法是设环境变量 NODE_USE_SYSTEM_CA=1 后重启 DSH |
llm.mode | 'dsh'(默认)或 'openai';'dsh' 时复用会话模型生成中文简介 |
llm.baseUrl | OpenAI 兼容端点,如 https://api.deepseek.com |
llm.apiKey | 端点 API key |
llm.model | 模型名,如 deepseek-chat |
scoring.weights | 评分权重(可调):language(25) / keywordPerHit(5) / keywordCap(45) / stars(20) / recent(10),缺省用括号内默认 |
limit | 单轮结果数(默认 10,上限 50);也可在 analyze 请求里逐调用覆盖 |
sort | 默认排序:relevance(相关度)/ stars(星数)/ updated(最近更新);也可逐调用覆盖 |
filters.minStars | 结果过滤:最低星数(默认 0 = 不过滤) |
filters.excludeForks | true 时排除 fork 仓库 |
filters.excludeArchived | true(默认)时排除已归档仓库——滤掉 "Moved to …" 这类已迁移的空壳仓库 |
filters.languages | 语言白名单数组(如 ["JavaScript","TypeScript"]),非空时只保留命中语言 |
agentTool.enabled | Agent 工具开关(默认关)。打开后对话里的 agent 可调用 find_similar_repos,结果展示在对话中,且每轮对话自动触发一次;即时生效无需重启 |
LLM 行为:
mode='openai'(且baseUrl/apiKey/model齐备):用外部端点提炼搜索词 / 重排结果,失败静默回退启发式。mode='dsh'(默认):查询词提炼与结果简介都走会话模型(hostctx.get('llm')+agentDefaultModel)—— 搜索词由会话模型按项目意图提炼(1-3 条英文查询词),结果简介生成中文一句话总结,随会话当前模型变化; 会话模型不可用时静默回退为启发式搜索词 / 仓库原文摘要。- analyze 响应里的
source字段标注搜索词来源:heuristic(启发式)或llm(模型提炼)。
限流说明
匿名调 GitHub search API 很快会撞 403 限流(错误码 rate-limit)。
处理方式:稍后再试,或配置 token(Personal Access Token 公共读权限即可,额度高一个量级)。
token 失效(401)时返回 auth,修正配置即可。
全部搜索请求因网络/代理失败时返回 network(不会再误报「没找到」)。
插件自身也做了一层保护:429 / 5xx 在建议等待 ≤3 秒时会自动重试一次;等待更久(或 403 无任何时间提示)则不阻塞对话,
直接把 retryAfterMs 带进错误里,文案会显示「(限流,约 N 秒后恢复)」。agent 工具与 Host API 共用 10 分钟结果缓存
(按 path + keywords + limit + evidence + 配置快照区分),同一会话重复问不会重复烧配额。
已知限制
- 项目识别基于启发式(package.json → README → git remote)。若当前目录自己没有任何项目标记,
会向下看一层:直接子目录里有项目(含 package.json 或 .git)就按那个子目录识别,结果里
detectedPath会指向那个子目录、nameSource标注child-pkg/child-remote。跳过的子目录:.开头的隐藏目录,以及 node_modules / vendor / dist / build / target / out。再往下不做递归。 - 目录和所有子目录都没有项目标记时,按目录名搜索,并提示「已按目录名「xxx」搜索」。
- 结果缓存 10 分钟(同一项目重复点击直接返回,不重搜不重调模型);改配置自动失效。
- 自动触发每轮注入一条提醒消息,会让该轮多一次工具调用(约 9 次 GitHub 请求,走缓存则更少)。若某轮问题与项目无关,模型可以自行忽略。
开发
npm install
npm test
npm test 跑 node --test(自动发现 test/ 下的 *.test.js,需要 Node 20+)。
真实联网 E2E(可选,会真的调 GitHub API):
node scripts/e2e-manual.mjs [项目目录]
许可证
MIT
Related plugins
archify (deepseek-harness)
tt-a1i/archify
WeKnora (dsh-weknora)
tencent/weknora
next-ai-draw-io (dsh-plugin)
dayuanjiang/next-ai-draw-io
AiToEarn (dsh-plugin-aitoearn)
yikart/aitoearn