mufeedvh/code2prompt
A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting. observed · 2026-08-28
Health v2 · maintenance only
66/100
- Activity 90
- Release rhythm 36
- Longevity 64
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 162
- age_days: 907
- days_rel: 265
- days_push: 65
- n_releases_24m: 4
Adoption not part of the score
7619 stars · 436 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
Code2Prompt is a Rust-based CLI tool that converts an entire codebase into a single structured LLM prompt, including a source tree, file contents, token counts, and optional Git diffs. It also ships as a Python SDK and an MCP server, making it usable for manual prompting, AI agents, and automation.
Use cases
- convert my codebase into a prompt for ChatGPT or Claude
- generate LLM context from a repository with a source tree
- count tokens before sending code to an LLM
- prepare code review prompts with git diffs
- build AI agents that ingest codebases programmatically
- filter which files go into an LLM prompt using glob patterns
- run an MCP server that exposes my codebase to an LLM
When to choose
- you need to hand a whole codebase or directory to an LLM as context
- you want token counting and .gitignore-aware filtering to fit context windows
- you want templated prompts (Handlebars) and clipboard/file output from the terminal
- you need a code-ingestion SDK or MCP server for agent workflows
When to avoid
- your codebase is too large for any LLM context window and you need semantic retrieval/RAG instead
- you want an IDE-integrated AI assistant rather than a standalone prompt generator
- you need to send code to LLM APIs directly rather than preparing prompt text
Facets
cli-tool · maturity active
llm-inference prompt-engineering cli developer-tools mcp developer-tools large-language-models artificial-intelligence windows cli rust python context-engineering codebase-to-prompt token-counting handlebars-templates git-integration sdk command-line linux macos
5 sources
- readme: https://github.com/mufeedvh/code2prompt · fetched 2026-08-28 · b51d247103ca
- homepage: https://code2prompt.dev · fetched 2026-08-29 · 4be77dbc646b
- site_page: https://code2prompt.dev/docs/welcome · fetched 2026-08-29 · d4fdf7176b49
- site_page: https://code2prompt.dev/docs/how_to/install · fetched 2026-08-29 · 2518bc9a99a7
- registry_crates: https://crates.io/api/v1/crates/code2prompt · fetched 2026-08-29 · 3e57d361c96f
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mufeedvh/code2prompt | main | 66 |
For agents
markdown · JSON · MCP: product_card(name="mufeedvh/code2prompt")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem