A Go TUI tool for GitHub workflows with AI integration. Zero commands - zero internet required for core features - AI-assisted workflows.
Run ghx and get an interactive menu-driven interface with AI assistance for commit messages, PR descriptions, code explanations, and more.
ghx/
├── go.mod
├── go.sum
├── main.go # Entry point - launches TUI directly
├── internal/
│ ├── app/
│ │ ├── app.go # Main TUI application (bubbletea)
│ │ ├── state.go # Application state
│ │ └── update.go # Update logic
│ ├── screens/
│ │ ├── home.go # Main menu screen
│ │ ├── status.go # Git status screen
│ │ ├── commit.go # Commit workflow screen
│ │ ├── push.go # Push workflow screen
│ │ ├── pr.go # PR creation screen
│ │ ├── issues.go # Issues management screen
│ │ ├── repos.go # Repo navigation screen
│ │ ├── ai.go # AI chat/assistant screen
│ │ └── settings.go # Settings screen
│ ├── components/
│ │ ├── menu.go # Selectable menu component
│ │ ├── filelist.go # Multi-select file list
│ │ ├── textinput.go # Text input component
│ │ ├── textarea.go # Multiline input component
│ │ ├── spinner.go # Loading spinner
│ │ ├── statusbar.go # Status bar component
│ │ ├── chat.go # AI chat component
│ │ └── diffviewer.go # Code diff viewer
│ ├── git/
│ │ ├── status.go # File status detection
│ │ └── operations.go # Commit, push operations
│ ├── gh/
│ │ └── client.go # GitHub CLI wrapper
│ ├── ai/
│ │ ├── provider.go # AI provider interface
│ │ ├── ollama.go # Ollama provider (local)
│ │ ├── openai.go # OpenAI provider
│ │ ├── claude.go # Anthropic Claude provider
│ │ ├── mlx.go # MLX provider (Apple Silicon)
│ │ ├── lmstudio.go # LM Studio provider (local)
│ │ ├── prompts.go # System prompts for different tasks
│ │ └── config.go # AI provider configuration
│ └── db/
│ ├── db.go # Local SQLite connection
│ └── history.go # Command/chat history storage
├── styles/
│ └── theme.go # Lipgloss styles
└── .ghx/
├── ghx.db # Local SQLite database
└── config.json # AI provider settings
github.com/charmbracelet/bubbletea- TUI frameworkgithub.com/charmbracelet/bubbles- Pre-built componentsgithub.com/charmbracelet/lipgloss- Stylinggithub.com/charmbracelet/glamour- Markdown rendering for AI responsesmodernc.org/sqlite- Pure Go SQLite (no CGO)github.com/go-git/go-git/v5- Git operationsgithub.com/sashabaranov/go-openai- OpenAI-compatible client (works with Ollama, OpenAI, LM Studio, etc.)github.com/anthropics/anthropic-sdk-go- Official Claude SDK
$ ghx
┌─────────────────────────────────────────────────┐
│ ghx - AI-Powered GitHub Assistant │
├─────────────────────────────────────────────────┤
│ │
│ > Status View git status │
│ Commit Stage & commit files (AI assist) │
│ Diff View staged changes │
│ Push Push to remote │
│ PR Create pull request (AI assist) │
│ Issues Manage issues │
│ AI Chat Ask AI about codebase │
│ History View recent commands │
│ Settings Configure providers & preferences│
│ │
├─────────────────────────────────────────────────┤
│ AI: Ollama (llama3) ↑/↓ Nav Enter Go q Quit │
└─────────────────────────────────────────────────┘
| Provider | Type | Endpoint | Models |
|---|---|---|---|
| Ollama | Local | http://localhost:11434 |
llama3, mistral, codellama, etc. |
| OpenAI | Cloud | https://api.openai.com |
gpt-4o, gpt-4-turbo, gpt-3.5-turbo |
| Claude | Cloud | https://api.anthropic.com |
claude-3-opus, claude-3-sonnet, claude-3-haiku |
| MLX | Local (macOS) | http://localhost:8080 |
Apple MLX models |
| LM Studio | Local | http://localhost:1234 |
Any GGUF model |
| Custom | Any | Configurable | OpenAI-compatible APIs |
┌─────────────────────────────────────────────────┐
│ AI Provider Settings │
├─────────────────────────────────────────────────┤
│ │
│ Active Provider: [Ollama ▼] │
│ │
│ ── Ollama Settings ── │
│ Host: [http://localhost:11434 ] │
│ Model: [llama3 ▼] │
│ │
│ ── OpenAI Settings ── │
│ API Key: [sk-**** ] │
│ Model: [gpt-4o ▼] │
│ │
│ ── Claude Settings ── │
│ API Key: [sk-ant-**** ] │
│ Model: [claude-3-sonnet ▼] │
│ │
│ ── LM Studio Settings ── │
│ Host: [http://localhost:1234 ] │
│ │
├─────────────────────────────────────────────────┤
│ t Test Connection s Save b Back │
└─────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────┐
│ Commit - Select files │
├─────────────────────────────────────────────────┤
│ [x] internal/ai/provider.go │
│ [x] internal/ai/ollama.go │
│ [ ] main.go │
│ │
├─────────────────────────────────────────────────┤
│ Commit message: │
│ Add Ollama integration for local AI inference │
│ _________________________________________ │
│ │
│ ┌─ AI Suggestions ────────────────────────┐ │
│ │ 1. Add Ollama provider with streaming │ │
│ │ response support │ │
│ │ 2. Implement AI provider interface │ │
│ │ 3. feat(ai): add local Ollama support │ │
│ └─────────────────────────────────────────┘ │
│ │
├─────────────────────────────────────────────────┤
│ Tab AI Suggest r Regenerate Enter Commit │
└─────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────┐
│ Create Pull Request - AI Assisted │
├─────────────────────────────────────────────────┤
│ Base: main │
│ Head: feature/ai-integration │
│ │
│ Title: Add multi-provider AI integration │
│ _________________________________________ │
│ │
│ Description: │
│ ┌─────────────────────────────────────────────┐│
│ │ ## Summary ││
│ │ This PR adds support for multiple AI providers│
│ │ (Ollama, OpenAI, Claude, MLX, LM Studio). ││
│ │ ││
│ │ ## Changes ││
│ │ - Add provider interface for AI abstraction│ │
│ │ - Implement Ollama provider (local) ││
│ │ - Implement OpenAI provider ││
│ │ - Add configuration management ││
│ │ ││
│ │ ## Testing ││
│ │ - Tested with Ollama llama3 ││
│ │ - Verified streaming responses ││
│ └─────────────────────────────────────────┘ │
│ │
├─────────────────────────────────────────────────┤
│ Tab Fields g AI Generate Enter Create │
└─────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────┐
│ AI Assistant (Ollama - llama3) │
├─────────────────────────────────────────────────┤
│ │
│ You: What does the provider.go file do? │
│ │
│ AI: The `provider.go` file defines the core │
│ interface for all AI providers in ghx. It │
│ includes: │
│ │
│ - `Provider` interface with `Chat()`, │
│ `Stream()`, and `Configure()` methods │
│ - `Message` and `Response` structs │
│ - Common error types │
│ │
│ You: Generate a commit message for my changes │
│ │
│ AI: Based on your staged changes: │
│ - Modified: internal/ai/ollama.go │
│ - Added: internal/ai/prompts.go │
│ │
│ Suggested: "Add streaming support to Ollama │
│ provider and extract system prompts" │
│ │
├─────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────┐ │
│ │ Ask AI anything... [│ ] │
│ └─────────────────────────────────────────┘ │
├─────────────────────────────────────────────────┤
│ Ctrl+L Clear Ctrl+S Stop Esc Back │
└─────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────┐
│ Diff Viewer - internal/ai/ollama.go │
├─────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────┐│
│ │ 1 +func (o *Ollama) Stream(ctx context.Context,│
│ │ 2 + messages []Message) (<-chan string, error) {│
│ │ 3 + // ... streaming implementation ││
│ │ 4 +} ││
│ └─────────────────────────────────────────┘ │
│ │
│ ┌─ AI Explanation ───────────────────────────┐ │
│ │ The `Stream` method implements real-time │ │
│ │ response streaming from Ollama. It returns │ │
│ │ a read-only channel that emits tokens as │ │
│ │ they're generated, enabling a chat-like │ │
│ │ experience in the TUI. │ │
│ └─────────────────────────────────────────┘ │
│ │
├─────────────────────────────────────────────────┤
│ e Explain r Review s Suggest b Back │
└─────────────────────────────────────────────────┘
q/Ctrl+C- Quit / Go back?- Show help overlayTab- Next field / sectionShift+Tab- Previous field/- Search
↑/k- Move up↓/j- Move downEnter- Select / ConfirmEsc- Cancel / Back
g- Generate with AIr- Regenerate AI responsee- Explain code with AICtrl+L- Clear AI chatCtrl+S- Stop AI generation
- Initialize Go module
- Set up bubbletea application structure
- Implement screen routing
- Create base components
- File status detection with go-git
- Status screen with file list
- Diff viewing
- Define provider interface
- Implement Ollama provider (local, no API key)
- Implement OpenAI provider
- Implement Claude provider
- Implement LM Studio provider (OpenAI-compatible)
- Add MLX support for Apple Silicon
- Configuration persistence
- Generate commit messages from diffs
- Generate PR descriptions from commits
- Code explanation on demand
- Streaming responses in TUI
- Chat screen with history
- Context-aware questions (current files, diffs)
- Markdown rendering for responses
- Chat history persistence
- Error handling
- Provider fallback/switching
- Rate limiting awareness
- Theme support
- Build release binaries
{
"ai": {
"active_provider": "ollama",
"providers": {
"ollama": {
"host": "http://localhost:11434",
"model": "llama3",
"options": {
"temperature": 0.7,
"num_ctx": 4096
}
},
"openai": {
"api_key": "sk-...",
"model": "gpt-4o",
"base_url": ""
},
"claude": {
"api_key": "sk-ant-...",
"model": "claude-3-sonnet-20240229"
},
"lmstudio": {
"host": "http://localhost:1234",
"model": "local-model"
},
"mlx": {
"host": "http://localhost:8080",
"model": ""
}
}
},
"ui": {
"theme": "dark",
"show_ai_suggestions": true
}
}You are a git commit message generator. Analyze the following diff and generate a concise, conventional commit message. Format: <type>(<scope>): <description>
Types: feat, fix, docs, style, refactor, test, chore
Diff:
{diff_content}
Generate 3 commit message options.
You are a pull request description generator. Based on the following commits and changes, generate a comprehensive PR description including:
- Summary
- Key changes (bullet points)
- Testing notes
- Breaking changes (if any)
Commits:
{commit_messages}
Changes:
{diff_summary}
You are a code explainer. Explain the following code changes in simple terms. Focus on:
- What the code does
- Why it was changed
- Any potential impacts
Code:
{code_snippet}
# Just run it
ghx
# Everything is interactive - no commands to memorize
# Local-only mode (Ollama) - works completely offline
# Set active provider to Ollama in settingsWith Ollama or LM Studio as the active provider:
- Fully offline AI assistance
- No API keys required
- No internet needed
- Privacy-first (code never leaves machine)