Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tsukimiya/phantom

ย 
ย 

Repository files navigation

๐Ÿ‘ป Phantom

A powerful CLI tool for seamless parallel development with Git worktrees

npm version License: MIT Node.js Version Ask DeepWiki

ๆ—ฅๆœฌ่ชž โ€ข Installation โ€ข Why Phantom? โ€ข Basic Usage โ€ข Documentation

Phantom demo

โœจ What is Phantom?

Phantom is a powerful CLI tool that dramatically boosts your development productivity by making Git worktrees simple and intuitive. Run multiple tasks in isolated environments simultaneously and achieve true multitask development. Built for the next generation of parallel development workflows, including AI-powered coding with multiple agents.

Key Features

  • ๐Ÿš€ Simple worktree management - Create and manage Git worktrees with intuitive commands
  • ๐Ÿ”„ True multitasking - Create separate working directories per branch and run multiple tasks simultaneously
  • ๐ŸŽฏ Execute commands from anywhere - Run commands in any worktree with phantom exec <worktree> <command>
  • ๐ŸชŸ Built-in tmux integration - Open worktrees in new panes or windows
  • ๐Ÿ” Interactive selection with fzf - Use built-in fzf option for worktree selection
  • ๐ŸŽฎ Shell completion - Full autocomplete support for Fish, Zsh, and Bash
  • ๐Ÿ™ GitHub Integration - Create worktrees directly from GitHub PRs and issues
  • ๐Ÿค– MCP Integration - AI autonomously manages worktrees for parallel development
  • ๐Ÿ” PR Review Interface - Review worktree differences locally using difit (experimental)
  • โšก Fast and lightweight - Minimal external dependencies

๐Ÿš€ Installation

Using Homebrew (recommended)

brew install aku11i/tap/phantom

Note: Shell completions for Fish and Zsh are installed automatically with Homebrew. For Bash completion, see the Shell Completion section below.

Using npm

npm install -g @aku11i/phantom

๐Ÿค” Why Phantom?

Git worktrees are powerful but require manual management of paths and branches. Also, navigating between multiple worktrees is cumbersome. Phantom eliminates these problems:

# Without Phantom
git worktree add -b feature-awesome ../project-feature-awesome origin/main
cd ../project-feature-awesome

# With Phantom
phantom create feature-awesome --shell

How Phantom Works

When you run phantom create feature-awesome, a new Git worktree named feature-awesome is created in .git/phantom/worktrees/. All worktrees created with phantom are centrally managed in this location.

your-project/    # Git repository
โ”œโ”€โ”€ .git/
โ”‚   โ””โ”€โ”€ phantom/
โ”‚       โ””โ”€โ”€ worktrees/        # Phantom-managed directory
โ”‚           โ”œโ”€โ”€ feature-awesome/  # branch name = worktree name
โ”‚           โ”œโ”€โ”€ bugfix-login/     # another worktree
โ”‚           โ””โ”€โ”€ hotfix-critical/  # yet another worktree
โ””โ”€โ”€ ...

You can also customize the worktree location using the worktreesDirectory configuration option in phantom.config.json. This allows you to store worktrees in any location you prefer.

This convention means you never need to remember worktree paths - just use the branch name for easy worktree operations.

โœˆ๏ธ Features for a Comfortable Development Experience

Phantom provides perfect functionality as a command-line tool. Developers feel the trust and comfort of flying first class.

Shell Completion

Phantom supports full shell completion for Fish, Zsh, and Bash. Use tab key to complete commands and worktree names.

When installed via Homebrew, completions for Fish and Zsh are installed automatically. For Bash, you need to manually set up the completion:

# Prerequisites: bash-completion v2 must be installed

# For Bash (add to your .bashrc or .bash_profile)
eval "$(phantom completion bash)"

tmux Integration

When creating worktrees, you can use tmux to open them in new windows or panes. This allows you to manage multiple work environments simultaneously.

# Create and open worktree in new window
phantom create feature-x --tmux
# Create with split panes
phantom create feature-y --tmux-vertical
phantom create feature-z --tmux-horizontal

# Open existing worktrees in tmux
phantom shell feature-x --tmux
phantom shell feature-y --tmux-v

# Result: Multiple worktrees displayed simultaneously, each allowing independent work

Phantom tmux integration

Editor Integration

Phantom works seamlessly with editors like VS Code and Cursor. You can specify an editor to open worktrees.

# Open with VS Code
phantom create feature --exec "code ."

# Or open existing worktree
phantom exec feature code .

# Open with Cursor
phantom create feature --exec "cursor ."
phantom exec feature cursor .

Phantom VS Code integration

fzf Integration

Interactive search with fzf allows quick worktree selection.

# Open shell with fzf selection
phantom shell --fzf

# Delete with fzf selection
phantom delete --fzf

MCP Integration

Phantom provides a Model Context Protocol (MCP) server. AI coding assistants can autonomously create and manage worktrees to develop multiple features in parallel.

After completing the MCP server setup, try giving your AI agent a prompt like this. The AI agent will create two worktrees and implement Express and Hono apps in each.

Create 2 variations of a simple hello world app using Express and Hono, each in their own worktree. Make sure each can be started with npm start and served on a different URL.

See MCP Integration Guide for detailed setup and usage.

๐Ÿ” Basic Usage

Create a new worktree

phantom create feature-awesome

phantom list

Start a new shell in the worktree

phantom shell feature-awesome

# Start development work

# Exit the shell when done
exit

Run commands in any worktree

phantom exec feature-awesome {command to run}
# Example: phantom exec feature-awesome npm run build

Review code with GitHub-like interface

# Review worktree against default branch
phantom review feature-awesome

# Review against specific branch
phantom review feature-awesome --base main

# Interactive worktree selection
phantom review --fzf

Clean up when done

phantom delete feature-awesome

๐Ÿ“š Documentation

๐Ÿค Contributing

Contributions are welcome! See our Contributing Guide for:

  • Development setup
  • Code style guidelines
  • Testing requirements
  • Pull request process

๐Ÿ“„ License

MIT License - see LICENSE

๐Ÿ™ Acknowledgments

Built with ๐Ÿ‘ป by @aku11i and Claude

About

A powerful CLI tool for seamless parallel development with Git worktrees.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 68.8%
  • TypeScript 31.2%