KYinCode/dsh-hooks-plugin
Claude Code 风格的 DSH hooks:通过 .dsh/hooks.json 在智能体/工具生命周期事件上运行 shell 命令 | Claude Code style hooks for DeepSeek Harness: shell commands on agent/tool events via .dsh/hooks.json
Project Overview项目介绍
This is a native DSH plugin built exclusively for DeepSeek Harness, designed to bring Claude Code-style hook functionality to the DSH ecosystem. It lets users run custom shell commands when specific agent or tool lifecycle events fire, and follows the same JSON configuration schema as Claude Code hooks, making it easy to migrate existing hook scripts. It supports four layers of configuration, starting from the global level at ~/.dsh/hooks.json, then preset-level, project-level, and finally project-level local configuration. Installation can be done directly via the DSH plugin command, either from the npm registry or from a local packed tarball.
After installation, the plugin takes effect automatically for both new and existing open sessions, no restart of DSH is required. Any changes to project configuration are automatically reloaded via the file watcher, and if you have the dsh-hot-installer plugin installed, even plugin upgrades work without a restart. The plugin includes a full configuration manual bundled with the installation package, so you don’t need to check the source code to understand how to write hooks. It also automatically registers an authoring skill that gives you quick access to guidance right inside DSH.
The plugin only supports the command and http hook types in v1, with prompt and agent types aligned to the Claude Code schema but not implemented yet. It keeps compatibility with Claude Code at the configuration and protocol level only, and does not replicate CC-specific environment variables or plugin mechanisms. Hook execution records are persisted up to 200 entries, which is configurable via the DSH_HOOKS_RECENT_MAX environment variable, and logs are automatically rotated when they hit 1 MiB, with the size limit also configurable. The plugin is released under the permissive MIT open source license.
这是一个面向 DeepSeek Harness 开发的原生插件,为 DSH 提供 Claude Code 风格的钩子功能,允许用户在智能体或工具的生命周期事件触发时运行自定义 shell 命令。配置遵循与 Claude Code 兼容的 JSON 结构,存储在 .dsh/hooks.json 路径下,支持全局、预设、项目、项目本地四层配置,可直接复用已有的 Claude Code 钩子脚本,无需额外改造。
它支持多种匹配规则,对齐 Claude Code 的去重逻辑,覆盖 PreToolUse、会话开始结束、子代理结束等多个生命周期事件,还支持拦截工具调用,默认对子代理生效,支持配置变更热重载,无需重启 DSH 即可生效。搭配 dsh-hot-installer 还可以实现免重启热升级插件,浮动控制台按会话隔离显示钩子记录,切换会话自动更新对应内容。
本插件采用 MIT 开源许可证,可通过 dsh plugin --profile <p> add 命令从 npm 或本地安装包安装,安装后新建和已有会话均可自动生效。插件自带配置手册,自动注册作者编写技能,方便开发者查阅学习,钩子记录会自动持久化保存,支持日志轮转,不会无限占用本地存储空间。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-hooks-plugin(KYinCode/dsh-hooks-plugin)
仓库:https://github.com/KYinCode/dsh-hooks-plugin
本站详情页:https://www.yhbd.top/plugins/kyincode-dsh-hooks-plugin/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 3 · 最近提交 2026-08-19 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
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 dsh-hooks-plugin
把 KYinCode/dsh-hooks-plugin 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-hooks-plugin
为 DeepSeek Harness 提供 Claude Code 风格的 hooks:在智能体 / 工具生命周期事件上运行 shell 命令,配置来自 .dsh/hooks.json(与 Claude Code hooks 兼容的 JSON 结构)。
产品名是 dsh-hooks;npm / GitHub 包名是
dsh-hooks-plugin(dsh-hooks已被占用)。运行时 API 与日志路径沿用dsh-hooks名:~/.dsh/logs/dsh-hooks/dsh-hooks.log与GET /dsh-hooks/recent(见下)。
目录
特性(v1)
- 四层配置:全局
~/.dsh/hooks.json→ 预设<preset-dir>/hooks.json→ 项目<项目根>/.dsh/hooks.json→ 项目本地.dsh/hooks.local.json。 - CC 兼容 schema 与协议:
matcher[] + hooks[]结构、stdin JSON 输入 / stdout JSON 决策输出,可复用现有 Claude Code hook 脚本。 - 去重规则对齐 CC 2.1.88
hookDedupKey:command=shell+command+if、http=url+if、prompt/agent=prompt+if;同一 key 跨层只执行一次,最后合并层胜出;callback/function不去重。 - matcher 语义对齐 CC
matchesPattern:*全匹配、A|B管道精确匹配、其余按正则;if条件支持权限规则语法(Bash(git *)、Read(*.ts))。 - 事件:
PreToolUse/PostToolUse/PostToolUseFailure/UserPromptSubmit/SessionStart/SessionEnd/Stop/SubagentEnd。PreToolUse决策deny→ 官方工具失败卡片(模型看到Error: <reason>)。
- 子代理:默认触发,输入载荷携带
agent_id/agent_type/delegation_depth;可用subagents: false关闭;命令在触发者自己的沙箱上下文执行。 - 热重载:项目配置改动自动重新加载(
fs.watchFile),无需重启。 - 免重启热升级:安装
dsh-hot-installer后,dsh plugin --profile web add <包>@<新版本>当场生效,无需重启。 - 浮动控制台按会话隔离:
shell.overlay上的 🔌 Hooks 浮动控制台只显示当前正在查看的会话的 hooks(含该会话子代理触发的记录,带subagent·dN角标,行内显示触发工具名);切换会话即随之更新,头部显示会话·<标题>。 - 最近记录持久化:每条 hook 记录写入
recent.jsonl(限 200 条,DSH_HOOKS_RECENT_MAX可调),插件热升级/进程重启后自动回填——控制台不丢最近历史。 - 日志轮转:
~/.dsh/logs/dsh-hooks/dsh-hooks.log超过 1 MiB(可用DSH_HOOKS_MAX_LOG_BYTES调整)自动滚动为.1并续写新文件,不会无限增长。 - 交付形态:profile bundle(
cordis.patch.yml自动插行),用dsh plugin --profile <p> add安装。 - 随包自带手册:
docs/CONFIGURATION.md(配置 / 协议 / 边界全讲清)随 npm 包装入——装完的 agent 可直接read它,不必翻源码猜协议。 - 自动注册作者技能:
apply()把包内skills/dsh-hooks-authoring注册进技能注册表(global 层),任意 agent 装完即在其skill目录看到dsh-hooks-authoring;加载即得「四条钉死事实 + 配置/决策 JSON + Windows/沙箱边界」索引,深度问题读随包手册。
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
omdsh-dev/DSH-better-sidebar
LiPu-jpg/Openwrite
cocode-agency/cocode
drewnekota/cetus
cosyncing/cosyncing
UNLINEARITY/dsh-code
Cerbur/clutch-dsh
cofy-x/dsh-console