@aku11i/phantom 0.3.0 → 0.5.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 CHANGED
@@ -8,36 +8,46 @@
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
- [インストール](#-インストール) • [クイックスタート](#-クイックスタート) • [なぜPhantom?](#-なぜphantom) • [ドキュメント](#-ドキュメント)
11
+ [インストール](#-インストール) • [基本的な使い方](#-基本的な使い方) • [なぜPhantom?](#-なぜphantom) • [ドキュメント](#-ドキュメント)
12
12
 
13
13
  </div>
14
14
 
15
- ## ✨ 主な機能
15
+ ## ✨ 概要
16
+
17
+ Phantomは、Git worktreeの管理を劇的にシンプルにするCLIツールです。複数の機能開発、バグ修正、PRレビューを並行して進める現代の開発ワークフローに最適化されています。
18
+
19
+ ### 主な特徴
16
20
 
17
21
  - 🚀 **シンプルなWorktree管理** - 直感的なコマンドでGit worktreeを作成・管理
18
- - 🔄 **シームレスなコンテキスト切り替え** - stashやcommitせずに異なる機能間をジャンプ
22
+ - 🔄 **シームレスなコンテキスト切り替え** - stashやcommitせずに異なる作業間を瞬時に移動
19
23
  - 🤖 **AI対応** - 複数のAIコーディングエージェントを並行実行するのに最適
20
24
  - 🎯 **ブランチとWorktreeの同期** - 各worktreeに対応するブランチを自動作成
21
25
  - 🐚 **インタラクティブシェル** - SSH風のworktreeナビゲーション体験
22
26
  - ⚡ **ゼロ設定** - 賢明なデフォルト設定ですぐに使用可能
27
+ - 📦 **ゼロ依存** - 外部依存関係がなく軽量で高速
23
28
 
24
29
  ## 🤔 なぜPhantom?
25
30
 
26
- 現代の開発ワークフローでは、複数の機能を同時に作業することがよくあります。AIコーディングエージェントを並行実行したり、開発しながらPRをレビューしたり、単純に複数の機能をマルチタスクで作業したりする場合、複数のGit worktreeの管理は面倒になりがちです。
31
+ 現代の開発ワークフローでは、複数の機能を同時に作業することが一般的になっています。Git worktreeは素晴らしい機能ですが、パスとブランチを個別に指定する必要があり、少し面倒です。
32
+
33
+ ### Git worktreeを使う際の問題点
34
+
35
+ 素のGit worktreeを使う場合、worktreeのパス、ブランチ名、ベースブランチなどを毎回指定する必要があります。また、作業を切り替える際はディレクトリを移動する必要があり、複数の作業を頻繁に切り替える場合は少し手間がかかります。
36
+
37
+ ### Phantomの解決策
38
+
39
+ ```bash
40
+ # 従来の方法
41
+ git worktree add -b feature ../project-feature origin/main
42
+ cd ../project-feature
27
43
 
28
- **問題点:**
29
- - Git worktreeコマンドは冗長で複雑
30
- - ブランチとworktreeを別々に管理するのはエラーが起きやすい
31
- - コンテキストの切り替えには複数のコマンドが必要
32
- - 同じコードベースで並行してAIエージェントを実行するのは困難
44
+ # Phantomを使用
45
+ phantom create feature --shell
46
+ ```
33
47
 
34
- **Phantomの解決策:**
35
- - 1つのコマンドでworktreeとブランチの両方を作成: `phantom create feature-x`
36
- - 即座にコンテキストを切り替え: `phantom shell feature-x`
37
- - ディレクトリを変更せずにコマンドを実行: `phantom exec feature-x npm test`
38
- - 複数のAIエージェントとの「並行バイブコーディング」に最適
48
+ Phantomは、worktreeとブランチの作成を1つのコマンドにまとめ、作業スペース間の移動や操作を簡単にします。
39
49
 
40
- ## 🚀 クイックスタート
50
+ ## 🚀 基本的な使い方
41
51
 
42
52
  ```bash
43
53
  # Phantomをインストール
@@ -46,6 +56,9 @@ npm install -g @aku11i/phantom
46
56
  # 新しいworktreeを作成
47
57
  phantom create feature-awesome
48
58
 
59
+ # 既存のブランチにアタッチ
60
+ phantom attach existing-branch
61
+
49
62
  # worktreeにジャンプ
50
63
  phantom shell feature-awesome
51
64
 
@@ -88,10 +101,6 @@ npm link
88
101
 
89
102
  ## 📖 ドキュメント
90
103
 
91
- ### コアコンセプト
92
-
93
- **Worktree** 🌳 - Phantomによって管理されるGit worktree。各worktreeは特定のブランチや機能のための独立したワークスペースで、競合なしに並行開発が可能です。
94
-
95
104
  ### コマンド概要
96
105
 
97
106
  #### Worktree管理
@@ -100,6 +109,9 @@ npm link
100
109
  # 対応するブランチを持つ新しいworktreeを作成
101
110
  phantom create <name>
102
111
 
112
+ # 既存のブランチにworktreeとしてアタッチ
113
+ phantom attach <branch-name>
114
+
103
115
  # すべてのworktreeとその現在のステータスをリスト表示
104
116
  phantom list
105
117
 
@@ -128,16 +140,61 @@ phantom shell <name>
128
140
 
129
141
  ### 環境変数
130
142
 
131
- Phantomで管理されたworktree内で作業する際、以下の環境変数が利用可能です:
143
+ `phantom shell`でインタラクティブシェルを開いた際、以下の環境変数が設定されます:
132
144
 
145
+ - `PHANTOM` - phantom shellから起動されたすべてのプロセスに"1"がセットされる
133
146
  - `PHANTOM_NAME` - 現在のworktreeの名前
134
147
  - `PHANTOM_PATH` - worktreeディレクトリへの絶対パス
135
148
 
149
+ ## 💡 ユースケース
150
+
151
+ Phantomは単なるworktreeラッパーではなく、開発生産性を劇的に向上させるツールです。以下に実際の使用例を紹介します。
152
+
153
+ ### tmuxとの統合
154
+
155
+ tmuxとPhantomを組み合わせることで、驚くほど効率的なワークフローを実現できます:
156
+
157
+ ```bash
158
+ # 新しいtmuxウィンドウを開いて、同時にworktreeを作成
159
+ tmux new-window 'phantom create --shell new-feature'
160
+ ```
161
+
162
+ このたった1行のコマンドで:
163
+ 1. `new-feature`用の新しいGit worktreeを作成 ✨
164
+ 2. 新しいtmuxウィンドウを開く 🪟
165
+ 3. 新しいworktreeでインタラクティブシェルを起動 🚀
166
+
167
+ 複数の機能を並行して開発する際に、各機能を独立したtmuxウィンドウで管理できます。
168
+
169
+ ### VS Codeとの統合
170
+
171
+ ```bash
172
+ # worktreeを作成してすぐにVS Codeで開く
173
+ phantom create --exec "code ." new-feature
174
+ phantom create --exec "cursor ." new-feature # Cursorでも動作します!
175
+
176
+ # 既存のブランチにアタッチしてVS Codeで開く
177
+ phantom attach --exec "code ." feature/existing-branch
178
+ ```
179
+
180
+ ### 並行開発ワークフロー
181
+
182
+ ```bash
183
+ # 機能開発中にバグレポートが来た場合
184
+ phantom create hotfix-critical # バグ修正用のworktreeを作成
185
+ phantom shell hotfix-critical # すぐに作業開始
186
+
187
+ # 修正後、元の機能開発に戻る
188
+ exit # hotfixシェルを終了
189
+ phantom shell feature-awesome # 機能開発を続行
190
+ ```
191
+
136
192
  ## 🔄 Phantom vs Git Worktree
137
193
 
138
194
  | 機能 | Git Worktree | Phantom |
139
195
  |---------|--------------|---------|
140
196
  | worktree + ブランチの作成 | `git worktree add -b feature ../project-feature` | `phantom create feature` |
197
+ | 既存のブランチにアタッチ | `git worktree add ../project-feature feature` | `phantom attach feature` |
141
198
  | worktreeのリスト表示 | `git worktree list` | `phantom list` |
142
199
  | worktreeへの移動 | `cd ../project-feature` | `phantom shell feature` |
143
200
  | worktreeでコマンド実行 | `cd ../project-feature && npm test` | `phantom exec feature npm test` |
@@ -155,7 +212,7 @@ pnpm install
155
212
  pnpm test
156
213
 
157
214
  # 型チェック
158
- pnpm type-check
215
+ pnpm typecheck
159
216
 
160
217
  # リンティング
161
218
  pnpm lint
@@ -183,10 +240,10 @@ Phantomの新しいバージョンをリリースするには:
183
240
  ```bash
184
241
  # パッチリリース(バグ修正)の場合
185
242
  npm version patch
186
-
243
+
187
244
  # マイナーリリース(新機能)の場合
188
245
  npm version minor
189
-
246
+
190
247
  # メジャーリリース(破壊的変更)の場合
191
248
  npm version major
192
249
  ```
@@ -208,7 +265,7 @@ Phantomの新しいバージョンをリリースするには:
208
265
  --title "Phantom v<version>" \
209
266
  --generate-notes \
210
267
  --target main
211
-
268
+
212
269
  # v0.1.3の例:
213
270
  gh release create v0.1.3 \
214
271
  --title "Phantom v0.1.3" \
@@ -216,6 +273,33 @@ Phantomの新しいバージョンをリリースするには:
216
273
  --target main
217
274
  ```
218
275
 
276
+ 7. **リリースノートを分かりやすく更新**
277
+ - 自動生成されたリリースノートをレビュー
278
+ - 重要な詳細についてはPRの説明を確認
279
+ - リリースノートをよりユーザーフレンドリーに更新:
280
+ - 変更をカテゴリー別にグループ化(機能、バグ修正、改善)
281
+ - 新機能には使用例を追加
282
+ - 変更の影響を平易な言葉で説明
283
+ - セキュリティ修正と破壊的変更を強調
284
+
285
+ ```bash
286
+ # リリースノートを編集
287
+ gh release edit v<version> --notes "$(cat <<'EOF'
288
+ ## 🚀 v<version> の新機能
289
+
290
+ ### ✨ 新機能
291
+ - 使用例付きの機能説明
292
+
293
+ ### 🐛 バグ修正
294
+ - 修正内容の明確な説明
295
+
296
+ ### 🛠️ 改善
297
+ - パフォーマンス、セキュリティ、その他の改善
298
+
299
+ EOF
300
+ )"
301
+ ```
302
+
219
303
  ビルドプロセスは`prepublishOnly`スクリプトによって自動的に処理され、以下を行います:
220
304
  - すべてのテストとチェックを実行
221
305
  - esbuildを使用してTypeScriptソースをJavaScriptにビルド
@@ -251,4 +335,4 @@ Phantomの新しいバージョンをリリースするには:
251
335
 
252
336
  <div align="center">
253
337
  <a href="https://github.com/aku11i">aku11i</a>と<a href="https://claude.ai">Claude</a>により👻で作成
254
- </div>
338
+ </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) • [日本語](./README.ja.md)
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
@@ -20,24 +24,30 @@
20
24
  - 🎯 **Branch-Worktree Sync** - Automatically creates matching branches for each worktree
21
25
  - 🐚 **Interactive Shell** - SSH-like experience for worktree navigation
22
26
  - ⚡ **Zero Configuration** - Works out of the box with sensible defaults
27
+ - 📦 **Zero Dependencies** - Lightweight and fast with no external dependencies
23
28
 
24
29
  ## 🤔 Why Phantom?
25
30
 
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.
31
+ 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.
32
+
33
+ ### The Manual Process
34
+
35
+ 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.
36
+
37
+ ### The Phantom Solution
38
+
39
+ ```bash
40
+ # Traditional approach
41
+ git worktree add -b feature ../project-feature origin/main
42
+ cd ../project-feature
27
43
 
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
44
+ # With Phantom
45
+ phantom create feature --shell
46
+ ```
33
47
 
34
- **The Phantom Solution:**
35
- - One command to create both worktree and branch: `phantom 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
48
+ Phantom combines worktree and branch creation into a single command, making it easy to switch between and work in different workspaces.
39
49
 
40
- ## 🚀 Quick Start
50
+ ## 🚀 Basic Usage
41
51
 
42
52
  ```bash
43
53
  # Install Phantom
@@ -46,6 +56,9 @@ npm install -g @aku11i/phantom
46
56
  # Create a new worktree
47
57
  phantom create feature-awesome
48
58
 
59
+ # Attach to an existing branch
60
+ phantom attach existing-branch
61
+
49
62
  # Jump into the worktree
50
63
  phantom shell feature-awesome
51
64
 
@@ -88,10 +101,6 @@ npm link
88
101
 
89
102
  ## 📖 Documentation
90
103
 
91
- ### Core Concepts
92
-
93
- **Worktrees** 🌳 - Git worktrees managed by Phantom. Each worktree is an isolated workspace for a specific branch or feature, allowing parallel development without conflicts.
94
-
95
104
  ### Commands Overview
96
105
 
97
106
  #### Worktree Management
@@ -100,6 +109,9 @@ npm link
100
109
  # Create a new worktree with a matching branch
101
110
  phantom create <name>
102
111
 
112
+ # Attach to an existing branch as a worktree
113
+ phantom attach <branch-name>
114
+
103
115
  # List all worktrees with their current status
104
116
  phantom list
105
117
 
@@ -128,16 +140,61 @@ phantom shell <name>
128
140
 
129
141
  ### Environment Variables
130
142
 
131
- When working within a worktree managed by Phantom, these environment variables are available:
143
+ When opening an interactive shell with `phantom shell`, these environment variables are set:
132
144
 
145
+ - `PHANTOM` - Set to "1" for all processes spawned from phantom shell
133
146
  - `PHANTOM_NAME` - Name of the current worktree
134
147
  - `PHANTOM_PATH` - Absolute path to the worktree directory
135
148
 
149
+ ## 💡 Use Cases
150
+
151
+ Phantom is more than just a worktree wrapper - it's a productivity multiplier. Here are some real-world examples:
152
+
153
+ ### tmux Integration
154
+
155
+ Combine tmux with Phantom for an incredibly efficient workflow:
156
+
157
+ ```bash
158
+ # Open a new tmux window and create a worktree in one command
159
+ tmux new-window 'phantom create --shell new-feature'
160
+ ```
161
+
162
+ This single line:
163
+ 1. Creates a new Git worktree for `new-feature` ✨
164
+ 2. Opens a new tmux window 🪟
165
+ 3. Starts an interactive shell in the new worktree 🚀
166
+
167
+ When developing multiple features in parallel, you can manage each feature in its own tmux window.
168
+
169
+ ### VS Code Integration
170
+
171
+ ```bash
172
+ # Create a worktree and immediately open it in VS Code
173
+ phantom create --exec "code ." new-feature
174
+ phantom create --exec "cursor ." new-feature # also works with cursor!!
175
+
176
+ # Attach to existing branch and open in VS Code
177
+ phantom attach --exec "code ." feature/existing-branch
178
+ ```
179
+
180
+ ### Parallel Development Workflow
181
+
182
+ ```bash
183
+ # When a bug report comes in during feature development
184
+ phantom create hotfix-critical # Create worktree for the fix
185
+ phantom shell hotfix-critical # Start working immediately
186
+
187
+ # After fixing, return to your feature
188
+ exit # Exit the hotfix shell
189
+ phantom shell feature-awesome # Continue feature development
190
+ ```
191
+
136
192
  ## 🔄 Phantom vs Git Worktree
137
193
 
138
194
  | Feature | Git Worktree | Phantom |
139
195
  |---------|--------------|---------|
140
196
  | Create worktree + branch | `git worktree add -b feature ../project-feature` | `phantom create feature` |
197
+ | Attach to existing branch | `git worktree add ../project-feature feature` | `phantom attach feature` |
141
198
  | List worktrees | `git worktree list` | `phantom list` |
142
199
  | Navigate to worktree | `cd ../project-feature` | `phantom shell feature` |
143
200
  | Run command in worktree | `cd ../project-feature && npm test` | `phantom exec feature npm test` |
@@ -155,7 +212,7 @@ pnpm install
155
212
  pnpm test
156
213
 
157
214
  # Type checking
158
- pnpm type-check
215
+ pnpm typecheck
159
216
 
160
217
  # Linting
161
218
  pnpm lint
@@ -183,10 +240,10 @@ To release a new version of Phantom:
183
240
  ```bash
184
241
  # For patch releases (bug fixes)
185
242
  npm version patch
186
-
243
+
187
244
  # For minor releases (new features)
188
245
  npm version minor
189
-
246
+
190
247
  # For major releases (breaking changes)
191
248
  npm version major
192
249
  ```
@@ -208,7 +265,7 @@ To release a new version of Phantom:
208
265
  --title "Phantom v<version>" \
209
266
  --generate-notes \
210
267
  --target main
211
-
268
+
212
269
  # Example for v0.1.3:
213
270
  gh release create v0.1.3 \
214
271
  --title "Phantom v0.1.3" \
@@ -216,6 +273,33 @@ To release a new version of Phantom:
216
273
  --target main
217
274
  ```
218
275
 
276
+ 7. **Update release notes for clarity**
277
+ - Review the auto-generated release notes
278
+ - Check PR descriptions for important details
279
+ - Update the release notes to be more user-friendly:
280
+ - Group changes by category (Features, Bug Fixes, Improvements)
281
+ - Add usage examples for new features
282
+ - Explain the impact of changes in plain language
283
+ - Highlight security fixes and breaking changes
284
+
285
+ ```bash
286
+ # Edit the release notes
287
+ gh release edit v<version> --notes "$(cat <<'EOF'
288
+ ## 🚀 What's New in v<version>
289
+
290
+ ### ✨ New Features
291
+ - Feature description with usage example
292
+
293
+ ### 🐛 Bug Fixes
294
+ - Clear description of what was fixed
295
+
296
+ ### 🛠️ Improvements
297
+ - Performance, security, or other improvements
298
+
299
+ EOF
300
+ )"
301
+ ```
302
+
219
303
  The build process is automatically handled by the `prepublishOnly` script, which:
220
304
  - Runs all tests and checks
221
305
  - Builds the TypeScript source to JavaScript using esbuild