Getting Started Quick Start - aku11i/phantom GitHub Wiki
Get Phantom up and running in 5 minutes! This guide covers installation and basic usage.
# Using npm
npm install -g @aku11i/phantom
# Using pnpm
pnpm add -g @aku11i/phantom
# Verify installation
phantom --version
- Node.js v22.0.0 or higher
- Git (with worktree support)
A "phantom" is a Git worktree - a separate working directory linked to your repository.
# Navigate to any Git repository
cd your-git-repo
# Create a phantom from the current branch
phantom create my-feature
# Create a phantom from a specific branch
phantom create bugfix-123 origin/production
phantom list
# Output example:
# NAME BRANCH PATH
# my-feature feature/new-ui /var/tmp/phantom/repo/my-feature
# bugfix-123 fix/critical-bug /var/tmp/phantom/repo/bugfix-123
# Run any command inside a phantom
phantom exec my-feature npm test
phantom exec my-feature git status
# Run multiple commands
phantom exec my-feature "npm install && npm test"
# Enter an interactive shell in the phantom
phantom shell my-feature
# You're now in the phantom's directory
# Run any commands as normal
npm install
npm test
git commit -m "Add feature"
# Exit when done
exit
# Print the path to a phantom
phantom where my-feature
# Output: /var/tmp/phantom/repo/my-feature
# Use in scripts
cd $(phantom where my-feature)
# Remove a phantom (worktree)
phantom delete my-feature
# This removes the worktree but preserves the branch
# Create a phantom for new feature
phantom create new-dashboard
# Enter the phantom
phantom shell new-dashboard
# Inside the phantom shell:
git checkout -b feature/dashboard
npm install
npm run dev
# Make changes, test, commit...
exit
# Back in main worktree, continue other work
# Create phantom from production branch
phantom create hotfix origin/production
# Make the fix
phantom exec hotfix "git checkout -b hotfix/security-patch"
phantom exec hotfix "npm test"
# Review changes
phantom shell hotfix
git diff
git commit -m "Fix security vulnerability"
git push origin hotfix/security-patch
exit
# Clean up
phantom delete hotfix
# Review a colleague's PR
phantom create review-pr-42 origin/feature/new-api
# Run tests and check code
phantom exec review-pr-42 npm test
phantom exec review-pr-42 npm run lint
# Explore interactively
phantom shell review-pr-42
# Work on multiple features simultaneously
phantom create feature-a
phantom create feature-b
phantom create feature-c
# Run tests in parallel
phantom exec feature-a npm test &
phantom exec feature-b npm test &
phantom exec feature-c npm test &
wait
# Check status of all
phantom list
Command | Description | Example |
---|---|---|
create |
Create a new phantom | phantom create <name> [branch] |
delete |
Remove a phantom | phantom delete <name> |
list |
List all phantoms | phantom list |
exec |
Run command in phantom | phantom exec <name> <command> |
shell |
Enter phantom shell | phantom shell <name> |
where |
Get phantom path | phantom where <name> |
--version |
Show version | phantom --version |
--help |
Show help | phantom --help |
Use descriptive names for your phantoms:
- Feature branches:
feature-login
,feature-dashboard
- Bug fixes:
fix-memory-leak
,bugfix-123
- Reviews:
review-pr-42
,review-api-changes
# List phantoms to see what can be cleaned up
phantom list
# Delete phantoms you're done with
phantom delete old-feature
# Create phantom for each PR review
phantom create pr-$(git rev-parse --short HEAD)
# Create phantom for each active ticket
phantom create ticket-JIRA-123
# Use in scripts
PHANTOM_PATH=$(phantom where my-feature)
if [ -d "$PHANTOM_PATH" ]; then
cd "$PHANTOM_PATH"
npm test
fi
# Start different versions simultaneously
phantom exec v1 "npm run dev -- --port 3001" &
phantom exec v2 "npm run dev -- --port 3002" &
phantom exec v3 "npm run dev -- --port 3003" &
Perfect for running multiple AI coding sessions:
# Create isolated environments for AI agents
phantom create ai-agent-1
phantom create ai-agent-2
# Each agent works in its own phantom
# No conflicts or confusion between parallel sessions
# Test against multiple configurations
phantom create test-node-20
phantom create test-node-22
phantom exec test-node-20 "nvm use 20 && npm test"
phantom exec test-node-22 "nvm use 22 && npm test"
- Ensure you're in a Git repository
- Check that the branch exists:
git branch -a
- Verify Git worktree support:
git worktree list
- Verify installation:
npm list -g @aku11i/phantom
- Check Node.js version:
node --version
(needs v22+) - Try reinstalling:
npm install -g @aku11i/phantom
- Phantom creates worktrees in
/tmp
by default - Ensure you have write permissions
- Check disk space:
df -h
- Explore Architecture Overview to understand how Phantom works
- Read Core Concepts for deeper understanding
- Check Development Setup to contribute