插件目录 / Knowledge / dsh-git-branch-switcher
dsh-git-branch-switcher
已验证 · 实测可装 mixin-ai
功能简介
DSH网页插件:会话头git分支标签,UI切换分支
可用 — 实测通过,早期项目
DSH网页插件:会话头git分支标签,UI切换分支 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-git-branch-switcher
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
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-git-branch-switcher」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
该插件是 GitHub 源码(未发 npm)——直接从仓库装:
Web profile:
dsh plugin --profile web add github:mixin-ai/dsh-git-branch-switcher Headless(CLI)profile:
dsh plugin --profile headless add github:mixin-ai/dsh-git-branch-switcher 实测报告
验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。
使用场景
给 agent 一套记忆、知识库或检索层,让它不再跨会话丢上下文。
适合谁
跑长项目、想让 agent 记住决策、文档和偏好而不用每次重讲的人。
二次开发建议
记忆/检索后端是缝——插新存储、调蒸馏策略,或加引用与审计轨迹。