# Runs a set of smoke tests for the opencode CLI inside the running container
param(
    [string]$ContainerName = 'wordpress-plugin-ai-builder'
)

$cmds = @(
    'pwsh --version',
    'node --version',
    'opencode --version',
    'opencode help'
        # verify our helper alias/function is loaded (source the profile file manually to simulate login)
        '. /root/.config/powershell/Microsoft.PowerShell_profile.ps1; Get-Command github'
)

foreach ($c in $cmds) {
    Write-Host "Running: $c"
    docker compose exec $ContainerName pwsh -NoProfile -Command $c
    if ($LASTEXITCODE -ne 0) {
        Write-Error "Command failed: $c"
        exit 1
    }
}

Write-Host "Smoke tests passed." -ForegroundColor Green
