# MeowByte Code installer for Windows. # # irm https://ai.meowbyte.net/install.ps1 | iex # # Downloads the standalone meowbyte.exe, checks it against the SHA-256 published in the release # manifest, installs it to %USERPROFILE%\.meowbyte\bin and adds that folder to your user PATH. # No admin rights, Node or package manager needed. $ErrorActionPreference = 'Stop' # Windows PowerShell 5.1's progress bar makes large downloads many times slower. $ProgressPreference = 'SilentlyContinue' $Api = if ($env:MEOWBYTE_API_URL) { $env:MEOWBYTE_API_URL } else { 'https://backend.meowbyte.net' } $Dir = if ($env:MEOWBYTE_INSTALL_DIR) { $env:MEOWBYTE_INSTALL_DIR } else { Join-Path $env:USERPROFILE '.meowbyte\bin' } if (-not [Environment]::Is64BitOperatingSystem) { throw 'MeowByte Code needs 64-bit Windows.' } # There's no Windows ARM build yet; Windows on ARM runs the x64 build under emulation. $Key = 'windows-x64' $Manifest = Invoke-RestMethod -Uri "$Api/cli/releases/latest.json" -UseBasicParsing $Entry = $Manifest.files.$Key if (-not $Entry) { throw "No build for $Key in the latest release." } Write-Host "Downloading MeowByte Code $($Manifest.version)..." $Tmp = Join-Path $env:TEMP ("meowbyte-" + [guid]::NewGuid().ToString() + '.exe') Invoke-WebRequest -Uri "$Api/cli/releases/$($Entry.path)" -OutFile $Tmp -UseBasicParsing $Actual = (Get-FileHash -Path $Tmp -Algorithm SHA256).Hash.ToLower() if ($Actual -ne $Entry.sha256) { Remove-Item $Tmp -Force throw "The download didn't match its published checksum - not installing it." } New-Item -ItemType Directory -Force -Path $Dir | Out-Null $Target = Join-Path $Dir 'meowbyte.exe' # A running meowbyte.exe can't be overwritten, but it can be moved aside. if (Test-Path "$Target.old") { Remove-Item "$Target.old" -Force -ErrorAction SilentlyContinue } if (Test-Path $Target) { Move-Item $Target "$Target.old" -Force } Move-Item $Tmp $Target -Force Write-Host "Installed $Target" $UserPath = [Environment]::GetEnvironmentVariable('Path', 'User') if (-not $UserPath) { $UserPath = '' } if (($UserPath -split ';') -notcontains $Dir) { [Environment]::SetEnvironmentVariable('Path', ($UserPath.TrimEnd(';') + ';' + $Dir).TrimStart(';'), 'User') $env:Path = "$env:Path;$Dir" Write-Host "Added $Dir to your PATH. New terminals will find meowbyte automatically." } Write-Host '' Write-Host 'Next: run "meowbyte login", then "meowbyte" inside a project.'