[security-guidance] 在 Windows 上,当 python3 是 Python 安装管理器别名时,每个钩子都会以 ENOENT 失败;停止钩子的 asyncRewake 循环永远无法结束

作者: MK-AIFy创建于 2026年9月16日更新于 2026年9月16日

1. sg-ZZTERM19ZZ.sh: require that the interpreter can actually see the hook script, and prefer registered full-path installs over PATH names.

bash
hook_script="$1"

can_see_hook() {  # $@ = interpreter command
    "$@" -c 'import os, sys; sys.exit(0 if os.path.exists(sys.argv[1]) else 1)' "$hook_script" 2>/dev/null
}

try_exec() {       # $@ = interpreter command

内容来源: anthropics/claude-plugins-official