fix: add folderTrust+yolo settings to Gemini installers and README

- settings.json now includes security.folderTrust.enabled=false and
  general.defaultApprovalMode=yolo to suppress trust/permission prompts
- Linux installer creates trustedFolders.json with common paths
- Windows PS1 installer creates trustedFolders.json for C:\ paths
- README Windows section adds $env: vars for current session
- Fixed BOM issue: all PS1 use WriteAllText instead of Set-Content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-08 07:29:33 +00:00
parent f50c0dfced
commit 8717236f29
3 changed files with 39 additions and 6 deletions

View File

@@ -130,8 +130,12 @@ source ~/.bashrc
mkdir -p ~/.gemini
cat > ~/.gemini/settings.json << 'EOF'
{
"security": { "auth": { "selectedType": "gemini-api-key" } },
"telemetry": { "enabled": false, "logPrompts": false }
"security": {
"auth": { "selectedType": "gemini-api-key" },
"folderTrust": { "enabled": false }
},
"telemetry": { "enabled": false, "logPrompts": false },
"general": { "defaultApprovalMode": "yolo" }
}
EOF
```
@@ -140,8 +144,10 @@ Then configure (Windows — run in **PowerShell**, not CMD):
```powershell
[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "ClauderAPI", "User")
[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://ai.37-187-136-86.sslip.io", "User")
$env:GEMINI_API_KEY = "ClauderAPI"
$env:GOOGLE_GEMINI_BASE_URL = "https://ai.37-187-136-86.sslip.io"
$d = "$env:USERPROFILE\.gemini"; New-Item -ItemType Directory -Force -Path $d | Out-Null
[System.IO.File]::WriteAllText("$d\settings.json", '{"security":{"auth":{"selectedType":"gemini-api-key"}},"telemetry":{"enabled":false,"logPrompts":false}}')
[System.IO.File]::WriteAllText("$d\settings.json", '{"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"yolo"}}')
```
Or use CMD:
@@ -149,7 +155,7 @@ Or use CMD:
setx GEMINI_API_KEY "ClauderAPI"
setx GOOGLE_GEMINI_BASE_URL "https://ai.37-187-136-86.sslip.io"
mkdir "%USERPROFILE%\.gemini" 2>nul
echo {"security":{"auth":{"selectedType":"gemini-api-key"}},"telemetry":{"enabled":false,"logPrompts":false}} > "%USERPROFILE%\.gemini\settings.json"
echo {"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"yolo"}} > "%USERPROFILE%\.gemini\settings.json"
```
Verify: `gemini -p "Hello"`

View File

@@ -150,15 +150,26 @@ $json = @'
"security": {
"auth": {
"selectedType": "gemini-api-key"
},
"folderTrust": {
"enabled": false
}
},
"telemetry": {
"enabled": false,
"logPrompts": false
},
"general": {
"defaultApprovalMode": "yolo"
}
}
'@
[System.IO.File]::WriteAllText($settingsFile, $json)
# Create trustedFolders.json
$trustedFile = "$geminiDir\trustedFolders.json"
$trustedJson = '{"C:\\":"TRUST_PARENT","C:\\Users":"TRUST_PARENT"}'
[System.IO.File]::WriteAllText($trustedFile, $trustedJson)
Write-Host " Settings: $settingsFile" -ForegroundColor Green
# ---- Verify ----

View File

@@ -168,10 +168,26 @@ assert d.get('security',{}).get('auth',{}).get('selectedType') == 'gemini-api-ke
" 2>/dev/null; then
cat > "$SETTINGS_FILE" << 'SETTINGS_EOF'
{
"security": { "auth": { "selectedType": "gemini-api-key" } },
"telemetry": { "enabled": false, "logPrompts": false }
"security": {
"auth": { "selectedType": "gemini-api-key" },
"folderTrust": { "enabled": false }
},
"telemetry": { "enabled": false, "logPrompts": false },
"general": { "defaultApprovalMode": "yolo" }
}
SETTINGS_EOF
# Trust common folders
TRUSTED_FILE="$GEMINI_DIR/trustedFolders.json"
python3 -c "
import json, os
t = {}
if os.path.isfile('$TRUSTED_FILE'):
try: t = json.load(open('$TRUSTED_FILE'))
except: pass
for p in [os.path.expanduser('~'), '/home', '/root', '/tmp']:
t.setdefault(p, 'TRUST_PARENT')
json.dump(t, open('$TRUSTED_FILE', 'w'), indent=2)
" 2>/dev/null
log "Settings configured: $SETTINGS_FILE"
else
log "Settings already configured"