FlashingChen/dsh-worktree ↗★ 2
dsh-worktree
Codex-style permanent git worktrees for DeepSeek Harness: agent tools, a /worktree command, and session context for durable worktrees.
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗dsh-worktree
为 DeepSeek Harness 打造的 Codex 同款永久 git 工作树 插件——让 DSH profile 获得与 codex worktree create --permanent 一样的持久工作树工作流。
永久工作树是一个真实的 git worktree add --detach 检出目录,跨会话、跨重启永久存在。你(或 agent)创建一次,之后任何会话都可以在它里面继续之前的工作——完全不碰你的主工作树。
功能一览
| Codex CLI | dsh-worktree 对应能力 |
|---|---|
codex worktree create --permanent [] | agent 工具 worktree_create,或 /worktree create [] |
codex worktree list | agent 工具 worktree_list,或 /worktree / /worktree list |
codex worktree open | /worktree open (注册为 DSH 工作区;在那里开新会话即可) |
codex worktree close/delete | agent 工具 worktree_remove,或 /worktree remove |
| 会话中展示工作树信息 | 会话运行在已注册工作树内时,agent 收到一次上下文提示 |
除了 CLI 对齐,模型本身也能使用这些工具:任务进行中就可以自己派生一个永久工作空间——在指定 commit 上创建工作树、用常规文件工具在里面干活、用完清理。
工作原理
- 工作树位于
/.dsh-worktrees/——与 Codex 的.codex/worktrees/相同的隐藏目录模式——因此始终在仓库内部(当会话工作区就是仓库根时,也在会话的workspace-write沙箱内)。 - 每个工作树都会写入按仓库持久化的 manifest:
/.dsh-worktrees/manifest.json(名称、路径、基线 commit、创建时间、创建者会话)。manifest 就是"永久"的载体:DSH 重启后依然存在,可被工具/命令列出,新会话在其中打开时也能被识别。 - 创建工作树的同时会注册到
ctx.workspaceRegistry,出现在 DSH 工作区列表里——这就是之后"打开"它的原生方式。 - 移除工作树会执行
git worktree remove(可选--force)、删除 manifest 条目并注销工作区;拒绝删除当前会话正在运行其中的工作树。
环境要求
- git ≥ 2.31(使用
git rev-parse --path-format=absolute --git-common-dir)。 - 带
tools、commands、subprocess服务的 DSH profile(webprofile 通过dsh-base三者齐全)。