@kaluarunsi/obi 0.2.16 → 0.2.18-alpha.3
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/obi +5 -0
- package/bin/obi.js +14 -2
- package/lib/binary.js +25 -0
- package/package.json +4 -4
- package/release-manifest.json +4 -4
package/bin/obi
CHANGED
|
@@ -36,6 +36,7 @@ case "$OS" in
|
|
|
36
36
|
esac
|
|
37
37
|
|
|
38
38
|
BINARY="$PACKAGE_DIR/node_modules/@kaluarunsi/obi-$PLATFORM/vendor/obi/obi"
|
|
39
|
+
RUNTIME="$PACKAGE_DIR/node_modules/@kaluarunsi/obi-$PLATFORM/vendor/obi/obi-runtime"
|
|
39
40
|
|
|
40
41
|
if [ ! -x "$BINARY" ]; then
|
|
41
42
|
printf 'obi: binary not found for platform %s\n' "$PLATFORM" >&2
|
|
@@ -43,4 +44,8 @@ if [ ! -x "$BINARY" ]; then
|
|
|
43
44
|
exit 1
|
|
44
45
|
fi
|
|
45
46
|
|
|
47
|
+
if [ -x "$RUNTIME" ]; then
|
|
48
|
+
export OBI_RUNTIME_BINARY_PATH="$RUNTIME"
|
|
49
|
+
fi
|
|
50
|
+
|
|
46
51
|
exec "$BINARY" "$@"
|
package/bin/obi.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawn } = require("node:child_process");
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
installedBinaryPath,
|
|
5
|
+
hasInstalledBinary,
|
|
6
|
+
installedRuntimePath,
|
|
7
|
+
hasInstalledRuntime,
|
|
8
|
+
} = require("../lib/binary");
|
|
4
9
|
|
|
5
10
|
const binaryPath = installedBinaryPath();
|
|
11
|
+
const runtimePath = installedRuntimePath();
|
|
6
12
|
|
|
7
13
|
if (!hasInstalledBinary()) {
|
|
8
14
|
console.error("Obi binary is not bundled for this platform in the installed package.");
|
|
9
15
|
process.exit(1);
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
18
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
env: {
|
|
21
|
+
...process.env,
|
|
22
|
+
...(hasInstalledRuntime() ? { OBI_RUNTIME_BINARY_PATH: runtimePath } : {}),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
13
25
|
child.on("exit", (code, signal) => {
|
|
14
26
|
if (signal) {
|
|
15
27
|
process.kill(process.pid, signal);
|
package/lib/binary.js
CHANGED
|
@@ -7,6 +7,11 @@ function binaryRelativePath(os, arch) {
|
|
|
7
7
|
return path.join("vendor", "obi", binary);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function runtimeRelativePath(os, arch) {
|
|
11
|
+
const binary = os === "windows" ? "obi-runtime.exe" : "obi-runtime";
|
|
12
|
+
return path.join("vendor", "obi", binary);
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
function packageNameForPlatform(os, arch) {
|
|
11
16
|
return `@kaluarunsi/obi-${os}-${arch}`;
|
|
12
17
|
}
|
|
@@ -41,10 +46,30 @@ function hasInstalledBinary(baseDir = path.join(__dirname, "..")) {
|
|
|
41
46
|
return fs.existsSync(installedBinaryPath(baseDir));
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
function installedRuntimePath(baseDir = path.join(__dirname, "..")) {
|
|
50
|
+
const { os, arch } = detectPlatform();
|
|
51
|
+
const packageRoot = installedPackageRoot(baseDir);
|
|
52
|
+
if (!packageRoot) {
|
|
53
|
+
return path.join(baseDir, runtimeRelativePath(os, arch));
|
|
54
|
+
}
|
|
55
|
+
return path.join(packageRoot, runtimeRelativePath(os, arch));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function hasInstalledRuntime(baseDir = path.join(__dirname, "..")) {
|
|
59
|
+
const packageRoot = installedPackageRoot(baseDir);
|
|
60
|
+
if (!packageRoot) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return fs.existsSync(installedRuntimePath(baseDir));
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
module.exports = {
|
|
45
67
|
binaryRelativePath,
|
|
68
|
+
runtimeRelativePath,
|
|
46
69
|
packageNameForPlatform,
|
|
47
70
|
installedPackageRoot,
|
|
48
71
|
installedBinaryPath,
|
|
49
72
|
hasInstalledBinary,
|
|
73
|
+
installedRuntimePath,
|
|
74
|
+
hasInstalledRuntime,
|
|
50
75
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaluarunsi/obi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18-alpha.3",
|
|
4
4
|
"description": "Terminal-first repo-aware coding operator",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"release-manifest.json"
|
|
16
16
|
],
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@kaluarunsi/obi-darwin-arm64": "0.2.
|
|
19
|
-
"@kaluarunsi/obi-linux-x64": "0.2.
|
|
20
|
-
"@kaluarunsi/obi-windows-x64": "0.2.
|
|
18
|
+
"@kaluarunsi/obi-darwin-arm64": "0.2.18-alpha.3",
|
|
19
|
+
"@kaluarunsi/obi-linux-x64": "0.2.18-alpha.3",
|
|
20
|
+
"@kaluarunsi/obi-windows-x64": "0.2.18-alpha.3"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "node --test"
|
package/release-manifest.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.18-alpha.3",
|
|
3
3
|
"assets": {
|
|
4
4
|
"darwin-arm64": {
|
|
5
5
|
"os": "darwin",
|
|
6
6
|
"arch": "arm64",
|
|
7
7
|
"archive": "obi-darwin-arm64.tar.gz",
|
|
8
|
-
"sha256": "
|
|
8
|
+
"sha256": "6a5ed53a30d6cf6201c9c9731c7ecb8ff470336fc84e4d72994b57aa8099d7d9",
|
|
9
9
|
"binary": "obi/obi"
|
|
10
10
|
},
|
|
11
11
|
"linux-x64": {
|
|
12
12
|
"os": "linux",
|
|
13
13
|
"arch": "x64",
|
|
14
14
|
"archive": "obi-linux-x64.tar.gz",
|
|
15
|
-
"sha256": "
|
|
15
|
+
"sha256": "41a14479eaec82fcd012363d30ef14fae1e71662101f67b65a57b5b7e19d7a0b",
|
|
16
16
|
"binary": "obi/obi"
|
|
17
17
|
},
|
|
18
18
|
"windows-x64": {
|
|
19
19
|
"os": "windows",
|
|
20
20
|
"arch": "x64",
|
|
21
21
|
"archive": "obi-windows-x64.zip",
|
|
22
|
-
"sha256": "
|
|
22
|
+
"sha256": "5fd0e8ea692a316aa961bc55b56e292329c2e8796b8a406d5ed864076db64907",
|
|
23
23
|
"binary": "obi/obi.exe"
|
|
24
24
|
}
|
|
25
25
|
}
|