@dohmboy64bit/pi-repomix
v1.3.1
Published
Pack repository contents into a single AI-friendly file. Supports compression, security scanning, git integration, and multiple output formats.
Maintainers
Readme
Pi Repomix Extension
Pack repository contents into a single AI-friendly file for LLM consumption
Overview
Pi Repomix is a powerful Pi agent extension that packs entire codebases into a single, optimized file perfect for AI/LLM consumption. It intelligently compresses code, removes boilerplate, scans for security issues, and generates clean output in multiple formats.
Why Repomix?
- 70% token reduction through intelligent code compression
- Security scanning to exclude sensitive data
- Multiple output formats (XML, Markdown, JSON, Plain text)
- Git integration with diff and commit history
- Config-driven with
.repomix.jsonsupport
Quick Start
Installation
From npm (recommended):
pi install npm:@dohmboy64bit/pi-repomixOr add to Pi settings:
{
"packages": [
"npm:@dohmboy64bit/pi-repomix"
]
}From local development:
pi install ./path/to/pi-repomixOr add the local path to settings.json:
{
"packages": [
"./path/to/pi-repomix"
]
}Usage
As a Tool
Call the repomix tool with your desired parameters:
repomix(
directory: "path/to/project",
style: "xml",
compress: true,
fileSummary: true
)As a Command
Run the /repomix command in the Pi TUI:
/repomix ./my-project --compress --style markdownGitHub URL Support
Both the tool and command accept GitHub repository URLs in addition to local directories:
Tool:
{
"directory": "https://github.com/owner/repo"
}Command:
/repomix https://github.com/owner/repo --compressWhen a GitHub URL is provided:
- The repository is cloned using
git clone --depth 1to a temporary directory - Configuration (
.repomix.json) is loaded from your local directory (not the cloned repo), so you can use your project's config for remote repos - The
cleanupRepoparameter controls cleanup behavior:true(default): removes the cloned repository on successfalse: keeps the cloned repository for inspection- On failure: the repository is always left behind for debugging (regardless of
cleanupReposetting)
- Output is saved to your local directory (
./repomix/<repo-name>-repomix.txt), not the temp directory - Only GitHub URLs are supported (format:
https://github.com/owner/repo)
CLI flag: --cleanup-repo (default) / --no-cleanup-repo
Basic Examples
| Use Case | Command |
|----------|---------|
| Pack current directory | repomix() |
| Pack with compression | repomix({ directory: "./project", compress: true }) |
| Markdown output | repomix({ style: "markdown" }) |
| Include git diffs | repomix({ gitIncludeDiffs: true }) |
| Pack remote GitHub repo | repomix({ directory: "https://github.com/owner/repo" }) |
| Keep cloned repo | repomix({ directory: "https://github.com/owner/repo", cleanupRepo: false }) |
Key Features
🗜️ Intelligent Compression
Reduce output by ~70% while preserving code structure and signatures.
{
"compress": true
}Supported languages: TypeScript, JavaScript, Python, Ruby, Go, Rust, Java, C/C++, PHP, Swift, Kotlin, and 10+ more.
🔒 Security Scanning
Automatically detects and flags sensitive data:
- API keys and tokens (GitHub, GitLab, Slack, AWS, etc.)
- Passwords and connection strings
- Private keys and JWT tokens
- Database credentials
{
"securityCheck": true
}📊 Rich Output
Generate comprehensive output with:
- File summary with token/line counts
- Directory tree with emojis
- Custom headers and instructions
- Line numbers (optional)
{
"fileSummary": true,
"directoryStructure": true,
"showLineNumbers": false
}📈 Git Integration
Leverage git history for smarter output:
- Include diffs of uncommitted changes
- Commit logs with file changes
- Sort by change frequency to highlight active files
{
"gitIncludeDiffs": true,
"gitIncludeLogs": true,
"gitSortByChanges": true
}📂 Dynamic Output Filename
By default, Repomix generates an output file with a dynamic name based on the repository:
<target-dir>/repomix/<repo-name>-repomix.txt(local directories)./repomix/<repo-name>-repomix.txt(GitHub URLs — output always goes to your local directory)
The repo name is resolved automatically using these sources (in order of priority):
package.jsonname field (scoped packages like@scope/namebecomescope-name).git/configremote URL (extractsowner-repofrom SSH format[email protected]:owner/repo.gitor HTTPS formathttps://github.com/owner/repo.git)- Directory name as fallback
You can also specify a custom output path:
{
"output": "custom-output.xml"
}🎨 Multiple Output Formats
Choose the format that best fits your workflow:
plain- Simple text with headersxml- Structured XML formatmarkdown- Markdown documentjson- Parseable JSON
Configuration
Config File
Create .repomix.json in your project root:
{
"style": "xml",
"compress": true,
"fileSummary": true,
"ignore": ["**/*.log"],
"securityCheck": true
}CLI Options
/repomix ./project \
--style xml \
--compress \
--remove-comments \
--git-include-diffs \
--output repomix/custom-output.xmlOutput Structure
The generated output includes:
- Header - Repository info and generation timestamp
- Summary - File count, token count, line count, top files
- Directory Tree - Visual tree structure
- File Contents - Compressed/processed file code
- Security Report - Flagged files (if any)
Advanced Features
Per-Pattern Compression
Fine-tune compression per file pattern:
{
"patterns": [
{
"pattern": "**/*.ts",
"compress": true
},
{
"pattern": "**/config/*.json",
"compress": false
}
]
}Output Splitting
Split large outputs into manageable chunks:
{
"splitOutput": 50000000
}Creates repomix/myproject-repomix-1.txt, repomix/myproject-repomix-2.txt, etc. (based on the dynamic repo name).
Custom Instructions
Add custom instructions from a file:
{
"instructionFilePath": "./docs/repomix-instructions.md"
}Documentation
- Features - Complete feature reference with all parameters
- Configuration - Config file format and options
- Git Integration - Git features and options
- Security - Security scanning patterns and configuration
Development
Project Structure
Pi Extensions/
├── index.ts # Extension entry point
├── tool/ # Tool handler and parameters
├── config/ # Configuration loading and merging
├── scan/ # File scanning and reading
├── process/ # File processing and compression
├── output/ # Output generation
├── security/ # Security scanning
├── git/ # Git integration
├── command/ # CLI command handler
└── test/ # Test suitesRunning Tests
npm testBuilding
npm run buildLicense
MIT License - see LICENSE file for details.
Repository packing for AI agents
