通过 GitHub App 查询当前仓库未关闭 PR 与最近一次 Actions,不回传密钥。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:173787247/dsh-wsl-github
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
套件安装: 见 dsh-wsl-kit。推荐
KIT_SET=daily|llm|github|full。故障树:TROUBLESHOOTING.zh.md。
DeepSeek Harness 工具:github_app_hint + github_repo_status — 用 GitHub App 鉴权,查看当前仓库未关闭的 PR 与最近一次 Actions。
属于 dsh-wsl-kit。
在套件里的位置
提示 GitHub App 环境文件在不在,并报告仓库 PR / Actions。绝不倾倒密钥。
flowchart LR
agent["dsh agent"] --> gh["dsh-wsl-github"] --> api["GitHub API 状态"]
整套关系图和版本快照:dsh-wsl-kit 中文说明。本插件是 0.2.0(github)。不要把那份总表抄进本 README。
兼容性
| 项 | 值 |
|---|---|
| 插件 | dsh-wsl-github 0.2.0 |
| 最低 dsh | ≥ 0.1.2(Windows 中继 :3081 一次性 ?token=) |
| 最新验证 | 以 dsh-wsl-kit 兼容性 为准(当前 0.2.0-rc.2)— 套件唯一真源 |
| 套件档位 | github / full |
| 云端 Flash | settings / llm-deepseek 使用 deepseek-flash(V4.1 Flash);本插件不配置模型 id |
| Agent Teams | 上游实验包;本插件不依赖 |
套件版本地板:check-plugin-versions.sh。故障树:TROUBLESHOOTING.zh.md。
为什么需要这个插件
WSL 里的 Agent 已有 dsh-wsl-cred(cred_hint)管 git 推送凭据。还需要 GitHub API 回答「开着哪些 PR?」「CI 绿了没?」——并且不要把 PAT 贴进对话。
本插件在内存里换短期 GitHub App installation token。工具输出不含私钥、JWT、token。返回的 html_url 用 dsh-wsl-browser 的 win_open_url 在 Windows 浏览器打开。
刻意做小:不是 40 个工具的通用 GitHub 连接器。
和 dsh-wsl-kit 怎么配合
DSH 在 WSL、聊天在 Windows 浏览器,正是 kit 的主场。连 GitHub 时建议整套一起用:
| 要做的事 | 插件 | 工具 |
|---|---|---|
| 推送 / HTTPS 凭据 | dsh-wsl-cred | cred_hint |
| API:未关闭 PR + 最近 Actions | 本插件 | github_app_hint、github_repo_status |
| 在 Windows 打开 PR / Actions | dsh-wsl-browser | win_open_url |
| 代理 / Node 24 打不通 | dsh-wsl-net | net_doctor |
走 kit 为什么方便
- 跟路径、剪贴板、通知同一套装(
dsh-wsl-kit/install.sh),不用临时塞 PAT。 - 密钥落在
~/.dsh/与进程内存,不进 Trajectory。 - 和 kit 其它插件同一心智模型:小工具、分清 WSL / Windows 边界。
- 有真实的 GitHub App 集成,可报名 GitHub Developer Program。
套件总览:dsh-wsl-kit 中文说明。
工具
| 工具 | 作用 |
|---|---|
github_app_hint |
是否已配置 App / ~/.dsh/dsh-wsl-github.env(只查存在性)、配置步骤与 vs cred/ssh/win_open_url 分工(不回传密钥) |
github_repo_status |
未关闭 PR(最多 5 条)+ 最近一次 Actions。可传 repo,默认 git origin |
配好 env 后可自测 github_app_hint(不做真实 App 冒烟,需用户 PEM)。
端到端用法(WSL)
- 安装插件(随 kit 或单独):
dsh plugin --profile web add github:173787247/dsh-wsl-github
- 一次性注册 GitHub App(权限来自
github-app-manifest.json,已预填):
npm run register-app
在 GitHub 上保留或改名 → 点 Create GitHub App。脚本把 App ID 和 PEM 写到 ~/.dsh/,不会把密钥打到终端。
| 权限 | 访问 | 用途 |
|---|---|---|
| Metadata | 读 | 仓库名、默认分支 |
| Pull requests | 读 | 列出未关闭 PR |
| Actions | 读 | 最近一次 workflow |
| Webhook | 关 | 本插件轮询 API,不收事件 |
| 安装范围 | 私有 App(public: false) |
开发时装到自己的账号 |
把 App 安装到你的 GitHub 账号(脚本打印的 Install 链接,或 apps/dsh-wsl-github)。可选 All repositories,或只勾需要的仓库。
启动
dsh web前加载环境(WSL / bash):
set -a
source "$HOME/.dsh/dsh-wsl-github.env"
set +a
dsh web
若从 Windows PowerShell 启动:
Get-Content "$HOME\.dsh\dsh-wsl-github.env" | ForEach-Object {
if ($_ -match '^(GITHUB_[A-Z_]+)=(.*)$') { Set-Item -Path "Env:$($matches[1])" -Value $matches[2] }
}
开新会话,例如对 Agent 说:
- 「跑一下
github_app_hint。」 - 「对当前仓库跑
github_repo_status。」 - 「用
win_open_url打开那个html_url。」
- 「跑一下
连不上 GitHub HTTPS 时跑 net_doctor;git push 失败时跑 cred_hint——那是另一件事,不是本插件的职责。
不用脚本时:打开 注册 GitHub App,Homepage 填 https://github.com/173787247/dsh-wsl-kit,权限同上、关掉 webhook,生成私钥后:
cp examples/dsh-wsl-github.env.example ~/.dsh/dsh-wsl-github.env
# 编辑填入 GITHUB_APP_ID,PEM 放到 ~/.dsh/dsh-wsl-github.pem
source "$HOME/.dsh/dsh-wsl-github.env"
或手动:
export GITHUB_APP_ID=123456
export GITHUB_APP_PRIVATE_KEY_PATH="$HOME/.dsh/dsh-wsl-github.pem"
GITHUB_TOKEN / GH_TOKEN 只适合本机冒烟,不是正式鉴权。
可选:API 通了之后到 github.com/developer/register 加入 Developer Program(产品网站可填 kit 或本插件仓库地址)。
配置
- id: dsh-wsl-github
name: dsh-wsl-github
config:
timeoutMs: 20000
appId: ""
privateKeyPath: ""
installationId: ""
空字符串表示「从环境变量读」。后写的 profile config 会整段替换。
测试
npm test
许可
MIT
链接
同类插件
6Mikao9/dsh-wsl-workspace★ 81
从 Web GUI 添加 WSL 工作区,无需在 WSL 之中再次安装 dsh 以及相关工具,bash 命令与文件读写运行在本机 WSL 发行版内,Windows 文件仍可访问。
173787247/dsh-wsl-open★ 3
把 DeepSeek Harness 聊天里的 WSL Linux 路径在 Windows 默认程序或资源管理器中打开。
liyu34/dsh-wsl-tray★ 3
为运行在 WSL 的 DSH 提供 Windows 桌面快捷方式和系统托盘启动器:完全隐藏启动,托盘菜单支持打开/重启/退出,插件配置页可管理快捷方式。
173787247/dsh-wsl-env★ 2
向 system prompt 注入 WSL 发行版、Linux 路径映射、/mnt/c 的 CRLF 与 git 注意点,以及 NODE_USE_ENV_PROXY。
173787247/dsh-wsl-net★ 2
提供 net_doctor 工具,报告代理环境、NODE_USE_ENV_PROXY,以及 DeepSeek API 与 npm registry 的连通性,并为 bash 和 npm 子进程设置 NODE_USE_ENV_PROXY。
Edge-Echo/dsh-win-toolkit★ 2
面向 DSH agent 的 Windows 原生工具:剪贴板读写、系统通知、hosts 文件查看与网络诊断,均返回结构化数据(带 UI 卡片),底层为防注入的 PowerShell。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。