103 lines
2.7 KiB
Markdown
103 lines
2.7 KiB
Markdown
---
|
|
name: ck-repomix
|
|
description: 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 `--include` to filter)
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
--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
|
|
|
|
```bash
|
|
# 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:
|
|
1. Always review output before sharing
|
|
2. Add `.repomixignore` for sensitive files
|
|
3. Never package `.env` files
|
|
4. Check for hardcoded credentials in output
|
|
|
|
## Resources
|
|
|
|
- GitHub: https://github.com/yamadashy/repomix
|
|
- Docs: https://repomix.com/guide/
|