# Simple script to validate opencode and pwsh inside running container or local environment
param(
    [string]$ContainerName = 'wordpress-plugin-ai-builder'
)

# If docker is available, run inside the container
if (Get-Command docker -ErrorAction SilentlyContinue) {
    Write-Host "Running checks inside container: $ContainerName"
    docker compose exec $ContainerName pwsh -NoProfile -Command @"
pwsh --version
node --version
opencode --version
opencode help | Out-Null
. /root/.config/powershell/Microsoft.PowerShell_profile.ps1
Get-Command github | Out-Null
exit 0
"@
} else {
    Write-Host "Docker is not available - trying local checks"
    pwsh --version
    node --version
    if (Get-Command opencode -ErrorAction SilentlyContinue) { opencode --version } else { Write-Error "opencode not found"; exit 1 }
}

Write-Host "Checks completed." -ForegroundColor Green
