# mufeedvh/code2prompt

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.

Repository: https://github.com/mufeedvh/code2prompt
Canonical: https://ross.abutalabs.com/products/code2prompt
Homepage: https://code2prompt.dev
Language: Rust
License: MIT
License Family: permissive
Topics: ai, chatgpt, claude, cli, command-line, command-line-tool, gpt, llm, prompt, prompt-engineering, prompt-generator, prompt-toolkit, rust
Last push: 2026-06-29T18:24:06+00:00

## Health v2 (maintenance only)
Score: 66/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 90, release rhythm 36, longevity 64
- inputs: {"age_days": 907, "days_push": 65, "days_rel": 265, "gap_med": 162, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 7619, forks 436 (observed 2026-08-28T04:10:02.052010+00:00)

## What it is
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
- artifact type: cli-tool
- maturity: active
- function: llm-inference, prompt-engineering, cli, developer-tools, mcp
- domain: developer-tools, large-language-models, artificial-intelligence
- platform: windows, cli, rust, python
- tags: context-engineering, codebase-to-prompt, token-counting, handlebars-templates, git-integration, sdk, command-line, linux, macos

## Member repositories
- mufeedvh/code2prompt (main) score 66

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:02.052010+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:36:49.259565+00:00, confidence not recorded.
  - readme: https://github.com/mufeedvh/code2prompt (fetched 2026-08-28T04:10:02.052010+00:00, sha b51d247103ca)
  - homepage: https://code2prompt.dev (fetched 2026-08-29T08:32:00.924696+00:00, sha 4be77dbc646b)
  - site_page: https://code2prompt.dev/docs/welcome (fetched 2026-08-29T08:32:00.927416+00:00, sha d4fdf7176b49)
  - site_page: https://code2prompt.dev/docs/how_to/install (fetched 2026-08-29T08:32:00.929379+00:00, sha 2518bc9a99a7)
  - registry_crates: https://crates.io/api/v1/crates/code2prompt (fetched 2026-08-29T08:32:00.931642+00:00, sha 3e57d361c96f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
