@aku11i/phantom 0.9.0 → 1.1.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
@@ -1,430 +1,21 @@
1
1
  # 👻 Phantom
2
2
 
3
- <div align="center">
3
+ A powerful CLI tool for seamless parallel development with Git worktrees.
4
4
 
5
- **A powerful CLI tool for seamless parallel development with Git worktrees**
5
+ Phantom makes Git worktrees simple and intuitive, enabling you to run multiple tasks in isolated environments simultaneously and achieve true multitask development.
6
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
- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/aku11i/phantom)
7
+ ## Installation
11
8
 
12
- [Installation](#-installation) • [Basic Usage](#-basic-usage) • [Why Phantom?](#-why-phantom) • [Documentation](#-documentation) • [日本語](./README.ja.md)
13
-
14
- </div>
15
-
16
- ## ✨ Overview
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.
19
-
20
- ### Key Features
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
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.
37
-
38
- ### The Phantom Solution
39
-
40
- ```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
47
- ```
48
-
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
52
-
53
- ```bash
54
- # Install Phantom
55
- npm install -g @aku11i/phantom
56
-
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
65
-
66
- # Or execute commands directly
67
- phantom exec feature-awesome npm install
68
- phantom exec feature-awesome npm test
69
-
70
- # List all your worktrees
71
- phantom list
72
-
73
- # Clean up when done
74
- phantom delete feature-awesome
75
- ```
76
-
77
- ## 📦 Installation
78
-
79
- ### Using npm (recommended)
80
9
  ```bash
81
10
  npm install -g @aku11i/phantom
82
11
  ```
83
12
 
84
- ### Using pnpm
85
- ```bash
86
- pnpm add -g @aku11i/phantom
87
- ```
88
-
89
- ### Using yarn
90
- ```bash
91
- yarn global add @aku11i/phantom
92
- ```
93
-
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
- ```
102
-
103
- ## 📖 Documentation
104
-
105
- ### Commands Overview
106
-
107
- #### Worktree Management
108
-
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
130
-
131
- # Get the absolute path to a worktree
132
- phantom where <name>
133
-
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
142
-
143
- ```bash
144
- # Execute any command in a worktree's context
145
- phantom exec <name> <command> [args...]
146
-
147
- # Examples:
148
- phantom exec feature-auth npm install
149
- phantom exec feature-auth npm run test
150
- phantom exec feature-auth git status
151
-
152
- # Open an interactive shell session in a worktree
153
- phantom shell <name>
154
- ```
155
-
156
- ### Environment Variables
157
-
158
- When opening an interactive shell with `phantom shell`, these environment variables are set:
159
-
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
163
-
164
- ## 💡 Use Cases
165
-
166
- Phantom is more than just a worktree wrapper - it's a productivity multiplier. Here are some real-world examples:
167
-
168
- ### tmux Integration
169
-
170
- Combine tmux with Phantom for an incredibly efficient workflow:
171
-
172
- ```bash
173
- # Open a new tmux window and create a worktree in one command
174
- tmux new-window 'phantom create --shell new-feature'
175
- ```
176
-
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 🚀
181
-
182
- When developing multiple features in parallel, you can manage each feature in its own tmux window.
183
-
184
- ### VS Code Integration
185
-
186
- ```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!!
190
-
191
- # Attach to existing branch and open in VS Code
192
- phantom attach --exec "code ." feature/existing-branch
193
- ```
194
-
195
- ### Parallel Development Workflow
196
-
197
- ```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
201
-
202
- # After fixing, return to your feature
203
- exit # Exit the hotfix shell
204
- phantom shell feature-awesome # Continue feature development
205
- ```
206
-
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
- }
241
- ```
242
-
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:
269
-
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
- }
290
- ```
291
-
292
- ## 🛠️ Development
293
-
294
- ```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
305
-
306
- # Type checking
307
- pnpm typecheck
308
-
309
- # Linting
310
- pnpm lint
311
-
312
- # Run all checks
313
- pnpm ready
314
- ```
315
-
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
-
402
- ## 🤝 Contributing
403
-
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
410
-
411
- ## 📄 License
412
-
413
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
414
-
415
- ## 🙏 Acknowledgments
416
-
417
- - Inspired by the need for better parallel development workflows
418
- - Built for the AI-assisted development era
419
- - Special thanks to all contributors
13
+ ## Documentation
420
14
 
421
- ## 🤝 Contributors
15
+ For detailed documentation, examples, and advanced usage, please visit:
422
16
 
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
17
+ https://github.com/aku11i/phantom
425
18
 
426
- ---
19
+ ## License
427
20
 
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>
21
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aku11i/phantom",
3
- "version": "0.9.0",
3
+ "version": "1.1.0",
4
4
  "description": "A powerful CLI tool for managing Git worktrees for parallel development",
5
5
  "keywords": [
6
6
  "git",
@@ -9,7 +9,8 @@
9
9
  "phantom",
10
10
  "workspace",
11
11
  "development",
12
- "parallel"
12
+ "parallel",
13
+ "mcp"
13
14
  ],
14
15
  "homepage": "https://github.com/aku11i/phantom#readme",
15
16
  "bugs": {
@@ -23,34 +24,12 @@
23
24
  "author": "aku11i",
24
25
  "type": "module",
25
26
  "bin": {
26
- "phantom": "./dist/phantom.js"
27
- },
28
- "engines": {
29
- "node": ">=22.0.0"
27
+ "phantom": "./phantom.js"
30
28
  },
31
29
  "files": [
32
- "dist/",
30
+ "phantom.js",
33
31
  "README.md",
34
32
  "LICENSE"
35
33
  ],
36
- "devDependencies": {
37
- "@biomejs/biome": "^1.9.4",
38
- "@types/node": "^22.15.29",
39
- "@typescript/native-preview": "7.0.0-dev.20250602.1",
40
- "esbuild": "^0.25.5",
41
- "typescript": "^5.8.3"
42
- },
43
- "scripts": {
44
- "start": "node ./src/bin/phantom.ts",
45
- "phantom": "node ./src/bin/phantom.ts",
46
- "build": "node build.ts",
47
- "typecheck": "tsgo --noEmit",
48
- "test": "node --test --experimental-strip-types --experimental-test-module-mocks \"src/**/*.test.js\"",
49
- "test:coverage": "node --experimental-test-coverage --test --experimental-strip-types --experimental-test-module-mocks \"src/**/*.test.js\"",
50
- "test:file": "node --test --experimental-strip-types --experimental-test-module-mocks",
51
- "lint": "biome check .",
52
- "fix": "biome check --write .",
53
- "ready": "pnpm fix && pnpm typecheck && pnpm test",
54
- "ready:check": "pnpm lint && pnpm typecheck && pnpm test"
55
- }
34
+ "dependencies": {}
56
35
  }