-
Notifications
You must be signed in to change notification settings - Fork 19
Fix #39: Update Gemini API key references #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Replaces Google API key references with Gemini. - Updates environment variable names and scrubber patterns.
Fix DFanso#39: Update Gemini API key references
WalkthroughThe provider identifier and environment variable for Google were replaced with Gemini in the commit message tool. The scrubber’s label and redaction token were renamed from Google to Gemini without changing the regex. Corresponding tests were updated to reflect the Gemini key name and redaction string. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Hook as commit-msg tool
participant Env as Environment
participant Gemini as Gemini Provider
participant Other as Other Providers (chatgpt/claude/grok)
participant Git as Git
Dev->>Hook: Run commit-msg hook
Hook->>Env: Read COMMIT_LLM
alt COMMIT_LLM == "gemini"
Hook->>Env: Read GEMINI_API_KEY
alt GEMINI_API_KEY present
Hook->>Gemini: GenerateCommitMessage(diff)
Gemini-->>Hook: message / error
opt On success
Hook->>Git: Write commit message
end
opt On error
Hook-->>Dev: Exit with error
end
else missing key
Hook-->>Dev: Error: GEMINI_API_KEY is not set
end
else COMMIT_LLM in {chatgpt, claude, grok}
Hook->>Other: GenerateCommitMessage(diff)
Other-->>Hook: message / error
Hook->>Git: Write or error
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/scrubber/scrubber_test.go (1)
30-32: Consider adding a test case for backward compatibility.While the Gemini test case is correct, the scrubber pattern (line 67 in
internal/scrubber/scrubber.go) still matchesGOOGLE_API_KEYfor backward compatibility. Consider adding a test case to verify that legacyGOOGLE_API_KEYreferences are still properly detected and redacted.Add this test case to verify backward compatibility:
{ name: "Gemini API key", input: `GEMINI_API_KEY="AIzaSyDabcdefghijklmnopqrstuvwxyz12345"`, expected: `GEMINI_API_KEY="[REDACTED_GEMINI_API_KEY]"`, }, + { + name: "Google API key (legacy)", + input: `GOOGLE_API_KEY="AIzaSyDabcdefghijklmnopqrstuvwxyz12345"`, + expected: `GOOGLE_API_KEY="[REDACTED_GEMINI_API_KEY]"`, + }, { name: "Claude API key", input: `CLAUDE_API_KEY=sk-ant-api03-abcdefghijklmnopqrst`, expected: `CLAUDE_API_KEY="[REDACTED_CLAUDE_KEY]"`, },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
cmd/commit-msg/main.go(2 hunks)internal/scrubber/scrubber.go(1 hunks)internal/scrubber/scrubber_test.go(1 hunks)
🔇 Additional comments (2)
internal/scrubber/scrubber.go (1)
66-68: LGTM! Backward compatibility maintained.The pattern correctly continues to match both
GOOGLE_API_KEYandGEMINI_API_KEY(line 67), ensuring that legacy references are still caught and scrubbed. Both will now be redacted as[REDACTED_GEMINI_API_KEY], which is appropriate given that Gemini is Google's AI product.cmd/commit-msg/main.go (1)
115-115: LGTM! Consistent with the case statement.The condition correctly checks for the
"gemini"provider, maintaining consistency with the case statement changes on line 26.
| case "gemini": | ||
| apiKey = os.Getenv("GEMINI_API_KEY") | ||
| if apiKey == "" { | ||
| log.Fatalf("GOOGLE_API_KEY is not set") | ||
| log.Fatalf("GEMINI_API_KEY is not set") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Breaking change: Document migration path for users.
This change renames the LLM provider from "google" to "gemini" and the environment variable from GOOGLE_API_KEY to GEMINI_API_KEY. Existing users will need to:
- Update
COMMIT_LLMfrom"google"to"gemini" - Rename the environment variable from
GOOGLE_API_KEYtoGEMINI_API_KEY
Ensure this migration is documented in release notes, README, or a migration guide.
Run the following script to check for references to the old naming that may need updates in documentation:
🏁 Script executed:
#!/bin/bash
# Description: Find references to "google" provider and GOOGLE_API_KEY in documentation
# Search for references to the old "google" provider name
echo "=== Searching for 'google' provider references in docs ==="
rg -i --type=md 'COMMIT_LLM.*google|provider.*google' -C 3
# Search for GOOGLE_API_KEY references
echo "=== Searching for GOOGLE_API_KEY references ==="
rg 'GOOGLE_API_KEY' --type=md -C 3
# Search in README files
echo "=== Checking README files ==="
fd -e md -e txt README --exec cat {}Length of output: 6678
Document migration path for renaming from google to gemini.
Add a note in the README or release notes that users upgrading from previous versions must rename:
COMMIT_LLM=google→COMMIT_LLM=geminiGOOGLE_API_KEY→GEMINI_API_KEY
🤖 Prompt for AI Agents
In cmd/commit-msg/main.go around lines 26 to 29, the launcher now reads
GEMINI_API_KEY for the "gemini" case but there is no documented migration
guidance for users of the prior "google" configuration; update the project
README (or release notes) to document the rename steps: instruct users to change
COMMIT_LLM=google → COMMIT_LLM=gemini and rename environment variable
GOOGLE_API_KEY → GEMINI_API_KEY, include an example snippet showing both old and
new settings and a short note about when this change was introduced
(version/release) so upgrading users can apply the migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adeeshperera can u check this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
DFanso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊
Summary by CodeRabbit
New Features
Refactor
Chores