#!/usr/bin/env sh
# Validate commit message with commitlint
# Add common bun installation paths to PATH
export PATH="$HOME/.bun/bin:$PATH"
if ! bun x commitlint --edit "$1"; then
echo "Commit message validation failed."
echo "Please use the Conventional Commits format:\n"
echo " <type>(<scope>): <subject>\n"
echo "Where:\n <type> is one of: build, chore, ci, doc, feat, fix, perf, refactor, style, test\n <scope> is optional and should be lower-case (e.g., package or feature name)\n <subject> should be a concise description in the imperative mood (no period at end)\n"
echo "Examples:\n feat(core): add support for custom dictionaries\n fix(website): correct broken 404 layout\n chore: update lockfile\n"
exit 1
fi