codemap_rs is a fast and portable Rust CLI utility that generates a comprehensive snapshot of a directory tree. It excludes files and directories based on .gitignore rules and produces a human-readable report of the directory structure, file types, and included file contents.
- ✅ Traverses a directory recursively
- 🚫 Excludes paths matching
.gitignorerules - 📝 Generates a report showing:
- File type summary by extension
- Directory structure diagram
- UTF-8 file contents for files ≤ 100 KB
- 📂 Skips binary or oversized files
- 🔍 Honors real Git behavior by always excluding
.git/
Build and install to your local bin directory:
cargo build --release
cp target/release/codemap_rs ~/.local/bin/codemapcodemap [target_dir]If target_dir is omitted, it defaults to the current directory.
The snapshot will be saved to directory_snapshot.txt in the target directory.
Directory and File Snapshot - 2025-04-13 18:29:54
Summary of File Types (by extension):
6 rs
1 lock
1 toml
Working Directory Full Path:
/home/bobby/projects/codemap_rs
Directory Structure Diagram (excluding entries in .gitignore):
LICENSE
tests/filter_tests.rs
Cargo.toml
src/lib.rs
src/main.rs
...
Run all tests:
cargo testIncludes:
- Integration tests for
.gitignoreexclusions - Test coverage for core path-filtering logic
src/
├── filter.rs # Handles .gitignore parsing and exclusion
├── walk.rs # Directory traversal with filters applied
├── snapshot.rs # Output formatting and report generation
├── lib.rs # Public API for tests and main
└── main.rs # CLI entry point
tests/
└── filter_tests.rs # Integration tests for exclusion behavior
MIT License. See LICENSE for details.