opencode2-cow-worktree 0.1.0 → 0.1.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/README.md +65 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,8 +7,9 @@ milliseconds at almost no disk cost. Where a `git worktree` carries tracked
|
|
|
7
7
|
files only, a **Deep clone** here carries everything, so the agent can run the
|
|
8
8
|
test suite immediately.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Current release: [v0.1.0](https://github.com/rbelem/opencode2-cow-worktree/releases/tag/v0.1.0),
|
|
11
|
+
also on [npm](https://www.npmjs.com/package/opencode2-cow-worktree). Install
|
|
12
|
+
from a local checkout (form A below) or from the npm registry.
|
|
12
13
|
|
|
13
14
|
## Requirements
|
|
14
15
|
|
|
@@ -28,59 +29,45 @@ capability gate on that default: on a filesystem that cannot reflink (ext4,
|
|
|
28
29
|
tmpfs), worktree creation fails loudly until you remove the plugin. Install
|
|
29
30
|
it only on machines whose projects meet the Requirements above. opencode2
|
|
30
31
|
Desktop cannot select plugin strategies today, so it ignores the plugin
|
|
31
|
-
entirely
|
|
32
|
+
entirely
|
|
33
|
+
([`docs/research/desktop-strategy-hardcode.md`](https://github.com/rbelem/opencode2-cow-worktree/blob/main/docs/research/desktop-strategy-hardcode.md)).
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
duplicate load fails.
|
|
35
|
+
### The short version
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
opencode2 installs the plugin itself from npm. Add the package to the
|
|
38
|
+
`plugins` array of your `opencode.json`:
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
3. Create two one-line seam files in the plugin directory. The first loads
|
|
46
|
-
the server plugin; the second loads its TUI half, which shows a small
|
|
47
|
-
`cow` marker in the sidebar footer while a session runs in a cow
|
|
48
|
-
worktree:
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
// ~/.config/opencode/plugins/opencode2-cow-worktree/index.ts
|
|
52
|
-
export { default } from "opencode2-cow-worktree";
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
// ~/.config/opencode/plugins/opencode2-cow-worktree/tui.tsx
|
|
57
|
-
export { default } from "opencode2-cow-worktree/tui";
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The server works without the second file; skip it if you do not want the
|
|
61
|
-
marker.
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"plugins": [{ "package": "opencode2-cow-worktree@latest" }]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
62
45
|
|
|
63
|
-
|
|
46
|
+
Or let the CLI write that entry:
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
```
|
|
48
|
+
```sh
|
|
49
|
+
opencode2 plugin add opencode2-cow-worktree
|
|
50
|
+
```
|
|
69
51
|
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
On the next startup opencode2 downloads the package into its own cache
|
|
53
|
+
(`~/.cache/opencode/node_modules/`) and loads it. That is the whole install:
|
|
54
|
+
the `cow` marker in the TUI sidebar ships in the same package and loads with
|
|
55
|
+
it — no seam files, no checkout, no symlink. The first startup waits for the
|
|
56
|
+
download, so give it a few extra seconds.
|
|
72
57
|
|
|
73
|
-
|
|
58
|
+
Declare the plugin exactly once. A duplicate declaration (registry entry plus
|
|
59
|
+
local path, or a discovered plugin directory plus the array) makes one of the
|
|
60
|
+
two loads fail with `Plugin failed to load`.
|
|
74
61
|
|
|
75
|
-
###
|
|
62
|
+
### Options
|
|
76
63
|
|
|
77
|
-
|
|
64
|
+
Options ride in the same entry:
|
|
78
65
|
|
|
79
66
|
```json
|
|
80
67
|
{
|
|
81
68
|
"plugins": [
|
|
82
69
|
{
|
|
83
|
-
"package": "
|
|
70
|
+
"package": "opencode2-cow-worktree@latest",
|
|
84
71
|
"options": {
|
|
85
72
|
"hooks": { "postCreate": ["corepack use pnpm@latest"] }
|
|
86
73
|
}
|
|
@@ -92,16 +79,40 @@ Point a `plugins` entry at the checkout itself — no symlink, no seam files:
|
|
|
92
79
|
`hooks`, `fallback`, and `targetRoot` are all optional; anything omitted takes
|
|
93
80
|
its default. Each is described below.
|
|
94
81
|
|
|
82
|
+
### Development install
|
|
83
|
+
|
|
84
|
+
To work on the plugin itself, point the entry at a checkout instead of the
|
|
85
|
+
registry. Because opencode2's runtime is Bun and the path points at the
|
|
86
|
+
working tree, tracked edits are live with no build step:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"plugins": [{ "package": "/path/to/opencode2-cow-worktree" }]
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
95
94
|
### Verify
|
|
96
95
|
|
|
96
|
+
Confirm the plugin loaded:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
opencode2 plugin list
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`opencode2-cow-worktree` should appear with state `active`.
|
|
103
|
+
|
|
104
|
+
For a deeper check — that a worktree create with no `strategy` field
|
|
105
|
+
materializes a Deep clone, proving `cow` became the default — the repository
|
|
106
|
+
ships a script:
|
|
107
|
+
|
|
97
108
|
```sh
|
|
98
109
|
bun scripts/dogfood-install-check.ts
|
|
99
110
|
```
|
|
100
111
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
Run it from a repository checkout; the script ships with the repo, not the
|
|
113
|
+
npm package. It boots a throwaway server against the installed plugin and
|
|
114
|
+
asserts that the plugin activates and that the default create is a Deep
|
|
115
|
+
clone.
|
|
105
116
|
|
|
106
117
|
Two gotchas when checking by hand: `GET /api/plugin` does not await
|
|
107
118
|
activation, so a list taken right after boot can look empty — resolve
|
|
@@ -226,6 +237,9 @@ regardless of `fallback`. Only `spawn_workspace` consults the policy.
|
|
|
226
237
|
- **`cow` fails on an ext4 or tmpfs project** — expected: that filesystem
|
|
227
238
|
cannot clone. Use the `git` fallback for tool calls, or let the project use
|
|
228
239
|
the built-in strategy.
|
|
240
|
+
- **The plugin is stuck on an old version** — opencode2 caches the package
|
|
241
|
+
under `~/.cache/opencode/node_modules/`. Remove the plugin's cache
|
|
242
|
+
directory and restart: `rm -rf ~/.cache/opencode/node_modules/opencode2-cow-worktree`.
|
|
229
243
|
- **Plugin looks absent right after boot** — resolve
|
|
230
244
|
`POST /api/plugin/await-activation` before reading `GET /api/plugin`.
|
|
231
245
|
- **`Plugin failed to load`** — the plugin is declared twice (discovered
|
|
@@ -238,13 +252,15 @@ regardless of `fallback`. Only `spawn_workspace` consults the policy.
|
|
|
238
252
|
|
|
239
253
|
The unit suite (`bun test`), typecheck (`bun run typecheck`), coverage gate
|
|
240
254
|
(`bun run test:coverage`), and the e2e harness (`bun scripts/e2e/harness.ts`)
|
|
241
|
-
are described in
|
|
242
|
-
|
|
243
|
-
with
|
|
255
|
+
are described in
|
|
256
|
+
[`docs/development.md`](https://github.com/rbelem/opencode2-cow-worktree/blob/main/docs/development.md),
|
|
257
|
+
along with the recorded live runs and the parallel-lane tooling this
|
|
258
|
+
repository is developed with.
|
|
244
259
|
|
|
245
260
|
Terms the output uses: a **Workspace** is a logical handle, a **Location** is
|
|
246
261
|
where a session runs, and a **Worktree** is a directory materialized by a
|
|
247
|
-
**Strategy** — more in
|
|
262
|
+
**Strategy** — more in
|
|
263
|
+
[CONTEXT.md](https://github.com/rbelem/opencode2-cow-worktree/blob/main/CONTEXT.md).
|
|
248
264
|
|
|
249
265
|
## License
|
|
250
266
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode2-cow-worktree",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Copy-on-write worktree strategy for opencode2: a Deep clone of the whole working directory, ignored files included, so parallel agents start ready to run",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|