Discover and explore top open-source AI tools and projects—updated daily.
raphaelmansuyCLI tool for converting codebases into LLM-ready prompts
Top 41.2% on SourcePulse
Code2Prompt is a command-line tool that transforms entire codebases into comprehensive Markdown prompts for Large Language Models (LLMs). It's designed for developers and researchers aiming to leverage LLMs for code analysis, documentation, and improvement by providing rich, structured context.
How It Works
Code2Prompt intelligently traverses project directories, respecting .gitignore and user-defined filters/exclusions. It generates a hierarchical Markdown representation of the codebase, optionally including line numbers and stripping comments. A key advantage is its Jinja2 templating system, allowing for highly customizable prompt generation tailored to specific AI tasks, with features like file inclusion and dynamic input variables.
Quick Start & Requirements
pip install code2prompt or pipx: pipx install code2prompt.code2prompt --path /path/to/your/projectHighlighted Details
--syntax-map.llm for direct analysis..code2promptrc configuration file.Maintenance & Community
The project is actively maintained by Raphaël Mansuy, founder of Quantalogic and creator of qllm. Contributions are welcome via the contributing guide.
Licensing & Compatibility
Released under the MIT License, allowing for commercial use and integration with closed-source projects.
Limitations & Caveats
Future roadmap items include token counts for Anthropic models and other LLMs, SQL-Lite embedding, and Git diff integration. The current token counting is primarily focused on OpenAI's encodings.
4 months ago
1 week
srush
simonw
context-labs