CodeTree is a Rust-based command-line tool that generates a comprehensive overview of a project's file structure and contents. It's designed to help developers quickly understand and document the layout and code of their projects.
Tired of the tedious task of manually creating file structures and populating them with code snippets when sharing your projects with LLMs or collaborators? This tool automates that process, saving you valuable time and effort.
Imagine needing to provide your entire project's codebase to an LLM for analysis or to a colleague for review. Manually copying and pasting each file's contents into a single text file is cumbersome and error-prone. This tool eliminates that friction.
This Rust application generates a representative file tree mirroring the structure of a typical full-stack application (as shown in the example above) and compiles all the code into a single, easy-to-share .txt
file. This makes sharing your code with LLMs, for tasks like code review, debugging, or generation of new code remarkably streamlined. No more tedious manual copying and pasting; instead, you'll have all the contextual information available at your fingertips, for immediate access to the source code, without needing to reconstruct the directory structures.
Stop wasting time on repetitive tasks and start focusing on what truly matters: building your application! And it works on every OS.
-
Ensure you have Rust installed on your system. If not, install it from https://www.rust-lang.org/tools/install
-
For Windows Users (Easiest Method):
Download the latest Windows release directly from the Releases page. Download the
.exe
file and run it. -
For All Other Users (Compile from Source):
a. Clone this repository:
git clone https://github.com/exyreams/Codetree.git cd Codetree
b. Build the project:
cargo build --release
-
Run the project:
cargo run <PATH>
Run CodeTree using one of the following commands:
-
To analyze the current directory:
cargo run
-
To analyze a specific directory:
- On Unix-like systems (Linux, macOS):
eg:
cargo run /path/to/your/directory
cargo run /home/Desktop/Codetree
- On Windows:
eg:
cargo run -- C:\path\to\your\directory
cargo run D:\Projects\Codetree
- On Unix-like systems (Linux, macOS):
The tool will generate an codetree.txt
file in the analyzed directory, containing the file tree and the contents of each file.
The codetree.txt
file will contain:
- A visual representation of the project's file structure
- The contents of each file in the project, excluding the script itself and the output file
- You can modify the
EXCLUDED_DIRS
constant in the source code to adjust which directories are excluded from the analysis. If you add or remove directories, ensure you update the[&str; 19]
value accordingly; the number of items in the array must match. - You can modify the
EXCLUDED_FILES
constant in the source code to adjust which files are excluded from the analysis. If you add or remove files, ensure you update the[&str; 8]
value accordingly; the number of items in the array must match.