| Crates.io | repo-flatten |
| lib.rs | repo-flatten |
| version | 0.2.1 |
| created_at | 2025-08-14 16:38:17.131281+00 |
| updated_at | 2025-09-12 20:27:31.104002+00 |
| description | A utility to flatten all files in the repository into a single file, consumed by LLMs. Will ignore .gitignore and hidden files. |
| homepage | https://github.com/irvingoujAtDevolution/flatten |
| repository | https://github.com/irvingoujAtDevolution/flatten |
| max_upload_size | |
| id | 1795087 |
| size | 47,888 |
A command-line utility to flatten all files from a Git repository into a single text file. This tool is particularly useful for feeding entire codebases into Large Language Models (LLMs) for analysis, documentation, or code review purposes.
git clone https://github.com/irvingoujAtDevolution/flatten.git
cd flatten
cargo build --release
The binary will be available at target/release/flatten (or target/release/flatten.exe on Windows).
cargo install --path .
# Flatten the current repository to default output file
flatten
# Flatten a specific repository
flatten --repo /path/to/repository
# Flatten a specific branch or commit
flatten --rev main
flatten --rev abc123def
# Specify custom output file
flatten --output my_codebase.txt
Options:
-r, --repo <REPO_PATH> The path to the git repository [default: .]
-v, --rev <REVISION> The git revision to inspect (branch, tag, or commit hash) [default: HEAD]
-o, --output <OUTPUT_FILE> The path for the output file [default: flattened_files.txt]
-h, --help Print help
-V, --version Print version
# Flatten the main branch of a repository
flatten --repo ./my-project --rev main --output codebase.txt
# Flatten a specific commit
flatten --rev a1b2c3d4 --output snapshot.txt
# Flatten current repository with custom output
flatten -o project_dump.txt
The tool creates a text file with the following structure:
--- File: src/main.rs ---
[file content here]
--- File: README.md ---
[file content here]
--- File: assets/image.png ---
[Binary file: content not included]
clap - Command-line argument parsinggit2 - Git repository accessanyhow - Error handlinggit checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under either of
at your option.
Irving Ou - jou@devolutions.net
Note: This tool respects Git's ignore rules by default and will only process files that are tracked in the Git repository at the specified revision.