Here's another of my projects. I've created a script that exports an entire code base, excluding the list of excluded files present in the .gitignore and other exclusion files.
The library I've developed has been developed in both Python and JavaScript to enable the use of a Python command and an NPM package to execute a command that will export the code base into a text file.
The aim is then to be able to give this same text file to an LLM (Large Language Model) so that it can understand the entire project and not hallucinate over the use of functions.
After installing the library, you can then use the following commands:
export-repo /path/to/project -o /path/to/output/output.txt -e /path/to/exclusion/patterns.txt
or
python export-repository-to-file.py /path/to/project -o /path/to/output/output.txt -e /path/to/exclusion/patterns.txt
This will give us a text file that can be used to quickly copy and paste a code base, without any headaches!
It's a simple little script that saves me a lot of time on code reviews and very simple things. (Contextual issues aside, at the moment, sending an entire repository to an LLM is something of a hassle for LLMs 😖)
And that's it!