use-mcp/scripts/pre-commit
Glen Maddern 0ea0bc48c6
Oauth tests (#13)
* Moving the non-authed cfagents tests to /public

* Added OAuth CF Agents tests

---------

Co-authored-by: Glen Maddern <glen@glenmaddern.com>
2025-07-01 13:26:26 +10:00

24 lines
No EOL
668 B
Shell
Executable file

#!/bin/sh
# Pre-commit hook to run prettier on staged files
# This hook is called by "git commit" and formats only the files being committed.
echo "Running prettier on staged files..."
# Get list of staged files that prettier can handle
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx|json|css|scss|md)$' | tr '\n' ' ')
if [ -z "$STAGED_FILES" ]; then
echo "No staged files need formatting."
exit 0
fi
echo "Formatting files: $STAGED_FILES"
# Run prettier on staged files
pnpm prettier --write $STAGED_FILES
# Add the formatted files back to staging
git add $STAGED_FILES
echo "Prettier formatting completed."