mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 13:04:11 +00:00
fix: fix bun install bug (#62)
* fix: fix bun install bug * refactor: consolidate executable check into assertExecutable helper - Add assertExecutable() to cli-shared that checks and attempts chmod - Simplify CLI and SDK spawn code to use the shared helper - Fix cli-shared package.json exports (.js not .mjs) - Add global install instructions to SDK error message * chore(release): update version to 0.1.6-rc.1 * fix: add cli-shared package to Dockerfiles * chore(release): update version to 0.1.6-rc.1 * fix: add cli-shared publishing to release workflow * chore(release): update version to 0.1.6-rc.1 * fix: handle already-exists error during crate publish * chore(release): update version to 0.1.6-rc.1
This commit is contained in:
parent
24de9e686c
commit
02bb992b11
30 changed files with 467 additions and 44 deletions
|
|
@ -1,7 +1,38 @@
|
|||
#!/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-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",
|
||||
|
|
@ -19,7 +50,14 @@ if (!pkg) {
|
|||
try {
|
||||
const pkgPath = require.resolve(`${pkg}/package.json`);
|
||||
const bin = process.platform === "win32" ? "sandbox-agent.exe" : "sandbox-agent";
|
||||
execFileSync(path.join(path.dirname(pkgPath), "bin", bin), process.argv.slice(2), { stdio: "inherit" });
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue