@jhorst11/wt 2.0.2 → 2.2.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,5 +1,7 @@
1
1
  # 🌳 wt-cli
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@jhorst11/wt)](https://www.npmjs.com/package/@jhorst11/wt)
4
+
3
5
  A beautiful, interactive CLI for managing git worktrees.
4
6
 
5
7
  ![Demo](https://via.placeholder.com/800x400?text=wt-cli+Demo)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=wt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wt.d.ts","sourceRoot":"","sources":["../../bin/wt.ts"],"names":[],"mappings":""}
package/dist/bin/wt.js ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname, join } from 'path';
5
+ import { program } from 'commander';
6
+ import { mainMenu, createWorktreeFlow, listWorktrees, removeWorktreeFlow, mergeWorktreeFlow, goHome, goToWorktree, } from '../src/commands.js';
7
+ import { spacer, colors } from '../src/ui.js';
8
+ import { setupCommand } from '../src/setup.js';
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const require = createRequire(import.meta.url);
12
+ // Resolve package.json relative to project root (one level up from bin/)
13
+ const packagePath = join(__dirname, '..', '..', 'package.json');
14
+ const { version } = require(packagePath);
15
+ program
16
+ .name('wt')
17
+ .description('🌳 Beautiful interactive git worktree manager')
18
+ .version(version)
19
+ .option('--verbose', 'Show full hook command output (default: show command name with spinner only)');
20
+ program
21
+ .command('new', { isDefault: false })
22
+ .argument('[name]', 'Worktree name (skip name prompt)')
23
+ .description('Create a new worktree')
24
+ .option('--from <branch>', 'Base branch (skip source selection)')
25
+ .option('--no-hooks', 'Skip post-create hooks')
26
+ .action((name, args, cmd) => {
27
+ createWorktreeFlow({ verbose: !!cmd.parent?.opts?.()?.verbose, hooks: args.hooks, name, from: args.from });
28
+ });
29
+ program
30
+ .command('list')
31
+ .alias('ls')
32
+ .description('List all worktrees for the current repo')
33
+ .action(listWorktrees);
34
+ program
35
+ .command('remove')
36
+ .alias('rm')
37
+ .argument('[name]', 'Worktree name to remove')
38
+ .description('Remove a worktree')
39
+ .option('--force', 'Skip confirmation and force-remove dirty worktrees')
40
+ .option('--no-hooks', 'Skip pre-destroy hooks')
41
+ .action((name, args, cmd) => {
42
+ removeWorktreeFlow({ verbose: !!cmd.parent?.opts?.()?.verbose, name, force: args.force, hooks: args.hooks });
43
+ });
44
+ program
45
+ .command('merge')
46
+ .argument('[name]', 'Worktree name to merge')
47
+ .description('Merge a worktree branch back to main')
48
+ .option('--into <branch>', 'Target branch to merge into')
49
+ .option('--cleanup', 'Auto-remove worktree after merge')
50
+ .option('--no-hooks', 'Skip pre-destroy hooks during cleanup')
51
+ .action((name, args, cmd) => {
52
+ mergeWorktreeFlow({ verbose: !!cmd.parent?.opts?.()?.verbose, name, into: args.into, cleanup: args.cleanup, hooks: args.hooks });
53
+ });
54
+ program
55
+ .command('home')
56
+ .description('Return to the main repository')
57
+ .option('--delete', 'Delete the current worktree after returning home')
58
+ .option('--no-hooks', 'Skip pre-destroy hooks when using --delete')
59
+ .action((args, cmd) => {
60
+ goHome({ delete: args.delete, hooks: args.hooks, verbose: !!cmd.parent?.opts?.()?.verbose });
61
+ });
62
+ program
63
+ .command('go [name]')
64
+ .alias('jump')
65
+ .description('Jump to a worktree (interactive if no name)')
66
+ .action((name) => {
67
+ goToWorktree(name);
68
+ });
69
+ program
70
+ .command('setup')
71
+ .description('Configure shell integration for directory jumping')
72
+ .action(setupCommand);
73
+ // Default action (no command = interactive menu)
74
+ program.action(async () => {
75
+ await mainMenu();
76
+ });
77
+ // Custom help
78
+ program.on('--help', () => {
79
+ spacer();
80
+ console.log('Examples:');
81
+ console.log(` ${colors.muted('$')} wt ${colors.muted('# Interactive menu')}`);
82
+ console.log(` ${colors.muted('$')} wt new ${colors.muted('# Create new worktree (interactive)')}`);
83
+ console.log(` ${colors.muted('$')} wt new my-feature --from main ${colors.muted('# Create worktree (non-interactive)')}`);
84
+ console.log(` ${colors.muted('$')} wt list ${colors.muted('# List all worktrees')}`);
85
+ console.log(` ${colors.muted('$')} wt go feature-x ${colors.muted('# Jump to worktree')}`);
86
+ console.log(` ${colors.muted('$')} wt merge my-wt --into main ${colors.muted('# Merge worktree to branch')}`);
87
+ console.log(` ${colors.muted('$')} wt rm my-wt --force ${colors.muted('# Remove worktree without prompts')}`);
88
+ console.log(` ${colors.muted('$')} wt home ${colors.muted('# Return to main repo')}`);
89
+ console.log(` ${colors.muted('$')} wt home --delete ${colors.muted('# Go home and delete current worktree')}`);
90
+ console.log(` ${colors.muted('$')} wt setup ${colors.muted('# Configure shell integration')}`);
91
+ spacer();
92
+ });
93
+ // Handle graceful exit
94
+ process.on('SIGINT', () => {
95
+ console.log('\n');
96
+ process.exit(0);
97
+ });
98
+ program.parse();
99
+ //# sourceMappingURL=wt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wt.js","sourceRoot":"","sources":["../../bin/wt.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,EACN,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAsB,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UA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AAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { CommandOptions } from './types.js';
2
+ export declare function mainMenu(): Promise<void>;
3
+ export declare function createWorktreeFlow(options?: CommandOptions): Promise<void>;
4
+ export declare function listWorktrees(): Promise<void>;
5
+ export declare function removeWorktreeFlow(options?: CommandOptions): Promise<void>;
6
+ export declare function mergeWorktreeFlow(options?: CommandOptions): Promise<void>;
7
+ export declare function goHome(options?: CommandOptions): Promise<void>;
8
+ export declare function goToWorktree(name?: string): Promise<void>;
9
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/commands.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAkC/D,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA+H9C;AAED,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoSpF;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAyCnD;AAED,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwMpF;AAED,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiTnF;AAED,wBAAsB,MAAM,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+GxE;AAED,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgG/D"}