@akiojin/gwt
Interactive Git worktree manager with Coding Agent selection (Claude Code / Codex CLI / Gemini CLI / OpenCode), graphical branch selection, and advanced workflow management.
Overview
@akiojin/gwt is a powerful CLI tool that revolutionizes Git worktree management through an intuitive interface. It seamlessly integrates with Claude Code / Codex CLI / Gemini CLI / OpenCode workflows, providing intelligent branch selection, automated worktree creation, and comprehensive project management capabilities.
Migration Status
The Rust implementation covers the core CLI/TUI workflow and the Web UI (REST + WebSocket terminal). Remaining work is focused on Git backend fallback coverage, documentation polish, and release packaging.
Key Features
- Modern TUI: Built with Ratatui for a smooth, responsive terminal interface
- Full-screen Layout: Persistent header with repo context, boxed branch list, and always-visible footer with keyboard shortcuts
- Smart Branch Creation: Create feature, bugfix, hotfix, or release branches with guided prompts and automatic base branch selection
- Advanced Worktree Management: Complete lifecycle management including creation, cleanup of worktree-backed branches, and path optimization
- Coding Agent Selection: Choose between built-in agents (Claude Code / Codex CLI / Gemini CLI / OpenCode) or custom coding agents defined in
~/.gwt/tools.json - Coding Agent Integration: Launch the selected agent in the worktree (Claude Code includes permission handling and post-change flow)
- GitHub PR Integration: Automatic cleanup of merged pull request branches and worktrees
- Change Management: Built-in support for committing, stashing, or discarding changes after development sessions
- Universal Package: Install once, use across all your projects with consistent behavior
Installation
GitHub Releases are the source of truth for prebuilt binaries. The npm/bunx wrapper downloads the matching release asset on install.
From GitHub Releases (Recommended)
Download pre-built binaries from the Releases page:
gwt-linux-x86_64- Linux x86_64gwt-linux-aarch64- Linux ARM64gwt-macos-x86_64- macOS Intelgwt-macos-aarch64- macOS Apple Silicongwt-windows-x86_64.exe- Windows x86_64
# Example for Linux x86_64
Via npm/bunx
Install globally or run without installation:
# Global install
# One-time execution
Via Cargo
Install the CLI with Cargo:
# From crates.io (recommended for Rust users)
# With cargo-binstall (faster, downloads prebuilt binary)
# From GitHub (latest development version)
# Or, from a local checkout
Build from Source
# Clone the repository
# Build release binary
# The binary is at target/release/gwt
Quick Start
Run in any Git repository:
# If installed globally or in PATH
# Or use bunx for one-time execution
CLI options:
# Display help
# Check version
# List worktrees
# Add worktree for existing branch
# Create new branch with worktree
# Remove worktree
# Cleanup orphaned worktrees
The tool presents an interactive interface with the following options:
- Select Existing Branch: Choose from local or remote branches with worktree auto-creation
- Create New Branch: Guided branch creation with type selection (feature/bugfix/hotfix/release)
- Manage Worktrees: View, open, or remove existing worktrees
- Cleanup Branches: Remove merged PR branches or branches identical to their base directly from the CLI (branches without worktrees are excluded)
Coding Agents
gwt detects agents available on PATH and lists them in the launcher.
Supported agents (built-in):
- Claude Code (
claude) - Codex CLI (
codex) - Gemini CLI (
gemini) - OpenCode (
opencode)
Custom coding agents
Custom agents are defined in ~/.gwt/tools.json and will appear in the launcher.
Minimal example:
Notes:
typesupportspath,bunx, orcommand.modeArgsdefines args per execution mode (Normal/Continue/Resume).envis optional per-agent environment variables.
Advanced Workflows
Branch Strategy
This repository follows a structured branching strategy:
main: Production-ready code. Protected branch for releases only.develop: Integration branch for features. All feature branches merge here.feature/*: New features and enhancements. Must be based on and targetdevelop.hotfix/*: Critical production fixes. Based on and targetmain.release/*: Release preparation branches.
Important: When creating feature branches, always use develop as the base branch:
# Correct: Create feature branch from develop
# Or use this tool which handles it automatically
# → Select "Create new branch" → "feature" → automatically uses develop as base
Branch Creation Workflow
Important: This workflow is intended for human developers. Autonomous agents must never create or delete branches unless a human gives explicit, task-specific instructions.
- Select "Create new branch" from the main menu
- Choose branch type (feature, bugfix, hotfix, release)
- Enter branch name with automatic prefix application
- Select base branch from available options (feature → develop, hotfix → main)
- Confirm worktree creation path
- Automatic worktree setup and selected tool launch
Worktree Management
- Open Existing: Launch the selected tool in existing worktrees
- Remove Worktree: Clean removal with optional branch deletion
- Batch Operations: Handle multiple worktrees efficiently
GitHub Integration
- Branch Cleanup: Automatically detect and remove merged pull request branches or branches that no longer differ from their base
- Authentication Check: Verify GitHub CLI setup before operations
- Remote Sync: Fetch latest changes before cleanup operations
System Requirements
- Rust: Stable toolchain (for building from source)
- Git: Latest version with worktree support
- Coding Agent: At least one built-in agent or a custom coding agent should be available
- GitHub CLI: Required for PR cleanup features (optional)
- bun/npm: Required for bunx/npx execution method
Project Structure
@akiojin/gwt/
├── Cargo.toml # Workspace configuration
├── crates/
│ ├── gwt-cli/ # CLI entry point and TUI (Ratatui)
│ ├── gwt-core/ # Core library (worktree management)
│ ├── gwt-web/ # Web server (future)
│ └── gwt-frontend/ # Web frontend (future)
├── package.json # npm distribution wrapper
├── bin/gwt.js # Binary wrapper script
├── scripts/postinstall.js # Binary download script
├── specs/ # Feature specifications
└── docs/ # Documentation
Development
Setup
# Clone the repository
# Build the project
# Run tests
# Run with debug output
Available Commands
# Development build
# Release build
# Run tests
# Run clippy lints
# Format code
# Run the CLI locally
Development Workflow
- Fork and Clone: Fork the repository and clone your fork
- Create Branch: Use the tool itself to create a feature branch
- Development: Make changes with Rust
- Testing: Test CLI functionality with
cargo run - Quality Checks: Run
cargo clippyandcargo fmt --check - Pull Request: Submit a PR with clear description
Code Structure
- Entry Point:
crates/gwt-cli/src/main.rs- Main application logic - Core Modules: Git operations, worktree management in
gwt-core - TUI Components: Ratatui-based interface in
gwt-cli/src/tui/ - Type Safety: Comprehensive Rust type definitions
- Error Handling: Robust error management with
thiserror
Release Process
We ship releases through release-please. End users can simply install the latest published package (via npm or the GitHub Releases tab) and rely on versioned artifacts. Maintainers who need the full workflow should read docs/release-guide.md (日本語版: docs/release-guide.ja.md).
Troubleshooting
Common Issues
Permission Errors: Ensure proper directory permissions
Git Worktree Conflicts: Use the cleanup feature to remove stale worktrees
GitHub Authentication: Run gh auth login before using PR cleanup features
Binary Not Found: Ensure the gwt binary is in your PATH
Debug Mode
For verbose output, set the environment variable:
GWT_DEBUG=1
License
MIT - See LICENSE file for details
Contributing
We welcome contributions! Please read our contributing guidelines:
- Issues: Report bugs or request features via GitHub Issues
- Pull Requests: Follow the development workflow above
- Code Style: Maintain Rust best practices and existing patterns
- Documentation: Update README and code comments for significant changes
Contributors
- AI Novel Project Team
- Community contributors welcome
Support
- Documentation: This README and inline code documentation
- Issues: GitHub Issues for bug reports and feature requests
- Discussions: GitHub Discussions for questions and community support