diff --git a/.claude/settings.json b/.claude/settings.json index fd3edef..8675d05 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -9,6 +9,15 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ], "PostToolUse": [ @@ -20,6 +29,15 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ], "PreCompact": [ @@ -31,6 +49,15 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ], "PreToolUse": [ @@ -42,6 +69,15 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ], "Stop": [ @@ -53,6 +89,15 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ], "SubagentStop": [ @@ -64,6 +109,15 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ], "UserPromptSubmit": [ @@ -75,7 +129,16 @@ "command": "/Users/jason/go/bin/cnotes" } ] + }, + { + "matcher": ".*", + "hooks": [ + { + "type": "command", + "command": "/var/folders/3z/q0v7phks3lsc_ryxstdz5h3m0000gn/T/go-build618894364/b001/exe/cnotes" + } + ] } ] } -} +} \ No newline at end of file diff --git a/internal/config/settings.go b/internal/config/settings.go index 322ddee..b6c2762 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -96,10 +96,9 @@ func InstallHooksToPath(binaryPath, settingsPath string) error { settings.Hooks = make(map[string][]HookDefinition) } - hookCmd := binaryPath + " run" hookAction := HookAction{ Type: "command", - Command: hookCmd, + Command: binaryPath, } hookDef := HookDefinition{ @@ -123,7 +122,7 @@ func InstallHooksToPath(binaryPath, settingsPath string) error { found := false for i, def := range settings.Hooks[claudeEvent] { for j, action := range def.Hooks { - if action.Command == hookCmd { + if action.Command == binaryPath { // Update existing hook settings.Hooks[claudeEvent][i].Hooks[j] = hookAction found = true @@ -158,8 +157,6 @@ func UninstallHooksFromPath(binaryPath, settingsPath string) error { return nil } - hookCmd := binaryPath + " run" - // Remove our hook from all events for eventName, hookDefs := range settings.Hooks { newDefs := make([]HookDefinition, 0) @@ -167,7 +164,7 @@ func UninstallHooksFromPath(binaryPath, settingsPath string) error { for _, def := range hookDefs { newActions := make([]HookAction, 0) for _, action := range def.Hooks { - if action.Command != hookCmd { + if action.Command != binaryPath { newActions = append(newActions, action) } } diff --git a/internal/context/conversation.go b/internal/context/conversation.go index 9a4c5f6..f07d8f7 100644 --- a/internal/context/conversation.go +++ b/internal/context/conversation.go @@ -167,8 +167,15 @@ func (ce *ContextExtractor) parseTranscriptContent(content, sessionID string, si case "user": // Extract user prompts if msg, ok := entry["message"].(map[string]interface{}); ok { - if content, ok := msg["content"].([]interface{}); ok { - for _, c := range content { + // Handle both string content and array content formats + if content, ok := msg["content"].(string); ok && content != "" { + // Direct string content + if !strings.Contains(content, "[Request interrupted by user") { + context.UserPrompts = append(context.UserPrompts, content) + } + } else if contentArray, ok := msg["content"].([]interface{}); ok { + // Array of content objects + for _, c := range contentArray { if textContent, ok := c.(map[string]interface{}); ok { if text, ok := textContent["text"].(string); ok && text != "" { // Skip system messages about interruptions diff --git a/test-prompt.txt b/test-prompt.txt deleted file mode 100644 index 9b4acc5..0000000 --- a/test-prompt.txt +++ /dev/null @@ -1 +0,0 @@ -Another test