# --- Ever Brain One-Click Installer for Windows --- # This script packages the CLI and installs it globally for the current user. $ErrorActionPreference = "Stop" Write-Host "--- Ever Brain Installation Started ---" -ForegroundColor Cyan # 1. Resolve Paths $RepoRoot = Get-Item $PSScriptRoot\.. $InstallDir = Join-Path $env:LOCALAPPDATA "EverBrain" $BinDir = Join-Path $InstallDir "bin" $ExeName = "ever-brain.exe" $DistExe = Join-Path $RepoRoot "dist\$ExeName" # 2. Package the CLI Write-Host "> Packaging CLI (this may take a minute)..." -ForegroundColor Gray Set-Location $RepoRoot python scripts/package_cli.py if (-not (Test-Path $DistExe)) { Write-Error "Packaging failed: $DistExe not found." } # 3. Create Install Directory Write-Host "> Creating installation directory at $BinDir..." -ForegroundColor Gray if (-not (Test-Path $BinDir)) { New-Item -ItemType Directory -Path $BinDir -Force | Out-Null } # 4. Copy Executable Write-Host "> Installing $ExeName..." -ForegroundColor Gray Copy-Item $DistExe $BinDir -Force # 5. Add to PATH Write-Host "> Updating PATH environment variable..." -ForegroundColor Gray $UserPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($UserPath -notlike "*$BinDir*") { $NewPath = "$UserPath;$BinDir" [Environment]::SetEnvironmentVariable("Path", $NewPath, "User") $env:Path = "$env:Path;$BinDir" Write-Host "++ Added $BinDir to User PATH." -ForegroundColor Green } else { Write-Host ">> $BinDir is already in PATH." -ForegroundColor DarkGray } Write-Host "`nSUCCESS! Ever Brain is now installed." -ForegroundColor Green Write-Host "Please restart your terminal and run: ever-brain status" -ForegroundColor White Write-Host "----------------------------------------" -ForegroundColor Cyan