DEV Community

forrest
forrest

Posted on

code2text

Sending code can be a pain. Virus filters, attachment rules, and more can make it difficult. Sometimes you just need a text file.

Enter code2text. This is a simple Go CLI tool that will traverse a project's directories and add all code to a single text document. This document can then be uploaded to an AI tool such as ChatGPT for analysis.

The created file will start with the directory structure, then the files. The defaults contain file extensions and directories to include/exclude for many popular languages, but can be overridden. Check the help code2text -h for details.

If, for some reason, you want to turn the output file into a directory structure resembling the original, use text2code. Note: this will not create a complete, compilable project as many files and directories may be excluded.

Top comments (0)