2.7 KiB
2.7 KiB
name, description
| name | description |
|---|---|
| ck-repomix | Pack repositories into AI-friendly files with Repomix. Use for codebase snapshots, LLM context preparation, security audits, third-party library analysis, and bug investigation across large codebases. |
Repomix
Packs entire repositories into single AI-friendly files (XML, Markdown, plain text) for LLM context.
When to Use
- Packaging a codebase for AI analysis or review
- Preparing repository context for LLM prompts
- Analyzing third-party libraries before adoption
- Running security audits on unknown codebases
- Investigating bugs spanning multiple files
Don't Use When
- Repository contains secrets that must not be shared (always review output first)
- Codebase exceeds target LLM context limit (use
--includeto filter)
Quick Start
# Package current directory (outputs repomix-output.xml)
repomix
# Markdown format
repomix --style markdown
# Remote repository (no clone needed)
npx repomix --remote owner/repo
# Filtered output
repomix --include "src/**/*.ts" --remove-comments -o output.md
Common Workflows
# AI code review (TypeScript only, no comments)
repomix --include "src/**/*.ts" --remove-comments -o review.md --style markdown
# Security audit of third-party lib
npx repomix --remote vendor/library --style xml -o audit.xml
# Bug investigation (specific modules)
repomix --include "src/auth/**,src/api/**" -o debug-context.xml
# Full codebase for planning
repomix --remove-comments --copy
Output Formats
| Flag | Format | Best For |
|---|---|---|
--style xml |
XML | Default, Claude/GPT |
--style markdown |
Markdown | Readable review |
--style json |
JSON | Programmatic use |
--style plain |
Plain text | Simple context |
Key Options
--include "src/**/*.ts,*.md" # Include patterns
-i "tests/**,*.test.js" # Ignore patterns
--remove-comments # Strip all comments
--copy # Copy to clipboard
-o output.md # Output file path
--no-gitignore # Disable .gitignore rules
--token-count-tree # Show token distribution
--no-security-check # Skip Secretlint checks
Token Management
# Visualize token distribution
repomix --token-count-tree
# Focus on files >1000 tokens
repomix --token-count-tree 1000
Context limits: Claude ~200K tokens, GPT-4 ~128K tokens
Security
Repomix uses Secretlint to detect API keys, passwords, private keys, AWS secrets.
Best practices:
- Always review output before sharing
- Add
.repomixignorefor sensitive files - Never package
.envfiles - Check for hardcoded credentials in output