Files
Neo-ZQYY/.kiro/hooks/cwd-guard-shell.kiro.hook

16 lines
817 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"enabled": true,
"name": "CWD Guard for Shell",
"description": "在 AI 执行 shell 命令前,检查是否在运行 Python 脚本。如果是,提醒 AI 确认 cwd 是否正确(仓库根 C:\\NeoZQYY避免相对路径解析到错误位置。",
"version": "1",
"when": {
"type": "preToolUse",
"toolTypes": [
"shell"
]
},
"then": {
"type": "askAgent",
"prompt": "如果即将执行的命令包含 `python` 且涉及 scripts/ops/、.kiro/scripts/、apps/etl/connectors/feiqiu/scripts/ 下的脚本请确认1) cwd 参数是否设置为仓库根目录 C:\\NeoZQYY2) 脚本是否已有 ensure_repo_root() 校验。如果 cwd 不对且脚本无校验,请修正 cwd 后再执行。对于非 Python 命令或不涉及上述目录的命令,直接放行。"
}
}