- Get an API key from https://aistudio.google.com/apikey
- Place
ask-gemini.shat.claude/ask-gemini.sh - Place
ask-gemini.mdat.claude/commands/ask-gemini.sh - In
claude, type something like/ask-gemini Are there any bugs in this code base?
Created
June 27, 2025 19:38
-
-
Save segeljakt/406fd7d195e92c9944498705bf400c35 to your computer and use it in GitHub Desktop.
In the root of the repo, run the command .claude/ask-gemini.sh $ARGUMENTS and handle the output.
This file contains hidden or 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/bash | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <text>" | |
| exit 1 | |
| fi | |
| gather_files() { | |
| local base=$(basename $(pwd)) | |
| fd --type file --exclude vendor --exclude '*test*' \ | |
| --glob '{*.go,*.py,*.rs,*.env,*.toml,*.md,*.mod,*.yaml,*.sh,Makefile}' | \ | |
| while read -r file; do | |
| echo "// $base/$file" | |
| cat "$file" | |
| echo | |
| done | |
| } | |
| send_to_gemini() { | |
| local prompt="$1" | |
| curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=$GEMINI_API_KEY" \ | |
| -H 'Content-Type: application/json' \ | |
| -X POST \ | |
| -d "$(jq -n --arg text "$prompt" '{contents: [{parts: [{text: $text}]}]}')" \ | |
| | jq -r '.candidates[0].content.parts[0].text' | |
| } | |
| file_contents=$(gather_files) | |
| full_prompt="$file_contents"$'\n'"$*" | |
| send_to_gemini "$full_prompt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment