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.
- π€ 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
- Go 1.27.1 or higher
- Google Cloud account with Vertex AI API enabled
- Git (required for commit and PR operations)
- GitHub CLI (
gh), authenticated withgh auth login(required for PR operations)
git clone https://github.com/EkeMinusYou/gelf.git
cd gelf
go buildgo install github.com/EkeMinusYou/gelf@latestbrew tap ekeminusyou/gelf
brew install ekeminusyou/gelf/gelfIf macOS blocks execution due to the quarantine attribute, remove it with:
sudo xattr -d com.apple.quarantine "$(which 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: "global" # optional, default: global
model:
flash: gemini-3.8-flash
pro: gemini-3.1-pro-preview
language: "english" # optional, default: english
commit:
model: "flash" # optional, default: flash
language: "english" # optional, inherits from global language
thinking: "minimal" # optional, default: minimal
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: alwaysYou 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.
- Create a service account in Google Cloud Console
- Grant the "Vertex AI User" role
- Download the JSON key file
- Set the
GELF_CREDENTIALSenvironment variable to the file path (recommended), or provide ADC viaGOOGLE_APPLICATION_CREDENTIALSorgcloud auth application-default login/ Workload Identity / GCE/GKE metadata
- Stage your changes:
git add .- Generate and commit with AI:
gelf commitGenerated messages have a Conventional Commits subject line and, for material changes, a body separated by a blank line. The AI receives the staged diff, its diffstat, the current branch name, and the five most recent commit subjects so that the generated message follows the repository's existing scope and wording style.
- Interactive TUI operations:
- Review the AI-generated commit message (Conventional Commits types such as
featandchoreare color-coded; breaking changes marked with!or aBREAKING CHANGE:footer are shown in white on red) - Press
yto approve ornto cancel - Press
eto edit the commit message in your editor (the same one git uses:GIT_EDITOR,core.editor,VISUAL,EDITOR, thenvi). Save and quit to apply; lines starting with#are ignored, and an empty message keeps the previous one - Press
pto give the AI a prompt for refining the message (e.g. "add a body", "write it in Japanese");Esccancels - Press
qorCtrl+Cto cancel during generation - The commit will be executed automatically upon approval
- Success message with the commit subject displays after TUI exits
- Review the AI-generated commit message (Conventional Commits types such as
Generate pull requests with AI-generated titles and descriptions based on committed changes:
gelf pr createThe generated body follows the PR template when available; otherwise, it briefly explains the purpose and key changes, using headings or bullet points when helpful rather than fixed sections.
Session log discovery is disabled by default. Enable it with --session-logs or pr.session_logs: true in gelf.yml to automatically discover recent local Claude Code and Codex CLI session logs to explain the intent and design rationale behind the changes. It reads ~/.claude/projects and ~/.codex/sessions, respecting CLAUDE_CONFIG_DIR and CODEX_HOME. Only conversations from the current Git worktree (including its subdirectories, excluding nested repositories) are eligible. Recorded branch names must match the local branch; logs without branch metadata are matched by worktree alone.
Discovery considers files modified in the last seven days, checks up to 1,000 candidates in modification-time order, and uses at most pr.session_log_count sessions (default: three across both agents). Override the count with --session-log-count N; the count must be positive and does not enable discovery by itself. Older timestamped messages are excluded. Only user and assistant text is included; tool calls/results, reasoning, system instructions, and Claude subagent logs are excluded. Common credential patterns are redacted, but this is not a comprehensive secret filter. Selected excerpts are sent to the configured Vertex AI model alongside the diff, including with --dry-run. The selected log paths are printed to stderr. Missing logs leave the usual diff-based generation available, and unreadable logs produce a warning without blocking PR creation.
Session context is limited to 20,000 bytes by default, retaining recent text when truncated. The generation and revision prompts treat logs as untrusted background material, use the final diff as the authority for implemented changes, and do not treat conversational test claims as execution evidence. Flags override configuration: --session-logs enables discovery, while --session-logs=false or --no-session-logs disables it. If both enabling and disabling flags are passed, --no-session-logs takes precedence.
pr:
session_logs: true
session_log_count: 5gelf pr create --session-logs --session-log-count 5The PR head is the repository and branch selected by the push remote. gelf respects branch.<branch>.pushRemote, remote.pushDefault, and the branch's upstream remote, falling back to origin. The base repository is the fork's parent when applicable, and the comparison uses that repository's default branch. An update uses the existing PR's base branch instead.
Before generating content, gelf fetches the required base and head refs. This refreshes local refs and objects without changing working files or the current branch. If the base repository has no configured remote, gelf fetches its clone URL without adding a remote. --dry-run also fetches these refs but does not push or create/update a PR.
A branch that is only behind the remote must be brought up to date manually before creating or updating a PR. Divergent history requires an explicit force-push confirmation, including with --yes. The force push uses a lease tied to the remote commit observed during preparation, so a later remote update is rejected.
Only open PRs (including drafts) with the exact head repository and branch count as existing PRs. Closed and merged PRs do not prevent a new PR. Use --update to replace an existing open PR's title and body, or create a new PR if none exists. Multiple matching open PRs cause an error.
After the PR title and description are generated, the interactive prompt lets you:
- Press
yto create the pull request with the generated content - Press
eto edit the title and body in your editor (the first line is the title, the rest is the body) - Press
pto enter a chat-style prompt (e.g. "shorten the title", "clarify the summary in Japanese"). gelf re-generates the title/body using your feedback and asks again β repeat as many times as you like. - Press
n(orEsc/q) to cancel without creating a PR
Options:
--draftto create a draft PR--dry-runto print the generated title/body without pushing or creating/updating a PR (required refs are fetched)--renderto render markdown in dry-run output (default: true)--no-renderto disable markdown rendering--session-logsto enable automatic Claude/Codex session context (default: disabled; overrides configuration)--no-session-logsto disable automatic Claude/Codex session context--session-log-count Nto set the maximum number of recent sessions when enabled (default: 3; overrides configuration; must be positive)--modelto override the model for PR generation--languageto set the output language for both title and body--title-languageto set the language for PR title only--body-languageto set the language for PR body only--yesto approve normal push and PR creation/update automatically (also skips revisions; force push still requires confirmation)--updateto update the matching open PR, or create a new one if none exists
# 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 normal push and PR confirmation prompts
gelf pr create --yes
# Regenerate the title and body of the matching open PR, or create a new PR
gelf pr create --update
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.
While gelf can work with any language supported by Gemini models, common examples include:
english(default)japanesespanishfrenchgermanchinesekorean- And many more...
# 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 japaneselanguage: "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 onlyIf no language is specified, commit messages and PR content will use English.
- Command-line flags (highest priority)
--languagesets both title and body language--title-languageoverrides title language specifically--body-languageoverrides body language specifically
- Configuration file command-specific settings (
commit.language/pr.language/pr.title_language/pr.body_language) - Configuration file global setting (
language) - 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.
- 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.8-flash
- Default Pro Model: gemini-3.1-pro-preview
- UI Framework: Bubble Tea (TUI)
- CLI Framework: Cobra
cmd/
βββ root.go # Command construction and build version
βββ config.go # Configuration inspection
βββ commit.go # Commit command implementation
βββ pr.go # Pull request command implementation
internal/
βββ git/
β βββ diff.go # Staged diffs, complete file summaries, and input limits
β βββ branch.go # Branch and commit range helpers
β βββ push.go # Push target resolution, status, and leases
β βββ remote.go # Remote URLs and base ref fetching
βββ github/
β βββ gh.go # GitHub repository and PR API operations
β βββ template.go # GitHub PR template resolution
βββ ai/
β βββ vertex.go # Vertex AI integration (commit messages and PR generation)
βββ ui/
β βββ session.go # Per-command input, output, and styles
β βββ tui.go # Bubble Tea TUI implementation (commit)
βββ process/
β βββ runner.go # Context-aware subprocess execution
βββ config/
βββ config.go # Configuration loading and model resolution
main.go # Application entry point
The application provides a clean, interactive terminal interface for commit and PR generation:
- Loading indicator while generating commit messages
- Review screen for generated commit messages with approval options
- Success confirmation after successful commits
- 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.
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: global)
model:
flash: string # Gemini Flash model to use (default: gemini-3.8-flash)
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)
thinking: string # Gemini thinking level for commits: "minimal", "low", "medium", "high", or "default" (default: minimal)
# Unsupported levels fall back automatically (minimal β low β model default), e.g. for Pro or Gemini 2.5
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)
max_diff_bytes: number # Maximum committed diff size sent to the AI (default: 100000)
session_logs: boolean # Automatically use recent Claude/Codex session context (default: false)
session_log_count: number # Maximum recent sessions across both agents (default: 3; must be positive)
max_session_log_bytes: number # Maximum session context size (default: 20000; negative is invalid)
color: string # Color output setting: "auto", "always", or "never" (default: always)Both diff limits apply only to AI input. Oversized diffs are truncated at a line/UTF-8 boundary with a warning, while interactive changed-file summaries still include every file and its full line counts. Omitted or zero limits use 100,000 bytes; negative values are invalid.
Configuration files that are missing are skipped during discovery. Malformed YAML and other read errors stop the command and report the affected file instead of silently using defaults. color: auto enables color only for terminal output and respects NO_COLOR and TERM=dumb; always is the default and never disables styling.
| 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.
# Install dependencies
go mod download
# Build the project
go build
# Run tests
go test ./...
# Tidy dependencies
go mod tidyPull request and commit errors are returned as a nonzero exit status, including errors in the interactive UI. External command errors include Git/GitHub diagnostics. gelf version reports release, module, or embedded VCS build information independently of the repository where it runs.
Commands receive their Git, GitHub, configuration, and AI dependencies, while UI sessions own their readers, writers, and styles. This keeps command construction independent between executions and lets tests exercise failure paths without external services.
CI runs tests with race detection, go vet, Staticcheck, and a build on Linux and macOS. Tests use temporary local Git repositories and mocked AI/GitHub responses; they require no cloud credentials and do not publish real PRs.
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 developmentgoogle.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 pull request bodiesgithub.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