worktree-zero 0.1.16
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 +26 -0
- package/bin/wt0.js +81 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# wt0
|
|
2
|
+
|
|
3
|
+
npm distribution of [Worktree Zero](https://github.com/lonormaly/worktree-zero) --
|
|
4
|
+
thin, copy-on-write worktrees for coding agents: create, prepare, measure,
|
|
5
|
+
migrate, and safely remove them from one guarded lifecycle.
|
|
6
|
+
|
|
7
|
+
This package is a small dispatcher; the real `wt0` binary ships in one of six
|
|
8
|
+
platform packages (`wt0-darwin-arm64`, `wt0-darwin-x64`, `wt0-linux-x64`,
|
|
9
|
+
`wt0-linux-arm64`, `wt0-win32-x64`, `wt0-win32-arm64`) installed automatically
|
|
10
|
+
as an optional dependency for your platform. No postinstall network download.
|
|
11
|
+
|
|
12
|
+
## Use
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx worktree-zero doctor
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or install it globally:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i -g worktree-zero
|
|
22
|
+
wt0 doctor
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
See the [Worktree Zero README](https://github.com/lonormaly/worktree-zero#readme)
|
|
26
|
+
for the full command reference, lifecycle model, and vendor integrations.
|
package/bin/wt0.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Thin dispatcher: resolve the prebuilt `wt0` binary for this platform from
|
|
5
|
+
// one of the optionalDependencies platform packages, then exec it in place.
|
|
6
|
+
// No dependencies, so this file has to run on a bare Node >=18 install.
|
|
7
|
+
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
const { spawnSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
const PLATFORM_PACKAGES = {
|
|
13
|
+
'darwin-arm64': 'wt0-darwin-arm64',
|
|
14
|
+
'darwin-x64': 'wt0-darwin-x64',
|
|
15
|
+
'linux-x64': 'wt0-linux-x64',
|
|
16
|
+
'linux-arm64': 'wt0-linux-arm64',
|
|
17
|
+
'win32-x64': 'wt0-win32-x64',
|
|
18
|
+
'win32-arm64': 'wt0-win32-arm64',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function resolveBinary() {
|
|
22
|
+
const key = `${process.platform}-${process.arch}`;
|
|
23
|
+
const pkgName = PLATFORM_PACKAGES[key];
|
|
24
|
+
const binName = process.platform === 'win32' ? 'wt0.exe' : 'wt0';
|
|
25
|
+
|
|
26
|
+
if (!pkgName) {
|
|
27
|
+
return {
|
|
28
|
+
error: [
|
|
29
|
+
`wt0: no prebuilt binary is published for this platform (${key}).`,
|
|
30
|
+
'Install from source instead: Homebrew (brew install lonormaly/wt0/wt0),',
|
|
31
|
+
'cargo-binstall (cargo binstall worktree-zero), or a manual download from',
|
|
32
|
+
'https://github.com/lonormaly/worktree-zero/releases.',
|
|
33
|
+
].join(' '),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let pkgJsonPath;
|
|
38
|
+
try {
|
|
39
|
+
pkgJsonPath = require.resolve(`${pkgName}/package.json`);
|
|
40
|
+
} catch {
|
|
41
|
+
return {
|
|
42
|
+
error: [
|
|
43
|
+
`wt0: the platform package "${pkgName}" for ${key} is not installed.`,
|
|
44
|
+
'This usually means optional dependencies were skipped during install',
|
|
45
|
+
'(e.g. --no-optional, --omit=optional, or an npm config that disables them)',
|
|
46
|
+
`or that ${key} has no prebuilt binary yet. Reinstall with optional`,
|
|
47
|
+
'dependencies enabled, or use Homebrew (brew install lonormaly/wt0/wt0),',
|
|
48
|
+
'cargo-binstall (cargo binstall worktree-zero), or a manual download from',
|
|
49
|
+
'https://github.com/lonormaly/worktree-zero/releases.',
|
|
50
|
+
].join(' '),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return { bin: path.join(path.dirname(pkgJsonPath), 'bin', binName) };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function exitCodeForSignal(signal) {
|
|
58
|
+
const num = os.constants.signals[signal];
|
|
59
|
+
return 128 + (typeof num === 'number' ? num : 1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function main() {
|
|
63
|
+
const resolved = resolveBinary();
|
|
64
|
+
if (resolved.error) {
|
|
65
|
+
console.error(resolved.error);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const result = spawnSync(resolved.bin, process.argv.slice(2), { stdio: 'inherit' });
|
|
70
|
+
|
|
71
|
+
if (result.error) {
|
|
72
|
+
console.error(`wt0: failed to run "${resolved.bin}": ${result.error.message}`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
if (result.signal) {
|
|
76
|
+
process.exit(exitCodeForSignal(result.signal));
|
|
77
|
+
}
|
|
78
|
+
process.exit(result.status === null ? 1 : result.status);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "worktree-zero",
|
|
3
|
+
"version": "0.1.16",
|
|
4
|
+
"description": "Thin, copy-on-write worktrees for coding agents -- create, prepare, measure, and safely remove them from the command line.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"wt0": "bin/wt0.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/wt0.js"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/lonormaly/worktree-zero.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/lonormaly/worktree-zero",
|
|
20
|
+
"bugs": "https://github.com/lonormaly/worktree-zero/issues",
|
|
21
|
+
"keywords": [
|
|
22
|
+
"git",
|
|
23
|
+
"worktree",
|
|
24
|
+
"agents",
|
|
25
|
+
"copy-on-write",
|
|
26
|
+
"cli"
|
|
27
|
+
],
|
|
28
|
+
"optionalDependencies": {
|
|
29
|
+
"wt0-darwin-arm64": "0.1.16",
|
|
30
|
+
"wt0-darwin-x64": "0.1.16",
|
|
31
|
+
"wt0-linux-x64": "0.1.16",
|
|
32
|
+
"wt0-linux-arm64": "0.1.16",
|
|
33
|
+
"wt0-win32-x64": "0.1.16",
|
|
34
|
+
"wt0-win32-arm64": "0.1.16"
|
|
35
|
+
}
|
|
36
|
+
}
|