feat: fix Cursor hook delivery and improve notify workflow

Route hook notifications through /dev/tty and client_tty so OSC reaches
Ghostty when Cursor captures stdout. Add afterAgentResponse hook, hook
logging, debounce, split test modes, and use directory name for titles.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-26 12:46:50 +08:00
parent aa9c2b8ea5
commit 021fc3a828
20 changed files with 757 additions and 76 deletions
+4 -2
View File
@@ -8,7 +8,8 @@ import (
"github.com/longbin/agent-notify/internal/config"
)
const cursorHookCmd = "agent-notify hook cursor stop"
const cursorStopCmd = "agent-notify hook cursor stop"
const cursorResponseCmd = "agent-notify hook cursor response"
const cursorToolCmd = "agent-notify hook cursor tool"
const claudeStopCmd = "agent-notify hook claude stop"
const claudeIdleCmd = "agent-notify hook claude idle"
@@ -31,7 +32,8 @@ func MergeCursorHooks(path string, force bool) error {
hooks = map[string]any{}
doc["hooks"] = hooks
}
addHook(hooks, "stop", cursorHookCmd, force)
addHook(hooks, "stop", cursorStopCmd, force)
addHook(hooks, "afterAgentResponse", cursorResponseCmd, force)
cfg, _ := config.LoadDefault()
if cfg.Events.Tool {
addHook(hooks, "afterShellExecution", cursorToolCmd, force)
+4
View File
@@ -24,6 +24,10 @@ func TestMergeCursorHooks(t *testing.T) {
if len(stop) != 1 {
t.Fatalf("expected stop hook added")
}
resp := hooks["afterAgentResponse"].([]any)
if len(resp) != 1 {
t.Fatalf("expected afterAgentResponse hook added")
}
}
func TestMergeCursorHooksNoOverwrite(t *testing.T) {