| Crates.io | contextify |
| lib.rs | contextify |
| version | 0.1.3 |
| created_at | 2025-05-02 16:48:14.095543+00 |
| updated_at | 2025-05-02 21:02:13.753905+00 |
| description | A tool to save project structure and contents to a text file |
| homepage | |
| repository | https://github.com/suenot/contextify |
| max_upload_size | |
| id | 1657966 |
| size | 71,049 |
Contextify is a Rust utility that captures the structure and contents of a project directory and saves them into a text file. It's designed for quick documentation of your project's file system.
cargo install contextify
Clone the repository and build the project:
git clone https://github.com/suenot/contextify.git
cd contextify
cargo install --path .
Navigate to your project directory and run:
contextify
By default, Contextify will scan all files and directories in the current folder and produce an output file called project_contents.txt.
To create global configuration files in your home directory:
contextify init
This will create ~/.contextify-blacklist and ~/.contextify-whitelist files.
To see where Contextify's configuration files are located:
contextify show-locations
This will print the paths to both local and global configuration files.
--blacklist: Use the blacklist defined in the .blacklist file (or ~/.contextify-blacklist).--whitelist: Use the whitelist defined in the .whitelist file (or ~/.contextify-whitelist).--gitignore: Use the patterns from the project's .gitignore file as part of blacklist.--blacklist-file <PATH>: Use a custom blacklist file.--whitelist-file <PATH>: Use a custom whitelist file.--blacklist-patterns <PATTERNS>: Specify blacklist patterns directly (comma-separated).--whitelist-patterns <PATTERNS>: Specify whitelist patterns directly (comma-separated).-o, --output <FILE>: Specify the output file (default: project_contents.txt).-s, --stats: Display performance statistics and token estimates.-h, --help: Show brief help information.-V, --version: Show version information.contextify full-help: Show detailed help information.contextify version: Show detailed version information.contextify init: Initialize global configuration files.contextify show-locations: Show paths to configuration files.Use the default blacklist:
contextify --blacklist
Use the project's .gitignore file:
contextify --gitignore
Combine .gitignore with custom patterns:
contextify --gitignore --blacklist-patterns "*.tmp,*.bak"
Use the default whitelist:
contextify --whitelist
Use custom patterns:
contextify --blacklist-patterns "target/,.git/,*.log" --output my_project.txt
Use both blacklist and whitelist:
contextify --blacklist --whitelist
Use with statistics:
contextify --stats
Show detailed help:
contextify full-help
Contextify respects two types of configuration files:
.blacklist): Exclude certain files/directories..whitelist): Include only certain files/directories.The configuration files can be found in:
./config/.blacklist and ./config/.whitelist in the project~/.contextify-blacklist and ~/.contextify-whitelist in the home directory.blacklist File.DS_Store
target/
*.log
.whitelist File*.rs
*.md
*.toml
The following diagram illustrates the core algorithm of Contextify:
flowchart TD
A[Start] --> B[Parse Command Line Arguments]
B --> C{Command Specified?}
C -->|Yes| D[Execute Command]
C -->|No| E[Start Processing Project]
E --> F[Read Configuration Files]
F --> G[Process .gitignore if --gitignore]
G --> H[Build File Filters]
H --> I[Apply Blacklist Patterns]
H --> J[Apply Whitelist Patterns]
I --> K[Traverse Directory Structure]
J --> K
K --> L[Filter Files]
L --> M[Process Files in Parallel]
M --> N[Read File Contents]
N --> O[Sort Results]
O --> P[Generate Project Structure]
P --> Q[Generate File Contents]
Q --> R[Save to Output File]
R --> S[Display Statistics if --stats]
S --> T[End]
D --> T
Contextify is optimized for speed using Rust's concurrency features, making it significantly faster than the Python implementation (snap2txt).
Contextify is open-sourced software licensed under the MIT license.
Eugen Soloviov (suenot)