gelf is a Go-based CLI tool that automatically generates Git commit messages and provides AI-powered code reviews using Vertex AI (Gemini). It analyzes git changes and provides intelligent feedback through a modern, interactive TUI interface built with Bubble Tea.
- π€ AI-Powered: Intelligent commit message generation using Vertex AI (Gemini)
- π Code Review: AI-powered code review with streaming real-time feedback
- π¨ Clean TUI: Simple and intuitive user interface built with Bubble Tea
- β‘ Fast Processing: Real-time progress indicators and streaming responses
- π‘οΈ Safe Operations: Only operates on staged changes for secure workflow
- π Cross-Platform: Works seamlessly across different operating systems
- π Multi-language Support: Generate commit messages and code reviews in multiple languages
- Go 1.24.3 or higher
- Google Cloud account with Vertex AI API enabled
- Git (required for commit operations)
git clone https://github.com/EkeMinusYou/gelf.git
cd gelf
go build
go install github.com/EkeMinusYou/gelf@latest
brew tap ekeminusyou/gelf
brew install ekeminusyou/gelf/gelf
gelf supports both configuration files and environment variables. Configuration files provide a more organized approach for managing settings.
Create a gelf.yml
file in one of the following locations (in order of priority):
./gelf.yml
- Project-specific configuration$XDG_CONFIG_HOME/gelf/gelf.yml
- XDG config directory~/.config/gelf/gelf.yml
- Default XDG config location~/.gelf.yml
- Legacy home directory location
vertex_ai:
project_id: "your-gcp-project-id"
location: "us-central1" # optional, default: us-central1
model:
flash: gemini-2.5-flash
pro: gemini-2.5-pro
language: "english" # optional, default: english
commit:
model: "flash" # optional, default: flash
language: "english" # optional, inherits from global language
review:
model: "pro" # optional, default: pro
language: "english" # optional, inherits from global language
color: "always" # optional, default: always
You can also configure using environment variables:
# Path to your service account key file (gelf-specific, takes priority)
export GELF_CREDENTIALS="/path/to/your/service-account-key.json"
# Alternative: Standard Google Cloud credentials (used if GELF_CREDENTIALS is not set)
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-key.json"
# Google Cloud project ID
export VERTEXAI_PROJECT="your-project-id"
# Vertex AI location (optional, default: us-central1)
export VERTEXAI_LOCATION="us-central1"
Note: Model configuration and language settings can only be configured via configuration file, not environment variables.
- Create a service account in Google Cloud Console
- Grant the "Vertex AI User" role
- Download the JSON key file
- Set the
GELF_CREDENTIALS
environment variable to the file path (recommended) or useGOOGLE_APPLICATION_CREDENTIALS
- Stage your changes:
git add .
- Generate and commit with AI:
gelf commit
- Interactive TUI operations:
- Review the AI-generated commit message
- Press
y
to approve orn
to cancel - Press
e
to edit the commit message - Press
q
orCtrl+C
to cancel during generation - The commit will be executed automatically upon approval
- Success message displays after TUI exits
- Review unstaged changes:
gelf review
- Review staged changes:
gelf review --staged
The review feature provides:
- Real-time streaming AI analysis
- Comprehensive code review feedback
- Security vulnerability detection
- Performance and maintainability suggestions
- No interactive prompts - displays results directly
Generate AI-powered documentation for your codebase:
# Generate README documentation
gelf doc --src . --dst README.md --template readme
# Generate API documentation
gelf doc --src ./api --dst docs/api.md --template api
# Generate architecture documentation
gelf doc --src . --dst docs/architecture.md --template architecture
# Generate changelog from git history
gelf doc --src . --dst CHANGELOG.md --template changelog
# Generate Go-style documentation
gelf doc --src ./pkg --dst docs/godoc.md --template godoc
The documentation feature provides:
- AI-powered analysis of source code structure
- Multiple documentation templates (readme, api, changelog, architecture, godoc)
- Support for multiple output formats (markdown, html, json)
- Interactive TUI with progress indicators
- Customizable language output
# Show help
gelf --help
# Show commit command help
gelf commit --help
# Show review command help
gelf review --help
# Generate commit message with TUI interface (default behavior)
gelf commit
# Generate commit message only with diff display (for debugging)
gelf commit --dry-run
# Generate commit message only without diff (for external tool integration)
gelf commit --dry-run --quiet
# Use specific model temporarily
gelf commit --model gemini-2.0-flash-exp
# Generate commit message in a specific language
gelf commit --language japanese
# Automatically approve commit message
gelf commit --yes
# Review unstaged changes (default)
gelf review
# Review staged changes
gelf review --staged
# Use specific model for review
gelf review --model gemini-2.0-flash-exp
# Disable markdown styling in review output (for plain text)
gelf review --no-style
# Generate code review in a specific language
gelf review --language japanese
# Generate documentation
gelf doc --src . --dst README.md --template readme
# Generate documentation with specific format
gelf doc --src ./src --dst docs/api.html --template api --format html
# Generate documentation with specific model and language
gelf doc --src . --dst README_JP.md --template readme --model gemini-2.0-flash-exp --language japanese
# Show documentation command help
gelf doc --help
gelf supports generating commit messages, code reviews, and documentation in multiple languages. You can configure language settings both through configuration files and command-line options.
While gelf can work with any language supported by Gemini models, common examples include:
english
(default)japanese
spanish
french
german
chinese
korean
- And many more...
# Set language for specific commands
gelf commit --language japanese
gelf review --language spanish
gelf doc --src . --dst README.md --template readme --language french
# Use different languages for different operations
gelf commit --language english
gelf review --language japanese
gelf doc --src . --dst docs/README_ES.md --template readme --language spanish
language: "japanese" # Global default language
commit:
language: "japanese" # Language for commit messages
review:
language: "english" # Language for code reviews
doc:
language: "english" # Language for documentation generation
If no language is specified, commit, review, and documentation generation will use English.
- Command-line
--language
flag (highest priority) - Configuration file command-specific settings (
commit.language
/review.language
/doc.language
) - Configuration file global setting (
language
) - Default value (
english
)
This allows you to set a global default language, override it for specific commands, and still override everything on a per-command basis.
- Commit Target: Staged changes only (
git diff --staged
) - Review Target: Both staged (
git diff --staged
) and unstaged (git diff
) changes - AI Provider: Vertex AI (Gemini models)
- Default Flash Model: gemini-2.5-flash
- Default Pro Model: gemini-2.5-pro
- UI Framework: Bubble Tea (TUI)
- CLI Framework: Cobra
- Streaming: Real-time AI response streaming for code reviews
cmd/
βββ root.go # Root command definition
βββ commit.go # Commit command implementation
βββ review.go # Review command implementation
βββ doc.go # Documentation generation command implementation
internal/
βββ git/
β βββ diff.go # Git operations (staged and unstaged diffs)
βββ ai/
β βββ vertex.go # Vertex AI integration (commit messages, code review, and documentation)
βββ ui/
β βββ tui.go # Bubble Tea TUI implementation (commit, review, and documentation)
βββ doc/
β βββ analyzer.go # Source code analysis for documentation generation
βββ config/
βββ config.go # Configuration management (API keys etc)
main.go # Application entry point
The application provides a clean, interactive terminal interface:
- Loading indicator while generating commit messages
- Review screen for generated commit messages with approval options
- Success confirmation after successful commits
- Real-time streaming AI analysis display
- Comprehensive code review feedback without interactive prompts
- Loading indicator while analyzing source code
- Real-time progress updates during AI document generation
- Success confirmation with output file location
The interface features color-coded states, animated progress indicators, and intuitive keyboard controls for a smooth user experience.
Settings are applied in the following order (highest to lowest priority):
- Environment variables (for Vertex AI settings only)
- Configuration file (
gelf.yml
) - Default values
vertex_ai:
project_id: string # Google Cloud project ID
location: string # Vertex AI location (default: us-central1)
model:
flash: string # Gemini Flash model to use (default: gemini-2.5-flash)
pro: string # Gemini Pro model to use (default: gemini-2.5-pro)
language: string # Global default language (default: english)
commit:
model: string # Model for commits: "flash", "pro", or custom (default: flash)
language: string # Language for commit messages (inherits from global if not set)
review:
model: string # Model for reviews: "flash", "pro", or custom (default: pro)
language: string # Language for code reviews (inherits from global if not set)
doc:
model: string # Model for documentation: "flash", "pro", or custom (default: pro)
language: string # Language for documentation generation (inherits from global if not set)
color: string # Color output setting: "always" or "never" (default: always)
Variable | Description | Default Value | Required |
---|---|---|---|
GELF_CREDENTIALS |
Path to service account key file (gelf-specific, takes priority) | - | β * |
GOOGLE_APPLICATION_CREDENTIALS |
Path to service account key file (fallback) | - | β * |
VERTEXAI_PROJECT or GOOGLE_CLOUD_PROJECT |
Google Cloud project ID | - | β |
VERTEXAI_LOCATION |
Vertex AI location | us-central1 |
β |
*Either GELF_CREDENTIALS
or GOOGLE_APPLICATION_CREDENTIALS
is required. If both are set, GELF_CREDENTIALS
takes priority.
Note: Model configuration and language settings are only available through configuration files.
# Install dependencies
go mod download
# Build the project
go build
# Run tests
go test ./...
# Tidy dependencies
go mod tidy
go build # Build the project
go test ./... # Run tests
go mod tidy # Tidy dependencies
go run main.go commit # Run commit command in development
go run main.go commit --dry-run # Run message generation only
go run main.go review # Run review command in development
go run main.go review --staged # Run review for staged changes
go run main.go doc --src . --dst README.md --template readme # Run documentation generation
google.golang.org/genai
- Official Gemini Go clientgithub.com/charmbracelet/bubbletea
- TUI frameworkgithub.com/charmbracelet/lipgloss
- Styling and layoutgithub.com/charmbracelet/bubbles
- TUI components (spinner)github.com/charmbracelet/glamour
- Markdown rendering for code reviewsgithub.com/spf13/cobra
- CLI frameworkgopkg.in/yaml.v3
- YAML configuration file support
Pull requests and issues are welcome!
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Create a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
- Bubble Tea - For enabling beautiful TUI experiences
- Vertex AI - For providing powerful AI capabilities
- Cobra - For excellent CLI experience
Made with β€οΈ by EkeMinusYou