67 lines
2.0 KiB
PowerShell
67 lines
2.0 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[string] $WorkspaceRoot
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$harnessRoot = Split-Path -Parent $scriptRoot
|
|
|
|
if ([string]::IsNullOrWhiteSpace($WorkspaceRoot)) {
|
|
$WorkspaceRoot = Split-Path -Parent $harnessRoot
|
|
}
|
|
|
|
$resolvedWorkspaceRoot = [System.IO.Path]::GetFullPath($WorkspaceRoot)
|
|
$resolvedHarnessRoot = [System.IO.Path]::GetFullPath($harnessRoot)
|
|
$expectedHarnessRoot = [System.IO.Path]::GetFullPath(
|
|
(Join-Path $resolvedWorkspaceRoot '_________AgentHarnessBase')
|
|
)
|
|
|
|
if (-not $resolvedHarnessRoot.Equals(
|
|
$expectedHarnessRoot,
|
|
[System.StringComparison]::OrdinalIgnoreCase
|
|
)) {
|
|
throw "Harness repository must be a direct child of the configured workspace root. Expected: $expectedHarnessRoot"
|
|
}
|
|
|
|
$workspaceFile = Join-Path $resolvedHarnessRoot 'workspace.yml'
|
|
$entryPoint = Join-Path $resolvedHarnessRoot 'dist\cli.cjs'
|
|
|
|
if (-not (Test-Path -LiteralPath $workspaceFile -PathType Leaf)) {
|
|
throw "Shared workspace registry not found: $workspaceFile"
|
|
}
|
|
|
|
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"
|
|
}
|
|
|
|
Write-Host "[Agent Harness] workspace=$resolvedWorkspaceRoot"
|
|
Write-Host "[Agent Harness] node=$nodeVersionText"
|
|
Write-Host '[Agent Harness] running read-only verify --all'
|
|
|
|
& $nodeCommand.Source $entryPoint verify --all
|
|
$verifyExitCode = $LASTEXITCODE
|
|
|
|
if ($verifyExitCode -ne 0) {
|
|
Write-Error "Agent Harness workspace verification failed with exit code $verifyExitCode."
|
|
exit $verifyExitCode
|
|
}
|
|
|
|
Write-Host '[Agent Harness] all registered projects are current.'
|