$p = Start-Process -FilePath ".\kv-cleanup.exe" -PassThru -NoNewWindow
Start-Sleep -Seconds 3

try {
    Write-Host "`n=== Disk Usage ==="
    $disk = Invoke-RestMethod -Uri "http://localhost:36969/api/disk-usage"
    Write-Host "Total: $($disk.totalGB) GB, Free: $($disk.freeGB) GB"

    Write-Host "`n=== System Info ==="
    $sys = Invoke-RestMethod -Uri "http://localhost:36969/api/system-info"
    Write-Host "OS: $($sys.os)"
    Write-Host "Memory: $($sys.memory)"

    Write-Host "`n=== Apps (First 3) ==="
    $apps = Invoke-RestMethod -Uri "http://localhost:36969/api/apps"
    $apps | Select-Object -First 3 | Format-Table Name, Path

    Write-Host "`n=== Scan Downloads ==="
    $scan = Invoke-RestMethod -Uri "http://localhost:36969/api/scan/category" -Method Post -Body '{"category": "downloads"}' -ContentType "application/json"
    $scan | Select-Object -First 3 | Format-Table Path, Size
} catch {
    Write-Host "Error: $_"
} finally {
    Stop-Process -Id $p.Id -Force
}
