dsh-git-branch-switcher
by mixin-ai
DSH Web 插件:会话头部的 Git 分支胶囊——显示该会话工作区当前分支并可就地切换
A DeepSeek Harness (DSH) Web plugin: a Git branch pill in the session header that shows the current branch of the session's workspace and lets you switch branches straight from…
安装
dsh plugin --profile web add github:mixin-ai/dsh-git-branch-switcherGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
English
A DeepSeek Harness (DSH) Web plugin: a Git branch pill in the session header that shows the current branch of the session's workspace and lets you switch branches straight from the UI.
Features
- Shows the current git branch in the top-right session header (only for git-managed workspaces)
- Click the pill to open the branch panel: local branches, current one highlighted with ✓
- Click any branch to
git checkoutit; the pill updates immediately - Detached HEAD support: shows the short commit hash with an explanation
- Auto-refresh every 30s (picks up terminal-side switches) plus a manual refresh button
- Checkout failures (e.g. conflicting local changes) surface git's own error message
- Theme-aware: all colors use the shell's
--dsw-*tokens, light/dark ready - Sandbox-aware: git runs under the same sandbox policy as the session's shell
Install
dsh plugin --profile web add "github:mixin-ai/dsh-git-branch-switcher#main"
Then restart your Web profile:
dsh --profile web
The plugin is now listed under Settings → Plugins and the branch pill appears in the session header.
Alternative (source checkout):
git clone https://github.com/mixin-ai/dsh-git-branch-switcher
dsh web --patch ./dsh-git-branch-switcher/cordis.patch.yml
Usage
- Open a session whose workspace is a git repository.
- The branch pill appears at the top-right of the conversation header.
- Click it → branch list → click a branch to switch.
- The ↻ button re-reads the branch list.
Architecture
| Half | File | What it does |
|---|---|---|
| Host | lib/index.js |
gitBranch Typert Remote service (status / branches / checkout) running git through the shell service with the session's sandbox policy. Plain-JS Remote markers, no generated artifacts (SRC mode). |
| Client | lib/client.js |
Prebuilt __ModuleLoader__ bundle mounting the Remote contribution and rendering the header pill (session-scoped conversation.session.header.utilities slot). |
| Patch | cordis.patch.yml |
Inserts the dual-face plugin row into the Web profile. |
- The workspace directory comes from the session's
cwd(useSessionsstandard slot prop), so it always tracks the open session. - Branch names are single-quote escaped for the shell and control characters are rejected — no command injection.
- All side effects (Remote mount, slot registration, timers, CSS) belong to the plugin fiber and are removed on unload.
Dynamic plugin variant
dynamic/ contains the same feature as an in-session dynamic Cordis Plugin (the form the DSH Web UI's plugin authoring flow runs). See dynamic/README.md.
License
MIT
简体中文
一个 DeepSeek Harness (DSH) Web 插件:在会话头部显示当前项目所在 git 分支的胶囊按钮,点击即可在界面里直接切换分支。
功能
- 在会话头部右上角显示当前 git 分支(仅当项目由 git 管理时出现)
- 点击胶囊弹出分支面板:本地分支列表,当前分支以 ✓ 高亮
- 点击任意分支即执行
git checkout切换,胶囊立即更新 - 支持 detached HEAD:显示短提交哈希并给出说明
- 每 30 秒自动刷新(终端里切了分支也能同步)+ 面板内手动刷新按钮
- 切换失败(例如本地有冲突改动)时显示 git 原始报错
- 颜色全部使用主题
--dsw-*token,自动适配亮/暗主题 - 尊重沙箱策略:git 命令与会话 shell 使用同一套沙箱策略执行
安装
dsh plugin --profile web add "github:mixin-ai/dsh-git-branch-switcher#main"
然后重启 Web profile:
dsh --profile web
插件会出现在「设置 → 插件」中,分支胶囊显示在会话头部。
源码方式(patch 覆盖层):
git clone https://github.com/mixin-ai/dsh-git-branch-switcher
dsh web --patch ./dsh-git-branch-switcher/cordis.patch.yml
使用
- 打开一个工作区为 git 仓库的会话。
- 会话头部右上角出现分支胶囊。
- 点击胶囊 → 分支列表 → 点击分支即可切换。
- ↻ 按钮重新读取分支列表。
架构
| 半边 | 文件 | 职责 |
|---|---|---|
| Host | lib/index.js |
gitBranch Typert Remote 服务(status / branches / checkout),通过 shell 服务执行 git,沿用会话沙箱策略。纯 JS Remote 标记,无生成产物(SRC 模式)。 |
| Client | lib/client.js |
预构建 __ModuleLoader__ bundle:挂载 Remote 贡献并渲染头部胶囊(会话级 conversation.session.header.utilities 插槽)。 |
| Patch | cordis.patch.yml |
将双面插件行插入 Web profile。 |
- 项目目录取自会话的
cwd(useSessions标准插槽属性),始终跟随当前打开的会话。 - 分支名经单引号 shell 转义并拒绝控制字符,不存在命令注入。
- 所有副作用(Remote 挂载、插槽注册、定时器、CSS)都归属插件 fiber,卸载时自动清理。
动态插件版本
dynamic/ 目录提供同功能的内存态动态 Cordis 插件源码(DSH Web UI 插件创作流程所用的形态),见 dynamic/README.md。
许可证
MIT
原始 README: https://github.com/mixin-ai/dsh-git-branch-switcher/blob/main/README.md ↗
同类插件
查看全部 →
dsh-anchored-standard
两阶段 DeepSeek Harness 预设:先 Minimal 对齐的 bootstrap,再切完整 Standard 工具(Project2 98/99)

PicGo-Core
极致的图片上传引擎,CLI 与 API 双支持

awesome-deepseek-harness
DeepSeek Harness(DSH)及其优秀社区插件的精选指南。

awesome-deepseek-harness
DeepSeek Harness (DSH)生态系统:来自dsh-external/hub和公共dsh-plugin主题的精选插件、工具和基础设施。

AI-Novel-Writer
本地优先 AI 小说创作工作台,提供 Windows/macOS 桌面版与 DeepSeek Harness 插件开发预览,支持角色、大纲、章节蓝图、审稿修稿和本地模型。

mcp-for-stata
MCP-for-Stata:把 Stata 集成进你的 agent