hooks.sh 798 B

12345678910
  1. #!/bin/sh
  2. # Usage: hooks.sh banner|metrics -- runs hooks.py when python3 is 3.9 or newer.
  3. have=$(python3 -c 'import sys; sys.stdout.write("%d.%d.%d" % sys.version_info[:3]); sys.exit(3 * (sys.version_info < (3, 9)))' 2>/dev/null)
  4. case "$?:$1" in
  5. 0:metrics) python3 "$(dirname -- "$0")/hooks.py" metrics 2>/dev/null ;;
  6. 0:banner) python3 "$(dirname -- "$0")/hooks.py" banner ;;
  7. 3:banner) printf '{"systemMessage": "\\n\\u26a0\\ufe0f Claude Security needs python3 3.9 or newer, but this python3 is %s. Scanning and fixing will fail until a newer python3 is first on PATH.\\n"}' "$have" ;;
  8. *:banner) printf '%s\n' '{"systemMessage":"\n⚠️ Claude Security needs a working python3 (3.9 or newer) on PATH and could not run one. Install Python 3, then start a new session.\n"}' ;;
  9. esac
  10. exit 0