mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 22:03:48 +00:00
docker on osx runs as linux-arm64 and there's no build for that. TBH, this is completely vibe coded but I did manually but I did look through this and seems right to me.
65 lines
1.8 KiB
JavaScript
Executable file
65 lines
1.8 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
const { execFileSync } = require("child_process");
|
|
const {
|
|
assertExecutable,
|
|
formatNonExecutableBinaryMessage,
|
|
} = require("@sandbox-agent/cli-shared");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const TRUST_PACKAGES =
|
|
"@sandbox-agent/cli-linux-x64 @sandbox-agent/cli-linux-arm64 @sandbox-agent/cli-darwin-arm64 @sandbox-agent/cli-darwin-x64 @sandbox-agent/cli-win32-x64";
|
|
|
|
function formatHint(binPath) {
|
|
return formatNonExecutableBinaryMessage({
|
|
binPath,
|
|
trustPackages: TRUST_PACKAGES,
|
|
bunInstallBlocks: [
|
|
{
|
|
label: "Project install",
|
|
commands: [
|
|
`bun pm trust ${TRUST_PACKAGES}`,
|
|
"bun add @sandbox-agent/cli",
|
|
],
|
|
},
|
|
{
|
|
label: "Global install",
|
|
commands: [
|
|
`bun pm -g trust ${TRUST_PACKAGES}`,
|
|
"bun add -g @sandbox-agent/cli",
|
|
],
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
const PLATFORMS = {
|
|
"darwin-arm64": "@sandbox-agent/cli-darwin-arm64",
|
|
"darwin-x64": "@sandbox-agent/cli-darwin-x64",
|
|
"linux-x64": "@sandbox-agent/cli-linux-x64",
|
|
"linux-arm64": "@sandbox-agent/cli-linux-arm64",
|
|
"win32-x64": "@sandbox-agent/cli-win32-x64",
|
|
};
|
|
|
|
const key = `${process.platform}-${process.arch}`;
|
|
const pkg = PLATFORMS[key];
|
|
if (!pkg) {
|
|
console.error(`Unsupported platform: ${key}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
try {
|
|
const pkgPath = require.resolve(`${pkg}/package.json`);
|
|
const bin = process.platform === "win32" ? "sandbox-agent.exe" : "sandbox-agent";
|
|
const binPath = path.join(path.dirname(pkgPath), "bin", bin);
|
|
|
|
if (!assertExecutable(binPath, fs)) {
|
|
console.error(formatHint(binPath));
|
|
process.exit(1);
|
|
}
|
|
|
|
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
} catch (e) {
|
|
if (e.status !== undefined) process.exit(e.status);
|
|
throw e;
|
|
}
|