<# .SYNOPSIS Vangu - Claude Code CLI Otomatik Kurulum ve Yapılandırma Scripti (Windows PowerShell) .DESCRIPTION Claude Code CLI aracını kurar ve Vangu Anthropic-uyumlu API uç noktasını Windows ortam değişkenlerine kalıcı olarak işler. .EXAMPLE irm https://vangu.dev/scripts/install-claude-code.ps1 | iex veya: .\install-claude-code.ps1 -ApiKey "vgu_live_your_key" #> [CmdletBinding()] param ( [Parameter(Mandatory = $false)] [string]$ApiKey = $env:VANGU_API_KEY, [Parameter(Mandatory = $false)] [string]$Model = "gpt-5.6-sol" ) $ErrorActionPreference = "Stop" $VanguBaseUrl = "https://api.vangu.dev/anthropic" Write-Host "========================================================" -ForegroundColor Cyan Write-Host " Vangu - Claude Code CLI Windows Kurulum ve Yapilandirici" -ForegroundColor Cyan Write-Host "========================================================" -ForegroundColor Cyan # 1. Node.js ve npm Kontrolü $nodeCmd = Get-Command node -ErrorAction SilentlyContinue $npmCmd = Get-Command npm -ErrorAction SilentlyContinue if (-not $nodeCmd) { Write-Host "[!] Hata: Node.js sisteminizde kurulu degil." -ForegroundColor Red Write-Host " Lutfen Node.js (v18+) yukleyin: https://nodejs.org/" -ForegroundColor Yellow exit 1 } $nodeVer = (& node -v) Write-Host "[*] Node.js ($nodeVer) algilandi." -ForegroundColor Green if (-not $npmCmd) { Write-Host "[!] Hata: npm komutu bulunamadi." -ForegroundColor Red exit 1 } # 2. Claude Code CLI Kurulumu Write-Host "[*] @anthropic-ai/claude-code paketi global olarak kuruluyor..." -ForegroundColor Yellow try { npm install -g @anthropic-ai/claude-code Write-Host "[+] Claude Code CLI basariyla kuruldu." -ForegroundColor Green } catch { Write-Host "[!] Kurulum sirasinda bir uyari olustu, devam ediliyor..." -ForegroundColor Yellow } # 3. API Anahtarı Alma if ([string]::IsNullOrWhiteSpace($ApiKey)) { Write-Host "" Write-Host "--------------------------------------------------------" Write-Host "Vangu API Anahtarinizi girin (vgu_live_...):" -ForegroundColor Cyan $secureInput = Read-Host -Prompt "API Key" -AsSecureString $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureInput) $ApiKey = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) Write-Host "--------------------------------------------------------" } if ([string]::IsNullOrWhiteSpace($ApiKey)) { Write-Host "[!] API Anahtari bos birakildi. Ortam degiskenleri atanamadi." -ForegroundColor Red Write-Host " Manuel atamak icin:" -ForegroundColor Yellow Write-Host " setx ANTHROPIC_BASE_URL `"$VanguBaseUrl`"" Write-Host " setx ANTHROPIC_API_KEY `"vgu_live_...`"" exit 0 } # 4. Windows Kullanıcı Ortam Değişkenlerine Kalıcı Olarak Yazma Write-Host "[*] Ortam degiskenleri Windows Kullanici Duzeyinde tanimlaniyor..." -ForegroundColor Yellow [System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", $VanguBaseUrl, [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", $ApiKey, [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", $Model, [System.EnvironmentVariableTarget]::User) # Aktif PowerShell oturumuna da ekle $env:ANTHROPIC_BASE_URL = $VanguBaseUrl $env:ANTHROPIC_API_KEY = $ApiKey $env:ANTHROPIC_MODEL = $Model # 5. PowerShell Profiline (varsa) destek ekle if (Test-Path $PROFILE) { $profileContent = Get-Content $PROFILE -Raw -ErrorAction SilentlyContinue if ($profileContent -notmatch "Vangu Anthropic") { $profileAppend = @" # --- Vangu Anthropic & Claude Code --- `$env:ANTHROPIC_BASE_URL = "$VanguBaseUrl" `$env:ANTHROPIC_API_KEY = "$ApiKey" `$env:ANTHROPIC_MODEL = "$Model" # -------------------------------------- "@ Add-Content -Path $PROFILE -Value $profileAppend Write-Host "[+] PowerShell profili guncellendi: $PROFILE" -ForegroundColor Green } } Write-Host "" Write-Host "========================================================" -ForegroundColor Cyan Write-Host " [OK] Kurulum ve Yapilandirma Basariyla Tamamlandi!" -ForegroundColor Green Write-Host "========================================================" -ForegroundColor Cyan Write-Host " Endpoint : $VanguBaseUrl" Write-Host " Model : $Model" Write-Host "" Write-Host "Hemen baslamak icin terminalde su komutu calistirin:" -ForegroundColor White Write-Host " claude" -ForegroundColor Yellow Write-Host "========================================================" -ForegroundColor Cyan