# AshaCode Installer for Windows (PowerShell) # Usage: irm https://asha-ai.ir/ashacode/install.ps1 | iex param( [string]$Version = "", [string]$BinaryPath = "", [switch]$NoModifyPath ) $ErrorActionPreference = "Stop" $APP = "ashacode" $BaseURL = "https://asha-ai.ir" function Write-Info($msg) { Write-Host "-> $msg" -ForegroundColor Cyan } function Write-Ok($msg) { Write-Host "OK $msg" -ForegroundColor Green } function Write-Warn($msg) { Write-Host "! $msg" -ForegroundColor Yellow } $InstallDir = Join-Path $env:LOCALAPPDATA "AshaCode\bin" if (-not (Test-Path $InstallDir)) { New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null } $arch = if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x64" } if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { $arch = "arm64" } $target = "windows-$arch" $filename = "$APP-$target.zip" $requestedVersion = $Version if (-not $requestedVersion -and $env:VERSION) { $requestedVersion = $env:VERSION } if ([string]::IsNullOrWhiteSpace($requestedVersion)) { $requestedVersion = "1.18.25" } Write-Info "Installing $APP version: $requestedVersion ($target)" $primaryUrl = "https://asha-ai.ir/ashacode/download/$filename" $zipPath = Join-Path $env:TEMP "$filename" try { Write-Info "Downloading $primaryUrl"; Invoke-WebRequest -Uri $primaryUrl -OutFile $zipPath -Headers @{"User-Agent"="AshaCode-Installer"} } catch { Write-Host "Failed to download $APP from $primaryUrl" -ForegroundColor Red; Write-Host "Please contact support: https://asha-ai.ir/ashacode/support" -ForegroundColor Yellow; exit 1 } Write-Info "Extracting to $InstallDir" Expand-Archive -Path $zipPath -DestinationPath $InstallDir -Force Remove-Item $zipPath -Force -ErrorAction SilentlyContinue $binPath = Join-Path $InstallDir "$APP.exe" if (Test-Path $binPath) { Write-Ok "Installed to $binPath"; & $binPath --version } if (-not $NoModifyPath) { $userPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($userPath -notlike "*$InstallDir*") { [Environment]::SetEnvironmentVariable("Path", "$InstallDir;$userPath", "User") $env:Path = "$InstallDir;$env:Path" Write-Ok "Added $InstallDir to User PATH (restart terminal)" } } Write-Host "" Write-Host "AshaCode includes free models so you can start immediately." -ForegroundColor Green Write-Host "Run: ashacode --help" -ForegroundColor White Write-Host "Docs: https://asha-ai.ir/ashacode/docs" -ForegroundColor DarkGray function AshaCode-Install { param([string]$Version) & $MyInvocation.MyCommand.Path -Version $Version }