<?php
$logPath = 'C:/Users/HP/.gemini/antigravity-ide/brain/d31b1fe2-ad06-4c7a-9ab1-c82bd4c8dd20/.system_generated/logs/transcript.jsonl';
if (!file_exists($logPath)) {
    die("Log not found\n");
}

$handle = fopen($logPath, 'r');
$allOutput = '';
while (($line = fgets($handle)) !== false) {
    $data = json_decode($line, true);
    if (!$data) continue;
    
    // Check if this step ran a command and got output containing database dumps
    if (isset($data['type']) && $data['type'] === 'RUN_COMMAND' && isset($data['content'])) {
        $content = $data['content'];
        if (strpos($content, 'lh3.googleusercontent.com') !== false && (strpos($content, 'image_stripe_ssp126_url') !== false || strpos($content, 'image_climate_stripe_url') !== false)) {
            $allOutput .= "=== STEP " . ($data['step_index'] ?? 'unknown') . " ===\n";
            $allOutput .= $content . "\n";
            $allOutput .= "=======================\n\n";
        }
    }
}
fclose($handle);

file_put_contents('scratch/extracted_dumps.txt', $allOutput);
echo "Extracted dumps saved to scratch/extracted_dumps.txt. Total length: " . strlen($allOutput) . " bytes\n";
