@aku11i/phantom 0.9.0 → 1.0.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.md CHANGED
@@ -9,422 +9,177 @@
9
9
  [![Node.js Version](https://img.shields.io/node/v/@aku11i/phantom.svg)](https://nodejs.org)
10
10
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/aku11i/phantom)
11
11
 
12
- [Installation](#-installation) • [Basic Usage](#-basic-usage) • [Why Phantom?](#-why-phantom) • [Documentation](#-documentation) • [日本語](./README.ja.md)
12
+ [日本語](./README.ja.md) • [Installation](#-installation) • [Why Phantom?](#-why-phantom) • [Basic Usage](#-basic-usage) • [Documentation](#-documentation)
13
13
 
14
14
  </div>
15
15
 
16
- ## ✨ Overview
16
+ ## ✨ What is Phantom?
17
17
 
18
- 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
+ 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.
19
19
 
20
20
  ### Key Features
21
21
 
22
- - 🚀 **Simplified Worktree Management** - Create and manage Git worktrees with intuitive commands
23
- - 🔄 **Seamless Context Switching** - Jump between different features without stashing or committing
24
- - 🤖 **AI-Friendly** - Perfect for running multiple AI coding agents in parallel
25
- - 🎯 **Branch-Worktree Sync** - Automatically creates matching branches for each worktree
26
- - 🐚 **Interactive Shell** - SSH-like experience for worktree navigation
27
- - **Zero Configuration** - Works out of the box with sensible defaults
28
- - 📦 **Zero Dependencies** - Lightweight and fast with no external dependencies
22
+ - 🚀 **Simple worktree management** - Create and manage Git worktrees with intuitive commands
23
+ - 🔄 **True multitasking** - Create separate working directories per branch and run multiple tasks simultaneously
24
+ - 🎯 **Execute commands from anywhere** - Run commands in any worktree with `phantom exec <worktree> <command>`
25
+ - 🪟 **Built-in tmux integration** - Open worktrees in new panes or windows
26
+ - 🔍 **Interactive selection with fzf** - Use built-in fzf option for worktree selection
27
+ - 🎮 **Shell completion** - Full autocomplete support for Fish and Zsh
28
+ - **Zero dependencies** - Fast and lightweight
29
29
 
30
- ## 🤔 Why Phantom?
31
-
32
- 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.
33
-
34
- ### The Manual Process
35
-
36
- 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.
30
+ ## 🚀 Installation
37
31
 
38
- ### The Phantom Solution
32
+ ### Using Homebrew (recommended)
39
33
 
40
34
  ```bash
41
- # Traditional approach
42
- git worktree add -b feature ../project-feature origin/main
43
- cd ../project-feature
44
-
45
- # With Phantom
46
- phantom create feature --shell
35
+ brew install aku11i/tap/phantom
47
36
  ```
48
37
 
49
- Phantom combines worktree and branch creation into a single command, making it easy to switch between and work in different workspaces.
50
-
51
- ## 🚀 Basic Usage
38
+ #### Using npm
52
39
 
53
40
  ```bash
54
- # Install Phantom
55
41
  npm install -g @aku11i/phantom
42
+ ```
56
43
 
57
- # Create a new worktree
58
- phantom create feature-awesome
59
-
60
- # Attach to an existing branch
61
- phantom attach existing-branch
62
-
63
- # Jump into the worktree
64
- phantom shell feature-awesome
44
+ ## 🤔 Why Phantom?
65
45
 
66
- # Or execute commands directly
67
- phantom exec feature-awesome npm install
68
- phantom exec feature-awesome npm test
46
+ Git worktrees are powerful but require manual management of paths and branches. Also, navigating between multiple worktrees is cumbersome. Phantom eliminates these problems:
69
47
 
70
- # List all your worktrees
71
- phantom list
48
+ ```bash
49
+ # Without Phantom
50
+ git worktree add -b feature-awesome ../project-feature-awesome origin/main
51
+ cd ../project-feature-awesome
72
52
 
73
- # Clean up when done
74
- phantom delete feature-awesome
53
+ # With Phantom
54
+ phantom create feature-awesome --shell
75
55
  ```
76
56
 
77
- ## 📦 Installation
57
+ ### How Phantom Works
78
58
 
79
- ### Using npm (recommended)
80
- ```bash
81
- npm install -g @aku11i/phantom
82
- ```
59
+ When you run `phantom create feature-awesome`, a new Git worktree named `feature-awesome` is created in `.git/phantom/worktrees/`.
60
+ All worktrees created with phantom are centrally managed in this location.
83
61
 
84
- ### Using pnpm
85
- ```bash
86
- pnpm add -g @aku11i/phantom
87
62
  ```
88
-
89
- ### Using yarn
90
- ```bash
91
- yarn global add @aku11i/phantom
63
+ your-project/ # Git repository
64
+ ├── .git/
65
+ │ └── phantom/
66
+ │ └── worktrees/ # Phantom-managed directory
67
+ │ ├── feature-awesome/ # branch name = worktree name
68
+ │ ├── bugfix-login/ # another worktree
69
+ │ └── hotfix-critical/ # yet another worktree
70
+ └── ...
92
71
  ```
93
72
 
94
- ### Build from source
95
- ```bash
96
- git clone https://github.com/aku11i/phantom.git
97
- cd phantom
98
- pnpm install
99
- pnpm build
100
- npm link
101
- ```
73
+ This convention means you never need to remember worktree paths - just use the branch name for easy worktree operations.
102
74
 
103
- ## 📖 Documentation
75
+ ### ✈️ Features for a Comfortable Development Experience
104
76
 
105
- ### Commands Overview
77
+ Phantom provides perfect functionality as a command-line tool. Developers feel the trust and comfort of flying first class.
106
78
 
107
- #### Worktree Management
79
+ #### Shell Completion
108
80
 
109
- ```bash
110
- # Create a new worktree with a matching branch
111
- phantom create <name>
112
- phantom create <name> --shell # Create and enter interactive shell
113
- phantom create <name> --exec <command> # Create and execute command
114
- phantom create <name> --tmux # Create and open in new tmux window
115
- phantom create <name> --tmux-vertical # Create and split tmux pane vertically
116
- phantom create <name> --tmux-v # Shorthand for --tmux-vertical
117
- phantom create <name> --tmux-horizontal # Create and split tmux pane horizontally
118
- phantom create <name> --tmux-h # Shorthand for --tmux-horizontal
119
-
120
- # Create a worktree and copy specific files
121
- phantom create <name> --copy-file ".env" --copy-file ".env.local"
122
-
123
- # Attach to an existing branch as a worktree
124
- phantom attach <branch-name>
125
- phantom attach <branch-name> --shell # Attach and enter interactive shell
126
- phantom attach <branch-name> --exec <command> # Attach and execute command
127
-
128
- # List all worktrees with their current status
129
- phantom list
81
+ Phantom supports full shell completion for fish and zsh. Use tab key to complete commands and worktree names.
130
82
 
131
- # Get the absolute path to a worktree
132
- phantom where <name>
83
+ #### tmux Integration
133
84
 
134
- # Delete a worktree and its branch
135
- phantom delete <name>
136
- phantom delete <name> --force # Force delete with uncommitted changes
137
- phantom delete --current # Delete the current worktree (when inside one)
138
- phantom delete --current --force # Force delete current worktree
139
- ```
140
-
141
- #### Working with Worktrees
85
+ When creating worktrees, you can use tmux to open them in new windows or panes. This allows you to manage multiple work environments simultaneously.
142
86
 
143
87
  ```bash
144
- # Execute any command in a worktree's context
145
- phantom exec <name> <command> [args...]
88
+ # Create and open worktree in new window
89
+ phantom create feature-x --tmux
90
+ # Create with split panes
91
+ phantom create feature-y --tmux-vertical
92
+ phantom create feature-z --tmux-horizontal
146
93
 
147
- # Examples:
148
- phantom exec feature-auth npm install
149
- phantom exec feature-auth npm run test
150
- phantom exec feature-auth git status
94
+ # Open existing worktrees in tmux
95
+ phantom shell feature-x --tmux
96
+ phantom shell feature-y --tmux-v
151
97
 
152
- # Open an interactive shell session in a worktree
153
- phantom shell <name>
98
+ # Result: Multiple worktrees displayed simultaneously, each allowing independent work
154
99
  ```
155
100
 
156
- ### Environment Variables
101
+ #### Editor Integration
157
102
 
158
- When opening an interactive shell with `phantom shell`, these environment variables are set:
103
+ Phantom works seamlessly with editors like VS Code and Cursor. You can specify an editor to open worktrees.
159
104
 
160
- - `PHANTOM` - Set to "1" for all processes spawned from phantom shell
161
- - `PHANTOM_NAME` - Name of the current worktree
162
- - `PHANTOM_PATH` - Absolute path to the worktree directory
105
+ ```bash
106
+ # Open with VS Code
107
+ phantom create feature --exec "code ."
163
108
 
164
- ## 💡 Use Cases
109
+ # Or open existing worktree
110
+ phantom exec feature code .
165
111
 
166
- Phantom is more than just a worktree wrapper - it's a productivity multiplier. Here are some real-world examples:
112
+ # Open with Cursor
113
+ phantom create feature --exec "cursor ."
114
+ phantom exec feature cursor .
115
+ ```
167
116
 
168
- ### tmux Integration
117
+ #### fzf Integration
169
118
 
170
- Combine tmux with Phantom for an incredibly efficient workflow:
119
+ Interactive search with fzf allows quick worktree selection.
171
120
 
172
121
  ```bash
173
- # Open a new tmux window and create a worktree in one command
174
- tmux new-window 'phantom create --shell new-feature'
175
- ```
122
+ # Open shell with fzf selection
123
+ phantom shell --fzf
176
124
 
177
- This single line:
178
- 1. Creates a new Git worktree for `new-feature` ✨
179
- 2. Opens a new tmux window 🪟
180
- 3. Starts an interactive shell in the new worktree 🚀
125
+ # Delete with fzf selection
126
+ phantom delete --fzf
127
+ ```
181
128
 
182
- When developing multiple features in parallel, you can manage each feature in its own tmux window.
129
+ ## 🔍 Basic Usage
183
130
 
184
- ### VS Code Integration
131
+ ### Create a new worktree
185
132
 
186
133
  ```bash
187
- # Create a worktree and immediately open it in VS Code
188
- phantom create --exec "code ." new-feature
189
- phantom create --exec "cursor ." new-feature # also works with cursor!!
134
+ phantom create feature-awesome
190
135
 
191
- # Attach to existing branch and open in VS Code
192
- phantom attach --exec "code ." feature/existing-branch
136
+ phantom list
193
137
  ```
194
138
 
195
- ### Parallel Development Workflow
139
+ ### Start a new shell in the worktree
196
140
 
197
141
  ```bash
198
- # When a bug report comes in during feature development
199
- phantom create hotfix-critical # Create worktree for the fix
200
- phantom shell hotfix-critical # Start working immediately
142
+ phantom shell feature-awesome
201
143
 
202
- # After fixing, return to your feature
203
- exit # Exit the hotfix shell
204
- phantom shell feature-awesome # Continue feature development
205
- ```
144
+ # Start development work
206
145
 
207
- ## 🔄 Phantom vs Git Worktree
208
-
209
- | Feature | Git Worktree | Phantom |
210
- |---------|--------------|---------|
211
- | Create worktree + branch | `git worktree add -b feature ../project-feature` | `phantom create feature` |
212
- | Attach to existing branch | `git worktree add ../project-feature feature` | `phantom attach feature` |
213
- | List worktrees | `git worktree list` | `phantom list` |
214
- | Navigate to worktree | `cd ../project-feature` | `phantom shell feature` |
215
- | Run command in worktree | `cd ../project-feature && npm test` | `phantom exec feature npm test` |
216
- | Remove worktree | `git worktree remove ../project-feature` | `phantom delete feature` |
217
- | Remove current worktree | `cd .. && git worktree remove project-feature` | `phantom delete --current` |
218
-
219
- ## ⚙️ Configuration
220
-
221
- Phantom supports configuration through a `phantom.config.json` file in your repository root. This allows you to define files to be automatically copied and commands to be executed when creating new worktrees.
222
-
223
- ### Configuration File
224
-
225
- Create a `phantom.config.json` file in your repository root:
226
-
227
- ```json
228
- {
229
- "postCreate": {
230
- "copyFiles": [
231
- ".env",
232
- ".env.local",
233
- "config/local.json"
234
- ],
235
- "commands": [
236
- "pnpm install",
237
- "pnpm build"
238
- ]
239
- }
240
- }
146
+ # Exit the shell when done
147
+ exit
241
148
  ```
242
149
 
243
- ### Copy Files Feature
244
-
245
- When creating a new worktree, Phantom can automatically copy specified files from your current worktree to the new one. This is particularly useful for:
246
-
247
- - Environment configuration files (`.env`, `.env.local`)
248
- - Local development settings
249
- - Secret files that are gitignored
250
-
251
- You can specify files to copy in two ways:
252
-
253
- 1. **Using the command line option:**
254
- ```bash
255
- phantom create feature --copy-file ".env" --copy-file ".env.local" --copy-file "config/local.json"
256
- ```
257
-
258
- 2. **Using the configuration file:**
259
- Configure once in `phantom.config.json` and it will apply to all new worktrees.
260
-
261
- 3. **Using both:**
262
- Files specified in both the configuration file and command line options are merged together (duplicates are removed).
263
-
264
- > **Note:** Currently, glob patterns are not supported. Files must be specified with their exact paths relative to the repository root.
265
-
266
- ### Post-Create Commands
267
-
268
- Phantom can automatically execute commands after creating a new worktree. This is useful for:
150
+ ### Run commands in any worktree
269
151
 
270
- - Installing dependencies (`pnpm install`, `npm install`, `yarn install`)
271
- - Building the project
272
- - Setting up the development environment
273
- - Running database migrations
274
- - Any other setup tasks specific to your project
275
-
276
- Commands are executed in the order they are specified in the configuration file. If a command fails, the creation process will stop and report the error.
277
-
278
- Example use cases:
279
- ```json
280
- {
281
- "postCreate": {
282
- "commands": [
283
- "pnpm install", // Install dependencies
284
- "pnpm db:migrate", // Run database migrations
285
- "cp .env.example .env", // Create environment file from template
286
- "pnpm build" // Build the project
287
- ]
288
- }
289
- }
152
+ ```bash
153
+ phantom exec feature-awesome {command to run}
154
+ # Example: phantom exec feature-awesome npm run build
290
155
  ```
291
156
 
292
- ## 🛠️ Development
157
+ ### Clean up when done
293
158
 
294
159
  ```bash
295
- # Clone and setup
296
- git clone https://github.com/aku11i/phantom.git
297
- cd phantom
298
- pnpm install
299
-
300
- # Run tests
301
- pnpm test
302
-
303
- # Run a specific test file
304
- pnpm test:file src/core/worktree/create.test.js
160
+ phantom delete feature-awesome
161
+ ```
305
162
 
306
- # Type checking
307
- pnpm typecheck
308
163
 
309
- # Linting
310
- pnpm lint
164
+ ## 📚 Documentation
311
165
 
312
- # Run all checks
313
- pnpm ready
314
- ```
166
+ - **[Getting Started](./docs/getting-started.md)** - Common workflows and tips
167
+ - **[Commands Reference](./docs/commands.md)** - All commands and options
168
+ - **[Configuration](./docs/configuration.md)** - Set up automatic file copying and post-create commands
315
169
 
316
- ## 🚀 Release Process
317
-
318
- To release a new version of Phantom:
319
-
320
- 1. **Ensure you're on main branch and up to date**
321
- ```bash
322
- git checkout main
323
- git pull
324
- ```
325
-
326
- 2. **Run all checks**
327
- ```bash
328
- pnpm ready
329
- ```
330
-
331
- 3. **Bump version**
332
- ```bash
333
- # For patch releases (bug fixes)
334
- npm version patch
335
-
336
- # For minor releases (new features)
337
- npm version minor
338
-
339
- # For major releases (breaking changes)
340
- npm version major
341
- ```
342
-
343
- 4. **Push the version commit and tag**
344
- ```bash
345
- git push && git push --tags
346
- ```
347
-
348
- 5. **Publish to npm**
349
- ```bash
350
- pnpm publish
351
- ```
352
-
353
- 6. **Create GitHub release**
354
- ```bash
355
- # Create a release with automatically generated notes
356
- gh release create v<version> \
357
- --title "Phantom v<version>" \
358
- --generate-notes \
359
- --target main
360
-
361
- # Example for v0.1.3:
362
- gh release create v0.1.3 \
363
- --title "Phantom v0.1.3" \
364
- --generate-notes \
365
- --target main
366
- ```
367
-
368
- 7. **Update release notes for clarity**
369
- - Review the auto-generated release notes using `gh release view v<version>`
370
- - Check PR descriptions for important details using `gh pr view <number>`
371
- - Update the release notes to be more user-friendly:
372
- - Group changes by category (Features, Bug Fixes, Improvements)
373
- - Add usage examples for new features
374
- - Explain the impact of changes in plain language
375
- - Highlight security fixes and breaking changes
376
-
377
- ```bash
378
- # Edit the release notes
379
- gh release edit v<version> --notes "$(cat <<'EOF'
380
- ## 🚀 What's New in v<version>
381
-
382
- ### ✨ New Features
383
- - Feature description with usage example
384
-
385
- ### 🐛 Bug Fixes
386
- - Clear description of what was fixed
387
-
388
- ### 🛠️ Improvements
389
- - Performance, security, or other improvements
390
-
391
- EOF
392
- )"
393
- ```
394
-
395
- The build process is automatically handled by the `prepublishOnly` script, which:
396
- - Runs all tests and checks
397
- - Builds the TypeScript source to JavaScript using esbuild
398
- - Creates bundled executables in the `dist/` directory
399
-
400
- **Note**: The `dist/` directory is git-ignored and only created during the publish process.
401
170
 
402
171
  ## 🤝 Contributing
403
172
 
404
- Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
405
-
406
- Please make sure to:
407
- - Update tests as appropriate
408
- - Follow the existing code style
409
- - Run `pnpm ready` before submitting
173
+ Contributions are welcome! See our [Contributing Guide](./CONTRIBUTING.md) for:
174
+ - Development setup
175
+ - Code style guidelines
176
+ - Testing requirements
177
+ - Pull request process
410
178
 
411
179
  ## 📄 License
412
180
 
413
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
181
+ MIT License - see [LICENSE](LICENSE)
414
182
 
415
183
  ## 🙏 Acknowledgments
416
184
 
417
- - Inspired by the need for better parallel development workflows
418
- - Built for the AI-assisted development era
419
- - Special thanks to all contributors
420
-
421
- ## 🤝 Contributors
422
-
423
- - [@aku11i](https://github.com/aku11i) - Project creator and maintainer
424
- - [Claude (Anthropic)](https://claude.ai) - AI pair programmer who implemented most of the codebase
425
-
426
- ---
427
-
428
- <div align="center">
429
- Made with 👻 by <a href="https://github.com/aku11i">aku11i</a> and <a href="https://claude.ai">Claude</a>
430
- </div>
185
+ Built with 👻 by [@aku11i](https://github.com/aku11i) and [Claude](https://claude.ai)