worktree-launcher 1.0.0 → 1.0.2

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.
Files changed (3) hide show
  1. package/README.md +92 -53
  2. package/dist/index.js +2 -4
  3. package/package.json +13 -5
package/README.md CHANGED
@@ -1,65 +1,83 @@
1
- # worktree-launcher (wt)
1
+ # worktree-launcher
2
2
 
3
- CLI tool to streamline git worktrees with AI coding assistants (Claude Code / Codex).
3
+ A CLI tool for managing git worktrees with AI coding assistants.
4
4
 
5
- ## Installation
5
+ ## The Problem
6
+
7
+ When working on multiple features or reviewing PRs, developers often need isolated environments. Git worktrees solve this by allowing multiple working directories from a single repository, but the workflow is clunky:
6
8
 
7
9
  ```bash
8
- npm install -g worktree-launcher
10
+ # The manual way
11
+ git worktree add ../myproject-feature-auth feature-auth
12
+ cp .env ../myproject-feature-auth/.env
13
+ cp .env.local ../myproject-feature-auth/.env.local
14
+ cd ../myproject-feature-auth
15
+ npm install
16
+ claude # or codex
9
17
  ```
10
18
 
11
- Or for local development:
19
+ This gets tedious fast. Tools like Conductor exist to manage this complexity, but they add overhead for simple use cases.
20
+
21
+ ## The Solution
22
+
23
+ `wt` streamlines the entire workflow into a single command:
12
24
 
13
25
  ```bash
14
- git clone <repo>
15
- cd worktree-launcher
16
- npm install
17
- npm run build
18
- npm link
26
+ wt new feature-auth
27
+ ```
28
+
29
+ This creates the worktree, copies your environment files, and launches your AI coding assistant in the new directory.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install -g worktree-launcher
19
35
  ```
20
36
 
37
+ Requires Node.js 18+ and git.
38
+
21
39
  ## Commands
22
40
 
23
- ### `wt new <branch-name>`
41
+ ### wt new
24
42
 
25
- Create a new worktree and launch your AI assistant.
43
+ Create a new worktree and optionally launch an AI assistant.
26
44
 
27
45
  ```bash
28
- wt new feature-auth
46
+ wt new <branch-name> [options]
29
47
  ```
30
48
 
31
- This will:
32
- 1. Create a new branch (if it doesn't exist)
33
- 2. Create a worktree at `../<repo-name>-<branch-name>/`
34
- 3. Copy all `.env*` files from the main repo
35
- 4. Show an interactive selector to choose Claude Code or Codex
36
- 5. Launch the selected AI assistant in the new worktree
37
-
38
- **Options:**
49
+ Options:
39
50
  - `-i, --install` - Run package manager install after creating worktree
40
51
  - `-s, --skip-launch` - Create worktree without launching AI assistant
41
52
 
42
- **Examples:**
53
+ Examples:
54
+
43
55
  ```bash
44
- wt new feature-auth # Create and launch AI
45
- wt new feature-auth --install # Also run npm/yarn/pnpm install
46
- wt new feature-auth --skip-launch # Just create the worktree
56
+ # Create worktree and launch AI selector
57
+ wt new feature-auth
58
+
59
+ # Create worktree and run npm/yarn/pnpm install
60
+ wt new feature-auth --install
61
+
62
+ # Just create the worktree
63
+ wt new feature-auth --skip-launch
47
64
  ```
48
65
 
49
- ### `wt list` (or `wt ls`)
66
+ The worktree is created at `../<repo-name>-<branch-name>/`. For example, if you run `wt new feature-auth` in `/code/myproject`, the worktree is created at `/code/myproject-feature-auth`.
67
+
68
+ ### wt list
50
69
 
51
70
  List all worktrees for the current repository.
52
71
 
53
72
  ```bash
54
73
  wt list
74
+ # or
75
+ wt ls
55
76
  ```
56
77
 
57
- Shows:
58
- - Worktree paths
59
- - Branch names
60
- - Status (active, merged, local only, detached)
78
+ Output shows path, branch, and status (active, merged, local only).
61
79
 
62
- ### `wt clean`
80
+ ### wt clean
63
81
 
64
82
  Interactively remove worktrees for merged or deleted branches.
65
83
 
@@ -67,37 +85,48 @@ Interactively remove worktrees for merged or deleted branches.
67
85
  wt clean
68
86
  ```
69
87
 
70
- This will:
71
- 1. Find worktrees where the branch was merged or deleted
72
- 2. Show an interactive checkbox to select which to remove
73
- 3. Remove selected worktrees
88
+ This finds stale worktrees, shows an interactive selection, and removes the ones you choose.
74
89
 
75
- ### `wt remove <name>` (or `wt rm`)
90
+ ### wt remove
76
91
 
77
92
  Remove a specific worktree.
78
93
 
79
94
  ```bash
80
- wt remove feature-auth
81
- wt rm feature-auth --force
95
+ wt remove <name> [options]
96
+ # or
97
+ wt rm <name>
82
98
  ```
83
99
 
84
- **Options:**
100
+ Options:
85
101
  - `-f, --force` - Force removal even with uncommitted changes
86
102
 
87
- ## Worktree Location
103
+ ## Workflow
88
104
 
89
- Worktrees are created as siblings to your main repository:
105
+ A typical development workflow:
90
106
 
107
+ ```bash
108
+ # 1. Start in your main repository
109
+ cd ~/code/myproject
110
+
111
+ # 2. Create a worktree for a new feature
112
+ wt new feature-user-auth
113
+ # Select Claude Code or Codex from the prompt
114
+ # AI assistant launches in the new worktree
115
+
116
+ # 3. Work on the feature, commit, push, create PR
117
+
118
+ # 4. Back in main repo, check your worktrees
119
+ wt list
120
+
121
+ # 5. After PR is merged, clean up
122
+ wt clean
123
+ # Select merged branches to remove
91
124
  ```
92
- /Users/you/code/
93
- ├── myproject/ # Main repo
94
- ├── myproject-feature-auth/ # Worktree for feature-auth branch
95
- └── myproject-fix-bug/ # Worktree for fix-bug branch
96
- ```
97
125
 
98
- ## Env Files
126
+ ## Environment Files
127
+
128
+ The following files are automatically copied to new worktrees:
99
129
 
100
- The following env files are automatically copied to new worktrees:
101
130
  - `.env`
102
131
  - `.env.local`
103
132
  - `.env.development`
@@ -106,14 +135,24 @@ The following env files are automatically copied to new worktrees:
106
135
  - `.env.test.local`
107
136
  - `.env.production`
108
137
  - `.env.production.local`
138
+ - Any other `.env.*` files
139
+
140
+ Template files (`.env.example`, `.env.sample`, `.env.template`) are excluded.
141
+
142
+ ## AI Assistants
143
+
144
+ Currently supports:
145
+
146
+ - Claude Code
147
+ - Codex
109
148
 
110
- Template files (`.env.example`, `.env.sample`) are not copied.
149
+ The tool checks if your selected assistant is installed before launching. If not found, the worktree is still created and you can launch manually.
111
150
 
112
- ## Requirements
151
+ ## Security
113
152
 
114
- - Node.js 18+
115
- - Git
116
- - Claude Code or Codex CLI installed and in PATH
153
+ Branch names are validated to prevent:
154
+ - Path traversal attacks (`..` sequences)
155
+ - Git flag injection (names starting with `-`)
117
156
 
118
157
  ## License
119
158
 
package/dist/index.js CHANGED
@@ -175,13 +175,11 @@ import path3 from "path";
175
175
  import { constants } from "fs";
176
176
  function launchAITool(options) {
177
177
  const { cwd, tool } = options;
178
- const child = spawn(tool, [], {
178
+ spawn(tool, [], {
179
179
  cwd,
180
180
  stdio: "inherit",
181
- // Detach so the CLI can exit
182
- detached: true
181
+ shell: true
183
182
  });
184
- child.unref();
185
183
  }
186
184
  async function isToolAvailable(tool) {
187
185
  return new Promise((resolve) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "worktree-launcher",
3
- "version": "1.0.0",
4
- "description": "CLI tool to streamline git worktrees with AI coding assistants",
3
+ "version": "1.0.2",
4
+ "description": "CLI tool for managing git worktrees with AI coding assistants",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {
@@ -11,18 +11,26 @@
11
11
  "build": "tsup src/index.ts --format esm --dts --clean",
12
12
  "dev": "tsup src/index.ts --format esm --watch",
13
13
  "typecheck": "tsc --noEmit",
14
- "lint": "eslint src/",
15
14
  "prepublishOnly": "npm run build"
16
15
  },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/mertdeveci5/worktree-launcher.git"
19
+ },
20
+ "homepage": "https://github.com/mertdeveci5/worktree-launcher#readme",
21
+ "bugs": {
22
+ "url": "https://github.com/mertdeveci5/worktree-launcher/issues"
23
+ },
17
24
  "keywords": [
18
25
  "git",
19
26
  "worktree",
20
27
  "cli",
21
28
  "claude",
22
29
  "codex",
23
- "ai"
30
+ "ai",
31
+ "developer-tools"
24
32
  ],
25
- "author": "",
33
+ "author": "mertdeveci5",
26
34
  "license": "MIT",
27
35
  "dependencies": {
28
36
  "chalk": "^5.3.0",