Files
claude-code-monitor/.claude/hooks/user_prompt.sh
felix.zoesch 48d2caf57c Add user prompt text display and agents graph tab
Features:
- User prompt hook now captures and displays actual prompt text
- Added tab switching between Event Feed and Agents Graph
- Created AgentsGraph component with placeholder
- Added CSS styling for agents graph view

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 10:51:38 +01:00

41 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# User Prompt Submit Hook for Claude Code Monitor
# Captures user prompt submission events
# Read JSON from stdin
INPUT=$(cat)
# Extract fields using jq
SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // "unknown"')
PROMPT=$(echo "$INPUT" | jq -r '.prompt // .text // ""')
PROMPT_LENGTH=${#PROMPT}
TIMESTAMP=$(echo "$INPUT" | jq -r '.timestamp // (now | tonumber)')
# Build payload for backend
PAYLOAD=$(jq -n \
--arg session_id "$SESSION_ID" \
--arg event_type "UserPromptSubmit" \
--arg prompt "$PROMPT" \
--arg prompt_length "$PROMPT_LENGTH" \
--arg timestamp "$TIMESTAMP" \
'{
session_id: $session_id,
event_type: $event_type,
tool_input: $prompt,
description: ("User submitted prompt (" + $prompt_length + " chars)"),
timestamp: ($timestamp | tonumber)
}')
# Send to backend API (asynchronous, non-blocking)
curl -X POST \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
http://localhost:8000/api/events \
--max-time 2 \
--silent \
--show-error \
> /dev/null 2>&1 &
# Exit immediately (don't wait for curl)
exit 0