@wangjunjian/dsh-github-trending
v0.2.0
Published
DeepSeek Harness bundle plugin that exposes a github_trending tool backed by https://github.com/trending
Maintainers
Readme
@wangjunjian/dsh-github-trending
中文 | English
一个 DeepSeek Harness bundle 插件:暴露一个基于 https://github.com/trending
的 github_trending 工具,并在 web profile 中提供一个右侧趋势面板。
功能
插件注册了一个面向模型的工具 github_trending:抓取公开的 GitHub
Trending 页面(按语言和时间窗口),返回结构化的热门仓库列表。
每条结果包含:
rank— 页面上的排名(从 1 开始)owner/name/fullNameurl— 仓库的完整 GitHub URLdescription— 仓库简介language— 主要编程语言stars— 总 star 数forks— fork 数starsToday— 今天(或本周/本月)新增的 star 数
在 web profile 下,插件还会在浏览器 UI 右侧渲染一个可停靠的趋势面板
(daily/weekly/monthly 标签页、可拖拽调宽、可折叠为窄条),数据来自宿主侧
内存缓存,通过 /github-trending HTTP 路由提供。
仓库概览(可选,依赖 LLM)
开启 overviewsEnabled 后,每次缓存刷新成功都会异步抓取排名靠前仓库的
README,并调用 harness 的 LLM 生成一段简短的本地化概览。生成是串行的
(同时只进行一次 LLM 调用),从面板当前查看窗口的第一个仓库开始依次进行;
等待中的卡片会显示"生成中"标志,概览生成后替换仓库的原始简介。点击卡片的
概览区域会弹出宽幅对话框,展示统一结构化(一句话定位 / 它是什么 /
解决什么 / 怎么用 / 该不该关注)的完整 Markdown 项目介绍——按需生成并
缓存在内存中。
github_trending 工具的输出不受影响。概览与介绍都会消耗 LLM token——因此
默认关闭。生成失败会在 host 端记录日志,并在下一轮刷新时重试。
安装
将插件安装到某个 DeepSeek Harness profile,不会修改 deepseek-harness
仓库本身:
# 从本地检出目录安装
dsh plugin --profile headless add /Users/junjian/GitHub/wang-junjian/dsh-github-trending
# 或从 npm registry 安装
dsh plugin --profile headless add @wangjunjian/dsh-github-trending使用 --profile web 可同时获得浏览器 UI 中的趋势面板。安装后 bundle 会
自动追加到 dsh.profile.bundles。
使用
直接向 agent 提问即可:
列出今天 trending 的 Python 仓库。工具参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| language | string | 否 | 语言过滤,如 python、typescript、go。 |
| since | string | 否 | daily(默认)、weekly 或 monthly。 |
| maxResults | integer | 否 | 返回的仓库数量上限(默认 10,硬上限 25)。 |
Cordis 配置
bundle patch 默认插入一行配置。可在 profile 的 cordis.patch.yml 中覆盖:
- id: github-trending
config:
enabled: true
timeoutMs: 30000
maxResults: 10
refreshIntervalMs: 14400000
overviewsEnabled: false| 字段 | 默认值 | 说明 |
|---|---|---|
| enabled | true | 是否注册工具、缓存与 web 路由。 |
| timeoutMs | 30000 | 每次 HTTP 请求的协作式超时预算(毫秒)。 |
| maxResults | 10 | 工具返回仓库数上限(最大会被钳制到 25)。 |
| refreshIntervalMs | 14400000 | UI 缓存的后台刷新间隔(毫秒,4 小时)。 |
| overviewsEnabled | false | 每次刷新后生成基于 README 的 LLM 概览。 |
| overviewsLanguage | zh | 概览语言:zh 或 en。 |
| overviewsMaxRepos | 10 | 每个窗口只为前 N 个仓库生成概览。 |
| overviewsProvider / overviewsModel | — | 可选的 LLM 路由覆盖(必须成对配置);默认跟随 harness 默认模型选择。 |
| overviewsMaxTokens | 2048 | 单次概览调用的输出 token 上限(推理模型需要预留思考 token)。 |
| overviewsTimeoutMs | 60000 | 单次 README 抓取或 LLM 调用的超时(毫秒)。 |
| introsMaxTokens | 4096 | 单次按需生成项目介绍的输出 token 上限。 |
| introsTimeoutMs | 120000 | 单次项目介绍生成的超时(毫秒)。 |
开发
pnpm install # 安装依赖(pnpm 10;prepare 钩子会自动构建)
pnpm run build # tsc -b tsconfig.json && tsdown
pnpm run test # vitest run
pnpm run typecheck # tsc --noEmit
pnpm run lint # biome check .
pnpm run lint:fix # biome check --write .scripts/screenshot_test.py 是手工开发辅助脚本:用本地 Playwright 驱动
浏览器访问 http://127.0.0.1:3080 截取 web 面板效果图;它不属于测试套件,
需要本地安装 Playwright。
已知限制
- GitHub Trending 没有官方 API。解析器针对当前服务端渲染的 HTML 结构, GitHub 改动页面标记时可能需要更新。
- 未认证的请求受 GitHub IP 级速率限制约束。
- 插件直接请求 GitHub,而不是通过
ctx.web,因此不继承 harness web 能力的抓取策略。 - 面板通过
shell.overlay浮于应用之上;DSH 目前尚无原生右侧栏插槽。
