feat: gigacode (#92)

This commit is contained in:
Nathan Flurry 2026-02-06 02:55:57 -08:00 committed by GitHub
parent 0a73d1d8e8
commit a02393436c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 2736 additions and 1327 deletions

View file

@ -8,6 +8,7 @@ export type NonExecutableBinaryMessageOptions = {
trustPackages: string;
bunInstallBlocks: InstallCommandBlock[];
genericInstallCommands?: string[];
binaryName?: string;
};
export type FsSubset = {
@ -63,10 +64,16 @@ export function assertExecutable(binPath: string, fs: FsSubset): boolean {
export function formatNonExecutableBinaryMessage(
options: NonExecutableBinaryMessageOptions,
): string {
const { binPath, trustPackages, bunInstallBlocks, genericInstallCommands } =
options;
const {
binPath,
trustPackages,
bunInstallBlocks,
genericInstallCommands,
binaryName,
} = options;
const lines = [`sandbox-agent binary is not executable: ${binPath}`];
const label = binaryName ?? "sandbox-agent";
const lines = [`${label} binary is not executable: ${binPath}`];
if (isBunRuntime()) {
lines.push(

View file

@ -0,0 +1,66 @@
#!/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 =
"gigacode-linux-x64 gigacode-linux-arm64 gigacode-darwin-arm64 gigacode-darwin-x64 gigacode-win32-x64";
function formatHint(binPath) {
return formatNonExecutableBinaryMessage({
binPath,
binaryName: "gigacode",
trustPackages: TRUST_PACKAGES,
bunInstallBlocks: [
{
label: "Project install",
commands: [
`bun pm trust ${TRUST_PACKAGES}`,
"bun add gigacode",
],
},
{
label: "Global install",
commands: [
`bun pm -g trust ${TRUST_PACKAGES}`,
"bun add -g gigacode",
],
},
],
});
}
const PLATFORMS = {
"darwin-arm64": "gigacode-darwin-arm64",
"darwin-x64": "gigacode-darwin-x64",
"linux-x64": "gigacode-linux-x64",
"linux-arm64": "gigacode-linux-arm64",
"win32-x64": "gigacode-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" ? "gigacode.exe" : "gigacode";
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;
}

View file

@ -0,0 +1,32 @@
{
"name": "gigacode",
"version": "0.1.6",
"description": "Gigacode CLI (sandbox-agent with OpenCode attach by default)",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/rivet-dev/sandbox-agent"
},
"bin": {
"gigacode": "bin/gigacode"
},
"scripts": {
"test": "vitest run"
},
"dependencies": {
"@sandbox-agent/cli-shared": "workspace:*"
},
"devDependencies": {
"vitest": "^3.0.0"
},
"optionalDependencies": {
"gigacode-linux-x64": "workspace:*",
"gigacode-linux-arm64": "workspace:*",
"gigacode-darwin-arm64": "workspace:*",
"gigacode-darwin-x64": "workspace:*",
"gigacode-win32-x64": "workspace:*"
},
"files": [
"bin"
]
}

View file

@ -0,0 +1,22 @@
{
"name": "gigacode-darwin-arm64",
"version": "0.1.6",
"description": "gigacode CLI binary for macOS arm64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/rivet-dev/sandbox-agent"
},
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"scripts": {
"postinstall": "chmod +x bin/gigacode || true"
},
"files": [
"bin"
]
}

View file

@ -0,0 +1,22 @@
{
"name": "gigacode-darwin-x64",
"version": "0.1.6",
"description": "gigacode CLI binary for macOS x64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/rivet-dev/sandbox-agent"
},
"os": [
"darwin"
],
"cpu": [
"x64"
],
"scripts": {
"postinstall": "chmod +x bin/gigacode || true"
},
"files": [
"bin"
]
}

View file

@ -0,0 +1,22 @@
{
"name": "gigacode-linux-arm64",
"version": "0.1.6",
"description": "gigacode CLI binary for Linux arm64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/rivet-dev/sandbox-agent"
},
"os": [
"linux"
],
"cpu": [
"arm64"
],
"scripts": {
"postinstall": "chmod +x bin/gigacode || true"
},
"files": [
"bin"
]
}

View file

@ -0,0 +1,22 @@
{
"name": "gigacode-linux-x64",
"version": "0.1.6",
"description": "gigacode CLI binary for Linux x64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/rivet-dev/sandbox-agent"
},
"os": [
"linux"
],
"cpu": [
"x64"
],
"scripts": {
"postinstall": "chmod +x bin/gigacode || true"
},
"files": [
"bin"
]
}

View file

@ -0,0 +1,19 @@
{
"name": "gigacode-win32-x64",
"version": "0.1.6",
"description": "gigacode CLI binary for Windows x64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/rivet-dev/sandbox-agent"
},
"os": [
"win32"
],
"cpu": [
"x64"
],
"files": [
"bin"
]
}