feat: initialize AI agent harness
This commit is contained in:
33
scripts/agent-harness.ps1
Normal file
33
scripts/agent-harness.ps1
Normal file
@@ -0,0 +1,33 @@
|
||||
[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
|
||||
Reference in New Issue
Block a user