diff --git a/.gemini/hooks/before-model.sh b/.gemini/hooks/before-model.sh index 105b851..7e8d01c 100644 --- a/.gemini/hooks/before-model.sh +++ b/.gemini/hooks/before-model.sh @@ -19,7 +19,7 @@ CURRENT_PHASE=$(grep -m1 "^## Current Phase" "$PLAN_FILE" 2>/dev/null || grep -m if [ -n "$CURRENT_PHASE" ]; then PYTHON=$(command -v python3 || command -v python) ESCAPED=$($PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" <<< "[planning-with-files] Current: $CURRENT_PHASE" 2>/dev/null || echo "\"\"") - echo "{\"additionalContext\":$ESCAPED}" + printf '%s\n' "{\"additionalContext\":$ESCAPED}" else echo '{}' fi diff --git a/.gemini/hooks/before-tool.sh b/.gemini/hooks/before-tool.sh index dce5062..6dffe94 100644 --- a/.gemini/hooks/before-tool.sh +++ b/.gemini/hooks/before-tool.sh @@ -23,7 +23,7 @@ PYTHON=$(command -v python3 || command -v python) if [ -n "$PYTHON" ]; then ESCAPED=$($PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" <<< "$CONTEXT" 2>/dev/null) if [ -n "$ESCAPED" ] && [ "$ESCAPED" != "\"\"" ]; then - echo "{\"systemMessage\":$ESCAPED}" + printf '%s\n' "{\"systemMessage\":$ESCAPED}" exit 0 fi fi diff --git a/.gemini/hooks/session-end.sh b/.gemini/hooks/session-end.sh index 4cafe5d..ddae00e 100644 --- a/.gemini/hooks/session-end.sh +++ b/.gemini/hooks/session-end.sh @@ -19,7 +19,7 @@ if [ -f "$SCRIPT_DIR/check-complete.sh" ]; then if [ -n "$RESULT" ]; then PYTHON=$(command -v python3 || command -v python) ESCAPED=$($PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" <<< "$RESULT" 2>/dev/null || echo "\"\"") - echo "{\"systemMessage\":$ESCAPED}" + printf '%s\n' "{\"systemMessage\":$ESCAPED}" exit 0 fi fi diff --git a/.gemini/hooks/session-start.sh b/.gemini/hooks/session-start.sh index ce7174f..18a736c 100644 --- a/.gemini/hooks/session-start.sh +++ b/.gemini/hooks/session-start.sh @@ -24,7 +24,7 @@ fi if [ -n "$CATCHUP" ]; then ESCAPED=$($PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" <<< "$CATCHUP" 2>/dev/null || echo "\"[planning-with-files] Session recovery data available. Read task_plan.md, progress.md, and findings.md.\"") - echo "{\"hookSpecificOutput\":{\"additionalContext\":$ESCAPED}}" + printf '%s\n' "{\"hookSpecificOutput\":{\"additionalContext\":$ESCAPED}}" else echo '{"hookSpecificOutput":{"additionalContext":"[planning-with-files] Active plan detected. Read task_plan.md, progress.md, and findings.md before proceeding."}}' fi diff --git a/.github/hooks/scripts/error-occurred.sh b/.github/hooks/scripts/error-occurred.sh index 5a64805..ebe4364 100644 --- a/.github/hooks/scripts/error-occurred.sh +++ b/.github/hooks/scripts/error-occurred.sh @@ -34,7 +34,7 @@ except: if [ -n "$ERROR_MSG" ]; then CONTEXT="[planning-with-files] Error detected: ${ERROR_MSG}. Log this error in task_plan.md under Errors Encountered with the attempt number and resolution." ESCAPED=$($PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" <<< "$CONTEXT" 2>/dev/null || echo "\"\"") - echo "{\"hookSpecificOutput\":{\"hookEventName\":\"ErrorOccurred\",\"additionalContext\":$ESCAPED}}" + printf '%s\n' "{\"hookSpecificOutput\":{\"hookEventName\":\"ErrorOccurred\",\"additionalContext\":$ESCAPED}}" else echo '{}' fi diff --git a/.github/hooks/scripts/pre-tool-use.sh b/.github/hooks/scripts/pre-tool-use.sh index 1a426af..019cffc 100755 --- a/.github/hooks/scripts/pre-tool-use.sh +++ b/.github/hooks/scripts/pre-tool-use.sh @@ -33,5 +33,5 @@ done [ -z "$PYTHON" ] && PYTHON=$(command -v python3 2>/dev/null || command -v python 2>/dev/null) ESCAPED=$(echo "$CONTEXT" | $PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" 2>/dev/null || echo "\"\"") -echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":$ESCAPED}}" +printf '%s\n' "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":$ESCAPED}}" exit 0 diff --git a/.github/hooks/scripts/session-start.sh b/.github/hooks/scripts/session-start.sh index d7a0114..5855324 100755 --- a/.github/hooks/scripts/session-start.sh +++ b/.github/hooks/scripts/session-start.sh @@ -45,5 +45,5 @@ fi # Escape context for JSON ESCAPED=$(echo "$CONTEXT" | $PYTHON -c "import sys,json; print(json.dumps(sys.stdin.read(), ensure_ascii=False))" 2>/dev/null || echo "\"\"") -echo "{\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":$ESCAPED}}" +printf '%s\n' "{\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":$ESCAPED}}" exit 0