code2prompt

code2prompt

5,702

Code2Prompt is a tool designed to automate the conversion of codebases into prompts for large language models, offering smart filtering, custom templating, and Git integration. It features a CLI, SDK, and runs as a Model Context Protocol server, simplifying code-to-prompt transformations.

Overview

  • Code2Prompt: A tool to convert your codebase into a large language model (LLM) prompt.

  • Features:

    • Automatic Code Processing: Streamlines the organization of codebases into prompts.
    • Smart Filtering: Uses glob patterns and respects .gitignore rules to filter files.
    • Flexible Templating: Allows customization of prompts using Handlebars templates.
    • Token Tracking: Manages token usage for LLM limits.
    • Git Integration: Includes diffs, logs, and branch comparisons in prompts.
    • Developer Experience: Automatic clipboard copy and improved file organization.
  • Components:

    • Core: Integrates easily into other applications.
    • CLI: Helps generate prompts from codebases and copy them to the clipboard.
    • SDK: Python bindings for seamless codebase interaction.
    • MCP: Available as a Model Context Protocol server for local service deployment.
  • Installation: Available via Cargo, Homebrew, and Python pip.

  • Documentation: Available online with detailed instructions.