@enginerd-kr/grove 0.5.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 enginerd-kr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # grove
2
+
3
+ Git worktrees let one repository have many working directories. grove turns
4
+ that into a managed workspace: one bare clone stores the repository once, and
5
+ every branch gets its own predictable directory, with a terminal UI over them.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @enginerd-kr/grove
11
+ grove
12
+ ```
13
+
14
+ Or run it without installing:
15
+
16
+ ```bash
17
+ npx @enginerd-kr/grove
18
+ ```
19
+
20
+ Homebrew works too: `brew install enginerd-kr/tap/grove`.
21
+
22
+ ## Quick start
23
+
24
+ ```bash
25
+ grove clone https://github.com/org/repo.git
26
+ cd repo
27
+
28
+ grove add feat/login
29
+ grove add fix/prod-crash
30
+ grove
31
+ ```
32
+
33
+ The full guide — every command, `.grove.toml`, stacked pull requests,
34
+ scripting and coding-agent sandboxes — is in the repository:
35
+
36
+ - README: https://github.com/enginerd-kr/grove#readme
37
+ - Usage: https://github.com/enginerd-kr/grove/blob/main/USAGE.md
38
+ - Changelog: https://github.com/enginerd-kr/grove/blob/main/CHANGELOG.md
39
+
40
+ ## How the package is put together
41
+
42
+ grove is a compiled binary, not JavaScript. This package holds a small Node
43
+ launcher; the binary itself is in one of four platform packages that this one
44
+ lists as optional dependencies, and npm installs the one whose `os`/`cpu` match
45
+ your machine:
46
+
47
+ | package | platform |
48
+ | --- | --- |
49
+ | `@enginerd-kr/grove-darwin-arm64` | macOS, Apple silicon |
50
+ | `@enginerd-kr/grove-darwin-x64` | macOS, Intel |
51
+ | `@enginerd-kr/grove-linux-x64` | Linux, x86-64 (glibc) |
52
+ | `@enginerd-kr/grove-linux-arm64` | Linux, arm64 (glibc) |
53
+
54
+ There is no install script. If `grove` reports that its binary package is
55
+ missing, the install skipped optional dependencies (`--omit=optional`) or used
56
+ a lockfile written on another platform; `npm install -g @enginerd-kr/grove
57
+ --force` puts it back.
58
+
59
+ Known limits:
60
+
61
+ - No Windows build. WSL works.
62
+ - The Linux binaries link against glibc; Alpine and other musl systems are not
63
+ supported yet.
64
+ - The launcher is a Node script. On a machine with Bun but no Node, run
65
+ `bunx --bun @enginerd-kr/grove`.
66
+
67
+ ## License
68
+
69
+ MIT
package/bin/grove.js ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ // The npm face of grove. The program itself is a compiled Bun binary that
3
+ // lives in @enginerd-kr/grove-<os>-<arch>, one of this package's optional
4
+ // dependencies; npm installs the one whose os/cpu fields match the machine.
5
+ // This file finds it and runs it — nothing more, so it needs nothing beyond
6
+ // what every Node since 12 ships, and runs unchanged under `bunx`.
7
+ import { spawnSync } from "node:child_process";
8
+ import { existsSync } from "node:fs";
9
+ import { createRequire } from "node:module";
10
+ import { dirname, join } from "node:path";
11
+
12
+ const TARGETS = ["darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"];
13
+ const target = `${process.platform}-${process.arch}`;
14
+ const pkg = `@enginerd-kr/grove-${target}`;
15
+
16
+ function fail(lines) {
17
+ console.error(lines.join("\n"));
18
+ process.exit(1);
19
+ }
20
+
21
+ if (process.platform === "win32") {
22
+ fail([
23
+ "grove: no Windows build is published.",
24
+ "Use WSL, where the linux-x64 / linux-arm64 package installs as usual.",
25
+ ]);
26
+ }
27
+ if (!TARGETS.includes(target)) {
28
+ fail([`grove: no build for ${target}.`, `supported: ${TARGETS.join(", ")}`]);
29
+ }
30
+
31
+ // The platform package has no main and no exports — it is one file in bin/ —
32
+ // so its package.json is the only thing that is guaranteed to resolve.
33
+ let bin;
34
+ try {
35
+ const require = createRequire(import.meta.url);
36
+ bin = join(dirname(require.resolve(`${pkg}/package.json`)), "bin", "grove");
37
+ } catch {
38
+ fail([
39
+ `grove: the binary package ${pkg} is not installed.`,
40
+ "It is an optionalDependency of @enginerd-kr/grove, chosen by os/cpu at install time.",
41
+ "Likely causes: --omit=optional (or --no-optional), a lockfile written on another",
42
+ "platform, or a package manager that ignores os/cpu. There is no install script,",
43
+ "so --ignore-scripts is not the reason.",
44
+ "Try: npm install -g @enginerd-kr/grove --force",
45
+ `supported: ${TARGETS.join(", ")}`,
46
+ ]);
47
+ }
48
+ if (!existsSync(bin)) {
49
+ fail([`grove: ${pkg} is installed but ${bin} is missing; reinstall it.`]);
50
+ }
51
+
52
+ // Ctrl-C reaches both processes at once: the terminal signals the whole
53
+ // foreground group. The child owns the shutdown — it kills the git it started
54
+ // and exits 130 — so this process only has to outlive it and repeat its
55
+ // answer. A listener, even an empty one, replaces Node's default "terminate on
56
+ // signal"; spawnSync then blocks the event loop, so the listener never runs.
57
+ // Inside the TUI none of this happens: the terminal is in raw mode there, and
58
+ // ^C arrives as a byte on the child's stdin, which the child handles itself.
59
+ const SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
60
+ const ignore = () => {};
61
+ for (const signal of SIGNALS) process.on(signal, ignore);
62
+
63
+ const result = spawnSync(bin, process.argv.slice(2), {
64
+ stdio: "inherit",
65
+ env: { ...process.env, GROVE_INSTALL_CHANNEL: process.env.GROVE_INSTALL_CHANNEL ?? "npm" },
66
+ });
67
+
68
+ if (result.error) fail([`grove: could not start ${bin}: ${result.error.message}`]);
69
+
70
+ // Died of a signal: die of the same one, so the shell sees 128+n as it would
71
+ // have without the launcher. Removing the listener restores the default
72
+ // disposition, which is what makes the second kill fatal.
73
+ if (result.signal) {
74
+ process.removeListener(result.signal, ignore);
75
+ process.kill(process.pid, result.signal);
76
+ }
77
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@enginerd-kr/grove",
3
+ "version": "0.5.1",
4
+ "description": "Git worktrees as a managed workspace: one bare clone, a directory per branch, and a terminal UI over them",
5
+ "type": "module",
6
+ "bin": {
7
+ "grove": "bin/grove.js"
8
+ },
9
+ "files": [
10
+ "bin"
11
+ ],
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "os": [
16
+ "darwin",
17
+ "linux"
18
+ ],
19
+ "keywords": [
20
+ "git",
21
+ "worktree",
22
+ "worktrees",
23
+ "cli",
24
+ "tui",
25
+ "branches"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/enginerd-kr/grove.git"
30
+ },
31
+ "homepage": "https://github.com/enginerd-kr/grove#readme",
32
+ "bugs": {
33
+ "url": "https://github.com/enginerd-kr/grove/issues"
34
+ },
35
+ "license": "MIT",
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "optionalDependencies": {
40
+ "@enginerd-kr/grove-darwin-arm64": "0.5.1",
41
+ "@enginerd-kr/grove-darwin-x64": "0.5.1",
42
+ "@enginerd-kr/grove-linux-x64": "0.5.1",
43
+ "@enginerd-kr/grove-linux-arm64": "0.5.1"
44
+ }
45
+ }