Crates.io | mkcontext |
lib.rs | mkcontext |
version | 0.4.3 |
source | src |
created_at | 2024-04-14 07:15:57.862602 |
updated_at | 2024-05-08 07:15:24.752447 |
description | A crate that provides functionality for creating context |
homepage | |
repository | |
max_upload_size | |
id | 1208076 |
size | 24,661 |
mkcontext
is a command-line tool written in Rust, designed to concatenate the contents of multiple files into a single string, primarily for building context to be used with OpenAI's ChatGPT. It supports glob patterns for file selection and maintains a token count to avoid exceeding a specified limit. The final concatenated string is copied to the clipboard for easy pasting.
anyhow
for robust error management.To use mkcontext
, you need to have Rust and Cargo installed. Follow these steps to install and build the tool:
Clone the repository:
git clone https://github.com/matthewrobertbell/mkcontext.git
cd mkcontext
Build the project using Cargo:
cargo build --release
The executable will be available in target/release/mkcontext
.
Alternatively, you can install mkcontext
directly using Cargo. This method will download and compile the source code automatically and place the executable in your Cargo bin path.
Install directly from the repository:
cargo install --git https://github.com/matthewrobertbell/mkcontext.git
Once installed, mkcontext
can be run from anywhere on your system if your Cargo bin path is in your system's PATH.
To update mkcontext
in the future, simply rerun the install command. Cargo will replace the old version with the new one.
Note: Ensure that you have Rust and Cargo installed and updated to the latest version for this method to work seamlessly.
Run mkcontext
with the required glob patterns. Optionally, specify a custom token limit using --token-limit
.
mkcontext "path/to/files/*.txt" "another/path/*.md" --token-limit 50000
If the token limit is exceeded, mkcontext
will output an error and terminate. Upon successful execution, it prints the token count and copies the content to the clipboard.
The tool uses the anyhow
crate for error handling, providing clear error messages for issues such as:
Contributions to mkcontext
are welcome. Please ensure that your code adheres to the project's standards and includes appropriate tests.
mkcontext
is licensed under the MIT License. See the LICENSE file for more details.
For questions or suggestions regarding mkcontext
, please open an issue on the GitHub repository.