Skip to content

Commit 2aac701

Browse files
Chhinnaclaude
andcommitted
Guard node execution in pre-push hook for environments without Node
Apply CodeAnt review fix: check `command -v node` before attempting to run the CLI via node, so the hook falls back to the global `codeant` command when Node isn't on PATH. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8b82b97 commit 2aac701

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/utils/installPushProtectionHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function buildHookBlock(cliPath) {
2828
# Reopen stdin from terminal so the CLI can show an interactive bypass prompt.
2929
# In non-interactive environments (CI), this silently fails and the push is blocked.
3030
exec < /dev/tty 2>/dev/null || true
31-
if [ -f "${cliPath}" ]; then
31+
if [ -f "${cliPath}" ] && command -v node >/dev/null 2>&1; then
3232
node "${cliPath}" secrets --committed --hook
3333
else
3434
command -v codeant >/dev/null 2>&1 || exit 0

0 commit comments

Comments
 (0)