JA Getting Started Quick Start - aku11i/phantom GitHub Wiki
English | 日本語
Phantomを5分で起動して実行しましょう!このガイドではインストールと基本的な使用方法を説明します。
# npmを使用
npm install -g @aku11i/phantom
# pnpmを使用
pnpm add -g @aku11i/phantom
# インストールの確認
phantom --version
- Node.js v22.0.0以上
- Git(worktreeサポート付き)
「phantom」はGit worktreeのことで、リポジトリにリンクされた独立した作業ディレクトリです。
# 任意のGitリポジトリに移動
cd your-git-repo
# 現在のブランチからphantomを作成
phantom create my-feature
# 特定のブランチからphantomを作成
phantom create bugfix-123 origin/production
phantom list
# 出力例:
# 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
# phantom内で任意のコマンドを実行
phantom exec my-feature npm test
phantom exec my-feature git status
# 複数のコマンドを実行
phantom exec my-feature "npm install && npm test"
# phantom内でインタラクティブシェルを開始
phantom shell my-feature
# phantom のディレクトリに移動済み
# 通常通りコマンドを実行
npm install
npm test
git commit -m "Add feature"
# 完了したら終了
exit
# phantomへのパスを表示
phantom where my-feature
# 出力: /var/tmp/phantom/repo/my-feature
# スクリプトで使用
cd $(phantom where my-feature)
# phantom(worktree)を削除
phantom delete my-feature
# これはworktreeを削除しますが、ブランチは保持されます
# 新機能用のphantomを作成
phantom create new-dashboard
# phantomに入る
phantom shell new-dashboard
# phantomシェル内で:
git checkout -b feature/dashboard
npm install
npm run dev
# 変更、テスト、コミット...
exit
# メインworktreeに戻り、他の作業を続ける
# プロダクションブランチからphantomを作成
phantom create hotfix origin/production
# 修正を実行
phantom exec hotfix "git checkout -b hotfix/security-patch"
phantom exec hotfix "npm test"
# 変更を確認
phantom shell hotfix
git diff
git commit -m "Fix security vulnerability"
git push origin hotfix/security-patch
exit
# クリーンアップ
phantom delete hotfix
# 同僚のPRをレビュー
phantom create review-pr-42 origin/feature/new-api
# テストを実行してコードをチェック
phantom exec review-pr-42 npm test
phantom exec review-pr-42 npm run lint
# インタラクティブに探索
phantom shell review-pr-42
# 複数の機能を同時に作業
phantom create feature-a
phantom create feature-b
phantom create feature-c
# 並行してテストを実行
phantom exec feature-a npm test &
phantom exec feature-b npm test &
phantom exec feature-c npm test &
wait
# すべてのステータスを確認
phantom list
コマンド | 説明 | 例 |
---|---|---|
create |
新しいphantomを作成 | phantom create <name> [branch] |
delete |
phantomを削除 | phantom delete <name> |
list |
すべてのphantomをリスト表示 | phantom list |
exec |
phantom内でコマンドを実行 | phantom exec <name> <command> |
shell |
phantomシェルに入る | phantom shell <name> |
where |
phantomのパスを取得 | phantom where <name> |
--version |
バージョンを表示 | phantom --version |
--help |
ヘルプを表示 | phantom --help |
phantomには説明的な名前を使用:
- フィーチャーブランチ:
feature-login
、feature-dashboard
- バグ修正:
fix-memory-leak
、bugfix-123
- レビュー:
review-pr-42
、review-api-changes
# phantomをリスト表示してクリーンアップできるものを確認
phantom list
# 完了したphantomを削除
phantom delete old-feature
# 各PRレビュー用にphantomを作成
phantom create pr-$(git rev-parse --short HEAD)
# 各アクティブチケット用にphantomを作成
phantom create ticket-JIRA-123
# スクリプトで使用
PHANTOM_PATH=$(phantom where my-feature)
if [ -d "$PHANTOM_PATH" ]; then
cd "$PHANTOM_PATH"
npm test
fi
# 異なるバージョンを同時に起動
phantom exec v1 "npm run dev -- --port 3001" &
phantom exec v2 "npm run dev -- --port 3002" &
phantom exec v3 "npm run dev -- --port 3003" &
複数のAIコーディングセッションの実行に最適:
# AIエージェント用の隔離環境を作成
phantom create ai-agent-1
phantom create ai-agent-2
# 各エージェントは独自のphantomで作業
# 並行セッション間での競合や混乱なし
# 複数の設定に対してテスト
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"
- Gitリポジトリ内にいることを確認
- ブランチが存在することを確認:
git branch -a
- Git worktreeサポートを確認:
git worktree list
- インストールを確認:
npm list -g @aku11i/phantom
- Node.jsバージョンを確認:
node --version
(v22+が必要) - 再インストールを試す:
npm install -g @aku11i/phantom
- Phantomはデフォルトで
/tmp
にworktreeを作成 - 書き込み権限があることを確認
- ディスク容量を確認:
df -h