# Installs ToolUniverse for this Windows account, so `tu` works in every terminal. # # powershell -ExecutionPolicy ByPass -c "irm https://connect.aiscientist.tools/install.ps1 | iex" # # Python does not need to be installed first: uv (https://docs.astral.sh/uv) fetches its own # Python 3.12, and everything lives in uv's tool folder. Running it again updates in place. # The versions below are kept identical to frontend/lib/tuplatform-connect.ts by # frontend/tests/install-script.test.mts. # Native programs report failure through $LASTEXITCODE, which is checked after each one. 'Stop' # would also turn any line uv prints on stderr into an error in Windows PowerShell 5.1. $ErrorActionPreference = 'Continue' $ToolUniverseRequirement = 'tooluniverse==1.5.7' $TuplatformConnectRequirement = 'tuplatform-connect @ https://connect.aiscientist.tools/downloads/tuplatform_connect-0.4.2-py3-none-any.whl#sha256=e4e09af02093da3e739c9234e1f8182f8a9c311cd9fc0145a1dc119a296ef8ba' $PythonVersion = '3.12' function Test-UsableUv([string]$Path) { if (-not $Path -or -not (Test-Path $Path)) { return $false } return [bool]((& $Path tool install --help 2>$null) -match '--with-executables-from') } $uv = (Get-Command uv -ErrorAction SilentlyContinue).Source if (-not (Test-UsableUv $uv)) { $uv = Join-Path $HOME '.local\bin\uv.exe' if (-not (Test-UsableUv $uv)) { $uv = Join-Path $HOME '.local/bin/uv' } if (-not (Test-UsableUv $uv)) { Write-Host 'Getting uv, the small program that installs Python and ToolUniverse for you...' $env:UV_NO_MODIFY_PATH = '1' Invoke-RestMethod https://astral.sh/uv/install.ps1 -ErrorAction Stop | Invoke-Expression | Out-Null $uv = Join-Path $HOME '.local\bin\uv.exe' if (-not (Test-UsableUv $uv)) { $uv = Join-Path $HOME '.local/bin/uv' } if (-not (Test-UsableUv $uv)) { throw 'uv was downloaded but does not run on this computer.' } } } Write-Host 'Installing ToolUniverse (about a minute the first time)...' & $uv tool install --quiet --force --python $PythonVersion ` --with-executables-from $TuplatformConnectRequirement $ToolUniverseRequirement if ($LASTEXITCODE -ne 0) { throw 'The install did not finish. The messages above say why.' } $bin = "$(& $uv tool dir --bin)".Trim() $tu = @('tu.exe', 'tu') | ForEach-Object { Join-Path $bin $_ } | Where-Object { Test-Path $_ } | Select-Object -First 1 if (-not $tu) { throw 'tu was not installed.' } & $tu --help | Out-Null if ($LASTEXITCODE -ne 0) { throw 'tu was installed but does not start.' } & $uv tool update-shell 2>&1 | Out-Null Write-Host '' Write-Host 'ToolUniverse is installed.' Write-Host 'Open a new terminal window, then run the next step there.'