KHG420/git-worktree

DeepSeek Harness 插件:一键将每条对话绑定到独立的 git worktree 和分支,使并行代理可在同一仓库中工作而互不干扰——每个项目的 worktree 在侧边栏工作区树中自动管理,并由 9 个 git 工具提供支持。

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness (DSH) that enables parallel AI agent work on a single Git repository by binding each conversation to an isolated git worktree and branch. To install, clone the repository to your local machine, then run dsh plugin --profile web add /path/to/dsh-git-worktree from the plugin directory, and restart your DSH web instance to activate both the tools and sidebar UI. It includes a sidebar workspace tree management panel and nine AI-callable Git tools to manage worktrees, branches, and binding status. The binding relationship is derived live from existing session, workspace, and Git data instead of being stored separately, so it always reflects the current state.

The most common workflow starts when you click the plus button next to a project folder in the sidebar, enter a feature name, and select create bound conversation. The plugin automatically runs git worktree add to create a new worktree and matching branch, registers the new workspace with DSH, and opens the new bound conversation immediately. You can also create a new bound conversation in an existing worktree by clicking the plus next to that worktree, which supports workflows where the AI prepares the worktree and you confirm opening the session. This plugin is designed for DSH AI developers who need to work on multiple features or bugfixes at the same time without interfering with each other.

To uninstall, run dsh plugin --profile web remove dsh-git-worktree and restart DSH again. Because Git branch and worktree state is shared and mutable, none of the plugin’s tools are concurrency-safe. A key limitation to note is that binding can only happen when a new session is created, since DSH freezes a session’s working directory at creation, so existing sessions cannot be rebound to a new worktree. The plugin ships with a full test suite that covers tool logic, edge cases, frontend interaction, and full user flows. Tests also check schema conformance for all tool outputs, to ensure stability and simplify ongoing maintenance.

这是一个专为 DeepSeek Harness 开发的原生插件,核心功能是为每个 DSH 会话绑定独立的 Git 工作树与分支,支持多个会话在同一个 Git 仓库上并行开发,互不干扰。插件自带侧边栏工作树管理面板和 9 个可被 AI 代理调用的 Git 工具,绑定关系无需额外存储,由现有会话、工作区和 Git 信息推导得出,始终保持状态实时准确。

典型使用流程是,用户点击侧边栏项目文件夹旁的加号,输入功能名称后点击创建绑定会话,插件会自动创建新分支与对应工作树,注册工作区后直接打开新会话,整个过程一键完成。对于已创建好的工作树,也可以点击工作树旁的加号直接新建绑定会话,满足 AI 先准备工作树、用户再确认开启会话的场景。本插件适合需要同时处理多个功能开发或缺陷修复的 DSH AI 开发用户。

安装需在插件检出目录下执行 dsh plugin add 命令,添加完成后重启 DSH Web 即可生效,卸载可通过 dsh plugin remove 命令完成。由于 Git 分支和工作树是共享可变状态,所有工具都不声明并发安全。绑定只能在创建新会话时完成,已存在的会话无法迁移绑定关系。插件自带完整测试套件,覆盖工具逻辑和用户流程,方便后续维护。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:KHG420/git-worktree

把 KHG420/git-worktree 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-git-worktree

面向 DeepSeek Harness 的 对话 ↔ 工作树绑定 插件:让多个会话在同一项目上并行工作,每个会话绑定一个独立 git 工作树 + 分支,一键创建、互不干扰(绑定是"专属工作树"标记,不是独占锁;真正的保护是同机占用检查,见下文)。

DeepSeek Harness plugin: bind every conversation to its own isolated git worktree + branch in one click, so parallel agents work on one repo without stepping on each other. A binding is a "dedicated worktree" marker, not an exclusive lock; the real protection is the same-host occupancy check described below.

  • 绑定 / Binding — 会话在创建时即绑定到专属工作树:工作树 + 工作区 + 会话一次成型(绑定关系可推导、可展示、可清理;非独占,可共享)。
  • Agent 工具 / Agent tools — 13 个工具:原有 9 个 Git 工具(git_session_binding、git_repo_status、git_worktree_*、git_branch_*),加上 4 个任务工具(git_task_start、git_task_status、git_task_cancel、git_task_integrate),每个会话都可以调用。
    13 tools: the original 9 Git tools (git_session_binding, git_repo_status, git_worktree_*, git_branch_*) plus 4 task tools (git_task_start, git_task_status, git_task_cancel, git_task_integrate) every conversation can call.
  • 左侧工作区树 / The sidebar workspace tree — 唯一的管理界面:每个项目自动检测全部 git 工作树并注册为平铺的工作区行(主工作树 = 项目文件夹本身,标记 主工作树),工作树行上可新建会话(出生即绑定)或 删除工作树(含绑定会话提示/归档;运行中的会话会阻止删除)。
    The single management surface: every project auto-detects all its git worktrees and registers each as a flat workspace row (the main worktree IS the project folder, marked 主工作树); a worktree row can start a conversation (born bound) or remove the worktree (with bound-conversation warning/archive; a running conversation blocks deletion).

绑定是什么 / What a binding is

DSH 中,会话的工作目录(cwd)在创建时冻结,工作区归属要求"会话 cwd == 工作区路径"。因此绑定只能在创建会话的那一刻发生——把会话建在专属工作树里,绑定关系即成立:

A DSH session's cwd is frozen at creation and workspace membership requires the session's canonical cwd to equal the workspace path. So a binding happens at creation time: the conversation is born inside its own worktree:

~/projects/foo/                  ← 主工作树 / primary worktree (main)
├── .dsh-wt/
│   ├── feature-a/               ← 会话 A 绑定 / conversation A is bound here (branch feature-a)
│   └── bugfix-b/                ← 会话 B 绑定 / conversation B is bound here (branch bugfix-b)
└── (共享同一个 .git / one shared .git)

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-capture 下一个 Next dsh-vision-plugin →