repo-text
v2.0.0
Published
The lightest LLM context packer. Pack your entire repo into a single AI-ready file. 100x smaller than repomix, zero bloat.
Maintainers
Readme
repo-text ⚡
The lightest LLM context packer. Pack your entire codebase into a single AI-ready file — XML, Markdown, or Plain Text.
100x smaller than repomix. Zero bloat. Instant startup.
npx repo-textWhy repo-text?
| | repo-text | repomix | |---|---|---| | 📦 Package Size | ~6 KB | 604 KB | | 🔗 Dependencies | 1 | 27+ | | 💾 Install Size | ~150 KB | ~50+ MB | | ⚡ Startup Time | ~50ms | ~500ms+ | | 🧠 Output Formats | XML, Markdown, Plain | XML, Markdown, JSON, Plain | | 🌳 Directory Tree | ✅ | ✅ | | 🗜️ Compression | ✅ (regex-based) | ✅ (tree-sitter) | | 📋 Clipboard Copy | ✅ (native) | ✅ | | 🔒 Secret Detection | ✅ (built-in) | ✅ (secretlint) | | 🔢 Token Counting | ✅ (BPE approx) | ✅ (gpt-tokenizer) | | 📁 Binary Detection | ✅ | ✅ | | ⚙️ Config File | ✅ | ✅ | | 🔍 Include/Exclude | ✅ | ✅ |
Same features. 100x lighter.
Installation
# Use directly with npx (recommended)
npx repo-text
# Or install globally
npm install -g repo-textQuick Start
# Pack current directory (plain text)
repo-text
# XML format with directory tree
repo-text --style xml --tree
# Markdown with compression (strips function bodies)
repo-text --style markdown --compress
# Copy to clipboard
repo-text --copy
# Only include source files
repo-text --include "src/**" --include "lib/**"
# Exclude tests
repo-text --exclude "**/*.test.js" --exclude "**/*.spec.ts"Output Formats
Plain Text (default)
================================================================
Project: my-app
Generated by: repo-text v2.0.0
================================================================
════════════════════════════════════════════════════════════════
File: src/index.js
════════════════════════════════════════════════════════════════
const app = express();
...XML (--style xml)
<?xml version="1.0" encoding="UTF-8"?>
<repository>
<metadata>
<name>my-app</name>
<generator>repo-text v2.0.0</generator>
</metadata>
<files>
<file path="src/index.js" language="javascript">
<content><![CDATA[const app = express();]]></content>
</file>
</files>
</repository>Markdown (--style markdown)
# my-app
> Generated by **repo-text** v2.0.0
## Files
### `src/index.js`
```javascript
const app = express();
```CLI Reference
Usage:
repo-text [options] [output-file]
flatter [options] [output-file]
flatten [options] [output-file]
Output:
-o, --output <file> Output file path (default: repo-text-output.<style>)
-s, --style <format> Output format: plain, xml, markdown (default: plain)
--tree Include directory tree at the top
--line-numbers Add line numbers to file contents
--compress Strip function bodies, keep signatures (~50% smaller)
--no-comments Remove code comments from output
Filtering:
--include <glob> Only include files matching pattern (repeatable)
--exclude <glob> Exclude files matching pattern (repeatable)
--max-size <KB> Skip files larger than N KB (default: 500)
Extras:
-c, --copy Copy output to clipboard
--no-tokens Hide token count
--no-security-check Skip secret detection scan
--config <path> Path to config file
--verbose Show skipped files and detailed stats
Info:
-v, --version Show version
-h, --help Show this helpConfig File
Create repo-text.config.json in your project root:
{
"style": "xml",
"tree": true,
"compress": false,
"copy": false,
"lineNumbers": false,
"noComments": false,
"maxSize": 500,
"include": ["src/**", "lib/**"],
"exclude": ["**/*.test.js", "**/__mocks__/**"]
}All CLI flags override config file values.
Smart Defaults
repo-text automatically:
- ✅ Respects
.gitignore - ✅ Skips binary files (images, videos, archives, fonts, etc.)
- ✅ Skips lock files (
package-lock.json,yarn.lock, etc.) - ✅ Skips build folders (
dist,build,.next, etc.) - ✅ Skips dependency folders (
node_modules,vendor,venv, etc.) - ✅ Skips files larger than 500KB (configurable)
- ✅ Scans for accidentally committed secrets
- ✅ Strips trailing whitespace and collapses blank lines
Compression (--compress)
The --compress flag uses regex-based analysis to strip function and method bodies while keeping signatures, imports, and type declarations. This reduces token usage by ~50% while preserving the structural context that LLMs need.
Supported languages: JavaScript, TypeScript, Python, Go, Rust, Java, Kotlin, C#, Dart
# Normal output: ~10,000 tokens
repo-text --style xml
# Compressed output: ~5,000 tokens
repo-text --style xml --compressSecurity Scanning
repo-text automatically scans for common secrets and warns you before they end up in your LLM context:
- AWS Access Keys & Secret Keys
- GitHub/GitLab Personal Access Tokens
- Slack Tokens
- Private Keys (RSA, EC, DSA)
- API Keys and Secrets
- Database Connection Strings
- Stripe Keys
- Google API Keys
- JWTs
Suppress with --no-security-check.
Aliases
repo-text registers three commands for convenience:
repo-text # primary
flatter # short
flatten # alternativeContributing
Issues and PRs welcome at github.com/Elayaraman/repo-text.
License
MIT © Elayaraman
