mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-18 20:03:40 +00:00
Compare commits
2 commits
main
...
v0.1.4-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93445b3d4f | ||
|
|
12b0975817 |
4 changed files with 25 additions and 1 deletions
|
|
@ -1,6 +1,21 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const { execFileSync } = require("child_process");
|
const { execFileSync } = require("child_process");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
// Handle --version / -V at the launcher level to report npm package version
|
||||||
|
// This ensures version matches what's installed via npm, not what's compiled into the binary
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-V")) {
|
||||||
|
const pkgJsonPath = path.join(__dirname, "..", "package.json");
|
||||||
|
try {
|
||||||
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
||||||
|
console.log(`sandbox-agent ${pkgJson.version}`);
|
||||||
|
process.exit(0);
|
||||||
|
} catch (e) {
|
||||||
|
// Fall through to binary if we can't read package.json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const PLATFORMS = {
|
const PLATFORMS = {
|
||||||
"darwin-arm64": "@sandbox-agent/cli-darwin-arm64",
|
"darwin-arm64": "@sandbox-agent/cli-darwin-arm64",
|
||||||
|
|
@ -19,7 +34,7 @@ if (!pkg) {
|
||||||
try {
|
try {
|
||||||
const pkgPath = require.resolve(`${pkg}/package.json`);
|
const pkgPath = require.resolve(`${pkg}/package.json`);
|
||||||
const bin = process.platform === "win32" ? "sandbox-agent.exe" : "sandbox-agent";
|
const bin = process.platform === "win32" ? "sandbox-agent.exe" : "sandbox-agent";
|
||||||
execFileSync(path.join(path.dirname(pkgPath), "bin", bin), process.argv.slice(2), { stdio: "inherit" });
|
execFileSync(path.join(path.dirname(pkgPath), "bin", bin), args, { stdio: "inherit" });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.status !== undefined) process.exit(e.status);
|
if (e.status !== undefined) process.exit(e.status);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "chmod +x bin/sandbox-agent || true"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"bin"
|
"bin"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "chmod +x bin/sandbox-agent || true"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"bin"
|
"bin"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "chmod +x bin/sandbox-agent || true"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"bin"
|
"bin"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue