Generated Configs
Output of bunx @pivanov/agent-hooks-bridge install ./.hooks/format.ts with default options (all events, all hosts).
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "./.hooks/format.ts --host claude"
}
]
}
],
"PreToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "./.hooks/format.ts --host claude"
}
]
}
],
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "./.hooks/format.ts --host claude"
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "./.hooks/format.ts --host claude"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "./.hooks/format.ts --host claude"
}
]
}
]
}
}{
"version": 1,
"hooks": {
"sessionStart": [
{
"command": "./.hooks/format.ts --host cursor"
}
],
"preToolUse": [
{
"command": "./.hooks/format.ts --host cursor"
}
],
"postToolUse": [
{
"command": "./.hooks/format.ts --host cursor"
}
],
"beforeSubmitPrompt": [
{
"command": "./.hooks/format.ts --host cursor"
}
],
"stop": [
{
"command": "./.hooks/format.ts --host cursor"
}
]
}
}# >>> agent-hooks-bridge: managed block; do not edit between markers
[[hooks]]
event = "SessionStart"
command = "./.hooks/format.ts --host codex"
[[hooks]]
event = "PreToolUse"
command = "./.hooks/format.ts --host codex"
matcher = "*"
[[hooks]]
event = "PostToolUse"
command = "./.hooks/format.ts --host codex"
matcher = "*"
[[hooks]]
event = "UserPromptSubmit"
command = "./.hooks/format.ts --host codex"
[[hooks]]
event = "Stop"
command = "./.hooks/format.ts --host codex"
# <<< agent-hooks-bridgePer-host notes
Claude. matcher is omitted on events that don't take one. If .claude/settings.json already exists, top-level keys (permissions, etc.) are preserved verbatim. hooks.<EventName> arrays merge: existing entries with command matching your script are removed; the fresh entry is appended. Other entries stay.
Cursor. The unified UserPromptSubmit event is wired to beforeSubmitPrompt. version: 1 is seeded if the file is fresh; existing version is preserved. The install wires preToolUse and postToolUse (the generic events), not the specific ones (beforeShellExecution, beforeMCPExecution, beforeReadFile). The generic events fire for all of those. matcher is only added when --matcher is passed with a non-default value.
Codex. The managed block is delimited by BEGIN/END marker comments. Re-installs replace the block in place. Content outside the markers (user-written TOML) is preserved by string operations. TOML strings are escaped for backslashes and double quotes.
Verifying without writing
--dry-run prints exactly the same content to stdout under per-host headers. Diff that against your existing files before committing:
bunx @pivanov/agent-hooks-bridge install ./.hooks/format.ts --dry-run# agent-hooks-bridge install --dry-run
# script: ./.hooks/format.ts
# events: SessionStart, PreToolUse, PostToolUse, UserPromptSubmit, Stop
# hosts: claude, cursor, codex
# matcher: *
# claude → /path/to/proj/.claude/settings.json
{
"hooks": { ... }
}
# cursor → /path/to/proj/.cursor/hooks.json
{ ... }
# codex → /path/to/proj/.codex/hooks.toml
# >>> agent-hooks-bridge ...