@adamancyzhang/claude-orchestrator 0.1.0
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/bin/claude-orchestrator +20 -0
- package/package.json +18 -0
- package/scripts/install.js +123 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adamancy Zhang
|
|
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.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
const binary = path.join(__dirname, "orchestrator-binary");
|
|
7
|
+
|
|
8
|
+
if (!fs.existsSync(binary)) {
|
|
9
|
+
console.error(`Error: orchestrator-binary not found at ${binary}`);
|
|
10
|
+
console.error(
|
|
11
|
+
"Run 'node scripts/install.js' to download it, or build with 'bash scripts/build-binary.sh'"
|
|
12
|
+
);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const result = spawnSync(binary, process.argv.slice(2), {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adamancyzhang/claude-orchestrator",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Multi-agent orchestration CLI backed by ZooKeeper — register, assign tasks, communicate, share context",
|
|
5
|
+
"repository": "github:adamancyzhang/claude-orchestrator-server",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"claude-orchestrator": "bin/claude-orchestrator"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"postinstall": "node scripts/install.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/claude-orchestrator",
|
|
15
|
+
"scripts/install.js",
|
|
16
|
+
"package.json"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const BIN_DIR = path.resolve(__dirname, "..", "bin");
|
|
8
|
+
const BINARY_PATH = path.join(BIN_DIR, "orchestrator-binary");
|
|
9
|
+
|
|
10
|
+
if (fs.existsSync(BINARY_PATH)) {
|
|
11
|
+
console.log("Binary already installed at", BINARY_PATH);
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const platform = process.platform; // "darwin", "linux"
|
|
16
|
+
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
17
|
+
const binaryName = `claude-orchestrator-${platform}-${arch}`;
|
|
18
|
+
|
|
19
|
+
const repo =
|
|
20
|
+
process.env.ORCHESTRATOR_REPO || "adamancyzhang/claude-orchestrator-server";
|
|
21
|
+
const version =
|
|
22
|
+
process.env.ORCHESTRATOR_VERSION || "v0.1.0";
|
|
23
|
+
|
|
24
|
+
// ── Helpers ──
|
|
25
|
+
|
|
26
|
+
function httpGetJSON(url) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
https
|
|
29
|
+
.get(url, { headers: { "User-Agent": "claude-orchestrator-installer" } }, (res) => {
|
|
30
|
+
if (res.statusCode !== 200) {
|
|
31
|
+
reject(new Error(`HTTP ${res.statusCode}`));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let body = "";
|
|
35
|
+
res.on("data", (chunk) => (body += chunk));
|
|
36
|
+
res.on("end", () => {
|
|
37
|
+
try {
|
|
38
|
+
resolve(JSON.parse(body));
|
|
39
|
+
} catch (e) {
|
|
40
|
+
reject(e);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
})
|
|
44
|
+
.on("error", reject);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function download(url, dest) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const file = fs.createWriteStream(dest, { mode: 0o755 });
|
|
51
|
+
https
|
|
52
|
+
.get(
|
|
53
|
+
url,
|
|
54
|
+
{ headers: { Accept: "application/octet-stream", "User-Agent": "claude-orchestrator-installer" } },
|
|
55
|
+
(response) => {
|
|
56
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
57
|
+
file.close();
|
|
58
|
+
fs.unlinkSync(dest);
|
|
59
|
+
return download(response.headers.location, dest).then(resolve).catch(reject);
|
|
60
|
+
}
|
|
61
|
+
if (response.statusCode !== 200) {
|
|
62
|
+
file.close();
|
|
63
|
+
fs.unlinkSync(dest);
|
|
64
|
+
reject(new Error(`Download failed: HTTP ${response.statusCode}`));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
response.pipe(file);
|
|
68
|
+
file.on("finish", () => {
|
|
69
|
+
file.close();
|
|
70
|
+
resolve();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
.on("error", (err) => {
|
|
75
|
+
file.close();
|
|
76
|
+
try { fs.unlinkSync(dest); } catch (_) {}
|
|
77
|
+
reject(err);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ── Main ──
|
|
83
|
+
|
|
84
|
+
async function install() {
|
|
85
|
+
// Step 1: Get asset download URL from GitHub Releases API
|
|
86
|
+
const apiUrl = `https://api.github.com/repos/${repo}/releases/tags/${version}`;
|
|
87
|
+
console.log(`Resolving ${binaryName} via ${apiUrl}...`);
|
|
88
|
+
|
|
89
|
+
let release;
|
|
90
|
+
try {
|
|
91
|
+
release = await httpGetJSON(apiUrl);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.error(`Failed to fetch release info: ${e.message}`);
|
|
94
|
+
console.error(`Build it locally: bash scripts/build-binary.sh`);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const asset = (release.assets || []).find((a) => a.name === binaryName);
|
|
99
|
+
if (!asset) {
|
|
100
|
+
console.error(
|
|
101
|
+
`No prebuilt binary for ${platform}-${arch}. ` +
|
|
102
|
+
`Available assets: ${(release.assets || []).map((a) => a.name).join(", ") || "none"}. ` +
|
|
103
|
+
`Build it locally: bash scripts/build-binary.sh`
|
|
104
|
+
);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
console.log(`Found ${binaryName} (${(asset.size / 1024 / 1024).toFixed(1)} MB), downloading...`);
|
|
109
|
+
|
|
110
|
+
// Step 2: Download via asset API URL (requires Accept header)
|
|
111
|
+
try {
|
|
112
|
+
await download(asset.url, BINARY_PATH);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
console.error(`Download failed: ${e.message}`);
|
|
115
|
+
console.error(`Build it locally: bash scripts/build-binary.sh`);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fs.chmodSync(BINARY_PATH, 0o755);
|
|
120
|
+
console.log(`Installed ${binaryName} to ${BINARY_PATH}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
install();
|