# Bolta CLI Installer for Windows # Usage: irm https://cli.boltacorp.com/install.ps1 | iex $ErrorActionPreference = "Stop" $BaseUrl = "https://cli.boltacorp.com" $BinaryName = "bolta.exe" $InstallDir = "$env:LOCALAPPDATA\bolta" Write-Host "Bolta CLI Installer" -ForegroundColor Cyan # Detect architecture $Arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture switch ($Arch) { "X64" { $Target = "windows-x64" } "Arm64" { Write-Error "Windows ARM64는 아직 지원되지 않습니다. 'npm install -g @bolta-io/cli'를 사용하세요."; exit 1 } default { Write-Error "Unsupported architecture: $Arch. Use 'npm install -g @bolta-io/cli' instead."; exit 1 } } Write-Host "Detected platform: $Target" -ForegroundColor Cyan # Get latest version Write-Host "Fetching latest version..." -ForegroundColor Cyan $LatestUrl = "$BaseUrl/releases/latest.json" try { $Release = Invoke-RestMethod -Uri $LatestUrl $Version = "v$($Release.version)" } catch { Write-Error "Failed to fetch latest version. Check your internet connection." exit 1 } Write-Host "Installing bolta $Version..." -ForegroundColor Cyan # Download $DownloadUrl = "$BaseUrl/releases/$Version/bolta-$Target.zip" $TmpDir = New-TemporaryFile | ForEach-Object { Remove-Item $_; New-Item -ItemType Directory -Path $_ } try { $ZipPath = Join-Path $TmpDir "bolta.zip" Invoke-WebRequest -Uri $DownloadUrl -OutFile $ZipPath -UseBasicParsing # Extract Expand-Archive -Path $ZipPath -DestinationPath $TmpDir -Force # Install if (-not (Test-Path $InstallDir)) { New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null } $SourceExe = Get-ChildItem -Path $TmpDir -Filter "bolta-*.exe" | Select-Object -First 1 Copy-Item -Path $SourceExe.FullName -Destination (Join-Path $InstallDir $BinaryName) -Force # Add to PATH if not already there $UserPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($UserPath -notlike "*$InstallDir*") { [Environment]::SetEnvironmentVariable("Path", "$UserPath;$InstallDir", "User") $env:Path = "$env:Path;$InstallDir" Write-Host "Added $InstallDir to PATH" -ForegroundColor Yellow } # Verify $InstalledPath = Join-Path $InstallDir $BinaryName if (Test-Path $InstalledPath) { Write-Host "" -ForegroundColor Green Write-Host "bolta $Version installed successfully!" -ForegroundColor Green Write-Host "" Write-Host "Get started:" -ForegroundColor Cyan Write-Host " bolta --help" Write-Host " bolta config set api-key " Write-Host "" Write-Host "Note: Restart your terminal for PATH changes to take effect." -ForegroundColor Yellow } } finally { Remove-Item -Path $TmpDir -Recurse -Force -ErrorAction SilentlyContinue }