Files
thermcool/parse_transcript.py
T

21 lines
1.0 KiB
Python

import json
transcript_path = '/Users/michalcukrowski/.gemini/antigravity-ide/brain/1d7cf0f7-087b-4c82-94a5-07c51084a559/.system_generated/logs/transcript_full.jsonl'
with open(transcript_path, 'r', encoding='utf-8') as f:
for line in f:
data = json.loads(line)
if data.get('type') == 'USER_INPUT':
content = data.get('content', '')
if 'export interface Product {' in content and len(content) > 100000:
print(f"Found large user input of length {len(content)}")
# Extract the file content. It probably starts with "export interface Product {"
# or there is some text before it.
idx = content.find('export interface Product {')
if idx != -1:
file_content = content[idx:]
with open('content/products.ts', 'w', encoding='utf-8') as out:
out.write(file_content)
print("Wrote to content/products.ts successfully!")
break