sync: auto-sync from DESKTOP-0O8A1RL at 2026-05-13 07:41:31
Author: Mike Swanson Machine: DESKTOP-0O8A1RL Timestamp: 2026-05-13 07:41:31
This commit is contained in:
26
.claude/scripts/check-messages.sh
Normal file
26
.claude/scripts/check-messages.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Checks for unread coord messages and injects them into Claude's context.
|
||||
# Runs as a UserPromptSubmit hook — exits silently if no messages or API is down.
|
||||
SESSION="$(hostname)/claude-main"
|
||||
API="http://172.16.3.30:8001"
|
||||
|
||||
result=$(curl -s --connect-timeout 3 "${API}/api/coord/messages?to_session=${SESSION}&unread_only=true" 2>/dev/null)
|
||||
[ -z "$result" ] && exit 0
|
||||
|
||||
count=$(echo "$result" | jq '.total' 2>/dev/null)
|
||||
[ -z "$count" ] || [ "$count" -eq 0 ] && exit 0
|
||||
|
||||
echo ""
|
||||
echo "============================================================"
|
||||
echo "UNREAD COORD MESSAGES ($count)"
|
||||
echo "============================================================"
|
||||
echo "$result" | jq -r '.messages[] | "FROM: \(.from_session)\nDATE: \(.created_at)\nSUBJECT: \(.subject)\n\nMESSAGE:\n\(.body)\n---"'
|
||||
echo "============================================================"
|
||||
echo ""
|
||||
|
||||
# Mark all fetched messages as read immediately
|
||||
echo "$result" | jq -r '.messages[].id' | tr -d '\r' | while read -r id; do
|
||||
curl -s -X PUT "${API}/api/coord/messages/${id}/read" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -5,5 +5,17 @@
|
||||
"preferences": {
|
||||
"autoCompact": true,
|
||||
"verbose": false
|
||||
},
|
||||
"hooks": {
|
||||
"UserPromptSubmit": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "bash .claude/scripts/check-messages.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Submodule projects/msp-tools/guru-rmm updated: 5b43fe63a5...3df58802d1
Reference in New Issue
Block a user