#code-review #cli

bin+lib cr-prep

A CLI tool for collecting code files for code review

2 unstable releases

new 0.2.0 Mar 27, 2025
0.1.0 Mar 27, 2025

#331 in Development tools

Download history 192/week @ 2025-03-23

192 downloads per month

MIT license

8KB
124 lines

cr-prep

A CLI tool for collecting code files for code review. This tool recursively searches through a specified directory and outputs the content of code files (.rs, .ts, .js, .py, .go) in a format suitable for code review.

Installation

You can install cr-prep using cargo:

cargo install cr-prep

Or build from source:

git clone https://github.com/yourusername/cr-prep
cd cr-prep
cargo build --release

Usage

Basic usage:

# Output to stdout
cr-prep --path /path/to/your/project

# Output to a file
cr-prep --path /path/to/your/project --output review.txt

Options

  • -p, --path <DIRECTORY>: Directory to search for code files (required)
  • -o, --output <FILE>: Output file path (optional, defaults to stdout)

Example Output

// src/main.rs
fn main() {
    println!("Hello, world!");
}

// src/lib.rs
pub fn add(a: i32, b: i32) -> i32 {
    a + b
}

Supported File Types

  • Rust (.rs)
  • TypeScript (.ts)
  • JavaScript (.js)
  • Python (.py)
  • Go (.go)

Error Handling

  • If the specified path is not a directory, the program will exit with an error message
  • If a file cannot be read, a warning message will be displayed and the file will be skipped
  • If the output file cannot be written, the program will exit with an error message

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~1.3–8.5MB
~66K SLoC