mrkeyoor.com_
Thu 17 Sept 22:01 UTC
AI Toolsevaluationupdated 01 Sept 2026

code2prompt review

Code2Prompt collects selected files, a directory tree, and optional Git context into one document that you can give to a language model. It comes as a Rust command-line app and library, an interactive terminal interface, and Python bindings, while the README also advertises a local MCP service.

+5stars / 7d
Verdict

Our Code2Prompt build succeeded in 282 seconds and all 336 tests passed in 96 seconds, so the implementation earns a trial while the source compile favors packaged binaries for occasional use. Choose it for a reviewable repository snapshot with strong filtering and formatting controls. Choose retrieval or an editing agent when the codebase cannot sensibly fit one prepared document, and verify the MCP distribution before buying into that part of the README.

We ran it

Lab card: what happened when we ran code2promptScreenshot of code2prompt (code2prompt.dev)
Install✓ · 48s268 packages
Build✓ · 282s
Tests✓ · 96s336 passed · 0 failed of 336 (cargo test)
Repo349 files~15,187 lines of source · 10.5 MB · 3 CI workflows

Answers from our run

Does code2prompt build from source?

Dependencies installed in 48 seconds (268 packages), and the build succeeded in 282 seconds. We cloned commit ab4fa06 into a clean Debian container with 3 CPUs and no project-specific setup.

Do code2prompt's tests pass?

Yes: 336 of 336 passed when we ran the project's own test command (cargo test). Some failures need services or credentials a bare container does not have.

Who should not use code2prompt?

Teams that cannot manually inspect exported source before sending it elsewhere: Code2Prompt can include file contents, hidden files, Git diffs, and branch history, while .gitignore does not classify secrets.

What are the alternatives to code2prompt?

Repomix, Gitingest, Aider. Our Code2Prompt build succeeded in 282 seconds and all 336 tests passed in 96 seconds, so the implementation earns a trial while the source compile favors packaged binaries for occasional use.

Setup4/548-second install, though the source build took 282 seconds
Docs3/5Good CLI guides, but MCP and newer source features are unclear
Community4/57,621 stars with issue and PR activity through August 2026
Maturity4/5All 336 tests passed; packaged releases trail newer source work

Discussed on

  1. hnShow HN: Code2prompt – Generate LLM prompts from your codebase4 points

Who it’s for

Developers who want a repeatable, inspectable way to prepare repository context for an LLM.
Teams that need .gitignore support, glob filters, token counts, and Git diffs before code leaves a workstation.
Python or Rust developers who want context packaging inside an existing automation script.
Terminal users who prefer choosing files in a TUI instead of maintaining a long command.

Who it’s NOT for

Teams that cannot manually inspect exported source before sending it elsewhere: Code2Prompt can include file contents, hidden files, Git diffs, and branch history, while .gitignore does not classify secrets.
Large monorepos that need retrieval instead of one assembled document: the README describes filtering and token counting, not a search index that selects code per question.
Branch-diff workflows that require the displayed tree to contain only changed files: open issue 176 says the full source tree is generated unless users exclude files themselves.
Notebook pipelines that need control over captured cells and outputs: open issue 264 says the built-in notebook processor uses predefined settings.
MCP adopters who require the server implementation in the reviewed workspace: the README advertises a local MCP service, but commit ab4fa06 lists only core, CLI, and Python crates in its Cargo workspace.

Setup reality

Our sandbox install succeeded in 48 seconds and pulled 268 packages. The build succeeded in 282 seconds. Cargo tests then finished in 96 seconds with 336 passed and 0 failed out of 336.

The local CLI does not require a model credential because it prepares output rather than sending it to a provider. Repeatable use benefits from a .c2pconfig file for filters, format, tokenizer, and destination. Python development from source adds Maturin, while the published Python package avoids that step.

The 282-second source build was much slower than the quick-install wording suggests. Wayland clipboard support needs an optional Cargo feature, SSH sessions should write to a file because they lack the local clipboard, and our scan found no Dockerfile.

A 349-file checkout becomes one inspectable document

Code2Prompt walks a repository, applies ignore rules and glob filters, and formats the selected files with a source tree for a language model. Our checkout contained 349 files and about 15,187 source lines, enough to show why repeatability matters. Output can go to standard output, a file, or the clipboard in Markdown, JSON, or XML. The tool never chooses a model or sends a request, so you can inspect the document before deciding where it goes.

The 10.5 MB repository contains a Rust core, a command-line app, a terminal interface, and Python bindings. Handlebars templates can use file paths, contents, Git diffs, and user variables. Token counting and the token map reveal which files dominate the result. commit ab4fa06 also has an optional entity-map feature that extracts functions, classes, methods, signatures, and line ranges through sem-core. That outline is useful when full source would consume too much context.

Filters reduce 15,187 lines, but they do not classify secrets

A 15,187-line source tree needs deliberate selection before it is copied into any hosted model. Code2Prompt respects .gitignore by default and accepts include or exclude globs. Users may also include hidden files, follow symbolic links, add staged diffs, or compare branches. Those switches are useful, yet none can know that a committed fixture contains customer data or that an ignored file is safe. Treat the generated artifact like a proposed public patch: inspect it and scan it before upload.

Open issue 176 documents a narrower token problem in branch-diff mode. The issue says the full source tree is generated unless files are explicitly excluded, even when the requested content concerns changed files. Open pull request 331 proposes pruning the tree to those files, but it was not merged when we checked. Until that changes, a small diff can still carry irrelevant paths in its outline. Teams using branch comparisons should measure the final token count rather than assuming the diff flag bounds every section.

What happened when we ran it

Our sandbox installed Code2Prompt in 48 seconds and pulled 268 packages. Building commit ab4fa06 then took 282 seconds on 3 CPUs with 12 GB of RAM. Cargo completed the full test command in 96 seconds: 336 tests passed and 0 failed out of 336. That is a clean result for the checked-out source, with no failed step or ambiguous log tail to explain. The timing also makes a published binary the sensible first choice for an occasional user.

The lab checkout occupied 10.5 MB before dependencies and contained 3 CI workflow files. Our scan found no Dockerfile and no root tests directory, although Cargo still discovered and ran the project's test targets. These facts cover installation, compilation, and the test suite in a fresh unprivileged Debian container. They say nothing about traversal speed on a giant monorepo, prompt quality, or how accurately a chosen model will use the exported files.

The 282-second build is harder than the first command

The README opens with Cargo, Homebrew, and PyPI installation choices, then shows code2prompt . as the basic command. That part is fair once a package is installed. A 282-second source build is a different experience, especially in short-lived CI jobs. Rust and Git are required for the documented source route. Building the Python bindings locally also needs a virtual environment, Maturin, and pytest, while pip install code2prompt-rs is the shorter consumer path.

Platform details appear in separate guides. Wayland clipboard integration requires the optional wayland Cargo feature. Over SSH, the project recommends writing to an output file because the remote session cannot reach the local clipboard. A .c2pconfig file can hold filters, tokenizer settings, format, and output destination; the loader checks the working directory before a global config location. With 268 packages resolved in our run, pinning the release or commit is wiser than rebuilding an unspecified tip in automation.

Version 4.2.0 does not describe every newer source feature

GitHub's latest release is v4.2.0, published on December 11, 2025, with an automatically generated one-line note. The repository was pushed on June 29, 2026, and the entity-map code landed after that release. The main README explains filters, templates, token tracking, Git integration, the Python SDK, and an MCP server, but it does not explain the newer entity-map flag. Buyers comparing a binary with current source need to check which features the binary actually contains.

The MCP claim deserves the same check. At commit ab4fa06, Cargo lists 3 workspace members: the core, CLI, and Python crates. The tree contains an MCP illustration, but no MCP crate or server documentation. That does not prove a separately distributed server is unavailable. It does mean this checkout is insufficient evidence for the README's local-service claim, so an MCP-dependent adoption should begin by locating and testing the exact server artifact.

All 336 tests passed, while open work still affects selection

GitHub listed 7,621 stars and 21 combined issues and pull requests when fetched. The open list contained 5 issues and 16 pull requests, with activity as recent as August 15, 2026, after the June 29 repository push. Issue 264 asks for configurable notebook processing, including control over captured outputs and cell counts. That is specific unfinished work, not evidence that ordinary source files are unreliable. It matters to teams whose notebooks contain large generated outputs.

Code2Prompt is easy to recommend for developers who want an artifact they can review, version, and hand to different models. Our 336 passing tests support the core path, while the 282-second build argues for Homebrew, a release binary, or PyPI when source changes are unnecessary. Filters and token maps help you make a smaller prompt; they do not replace secret scanning or relevance judgment. For semantic retrieval, iterative editing, or a required MCP server, compare the alternatives before standardizing on it.

Alternatives

ProjectWhat it isPick it when
Repomix gh↗A Node-based repository packer with local and remote inputs, token counts, and several output formats.pick this instead when your team prefers Node or needs Repomix's remote-repository workflow.
GitingestA web app and command-line tool that turns a Git repository into a prompt-ready text digest.pick this instead when a URL-based digest and shareable web flow matter more than local Rust tooling.
Aider gh↗A terminal coding assistant that maps a repository and edits files through model conversations.pick this instead when you want an agent to change code through repeated model calls rather than export context.

What people are saying

  1. [github-trending] mufeedvh/code2prompt

Sources

  1. Code2Prompt README
  2. Code2Prompt CLI arguments at commit ab4fa06
  3. Entity map pull request 321
  4. Branch diff source-tree issue 176
  5. Configurable file processors issue 264
  6. Code2Prompt v4.2.0 release

More ai tools reviews

rowboat · skills · superpowers-zh · yolov5 · eve · MemOS · the whole board →