Stats
Actions
Tags
From token-guard
Pre-sync hooks for Tilt and ArgoCD that run before triggering or syncing, with a post-trigger hook for Tilt. Enables custom validation or setup before deployment operations.
2 events · 4 hooks
Where this hook configuration is defined
Defined inline in plugin.json manifest
Event handlers and matchers — expand Raw Configuration for the full JSON
ReadINPUT=$(cat); FP=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null); [ -z "$FP" ] || [ ! -f "$FP" ] && exit 0; SZ=$(stat -c%s "$FP" 2>/dev/null || stat -f%z "$FP" 2>/dev/null); [ "$SZ" -gt 102400 ] 2>/dev/null && echo "Warning: $(basename $FP) is $((SZ/1024))KB. Use limit parameter to read only what you need." || trueReadBUDGET=${CC_READ_BUDGET:-100}; WARN=${CC_READ_WARN:-50}; T=/tmp/cc-read-budget-$PPID; INPUT=$(cat); FP=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null); [ -z "$FP" ] && exit 0; C=0; if [ -f "$T" ]; then grep -qF "$FP" "$T" || echo "$FP" >> "$T"; C=$(wc -l < "$T"); else echo "$FP" > "$T"; C=1; fi; [ "$C" -ge "$BUDGET" ] && { echo "[BLOCK] Read budget reached (${BUDGET} files). Use Glob/Grep to narrow down."; exit 2; }; [ "$C" -ge "$WARN" ] && echo "Warning: ${C}/${BUDGET} files read."AgentMAX=${CC_MAX_AGENTS:-3}; T=/tmp/cc-agents-$PPID; C=0; [ -f "$T" ] && C=$(cat "$T"); C=$((C+1)); echo $C > "$T"; [ $C -gt $MAX ] && { echo "[BLOCK] Subagent limit (${MAX}). Complete existing agents first."; exit 2; }; [ $C -ge $MAX ] && echo "Warning: ${C}/${MAX} subagents spawned."{}WARN=${CC_TOKEN_BUDGET:-50000}; BLOCK=${CC_TOKEN_BLOCK:-100000}; T=/tmp/cc-tokens-$PPID; INPUT=$(cat); SZ=${#INPUT}; TK=$((SZ/4)); TOTAL=0; [ -f "$T" ] && TOTAL=$(cat "$T"); TOTAL=$((TOTAL+TK)); echo $TOTAL > "$T"; [ $TOTAL -ge $BLOCK ] && { echo "[BLOCK] Token budget exceeded (~${TOTAL}). Run /compact."; exit 2; }; [ $TOTAL -ge $WARN ] && echo "Warning: ~${TOTAL} tokens consumed (limit: ${BLOCK})."npx claudepluginhub gaebalai/cc-guard --plugin token-guard