@pborck/clove 0.0.0-stage → 0.1.32
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 +21 -0
- package/README.md +167 -2
- package/bin/clove.js +43 -0
- package/package.json +24 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pierre Borckmans
|
|
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
CHANGED
|
@@ -1,3 +1,168 @@
|
|
|
1
|
-
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="brand/mark-on-dark.svg">
|
|
3
|
+
<img src="brand/mark.svg" alt="" width="72">
|
|
4
|
+
</picture>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# clove
|
|
7
|
+
|
|
8
|
+
[](https://github.com/pierre-borckmans/clove/actions/workflows/ci.yml)
|
|
9
|
+
[](https://github.com/pierre-borckmans/clove/releases/latest)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
A ready git worktree in ~1s, with `node_modules`, the dev shell and every other ignored file already there.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
$ clove new feat/login
|
|
16
|
+
+ feat/login
|
|
17
|
+
✓ clone image 0.00s
|
|
18
|
+
✓ mount 0.70s
|
|
19
|
+
✓ checkout 0.21s
|
|
20
|
+
✓ setup mise-trust 0.02s
|
|
21
|
+
✓ setup direnv-allow 0.02s
|
|
22
|
+
· setup direnv unchanged since golden
|
|
23
|
+
· setup pnpm unchanged since golden
|
|
24
|
+
|
|
25
|
+
● feat-login ready in 1.0s ~/src/mono.clove/feat-login/mono
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| On a ~35k-file monorepo | `git worktree add` + setup | `clove new` |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| Time to a usable checkout | ~70s | ~1s |
|
|
31
|
+
| New disk per worktree | a few GB | ~6 MB |
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
The CLI and terminal UI, on macOS and Linux:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
brew install pierre-borckmans/tap/clove
|
|
39
|
+
clove shell-init --install # cd into new clones, completions (zsh, bash, fish)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The desktop app, on macOS, with a menu-bar popover:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
brew install --cask pierre-borckmans/tap/clove-app
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
On Linux (x86_64 and arm64), a `.deb` and an AppImage are on the [releases page](https://github.com/pierre-borckmans/clove/releases). It runs the CLI for the background service, so install that too.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
sudo apt install ./clove-app-v<version>-x86_64.deb # Debian, Ubuntu
|
|
52
|
+
chmod +x clove-app-v<version>-x86_64.AppImage # anywhere else; needs libfuse2
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Without Homebrew:
|
|
56
|
+
|
|
57
|
+
- **npm:** `npm i -g @pborck/clove`, or `npx @pborck/clove`. Same binaries as the releases; `clove upgrade` only handles Homebrew, so upgrade with npm.
|
|
58
|
+
- **Prebuilt binaries** for macOS and Linux are on the [releases page](https://github.com/pierre-borckmans/clove/releases). The macOS ones are signed and notarized.
|
|
59
|
+
- **From source:** `cargo install --git https://github.com/pierre-borckmans/clove clove-cli`
|
|
60
|
+
|
|
61
|
+
Then, in a repository:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
clove init # shows what it will set up, then builds the golden image (once)
|
|
65
|
+
clove new feat/login # a ready worktree on that branch
|
|
66
|
+
clove service install # remount clones at login, keep golden images fresh
|
|
67
|
+
clove agents install # teach Claude Code, Codex, OpenCode and Pi to use clove (optional)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<details>
|
|
71
|
+
<summary><strong>Requirements</strong></summary>
|
|
72
|
+
|
|
73
|
+
#### macOS
|
|
74
|
+
|
|
75
|
+
- APFS, the default filesystem.
|
|
76
|
+
- Tested on macOS 26, which has ASIF disk images.
|
|
77
|
+
- Older versions fall back to `hdiutil` sparse images: implemented, but untested.
|
|
78
|
+
|
|
79
|
+
#### Linux
|
|
80
|
+
|
|
81
|
+
- `btrfs-progs` (`sudo apt install btrfs-progs`) and loop devices. The host disk can be any filesystem.
|
|
82
|
+
- Kernel 6.7+ gives exact clone sizes (simple quotas). Older kernels use full qgroups, or report no sizes.
|
|
83
|
+
- `clove init` offers to add one line to `/etc/fstab`, with sudo, once per repo:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
~/.clove/repos/<repo>-<hash>/pool.btrfs ~/src/<repo>.clove btrfs loop,user,noauto,exec,user_subvol_rm_allowed 0 0
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- How clove mounts the repo's image, in order of preference (`clove doctor` says which one a repo uses):
|
|
90
|
+
- **With that fstab line:** as you, at `<repo>.clove`, from a desktop or over SSH.
|
|
91
|
+
- **Without it, through udisks2** if installed: only from a desktop session, with clones under `/run/media/$USER/` (or `/media/$USER/`).
|
|
92
|
+
- **`sudo -n`** as a last resort.
|
|
93
|
+
|
|
94
|
+
</details>
|
|
95
|
+
|
|
96
|
+
## Why
|
|
97
|
+
|
|
98
|
+
- **`git worktree add` gives you the tracked files and nothing else.** On a monorepo with ~35k files, ~4.5k npm packages and a nix flake dev shell, a fresh worktree takes ~70s before anything runs:
|
|
99
|
+
- ~40s for direnv to evaluate the flake
|
|
100
|
+
- ~30s for `pnpm install --offline`
|
|
101
|
+
- a few GB of new files
|
|
102
|
+
- **Copying the ignored files over doesn't scale with file count.** Tools like worktrunk's `copy-ignored`, `cp -c` and the git-cow family copy-on-write file by file. That saves disk, but time grows with the number of files: that repo's ~550k ignored files take minutes, and `clonefile` on the root `node_modules` alone takes ~15s.
|
|
103
|
+
- **clove copies one disk image instead of half a million files**, so the cost doesn't depend on how many files the repo has.
|
|
104
|
+
|
|
105
|
+
## How it works
|
|
106
|
+
|
|
107
|
+
<picture>
|
|
108
|
+
<source media="(prefers-color-scheme: dark)" srcset="brand/how-it-works-dark.svg">
|
|
109
|
+
<img src="brand/how-it-works.svg" alt="clove builds one golden image per repo from the base branch, local files and warm steps, then makes each clone a copy-on-write copy of it in about a second" width="100%">
|
|
110
|
+
</picture>
|
|
111
|
+
|
|
112
|
+
- **One golden image per repo:** a worktree of the base branch, with dependencies installed and dev environments warmed.
|
|
113
|
+
- **A clone is a copy-on-write copy of it**, registered as a regular git worktree with a copy of the golden index. Inodes and timestamps are kept, so git rehashes nothing.
|
|
114
|
+
- **Then only what changed runs:** clove checks out your branch and reruns the setup steps whose inputs changed since the golden commit. Same lockfile, no `pnpm install`.
|
|
115
|
+
- **Clones are isolated.** Adding a dependency or editing the nix flake in one doesn't affect the others.
|
|
116
|
+
- **Normal tools work inside a clone:** file watchers, Docker bind mounts, Go and Rust builds.
|
|
117
|
+
|
|
118
|
+
<details>
|
|
119
|
+
<summary><strong>Under the hood on macOS and Linux</strong></summary>
|
|
120
|
+
|
|
121
|
+
#### macOS
|
|
122
|
+
|
|
123
|
+
The golden image is an APFS volume in a disk image file. `clove new`:
|
|
124
|
+
|
|
125
|
+
1. copies the image *file* with `clonefile(2)`: one syscall whatever is inside, and no disk used until something is written
|
|
126
|
+
2. mounts the copy as its own volume (~0.7s)
|
|
127
|
+
3. registers the worktree and runs the changed steps
|
|
128
|
+
|
|
129
|
+
On the monorepo above: ~1.1s and ~6 MB of disk per clone. `clove init` took ~1m20s, once.
|
|
130
|
+
|
|
131
|
+
#### Linux
|
|
132
|
+
|
|
133
|
+
- Each repo has one btrfs image file, mounted once.
|
|
134
|
+
- The golden worktree is a subvolume in it, and a clone is a snapshot of that subvolume, so there's no mount per clone.
|
|
135
|
+
- On a ~185k-file golden: the snapshot takes ~8 ms, and the first `git status` in the clone ~50 ms, with no rehash.
|
|
136
|
+
|
|
137
|
+
More in [internals](docs/internals.md).
|
|
138
|
+
|
|
139
|
+
</details>
|
|
140
|
+
|
|
141
|
+
## Features
|
|
142
|
+
|
|
143
|
+
- **Any branch or PR, ready in ~1s.** `clove new feat/x`, `clove new pr:123`, or `-x claude` to start an agent in it. → [Commands](docs/commands.md)
|
|
144
|
+
- **CLI, terminal UI and desktop app** (macOS and Linux), with the same features everywhere; every command takes `--json`. → [Interfaces](docs/commands.md#interfaces)
|
|
145
|
+
- **Shell integration:** `cd` into new clones, completions, and each clone's environment loaded while you're in it. → [Shell integration](docs/commands.md#shell-integration)
|
|
146
|
+
- **Checkpoints, rewind and fork:** freeze a clone mid-work in ~0.05s, put it back in ~1.5s, or fork it into new clones with its uncommitted state. → [Checkpoints](docs/design/checkpoints.md)
|
|
147
|
+
- **Agent sessions, linked to their clone:** clove reads Claude Code, Codex, pi and Antigravity logs on your machine to show which sessions made or worked in each clone. Read one as a conversation, follow a live one, or resume it in a terminal. → [Agent sessions](docs/commands.md#agent-sessions)
|
|
148
|
+
- **Sees what runs in a clone:** shells, dev servers, editors and agents, with their ports; `clove ps` lists them, and removing a clone stops them first. → [Processes](docs/commands.md#processes-using-a-clone)
|
|
149
|
+
- **Renames clones:** `clove rename` moves the folder, the image and the branch when it was named after the clone. → [Renaming a clone](docs/commands.md#renaming-a-clone)
|
|
150
|
+
- **Brings clones up to date:** `clove update` rebases onto the latest base and reruns only the setup steps that changed; conflicts stop cleanly, with `--continue` or `--abort`. → [Updating a clone](docs/commands.md#updating-a-clone)
|
|
151
|
+
- **Works next to plain git worktrees:** lists them, removes them safely, or adopts them as clones. → [Plain git worktrees](docs/commands.md#plain-git-worktrees)
|
|
152
|
+
- **Cleans up after merged PRs,** squash merges included, by hand or automatically, with a history to get any branch back. → [Cleaning up](docs/cleanup.md)
|
|
153
|
+
- **Built for coding agents:** one command teaches Claude Code, Codex, OpenCode and Pi to use clones. Claude Code and OpenCode use clones for native worktrees in repos clove manages. → [Coding agents](docs/agents.md)
|
|
154
|
+
- **Stays fresh on its own:** incremental refreshes, only when a step's inputs change on the base. → [Staying fresh](docs/freshness.md)
|
|
155
|
+
- **Detects your toolchain:** mise, direnv + nix, pnpm, bun, yarn, npm, deno, uv, Poetry, PDM, Bundler, Composer, Go, Gradle, Maven, .NET, Dart/Flutter, Mix, SwiftPM, CocoaPods, Zig and cargo, plus your own steps and local files like `.env`. → [Configuration](docs/configuration.md)
|
|
156
|
+
|
|
157
|
+
Also: [limits](docs/limits.md) and [internals](docs/internals.md) (how clones are stored on macOS and Linux).
|
|
158
|
+
|
|
159
|
+
## Develop
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
cargo test --workspace # unit tests + an end-to-end run on real disk images (macOS)
|
|
163
|
+
scripts/smoke.zsh # the CLI through the zsh integration, on a throwaway repo
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Releasing and signing: [RELEASING.md](RELEASING.md).
|
|
167
|
+
|
|
168
|
+
MIT licensed.
|
package/bin/clove.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
const scope = "@pborck";
|
|
6
|
+
const supported = ["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64"];
|
|
7
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
8
|
+
|
|
9
|
+
if (!supported.includes(platform)) {
|
|
10
|
+
console.error(`clove has no build for ${platform}. It runs on macOS and Linux, arm64 and x64.`);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const pkg = `${scope}/clove-${platform}`;
|
|
15
|
+
let bin;
|
|
16
|
+
try {
|
|
17
|
+
bin = require.resolve(`${pkg}/bin/clove`);
|
|
18
|
+
} catch {
|
|
19
|
+
console.error(
|
|
20
|
+
`clove: ${pkg} is not installed. npm skips it when optional dependencies are\n` +
|
|
21
|
+
`omitted (--omit=optional), or on Linux without glibc. Reinstall @pborck/clove.`,
|
|
22
|
+
);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
27
|
+
|
|
28
|
+
// Ctrl-C reaches clove from the terminal already; don't die before it does.
|
|
29
|
+
process.on("SIGINT", () => {});
|
|
30
|
+
for (const sig of ["SIGTERM", "SIGHUP"]) process.on(sig, () => child.kill(sig));
|
|
31
|
+
|
|
32
|
+
child.on("error", (err) => {
|
|
33
|
+
console.error(`clove: ${err.message}`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
});
|
|
36
|
+
child.on("exit", (code, signal) => {
|
|
37
|
+
if (signal) {
|
|
38
|
+
process.removeAllListeners(signal);
|
|
39
|
+
process.kill(process.pid, signal);
|
|
40
|
+
} else {
|
|
41
|
+
process.exit(code ?? 1);
|
|
42
|
+
}
|
|
43
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pborck/clove",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"description": "Copy-on-write git worktrees with dependencies already installed",
|
|
4
|
+
"version": "0.1.32",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/pierre-borckmans/clove",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/pierre-borckmans/clove.git"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"clove": "bin/clove.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"optionalDependencies": {
|
|
21
|
+
"@pborck/clove-darwin-arm64": "0.1.32",
|
|
22
|
+
"@pborck/clove-darwin-x64": "0.1.32",
|
|
23
|
+
"@pborck/clove-linux-arm64": "0.1.32",
|
|
24
|
+
"@pborck/clove-linux-x64": "0.1.32"
|
|
25
|
+
}
|
|
26
|
+
}
|