refactor: Remove 'env' key from .cast file header

This commit is contained in:
Paul Gauthier (aider) 2025-03-12 13:28:01 -07:00
parent 3a837c472e
commit a24ff28031

View file

@ -42,9 +42,16 @@ def process_file(input_path, output_path):
open(output_path, "w", encoding="utf-8") as outfile,
):
for line in infile:
# Always include the header (first line)
# Process the header (first line)
if is_first_line:
outfile.write(line)
try:
header = json.loads(line)
if 'env' in header:
del header['env']
outfile.write(json.dumps(header) + "\n")
except json.JSONDecodeError:
# If we can't parse the header, keep it as is
outfile.write(line)
is_first_line = False
continue