#!/bin/sh
# Validate conventional commit format with mandatory scope.
if ! head -n 1 "$1" | grep -qE '^(feat|fix|build|chore|docs|style|ci|refactor|perf|test|revert)\([a-z0-9][a-z0-9./-]*\)!?: [^[:space:]](.*[^[:space:]])?$'; then
    echo "Error: Invalid commit message format."
    echo "Required: type(scope): description"
    echo "Example: feat(cache): add bounded cache"
    exit 1
fi
