LAUNCHER.ps1 (1207B)
1 $ErrorActionPreference = "Stop" 2 Set-Location $PSScriptRoot 3 4 Write-Host "[Bzl] Launcher UI (dev)" -ForegroundColor Cyan 5 if (-not (Get-Command node -ErrorAction SilentlyContinue)) { throw "Missing node. Node.js 18+ required." } 6 7 $nodeMajor = [int]((node -p "process.versions.node.split('.')[0]" 2>$null) -join "") 8 if ($nodeMajor -lt 18) { throw "Node.js 18+ required. Found Node major: $nodeMajor" } 9 10 $uiPort = $env:BZL_LAUNCHER_PORT 11 if (-not $uiPort) { $uiPort = 8787 } 12 $url = "http://127.0.0.1:$uiPort/" 13 14 Write-Host "[Bzl] Starting local UI..." -ForegroundColor Yellow 15 Write-Host "[Bzl] UI URL: $url" -ForegroundColor DarkGray 16 17 # Open in the background (node keeps this console busy). 18 $urlEsc = $url.Replace("'", "''") 19 Start-Process -WindowStyle Hidden -FilePath "powershell.exe" -ArgumentList @( 20 "-NoProfile", 21 "-Command", 22 "Start-Sleep -Seconds 2; Start-Process '$urlEsc'" 23 ) | Out-Null 24 25 node .\\scripts\\launcher-ui.js 26 27 if ($LASTEXITCODE -ne 0) { 28 Write-Host "" 29 Write-Host "[Bzl] Launcher UI exited (code $LASTEXITCODE)." -ForegroundColor Red 30 Write-Host "[Bzl] If it closed immediately, check: $PSScriptRoot\\launcher-ui.crash.log" -ForegroundColor DarkGray 31 Read-Host "Press Enter to close" 32 } 33