code2prompt  by mufeedvh

CLI tool for converting codebases into LLM prompts

created 1 year ago
6,132 stars

Top 8.5% on sourcepulse

GitHubView on GitHub
Project Summary

This tool addresses the challenge of preparing codebases for Large Language Models (LLMs) by converting entire code repositories into a single, structured prompt. It is designed for developers and AI engineers who need to analyze, generate, or interact with code using LLMs, offering a streamlined workflow to avoid manual file formatting and copying.

How It Works

The tool traverses directories, builds a source tree, and gathers file information to create a unified prompt. It leverages Handlebars for flexible prompt templating and includes token counting to manage LLM context limits. This approach automates the tedious process of code preparation, ensuring structured and efficient input for LLMs.

Quick Start & Requirements

  • Install via Cargo: cargo install code2prompt
  • Install via Homebrew: brew install code2prompt
  • Install SDK via pip: pip install code2prompt-rs
  • Source build requires Git, Rust, and Cargo.
  • Documentation available at https://code2prompt.com/

Highlighted Details

  • Transforms entire codebases into LLM-ready prompts.
  • Supports smart filtering via glob patterns and .gitignore.
  • Customizable prompts using Handlebars templating.
  • Integrates Git features like diffs and logs.
  • Tracks token usage for LLM context limits.

Maintenance & Community

  • Active community engagement encouraged via Discord.
  • Contributions are welcomed through feature suggestions, bug reports, and pull requests.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The project is actively seeking contributions for documentation and bug fixes, suggesting potential areas for improvement or ongoing development.

Health Check
Last commit

1 week ago

Responsiveness

1 week

Pull Requests (30d)
15
Issues (30d)
9
Star History
638 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), and
2 more.

prompt-engine by microsoft

0.0%
3k
NPM library for LLM prompt engineering
created 3 years ago
updated 2 years ago
Feedback? Help us improve.