Payload/scripts/harness/harness-sandbox-readiness.ps1

#Requires -Version 5.1
<#
.SYNOPSIS
    Named sandbox capability probe for the current environment.

.DESCRIPTION
    Reports PASS / FAIL / NOT_APPLICABLE for named tool ids, including version when known.
    Exit code is 1 when any required capability is FAIL. Invoke through the public entry:
    pwsh -File scripts/harness-invoke.ps1 harness-sandbox-readiness.ps1

.EXAMPLE
    pwsh -File scripts/harness-invoke.ps1 harness-sandbox-readiness.ps1
#>

[CmdletBinding()]
param(
    [string]$RepoRoot = ''
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

Import-Module (Join-Path $PSScriptRoot 'lib\HarnessContract.psm1') -Force
Test-HarnessContractModuleReady

if ([string]::IsNullOrWhiteSpace($RepoRoot)) {
    $RepoRoot = Get-HarnessRepoRoot -StartPath $PSScriptRoot
}

$report = Invoke-HarnessSandboxReadiness -RepoRoot $RepoRoot
foreach ($check in @($report.Checks)) {
    Write-Output ("{0}`t{1}`t{2}`t{3}" -f $check.Id, $check.Status, $check.Version, $check.Detail)
}
if ($report.ExitCode -ne 0) {
    Write-Output $report.Summary
}
exit $report.ExitCode