Skip to content

Conversation

@adeeshperera
Copy link
Contributor

@adeeshperera adeeshperera commented Oct 4, 2025

  • Replaces Google API key references with Gemini.
  • Updates environment variable names and scrubber patterns.
image

Summary by CodeRabbit

  • New Features

    • Commit message generation now supports the Gemini provider. Select it via COMMIT_LLM=gemini.
  • Refactor

    • Configuration updated to use GEMINI_API_KEY instead of GOOGLE_API_KEY.
  • Chores

    • Secret scrubbing updated to recognize and redact Gemini API keys, with labels reflecting the Gemini provider.

adeeshperera and others added 2 commits October 4, 2025 22:24
- Replaces Google API key references with Gemini.
- Updates environment variable names and scrubber patterns.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Walkthrough

The 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

Cohort / File(s) Summary
Commit message provider switch
cmd/commit-msg/main.go
Replaced provider "google" with "gemini"; updated env var from GOOGLE_API_KEY to GEMINI_API_KEY and related error text; changed COMMIT_LLM check to "gemini" for gemini.GenerateCommitMessage.
Scrubber patterns and tests
internal/scrubber/scrubber.go, internal/scrubber/scrubber_test.go
Renamed scrubber entry label and redaction token from Google to Gemini; kept regex unchanged; adjusted tests to expect Gemini naming and redaction marker.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

go, good first issue

Suggested reviewers

  • DFanso

Poem

A hop, a skip, I tweak the key—
From Google’s burrow to Gemini’s tree.
Env winds whisper: set it right,
Or carrots vanish in the night.
Commit notes bloom, concise and airy—
Thump-thump! Approved by this happy hare-y. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title clearly indicates the primary change of updating API key references to use Gemini and references the relevant issue, matching the code modifications that replace Google API key usage with Gemini. It is concise, specific, and gives reviewers a clear understanding of the pull request’s intent without unnecessary detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@DFanso DFanso self-requested a review October 4, 2025 17:01
@DFanso DFanso added documentation Improvements or additions to documentation good first issue Good for newcomers hacktoberfest Eligible for Hacktoberfest labels Oct 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 matches GOOGLE_API_KEY for backward compatibility. Consider adding a test case to verify that legacy GOOGLE_API_KEY references 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b3ae6e and ea4a548.

📒 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_KEY and GEMINI_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.

Comment on lines +26 to +29
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")
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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:

  1. Update COMMIT_LLM from "google" to "gemini"
  2. Rename the environment variable from GOOGLE_API_KEY to GEMINI_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=googleCOMMIT_LLM=gemini
  • GOOGLE_API_KEYGEMINI_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.

Copy link
Owner

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

Copy link
Contributor

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!

Copy link
Owner

@DFanso DFanso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎊

@DFanso DFanso merged commit e4248b2 into DFanso:main Oct 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation good first issue Good for newcomers hacktoberfest Eligible for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants