Crates.io | cunw |
lib.rs | cunw |
version | |
source | src |
created_at | 2024-05-13 05:13:43.163541 |
updated_at | 2024-11-30 17:06:17.253956 |
description | A tiny utility that generates a file representing the structure and content of a directory. Made to easily give context to a LLM. |
homepage | https://github.com/RemiKalbe/cunw |
repository | https://github.com/RemiKalbe/cunw |
max_upload_size | |
id | 1237979 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
cunw (codebase unwrap) is a command-line interface (CLI) tool that generates a structured representation of a codebase, making it easy to provide context to a large language model (LLM). It recursively traverses a directory, collects file content, and generates a single file that represents the structure and content of the codebase.
.gitignore
files by default (can be disabled)You can easily install cunw through cargo:
cargo install cunw
Or download the precompiled binaries from the releases page.
To install cunw, ensure you have Rust and Cargo installed on your system. Then, clone the repository and build the project:
git clone https://github.com/RemiKalbe/cunw.git
cd cunw
cargo build --release
The compiled binary will be available at target/release/cunw
.
cunw [OPTIONS]
-p, --path <PATH>
: The path to the directory containing the codebase.-o, --output <FILE>
: The path of the output file. Default: output.txt
-e, --exclude <PATTERN>
: Exclude files or directories matching the specified glob pattern.--do-not-consider-ignore-files
: Do not consider .gitignore
files when filtering. Default: false
--dangerously-allow-dot-git-traversal
: Include .git
directory in the search. Default: false
-d, --max-depth <DEPTH>
: Maximum depth to walk into the directory tree.-f, --follow-symbolic-links
: Follow symbolic links. Default: false
-v, --verbose
: Set the verbosity level. Can be used multiple times to increase verbosity.To generate a file representation of a codebase located at path/to/codebase
, excluding files matching *.txt
and save the output to codebase.md
:
cunw path/to/codebase -o codebase.md -e "*.txt"
The generated file will have the following structure:
<directory_structure>
.
└─ .
├─ ./src
│ ├─ main.rs
│ └─ lib.rs
├─ .gitignore
├─ Cargo.lock
└─ Cargo.toml
</directory_structure>
<file path="Cargo.toml">
[package]
name = "cunw"
version = "0.1.0"
edition = "2021"
[dependencies]
<!-- ... -->
</file>
<file path="src/main.rs">
fn main() {
println!("Hello, world!");
}
</file>
<!-- ... -->
The <directory_structure>
section represents the directory tree of the codebase, and each <file>
section contains the content of a specific file.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License.