Repomix is a tool that packs repository contents into a single AI-friendly file. It supports four output formats (XML, Markdown, JSON, Plain Text), provides token counting, code compression (~70% reduction), and sensitive information detection. Can be run instantly via npx, supports GitHub remote repository processing and MCP server mode for seamless integration with AI tools like Claude and Cursor.
Core Features#
- Multiple Output Formats: XML (recommended for Claude), Markdown, JSON, Plain Text
- Code Compression: Tree-sitter based extraction of key code elements (classes, functions, interfaces), ~70% token reduction
- Token Management: Precise token counting and statistics tree visualization to manage LLM context limits
- Security Check: Integrated Secretlint for detecting API keys, passwords, and sensitive information
- Remote Processing: Process GitHub repositories without cloning, supports branch specification
- MCP Integration: Model Context Protocol support for AI tools like Claude and Cursor
- Output Splitting: Split large outputs into multiple files (e.g., --split-output 1mb)
- Git History: Optional inclusion of git commit history and diff information
Quick Start#
# Method 1: No installation needed, use npx (recommended)
npx repomix@latest
# Method 2: npm global install
npm install -g repomix
# Method 3: Homebrew (macOS/Linux)
brew install repomix
# Method 4: Docker
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
Common Commands#
repomix # Pack current directory
repomix path/to/directory # Pack specific directory
repomix --include "src/**/*.ts,**/*.md" # Include specific files
repomix --ignore "**/*.log,tmp/" # Exclude specific files
repomix --remote https://github.com/user/repo # Process remote repository
repomix --style markdown # Specify output format
repomix --compress # Enable code compression
repomix --split-output 20mb # Split large output
repomix --token-count-tree # Show token statistics tree
repomix --mcp # Run as MCP server
Configuration Example#
{
"$schema": "https://repomix.com/schemas/latest/schema.json",
"output": {
"filePath": "repomix-output.xml",
"style": "xml",
"compress": false,
"removeComments": false,
"tokenCountTree": false
},
"ignore": {
"useGitignore": true,
"useDefaultPatterns": true,
"customPatterns": ["additional-folder", "**/*.log"]
},
"security": {
"enableSecurityCheck": true
}
}
Typical Use Cases#
- Code review and quality assessment: Send entire codebase to AI for structure and quality analysis
- Refactoring suggestions and architecture analysis: Get AI-powered refactoring and optimization recommendations
- Documentation and test case auto-generation: Generate README, technical docs, and unit tests from codebase
- Quick understanding of third-party library architecture
- Context preparation for AI coding assistants
Key Dependencies#
@modelcontextprotocol/sdk- MCP server supporttiktoken- OpenAI official token countingweb-tree-sitter- Code structure parsing@secretlint/core- Security scanningcommander- CLI frameworkglobby- File pattern matching
Requirements#
- Node.js >= 20.0.0
- Or Docker environment