Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions examples/title/title.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ set -euo pipefail
# Read JSON payload from stdin
DATA=$(cat)

# Extract fields using jq
eval $(echo "$DATA" | jq -r '
"STATE=\"\(.agent_state // "idle")\"
CWD=\"\(.workspace.current_dir // "")\"
"
' 2>/dev/null || echo 'STATE="idle" CWD=""')
# Extract fields using jq safely without eval
{
read -r STATE
read -r CWD
} <<< "$(
echo "$DATA" | jq -r '
(.agent_state // "idle"),
(.workspace.current_dir // "")
' 2>/dev/null || printf "idle\n\n"
)"

# Try to extract CitC workspace name from CWD
if [ -n "$CWD" ]; then
Expand Down