跳过主要内容
C

dsh-hooks-pack

chenzhi-clude/dsh-hooks-pack

One-click Claude Code and Codex hooks for DeepSeek Harness: auto-discovers your existing hooks config and runs it on the official bridge plugins.

安装

dsh plugin --profile web add github:chenzhi-clude/dsh-hooks-pack

README

dsh-hooks-pack

One-click Claude Code & Codex hooks for DeepSeek Harness.

Already have a hooks.json from Claude Code or Codex? Install this pack and those hooks run inside DSH — no code, no config editing. No hooks yet? Copy the bundled starter pack and you have dangerous-command guarding plus a full tool-call audit log in one minute.

The heavy lifting is done by the official bridge plugins (@deepseek-ai/dsh-hooks-claude-code, @deepseek-ai/dsh-hooks-codex, shared protocol @deepseek-ai/dsh-hook-protocol). This pack adds what a manual setup is missing:

  1. Auto-discovery — probes the standard locations for your existing hook configs.
  2. One row — a single bundle mounts both dialects on the host plane.
  3. Safe idle — with no config found anywhere it registers nothing; installing never changes agent behavior by itself.

Install

From the plugin market UI: search dsh-hooks-pack → install.

Or with the CLI:

dsh plugin --profile web add github:REPLACE_ME/dsh-hooks-pack
# or from npm once published:
dsh plugin --profile web add dsh-hooks-pack

Restart the profile (or reload the web app) afterwards.

What gets discovered

DialectProbed locations (first hit wins)
Claude Code$CLAUDE_CONFIG_DIR/hooks.json~/.claude/hooks.json~/.claude/settings.json (only if it has a hooks key)
Codex$CODEX_HOME/hooks.json~/.codex/hooks.json

Explicit paths win over discovery:

# your profile's cordis.patch.yml
- id: hooks-pack
  name: dsh-hooks-pack
  config:
    claude:
      configPath: D:/my-hooks/claude-hooks.json
    codex:
      configPath: D:/my-hooks/codex-hooks.json

Supported hook points

Via the official bridges (command hooks only):

  • Claude Code dialect: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SubagentStart, SubagentStop
  • Codex dialect: PreToolUse, PostToolUse, SessionStart, UserPromptSubmit, Stop

deny / ask decisions, blocking feedback, and additionalContext injection all work; see each bridge README for the exact per-event payload and output contract.

Hook output format

Decisions must use Claude Code's structured form — top-level permissionDecision is ignored:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "deny",
    "permissionDecisionReason": "blocked by policy X"
  }
}

hookEventName must name the firing event (PreToolUse, SessionStart, …) or the event-scoped fields are discarded. Exit code 2 also blocks, with stderr as the reason.

Starter pack

examples/claude-hooks.example.json ships two ready-made hooks:

  • guard-dangerous (PreToolUse on shell tools): blocks rm -rf, force pushes, Remove-Item -Recurse -Force, disk formatting, fork bombs, …
  • audit-log (PostToolUse on everything): appends every tool call to ~/.dsh-hooks-audit.jsonl

Enable them:

# 1. copy the examples somewhere stable
xcopy /E /I <profile-node-modules>\dsh-hooks-pack\examples %USERPROFILE%\dsh-hooks-examples\
# 2. point your hooks file at it
copy %USERPROFILE%\dsh-hooks-examples\claude-hooks.example.json %USERPROFILE%\.claude\hooks.json
# 3. edit that file, replacing <ABS-PATH> with %USERPROFILE%\dsh-hooks-examples

Config reference

KeyTypeDefaultMeaning
autoDiscoverbooleantrueProbe standard locations when no explicit path is given
claude.configPathstringdiscoveredExplicit Claude Code config file
claude.pluginRootstringReplaces ${CLAUDE_PLUGIN_ROOT} in commands
claude.projectDirstringsession cwdReplaces ${CLAUDE_PROJECT_DIR} and sets the env var
claude.defaultTimeoutMsnumber600000Per-hook timeout when the hook sets none
codex.configPathstringdiscoveredExplicit Codex config file
codex.modelstringModel name stamped on Codex payloads

Known limitations

Inherited from the official bridges: only shell-form command hooks run (http/mcp_tool/prompt handlers are skipped with a warning); config is read once at process load, so project-local hooks.json per-session discovery is not available yet; some newer Claude Code events are not mapped. See the bridges' READMEs for the complete lists.

Compatibility

Tested against DeepSeek Harness 0.1.0-rc.7 with bridge packages 0.1.0-rc.7. The dependency range also accepts 0.1.1-rc.1 for newer deployments.

License

MIT

相关插件