@aku11i/phantom 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ja.md ADDED
@@ -0,0 +1,300 @@
1
+ # 👻 Phantom
2
+
3
+ <div align="center">
4
+
5
+ **Git worktreeを使った並行開発のためのパワフルなCLIツール**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@aku11i/phantom.svg)](https://www.npmjs.com/package/@aku11i/phantom)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![Node.js Version](https://img.shields.io/node/v/@aku11i/phantom.svg)](https://nodejs.org)
10
+
11
+ [インストール](#-インストール) • [基本的な使い方](#-基本的な使い方) • [なぜPhantom?](#-なぜphantom) • [ドキュメント](#-ドキュメント)
12
+
13
+ </div>
14
+
15
+ ## ✨ 概要
16
+
17
+ Phantomは、Git worktreeの管理を劇的にシンプルにするCLIツールです。複数の機能開発、バグ修正、PRレビューを並行して進める現代の開発ワークフローに最適化されています。
18
+
19
+ ### 主な特徴
20
+
21
+ - 🚀 **シンプルなWorktree管理** - 直感的なコマンドでGit worktreeを作成・管理
22
+ - 🔄 **シームレスなコンテキスト切り替え** - stashやcommitせずに異なる作業間を瞬時に移動
23
+ - 🤖 **AI対応** - 複数のAIコーディングエージェントを並行実行するのに最適
24
+ - 🎯 **ブランチとWorktreeの同期** - 各worktreeに対応するブランチを自動作成
25
+ - 🐚 **インタラクティブシェル** - SSH風のworktreeナビゲーション体験
26
+ - ⚡ **ゼロ設定** - 賢明なデフォルト設定ですぐに使用可能
27
+
28
+ ## 🤔 なぜPhantom?
29
+
30
+ 現代の開発ワークフローでは、複数の機能を同時に作業することが一般的になっています。Git worktreeは素晴らしい機能ですが、パスとブランチを個別に指定する必要があり、少し面倒です。
31
+
32
+ ### Git worktreeを使う際の問題点
33
+
34
+ 素のGit worktreeを使う場合、worktreeのパス、ブランチ名、ベースブランチなどを毎回指定する必要があります。また、作業を切り替える際はディレクトリを移動する必要があり、複数の作業を頻繁に切り替える場合は少し手間がかかります。
35
+
36
+ ### Phantomの解決策
37
+
38
+ ```bash
39
+ # 従来の方法
40
+ git worktree add -b feature ../project-feature origin/main
41
+ cd ../project-feature
42
+
43
+ # Phantomを使用
44
+ phantom create feature --shell
45
+ ```
46
+
47
+ Phantomは、worktreeとブランチの作成を1つのコマンドにまとめ、作業スペース間の移動や操作を簡単にします。
48
+
49
+ ## 🚀 基本的な使い方
50
+
51
+ ```bash
52
+ # Phantomをインストール
53
+ npm install -g @aku11i/phantom
54
+
55
+ # 新しいworktreeを作成
56
+ phantom create feature-awesome
57
+
58
+ # worktreeにジャンプ
59
+ phantom shell feature-awesome
60
+
61
+ # または直接コマンドを実行
62
+ phantom exec feature-awesome npm install
63
+ phantom exec feature-awesome npm test
64
+
65
+ # すべてのworktreeをリスト表示
66
+ phantom list
67
+
68
+ # 完了したらクリーンアップ
69
+ phantom delete feature-awesome
70
+ ```
71
+
72
+ ## 📦 インストール
73
+
74
+ ### npmを使用(推奨)
75
+ ```bash
76
+ npm install -g @aku11i/phantom
77
+ ```
78
+
79
+ ### pnpmを使用
80
+ ```bash
81
+ pnpm add -g @aku11i/phantom
82
+ ```
83
+
84
+ ### yarnを使用
85
+ ```bash
86
+ yarn global add @aku11i/phantom
87
+ ```
88
+
89
+ ### ソースからビルド
90
+ ```bash
91
+ git clone https://github.com/aku11i/phantom.git
92
+ cd phantom
93
+ pnpm install
94
+ pnpm build
95
+ npm link
96
+ ```
97
+
98
+ ## 📖 ドキュメント
99
+
100
+ ### コマンド概要
101
+
102
+ #### Worktree管理
103
+
104
+ ```bash
105
+ # 対応するブランチを持つ新しいworktreeを作成
106
+ phantom create <name>
107
+
108
+ # すべてのworktreeとその現在のステータスをリスト表示
109
+ phantom list
110
+
111
+ # worktreeへの絶対パスを取得
112
+ phantom where <name>
113
+
114
+ # worktreeとそのブランチを削除
115
+ phantom delete <name>
116
+ phantom delete <name> --force # コミットされていない変更がある場合の強制削除
117
+ ```
118
+
119
+ #### Worktreeでの作業
120
+
121
+ ```bash
122
+ # worktreeのコンテキストで任意のコマンドを実行
123
+ phantom exec <name> <command> [args...]
124
+
125
+ # 例:
126
+ phantom exec feature-auth npm install
127
+ phantom exec feature-auth npm run test
128
+ phantom exec feature-auth git status
129
+
130
+ # worktreeでインタラクティブシェルセッションを開く
131
+ phantom shell <name>
132
+ ```
133
+
134
+ ### 環境変数
135
+
136
+ `phantom shell`でインタラクティブシェルを開いた際、以下の環境変数が設定されます:
137
+
138
+ - `PHANTOM` - phantom shellから起動されたすべてのプロセスに"1"がセットされる
139
+ - `PHANTOM_NAME` - 現在のworktreeの名前
140
+ - `PHANTOM_PATH` - worktreeディレクトリへの絶対パス
141
+
142
+ ## 💡 ユースケース
143
+
144
+ Phantomは単なるworktreeラッパーではなく、開発生産性を劇的に向上させるツールです。以下に実際の使用例を紹介します。
145
+
146
+ ### tmuxとの統合
147
+
148
+ tmuxとPhantomを組み合わせることで、驚くほど効率的なワークフローを実現できます:
149
+
150
+ ```bash
151
+ # 新しいtmuxウィンドウを開いて、同時にworktreeを作成
152
+ tmux new-window 'phantom create new-feature --shell'
153
+ ```
154
+
155
+ このたった1行のコマンドで:
156
+ 1. `new-feature`用の新しいGit worktreeを作成 ✨
157
+ 2. 新しいtmuxウィンドウを開く 🪟
158
+ 3. 新しいworktreeでインタラクティブシェルを起動 🚀
159
+
160
+ 複数の機能を並行して開発する際に、各機能を独立したtmuxウィンドウで管理できます。
161
+
162
+ ### VS Codeとの統合
163
+
164
+ ```bash
165
+ # worktreeを作成してすぐにVS Codeで開く
166
+ phantom create feature-auth
167
+ phantom exec feature-auth code .
168
+ ```
169
+
170
+ ### 並行開発ワークフロー
171
+
172
+ ```bash
173
+ # 機能開発中にバグレポートが来た場合
174
+ phantom create hotfix-critical # バグ修正用のworktreeを作成
175
+ phantom shell hotfix-critical # すぐに作業開始
176
+
177
+ # 修正後、元の機能開発に戻る
178
+ exit # hotfixシェルを終了
179
+ phantom shell feature-awesome # 機能開発を続行
180
+ ```
181
+
182
+ ## 🔄 Phantom vs Git Worktree
183
+
184
+ | 機能 | Git Worktree | Phantom |
185
+ |---------|--------------|---------|
186
+ | worktree + ブランチの作成 | `git worktree add -b feature ../project-feature` | `phantom create feature` |
187
+ | worktreeのリスト表示 | `git worktree list` | `phantom list` |
188
+ | worktreeへの移動 | `cd ../project-feature` | `phantom shell feature` |
189
+ | worktreeでコマンド実行 | `cd ../project-feature && npm test` | `phantom exec feature npm test` |
190
+ | worktreeの削除 | `git worktree remove ../project-feature` | `phantom delete feature` |
191
+
192
+ ## 🛠️ 開発
193
+
194
+ ```bash
195
+ # クローンとセットアップ
196
+ git clone https://github.com/aku11i/phantom.git
197
+ cd phantom
198
+ pnpm install
199
+
200
+ # テストの実行
201
+ pnpm test
202
+
203
+ # 型チェック
204
+ pnpm type-check
205
+
206
+ # リンティング
207
+ pnpm lint
208
+
209
+ # すべてのチェックを実行
210
+ pnpm ready
211
+ ```
212
+
213
+ ## 🚀 リリースプロセス
214
+
215
+ Phantomの新しいバージョンをリリースするには:
216
+
217
+ 1. **mainブランチにいて最新の状態であることを確認**
218
+ ```bash
219
+ git checkout main
220
+ git pull
221
+ ```
222
+
223
+ 2. **すべてのチェックを実行**
224
+ ```bash
225
+ pnpm ready
226
+ ```
227
+
228
+ 3. **バージョンを上げる**
229
+ ```bash
230
+ # パッチリリース(バグ修正)の場合
231
+ npm version patch
232
+
233
+ # マイナーリリース(新機能)の場合
234
+ npm version minor
235
+
236
+ # メジャーリリース(破壊的変更)の場合
237
+ npm version major
238
+ ```
239
+
240
+ 4. **バージョンコミットとタグをプッシュ**
241
+ ```bash
242
+ git push && git push --tags
243
+ ```
244
+
245
+ 5. **npmに公開**
246
+ ```bash
247
+ pnpm publish
248
+ ```
249
+
250
+ 6. **GitHubリリースを作成**
251
+ ```bash
252
+ # 自動生成されたノートでリリースを作成
253
+ gh release create v<version> \
254
+ --title "Phantom v<version>" \
255
+ --generate-notes \
256
+ --target main
257
+
258
+ # v0.1.3の例:
259
+ gh release create v0.1.3 \
260
+ --title "Phantom v0.1.3" \
261
+ --generate-notes \
262
+ --target main
263
+ ```
264
+
265
+ ビルドプロセスは`prepublishOnly`スクリプトによって自動的に処理され、以下を行います:
266
+ - すべてのテストとチェックを実行
267
+ - esbuildを使用してTypeScriptソースをJavaScriptにビルド
268
+ - `dist/`ディレクトリにバンドルされた実行可能ファイルを作成
269
+
270
+ **注意**: `dist/`ディレクトリはgit-ignoreされており、公開プロセス中にのみ作成されます。
271
+
272
+ ## 🤝 コントリビューション
273
+
274
+ コントリビューションは歓迎します!プルリクエストを自由に送信してください。大きな変更については、まず変更したい内容について議論するためにissueを開いてください。
275
+
276
+ 以下を必ず行ってください:
277
+ - 適切にテストを更新する
278
+ - 既存のコードスタイルに従う
279
+ - 提出前に`pnpm ready`を実行する
280
+
281
+ ## 📄 ライセンス
282
+
283
+ このプロジェクトはMITライセンスの下でライセンスされています - 詳細は[LICENSE](LICENSE)ファイルをご覧ください。
284
+
285
+ ## 🙏 謝辞
286
+
287
+ - より良い並行開発ワークフローの必要性に触発されて
288
+ - AI支援開発時代のために構築
289
+ - すべてのコントリビューターに特別な感謝を
290
+
291
+ ## 🤝 コントリビューター
292
+
293
+ - [@aku11i](https://github.com/aku11i) - プロジェクトの作成者およびメンテナー
294
+ - [Claude (Anthropic)](https://claude.ai) - コードベースの大部分を実装したAIペアプログラマー
295
+
296
+ ---
297
+
298
+ <div align="center">
299
+ <a href="https://github.com/aku11i">aku11i</a>と<a href="https://claude.ai">Claude</a>により👻で作成
300
+ </div>
package/README.md CHANGED
@@ -8,11 +8,15 @@
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
9
  [![Node.js Version](https://img.shields.io/node/v/@aku11i/phantom.svg)](https://nodejs.org)
10
10
 
11
- [Installation](#-installation) • [Quick Start](#-quick-start) • [Why Phantom?](#-why-phantom) • [Documentation](#-documentation)
11
+ [Installation](#-installation) • [Basic Usage](#-basic-usage) • [Why Phantom?](#-why-phantom) • [Documentation](#-documentation) • [日本語](./README.ja.md)
12
12
 
13
13
  </div>
14
14
 
15
- ## ✨ Key Features
15
+ ## ✨ Overview
16
+
17
+ Phantom is a CLI tool that dramatically simplifies Git worktree management. It's optimized for modern development workflows where you need to work on multiple features, bug fixes, and PR reviews in parallel.
18
+
19
+ ### Key Features
16
20
 
17
21
  - 🚀 **Simplified Worktree Management** - Create and manage Git worktrees with intuitive commands
18
22
  - 🔄 **Seamless Context Switching** - Jump between different features without stashing or committing
@@ -23,41 +27,46 @@
23
27
 
24
28
  ## 🤔 Why Phantom?
25
29
 
26
- Modern development workflows often require working on multiple features simultaneously. Whether you're running AI coding agents in parallel, reviewing PRs while developing, or simply multitasking across features, managing multiple Git worktrees can be cumbersome.
30
+ Modern development workflows often require working on multiple features simultaneously. While Git worktree is a powerful feature, it requires specifying paths and branches separately, which can be cumbersome.
31
+
32
+ ### The Manual Process
33
+
34
+ When using Git worktree directly, you need to specify the worktree path, branch name, and base branch each time. Additionally, switching between tasks requires navigating directories, which can be a bit tedious when frequently switching between multiple parallel tasks.
27
35
 
28
- **The Problem:**
29
- - Git worktree commands are verbose and complex
30
- - Managing branches and worktrees separately is error-prone
31
- - Switching contexts requires multiple commands
32
- - Running parallel AI agents on the same codebase is challenging
36
+ ### The Phantom Solution
37
+
38
+ ```bash
39
+ # Traditional approach
40
+ git worktree add -b feature ../project-feature origin/main
41
+ cd ../project-feature
42
+
43
+ # With Phantom
44
+ phantom create feature --shell
45
+ ```
33
46
 
34
- **The Phantom Solution:**
35
- - One command to create both worktree and branch: `phantom garden create feature-x`
36
- - Instant context switching: `phantom shell feature-x`
37
- - Execute commands without changing directories: `phantom exec feature-x npm test`
38
- - Perfect for "parallel vibe coding" with multiple AI agents
47
+ Phantom combines worktree and branch creation into a single command, making it easy to switch between and work in different workspaces.
39
48
 
40
- ## 🚀 Quick Start
49
+ ## 🚀 Basic Usage
41
50
 
42
51
  ```bash
43
52
  # Install Phantom
44
53
  npm install -g @aku11i/phantom
45
54
 
46
- # Create a new development space (garden)
47
- phantom garden create feature-awesome
55
+ # Create a new worktree
56
+ phantom create feature-awesome
48
57
 
49
- # Jump into the new space
58
+ # Jump into the worktree
50
59
  phantom shell feature-awesome
51
60
 
52
61
  # Or execute commands directly
53
62
  phantom exec feature-awesome npm install
54
63
  phantom exec feature-awesome npm test
55
64
 
56
- # List all your gardens
57
- phantom garden list
65
+ # List all your worktrees
66
+ phantom list
58
67
 
59
68
  # Clean up when done
60
- phantom garden delete feature-awesome
69
+ phantom delete feature-awesome
61
70
  ```
62
71
 
63
72
  ## 📦 Installation
@@ -88,62 +97,97 @@ npm link
88
97
 
89
98
  ## 📖 Documentation
90
99
 
91
- ### Core Concepts
92
-
93
- **Gardens** 🌳 - Git worktrees managed by Phantom. Each garden is an isolated workspace for a specific branch or feature.
94
-
95
- **Phantoms** 👻 - Processes or agents that work within gardens.
96
-
97
100
  ### Commands Overview
98
101
 
99
- #### Gardens Management
102
+ #### Worktree Management
100
103
 
101
104
  ```bash
102
- # Create a new garden with a matching branch
103
- phantom garden create <name>
105
+ # Create a new worktree with a matching branch
106
+ phantom create <name>
104
107
 
105
- # List all gardens with their current status
106
- phantom garden list
108
+ # List all worktrees with their current status
109
+ phantom list
107
110
 
108
- # Get the absolute path to a garden
109
- phantom garden where <name>
111
+ # Get the absolute path to a worktree
112
+ phantom where <name>
110
113
 
111
- # Delete a garden and its branch
112
- phantom garden delete <name>
113
- phantom garden delete <name> --force # Force delete with uncommitted changes
114
+ # Delete a worktree and its branch
115
+ phantom delete <name>
116
+ phantom delete <name> --force # Force delete with uncommitted changes
114
117
  ```
115
118
 
116
- #### Working with Gardens
119
+ #### Working with Worktrees
117
120
 
118
121
  ```bash
119
- # Execute any command in a garden's context
120
- phantom exec <garden> <command> [args...]
122
+ # Execute any command in a worktree's context
123
+ phantom exec <name> <command> [args...]
121
124
 
122
125
  # Examples:
123
126
  phantom exec feature-auth npm install
124
127
  phantom exec feature-auth npm run test
125
128
  phantom exec feature-auth git status
126
129
 
127
- # Open an interactive shell session in a garden
128
- phantom shell <garden>
130
+ # Open an interactive shell session in a worktree
131
+ phantom shell <name>
129
132
  ```
130
133
 
131
134
  ### Environment Variables
132
135
 
133
- When working within a Phantom context, these environment variables are available:
136
+ When opening an interactive shell with `phantom shell`, these environment variables are set:
137
+
138
+ - `PHANTOM` - Set to "1" for all processes spawned from phantom shell
139
+ - `PHANTOM_NAME` - Name of the current worktree
140
+ - `PHANTOM_PATH` - Absolute path to the worktree directory
141
+
142
+ ## 💡 Use Cases
143
+
144
+ Phantom is more than just a worktree wrapper - it's a productivity multiplier. Here are some real-world examples:
145
+
146
+ ### tmux Integration
147
+
148
+ Combine tmux with Phantom for an incredibly efficient workflow:
134
149
 
135
- - `PHANTOM_GARDEN` - Name of the current garden
136
- - `PHANTOM_GARDEN_PATH` - Absolute path to the garden directory
150
+ ```bash
151
+ # Open a new tmux window and create a worktree in one command
152
+ tmux new-window 'phantom create new-feature --shell'
153
+ ```
154
+
155
+ This single line:
156
+ 1. Creates a new Git worktree for `new-feature` ✨
157
+ 2. Opens a new tmux window 🪟
158
+ 3. Starts an interactive shell in the new worktree 🚀
159
+
160
+ When developing multiple features in parallel, you can manage each feature in its own tmux window.
161
+
162
+ ### VS Code Integration
163
+
164
+ ```bash
165
+ # Create a worktree and immediately open it in VS Code
166
+ phantom create feature-auth
167
+ phantom exec feature-auth code .
168
+ ```
169
+
170
+ ### Parallel Development Workflow
171
+
172
+ ```bash
173
+ # When a bug report comes in during feature development
174
+ phantom create hotfix-critical # Create worktree for the fix
175
+ phantom shell hotfix-critical # Start working immediately
176
+
177
+ # After fixing, return to your feature
178
+ exit # Exit the hotfix shell
179
+ phantom shell feature-awesome # Continue feature development
180
+ ```
137
181
 
138
182
  ## 🔄 Phantom vs Git Worktree
139
183
 
140
184
  | Feature | Git Worktree | Phantom |
141
185
  |---------|--------------|---------|
142
- | Create worktree + branch | `git worktree add -b feature ../project-feature` | `phantom garden create feature` |
143
- | List worktrees | `git worktree list` | `phantom garden list` |
186
+ | Create worktree + branch | `git worktree add -b feature ../project-feature` | `phantom create feature` |
187
+ | List worktrees | `git worktree list` | `phantom list` |
144
188
  | Navigate to worktree | `cd ../project-feature` | `phantom shell feature` |
145
189
  | Run command in worktree | `cd ../project-feature && npm test` | `phantom exec feature npm test` |
146
- | Remove worktree | `git worktree remove ../project-feature` | `phantom garden delete feature` |
190
+ | Remove worktree | `git worktree remove ../project-feature` | `phantom delete feature` |
147
191
 
148
192
  ## 🛠️ Development
149
193
 
@@ -185,10 +229,10 @@ To release a new version of Phantom:
185
229
  ```bash
186
230
  # For patch releases (bug fixes)
187
231
  npm version patch
188
-
232
+
189
233
  # For minor releases (new features)
190
234
  npm version minor
191
-
235
+
192
236
  # For major releases (breaking changes)
193
237
  npm version major
194
238
  ```
@@ -210,7 +254,7 @@ To release a new version of Phantom:
210
254
  --title "Phantom v<version>" \
211
255
  --generate-notes \
212
256
  --target main
213
-
257
+
214
258
  # Example for v0.1.3:
215
259
  gh release create v0.1.3 \
216
260
  --title "Phantom v0.1.3" \
package/dist/garden.js CHANGED
File without changes