From 2b426c6ac9cc79717b19153ef8141d9025b5a547 Mon Sep 17 00:00:00 2001 From: Haoqian Date: Wed, 24 Jun 2026 07:42:40 +0800 Subject: [PATCH] fix: make shared hooks parse in PowerShell (#265) --- hooks/claude-codex-hooks.json | 4 ++-- tests/hooks-windows.test.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/hooks/claude-codex-hooks.json b/hooks/claude-codex-hooks.json index 483c3e1..804ce4a 100644 --- a/hooks/claude-codex-hooks.json +++ b/hooks/claude-codex-hooks.json @@ -6,7 +6,7 @@ "hooks": [ { "type": "command", - "command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\" || exit 0", + "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-activate.js\"; exit 0", "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-activate.js\" }", "timeout": 5, "statusMessage": "Loading ponytail mode..." @@ -19,7 +19,7 @@ "hooks": [ { "type": "command", - "command": "command -v node >/dev/null 2>&1 && node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\" || exit 0", + "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js\"; exit 0", "commandWindows": "if (Get-Command node -ErrorAction SilentlyContinue) { node \"$env:CLAUDE_PLUGIN_ROOT\\hooks\\ponytail-mode-tracker.js\" }", "timeout": 5, "statusMessage": "Tracking ponytail mode..." diff --git a/tests/hooks-windows.test.js b/tests/hooks-windows.test.js index b72f357..de2934c 100644 --- a/tests/hooks-windows.test.js +++ b/tests/hooks-windows.test.js @@ -18,6 +18,8 @@ const HOST_PLUGIN_MANIFESTS = [ ]; // cmd.exe variable syntax (%FOO%); PowerShell leaves it literal, breaking the path. const CMD_VAR_SYNTAX = /%[A-Za-z_][A-Za-z0-9_]*%/; +// PowerShell 5.1 rejects these POSIX shell guards when a host runs `command`. +const POSIX_GUARD_SYNTAX = /\bcommand\s+-v\b|&&|\|\||>\/dev\/null|2>&1/; // Pull the hooks/