param( [ValidateSet('preflight','weights','generate','analyze','sheets','report','verify','all')][string]$Stage='all', [string]$Config="$PSScriptRoot\config.json", [string]$Python, [switch]$SkipHashes, [switch]$NoStepCapture ) $ErrorActionPreference='Stop' if (-not $Python) { $cfg=Get-Content -LiteralPath $Config -Raw|ConvertFrom-Json; $base=Split-Path -Parent (Resolve-Path -LiteralPath $Config); $portable=Join-Path $base $cfg.paths.portable_root; $Python=Join-Path $portable 'python_embeded\python.exe' } if (-not (Test-Path -LiteralPath $Python)) { throw "Python not found at $Python; pass -Python explicitly" } $a=@("$PSScriptRoot\krea_benchmark.py",$Stage,'--config',$Config); if($SkipHashes){$a+='--skip-hashes'}; if($NoStepCapture){$a+='--no-step-capture'}; & $Python @a; exit $LASTEXITCODE