Files
ai-agent-harness/scripts/agent-harness.ps1

34 lines
909 B
PowerShell

[CmdletBinding()]
param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]] $HarnessArguments
)
$ErrorActionPreference = 'Stop'
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$harnessRoot = Split-Path -Parent $scriptRoot
$entryPoint = Join-Path $harnessRoot 'dist\cli.cjs'
if (-not (Test-Path -LiteralPath $entryPoint -PathType Leaf)) {
throw "Harness entry point not found: $entryPoint"
}
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
if ($null -eq $nodeCommand) {
throw 'Node.js 20 or newer is required.'
}
$nodeVersionText = (& $nodeCommand.Source --version).TrimStart('v')
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$nodeVersion = [Version] $nodeVersionText
if ($nodeVersion.Major -lt 20) {
throw "Node.js 20 or newer is required. Found: $nodeVersionText"
}
& $nodeCommand.Source $entryPoint @HarnessArguments
exit $LASTEXITCODE