From 28ff62e7b1b2191c5f5193314523f848a0f3dea5 Mon Sep 17 00:00:00 2001 From: Bryan Morgan Date: Sat, 7 Jun 2025 15:06:18 -0400 Subject: Added /mcp command support and cleaned up broken tests (#817) --- scripts/sandbox_command.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'scripts/sandbox_command.sh') diff --git a/scripts/sandbox_command.sh b/scripts/sandbox_command.sh index 325722f5..468a4834 100755 --- a/scripts/sandbox_command.sh +++ b/scripts/sandbox_command.sh @@ -35,8 +35,16 @@ shift $((OPTIND - 1)) # note it can be string or boolean, and if missing `npx json` will return empty string USER_SETTINGS_FILE="$HOME/.gemini/settings.json" if [ -z "${GEMINI_SANDBOX:-}" ] && [ -f "$USER_SETTINGS_FILE" ]; then - USER_SANDBOX_SETTING=$(sed -e 's/\/\/.*//' -e 's/\/\*.*\*\///g' -e '/^[[:space:]]*\/\//d' "$USER_SETTINGS_FILE" | npx json 'sandbox') - if [ -n "$USER_SANDBOX_SETTING" ]; then + # Check if jq is available (more reliable than npx json) + if command -v jq &>/dev/null; then + USER_SANDBOX_SETTING=$(jq -r '.sandbox // empty' "$USER_SETTINGS_FILE" 2>/dev/null || echo "") + else + # Fallback to npx json with error handling + USER_SANDBOX_SETTING=$(sed -e 's/\/\/.*//' -e 's/\/\*.*\*\///g' -e '/^[[:space:]]*\/\//d' "$USER_SETTINGS_FILE" | npx json 'sandbox' 2>/dev/null || echo "") + fi + + # Avoid setting GEMINI_SANDBOX to complex objects + if [ -n "$USER_SANDBOX_SETTING" ] && [[ ! "$USER_SANDBOX_SETTING" =~ ^\{.*\}$ ]]; then GEMINI_SANDBOX=$USER_SANDBOX_SETTING fi fi -- cgit v1.2.3