Want to engage with us ? Join our Discord channel!
Stay updated on new features π’
Give your insight and suggestion π¬
Get help with configuration and usage π οΈ
Report Bug π
CLI with cargo π¦
cargo install code2prompt
SDK with pip π
pip install code2prompt-rs
Core
code2prompt
is a code ingestion tool that streamline the process of creating LLM prompts for code analysis, generation, and other tasks. It works by traversing directories, building a tree structure, and gathering informations about each file. The core library can easily be integrated into other applications.
CLI
code2prompt
command line interface (CLI) was designed for humans to generate prompts directly from your codebase. The generated prompt is automatically copied to your clipboard and can also be saved to an output file. Furthermore, you can customize the prompt generation using Handlebars templates. Check out the provided prompts in the doc !
SDK
code2prompt
software development kit (SDK) offers python binding to the core library. This is perfect for AI agents or automation scripts that want to interact with codebase seamlessly. The SDK is hosted on Pypi and can be installed via pip.
MCP
code2prompt
is also available as a Model Context Protocol (MCP) server, which allows you to run it as a local service. This enables LLMs on steroids by providing them a tool to automatically gather a well-structured context of your codebase.
Check our online documentation for detailed instructions
Code2Prompt transforms your entire codebase into a well-structured prompt for large language models. Key features include:
- Automatic Code Processing: Convert codebases of any size into readable, formatted prompts
- Smart Filtering: Include/exclude files using glob patterns and respect
.gitignore
rules - Flexible Templating: Customize prompts with Handlebars templates for different use cases
- Token Tracking: Track token usage to stay within LLM context limits
- Git Integration: Include diffs, logs, and branch comparisons in your prompts
- Developer Experience: Automatic clipboard copy, line numbers, and file organization options
Stop manually copying files and formatting code for LLMs. Code2Prompt handles the tedious work so you can focus on getting insights and solutions from AI models.
Refer to the documentation for detailed installation instructions.
Download the latest binary for your OS from Releases.
Requires:
git clone https://github.com/mufeedvh/code2prompt.git
cd code2prompt/
cargo install --path crates/code2prompt
Licensed under the MIT License, see LICENSE for more information.
If you liked the project and found it useful, please give it a β !
Ways to contribute:
- Suggest a feature
- Report a bug
- Fix something and open a pull request
- Help me document the code
- Spread the word