Created
February 2, 2025 22:13
-
-
Save michaelneale/571f4e235e18c26f53364ffaadb18d67 to your computer and use it in GitHub Desktop.
goose-check.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Run Goose AI check on staged files | |
files=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.txt$|\.md$|\.rst$') | |
if [ -z "$files" ]; then | |
exit 0 | |
fi | |
echo "Running Goose AI spell check..." | |
for file in $files; do | |
content=$(git show :$file) | |
result=$(echo "$content" | goose run --text "please check unchanged for spelling errors and obvious mistakes and fail if found") | |
if echo "$result" | grep -qi "fail"; then | |
echo "Goose AI detected errors in $file" | |
exit 1 | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
could add this to a git pre comit hook
chmod +x .git/hooks/pre-commit
etc