Dir2txt – Dump your project into clean LLM-ready text or JSON
Dir2txt – Dump your project into clean LLM-ready text or JSON
Hi HN, I built dir2txt — a simple but powerful CLI tool that turns a directory tree into a clean, structured text or JSON dump. What It Does • Traverses a project directory • Dumps readable file contents • Optionally strips comments (smart detection of comment blocks + patterns) • Respects .gitignore, .dockerignore, .npmignore, etc. • Outputs LLM-friendly .json or .txt files Why I Made It Working with LLMs like GPT-4 or Claude, I kept hitting the same issue: how do I give the model meaningful access to an entire project? Manually pasting files is noisy and lossy. Existing tools like tree only give structure. I wanted one tool that could: •Structure the directory •Include the real content •Strip boilerplate if needed •Output in a format usable by RAG pipelines, code copilots, or embedders Example $>dir2txt ./my-project --strip-comments --json > project.json And then feed it into a vector DB or tokenizer for embedding + retrieval. Install Homebrew $>brew tap shubhamoy/dir2txt $>brew install dir2txt
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Correct prediction on native model
Similar products
heroku.json, our Sunday hack project
AI-ready JSON snapshots of your live DOM
Eliminating text looping/latent collapse in LLM activation steering
Clean AI-pasted text
a small weekendish project - JSON Blob
JSON.stringify (without circular deps) for AngularJS 1.x
JSON.is
Parse JSON with Flex, Bison, and Ruby
Homogenius – JSON packer/unpacker
json.is