鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

dsh-git-workbench

DeepSeek Harness Git 开发工作台:采集分支、状态、worktree、stash 和最近提交,并通过命令、工具与设置界面管理 Git 工作区。

代码评审
访问 GitHub
文档README

dsh-git-workbench

A git development workbench for DeepSeek Harness: not a git-status display plugin — it drives the branch/worktree workflow. It captures the repository state (branch, ahead/behind, worktree status, worktrees, stashes, recent commits) into every session, asks which branch or worktree to develop in at new-session start, and switches branches / creates and manages worktrees through /git commands, the git_workbench agent tool, and a Settings page.

Features

  • Automatic git context (read-only, always on) — every session in a git repository gets a compact context block injected at the first step (and refreshed after git-workbench writes): current branch, ahead/behind vs upstream, working-tree status (staged / modified / untracked / conflicts), worktree list, stash list, recent commits. Non-git directories stay silent.
  • New-session environment choice (skippable) — with autoAsk on, the agent asks once per session which environment to develop in: stay on the current branch, switch to another branch, create a new branch, open an existing worktree, or create a new worktree. The user can skip (stay where they are).
  • /git slash commands
    • /git status — inject the current git context snapshot
    • /git switch <branch> [--stash|--force] — switch branch
    • /git merge <target> — merge the current branch into
    • /git branch <name> [--from <base>] — create a branch and switch to it
    • /git log [N] — recent commits
    • /git stash [push|list|pop|drop] — stash management
    • /git worktree list · add <branch> [--from <base>] [--dir <path>] · remove <path|branch> [--force] [--delete-branch]
  • git_workbench agent tool — the same guarded operations, callable by the agent (e.g. from the auto-ask flow). Agent-driven switching goes through exactly the same guardrails as the command.
  • Sidebar Git panel (Web) — a "Git" button in the sidebar footer opens a workbench overlay: pick any registered DSH workspace, see its branch / ahead-behind / working-tree status / worktrees / stashes / recent commits live, and run guarded actions (switch branch, new branch, new worktree, remove worktree, stash push/pop/drop) with one click. Dirty-tree decisions surface inline (stash first / force / cancel).
  • Composer git strip (Web) — the input card's top row (new-session hero and every session) shows the current workspace's branch and clean/dirty state plus an environment dropdown, left-aligned on the same row as right-aligned model shortcuts. Narrow composers wrap the git controls onto their own row instead of clipping them. The choices are use the current branch (default) / create a new branch / create a new worktree. The strip stays hidden outside a git repository. Create options are disabled while the tree has uncommitted changes (with a "stash now" shortcut); creating a worktree registers the new directory as a workspace and offers "open a session in the new worktree".
  • Merge & cleanup policy (agent rule) — when the current branch is not the main branch (auto-detected: main → master → develop), the agent follows a persistent rule: if you ask to merge to main / ship / release / go live, it merges the current branch into main with git_workbench (action merge, which also handles the target being checked out in another worktree, dirty-tree guards, and already-merged detection), then asks you whether to delete the branch/worktree after the merge or keep it, and only deletes with your explicit choice.
  • Guardrails
    • Switching branches over a dirty tree is blocked; the tool returns needsDecision with options (stash first / force / cancel). Force is gated by allowForceSwitch (default off).
    • Removing a worktree never targets the main worktree or this session's working directory; dirty worktrees need --force, gated by allowForceWorktreeRemove (default off). Optionally deletes the branch after removal (--delete-branch, only when merged).
    • All git execution uses execFile with an argument array — no shell, so names cannot inject commands. Branch names are sanitized.
  • Settings → Plugins → Git Workbench — autoAsk, ask threshold, worktree directory template ({parent}/{repo}-{branch}), recent-commit count, and the two force toggles. Persisted to $DSH_HOME/git-workbench.json.

Quick start

▼
sh
复制代码
dsh plugin --profile web add dsh-git-workbench

Slow npm registry? dsh plugin --profile web add dsh-git-workbench --registry=https://registry.npmmirror.com

Install from a local checkout (development):

▼
sh
复制代码
dsh plugin --profile web add file:/path/to/dsh-git-workbench

Use the file: prefix (copies the package into node_modules). A bare add . or add link:… makes pnpm symlink the package, in which case the plugin's schemastery dependency resolves from the source checkout and is not found — a general pnpm symlink-install gotcha, not a bug in the plugin.

Restart dsh web, then:

  1. Open a session in a git repository → you should see the git context injected, and (with ≥2 branches/worktrees) the environment question at the start (skippable);
  2. Or type /git for the command menu.

Worktree workflow

Worktrees are separate directories, so in DSH each worktree is its own workspace/session. /git worktree add <branch> creates the worktree at <parent>/<repo>-<branch> (configurable via worktreeDirTemplate) and tells you to open a new DSH session in that directory — that is the intended way to "develop in a worktree". The worktree is immediately visible in the worktree list of every other session of the same repository.

Implementation notes (for plugin authors)

  • Do not import @deepseek-ai/* from an out-of-tree host plugin. Declaring @deepseek-ai/dsh-llm / dsh-tools (or any @deepseek-ai/*) as dependencies installs second copies into the profile's node_modules; the resulting duplicate module instances break host module identity (empirically: the tools scheduler's TOOL_RUNTIME_SCHEDULER symbol mismatch makes every tool dispatch fail with Cannot read properties of undefined (reading 'prepare')). This plugin therefore hand-builds its pre-step context message (the createUserMessage shape: id + role:'user' + content + source:{kind:'plugin',plugin,form:'snapshot',sections}, deep-frozen) and registers its agent tool as a plain compiled definition (parameters as an object-rooted JSON Schema with a root required array; output as a strict JsonSchemaNode).
  • The injected context uses the dsh-time-context pre-step pattern: ctx.on('agent/pre-step', …, { prepend: true }), fresh capture on step 1, memoized between steps, re-injected when the fingerprint changes or after our own writes.
  • git status --porcelain=v2 does not emit # branch.* header lines unless --branch is passed.

Test

▼
sh
复制代码
npm test # client regression, unit, and real-git integration tests (temp repos)
代码评审

快捷安装

复制到终端去安装插件

dshplugin--profilewebaddgithub:kaixinbaba/dsh-git-workbench

温馨提示

装插件等于在本机跑第三方代码,权限与你相同,能读文件、用凭据、访问网络,工具审批管不到。请只装可信来源,并尽量锁定 commit。

站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
零感AI零感AI
墨得问题墨得问题
dsh 插件推荐
dsh-code-review
提供 /review、/review-status 和 /review-cancel,用独立原生子 Agent 审查所选 Git 范围(基准分支、未提交更改、某次提交或自定义要求),并把发现报告返回当前会话;报告语言跟随宿主 locale,支持中英文。
AgentsGitFlowController
AI 编码智能体分支角色守卫:可配置集成/预览/生产/归档角色,拦截对受保护分支的直接推送、强推与删除,以及智能体对生产/归档分支的合并。
dsh-github-mcp-hint
GitHub MCP 辅助面板:在「设置 → 插件 → GitHub MCP」展示可复制的示例提示(30 条示例池随机 4 条)、可视化公开仓库的星/fork/语言,并提供 gh_repo_stats / gh_current_user 模型工具。
dsh-github-mcp
把 GitHub 官方远程 MCP server 封装为 DSH 插件:PAT 存入 DSH 凭据中心(.credentials.yaml),提供 github_set_token / github_token_status 模型工具,GitHub 工具以 mcp__github__* 形式可用。
source-code-mgmt
DSH 网页界面的代码管理面板,五步搞定 Git 日常:① 环境检查自动检测 git/gh/ssh,缺工具一键安装(gh 支持镜像下载源加速,Windows 也可用)并带检查更新;② SSH ed25519 密钥生成/连接测试 + 一键写 443 配置绕过 22 端口封锁,Gitee 私人令牌在此配置;③ 查看仓库状态、并排 diff、暂存提交、切换分支、查看/回滚历史,一键新建仓库并推送,自动忽略超 100MB 文件;④ 列出账号名下所有远程仓库一键克隆;⑤ 五步发布 npm 包。支持 GitHub / Gitee 双平台,界面中英文跟随 DSH 设置实时切换。