repomix
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRepomix Skill
Repomix Skill
Repomix packs entire repositories into single, AI-friendly files. Perfect for feeding codebases to LLMs like Claude, ChatGPT, and Gemini.
Repomix 可将整个代码仓库打包为单个AI友好型文件,非常适合将代码库提供给Claude、ChatGPT和Gemini等LLM使用。
When to Use
适用场景
Use when:
- Packaging codebases for AI analysis
- Creating repository snapshots for LLM context
- Analyzing third-party libraries
- Preparing for security audits
- Generating documentation context
- Investigating bugs across large codebases
- Creating AI-friendly code representations
适用于以下场景:
- 为AI分析打包代码库
- 为LLM上下文创建仓库快照
- 分析第三方库
- 准备安全审计
- 生成文档上下文
- 排查跨大型代码库的Bug
- 创建AI友好型代码表示
Quick Start
快速开始
Check Installation
检查安装
bash
repomix --versionbash
repomix --versionInstall
安装
bash
undefinedbash
undefinednpm
npm
npm install -g repomix
npm install -g repomix
Homebrew (macOS/Linux)
Homebrew (macOS/Linux)
brew install repomix
undefinedbrew install repomix
undefinedBasic Usage
基础用法
bash
undefinedbash
undefinedPackage current directory (generates repomix-output.xml)
打包当前目录(生成repomix-output.xml)
repomix
repomix
Specify output format
指定输出格式
repomix --style markdown
repomix --style json
repomix --style markdown
repomix --style json
Package remote repository
打包远程仓库
npx repomix --remote owner/repo
npx repomix --remote owner/repo
Custom output with filters
带过滤规则的自定义输出
repomix --include "src/**/*.ts" --remove-comments -o output.md
undefinedrepomix --include "src/**/*.ts" --remove-comments -o output.md
undefinedCore Capabilities
核心功能
Repository Packaging
仓库打包
- AI-optimized formatting with clear separators
- Multiple output formats: XML, Markdown, JSON, Plain text
- Git-aware processing (respects .gitignore)
- Token counting for LLM context management
- Security checks for sensitive information
- 采用AI优化格式,带有清晰分隔符
- 多种输出格式:XML、Markdown、JSON、纯文本
- 支持Git感知处理(遵循.gitignore规则)
- 用于LLM上下文管理的Token计数
- 敏感信息安全检查
Remote Repository Support
远程仓库支持
Process remote repositories without cloning:
bash
undefined无需克隆即可处理远程仓库:
bash
undefinedShorthand
简写形式
npx repomix --remote yamadashy/repomix
npx repomix --remote yamadashy/repomix
Full URL
完整URL
npx repomix --remote https://github.com/owner/repo
npx repomix --remote https://github.com/owner/repo
Specific commit
指定提交版本
npx repomix --remote https://github.com/owner/repo/commit/hash
undefinednpx repomix --remote https://github.com/owner/repo/commit/hash
undefinedComment Removal
移除注释
Strip comments from supported languages (HTML, CSS, JavaScript, TypeScript, Vue, Svelte, Python, PHP, Ruby, C, C#, Java, Go, Rust, Swift, Kotlin, Dart, Shell, YAML):
bash
repomix --remove-comments可移除支持语言的注释(HTML、CSS、JavaScript、TypeScript、Vue、Svelte、Python、PHP、Ruby、C、C#、Java、Go、Rust、Swift、Kotlin、Dart、Shell、YAML):
bash
repomix --remove-commentsCommon Use Cases
常见使用场景
Code Review Preparation
代码审查准备
bash
undefinedbash
undefinedPackage feature branch for AI review
打包特性分支用于AI审查
repomix --include "src/**/*.ts" --remove-comments -o review.md --style markdown
undefinedrepomix --include "src/**/*.ts" --remove-comments -o review.md --style markdown
undefinedSecurity Audit
安全审计
bash
undefinedbash
undefinedPackage third-party library
打包第三方库
npx repomix --remote vendor/library --style xml -o audit.xml
undefinednpx repomix --remote vendor/library --style xml -o audit.xml
undefinedDocumentation Generation
文档生成
bash
undefinedbash
undefinedPackage with docs and code
打包文档和代码
repomix --include "src/,docs/,*.md" --style markdown -o context.md
undefinedrepomix --include "src/,docs/,*.md" --style markdown -o context.md
undefinedBug Investigation
Bug排查
bash
undefinedbash
undefinedPackage specific modules
打包特定模块
repomix --include "src/auth/,src/api/" -o debug-context.xml
undefinedrepomix --include "src/auth/,src/api/" -o debug-context.xml
undefinedImplementation Planning
实施规划
bash
undefinedbash
undefinedFull codebase context
完整代码库上下文
repomix --remove-comments --copy
undefinedrepomix --remove-comments --copy
undefinedCommand Line Reference
命令行参考
File Selection
文件选择
bash
undefinedbash
undefinedInclude specific patterns
包含特定模式
repomix --include "src/**/.ts,.md"
repomix --include "src/**/.ts,.md"
Ignore additional patterns
忽略额外模式
repomix -i "tests/**,*.test.js"
repomix -i "tests/**,*.test.js"
Disable .gitignore rules
禁用.gitignore规则
repomix --no-gitignore
undefinedrepomix --no-gitignore
undefinedOutput Options
输出选项
bash
undefinedbash
undefinedOutput format
输出格式
repomix --style markdown # or xml, json, plain
repomix --style markdown # 或 xml, json, plain
Output file path
输出文件路径
repomix -o output.md
repomix -o output.md
Remove comments
移除注释
repomix --remove-comments
repomix --remove-comments
Copy to clipboard
复制到剪贴板
repomix --copy
undefinedrepomix --copy
undefinedConfiguration
配置
bash
undefinedbash
undefinedUse custom config file
使用自定义配置文件
repomix -c custom-config.json
repomix -c custom-config.json
Initialize new config
初始化新配置
repomix --init # creates repomix.config.json
undefinedrepomix --init # 创建repomix.config.json
undefinedToken Management
Token管理
Repomix automatically counts tokens for individual files, total repository, and per-format output.
Typical LLM context limits:
- Claude Sonnet 4.5: ~200K tokens
- GPT-4: ~128K tokens
- GPT-3.5: ~16K tokens
Repomix会自动统计单个文件、整个仓库以及各格式输出的Token数量。
典型LLM上下文限制:
- Claude Sonnet 4.5: ~200K tokens
- GPT-4: ~128K tokens
- GPT-3.5: ~16K tokens
Security Considerations
安全注意事项
Repomix uses Secretlint to detect sensitive data (API keys, passwords, credentials, private keys, AWS secrets).
Best practices:
- Always review output before sharing
- Use for sensitive files
.repomixignore - Enable security checks for unknown codebases
- Avoid packaging files
.env - Check for hardcoded credentials
Disable security checks if needed:
bash
repomix --no-security-checkRepomix使用Secretlint检测敏感数据(API密钥、密码、凭证、私钥、AWS密钥等)。
最佳实践:
- 分享前务必检查输出内容
- 使用.repomixignore忽略敏感文件
- 对未知代码库启用安全检查
- 避免打包.env文件
- 检查是否存在硬编码凭证
如需禁用安全检查:
bash
repomix --no-security-checkImplementation Workflow
实施流程
When user requests repository packaging:
-
Assess Requirements
- Identify target repository (local/remote)
- Determine output format needed
- Check for sensitive data concerns
-
Configure Filters
- Set include patterns for relevant files
- Add ignore patterns for unnecessary files
- Enable/disable comment removal
-
Execute Packaging
- Run repomix with appropriate options
- Monitor token counts
- Verify security checks
-
Validate Output
- Review generated file
- Confirm no sensitive data
- Check token limits for target LLM
-
Deliver Context
- Provide packaged file to user
- Include token count summary
- Note any warnings or issues
当用户请求仓库打包时:
-
需求评估
- 确定目标仓库(本地/远程)
- 确认所需输出格式
- 检查敏感数据相关顾虑
-
配置过滤规则
- 设置相关文件的包含模式
- 添加不必要文件的忽略模式
- 启用/禁用注释移除
-
执行打包
- 使用合适选项运行repomix
- 监控Token计数
- 验证安全检查结果
-
验证输出
- 检查生成的文件
- 确认无敏感数据
- 核对目标LLM的Token限制
-
交付上下文
- 向用户提供打包后的文件
- 包含Token计数摘要
- 标注任何警告或问题
Reference Documentation
参考文档
For detailed information, see:
- Configuration Reference - Config files, include/exclude patterns, output formats, advanced options
- Usage Patterns - AI analysis workflows, security audit preparation, documentation generation, library evaluation
如需详细信息,请查看:
- 配置参考 - 配置文件、包含/排除模式、输出格式、高级选项
- 使用模式 - AI分析工作流、安全审计准备、文档生成、库评估
Additional Resources
更多资源
- GitHub: https://github.com/yamadashy/repomix
- Documentation: https://repomix.com/guide/
- MCP Server: Available for AI assistant integration
- GitHub: https://github.com/yamadashy/repomix
- 文档: https://repomix.com/guide/
- MCP Server: 可用于AI助手集成