feat: Use json5 to load model metadata for lenient parsing

This commit is contained in:
Paul Gauthier (aider) 2025-04-20 11:00:00 -07:00
parent 19a94e5f15
commit 8596f0d4a3

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import json import json
import json5
from pathlib import Path from pathlib import Path
@ -28,8 +29,9 @@ def main():
return return
try: try:
# Use json5 for the aider metadata file as it might contain comments
with open(aider_path, "r") as f: with open(aider_path, "r") as f:
aider_data = json.load(f) aider_data = json5.load(f)
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
print(f"Error decoding JSON from {aider_path}: {e}") print(f"Error decoding JSON from {aider_path}: {e}")
return return