workon 3.2.4 → 3.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.md CHANGED
@@ -6,12 +6,13 @@ A productivity CLI tool that helps developers quickly switch between projects wi
6
6
 
7
7
  ## Features
8
8
 
9
- ✨ **Smart Project Switching** - Switch between projects in your current shell (no nested processes!)
10
- 🔧 **IDE Integration** - Automatically open projects in VS Code, IntelliJ IDEA, or Atom
11
- 🌐 **Web Integration** - Launch project websites and documentation
12
- 🌳 **Git Branch Support** - Different configurations for different branches
13
- 📁 **Auto Directory Change** - Seamlessly `cd` into project directories
14
- **Interactive Setup** - Guided project configuration
9
+ ✨ **Smart Project Switching** - Switch between projects in your current shell (no nested processes!)
10
+ 🔧 **IDE Integration** - Automatically open projects in VS Code, IntelliJ IDEA, or Atom
11
+ 🌐 **Web Integration** - Launch project websites and documentation
12
+ 🌳 **Git Branch Support** - Different configurations for different branches
13
+ 🌲 **Git Worktrees** - Create, open, and manage git worktrees with tmux integration
14
+ 📁 **Auto Directory Change** - Seamlessly `cd` into project directories
15
+ ⚡ **Interactive Setup** - Guided project configuration
15
16
  🔄 **Backward Compatible** - Legacy nested shell mode still available
16
17
 
17
18
  ## Requirements
@@ -53,17 +54,23 @@ workon --help
53
54
 
54
55
  ## Quick Start
55
56
 
56
- 1. **Create your first project:**
57
+ 1. **Add your first project:**
57
58
  ```bash
58
- workon # Start interactive mode
59
+ cd ~/code/myproject
60
+ workon add . # Register current directory as a project
59
61
  ```
60
62
 
61
- 2. **Switch to a project:**
63
+ 2. **Or use interactive mode:**
64
+ ```bash
65
+ workon # Start interactive setup wizard
66
+ ```
67
+
68
+ 3. **Switch to a project:**
62
69
  ```bash
63
70
  workon myproject # Automatically cd + open IDE
64
71
  ```
65
72
 
66
- 3. **List available projects:**
73
+ 4. **List available projects:**
67
74
  ```bash
68
75
  workon config list
69
76
  ```
@@ -115,6 +122,23 @@ workon config set projects.myapp.events.ide true
115
122
 
116
123
  ## Usage Examples
117
124
 
125
+ ### Adding Projects
126
+
127
+ ```bash
128
+ # Add current directory as a project
129
+ cd ~/code/myproject
130
+ workon add .
131
+
132
+ # Add with a custom name
133
+ workon add . --name my-awesome-project
134
+
135
+ # Add with specific IDE
136
+ workon add . --ide idea
137
+
138
+ # Add a project from any path
139
+ workon add ~/code/another-project
140
+ ```
141
+
118
142
  ### Basic Project Switching
119
143
  ```bash
120
144
  # Switch to project (changes directory + opens IDE)
@@ -126,12 +150,104 @@ workon myproject --shell
126
150
  # code "/path/to/myproject" &
127
151
  ```
128
152
 
153
+ ### Colon Syntax (Run Specific Events)
154
+
155
+ Use the colon syntax to run only specific events for a project:
156
+
157
+ ```bash
158
+ # Run only the cwd event (just change directory)
159
+ workon myproject:cwd
160
+
161
+ # Run multiple specific events
162
+ workon myproject:cwd,ide
163
+
164
+ # Show available events for a project
165
+ workon myproject:help
166
+ ```
167
+
129
168
  ### Branch-Specific Configuration
130
169
  ```bash
131
170
  # Configure different settings for a git branch
132
171
  workon myproject#feature-branch
133
172
  ```
134
173
 
174
+ ### Git Worktrees
175
+
176
+ Manage git worktrees with full tmux integration. There are two commands:
177
+
178
+ - `workon worktrees` - Manage worktrees (run from the **main repository**)
179
+ - `workon worktree` - Operate on the **current worktree** you're inside
180
+
181
+ #### Managing Worktrees (from main repo)
182
+
183
+ ```bash
184
+ cd ~/code/myproject
185
+
186
+ # Show interactive worktree menu
187
+ workon worktrees
188
+
189
+ # List worktrees
190
+ workon worktrees list
191
+
192
+ # Create a new worktree
193
+ workon worktrees add feature-branch
194
+
195
+ # Open workon session in a worktree (creates tmux session)
196
+ workon worktrees open feature-branch
197
+
198
+ # Remove a worktree
199
+ workon worktrees remove feature-branch
200
+
201
+ # Merge worktree branch and remove
202
+ workon worktrees merge feature-branch
203
+
204
+ # Create branch from detached HEAD (for PR workflow)
205
+ workon worktrees branch my-worktree new-branch-name --push
206
+ ```
207
+
208
+ #### Operating on Current Worktree (from inside a worktree)
209
+
210
+ When you're inside a worktree, use `workon worktree` (singular):
211
+
212
+ ```bash
213
+ cd ~/code/myproject/.worktrees/feature-branch
214
+
215
+ # Show status of current worktree
216
+ workon worktree
217
+ workon worktree status
218
+
219
+ # Merge this worktree's branch into main/master
220
+ workon worktree merge
221
+
222
+ # Remove this worktree (shows instructions to exit first)
223
+ workon worktree remove
224
+ ```
225
+
226
+ If you run `workon worktrees` from inside a worktree, you'll get a helpful error directing you to use `workon worktree` instead.
227
+
228
+ #### Notes
229
+
230
+ - If you run worktree commands from an unregistered git repository, workon will prompt you to register it first
231
+ - Worktrees created by workon are stored in `.worktrees/` inside the project
232
+ - External worktrees (created elsewhere) show as "(external)" in the list
233
+
234
+ #### Post-Setup Hook
235
+
236
+ Create `.workon/worktree-setup.sh` in your project to run commands after creating a worktree:
237
+
238
+ ```bash
239
+ #!/bin/bash
240
+ # Install dependencies
241
+ [ -f "package.json" ] && npm install
242
+
243
+ # Copy environment file
244
+ [ -f "$PROJECT_PATH/.env" ] && cp "$PROJECT_PATH/.env" .env
245
+ ```
246
+
247
+ Environment variables available:
248
+ - `WORKTREE_PATH` - Absolute path to the new worktree
249
+ - `PROJECT_PATH` - Absolute path to the main project
250
+
135
251
  ### Legacy Mode (Nested Shells)
136
252
  ```bash
137
253
  # Use the old behavior if needed (spawns new shell)