truelove-dreamer/dsh-plugin-hooks0

dsh-plugin-hooks

DeepSeek Harness plugin: Claude-Code-style lifecycle hooks for DSH. Configure shell commands that run automatically before/after model tool calls (pre-tool / post-tool) with a JSON payload on stdin; pre-tool non-zero exits block the call.

AI Analysis

核心用途是为工具调用建立前置/后置安全守卫或自动化流水线(如编辑后自动 Lint)。适合需要对 Agent 行为进行自动化审计或格式校验的高级用户。

Package
dsh-plugin-hooks
Version
0.1.1
Last updated
Aug 14, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:truelove-dreamer/dsh-plugin-hooks

配置

JSON 配置,来源二选一或叠加:

  1. 文件(默认 $DSH_HOME/hooks.json):
{
  "hooks": [
    {
      "id": "lint-after-edit",
      "event": "post-tool",
      "tools": ["edit", "write"],
      "command": "npm run lint -- --quiet",
      "timeoutMs": 30000
    },
    {
      "id": "guard-prod",
      "event": "pre-tool",
      "tools": ["bash", "pwsh"],
      "command": "node guard.js"
    }
  ]
}
  1. 内联(挂载 config,追加在文件 hooks 之后):
- id: hooks
  name: dsh-plugin-hooks
  config:
    configFile: C:/path/to/hooks.json   # 可选
    hooks:
      - id: always-deny-db
        event: pre-tool
        tools: [bash]
        command: "node deny-db.js"

字段:id(必填、唯一)、event(pre-tool | post-tool)、tools(可选,默认全部)、command(必填)、timeoutMs(可选)、enabled(默认 true)。