worktree-flow 0.0.2 → 0.0.3

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
@@ -93,7 +93,7 @@ Settings are stored in `~/.config/flow/config.json`.
93
93
  | `source-path` | Directory containing your source repos | *required* |
94
94
  | `dest-path` | Directory where workspaces are created | *required* |
95
95
  | `main-branch` | Main branch name | `master` |
96
- | `tmux` | Create tmux sessions for workspaces | `false` |
96
+ | `tmux` | Create tmux sessions with split panes (root + each worktree) | `false` |
97
97
  | `copy-files` | Files to copy from source repos to worktrees | `.env` |
98
98
  | `post-checkout` | Command to run after checkout (e.g. `npm ci`) | *none* |
99
99
 
package/dist/lib/tmux.js CHANGED
@@ -6,8 +6,9 @@ export class TmuxService {
6
6
  constructor(shell) {
7
7
  this.shell = shell;
8
8
  }
9
- async createSession(workspacePath, sessionName) {
9
+ async createSession(workspacePath, sessionName, worktreePaths = []) {
10
10
  try {
11
+ // Create base session in workspace root
11
12
  await this.shell.execFile('tmux', [
12
13
  'new-session',
13
14
  '-d',
@@ -16,6 +17,25 @@ export class TmuxService {
16
17
  '-c',
17
18
  workspacePath,
18
19
  ]);
20
+ // Create split panes for each worktree
21
+ for (const worktreePath of worktreePaths) {
22
+ await this.shell.execFile('tmux', [
23
+ 'split-window',
24
+ '-t',
25
+ sessionName,
26
+ '-c',
27
+ worktreePath,
28
+ ]);
29
+ }
30
+ // Apply tiled layout if we have multiple panes (root + worktrees)
31
+ if (worktreePaths.length > 0) {
32
+ await this.shell.execFile('tmux', [
33
+ 'select-layout',
34
+ '-t',
35
+ sessionName,
36
+ 'tiled',
37
+ ]);
38
+ }
19
39
  }
20
40
  catch (error) {
21
41
  // If session already exists, ignore the error
@@ -51,7 +51,8 @@ export class CheckoutWorkspaceUseCase {
51
51
  let tmuxCreated = false;
52
52
  if (params.tmux) {
53
53
  try {
54
- await this.tmux.createSession(workspacePath, params.branchName);
54
+ const worktreeDirs = this.workspaceDir.getWorktreeDirs(workspacePath);
55
+ await this.tmux.createSession(workspacePath, params.branchName, worktreeDirs);
55
56
  tmuxCreated = true;
56
57
  }
57
58
  catch (error) {
@@ -40,7 +40,8 @@ export class CreateBranchWorkspaceUseCase {
40
40
  let tmuxCreated = false;
41
41
  if (params.tmux) {
42
42
  try {
43
- await this.tmux.createSession(workspacePath, params.branchName);
43
+ const worktreeDirs = this.workspaceDir.getWorktreeDirs(workspacePath);
44
+ await this.tmux.createSession(workspacePath, params.branchName, worktreeDirs);
44
45
  tmuxCreated = true;
45
46
  }
46
47
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktree-flow",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Manage git worktrees across a poly-repo environment",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,6 +11,7 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "build": "tsc -p tsconfig.build.json",
14
+ "postbuild": "chmod +x dist/cli.js",
14
15
  "type-check": "tsc --noEmit",
15
16
  "test": "vitest",
16
17
  "test:ui": "vitest --ui",