feat(claude-code-hooks): add PreCompact hook support for experimental.session.compacting event (#139)

This commit is contained in:
YeonGyu-Kim
2025-12-25 14:29:27 +09:00
committed by GitHub
parent ac3c21fe90
commit fccaaf7676
5 changed files with 166 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ interface RawClaudeHooksConfig {
PostToolUse?: RawHookMatcher[]
UserPromptSubmit?: RawHookMatcher[]
Stop?: RawHookMatcher[]
PreCompact?: RawHookMatcher[]
}
function normalizeHookMatcher(raw: RawHookMatcher): HookMatcher {
@@ -30,6 +31,7 @@ function normalizeHooksConfig(raw: RawClaudeHooksConfig): ClaudeHooksConfig {
"PostToolUse",
"UserPromptSubmit",
"Stop",
"PreCompact",
]
for (const eventType of eventTypes) {
@@ -66,6 +68,7 @@ function mergeHooksConfig(
"PostToolUse",
"UserPromptSubmit",
"Stop",
"PreCompact",
]
for (const eventType of eventTypes) {
if (override[eventType]) {