$ErrorActionPreference = 'Stop' function Invoke-Step { param( [Parameter(Mandatory = $true)][string]$Name, [Parameter(Mandatory = $true)][string]$Command, [Parameter(Mandatory = $true)][string[]]$Arguments ) Write-Host "" Write-Host "==> $Name" & $Command @Arguments if ($LASTEXITCODE -ne 0) { throw "$Name failed with exit code $LASTEXITCODE" } } Invoke-Step 'Typecheck' 'npm.cmd' @('run', 'typecheck') Invoke-Step 'Tests' 'npm.cmd' @('run', 'test:run') Invoke-Step 'Lint' 'npm.cmd' @('run', 'lint') Invoke-Step 'Build' 'npm.cmd' @('run', 'build') Write-Host "" Write-Host "==> Audit summary" & npm.cmd audit --audit-level=moderate if ($LASTEXITCODE -ne 0) { Write-Warning 'npm audit reported vulnerabilities. See the output above; verification gates still passed.' } Write-Host "" Write-Host "Verification complete."