@hybroai/cli 0.2.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/bin/hybro.js +69 -0
- package/package.json +36 -0
package/bin/hybro.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Entry point for `hybro`. It locates the frozen CLI for this platform and
|
|
3
|
+
// replaces itself with it.
|
|
4
|
+
//
|
|
5
|
+
// The platform binaries are optionalDependencies, not postinstall downloads:
|
|
6
|
+
// npm already resolves os/cpu, so only the matching package is installed, and
|
|
7
|
+
// `npm install --ignore-scripts` still yields a working CLI.
|
|
8
|
+
//
|
|
9
|
+
// No signal handlers are installed on purpose. With stdio inherited, the child
|
|
10
|
+
// shares this process's foreground process group, so Ctrl-C reaches it directly;
|
|
11
|
+
// forwarding as well would deliver SIGINT twice and the TUI treats that as two
|
|
12
|
+
// separate interrupts.
|
|
13
|
+
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
const { spawn } = require("node:child_process");
|
|
17
|
+
const { accessSync, constants, chmodSync } = require("node:fs");
|
|
18
|
+
|
|
19
|
+
const PLATFORM_PACKAGES = {
|
|
20
|
+
"darwin arm64": "@hybroai/cli-darwin-arm64",
|
|
21
|
+
"darwin x64": "@hybroai/cli-darwin-x64",
|
|
22
|
+
"linux arm64": "@hybroai/cli-linux-arm64",
|
|
23
|
+
"linux x64": "@hybroai/cli-linux-x64",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function fail(message) {
|
|
27
|
+
process.stderr.write(`hybro: ${message}\n`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const key = `${process.platform} ${process.arch}`;
|
|
32
|
+
const packageName = PLATFORM_PACKAGES[key];
|
|
33
|
+
if (!packageName) {
|
|
34
|
+
fail(
|
|
35
|
+
`no build for ${key}. Supported: ${Object.keys(PLATFORM_PACKAGES).join(", ")}.`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let binary;
|
|
40
|
+
try {
|
|
41
|
+
binary = require.resolve(`${packageName}/hybro/hybro`);
|
|
42
|
+
} catch {
|
|
43
|
+
fail(
|
|
44
|
+
`${packageName} is not installed. Reinstall with ` +
|
|
45
|
+
`"npm install -g @hybroai/cli" without --omit=optional.`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// npm preserves the executable bit, but a copied or re-packed tree may not.
|
|
50
|
+
try {
|
|
51
|
+
accessSync(binary, constants.X_OK);
|
|
52
|
+
} catch {
|
|
53
|
+
try {
|
|
54
|
+
chmodSync(binary, 0o755);
|
|
55
|
+
} catch {
|
|
56
|
+
fail(`${binary} is not executable.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
61
|
+
|
|
62
|
+
child.on("error", (error) => fail(`cannot start ${binary}: ${error.message}`));
|
|
63
|
+
child.on("exit", (code, signal) => {
|
|
64
|
+
if (signal) {
|
|
65
|
+
process.kill(process.pid, signal);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
process.exit(code === null ? 1 : code);
|
|
69
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hybroai/cli",
|
|
3
|
+
"version": "0.2.16",
|
|
4
|
+
"description": "Hybro command line: configure models and run the Hybro container stack",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hybro",
|
|
7
|
+
"agents",
|
|
8
|
+
"a2a",
|
|
9
|
+
"cli"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/hybroai/hybro",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/hybroai/hybro.git",
|
|
15
|
+
"directory": "packaging/npm/cli"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"bin": {
|
|
19
|
+
"hybro": "bin/hybro.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"optionalDependencies": {
|
|
31
|
+
"@hybroai/cli-darwin-arm64": "0.2.16",
|
|
32
|
+
"@hybroai/cli-darwin-x64": "0.2.16",
|
|
33
|
+
"@hybroai/cli-linux-arm64": "0.2.16",
|
|
34
|
+
"@hybroai/cli-linux-x64": "0.2.16"
|
|
35
|
+
}
|
|
36
|
+
}
|