<?php
$logPath = 'C:/Users/HP/.gemini/antigravity-ide/brain/dabec389-a1dd-4fd5-add9-97761faf96ae/.system_generated/logs/transcript.jsonl';
if (!file_exists($logPath)) {
    die("Log 1 not found\n");
}
$stepsToExtract = [44, 135, 191, 197, 201, 203];
$handle = fopen($logPath, "r");
$idx = 0;
$out = "";
while (($line = fgets($handle)) !== false) {
    $idx++;
    if (in_array($idx, $stepsToExtract)) {
        $data = json_decode($line, true);
        if (!$data) continue;
        
        $out .= "=== Step $idx ===\n";
        $out .= "Type: " . ($data['type'] ?? '') . "\n";
        $out .= "Content:\n" . ($data['content'] ?? '') . "\n";
        if (isset($data['tool_calls'])) {
            $out .= "Tool Calls:\n" . json_encode($data['tool_calls'], JSON_PRETTY_PRINT) . "\n";
        }
        $out .= "=================\n\n";
    }
}
fclose($handle);
file_put_contents("scratch/extracted_step_details.txt", $out);
echo "Saved to scratch/extracted_step_details.txt\n";
