<# .SYNOPSIS One-time developer setup: verifies prerequisites, restores dependencies and generates local secrets when missing. #> [CmdletBinding()] param() $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot Write-Host '── Checking prerequisites ──' $dotnet = Get-Command dotnet -ErrorAction SilentlyContinue if (-not $dotnet) { throw '.NET SDK 10.x is required (https://dotnet.microsoft.com).' } Write-Host "dotnet $(dotnet --version)" $node = Get-Command node -ErrorAction SilentlyContinue if (-not $node) { throw 'Node.js 22 or later is required (https://nodejs.org).' } # The NATS browser client (@nats-io/*) needs Node 22+; npm enforces it too (engines). $nodeMajor = [int]((node --version).TrimStart('v').Split('.')[0]) if ($nodeMajor -lt 22) { throw "Node.js 22 or later is required; found $(node --version)." } Write-Host "node $(node --version)" Write-Host '── Restoring .NET packages ──' dotnet restore (Join-Path $repoRoot 'ExecuteR.slnx') if ($LASTEXITCODE -ne 0) { throw "dotnet restore failed ($LASTEXITCODE)." } Write-Host '── Installing WebUI packages ──' Push-Location (Join-Path $repoRoot 'src/WebUI') try { npm ci if ($LASTEXITCODE -ne 0) { throw "npm ci failed ($LASTEXITCODE)." } } finally { Pop-Location } if (-not (Test-Path (Join-Path $repoRoot '.env'))) { Write-Host '── Generating local secrets ──' & (Join-Path $PSScriptRoot 'New-LocalSecrets.ps1') } Write-Host '' Write-Host 'Repository initialized. Next steps:' Write-Host ' docker compose up -d # NATS + backend + webui' Write-Host ' ./scripts/Build.ps1 # build everything' Write-Host ' ./scripts/Test.ps1 # run tests'