A simple Python script that collects code from specified file paths on Windows 10. It copies each file’s content, labels it by programming language, and saves everything into a single JSON file – perfect for feeding into a Large Language Model (LLM).
- You provide a list of file paths in the script.
- The script reads each file and identifies its language from the file extension.
- All code snippets are compiled into a single JSON file called
aggregated_files.json.
- Clone or download this repository.
- Update the
file_pathslist with the files you want to aggregate. - Run the script:
python collate_code.py - Open
aggregated_files.jsonto see your collated data.
- Extend the
extension_mapdictionary to add mappings for more programming languages or file types. - Swap out the JSON output for plain text or any other format you prefer.
This project is licensed under the MIT License. Feel free to use it and adapt it to suit your needs. Enjoy collating your code!