# Truto CLI installer for Windows (PowerShell) # Usage: irm https://cli.truto.one/install.ps1 | iex # # Environment variables: # $env:TRUTO_VERSION - install a specific version (e.g. "0.26.2") # $env:TRUTO_INSTALL_DIR - install location (default: %USERPROFILE%\.truto\bin) $ErrorActionPreference = 'Stop' $BaseUrl = 'https://cli.truto.one' $InstallDir = if ($env:TRUTO_INSTALL_DIR) { $env:TRUTO_INSTALL_DIR } else { Join-Path $env:USERPROFILE '.truto\bin' } # Bun does not ship a native windows-arm64 target yet; Windows-on-ARM # users get the x64 binary, which runs transparently under the OS's # x64 emulation layer. $Arch = switch ($env:PROCESSOR_ARCHITECTURE) { 'AMD64' { 'x64' } 'ARM64' { 'x64' } default { Write-Error "Unsupported architecture: $env:PROCESSOR_ARCHITECTURE. Truto CLI supports x64 (and ARM64 via emulation)." exit 1 } } $Binary = "truto-windows-$Arch.exe" if ($env:TRUTO_VERSION) { $Url = "$BaseUrl/releases/$($env:TRUTO_VERSION)/$Binary" } else { $Url = "$BaseUrl/latest/$Binary" } Write-Host "> Downloading Truto CLI (windows/$Arch)" -ForegroundColor Cyan New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null $Target = Join-Path $InstallDir 'truto.exe' # Download via Invoke-WebRequest. Force TLS 1.2+ in case the host # defaults to TLS 1.0 (older Windows Server SKUs). UseBasicParsing # keeps this script working on Server Core / Nano without IE engine. [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 Invoke-WebRequest -Uri $Url -OutFile $Target -UseBasicParsing # Unblock the binary so SmartScreen / Mark-of-the-Web does not nag the # user on first launch. Best-effort: -ErrorAction SilentlyContinue # keeps things quiet if the file system does not support ADS (FAT32, # network share, etc.). Unblock-File -Path $Target -ErrorAction SilentlyContinue # Add to the user's PATH if missing. We intentionally edit the User # scope (not Machine) so the installer does not require admin. $UserPath = [Environment]::GetEnvironmentVariable('Path', 'User') if (-not $UserPath) { $UserPath = '' } $pathSegments = $UserPath.Split(';') | Where-Object { $_ -ne '' } if ($pathSegments -notcontains $InstallDir) { $newPath = if ($UserPath) { "$UserPath;$InstallDir" } else { $InstallDir } [Environment]::SetEnvironmentVariable('Path', $newPath, 'User') # Update the live session too, so a follow-up `truto --help` works # without restarting the shell. $env:Path = "$env:Path;$InstallDir" Write-Host " Added $InstallDir to your user PATH." -ForegroundColor DarkGray } Write-Host "" Write-Host "[OK] Truto CLI installed to $Target" -ForegroundColor Green Write-Host " Run 'truto --help' to get started" Write-Host " Run 'truto login' to authenticate" Write-Host " Optional (for AI-powered 'truto integrations build'): set ANTHROPIC_API_KEY or run 'truto profiles set-key anthropic'" if (-not (Get-Command truto -ErrorAction SilentlyContinue)) { Write-Host "" Write-Host " Open a new terminal window to pick up the updated PATH." -ForegroundColor Yellow }