Skip to content

Instantly share code, notes, and snippets.

@michaelneale
Created February 2, 2025 22:13
Show Gist options
  • Save michaelneale/571f4e235e18c26f53364ffaadb18d67 to your computer and use it in GitHub Desktop.
Save michaelneale/571f4e235e18c26f53364ffaadb18d67 to your computer and use it in GitHub Desktop.
goose-check.sh
#!/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
@michaelneale
Copy link
Author

could add this to a git pre comit hook chmod +x .git/hooks/pre-commit etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment