feat: initial commit for omp-hooks plugin
This commit is contained in:
commit
a0d4230537
6 files changed
+624
No files matched your search
@@ -0,0 +1,53 @@
|
||||
# @local/omp-hooks
|
||||
|
||||
Project-level and session-level lifecycle hooks for DeepSeek Harness (DSH), with full compatibility for Claude Code `.claude/settings.json`, `.claude/hooks.json`, and project-root `hooks.json`.
|
||||
|
||||
## Supported Hook Events
|
||||
|
||||
| Event | Firing Moment | Capabilities |
|
||||
|---|---|---|
|
||||
| `SessionStart` | On agent creation / session init | Injects context before the first turn |
|
||||
| `UserPromptSubmit` | When user prompt / messages are submitted | Can block prompt (exit 2) or attach extra context |
|
||||
| `PreToolUse` | Before any tool executes | Can block execution (`deny`), ask confirmation (`ask`), or pass |
|
||||
| `PostToolUse` | After a tool finishes execution | Can block result with feedback, or append context |
|
||||
| `Stop` | When agent turn is stopping | Can steer agent into continuing with a reason |
|
||||
|
||||
## Configuration Locations (per-project discovery)
|
||||
|
||||
In any project workspace directory, hooks are automatically discovered from:
|
||||
1. `.claude/settings.local.json`
|
||||
2. `.claude/settings.json`
|
||||
3. `.claude/hooks.json`
|
||||
4. `hooks.json`
|
||||
|
||||
## Example `.claude/settings.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "bash|write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python3 $CLAUDE_PROJECT_DIR/.claude/hooks/guard.py",
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "edit|write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "npx prettier --write $CLAUDE_PROJECT_DIR/src"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user