| Crates.io | mkcontext |
| lib.rs | mkcontext |
| version | 0.7.3 |
| created_at | 2024-04-14 07:15:57.862602+00 |
| updated_at | 2024-08-10 14:22:38.311285+00 |
| description | A crate that provides functionality for creating context |
| homepage | |
| repository | https://github.com/matthewrobertbell/mkcontext |
| max_upload_size | |
| id | 1208076 |
| size | 27,554 |
mkcontext is a command-line tool that generates context from files and command outputs, useful for large language models.
To install mkcontext, you need to have Rust and Cargo installed on your system. Then, you can install it using:
cargo install mkcontext
mkcontext [OPTIONS]
-t, --token-limit <TOKEN_LIMIT>: Optional token limit (default: 200000)-c, --command <COMMAND>: Commands to execute and include in the output (can be used multiple times)-g, --glob <GLOB>: Glob patterns to include or exclude files (can be used multiple times)-h, --help: Print help information-V, --version: Print version informationProcess all Rust files in the current directory:
mkcontext -g "*.rs"
Process all JavaScript files in the src directory and its subdirectories, with a token limit of 16000:
mkcontext -t 16000 -g "src/**/*.js"
Include the output of git status command in the context:
mkcontext -g "*.rs" -c "git status"
Process Python files and include outputs from multiple commands:
mkcontext -g "*.py" -c "pip list" -c "python --version"
Combine file processing and command execution:
mkcontext -g "src/**/*.rs" -g "tests/**/*.rs" -c "cargo test" -c "rustc --version"
Exclude specific directories or file patterns:
mkcontext -g "src/**/*.js" -g "!node_modules/**" -g "!*.log"
mkcontext processes the specified files matching the include glob patterns, excluding any paths or patterns specified by exclude globs.The -g or --glob option allows you to specify patterns to include or exclude files during processing. This is useful for selecting specific file types or excluding certain directories or files.
-g "src/**/*.rs"!: -g "!node_modules/**"You can use multiple -g options to specify several include and exclude patterns:
mkcontext -g "src/**/*.js" -g "!node_modules/**" -g "!*.log" -g "!build/**"
This will process all JavaScript files in the src directory and its subdirectories, while ignoring the node_modules directory, any .log files, and the build/ directory.
The tool uses the system clipboard, so make sure you have the appropriate clipboard drivers installed for your operating system.
This project is licensed under the MIT License.