commit-msg•526 B
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
echo "🔍 Validating commit message..."
# Check commit message format
commit_regex='^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,50}'
if ! grep -qE "$commit_regex" < "$1"; then
echo "❌ Invalid commit message format!"
echo "Format: <type>[optional scope]: <description>"
echo "Types: feat, fix, docs, style, refactor, test, chore"
echo "Example: feat(auth): add user authentication"
exit 1
fi
echo "✅ Commit message format is valid!"