From 320f54e2057da5ae92ee47d9d53d1c77a4badc19 Mon Sep 17 00:00:00 2001 From: Olcan Date: Fri, 25 Apr 2025 10:58:23 -0700 Subject: instant (dev) sandbox (#171) * instant (dev) sandbox * leave Dockerfile as is to pass deploy test * fix comma * fix prod build * do not use "images exists" which docker does not support * separate dev-mode flag * Merge remote-tracking branch 'origin/main' into instant_sandbox --- scripts/start_sandbox.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'scripts/start_sandbox.sh') diff --git a/scripts/start_sandbox.sh b/scripts/start_sandbox.sh index 1c3e2417..1661fa14 100755 --- a/scripts/start_sandbox.sh +++ b/scripts/start_sandbox.sh @@ -22,10 +22,23 @@ fi CMD=$(scripts/sandbox_command.sh) IMAGE=gemini-code-sandbox -WORKDIR=/sandbox/$(basename "$PWD") -CLI_PATH=/usr/local/share/npm-global/lib/node_modules/\@gemini-code/cli DEBUG_PORT=9229 +PROJECT=$(basename "$PWD") +WORKDIR=/sandbox/$PROJECT +CLI_PATH=/usr/local/share/npm-global/lib/node_modules/\@gemini-code/cli + +# if project is gemini-code, then run CLI from $WORKDIR/packages/cli +# note this means the global installation is not required in this case +if [[ "$PROJECT" == "gemini-code" ]]; then + CLI_PATH="$WORKDIR/packages/cli" +elif [ -n "${DEBUG:-}" ]; then + # refuse to debug using global installation + # (requires a separate attach config in launch.json, see comments there around remoteRoot) + echo "ERROR: debugging is sandbox is not supported when target/root is not gemini-code" + exit 1 +fi + # use interactive tty mode and auto-remove container on exit run_args=(-it --rm) -- cgit v1.2.3