Fix Codex PreToolUse hook failing on Windows
Replace bash-only [ -f ] file check with a cross-platform Python one-liner so the hook works on Windows where cmd.exe has no [ builtin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a4149dffcd
commit
8c9ee1818b
@@ -718,10 +718,14 @@ _CODEX_HOOK = {
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
# Use Python for the file check so the hook works on Windows
|
||||
# (cmd.exe has no [ -f ] builtin; Python is always available).
|
||||
"command": (
|
||||
"[ -f graphify-out/graph.json ] && "
|
||||
r"""echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files."}}' """
|
||||
"|| true"
|
||||
"python3 -c \""
|
||||
"import pathlib,json,sys; "
|
||||
"p=pathlib.Path('graphify-out/graph.json'); "
|
||||
r"print(json.dumps({'hookSpecificOutput':{'hookEventName':'PreToolUse','additionalContext':'graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files.'}})) if p.exists() else None"
|
||||
"\""
|
||||
),
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user