ability to (re-)build sandbox outside GC repo root, useful for dev iterations (#196)

This commit is contained in:
Olcan 2025-04-28 09:07:37 -07:00 committed by GitHub
parent 491a9da80b
commit 491f8b28b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 0 deletions

View File

@ -85,6 +85,25 @@ function start_sandbox(sandbox: string) {
}
}
// if BUILD_SANDBOX is set, then call scripts/build_sandbox.sh under gemini-code repo
// note this can only be done with binary linked from gemini-code repo
if (process.env.BUILD_SANDBOX) {
if (!gcPath.includes('gemini-code/packages/')) {
console.error(
'ERROR: cannot BUILD_SANDBOX using installed gemini-code binary; ' +
'run `npm link ./packages/cli` under gemini-code repo to switch to linked binary.',
);
process.exit(1);
} else {
console.log('building sandbox ...');
const gcRoot = gcPath.split('/packages/')[0];
spawnSync(`cd ${gcRoot} && scripts/build_sandbox.sh`, {
stdio: 'inherit',
shell: true,
});
}
}
// stop if image is missing
if (!execSync(`${sandbox} images -q ${image}`).toString().trim()) {
const remedy = gcPath.includes('gemini-code/packages/')