Press "Enter" to skip to content

Building CodeClip: Copy Your Entire Codebase Instantly

As developers, we’ve all been there: you need to share either parts of your code or sometimes your entire codebase with LLMs. The inspiration was drawn from a linkedin post I saw which showcased a tool which can copy an entire github repository which you can give to LLMs, it had a UI and everything where you could select which files you wanted to include/exclude.

This got me thinking this actually seems useful and I might actually use this. Which is when I realized that most of the time I want to give my code as context rather than code which is in a repository as we commit only after completion of a fix/feature and not while it is in development. This means I need a tool which will copy everything in my working directory.

There’s a pretty good chance that something like this probably exists but implementing a filepath.walk() felt easier than actually looking up if this actually exists. Which is why I decided to make this anyways. You can find the code to CodeClip here.

I began by laying out the requirements, which look somewhat like this:

  • Should be lightweight and quick.
  • Shouldn’t take too much time or effort to use.
  • Should copy everything to clipboard.
  • Should copy contents to a file called codebase_dump.txt

After which i started implementing it and i tested it out on a mern project i had running locally. Which is when i ran into some error. I tried to run it in the codeclip directory itself where it worked 😐

Okay so that was when i realised that the error might’ve originated out of codeclip trying to read all files from node_modules and hit a limit either while copying or writing the contents.

Soooo we need this tool to only copy files where your code lies. I implemented this just by adding a blacklist of directories and file extensions to avoid. I will be adding support for users to configure it themselves and also copy only files with certain extensions such as cclip -f .js .py .json. I will also be adding support for users to be able to choose if they want to save it to clipboard or save it to a .txt file or both.

This was just something i thought would be cool to make and something i will genuinely use. You can find the code here, and if you want to try out codeclip click here.

If you have any suggestions or any feedback let me know in the comments, i would love your opinion on this, maybe we can collaborate if you’re interested on a particular feature you’d like to see in CodeClip.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *