git-worktree-pool 0.1.3 → 0.1.4

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,95 +1,95 @@
1
- # git-worktree-pool
2
-
3
- Work on several branches at once, without a fresh `npm install` for each one.
4
-
5
- ## Why
6
-
7
- `git worktree add` gives you a second checkout of a branch in seconds. In a large monorepo, though, the checkout is not where the time goes. A new worktree has no `node_modules`, so you run `npm install` there, and that can take a long time.
8
-
9
- It is worst on Windows. Antivirus and other IT security tools there often check each file as it is written and hold the write until the check ends, so writing the many files of `node_modules` is slow. On macOS, some of these tools check files after they are written, so the same install finishes sooner.
10
-
11
- `wtp` keeps a pool of worktrees next to your clone and reuses them, so you pay for that install once per slot, not once per branch. When you finish a branch, wtp frees its slot: it discards the branch's changes but keeps the ignored files, such as `node_modules` and build output. The next branch gets that slot with its dependencies already in place, and a later `npm install` there only has to apply the difference. wtp also moves your shell into the slot, so you can start work at once.
12
-
13
- ## Install
14
-
15
- ```bash
16
- npm install -g git-worktree-pool
17
- worktree-pool setup
18
- ```
19
-
20
- Requirements: Node 22.12 or later, git 2.31 or later.
21
-
22
- `worktree-pool setup` gives you the `wtp` command, which moves the shell you type it in. Setup asks before each change. `worktree-pool setup --remove` undoes them.
23
-
24
- * **cmd and PowerShell:** `wtp` works right after setup. Windows PowerShell 5.1 also needs scripts allowed: `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`.
25
- * **bash, zsh, fish, Git Bash:** setup adds a `wtp` function to your shell profile. Open a new shell to use it.
26
-
27
- Without setup, wtp still copies the slot path to the clipboard, and you paste it.
28
-
29
- ## Quick start
30
-
31
- ```bash
32
- cd my-repo
33
- wtp assign my-feature # gives the branch a slot and moves you there
34
- wtp switch 0 # back to your clone
35
- wtp free 1 # done with slot 1: it is free for the next branch
36
- wtp # or do all of this from the TUI
37
- ```
38
-
39
- The pool sits next to your clone:
40
-
41
- ```
42
- my-repo/ slot 0, your clone
43
- my-repo-wt-pool/
44
- my-repo-wt-1/ slot 1
45
- my-repo-wt-2/ slot 2
46
- ```
47
-
48
- wtp works from the clone, from the pool folder, and from any slot.
49
-
50
- ## Commands
51
-
52
- | Command | What it does |
53
- |---|---|
54
- | `wtp` | Opens the TUI. |
55
- | `wtp list`, `wtp ls` | Prints the slot table. `--json` prints the data. `--no-changes` skips the change counts. |
56
- | `wtp assign <branch>` | Gives the branch a slot, copies the path, and moves the shell there. `--no-cd` only copies. When the branch is already in a slot, wtp offers to switch there. |
57
- | `wtp switch <index\|branch>` | Copies the slot path and moves the shell there. A branch name must match exactly. It also reaches a worktree outside the pool. |
58
- | `wtp free <index>` | Asks, then discards uncommitted changes, releases the branch, and marks the slot free. `--yes` skips the question. `--force` frees a locked slot. |
59
- | `wtp delete <index>` | Asks, then discards uncommitted changes and removes the slot folder. `--yes` skips the question. `--branch` also deletes the local branch. `--force` allows unmerged branches and locked slots. |
60
- | `wtp path <index\|branch>` | Prints the slot path. |
61
- | `wtp doctor` | Reports pool problems and repairs the safe ones. |
62
-
63
- `assign` takes the lowest free slot, or makes a new one. For the branch, it uses the local branch, else the branch on `origin`, else a new branch from your local `main`. wtp does not fetch `main` first.
64
-
65
- ## TUI keys
66
-
67
- | Key | Action |
68
- |---|---|
69
- | `↑` `↓`, `k` `j` | Move the selection |
70
- | `0`-`9` | Jump to a slot index |
71
- | `Enter` | Move the shell to the slot and exit |
72
- | `a` | Assign a branch. The suggestions leave out branches that a worktree already has. The TUI stays open with the new slot selected; Enter goes there. |
73
- | `f` | Free the slot |
74
- | `d` | Delete the slot |
75
- | `c` | Copy the path |
76
- | `/` | Filter by branch |
77
- | `?` | Help |
78
- | `q`, `Esc` | Quit. If you freed or deleted the slot you are in, quit moves you to the clone. |
79
-
80
- ## Settings
81
-
82
- Per-repo settings live in git config:
83
-
84
- | Key | Default | Meaning |
85
- |---|---|---|
86
- | `wtp.base` | `main` | The branch that new branches start from |
87
- | `wtp.remote` | `origin` | The remote that assign looks at |
88
-
89
- For example: `git config wtp.base develop`.
90
-
91
- ## Notes
92
-
93
- * Slot 0 is your clone. wtp never frees or deletes it.
94
- * Free and delete always say what they discard before they ask.
95
- * On Windows, wtp can't delete the slot your shell is in. Run `wtp switch 0` first.
1
+ # git-worktree-pool
2
+
3
+ Work on several branches at once, without a fresh `npm install` for each one.
4
+
5
+ ## Why
6
+
7
+ `git worktree add` gives you a second checkout of a branch in seconds. In a large monorepo, though, the checkout is not where the time goes. A new worktree has no `node_modules`, so you run `npm install` there, and that can take a long time.
8
+
9
+ It is worst on Windows. Antivirus and other IT security tools there often check each file as it is written and hold the write until the check ends, so writing the many files of `node_modules` is slow. On macOS, some of these tools check files after they are written, so the same install finishes sooner.
10
+
11
+ `wtp` keeps a pool of worktrees next to your clone and reuses them, so you pay for that install once per slot, not once per branch. When you finish a branch, wtp frees its slot: it discards the branch's changes but keeps the ignored files, such as `node_modules` and build output. The next branch gets that slot with its dependencies already in place, and a later `npm install` there only has to apply the difference. wtp also moves your shell into the slot, so you can start work at once.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install -g git-worktree-pool
17
+ worktree-pool setup
18
+ ```
19
+
20
+ Requirements: Node 22.12 or later, git 2.31 or later.
21
+
22
+ `worktree-pool setup` gives you the `wtp` command, which moves the shell you type it in. Setup asks before each change. `worktree-pool setup --remove` undoes them.
23
+
24
+ * **cmd and PowerShell:** `wtp` works right after setup. Windows PowerShell 5.1 also needs scripts allowed: `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`.
25
+ * **bash, zsh, fish, Git Bash:** setup adds a `wtp` function to your shell profile. Open a new shell to use it.
26
+
27
+ Without setup, wtp still copies the slot path to the clipboard, and you paste it.
28
+
29
+ ## Quick start
30
+
31
+ ```bash
32
+ cd my-repo
33
+ wtp assign my-feature # gives the branch a slot and moves you there
34
+ wtp switch 0 # back to your clone
35
+ wtp free 1 # done with slot 1: it is free for the next branch
36
+ wtp # or do all of this from the TUI
37
+ ```
38
+
39
+ The pool sits next to your clone:
40
+
41
+ ```
42
+ my-repo/ slot 0, your clone
43
+ my-repo-wt-pool/
44
+ my-repo-wt-1/ slot 1
45
+ my-repo-wt-2/ slot 2
46
+ ```
47
+
48
+ wtp works from the clone, from the pool folder, and from any slot.
49
+
50
+ ## Commands
51
+
52
+ | Command | What it does |
53
+ |---|---|
54
+ | `wtp` | Opens the TUI. |
55
+ | `wtp list`, `wtp ls` | Prints the slot table. `--json` prints the data. `--no-changes` skips the change counts. |
56
+ | `wtp assign <branch>` | Gives the branch a slot, copies the path, and moves the shell there. `--no-cd` only copies. When the branch is already in a slot, wtp offers to switch there. |
57
+ | `wtp switch <index\|branch>` | Copies the slot path and moves the shell there. A branch name must match exactly. It also reaches a worktree outside the pool. |
58
+ | `wtp free <index>` | Asks, then discards uncommitted changes, releases the branch, and marks the slot free. `--yes` skips the question. `--force` frees a locked slot. |
59
+ | `wtp delete <index>` | Asks, then discards uncommitted changes and removes the slot folder. `--yes` skips the question. `--branch` also deletes the local branch. `--force` allows unmerged branches and locked slots. |
60
+ | `wtp path <index\|branch>` | Prints the slot path. |
61
+ | `wtp doctor` | Reports pool problems and repairs the safe ones. |
62
+
63
+ `assign` takes the lowest free slot, or makes a new one. For the branch, it uses the local branch, else the branch on `origin`, else a new branch from your local `main`. wtp does not fetch `main` first.
64
+
65
+ ## TUI keys
66
+
67
+ | Key | Action |
68
+ |---|---|
69
+ | `↑` `↓`, `k` `j` | Move the selection |
70
+ | `0`-`9` | Jump to a slot index |
71
+ | `Enter` | Move the shell to the slot and exit |
72
+ | `a` | Assign a branch. The suggestions leave out branches that a worktree already has. The TUI stays open with the new slot selected; Enter goes there. |
73
+ | `f` | Free the slot |
74
+ | `d` | Delete the slot |
75
+ | `c` | Copy the path |
76
+ | `/` | Filter by branch |
77
+ | `?` | Help |
78
+ | `q`, `Esc` | Quit. If you freed or deleted the slot you are in, quit moves you to the clone. |
79
+
80
+ ## Settings
81
+
82
+ Per-repo settings live in git config:
83
+
84
+ | Key | Default | Meaning |
85
+ |---|---|---|
86
+ | `wtp.base` | `main` | The branch that new branches start from |
87
+ | `wtp.remote` | `origin` | The remote that assign looks at |
88
+
89
+ For example: `git config wtp.base develop`.
90
+
91
+ ## Notes
92
+
93
+ * Slot 0 is your clone. wtp never frees or deletes it.
94
+ * Free and delete always say what they discard before they ask.
95
+ * On Windows, wtp can't delete the slot your shell is in. Run `wtp switch 0` first.
@@ -1,22 +1,22 @@
1
- const HELP = `wtp - a pool of reusable git worktrees
2
-
3
- Usage:
4
- wtp open the TUI (plain list when not in a terminal)
5
- wtp list | ls print the slot table [--json] [--no-changes]
6
- wtp assign <branch> give a branch a slot, copy its path, cd to it [--no-cd]
7
- wtp switch <index|branch> copy the slot path and cd to it
8
- wtp free <index> reset a slot and mark it free [--yes] [--force]
9
- wtp delete <index> remove a slot [--yes] [--branch] [--force]
10
- wtp path <index|branch> print a slot path
11
- wtp setup set up the wtp command for your shells, once [--yes] [--remove]
12
- wtp doctor report and repair pool problems
13
- wtp help | --help show this help
14
- wtp --version print the version
15
-
16
- A branch name must match exactly. Digits always mean a slot index.
17
-
18
- worktree-pool is the same program, but only wtp can change the shell's folder.
19
- First time: run "worktree-pool setup" once to get the wtp command.
1
+ const HELP = `wtp - a pool of reusable git worktrees
2
+
3
+ Usage:
4
+ wtp open the TUI (plain list when not in a terminal)
5
+ wtp list | ls print the slot table [--json] [--no-changes]
6
+ wtp assign <branch> give a branch a slot, copy its path, cd to it [--no-cd]
7
+ wtp switch <index|branch> copy the slot path and cd to it
8
+ wtp free <index> reset a slot and mark it free [--yes] [--force]
9
+ wtp delete <index> remove a slot [--yes] [--branch] [--force]
10
+ wtp path <index|branch> print a slot path
11
+ wtp setup set up the wtp command for your shells, once [--yes] [--remove]
12
+ wtp doctor report and repair pool problems
13
+ wtp help | --help show this help
14
+ wtp --version print the version
15
+
16
+ A branch name must match exactly. Digits always mean a slot index.
17
+
18
+ worktree-pool is the same program, but only wtp can change the shell's folder.
19
+ First time: run "worktree-pool setup" once to get the wtp command.
20
20
  `;
21
21
  export async function helpCommand(_args, io) {
22
22
  io.stdout.write(HELP);
@@ -8,34 +8,34 @@ export const MARKER = "# wtp shell integration";
8
8
  export const PROFILE_VERSION = 1;
9
9
  export const PROFILE_MARKER = `${MARKER} (wtp-profile ${PROFILE_VERSION})`;
10
10
  export const POWERSHELL_NO_PROFILE = "PowerShell needs no profile line. Run \"worktree-pool setup\" once.";
11
- const POSIX = `${MARKER}
12
- wtp() {
13
- local f rc dir
14
- f="$(mktemp "\${TMPDIR:-/tmp}/wtp-cwd.XXXXXX")" || return
15
- WTP_CWD_FILE="$f" command worktree-pool "$@"
16
- rc=$?
17
- dir="$(cat -- "$f" 2>/dev/null)"
18
- rm -f -- "$f"
19
- if [ -n "$dir" ]; then
20
- if command -v cygpath >/dev/null 2>&1; then dir="$(cygpath -u -- "$dir")"; fi
21
- if [ "$dir" != "$PWD" ]; then cd -- "$dir" || return; fi
22
- fi
23
- return $rc
24
- }
11
+ const POSIX = `${MARKER}
12
+ wtp() {
13
+ local f rc dir
14
+ f="$(mktemp "\${TMPDIR:-/tmp}/wtp-cwd.XXXXXX")" || return
15
+ WTP_CWD_FILE="$f" command worktree-pool "$@"
16
+ rc=$?
17
+ dir="$(cat -- "$f" 2>/dev/null)"
18
+ rm -f -- "$f"
19
+ if [ -n "$dir" ]; then
20
+ if command -v cygpath >/dev/null 2>&1; then dir="$(cygpath -u -- "$dir")"; fi
21
+ if [ "$dir" != "$PWD" ]; then cd -- "$dir" || return; fi
22
+ fi
23
+ return $rc
24
+ }
25
25
  `;
26
- const FISH = `${MARKER}
27
- function wtp
28
- set -l f (mktemp)
29
- or return
30
- WTP_CWD_FILE=$f command worktree-pool $argv
31
- set -l rc $status
32
- set -l dir (cat $f 2>/dev/null)
33
- rm -f $f
34
- if test -n "$dir"; and test "$dir" != "$PWD"
35
- cd $dir
36
- end
37
- return $rc
38
- end
26
+ const FISH = `${MARKER}
27
+ function wtp
28
+ set -l f (mktemp)
29
+ or return
30
+ WTP_CWD_FILE=$f command worktree-pool $argv
31
+ set -l rc $status
32
+ set -l dir (cat $f 2>/dev/null)
33
+ rm -f $f
34
+ if test -n "$dir"; and test "$dir" != "$PWD"
35
+ cd $dir
36
+ end
37
+ return $rc
38
+ end
39
39
  `;
40
40
  export function parseShell(value) {
41
41
  if (value === "pwsh" || value === "powershell")
package/package.json CHANGED
@@ -1,72 +1,72 @@
1
- {
2
- "name": "git-worktree-pool",
3
- "version": "0.1.3",
4
- "description": "Manage a pool of reusable git worktrees from the command line or a TUI",
5
- "type": "module",
6
- "bin": {
7
- "worktree-pool": "dist/bin/wtp.js"
8
- },
9
- "scripts": {
10
- "build": "tsc -p tsconfig.build.json",
11
- "type-check": "tsc -p tsconfig.json --noEmit",
12
- "test": "vitest run",
13
- "test:e2e": "vitest run --config vitest.e2e.config.ts",
14
- "eslint": "eslint --cache --cache-location ./.eslint-cache/ --cache-strategy content src/ tests/ tests-e2e/ eslint.config.mjs vitest.config.ts vitest.e2e.config.ts",
15
- "eslint:fix": "npm run eslint -- --fix"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/yoavain/git-worktree-pool.git"
20
- },
21
- "keywords": [
22
- "git",
23
- "worktree",
24
- "git-worktree",
25
- "worktrees",
26
- "pool",
27
- "cli",
28
- "tui",
29
- "ink",
30
- "developer-tools",
31
- "productivity"
32
- ],
33
- "author": "yoavain",
34
- "license": "MIT",
35
- "engines": {
36
- "node": ">=22.12",
37
- "npm": ">=10"
38
- },
39
- "files": [
40
- "dist",
41
- "launchers"
42
- ],
43
- "bugs": {
44
- "url": "https://github.com/yoavain/git-worktree-pool/issues"
45
- },
46
- "homepage": "https://github.com/yoavain/git-worktree-pool#readme",
47
- "devDependencies": {
48
- "@eslint/js": "10.0.1",
49
- "@types/node": "24.6.0",
50
- "@types/react": "19.3.0",
51
- "@typescript-eslint/eslint-plugin": "8.71.0",
52
- "@typescript-eslint/parser": "8.71.0",
53
- "@typescript/native": "npm:typescript@7.0.2",
54
- "eslint": "10.11.0",
55
- "eslint-import-resolver-typescript": "4.4.5",
56
- "eslint-plugin-import-x": "4.17.1",
57
- "eslint-plugin-n": "18.4.0",
58
- "eslint-plugin-security": "4.2.0",
59
- "globals": "17.13.0",
60
- "ink-testing-library": "4.0.0",
61
- "typescript": "npm:@typescript/typescript6@6.0.2",
62
- "vite": "8.3.2",
63
- "vitest": "5.0.3"
64
- },
65
- "dependencies": {
66
- "ink": "7.1.1",
67
- "react": "19.3.0"
68
- },
69
- "overrides": {
70
- "rolldown": "1.2.12"
71
- }
72
- }
1
+ {
2
+ "name": "git-worktree-pool",
3
+ "version": "0.1.4",
4
+ "description": "Manage a pool of reusable git worktrees from the command line or a TUI",
5
+ "type": "module",
6
+ "bin": {
7
+ "worktree-pool": "dist/bin/wtp.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc -p tsconfig.build.json",
11
+ "type-check": "tsc -p tsconfig.json --noEmit",
12
+ "test": "vitest run",
13
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
14
+ "eslint": "eslint --cache --cache-location ./.eslint-cache/ --cache-strategy content src/ tests/ tests-e2e/ eslint.config.mjs vitest.config.ts vitest.e2e.config.ts",
15
+ "eslint:fix": "npm run eslint -- --fix"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/yoavain/git-worktree-pool.git"
20
+ },
21
+ "keywords": [
22
+ "git",
23
+ "worktree",
24
+ "git-worktree",
25
+ "worktrees",
26
+ "pool",
27
+ "cli",
28
+ "tui",
29
+ "ink",
30
+ "developer-tools",
31
+ "productivity"
32
+ ],
33
+ "author": "yoavain",
34
+ "license": "MIT",
35
+ "engines": {
36
+ "node": ">=22.12",
37
+ "npm": ">=10"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "launchers"
42
+ ],
43
+ "bugs": {
44
+ "url": "https://github.com/yoavain/git-worktree-pool/issues"
45
+ },
46
+ "homepage": "https://github.com/yoavain/git-worktree-pool#readme",
47
+ "devDependencies": {
48
+ "@eslint/js": "10.0.1",
49
+ "@types/node": "24.6.0",
50
+ "@types/react": "19.3.0",
51
+ "@typescript-eslint/eslint-plugin": "8.71.0",
52
+ "@typescript-eslint/parser": "8.71.0",
53
+ "@typescript/native": "npm:typescript@7.0.2",
54
+ "eslint": "10.11.0",
55
+ "eslint-import-resolver-typescript": "4.4.5",
56
+ "eslint-plugin-import-x": "4.17.1",
57
+ "eslint-plugin-n": "18.4.0",
58
+ "eslint-plugin-security": "4.2.0",
59
+ "globals": "17.13.0",
60
+ "ink-testing-library": "4.0.0",
61
+ "typescript": "npm:@typescript/typescript6@6.0.2",
62
+ "vite": "8.3.2",
63
+ "vitest": "5.0.3"
64
+ },
65
+ "dependencies": {
66
+ "ink": "7.1.1",
67
+ "react": "19.3.0"
68
+ },
69
+ "overrides": {
70
+ "rolldown": "1.2.12"
71
+ }
72
+ }