在DeepSeek Harness(DSH)Web UI的composer模式控制(访问模式/计划)后显示当前工作区git分支。仅在工作区…时渲染。
Show the current workspace git branch right after the composer mode controls (access mode / plan) in the DeepSeek Harness (DSH) Web UI. It renders only when the workspace is…
安装
dsh plugin --profile web add github:hanyueqiang/dsh-git-branchGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
English | 中文
在 DeepSeek Harness(DSH)Web 界面的输入框工具行中,紧跟在「模式」控件(访问模式 / Plan 模式)之后, 展示当前工作区的 git 分支。存在 git 仓库时才展示;切换分支后按事件驱动规则自动刷新。
效果位置
输入框工具行布局为:[+ 命令] [访问模式] [Plan] ← 分支 chip。本插件注册到 conversation.input.left
这个「位于常驻模式 chrome 之后」的插槽,因此分支 chip 恰好落在模式控件右侧。
- 分支:
⎇ main - detached HEAD:
⎇ detached @ a1b2c3d - 无 git:不渲染
- 点击 chip:立即刷新(
title有提示)
安装
插件是一个 DSH bundle(自带 cordis.patch.yml),因此 dsh plugin add 会同时完成两件事:
安装依赖 + 把它加入 profile 的 bundles 列表,无需手动改任何配置。一条命令 + 重启即可:
# 从 npm 安装(推荐)
dsh plugin --profile web add dsh-git-branch
# 或本地目录(开发)
dsh plugin --profile web add ./dsh-git-branch
然后重启(或重新进入)该 profile,刷新浏览器页面即可:
# 重启正在运行的 dsh web 后,刷新浏览器页面
原理:本包在
package.json里声明了dsh.bundle.patch = ./cordis.patch.yml,其中- insert一行git-branch插件行;dsh plugin add检测到dsh.bundle后会自动把它加入dsh.profile.bundles, 下次启动时该 patch 层生效,宿主加载 host 半并自动把 client 半下发到浏览器。
可选配置(host)
如需改命令名,在你的 profile 自己的 cordis.patch.yml 里做一次 id 覆盖(id 与 bundle 插入行一致):
- id: git-branch
name: dsh-git-branch
config:
commandName: git-branch # 可选,默认即 git-branch
未知配置键会在加载时报错。
客户端刷新常量
见 src/client/index.tsx(或 lib/client.js)顶部:
POLL_INTERVAL_MS = 60000:慢速兜底轮询;<= 0关闭。
工作原理
- host:
lib/index.js注册/git-branch命令;handler 从session.header.cwd向上查找最近的.git(支持 worktree / submodule),解析HEAD,把结果以 JSON 放进命令text返回。 - client:
lib/client.js注册conversation.input.leftchip,通过ctx.remote.commands.execute拉取分支;并注册conversation.chat.commandview的git-branch键位为null,隐藏传输命令在对话流中的行。
刷新时机(详见 DESIGN.md):挂载 / 会话或工作区切换 → 立即;窗口 focus → 立即;
标签页 visibilitychange→visible → 立即;点击 chip → 立即;60s 轮询 → 兜底。
目录结构
dsh-git-branch/
├── package.json # dsh.bundle + dsh.client 装配 + peerDependencies
├── cordis.patch.yml # bundle patch:插入 git-branch 插件行
├── LICENSE
├── src/
│ ├── index.ts # host 半(TS 源)
│ └── client/index.tsx # client 半(TS 源)
├── lib/
│ ├── index.js # host 半(预构建)
│ ├── index.d.ts
│ ├── client.js # client 半(预构建,window.__ModuleLoader__ 格式)
│ └── client.d.ts
├── DESIGN.md # git 分支刷新规则设计
├── README.md # English(默认)
└── README.zh.md # 中文(本文件)
License
MIT
原始 README: https://github.com/hanyueqiang/dsh-git-branch/blob/main/README.zh.md ↗
同类插件
查看全部 →
k8e
k8e.sh — 开源 Agentic AI 沙箱矩阵

hol-guard
开源AI代理防病毒:运行时拦截风险工具、秘密访问、提示注入、恶意软件包、MCP服务器、插件和技能。

anolisa
ANOLISA(Agentic Nexus Operating Layer & Interface System Architecture):具备运行时、安全性、可观测性和 Tokenless 响应压缩能力的 Agentic OS,可降低 Token 使用量与成本。

mobius
首个自我演进的开源 Agent OS:连接你的团队、AI agent、设备与算力

deepseek-harness-desktop
DeepSeek Harness Tauri 桌面版 | Only 5mb installer, zero environment setup. Windows / macOS / Linux.

open-managed-agents
开源Claude管理代理API实现和自托管Claude标签式代理运行时。即插即用;在Cloudflare Workers/Durable Objects或Node.js上运行。Apache 2.0。