Publish harness and TUI open-source
initial sync from the monorepo
This commit is contained in:
commit
c68e39f604
2734 changed files with 1437016 additions and 0 deletions
18
crates/codegen/xai-grok-hooks/examples/hooks/bin/tool-logger.sh
Executable file
18
crates/codegen/xai-grok-hooks/examples/hooks/bin/tool-logger.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# tool-logger.sh — log tool calls to a local activity file
|
||||
#
|
||||
# Reads the hook envelope from stdin and appends a one-line JSON entry
|
||||
# to ~/.grok/tool-activity.log with event name, tool name, and timestamp.
|
||||
# `toolName` is the resolved tool (e.g. `linear__save_issue` for MCP calls).
|
||||
|
||||
INPUT=$(cat)
|
||||
|
||||
EVENT=$(echo "$INPUT" | grep -o '"hookEventName":"[^"]*"' | sed 's/"hookEventName":"//;s/"$//')
|
||||
TOOL=$(echo "$INPUT" | grep -o '"toolName":"[^"]*"' | head -1 | sed 's/"toolName":"//;s/"$//')
|
||||
BACKGROUNDED=$(echo "$INPUT" | grep -o '"isBackgrounded":[a-z]*' | sed 's/"isBackgrounded"://')
|
||||
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
LOG_FILE="${HOME}/.grok/tool-activity.log"
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
echo "{\"timestamp\":\"${TIMESTAMP}\",\"event\":\"${EVENT}\",\"tool\":\"${TOOL}\",\"backgrounded\":${BACKGROUNDED:-false}}" >> "$LOG_FILE"
|
||||
Loading…
Reference in a new issue