[PR #28] feat: add Google Gemini provider support #27

Open
opened 2026-02-27 19:20:58 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/f/git-rewrite-commits/pull/28

State: open
Merged: No


What

Adds Google Gemini as a fourth AI provider alongside OpenAI, Ollama, and
Claude Code. Default model is gemini-2.5-flash-lite.

Changes

New provider

  • src/providers/gemini.tsGeminiProvider using @google/generative-ai
    with temperature: 0.3 and maxOutputTokens: 200

Wiring

  • src/providers/types.ts — added 'gemini' to ProviderOptions.provider
    union type
  • src/providers/index.ts — factory routes to GeminiProvider, reads
    GEMINI_API_KEY env var
  • src/index.ts — added 'gemini' to RewriteOptions.provider union type,
    added gemini-2.5-flash-lite to default model resolution chain, fixed
    execCommand to use stdio: ['pipe', 'pipe', 'pipe']

CLI

  • src/cli.ts — updated --provider description, --api-key description,
    --model description; added Gemini API key validation error, informational
    message, help text, and usage examples

Other

  • .env.example — added GEMINI_API_KEY entry
  • package.json — added @google/generative-ai ^0.24.1 dependency

Usage

export GEMINI_API_KEY="your-api-key"
git-rewrite-commits --provider gemini

# or with a specific model
git-rewrite-commits --provider gemini --model gemini-2.5-flash-lite
**Original Pull Request:** https://github.com/f/git-rewrite-commits/pull/28 **State:** open **Merged:** No --- ## What Adds Google Gemini as a fourth AI provider alongside OpenAI, Ollama, and Claude Code. Default model is `gemini-2.5-flash-lite`. ## Changes **New provider** - `src/providers/gemini.ts` — `GeminiProvider` using `@google/generative-ai` with `temperature: 0.3` and `maxOutputTokens: 200` **Wiring** - `src/providers/types.ts` — added `'gemini'` to `ProviderOptions.provider` union type - `src/providers/index.ts` — factory routes to `GeminiProvider`, reads `GEMINI_API_KEY` env var - `src/index.ts` — added `'gemini'` to `RewriteOptions.provider` union type, added `gemini-2.5-flash-lite` to default model resolution chain, fixed `execCommand` to use `stdio: ['pipe', 'pipe', 'pipe']` **CLI** - `src/cli.ts` — updated `--provider` description, `--api-key` description, `--model` description; added Gemini API key validation error, informational message, help text, and usage examples **Other** - `.env.example` — added `GEMINI_API_KEY` entry - `package.json` — added `@google/generative-ai ^0.24.1` dependency ## Usage ```bash export GEMINI_API_KEY="your-api-key" git-rewrite-commits --provider gemini # or with a specific model git-rewrite-commits --provider gemini --model gemini-2.5-flash-lite
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-rewrite-commits#27
No description provided.