Skip to content

Add Gemini CLI provider support and fix output parsing issues#36

Merged
m7medVision merged 2 commits intom7medVision:mainfrom
stn1slv:main
Apr 6, 2026
Merged

Add Gemini CLI provider support and fix output parsing issues#36
m7medVision merged 2 commits intom7medVision:mainfrom
stn1slv:main

Conversation

@stn1slv
Copy link
Copy Markdown
Contributor

@stn1slv stn1slv commented Apr 5, 2026

This pull request adds support for the Gemini CLI as an AI provider for generating commit messages and PR titles, alongside existing providers like Anthropic and Copilot. It also refactors the provider output parsing logic for better maintainability and testability. The most important changes are grouped below:

Gemini Provider Integration:

  • Adds a new GeminiProvider in internal/provider/gemini.go, enabling commit message and PR title generation using the Gemini CLI, including CLI invocation, prompt construction, and output parsing.
  • Updates CLI commands and interactive config to support Gemini as a selectable provider, including default model and suggestion count, and ensures Gemini does not require an API key or endpoint. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Ensures Gemini is properly referenced in the README and configuration defaults. [1] [2]

Provider Output Parsing Refactor:

  • Extracts and centralizes output parsing logic into a new parseOutputLines function in internal/provider/common.go, which strips markdown, list prefixes, and skips empty/long lines.
  • Adds comprehensive unit tests for parseOutputLines to ensure robust handling of various output formats.

Anthropic Provider Refactor:

  • Refactors the Anthropic provider to use the new parseOutputLines function and move CLI execution into a reusable runCLI helper, reducing code duplication and improving maintainability. [1] [2]

Configuration and Defaults:

  • Sets up default model and suggestion count for Gemini in the configuration system, and ensures endpoint handling is consistent with other CLI-based providers. [1] [2]

These changes collectively make it easy to use the Gemini CLI for AI-powered commit and PR title suggestions, while improving code clarity and maintainability.

stn1slv added 2 commits April 5, 2026 16:39
- Introduce new Gemini provider for generating commit messages and PR reviews.
- Update configuration wizard to support Gemini model selection and options.
- Add supported Gemini models (Flash, Pro, Flash Lite, etc.) to the models package.
- Update README.md with configuration instructions for the new provider.
- Extract parseOutputLines() helper into common.go, shared by both
  Anthropic and Gemini providers, replacing four copies of identical logic
- Fix multi-digit numbered list stripping (e.g. "10. message" was broken)
- Separate stderr from stdout in CLI exec; only stdout is parsed for
  messages, stderr is included in error output on failure
- Add table-driven tests covering all parsing edge cases
@m7medVision m7medVision merged commit b10cebf into m7medVision:main Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants