feat: 增强三个 CLI 工具配置脚本
- Gemini CLI: 添加 GEMINI_MODEL 环境变量、settings.json 输出及备份逻辑 - Codex: 修复模型名称一致性 (gpt-5-codex)、添加 auth.json 备份逻辑 - Claude Code: 添加 VSCode 插件 config.json 配置支持 - CLAUDE.md: 重构文档,添加三个工具配置差异表 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,13 @@ function Backup-Settings {
|
||||
Copy-Item -Path $GeminiEnvFile -Destination $backupFile
|
||||
Write-Info "Backed up existing settings to: $backupFile"
|
||||
}
|
||||
$settingsJsonPath = "$GeminiConfigDir\settings.json"
|
||||
if (Test-Path $settingsJsonPath) {
|
||||
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
||||
$backupFile = "$settingsJsonPath.backup.$timestamp"
|
||||
Copy-Item -Path $settingsJsonPath -Destination $backupFile
|
||||
Write-Info "Backed up existing settings to: $backupFile"
|
||||
}
|
||||
}
|
||||
|
||||
# Function to create settings directory
|
||||
@@ -165,11 +172,27 @@ function New-Settings {
|
||||
$envContent = @"
|
||||
GOOGLE_GEMINI_BASE_URL="$BaseUrl"
|
||||
GEMINI_API_KEY="$ApiKey"
|
||||
GEMINI_MODEL="gemini-3-pro-preview"
|
||||
"@
|
||||
|
||||
|
||||
$settingsJson = @{
|
||||
general = @{
|
||||
previewFeatures = $true
|
||||
}
|
||||
security = @{
|
||||
auth = @{
|
||||
selectedType = "gemini-api-key"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Set-Content -Path $GeminiEnvFile -Value $envContent -Encoding UTF8
|
||||
Write-Success "Gemini CLI settings written to: $GeminiEnvFile"
|
||||
|
||||
$settingsJsonPath = "$GeminiConfigDir\settings.json"
|
||||
$settingsJson | ConvertTo-Json -Depth 10 | Set-Content -Path $settingsJsonPath -Encoding UTF8
|
||||
Write-Success "Gemini CLI settings written to: $settingsJsonPath"
|
||||
return $true
|
||||
}
|
||||
catch {
|
||||
|
||||
@@ -42,6 +42,12 @@ backup_settings() {
|
||||
cp "$GEMINI_ENV_FILE" "$backup_file"
|
||||
print_info "Backed up existing settings to: $backup_file"
|
||||
fi
|
||||
local settings_json_path="$GEMINI_CONFIG_DIR/settings.json"
|
||||
if [ -f "$settings_json_path" ]; then
|
||||
local backup_file="${settings_json_path}.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
cp "$settings_json_path" "$backup_file"
|
||||
print_info "Backed up existing settings to: $backup_file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to create settings directory
|
||||
@@ -122,8 +128,25 @@ create_settings_file() {
|
||||
cat <<EOF > "$GEMINI_ENV_FILE"
|
||||
GOOGLE_GEMINI_BASE_URL="$base_url"
|
||||
GEMINI_API_KEY="$api_key"
|
||||
GEMINI_MODEL="gemini-3-pro-preview"
|
||||
EOF
|
||||
print_success "Gemini CLI settings written to: $GEMINI_ENV_FILE"
|
||||
|
||||
# Write to settings.json
|
||||
local settings_json_path="$GEMINI_CONFIG_DIR/settings.json"
|
||||
cat <<EOF > "$settings_json_path"
|
||||
{
|
||||
"general": {
|
||||
"previewFeatures": true
|
||||
},
|
||||
"security": {
|
||||
"auth": {
|
||||
"selectedType": "gemini-api-key"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
print_success "Gemini CLI settings written to: $settings_json_path"
|
||||
}
|
||||
|
||||
# Function to display current settings
|
||||
|
||||
Reference in New Issue
Block a user