Skip to content

Latest commit

Β 

History

134 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ gelf

gelf is a Go-based CLI tool that generates Git commit messages and AI-assisted pull request titles/descriptions using Vertex AI (Gemini). It analyzes git changes and provides a modern, interactive TUI interface built with Bubble Tea.

✨ Features

  • πŸ€– AI-Powered: Intelligent commit message generation using Vertex AI (Gemini)
  • πŸ“ PR Creation: Generate pull request titles and descriptions with AI
  • πŸ’¬ Interactive Revisions: Refine generated PR titles and bodies with chat-style instructions
  • 🎨 Clean TUI: Simple and intuitive user interface built with Bubble Tea
  • ⚑ Fast Processing: Real-time progress indicators during generation
  • πŸ›‘οΈ Safe Operations: Commit generation uses staged changes for a secure workflow
  • 🌐 Cross-Platform: Works seamlessly across different operating systems
  • 🌍 Multi-language Support: Generate commit messages and PRs in multiple languages

πŸ› οΈ Installation

Prerequisites

  • Go 1.24.3 or higher
  • Google Cloud account with Vertex AI API enabled
  • Git (required for commit operations)

Build from Source

git clone https://github.com/EkeMinusYou/gelf.git
cd gelf
go build

Install Binary

go install github.com/EkeMinusYou/gelf@latest

Install via Homebrew

brew tap ekeminusyou/gelf
brew install ekeminusyou/gelf/gelf

If macOS blocks execution due to the quarantine attribute, remove it with:

sudo xattr -d com.apple.quarantine "$(which gelf)"

βš™οΈ Setup

1. Configuration Options

gelf supports both configuration files and environment variables. Configuration files provide a more organized approach for managing settings.

Configuration File (Recommended)

Create a gelf.yml file in one of the following locations (in order of priority):

  1. ./gelf.yml - Project-specific configuration
  2. $XDG_CONFIG_HOME/gelf/gelf.yml - XDG config directory
  3. ~/.config/gelf/gelf.yml - Default XDG config location
  4. ~/.gelf.yml - Legacy home directory location
vertex_ai:
  project_id: "your-gcp-project-id"
  location: "global"  # optional, default: global

model:
  flash: gemini-3-flash-preview
  pro: gemini-3.1-pro-preview

language: "english"  # optional, default: english

commit:
  model: "flash"     # optional, default: flash
  language: "english"  # optional, inherits from global language

pr:
  model: "pro"       # optional, default: pro
  language: "english"  # optional, inherits from global language
  title_language: "english"  # optional, inherits from pr.language
  body_language: "english"   # optional, inherits from pr.language

color: "always"  # optional, default: always

Environment Variables (Alternative)

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: global)
export VERTEXAI_LOCATION="global"

Note: Model configuration and language settings can only be configured via configuration file, not environment variables. Note: If Application Default Credentials (ADC) are already available (e.g., via gcloud auth application-default login, Workload Identity, or GCE/GKE metadata), you can omit both credential environment variables.

2. Google Cloud Authentication

  1. Create a service account in Google Cloud Console
  2. Grant the "Vertex AI User" role
  3. Download the JSON key file
  4. Set the GELF_CREDENTIALS environment variable to the file path (recommended), or provide ADC via GOOGLE_APPLICATION_CREDENTIALS or gcloud auth application-default login / Workload Identity / GCE/GKE metadata

πŸš€ Usage

Commit Message Generation

  1. Stage your changes:
git add .
  1. Generate and commit with AI:
gelf commit
  1. Interactive TUI operations:
    • Review the AI-generated commit message
    • Press y to approve or n to cancel
    • Press e to edit the commit message
    • Press q or Ctrl+C to cancel during generation
    • The commit will be executed automatically upon approval
    • Success message displays after TUI exits

Pull Request Creation

Generate pull requests with AI-generated titles and descriptions based on committed changes:

gelf pr create

After the PR title and description are generated, the interactive prompt lets you:

  • Press y to create the pull request with the generated content
  • Press r to enter chat-style revision instructions (e.g. "shorten the title", "add a Testing section in Japanese"). gelf re-generates the title/body using your feedback and asks again β€” repeat as many times as you like.
  • Press n (or Esc / q) to cancel without creating a PR

Options:

  • --draft to create a draft PR
  • --dry-run to print the generated title/body without creating a PR
  • --render to render markdown in dry-run output (default: true)
  • --no-render to disable markdown rendering in dry-run output
  • --model to override the model for PR generation
  • --language to set the output language for both title and body
  • --title-language to set the language for PR title only
  • --body-language to set the language for PR body only
  • --yes to skip confirmation prompt (also skips the revise step)

Command Options

# Show help
gelf --help

# Show commit command help
gelf commit --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

# Create a pull request with AI-generated title/body
gelf pr create

# Create a draft pull request
gelf pr create --draft

# Preview generated PR title/body without creating a PR
gelf pr create --dry-run

# Preview without markdown rendering
gelf pr create --dry-run --no-render

# Use specific model and language for PR generation
gelf pr create --model gemini-2.0-flash-exp --language japanese

# Use different languages for title and body
gelf pr create --title-language english --body-language japanese

# Skip confirmation prompt
gelf pr create --yes

🌍 Language Support

gelf supports generating commit messages and pull request content in multiple languages. You can configure language settings both through configuration files and command-line options.

Supported Languages

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...

Configuration Options

1. Command Line (Highest Priority)

# Set language for specific commands
gelf commit --language japanese
gelf pr create --language french

# Use different languages for different operations
gelf commit --language english
gelf pr create --language japanese

# Use different languages for PR title and body
gelf pr create --title-language english --body-language japanese

2. Configuration File

language: "japanese"  # Global default language

commit:
  language: "japanese"  # Language for commit messages

pr:
  language: "english"   # Language for pull request titles and descriptions
  title_language: "english"  # Override language for PR title only
  body_language: "japanese"  # Override language for PR body only

3. Defaults

If no language is specified, commit messages and PR content will use English.

Priority Order

  1. Command-line flags (highest priority)
    • --language sets both title and body language
    • --title-language overrides title language specifically
    • --body-language overrides body language specifically
  2. Configuration file command-specific settings (commit.language/pr.language/pr.title_language/pr.body_language)
  3. Configuration file global setting (language)
  4. Default value (english)

This allows you to set a global default language, override it for specific commands, and even use different languages for PR titles and bodies.

πŸ”§ Technical Specifications

Architecture

  • Commit Target: Staged changes only (git diff --staged)
  • PR Target: Committed changes between base branch and HEAD
  • AI Provider: Vertex AI (Gemini models)
  • Default Flash Model: gemini-3-flash-preview
  • Default Pro Model: gemini-3.1-pro-preview
  • UI Framework: Bubble Tea (TUI)
  • CLI Framework: Cobra

Project Structure

cmd/
β”œβ”€β”€ root.go          # Root command definition
β”œβ”€β”€ commit.go        # Commit command implementation
└── pr.go            # Pull request command implementation
internal/
β”œβ”€β”€ git/
β”‚   β”œβ”€β”€ diff.go      # Git operations (staged and unstaged diffs)
β”‚   └── branch.go    # Branch and commit range helpers
β”œβ”€β”€ github/
β”‚   └── template.go  # GitHub PR template resolution
β”œβ”€β”€ ai/
β”‚   └── vertex.go    # Vertex AI integration (commit messages and PR generation)
β”œβ”€β”€ ui/
β”‚   └── tui.go       # Bubble Tea TUI implementation (commit)
└── config/
    └── config.go    # Configuration management (API keys etc)
main.go             # Application entry point

🎨 User Interface

The application provides a clean, interactive terminal interface for commit and PR generation:

Commit Workflow

  • Loading indicator while generating commit messages
  • Review screen for generated commit messages with approval options
  • Success confirmation after successful commits

Pull Request Workflow

  • Loading indicator while generating PR title and description
  • Review screen showing the generated title and (optionally rendered) body
  • Choose between creating, revising via chat instructions, or cancelling
  • When revising, type your feedback (e.g. "make it more concise") and gelf regenerates the title/body β€” loop until you are satisfied

The interface features color-coded states, animated progress indicators, and intuitive keyboard controls for a smooth user experience.

βš™οΈ Configuration Reference

Configuration Priority

Settings are applied in the following order (highest to lowest priority):

  1. Environment variables (for Vertex AI settings only)
  2. Configuration file (gelf.yml)
  3. Default values

Configuration File Options

vertex_ai:
  project_id: string     # Google Cloud project ID
  location: string       # Vertex AI location (default: global)

model:
  flash: string          # Gemini Flash model to use (default: gemini-3-flash-preview)
  pro: string            # Gemini Pro model to use (default: gemini-3.1-pro-preview)

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)
  max_diff_bytes: number # Maximum staged diff size sent to the AI (default: 100000)

pr:
  model: string          # Model for pull requests: "flash", "pro", or custom (default: pro)
  language: string       # Language for pull request titles and descriptions (inherits from global if not set)
  title_language: string # Language for PR title only (inherits from pr.language if not set)
  body_language: string  # Language for PR body only (inherits from pr.language if not set)

color: string            # Color output setting: "always" or "never" (default: always)

Environment Variables

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 (ADC fallback) - ⚠️*
VERTEXAI_PROJECT or GOOGLE_CLOUD_PROJECT Google Cloud project ID - βœ…
VERTEXAI_LOCATION Vertex AI location global ❌

*Either GELF_CREDENTIALS or GOOGLE_APPLICATION_CREDENTIALS is required unless ADC is already available (e.g., gcloud auth application-default login, Workload Identity, or GCE/GKE metadata). If both are set, GELF_CREDENTIALS takes priority.

Note: Model configuration and language settings are only available through configuration files.

πŸ”¨ Development

Development Environment Setup

# Install dependencies
go mod download

# Build the project
go build

# Run tests
go test ./...

# Tidy dependencies
go mod tidy

Available Commands

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 pr create     # Run PR creation in development

πŸ“¦ Dependencies

Main Dependencies

🀝 Contributing

Pull requests and issues are welcome!

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Create a pull request

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™ Acknowledgments

  • Bubble Tea - For enabling beautiful TUI experiences
  • Vertex AI - For providing powerful AI capabilities
  • Cobra - For excellent CLI experience

Made with ❀️ by EkeMinusYou

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages