The CLI (command-line) tool Repository-Context-Packager was built to analyze local git repositories and create a text file containing repository content optimized for sharing with LLMs (Large Language Models).
I built it because I often faced the challenge of copy-pasting multiple files into an LLM when I needed help. This was time-consuming and repetitive, especially for larger projects. With this tool, I can now generate a complete report of my repository in just one step.
Below are the features implemented in this project:
Command Line Entry Point: I used the Commander.js library to handle commands, arguments and options.
Output Formatting: I implemented a buildTree() utility function to create a text-based tree structure of directories and files. This took me sometime to be able to have a nice tree representation. The current Git commit information was included as well as a summary showing the total number of files and lines processed.
File Reading and Exclusions: Some of my files like package-lock.json were over 16KB, so I had to truncate it with a note specifying the user that only the first 16KB have been included. I also excluded files like node_modules, .git.
Optional Features: I integrated the .gitignore where I listed some files to be automatically excluded. I also implemented options like --output to write to a file, and --include to filter file types by extension.
I am really happy with what I have built so far. It is not perfect, can still be improved but it is satisfying to see the little things we can learn each day. This first open source project enhanced my understanding of working in open source with other people, reviewing issues, fixing and closing them. I gained a lot and enhanced my knowledge on GitHub. With this tool, I can now package a repository and send it to an LLM for help in seconds, hence no more copy-pasting files one by one which is time saving.
Here is the link to my Repository-Context-Packager tool: https://github.com/CynthiaFotso/Repository-Context-Packager
Top comments (0)