#!/usr/bin/env bash set -euo pipefail # Local commit-msg hook using commitlint via npx (no Docker/GHCR auth required). # Usage: scripts/commit-msg.sh MSG_FILE="${1:?path to commit message file required}" if ! command -v npx >/dev/null 2>&1; then echo "npx not found. Install Node.js and run: npm install --save-dev @commitlint/cli" >&2 exit 1 fi # Ensure commitlint is available (installed as devDependency) if ! npx --yes @commitlint/cli@latest --help >/dev/null 2>&1; then echo "Install commitlint locally: npm install --save-dev @commitlint/cli" >&2 exit 1 fi npx --yes @commitlint/cli@latest --config .commitlintrc.yml --edit "${MSG_FILE}"