code2prompt  by mufeedvh

CLI tool for converting codebases into LLM prompts

Created 1 year ago
6,513 stars

Top 7.9% 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

2 days ago

Responsiveness

1 week

Pull Requests (30d)
14
Issues (30d)
3
Star History
161 stars in the last 30 days

Explore Similar Projects

Starred by David Cournapeau David Cournapeau(Author of scikit-learn), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
7 more.

repomix by yamadashy

0.6%
19k
CLI tool to pack codebases into AI-friendly formats for LLMs
Created 1 year ago
Updated 2 days ago
Feedback? Help us improve.