$runnerRoot = 'C:\xiaoxia-ci\act_runner'
$runnerExe = Join-Path $runnerRoot 'act_runner.exe'
$configPath = Join-Path $runnerRoot 'config.yaml'
$stdoutLog = Join-Path $runnerRoot 'logs\runner.stdout.log'
$stderrLog = Join-Path $runnerRoot 'logs\runner.stderr.log'

if (-not (Test-Path $runnerExe)) {
  throw "Missing runner executable: $runnerExe"
}

if (-not (Test-Path $configPath)) {
  throw "Missing runner config: $configPath"
}

Start-Process -FilePath $runnerExe `
  -ArgumentList "daemon --config `"$configPath`"" `
  -WorkingDirectory $runnerRoot `
  -RedirectStandardOutput $stdoutLog `
  -RedirectStandardError $stderrLog

Write-Host 'Runner start command issued.'
