BMAD-METHOD/.husky/pre-commit

19 lines
405 B
Bash
Executable File

#!/usr/bin/env sh
# Auto-fix changed files and stage them
npx --no-install lint-staged
# Validate everything
npm test
# Validate docs links only when docs change
if command -v rg >/dev/null 2>&1; then
if git diff --cached --name-only | rg -q '^docs/'; then
npm run docs:validate-links
fi
else
if git diff --cached --name-only | grep -Eq '^docs/'; then
npm run docs:validate-links
fi
fi