Roo-Code/.husky/pre-commit
2025-05-21 21:01:20 -07:00

30 lines
791 B
Text

branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ]; then
echo "You can't commit directly to main - please check out a branch."
exit 1
fi
# Detect if running on Windows and use pnpm.cmd, otherwise use pnpm.
if [ "$OS" = "Windows_NT" ]; then
pnpm_cmd="pnpm.cmd"
else
pnpm_cmd="pnpm"
fi
"$pnpm_cmd" --filter roo-cline generate-types
if [ -n "$(git diff --name-only src/exports/roo-code.d.ts)" ]; then
echo "Error: There are unstaged changes to roo-code.d.ts after running 'pnpm --filter roo-cline generate-types'."
echo "Please review and stage the changes before committing."
exit 1
fi
# Detect if running on Windows and use npx.cmd, otherwise use npx.
if [ "$OS" = "Windows_NT" ]; then
npx_cmd="npx.cmd"
else
npx_cmd="npx"
fi
"$npx_cmd" lint-staged