#!/bin/sh
# Git commit-msg hook entry point. Invoked by git when core.hooksPath
# points at this directory (set by `node scripts/install-git-hooks.mts`
# at `pnpm install` time). Defers to the .mts implementation.

# Sanitize placeholder Socket API credentials so the .mts step's
# subprocesses (which may invoke pnpm via the sfw shim) don't 401.
for var in SOCKET_API_TOKEN SOCKET_API_KEY; do
  eval "val=\${$var}"
  if [ -n "$val" ] && ! printf '%s' "$val" | grep -q '^sktsec_'; then
    unset "$var"
  fi
done

exec node "$(dirname "$0")/commit-msg.mts" "$@"
