npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-git-workbench

v0.3.4

Published

DeepSeek Harness git development workbench: captures git context (branch, status, worktrees, stash, recent commits) into every session, asks which branch/worktree to develop in at session start, and switches branches / creates and manages worktrees throug

Readme

dsh-git-workbench

DeepSeek Harness 的 git 开发工作台插件:不是(仅仅是)显示 git 状态的插件,而是驱动分支/worktree 开发流程的工作台。它把仓库状态(分支、ahead/behind、工作区状态、worktree 列表、stash、最近提交)注入每个会话,新会话开始时询问在哪个分支或 worktree 开发,并可通过 /git 命令、git_workbench agent 工具和设置页来切换分支、创建/管理 worktree。

功能

  • git 信息自动捕获(只读,常驻) — 在 git 仓库中的每个会话,第一步注入紧凑的 git 上下文块(切换后自动刷新):当前分支、相对 upstream 的 ahead/behind、工作区状态(staged / modified / untracked / conflicts)、worktree 列表、stash 列表、最近提交。非 git 目录静默跳过。
  • 新会话环境选择(可跳过) — 开启 autoAsk 后,新会话开始时 agent 会询问一次用哪个环境开发:保持当前分支 / 切换到其他分支 / 新建分支 / 进入已有 worktree / 基于分支新建 worktree。用户可直接跳过(保持当前环境)。
  • /git 斜杠命令
    • /git status — 注入当前 git 上下文快照
    • /git switch <branch> [--stash|--force] — 切换分支
    • /git merge <target> — 把当前分支合并到
    • /git branch <name> [--from <base>] — 新建分支并切换
    • /git log [N] — 最近提交
    • /git stash [push|list|pop|drop] — stash 管理
    • /git worktree list · add <branch> [--from <base>] [--dir <path>] · remove <path|branch> [--force] [--delete-branch]
  • 侧边栏 Git 面板(Web) — 侧边栏底部的 "Git" 按钮打开工作台浮层:选择任意已登记的工作目录,实时查看分支 / ahead-behind / 工作区状态 / worktrees / stashes / 最近提交,并一键执行带护栏的操作(切换分支、新建分支、新建 worktree、删除 worktree、stash push/pop/drop)。脏工作区的决策内联呈现(先 stash / 强制 / 取消)。
  • 输入框 git 条(Web) — 输入框卡片顶部(新建会话与每个会话)左侧显示当前工作目录的分支、clean/dirty 状态与环境下拉框,并与右侧的模型快捷按钮保持同一行;空间不足时 Git 控件会自动换到独立一行,避免裁切。选项包括:使用当前分支(默认)/ 创建新的分支 / 创建新的 worktree;非 git 仓库不显示该区域。有未提交改动时创建类选项禁用(附"stash 一下"快捷按钮);创建 worktree 后自动登记为工作目录,并提供"在新 worktree 开会话"按钮。
  • 合并与清理策略(agent 规则) — 当前分支非主分支(自动检测 main → master → develop)时,agent 遵循常驻规则:你说"合并到 main / 上线 / 发布"时,用 git_workbench(新增 merge 操作,支持目标分支在别的 worktree 检出、脏工作区护栏、已合并检测)把当前分支合并进主分支,然后询问你合并后分支/worktree 是删除还是保留,只有你明确选择后才删除。
  • 安全护栏
    • 脏工作区切分支会被拦截,工具返回 needsDecision,选项:先 stash / force / 取消。force 受 allowForceSwitch 控制(默认关闭)。
    • 删除 worktree 永远不允许删主 worktree当前会话所在目录;脏 worktree 需要 --force,受 allowForceWorktreeRemove 控制(默认关闭)。可选 --delete-branch 顺带删除分支(仅已合并时)。
    • 所有 git 执行走 execFile 参数数组,不经 shell,名称无法注入命令;分支名做白名单清洗。
  • Settings → Plugins → Git WorkbenchautoAsk、询问阈值、worktree 目录模板({parent}/{repo}-{branch})、最近提交条数、两个 force 开关。持久化到 $DSH_HOME/git-workbench.json

快速开始

dsh plugin --profile web add dsh-git-workbench

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

本地开发安装

dsh plugin --profile web add file:/path/to/dsh-git-workbench

file: 前缀(把包复制进 node_modules)。裸 add .add link:… 会让 pnpm 软链包,插件的 schemastery 依赖会从源码目录解析而找不到——这是 pnpm 软链安装的通用坑,不是插件问题。

重启 dsh web 后:

  1. 在 git 仓库目录打开会话 → 看到注入的 git 上下文;分支/worktree ≥2 时开头会有环境选择询问(可跳过);
  2. 或直接输入 /git 查看命令菜单。

Worktree 工作流

worktree 是独立目录,在 DSH 里每个 worktree 对应独立的 workspace/会话。/git worktree add <branch> 会在 <parent>/<repo>-<branch>(可用 worktreeDirTemplate 配置)创建 worktree,并提示在该目录打开新的 DSH 会话——这就是"进入 worktree 开发"的正确方式。新 worktree 会立即出现在同一仓库其他会话的 worktree 列表里。

实现笔记(写给插件作者)

  • 外部宿主插件不要 import @deepseek-ai/*。把 @deepseek-ai/dsh-llm / dsh-tools(或其他 @deepseek-ai/*)声明为依赖,会在 profile 的 node_modules 里装上第二份副本;重复模块实例会破坏宿主模块身份(实测:tools 调度器的 TOOL_RUNTIME_SCHEDULER 符号错位会让所有工具调度报 Cannot read properties of undefined (reading 'prepare'))。因此本插件手工构造 pre-step 上下文消息(createUserMessage 的形状:id + role:'user' + content + source:{kind:'plugin',plugin,form:'snapshot',sections},并深度冻结),工具也用普通编译后的定义注册(参数为对象根 JSON Schema + 根级 required 数组;输出为严格的 JsonSchemaNode)。
  • 上下文注入采用 dsh-time-context 的 pre-step 模式:ctx.on('agent/pre-step', …, { prepend: true }),第 1 步全量捕获、步间走 memo,指纹变化或本插件写入后重新注入。
  • git status --porcelain=v2 默认不输出 # branch.* 头部行,需要加 --branch

测试

npm test   # 客户端回归、单元与真实 git 集成测试(临时仓库)