From 1b571d7e0a0f402c44ec9737a9ba4fc28557f032 Mon Sep 17 00:00:00 2001 From: David <37255403+Classy-Bear@users.noreply.github.com> Date: Sat, 11 Jul 2026 11:53:59 -0400 Subject: [PATCH] fix(codex): skip bash write gate on Windows --- .github/workflows/tests.yml | 2 +- hooks/hooks.json | 1 + tests/test_hooks_config.py | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/test_hooks_config.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8940934..1fcc57f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,4 +22,4 @@ jobs: run: python3 -m pip install --user pytest - name: Run Python tests - run: python3 -m pytest tests/test_session_parser.py tests/test_posthog_llma.py + run: python3 -m pytest tests/test_session_parser.py tests/test_posthog_llma.py tests/test_hooks_config.py diff --git a/hooks/hooks.json b/hooks/hooks.json index fa517ba..e3ed81f 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -19,6 +19,7 @@ { "type": "command", "command": "${CLAUDE_PLUGIN_ROOT:-$PLUGIN_ROOT}/hooks/gate-exec-write.sh", + "commandWindows": "cmd /d /c exit 0", "timeout": 5 } ] diff --git a/tests/test_hooks_config.py b/tests/test_hooks_config.py new file mode 100644 index 0000000..90d9047 --- /dev/null +++ b/tests/test_hooks_config.py @@ -0,0 +1,12 @@ +import json +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] + + +def test_codex_windows_skips_the_bash_only_pre_tool_gate(): + config = json.loads((ROOT / "hooks" / "hooks.json").read_text(encoding="utf-8")) + handler = config["hooks"]["PreToolUse"][0]["hooks"][0] + + assert handler["commandWindows"] == "cmd /d /c exit 0"