nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:PerryLink/dsh-github
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
在 agent 里安全地写 GitHub——每个写操作先经人类审批,token 永不落日志。
把 PR、审查、issue 与 CI 接入 DeepSeek Harness 的主机端插件:15 个工具、4 族命令、后台审查 job、CI 复合动作与状态检查门禁。
安装 · 配置 · FAQ · 简体中文 · English · Español · Português · हिन्दी
dsh plugin --profile <name> add @perrylink/dsh-github
社区插件,与 DeepSeek 官方无关;唯一仓库:https://github.com/PerryLink/dsh-github(Gitee 为镜像)。npm 发布名是 @perrylink/dsh-github,裸名 dsh-github 属于另一个无关项目。项目已迁移到 dsh-github-bot:本仓库保留为索引/备份,旧 npm 包 @perrylink/dsh-github 已弃用,新工作请安装 dsh-github-bot。
dsh-github 把 GitHub 的 PR、审查、issue 与 CI 接进 agent 的回合,同时给每个写操作套上审批笼子:pr_create、pr_merge、review_post、issue_close 这类工具只有在 ctx.approval 得到明确同意后才会落到 GitHub。读侧(PR 元数据、截断 diff、文件、搜索、状态检查)不设审批,直接返回。后台 /review 在 ctx.jobs 上跑确定性多文件分析器,CI 侧另有一套复合动作、轮询审查机器人与状态检查门禁。token 逐操作从 credentials seam、环境变量或 gh CLI 解析,只进 Authorization 头,日志、事件、卡片、命令输出与错误消息里都看不到它。
安装(三选一):
# git 通道(最新 main;等价于 git+https://github.com/PerryLink/dsh-github.git)
dsh plugin --profile web add github:PerryLink/dsh-github
# npm 通道(已发布版本)
dsh plugin --profile web add @perrylink/dsh-github
# tarball 通道:本仓库 pnpm pack 后
dsh plugin --profile web add ./perrylink-dsh-github-<version>.tgz
prepare 脚本只带生产依赖构建,git 通道无需额外准备。
最小配置(默认即可用;token 按需指定来源):
- insert:
- id: dsh-github
name: '@perrylink/dsh-github'
config:
tokenSource: auto
autoCommit: false
tokenSource: auto 会依次尝试 Plugins 页字段 → credentials 文件 → 环境变量 → gh CLI,token 本身不写进这份 YAML。
验证已生效:
dsh --profile web --dump-config | grep -A3 'id: dsh-github'
看到 id: dsh-github 这一行即挂载成功;第一次写操作会走审批。
卸载:dsh plugin --profile web remove @perrylink/dsh-github(或从 profile patch 里删掉该行)。
所有 PerryLink 插件均可在 DSH Desktop 内置市场中浏览:市场 → 来源 → 添加来源 → 粘贴 https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json → 选中。安装仍需通过市场的 npm 身份校验与你的确认。
以下为插件真实入口;安装后调用一个即可。
详细示例 — 命令 pr_create,输入:
{
"title": "feat: shiny",
"body": "desc"
}
输出:
created pull request #7: https://github.com/o/r/pull/7 (main ← feat/shiny)
Observed from plugins/dsh-github/test/tools.test.ts:69-74 (fixture + assertions); renderer at plugins/dsh-github/src/tools.ts:189
失败分支 — 没有任何可用 token 时,输入:
{"title":"x"} (credentials seam empty; GITHUB_TOKEN unset; gh not logged in)
输出:
{
"status": "error",
"code": "no-token",
"message": "no GitHub token found (source: credentials/env/gh)",
"guidance": "Configure one of: 1) a dsh credential for this reference (recommended; $DSH_HOME/.credentials.yaml), 2) the same-named environment variable, or 3) `gh auth login` for the gh CLI. Set `tokenSource` in cordis.yml to pin one source."
}
Observed from plugins/dsh-github/src/credential.ts:96-104; plugins/dsh-github/test/tools.test.ts:88-93
简短示例:pr_merge · gh_review
dsh-github 补上了 dsh 与 Claude Code、Codex 之类工具之间的 GitHub 缺口:agent 能读、审、开、改、合 PR,读仓库元数据与文件,评论与关闭 issue,以及搜索——每个写操作都有人类审批,token 全程保密。
pr_create、pr_merge、pr_update、gh_review、review_post、gh_issue、issue_open、issue_comment、issue_close、gh_search、gh_repo、gh_file、gh_repo_search、gh_checks,全部经 defineTool 返回规范 JSON;ci.enabled 打开时再加一次性 ci_run。/pr create、/review(start / stop / post)、/issue open,以及 ci.enabled 下的 /ci(scan / status / start / stop / run)。review_post 可发布单条汇总评论,或按行锚定 PR head commit 的行级审查评论。ctx.approval(默认 ask,fail-closed);审批理由预览标题、正文长度与评论覆盖内容。gh CLI,逐操作解析,绝不进日志、事件、渲染或错误。/review 跑在 ctx.jobs 上,复用宿主自带 job_list / job_output / job_kill 工具面。Retry-After / x-ratelimit-reset 退避重试 429;读工具并发安全;所有调用尊重取消信号。ci_run 工具、轮询式审查机器人与状态检查门禁(复合动作 action.yml)。| 界面 | 类型 | 说明 |
|---|---|---|
pr_create |
工具 | 创建 pull request(写;审批门控) |
pr_merge |
工具 | 合并 PR(merge / squash / rebase,可选删源分支) |
pr_update |
工具 | 更新 PR(标题 / 正文 / 状态 / 目标分支) |
gh_review |
工具 | 读取 PR:元数据、截断 diff、评论、CI、静态发现 |
review_post |
工具 | 发布审查评论(汇总或行级锚定) |
gh_issue |
工具 | 列出 / 获取 / 评论 issue(PR 标记为 kind: "pr") |
issue_open |
工具 | 创建 issue |
issue_comment |
工具 | 评论 issue 或 PR |
issue_close |
工具 | 关闭 issue(可选关闭原因) |
gh_search |
工具 | 搜索 issue 与 PR(独立搜索配额) |
gh_repo |
工具 | 读取仓库元数据 |
gh_file |
工具 | 按分支 / tag / commit 读取单个文件 |
gh_repo_search |
工具 | GraphQL 仓库搜索(独立搜索配额) |
gh_checks |
工具 | GraphQL PR 状态检查(check runs + commit statuses) |
/pr create |
命令 | 读取 git 状态并排队一条 pr_create 指令 |
/review |
命令 | 启动 / 停止 / 发布后台审查 job |
/issue open |
命令 | 排队一条 issue_open 指令 |
/ci |
命令 | CI 驱动:scan / status / start / stop / run(ci.enabled) |
ci_run |
工具 | 由复合动作 / CI 驱动执行的一次性 CI 审查 |
| 审查机器人 | 界面 | 带幂等行内评论的轮询式审查机器人(ci.*) |
| 状态检查门禁 | 界面 | 按 PR head commit 发布 success / needs-changes 结论(action.yml) |
tokenSource: auto 每次操作按 credentials seam(GITHUB_TOKEN 引用)→ 环境变量 → gh CLI token 的顺序解析。该值只是交给 REST 客户端的局部变量,绝不进入规范值、渲染、卡片、命令输出、注入通知、job 输出、审批理由或错误消息。tools/pre-execute waterfall 监听器对写工具返回 ask,注册表即通过 ctx.approval 询问人类(宿主落 approval/asked + approval/decided 审计对),无应答者时 fail-closed。命令从不直接写:写命令先收集只读上下文,再唤醒 agent,让模型在 turn 内调用受审批门保护的工具。/review <pr> 在 ctx.jobs 上启动 github-review job;job 抓取元数据(记录 head-commit SHA 供行级发布)、截断 diff、CI 检查与既有评论,然后运行确定性多文件分析器(src/review.ts)。该 job 由调用 agent 的裸 SessionId 归属——0.1.7-alpha.1 的注册表以 SessionId 做访问围栏、不再接受 Agent 联合——因此必须组合 dsh-tool-jobs,否则 start 会直接拒绝。reviewMode: "model" 时改为把截断 diff 交给宿主 subagents 接缝的一次性 subagent。完成通知经宿主的 dsh-tool-jobs 消费者送回会话;模型用 job_output 读取、用 review_post 发布。action.yml),负责审查 PR、修复 CI 并产出报告;轮询式审查机器人发布幂等行内评论;状态检查门禁按 PR head commit 发布结论。一次性 ci_run 工具驱动 headless 运行。每个写操作都保持审批门控。所有可调项都是 Schemastery Config 字段(可从 cordis.yml 修改)。以 id 定位的覆盖会替换整行——需要重新声明你所需的每个键。cordis.patch.yml 逐键内联说明。在图形界面中,Plugins 页设置卡(Official 组)从该条目自己的配置表单读取 tokenRef:0.1.7-alpha.1 宿主已删除 ctx.settingsScope 绑定及其背后的命名空间注册缝,卡片因此不再拥有设置命名空间。令牌本身就是该条目的 githubToken 字段:卡片写到这里,宿主半部按「页面字段 → 凭证文件 → 环境变量 → gh」的顺序解析。
最常用键:
| 键 | 默认值 | 含义 |
|---|---|---|
tokenSource |
auto |
auto(页面字段 → credentials → env → gh)或指定 config / credentials / env / gh |
tokenRef |
GITHUB_TOKEN |
credentials seam 引用名 / 环境变量名 |
githubToken |
— | 从插件页保存的令牌;以明文存于 profile 配置,非空时优先使用 |
defaultOwnerRepo |
— | 调用未指定且 git 无 origin 时的兜底 owner/repo |
autoCommit |
false |
/pr create 是否允许指示模型先 commit + push |
maxDiffChars |
8000 |
审查读取 PR diff 的字符数上限 |
reviewMode |
static |
评审引擎:static(确定性分析器)或 model(经宿主 subagents 接缝的一次性 subagent;接缝缺失时响亮失败) |
ci |
{ enabled: false, … } |
CI 集成段:轮询式审查机器人、状态检查门禁与一次性 ci_run 工具(其下为全部 ci.* 子键) |
| 键 | 默认值 | 含义 |
|---|---|---|
tokenSource |
auto |
auto(页面字段 → credentials → env → gh)或指定 config / credentials / env / gh |
tokenRef |
GITHUB_TOKEN |
credentials seam 引用名 / 环境变量名 |
githubToken |
— | 从插件页保存的令牌;以明文存于 profile 配置,非空时优先使用 |
defaultOwnerRepo |
— | 调用未指定且 git 无 origin 时的兜底 owner/repo |
autoCommit |
false |
/pr create 是否允许指示模型先 commit + push |
maxDiffChars |
8000 |
审查读取 PR diff 的字符数上限 |
renderExcerptChars |
2000 |
渲染进工具输出的 diff 摘要字符数上限 |
maxComments |
20 |
gh_review 列出 PR 评论的上限 |
reviewJobTimeoutMs |
600000 |
单个后台审查 job 的截止时间(超时以 timeout 失败) |
maxReviewRecords |
50 |
内存审查 job 记录上限;最旧的已终态记录先淘汰 |
maxFileChars |
12000 |
gh_file 读取文件内容的字符数上限 |
maxFindings |
50 |
每次审查分析器发现数上限 |
maxLineLength |
300 |
行长度超过该值时分析器报超长行发现 |
reviewMode |
static |
评审引擎:static(确定性分析器)或 model(经宿主 subagents 接缝的一次性 subagent;接缝缺失时响亮失败) |
modelReviewProvider |
— | reviewMode: "model" 使用的 subagent provider 名;缺省用第一个注册的 provider |
maxRetries |
3 |
单请求的 429 重试次数 |
retryBaseMs |
500 |
重试退避基数(逐次翻倍) |
retryMaxWaitMs |
60000 |
重试退避上限 |
requestTimeoutMs |
30000 |
单次请求硬超时;超时即中止 fetch |
apiBaseUrl |
https://api.github.com |
GitHub REST 基地址(GitHub Enterprise) |
allowedActions |
pr.create · pr.merge · pr.update · review.post · issue.create · issue.comment · issue.close · ci.run |
写动作白名单;名单外直接拒绝 |
workspaceDir |
进程 cwd | 只读 git 检查的工作目录 |
ci |
{ enabled: false, … } |
CI 集成段:轮询式审查机器人、状态检查门禁与一次性 ci_run 工具(其下为全部 ci.* 子键) |
profile patch 覆盖示例:
- insert:
- id: dsh-github
name: '@perrylink/dsh-github'
config:
tokenSource: auto
tokenRef: GITHUB_TOKEN
autoCommit: false
reviewMode: static
allowedActions: [pr.create, review.post, issue.create, issue.comment, issue.close, pr.merge, pr.update, ci.run]
插件本身不落盘 token:每次操作按 tokenSource 的顺序现取,只放进 Authorization 头,绝不写日志、事件、卡片、命令输出或错误。唯一例外是你主动在 Plugins 页设置卡里保存的 githubToken——它以明文存在 profile 配置里(与 credentials 文件同级的暴露面);配置会共享给别人时请留空,改用凭证引用、环境变量或 gh auth login。审查报告按 job id 只存进程内存,不向磁盘写任何持久数据。
不会。没 token 时工具返回结构化错误,code 为 no-token,并附上三条配置指引;审批服务缺失或没有人应答时,写操作 fail-closed,绝不静默放行。两者都是可见错误,不是“看起来成功”。
不会。工具全部带命名空间,不提供 service key、不注册客户端 slot、不注册 webServer 前缀;共享的 tools/pre-execute 用 ctx.on() 广播监听,每个监听器都经 next() 委托,链条不会被短路。逐条论证见「与其他 DSH 插件的互操作性」。
默认 reviewMode: "static":确定性规则、零 token、可复现,适合绝大多数 PR。reviewMode: "model" 把截断 diff 交给一次性 subagent,会消耗 token,且要求宿主提供 subagents 接缝和已注册 provider,否则加载期响亮失败。
429 按 Retry-After / x-ratelimit-reset 退避重试(maxRetries、retryBaseMs、retryMaxWaitMs 可调),每个请求还有 requestTimeoutMs 硬超时;剩余配额会随每次结果返回,失败时也可见。
ask / deny 决策;沙箱与审批系统仍是执行权威。Authorization 头;从不落日志、渲染、注入或出现在错误中。/pr create 自己从不 commit / push;autoCommit: true 时模型经 bash 工具自身的审批门执行这些写操作。审查 job 零写操作;只有 review_post 在审批后发布。formatPostBody 对 diff 派生的文件名做反引号与 HTML 转义,外部 GitHub 内容(文件、正文、评论、搜索结果)在渲染中被标记为外部内容。network:outbound 与 filesystem:write。tool/result、user/message、command/run、approval/asked…)。命令排队的通知携带插件自己的可合并来源 kind { kind: 'dsh-github', form: 'notice', summary }——宿主没有兜底的 plugin kind,其会话格式准入路径会直接拒绝。src/review.ts),零 token、可复现。reviewMode: "model" 消耗 token,且需要 subagents 接缝与已注册的 provider。maxReviewRecords 上限约束(最旧已终态记录先淘汰)。latest 标签过期 —— 请通过 dsh-base 提供的 profile 闭包安装;不要裸跑 npm i @deepseek-ai/dsh-tools。已对照 DSH 0.2.0-rc.2(本 README 面向的运行时)与 2026-10-05 实测的高星插件集验证。
本插件不干扰其他插件,包括广泛安装的高星插件:
shadows-shipped-ui 座位争抢。webServer 前缀。insert 自己那一行,从不覆写内置行的 config。process.env、不替换全局 fetch dispatcher。共享事件监听器在构造上就不互相干扰。 它用 ctx.on() 监听顺序敏感事件 tools/pre-execute——Cordis 的广播语义:每个监听器都会运行,任何一个都无法饿死其他监听器。此处每个监听器都通过 next() 委托,因此链条绝不会被短路;改写作用在 next() 产出的值上,而不是用它顶替返回:
tools/pre-execute — also used by cc-safety-net (1576★).静态证据:dsh-plugin-doctor 的 K10–K13 在本仓全部为 pass。
| 维度 | 状态 |
|---|---|
| Harness | DeepSeek Harness dsh-v0.2.1-rc.2(2026-10-18 验证):engines.dsh >=0.2.1-0 <0.3.0;P0 兼容路径已有回归测试。 |
| Node | ^22.19.0 \|\| >=24.0.0 |
| 平台 | 全部(host 插件;出站网络访问 GitHub) |
| 模型 | 任意(静态审查是确定性的;reviewMode: "model" 为可选) |
pass)npm i -g dsh1024,再 dsh1024 plugin --profile web add @perrylink/dsh-github(计入 deepseek1024.com 安装排行)pnpm install # node ^22.19 || >=24
pnpm run build # tsc --noEmitOnError → lib/(含 fix-dts 与 client bundle)
pnpm run prepare # 自包含 git 安装构建(scripts/prepare.mjs)
pnpm run prepublishOnly # 发布前构建 + 测试
pnpm test # vitest run
pnpm run typecheck # tsc --noEmit
pnpm run typecheck:ci # 已发布线类型检查
pnpm run check:readmes # 五语 README 的工具与配置键覆盖
lib/ 是提交进仓库的发布产物,pnpm run build 会重新生成它。配图由 scripts/gen-readme-assets.py 程序化生成(Python + Pillow),可重复执行,输出 docs/assets/dsh-github-hero-{zh,en}-{light,dark}.webp 与 docs/assets/dsh-github-flow-v5-{light,dark}.svg。
Topics:dsh · dsh-plugin · deepseek-harness · github · pull-request · code-review · issue-tracker
src/index.ts plugin entry (name/inject/apply, applyWithDeps for tests)
src/config.ts Schemastery Config
src/types.ts local structural views of host services + Context merging
src/credential.ts token resolution (seam → env → gh), per operation
src/github.ts REST client: 429 retry, rate limits, diff media type
src/git.ts read-only git inspection + origin parsing for any API host
src/review.ts deterministic diff analyzer + sanitized comment drafting
src/jobs.ts github-review background job producer (metadata + diff + CI + comments)
src/approval-gate.ts tools/pre-execute ask/deny gate with write previews
src/tools.ts the fourteen model-facing tools
src/ci/ review pipeline, polling bot, one-shot ci_run
src/commands.ts /pr, /review, /issue
src/client.ts browser half: the Plugins settings card
src/present.ts pure UI-card presenters
test/ vitest suite + mock host scaffolding + opt-in e2e smoke
cordis.patch.yml bundle patch (one insert row)
scripts/prepare.mjs self-contained git-install build
本项目是 PerryLink 维护的 DeepSeek Harness 插件家族成员(全部 Apache-2.0)。如果这个插件帮到了你,给个 star——它不解锁任何功能,但会让下一个人更容易找到它。
lib/client.js 未打进包(#11)。LICENSE(Apache License 2.0)© 2026 dsh-github contributors
Apache-2.0 · 社区插件,与 DeepSeek 无关。
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: ai-agent。