dsh-ci-cd-bot
Verifieddsh-ci-cd-bot · v0.1.0 · MIT · Web UI
DSH Web UI plugin: listens to GitHub issues/PRs across the account's repositories, auto-fixes issues whose repos are checked out locally, and turns PRs / feature requests / other items into a review-and-run queue with one-click agent execution and push.
Install
dsh plugin add dsh-ci-cd-bot Confirm the layer applied with dsh --profile default --dump-config — see the install guide.
Source
Published to npm without a public repository. Inspect the package contents before installing.
Tags
Creators
Readme
dsh-ci-cd-bot
DSH Web UI 插件 —— 自动监听 GitHub 账户仓库的 issue / PR:本地工作区仓库的故障 issue 自动修复并推送,PR、功能添加、非故障事项进入「CI/CD」面板清单,一键选择后自动实现 / 审查 / 推送。
English · 中文
它做什么
| 事项 | 处置 |
|---|---|
| 故障 issue(bug),仓库在本地工作区 | 全自动:agent 在仓库 checkout 中修复并自测 → 插件提交推送(可自动开 PR)→ 回复 issue |
| 功能添加(feature) | 进入面板清单 → 点击「处理」→ agent 实现 → 推送 → 回复 issue |
| 非故障事项(question / 维护) | 进入面板清单 → 有本地 checkout 则实现并推送;否则 agent 起草回复并评论 |
| PR | 进入面板清单 → 点击「审查」→ 拉取 diff → agent 审查 → 按结论自动提交 APPROVE / REQUEST_CHANGES / COMMENT,approve 且可合并时自动合并(可配置) |
每次执行都是真实 agent 会话(保留在会话列表中,可全程查看)。git 分支 / 提交 / 推送由插件统一执行,确定性可控;推送策略可配为「自动」或「面板确认」。
工作原理
宿主半区每 N 分钟(可配置)轮询 GitHub:列出账户仓库 → 按水位增量拉取各仓库近期更新的 issue / PR(首轮只回填最近几天)→ 按标签规则 + 标题/正文关键词分类 → 把仓库匹配到「配置的扫描根目录 ∪ DSH 工作区」下的本地 checkout。新出现的本地 bug 自动入队执行;其余全部进面板清单,等待用户选择。
agent 运行走官方 headless 模式——ctx.agents.create({ meta: { cwd } }) + followup + whenIdle,用会话日志里 turn/end 的 reason 判定成败。agent 只改代码并自测(prompt 明确禁止 git 操作);插件随后执行 fetch → checkout ghbot/#<n>-<slug> → add → commit → push,并回写 GitHub(评论、PR、审查、合并)。
浏览器半区注入侧边栏 CI/CD 入口与中心列面板(通过 dsh-panel-activate 与兄弟面板互斥)。配置存 ~/.dsh/dsh-ci-cd-bot.json(0600)——Token 永不离宿主,设置页经 loopback 防护的 /api/dsh-ghbot/* 路由族读写。
快速开始
DSH 插件安装进 profile(dsh web 对应 web profile)。需要 Node.js ≥ 22 与 dsh 0.1.0-rc.6。
从本仓库安装
git clone https://github.com/bkMoon1024/dsh-ci-cd-bot.git
cd dsh-ci-cd-bot
npm install --ignore-scripts # esbuild 平台二进制经 optionalDependencies 提供,无需 postinstall
npm run build
npm test # 11 个无头行为场景
# 包自带 cordis.patch.yml(通过 dsh.bundle.patch 声明),
# 插件行会自动注册
dsh plugin --profile web add link:$(pwd)
dsh web
从 npm 安装(发布后)
dsh plugin --profile web add dsh-ci-cd-bot
dsh web
手动安装(无需 pnpm / dsh plugin)
ln -sfn "$(pwd)" ~/.dsh/profiles/node_modules/dsh-ci-cd-bot
# 然后在 ~/.dsh/profiles/web/cordis.patch.yml 追加:
# - insert:
# - id: ci-cd-bot
# name: 'dsh-ci-cd-bot'
dsh web
从手动安装切换到
dsh plugin add时,请先删掉手动加的insert条目——包自带的 bundle patch 会注册插件行,重复注册会冲突。
验证与卸载
dsh --profile web --dump-config | grep ci-cd-bot # 确认配置层已挂载
重启后侧边栏出现 CI/CD 入口。首次使用:打开面板 → 设置 → 填入 GitHub Token(repo 权限)、按需配置扫描根目录 → 保存。
dsh plugin --profile web remove dsh-ci-cd-bot # npm / 仓库安装
# 或删除软链 + insert 条目 # 手动安装
dsh web
配置
所有参数都在面板的设置页中调整——无需改文件。保存后立即生效,并持久化到 ~/.dsh/dsh-ci-cd-bot.json。
| 字段 | 默认 | 说明 |
|---|---|---|
| GitHub Token | 空 | GitHub PAT(repo 权限);只在宿主侧使用,绝不下发浏览器 |
| 轮询间隔 (ms) | 300000 |
监听器轮询 GitHub 的频率 |
| 首轮回填窗口(天) | 3 |
首轮只处理该窗口内的开放事项 |
| 扫描根目录 | 空 | 额外扫描的本地根目录(DSH 工作区自动加入) |
| 故障标签 | bug,故障,defect |
判定为 bug 的标签集 |
| 功能标签 | enhancement,feature,需求 |
判定为功能需求的标签集 |
| 本地故障自动修复 | 开 | 本地 checkout 的 bug issue 自动开跑 |
| 推送策略 | auto |
auto 直接推送;confirm 停在面板确认 |
| 修复后自动开 PR | 开 | 推送 ghbot/… 分支并开 PR,而非直接合入 |
| 完成后回复 issue | 开 | 运行结束后评论变更摘要 |
| 审查通过自动合并 | 开 | 审查结论为 approve 时自动 merge |
| 执行并发上限 | 2 |
同时运行的 agent 上限 |
| 单次运行超时 (ms) | 1800000 |
一次运行的最长时间 |
| 启用监听 | 开 | 轮询与执行总开关 |
| 向 agent 通告 | 开 | 系统提示区通告插件,便于会话 agent 协作 |
| 包含/排除仓库 | 空 | owner/repo 过滤(空 = 全部账户仓库) |
技术栈与结构
| 分层 | 选型 |
|---|---|
| 平台 | DSH Web GUI 插件(宿主半区 + 浏览器半区,shipped 形态,不改 dsh 源码) |
| 语言 | TypeScript(宿主半区跑在普通 Node 进程:node 内置、fetch、dsh SDK 包均可直接用) |
| 构建 | esbuild 平台二进制直调 + tsc 声明(node build.mjs) |
| 运行时依赖 | 宿主半区:@deepseek-ai/dsh-agent / dsh-llm / dsh-session(由 dsh 安装解析);浏览器半区:react(平台种子) |
| 存储 | ~/.dsh/dsh-ci-cd-bot.json(配置)+ ~/.dsh/dsh-ci-cd-bot-state.json(条目 / 水位) |
dsh-ci-cd-bot/
├── package.json # 插件清单(dsh.client / dsh.bundle)
├── cordis.patch.yml # profile 补丁层:注册插件行
├── build.mjs # esbuild 构建(浏览器 CJS 包装 + 宿主 ESM)
├── tsconfig.json / tsconfig.build.json
├── src/
│ ├── index.ts # 宿主半区:listener/runner/queue/routes/通告
│ ├── gh.ts # GitHub REST 客户端(fetch、分页、限流退避)
│ ├── listener.ts # 轮询引擎(水位、本地 bug 自动入队)
│ ├── agent-run.ts # ctx.agents.create({meta:{cwd}}) → followup → whenIdle
│ ├── runner.ts # 修复/实现/回复流 + git 收尾 + 推送策略
│ ├── review.ts # PR 审查流(diff → agent → 提交审查 / 合并)
│ ├── routes.ts # /api/dsh-ghbot/*(loopback 防护)
│ └── client/
│ ├── index.ts # 浏览器半区入口
│ ├── sidebar-entry.ts# 侧边栏 DOM 注入(family block 协作约定)
│ ├── board-mount.tsx # 中心列 React 根 + 面板互斥
│ ├── Board.tsx / settings-view.tsx / controller.ts / api.ts
│ └── locales.ts / board.css
├── tests/run.mjs # 11 个无头行为场景
├── lib/ # 构建产物(已提交,可直接链接)
└── docs/ # banner 图 + 设计笔记
已知限制
- 兄弟面板(任务看板、SSH)不认识
ghbot面板事件值:本面板打开时它们内部状态不自关(视觉已互斥,多一次点击即可切回)。 - 分类为纯规则(标签 + 关键词,均可配置);LLM 兜底列为后续项。
- 超时的运行只标记失败,不会中途取消 agent。
- 仅支持 github.com(暂不支持 GitHub Enterprise);面板刷新走轮询而非 SSE。
开发
npm run typecheck # tsc --noEmit
npm run build # lib/client.js + lib/index.js + lib/types
npm test # node tests/run.mjs — 11 个行为场景
源码需兼容 Node 的 strip-only 类型剥离加载器(测试运行器使用):禁止 TS 参数属性(constructor(readonly x))、enum、namespace。
发布
npm run build
npm publish # 发布 dsh-ci-cd-bot(含 bundle 的 cordis.patch.yml)
亦可仿照同类 DSH 插件增加 tag 触发的 CI 流水线(校验版本 → 构建测试 → 发布 → GitHub Release 附构建产物)。
链接
- 仓库: github.com/bkMoon1024/dsh-ci-cd-bot
- DeepSeek Harness: github.com/deepseek-ai/deepseek-harness
License
MIT © bkMoon1024