AI prompts
base on A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting. <div align="center">
<a href="https://code2prompt.dev">
<img align="center" width="550px" src=".assets/logo_dark_v0.0.2.svg" alt="Code2prompt"/>
</a>
<p align="center">
<b>Convert your codebase into a single LLM prompt !</b>
</p>
</div>
<h1 align="center">
<a href="https://code2prompt.dev"><img src=".assets/CLI.png" alt="code2prompt"></a>
</h1>
<hr />
[](https://crates.io/crates/code2prompt)
[](https://github.com/mufeedvh/code2prompt/blob/master/LICENSE)
[](https://github.com/user/repo/pulls)
[](https://github.com/mufeedvh/code2prompt)
[](https://discord.com/invite/ZZyBbsHTwH)
<hr />
<p align="center">
Want to engage with us ? Join our <a href="https://discord.com/invite/ZZyBbsHTwH">Discord</a> channel!<br>
<i>Stay updated on new features</i> 📢<br>
<i>Give your insight and suggestion</i> 💬<br>
<i>Get help with configuration and usage</i> 🛠️<br>
<i>Report Bug</i> 🐛<br>
</p>
## Quick Install ⚡
```bash
# Cargo
$ cargo install code2prompt
# Homebrew
$ brew install code2prompt
```
SDK with pip 🐍
```bash
pip install code2prompt-rs
```
## How is it useful?
**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.
## Documentation 📚
Check our online [documentation](https://code2prompt.dev/docs/welcome/) for detailed instructions
## Features
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.
## Alternative Installation
Refer to the [documentation](https://code2prompt.dev/docs/how_to/install/) for detailed installation instructions.
### Binary releases
Download the latest binary for your OS from [Releases](https://github.com/mufeedvh/code2prompt/releases).
### Source build
Requires:
- [Git](https://git-scm.org/downloads), [Rust](https://rust-lang.org/tools/install) and `Cargo`.
```sh
git clone https://github.com/mufeedvh/code2prompt.git
cd code2prompt/
cargo install --path crates/code2prompt
```
## Star History
[](https://star-history.com/#mufeedvh/code2prompt&Date)
## License
Licensed under the MIT License, see <a href="https://github.com/mufeedvh/code2prompt/blob/master/LICENSE">LICENSE</a> for more information.
## Liked the project?
If you liked the project and found it useful, please give it a :star: !
## Contribution
Ways to contribute:
- Suggest a feature
- Report a bug
- Fix something and open a pull request
- Help me document the code
- Spread the word
", Assign "at most 3 tags" to the expected json: {"id":"11139","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"