Skip to content

magucc/gw-interactive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gw — Git Worktree Inspector

A TUI for managing git worktrees with issue tracker integration (Linear + Jira) and AI-assisted conflict resolution. See all your worktrees at a glance with issue status, dirty file counts, and quick actions.

Go License

gw demo

Platform Support

OS Status
macOS (arm64, amd64) Fully supported
Linux (arm64, amd64) Fully supported
Windows (WSL) Supported via WSL
Windows (native) Not supported (syscall.Exec used for git proxy)

Requires: Go 1.21+, git

Install

# From source
go install github.com/magucc/gw-interactive@latest

# Or clone and build
git clone https://github.com/magucc/gw-interactive && cd gw
go install .

The binary lands in $GOPATH/bin/gw (usually ~/go/bin/gw).

Setup

# Run interactive setup in any git repo
gw init

The onboarding flow asks for:

  1. Issue tracker — Linear, Jira (Cloud), or none
  2. Credentials — Linear API key or Jira email + API token
  3. AI tool — detects installed coding assistants (Claude, GitHub Copilot, Gemini)

This creates two files:

File Contents Committed?
~/.config/gw/config.json Credentials + AI tool No (global, private)
.pm.json (repo root) Tracker type, prefix, agent Yes (per-project)

.pm.json

A per-project config that declares which issue tracker and AI agent a repo uses. Safe to commit — no secrets.

{
  "$schema": "https://raw.githubusercontent.com/magucc/gw-interactive/main/schema/pm.schema.json",
  "tracker": "jira",
  "prefix": "PROJ",
  "base_url": "https://company.atlassian.net",
  "agent": "claude"
}
Field Required Description
tracker yes "linear" or "jira"
prefix no Issue key prefix (e.g. KJU, PROJ). Filters branch name matching
base_url jira only Jira Cloud instance URL
agent no AI coding agent: "claude", "copilot", or "gemini"

Env var overrides: LINEAR_API_KEY, JIRA_EMAIL, JIRA_API_TOKEN, JIRA_BASE_URL

Usage

# Launch TUI
gw

# Initialize project config
gw init

# Or use as git worktree alias
gw list
gw add ../feature-branch -b feature-branch
gw remove ../old-branch

Any arguments (except init) are proxied directly to git worktree.

Keybindings

Press ? inside the app to see the full shortcut overlay.

Navigation

Key Action
j / k / / Move cursor up/down
enter Inspect worktree (changes, issue info, tracker diagnostics)

Actions

Key Action
c Create worktree — issue picker (Linear/Jira) or manual ID input
d Delete worktree — confirm with y/n (disabled for main worktree)
s Sync — fetch + rebase onto default branch (with AI conflict resolution)
f Fetch latest from remote for selected worktree
t Terminal — open a shell in the worktree directory (exit to return)
a Agent — open your configured AI tool in the worktree directory
P Prune stale worktree entries
o Open issue in browser (Linear or Jira)
r Refresh all data

Conflict Resolution

When s (sync) hits merge conflicts, gw shows the conflicted files and offers:

Key Action
a Resolve with AI — launches your configured AI tool to fix conflicts
s Skip this commit (git rebase --skip)
x Abort the rebase (git rebase --abort)

Supported AI tools: Claude Code, GitHub Copilot, Gemini CLI

General

Key Action
? Toggle shortcut help overlay
q / esc Quit app or go back from sub-view
ctrl+c Force quit

How It Works

  1. Worktree discovery — Parses git worktree list --porcelain to find all worktrees
  2. Issue matching — Extracts issue IDs from branch names using pattern [A-Z]+-\d+ (e.g. kju-100-add-authKJU-100). When a prefix is set in .pm.json, only that prefix is matched.
  3. Issue fetching — Linear: batched GraphQL query (1 API call). Jira: JQL search via REST API v3.
  4. Status detection — Runs git status --porcelain per worktree to count dirty files
  5. Conflict resolution — On rebase conflicts, suspends the TUI, launches the AI tool in the worktree directory, then continues the rebase

Create Worktree Flow

  1. Press c
  2. If a tracker is configured, browse your assigned issues with a filterable picker
  3. Select an issue (or type an ID manually if no tracker)
  4. A new worktree is created as a sibling directory with the lowercased issue ID as branch name
your-repo/          ← main worktree
../kju-100/         ← new worktree

Project Structure

gw/
├── main.go                    # Entry point, git proxy, gw init, tracker wiring
├── schema/
│   └── pm.schema.json         # JSON Schema for .pm.json
├── internal/
│   ├── config/
│   │   └── config.go          # Global config, ProjectConfig (.pm.json), AI tool detection
│   ├── git/
│   │   └── git.go             # Worktree ops, sync, conflict detection, rebase
│   ├── tracker/
│   │   └── tracker.go         # IssueTracker interface, shared Issue types
│   ├── linear/
│   │   └── linear.go          # Linear GraphQL client, batched issue fetching
│   ├── jira/
│   │   └── jira.go            # Jira Cloud REST API v3 client, JQL search
│   └── tui/
│       ├── model.go           # Bubble Tea model (Update/View/Init)
│       ├── onboarding.go      # Setup flow: tracker + credentials + AI tool
│       ├── styles.go          # Lipgloss styles
│       └── commands.go        # Async tea.Cmd functions

Dependencies

About

Interactive Terminal User Interface for Git Worktrees

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages