CodeText: Turn Any GitHub Project Into a Prompt-friendly Text (Free & Open-source Tool)
Meet CodeTxt, The Open-Source Tool That Lets You Feed Any Git Repo to LLMs Like ChatGPT & Claude (Built by an Egyptian Developer!)
Table of Content
If you’ve ever wanted to hand over your entire codebase to an AI assistant like ChatGPT or Claude for analysis, debugging, documentation, or even training, you’ve probably hit a wall. Either the code was too large, messy, or fragmented across files.
What is CodeTxt?
Well, say hello to CodeTxt, a sleek, open-source CLI tool that turns any Git repository, local or remote, into a clean, prompt-ready text digest for Large Language Models (LLMs).
And guess what? It’s free, open-source, and built by Hassan Kerdash, a talented Egyptian developer who saw a gap in how developers interact with AI today, and decided to fix it.
What Is CodeTxt?
CodeTxt is a lightweight command-line interface (CLI) tool that extracts, filters, and formats your codebase into a single readable text file optimized for AI consumption.
Whether you're working on a personal project, contributing to open-source, or managing a complex monorepo, CodeTxt makes it easy to prepare your code for:
- AI-powered code review
- Automated documentation generation
- Debugging with LLMs
- Training custom models
- Static search indexing
- And much more!
Why CodeTxt Is a Cool Tool for Developers
1. Supercharge AI Collaboration
Instead of copy-pasting chunks of code into your favorite AI chatbot, just run codetxt
and let it build a structured dump of your entire project, ready for AI to parse, understand, and assist with.
2. Supports Remote & Local Repositories
Clone and analyze GitHub repos directly, or point it to a local folder:
codetxt https://github.com/facebook/react
# Or analyze current directory
codetxt .
3. Fine-Grained File Filtering
Use glob patterns to include or exclude files/directories:
# Only include JS and Markdown files
codetxt . --include-pattern "**/*.js" --include-pattern "**/*.md"
# Exclude tests and logs
codetxt . --exclude-pattern "tests/" --exclude-pattern "*.log"
4. Control Over Large Files
Don’t want massive binary or log files bloating your output?
codetxt . --max-size 50000 # Skip files over 50KB
5. Respect .gitignore
or Bypass It
By default, CodeTxt respects .gitignore
. Want to include ignored files? Just add --include-gitignored
.
6. Pipes & Outputs Like a Pro
Want to grep through your codebase via terminal?
codetxt . -o - | grep "function"
Real Use Cases That’ll Make Your Life Easier
Here are some real-world scenarios where CodeTxt shines:
Analyze Full Projects with AI
Need help understanding a new codebase fast? Run:
codetxt https://github.com/vuejs/core -o vue-core.txt
Then paste vue-core.txt
into Claude or ChatGPT and ask:
“Explain the architecture of this Vue 3 core module.”
Auto-Generate Docs
Feed the generated .txt
file to an LLM and say:
“Write comprehensive documentation for this project.”
Refactor or Debug with Context
Got a bug but not sure where it's coming from? Hand the full context to an AI model:
“Find potential memory leaks in this code.”
Train Custom Models
Want to fine-tune an LLM on your team’s coding style? CodeTxt gives you clean, consistent input data for training.
Search Across Codebases
Pipe the output into tools like grep
, ripgrep
, or indexers to perform advanced searches across huge repositories.
Quick Start Guide
Make sure you have Node.js v18+ installed, then install globally:
npm install -g codetxt
Now try one of these commands:
# Clone and analyze a remote repo
codetxt https://github.com/expressjs/express -o express.txt
# Analyze current directory
codetxt .
# Include only specific file types
codetxt . --include-pattern "**/*.ts"
Check out the full list of options here.
Built with Passion by Hassan Kerdash
This isn't just another utility script—it's a passion project born out of real developer pain points. Hassan Kerdash, a software engineer based in Egypt, created CodeTxt to bridge the gap between messy codebases and powerful AI tools.
He believes that every developer deserves better tools to work alongside AI, and he's giving it away for free, under the MIT license.
Final Thoughts: Why This Matters
No more fragmented prompts. No more missing context. Just clean, structured, AI-ready code, all at the tip of your fingers.
So if you’re a developer looking to level up your AI workflow, give CodeTxt a shot.
And hey, don’t forget to star the repo and share it with your fellow devs!
Spread the Word
Liked what you read? Help us get the word out:
- Share this article
- Star the repo on GitHub
- Follow Hassan Kerdash for more awesome tools
Let’s make AI collaboration easier, together.