@gw-tools/gw 0.12.24 → 0.12.27

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
@@ -274,6 +274,9 @@ When `gw add` creates a new branch, it automatically configures the branch to tr
274
274
  **Git Ref Conflict Detection:**
275
275
  The command automatically detects and prevents Git ref naming conflicts. For example, you cannot have both a branch named `test` and `test/foo` because Git stores branches as files in `.git/refs/heads/`, and `test` cannot be both a file and a directory. If a conflict is detected, you'll receive a helpful error message with suggestions for resolving it.
276
276
 
277
+ **Automatic Navigation:**
278
+ After successfully creating a new worktree, the command automatically navigates to the new worktree directory. This requires shell integration to be installed (see [install-shell](#install-shell)). Use the `--no-cd` flag to skip automatic navigation.
279
+
277
280
  **Existing Worktree Navigation:**
278
281
  If you try to add a worktree that already exists, the command will prompt you to navigate to it instead. Press Enter (default: Yes) to navigate, or type 'n' to cancel. This requires shell integration to be installed (see [install-shell](#install-shell)).
279
282
 
@@ -284,6 +287,8 @@ If you try to add a worktree that already exists, the command will prompt you to
284
287
 
285
288
  #### Options
286
289
 
290
+ - `--no-cd`: Don't navigate to the new worktree after creation
291
+
287
292
  All `git worktree add` options are supported:
288
293
 
289
294
  - `-b <branch>`: Create a new branch
@@ -297,8 +302,12 @@ All `git worktree add` options are supported:
297
302
 
298
303
  ```bash
299
304
  # Create worktree (auto-copies files if autoCopyFiles is configured)
305
+ # Automatically navigates to new worktree
300
306
  gw add feat/new-feature
301
307
 
308
+ # Create worktree without navigating to it
309
+ gw add feat/new-feature --no-cd
310
+
302
311
  # Create worktree with new branch
303
312
  gw add feat/new-feature -b my-branch
304
313
 
package/bin/gw ADDED
Binary file
package/install.js CHANGED
@@ -176,12 +176,28 @@ async function install() {
176
176
  async function installShellIntegration(binaryPath, retries = 3) {
177
177
  const { spawn } = require('child_process');
178
178
 
179
+ // Check environment before attempting shell integration
180
+ const hasRequiredEnv = process.env.HOME || process.env.USERPROFILE;
181
+ const hasShell = process.env.SHELL;
182
+
183
+ if (!hasRequiredEnv) {
184
+ console.log(' Skipping shell integration: HOME environment variable not set');
185
+ console.log(' Run "gw install-shell" manually after installation');
186
+ return;
187
+ }
188
+
189
+ if (!hasShell) {
190
+ console.log(' Skipping shell integration: SHELL environment variable not set');
191
+ console.log(' Run "gw install-shell" manually after installation');
192
+ return;
193
+ }
194
+
179
195
  return new Promise((resolve) => {
180
196
  let child;
181
197
 
182
198
  try {
183
- child = spawn(binaryPath, ['install-shell', '--quiet'], {
184
- stdio: 'inherit',
199
+ child = spawn(binaryPath, ['install-shell'], {
200
+ stdio: ['inherit', 'inherit', 'pipe'], // stdin, stdout, stderr
185
201
  });
186
202
  } catch (err) {
187
203
  // Catch synchronous spawn errors (e.g., ETXTBSY thrown immediately)
@@ -191,20 +207,28 @@ async function installShellIntegration(binaryPath, retries = 3) {
191
207
  }, 200);
192
208
  return;
193
209
  }
194
- console.log(
195
- ' (Shell integration can be installed later with: gw install-shell)',
196
- );
210
+ console.log(' Shell integration setup encountered an issue.');
211
+ console.log(' You can install it manually later with: gw install-shell');
197
212
  resolve();
198
213
  return;
199
214
  }
200
215
 
216
+ let stderrOutput = '';
217
+ child.stderr.on('data', (data) => {
218
+ stderrOutput += data.toString();
219
+ // Also display it immediately
220
+ process.stderr.write(data);
221
+ });
222
+
201
223
  child.on('close', (code) => {
202
224
  if (code === 0) {
203
225
  console.log('✓ Shell integration installed!');
204
226
  } else {
205
- console.log(
206
- ' (Shell integration can be installed later with: gw install-shell)',
207
- );
227
+ console.log(' Shell integration failed with exit code:', code);
228
+ if (stderrOutput) {
229
+ console.log(' Error:', stderrOutput.trim());
230
+ }
231
+ console.log(' You can install it manually later with: gw install-shell');
208
232
  }
209
233
  resolve();
210
234
  });
@@ -215,9 +239,8 @@ async function installShellIntegration(binaryPath, retries = 3) {
215
239
  await new Promise((r) => setTimeout(r, 200));
216
240
  return installShellIntegration(binaryPath, retries - 1).then(resolve);
217
241
  }
218
- console.log(
219
- ' (Shell integration can be installed later with: gw install-shell)',
220
- );
242
+ console.log(' Shell integration setup encountered an issue.');
243
+ console.log(' You can install it manually later with: gw install-shell');
221
244
  resolve();
222
245
  });
223
246
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/gw",
3
- "version": "0.12.24",
3
+ "version": "0.12.27",
4
4
  "description": "A command-line tool for managing git worktrees - copy files between worktrees with ease",
5
5
  "keywords": [
6
6
  "git",