@genesis-agent/cli 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/bin/genesis.js +19 -0
- package/install.js +105 -0
- package/package.json +33 -0
package/bin/genesis.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { execFileSync } = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
9
|
+
const binary = path.join(__dirname, `genesis${ext}`);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
13
|
+
} catch (err) {
|
|
14
|
+
if (err.status !== null) {
|
|
15
|
+
process.exit(err.status);
|
|
16
|
+
}
|
|
17
|
+
console.error(`Failed to run genesis: ${err.message}`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const { execSync } = require("child_process");
|
|
9
|
+
|
|
10
|
+
const VERSION = require("./package.json").version;
|
|
11
|
+
const REPO = "deadraid/genesis";
|
|
12
|
+
|
|
13
|
+
const PLATFORM_MAP = {
|
|
14
|
+
"darwin-arm64": "genesis-macos-aarch64",
|
|
15
|
+
"darwin-x64": "genesis-macos-x86_64",
|
|
16
|
+
"linux-x64": "genesis-linux-x86_64",
|
|
17
|
+
"linux-arm64": "genesis-linux-aarch64",
|
|
18
|
+
"win32-x64": "genesis-windows-x86_64",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getPlatformKey() {
|
|
22
|
+
const platform = process.platform;
|
|
23
|
+
const arch = process.arch;
|
|
24
|
+
const key = `${platform}-${arch}`;
|
|
25
|
+
|
|
26
|
+
if (!PLATFORM_MAP[key]) {
|
|
27
|
+
console.error(`Unsupported platform: ${key}`);
|
|
28
|
+
console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return key;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getBinaryName(platformKey) {
|
|
36
|
+
const name = PLATFORM_MAP[platformKey];
|
|
37
|
+
return platformKey.startsWith("win32") ? `${name}.exe` : name;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getDownloadUrl(binaryName) {
|
|
41
|
+
return `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function download(url, dest) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
const follow = (url, redirects) => {
|
|
47
|
+
if (redirects > 5) return reject(new Error("Too many redirects"));
|
|
48
|
+
|
|
49
|
+
https
|
|
50
|
+
.get(url, (res) => {
|
|
51
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
52
|
+
return follow(res.headers.location, redirects + 1);
|
|
53
|
+
}
|
|
54
|
+
if (res.statusCode !== 200) {
|
|
55
|
+
return reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const file = fs.createWriteStream(dest);
|
|
59
|
+
res.pipe(file);
|
|
60
|
+
file.on("finish", () => {
|
|
61
|
+
file.close();
|
|
62
|
+
resolve();
|
|
63
|
+
});
|
|
64
|
+
file.on("error", reject);
|
|
65
|
+
})
|
|
66
|
+
.on("error", reject);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
follow(url, 0);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function main() {
|
|
74
|
+
const platformKey = getPlatformKey();
|
|
75
|
+
const binaryName = getBinaryName(platformKey);
|
|
76
|
+
const url = getDownloadUrl(binaryName);
|
|
77
|
+
const binDir = path.join(__dirname, "bin");
|
|
78
|
+
const destName = process.platform === "win32" ? "genesis.exe" : "genesis";
|
|
79
|
+
const dest = path.join(binDir, destName);
|
|
80
|
+
|
|
81
|
+
if (fs.existsSync(dest)) {
|
|
82
|
+
console.log("genesis binary already exists, skipping download.");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
87
|
+
|
|
88
|
+
console.log(`Downloading genesis v${VERSION} for ${platformKey}...`);
|
|
89
|
+
console.log(` ${url}`);
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
await download(url, dest);
|
|
93
|
+
if (process.platform !== "win32") {
|
|
94
|
+
fs.chmodSync(dest, 0o755);
|
|
95
|
+
}
|
|
96
|
+
console.log("genesis installed successfully.");
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.error(`Failed to download genesis: ${err.message}`);
|
|
99
|
+
console.error("You can download manually from:");
|
|
100
|
+
console.error(` https://github.com/${REPO}/releases/tag/v${VERSION}`);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@genesis-agent/cli",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Genesis — AI agent orchestration platform with swarm intelligence",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/deadraid/genesis.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"genesis": "bin/genesis.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node install.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/",
|
|
18
|
+
"install.js"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
22
|
+
},
|
|
23
|
+
"os": ["darwin", "linux", "win32"],
|
|
24
|
+
"cpu": ["x64", "arm64"],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"genesis",
|
|
27
|
+
"ai",
|
|
28
|
+
"agent",
|
|
29
|
+
"llm",
|
|
30
|
+
"swarm",
|
|
31
|
+
"cli"
|
|
32
|
+
]
|
|
33
|
+
}
|