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/session-log.sh
Executable file
18
crates/codegen/xai-grok-hooks/examples/hooks/bin/session-log.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# session-log.sh — append session events to an audit log
|
||||
#
|
||||
# Reads the hook envelope from stdin and appends a one-line JSON entry
|
||||
# to ~/.grok/session-audit.log with event name, session ID, cwd, and
|
||||
# timestamp.
|
||||
|
||||
INPUT=$(cat)
|
||||
|
||||
EVENT=$(echo "$INPUT" | grep -o '"hookEventName":"[^"]*"' | sed 's/"hookEventName":"//;s/"$//')
|
||||
SESSION=$(echo "$INPUT" | grep -o '"sessionId":"[^"]*"' | sed 's/"sessionId":"//;s/"$//')
|
||||
CWD=$(echo "$INPUT" | grep -o '"cwd":"[^"]*"' | sed 's/"cwd":"//;s/"$//')
|
||||
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
LOG_FILE="${HOME}/.grok/session-audit.log"
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
echo "{\"timestamp\":\"${TIMESTAMP}\",\"event\":\"${EVENT}\",\"session\":\"${SESSION}\",\"cwd\":\"${CWD}\"}" >> "$LOG_FILE"
|
||||
Loading…
Reference in a new issue