-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtest-hook.sh
More file actions
executable file
·56 lines (46 loc) · 2.64 KB
/
Copy pathtest-hook.sh
File metadata and controls
executable file
·56 lines (46 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Test script for AgentBro HookServer
# Run this while the app is running to verify the full event pipeline.
SOCKET="/tmp/agentbro.sock"
SESSION_ID="test-$(date +%s)"
echo "=== AgentBro Hook Test ==="
echo "Socket: $SOCKET"
echo "Session: $SESSION_ID"
echo ""
# Test 1: SessionStart
echo "--- Test 1: SessionStart ---"
echo "{\"agent\":\"claude-code\",\"event\":\"SessionStart\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"waiting_for_input\",\"pid\":$$,\"tty\":\"$(tty 2>/dev/null || echo /dev/ttys000)\"}" | nc -U "$SOCKET"
echo "Sent SessionStart. Check the notch panel — you should see a new session."
sleep 2
# Test 2: Processing (UserPromptSubmit)
echo "--- Test 2: UserPromptSubmit ---"
echo "{\"agent\":\"claude-code\",\"event\":\"UserPromptSubmit\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"processing\",\"pid\":$$}" | nc -U "$SOCKET"
echo "Sent UserPromptSubmit. Session should show 'processing'."
sleep 2
# Test 3: PreToolUse
echo "--- Test 3: PreToolUse ---"
echo "{\"agent\":\"claude-code\",\"event\":\"PreToolUse\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"running_tool\",\"tool\":\"Read\",\"tool_input\":{\"file_path\":\"/tmp/test.txt\"},\"pid\":$$}" | nc -U "$SOCKET"
echo "Sent PreToolUse (Read). Session should show tool activity."
sleep 2
# Test 4: PostToolUse
echo "--- Test 4: PostToolUse ---"
echo "{\"agent\":\"claude-code\",\"event\":\"PostToolUse\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"processing\",\"tool\":\"Read\",\"tool_input\":{\"file_path\":\"/tmp/test.txt\"},\"pid\":$$}" | nc -U "$SOCKET"
echo "Sent PostToolUse."
sleep 2
# Test 5: Notification (idle)
echo "--- Test 5: Notification (idle) ---"
echo "{\"agent\":\"claude-code\",\"event\":\"Notification\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"notification\",\"notification_type\":\"idle_prompt\",\"message\":\"Claude is waiting for your input\",\"pid\":$$}" | nc -U "$SOCKET"
echo "Sent idle notification."
sleep 2
# Test 6: Stop (waiting for input)
echo "--- Test 6: Stop ---"
echo "{\"agent\":\"claude-code\",\"event\":\"Stop\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"waiting_for_input\",\"pid\":$$}" | nc -U "$SOCKET"
echo "Sent Stop. Session should show idle/waiting."
sleep 2
# Test 7: SessionEnd
echo "--- Test 7: SessionEnd ---"
echo "{\"agent\":\"claude-code\",\"event\":\"SessionEnd\",\"session_id\":\"$SESSION_ID\",\"cwd\":\"$PWD\",\"status\":\"ended\",\"pid\":$$}" | nc -U "$SOCKET"
echo "Sent SessionEnd. Session should be removed."
echo ""
echo "=== Test Complete ==="
echo "If you saw session state changes in the notch panel, the end-to-end pipeline works!"