一个面向 Docker 部署与简体中文工作流的本地优先 Repomix Web UI 分支。
这个 fork 重点强化了本地部署、本地绝对路径浏览、Web UI 状态持久化,以及默认简体中文体验。
特别感谢:
想讨论用法?欢迎加入 Discord!
分享经验与技巧
了解新功能动态
获取配置与使用帮助
- 面向本地环境的 Docker Web UI 部署
- 默认提供简体中文入口体验
- 支持可信本地部署场景下的本地绝对路径打包
- 内置本地目录浏览器,可直接在 Web UI 中选择文件夹
- 页面状态持久化,可恢复上次模式、路径、选项与浏览位置
这个仓库是 yamadashy/repomix 的维护中分支。
- 上游项目仍然是 Repomix CLI 与官方托管网站的核心来源
- 这个 fork 在保留上游 CLI 行为的基础上,增加了本地部署与本地路径工作流增强
- 如果你想使用原版项目,请前往 yamadashy/repomix
- 如果你想使用本地 Web UI 变体,请使用 yeahhe365/repomix-local-webui
📦 Repomix 是一个可以把整个仓库打包成单个 AI 友好文件的强大工具。
它非常适合在你需要把完整代码库提供给大型语言模型(LLM)或其他 AI 工具时使用,例如 Claude、ChatGPT、DeepSeek、Perplexity、Gemini、Gemma、Llama、Grok 等。
如果你主要依赖核心 Repomix CLI,也欢迎支持上游 Repomix 项目。
这个仓库已经提供了一套中文文档,适合进一步查看细节:
- 入门指南
- 本地部署(Docker)
- 安装
- 基本用法
- 命令行选项
- 配置
- 输出格式
- MCP 服务器
- Claude Code 插件
- Agent Skills 生成
- Repomix Explorer Skill
- 提示词示例
- GitHub Actions
- 安全性
- 作为库使用
我们非常荣幸,Repomix 曾入围 JSNation Open Source Awards 2025 的 Powered by AI 类别。
这离不开每一位使用和支持 Repomix 的朋友,感谢大家!
- 在浏览器中体验 Repomix:repomix.com
- 加入 Discord 社区 获取帮助与交流
- 访问友链 LINUXDO 论坛 参与更多技术讨论
期待在那里见到你。
- AI 优化输出:将代码库整理为 AI 更容易理解和处理的格式
- Token 统计:支持统计单个文件和整个仓库的 token 数量,便于适配上下文窗口
- 简单易用:通常只需一条命令即可打包整个仓库
- 灵活可配置:可精细控制包含、排除、输出格式与附加信息
- Git 感知:自动遵循
.gitignore、.ignore与.repomixignore - 关注安全:集成 Secretlint 检测潜在敏感信息
- 代码压缩:
--compress基于 Tree-sitter 提取关键结构,在保留轮廓的同时减少 token
repomix npm 包和官方托管网站由上游 yamadashy/repomix 维护。这个 fork 保留了上游 CLI 的核心行为,同时把重点放在本地 Docker Web UI 工作流上。
你可以在项目目录中直接体验,无需预先安装:
npx repomix@latest也可以选择全局安装,便于重复使用:
# 使用 npm 安装
npm install -g repomix
# 或使用 yarn
yarn global add repomix
# 或使用 bun
bun add -g repomix
# 或使用 Homebrew(macOS/Linux)
brew install repomix
# 然后在任意项目目录中运行
repomix运行后,Repomix 会在当前目录生成一个 repomix-output.xml 文件,其中包含以 AI 友好格式整理的整个仓库内容。
你可以把这个文件发送给 AI 助手,并附上一段类似提示词:
这个文件包含了仓库中所有文件合并后的内容。
我想重构这份代码,请先帮我做一次整体审查。
当你进一步提出具体修改需求时,AI 通常就能基于这份完整上下文生成更准确的代码。像 Claude Artifacts 这类功能,甚至还能帮助你同时输出多个互相关联的文件。
这个 fork 最推荐的使用方式,是在本机通过 Docker 启动增强版 Web UI。
适合场景:
- 希望使用中文界面
- 需要直接处理本地绝对路径,例如
/Users/jones/Documents/Code/project - 想通过浏览器操作,但不希望把代码上传到第三方服务
在仓库根目录运行:
docker compose -f website/compose.docker.yml up --build启动后默认可访问:
- 前端:
http://localhost:5173 - 后端健康检查:
http://localhost:8080/health
默认本地部署配置会启用:
ENABLE_LOCAL_PATH_MODE=trueLOCAL_PATH_ALLOWLIST=/Users- 端口绑定到
127.0.0.1 - 宿主机目录只读挂载
这意味着:
- Web UI 可以浏览允许目录中的文件夹
- 后端只会读取白名单目录中的内容
- 默认只允许本机访问
- 不会修改宿主机文件
更多细节请查看 本地部署说明。
如果你只想快速体验,可以直接访问 repomix.com。输入仓库地址、填写可选项,然后点击 Pack 即可生成输出。
网站支持:
- 输出格式切换(XML、Markdown、JSON、纯文本)
- 即时 token 数估算
- 远程仓库处理
- 其他更多便捷能力
Repomix 提供浏览器扩展,可直接在 GitHub 仓库页面加入 “Repomix” 按钮:
- Chrome 扩展:Repomix - Chrome Web Store
- Firefox 扩展:Repomix - Firefox Add-ons
社区维护的 Repomix Runner 可以让你在 VSCode 中直接运行 Repomix。
它支持:
- 在任意文件夹上快速执行打包
- 便捷管理输出文件
- 与现有
repomix.config.json配合工作
扩展详情和源码:
- Marketplace:Repomix Runner
- GitHub:massdo/repomix-runner
如果你主要在 Python 生态中工作,也可以看看更偏向 Python / 数据科学场景的 Gitingest:
repomixrepomix path/to/directory使用 glob 模式:
repomix --include "src/**/*.ts,**/*.md"repomix --ignore "**/*.log,tmp/"repomix --remote https://github.com/yamadashy/repomix
# 也支持 GitHub 简写
repomix --remote yamadashy/repomix
# 指定分支、标签或提交
repomix --remote https://github.com/yamadashy/repomix --remote-branch main
repomix --remote https://github.com/yamadashy/repomix --remote-branch 935b695
# 直接使用分支 URL
repomix --remote https://github.com/yamadashy/repomix/tree/main
# 也支持提交 URL
repomix --remote https://github.com/yamadashy/repomix/commit/836abcd7335137228ad77feb28655d85712680f1Note
出于安全考虑,远程仓库中的 repomix.config.* 默认不会被加载。如果你确认该仓库可信,可以使用 --remote-trust-config 或设置 REPOMIX_REMOTE_TRUST_CONFIG=true。
当 --remote 与 --config 一起使用时,--config 需要传入绝对路径,例如 --config /home/user/repomix.config.json。
--stdin 允许你把文件路径列表通过管道传给 Repomix,适合按条件精确挑选文件。
# 使用 find
find src -name "*.ts" -type f | repomix --stdin
# 使用 git 获取已跟踪文件
git ls-files "*.ts" | repomix --stdin
# 使用 grep 查找包含指定内容的文件
grep -l "TODO" **/*.ts | repomix --stdin
# 使用 ripgrep 查找包含指定内容的文件
rg -l "TODO|FIXME" --type ts | repomix --stdin
# 使用 ripgrep 查找文件
rg --files --type ts | repomix --stdin
# 使用 fd
fd -e ts | repomix --stdin
# 使用 fzf 从所有文件中交互选择
fzf -m | repomix --stdin
# 交互式组合使用
find . -name "*.ts" -type f | fzf -m | repomix --stdin
# 使用 ls 和 glob
ls src/**/*.ts | repomix --stdin
# 从文件读取路径列表
cat file-list.txt | repomix --stdin
# 直接输入
echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin使用 --stdin 时:
- 文件路径可以是相对路径,也可以是绝对路径
- Repomix 会自动进行路径解析与去重
- 传入的文件会等效加入 include 范围
- 但 ignore 规则仍然生效,匹配忽略模式的文件依旧会被排除
# 包含 git 日志(默认最近 50 次提交)
repomix --include-logs
# 指定提交数量
repomix --include-logs --include-logs-count 10
# 同时包含工作区 diff
repomix --include-logs --include-diffs这能为 AI 提供更多代码演进背景,例如提交时间、提交说明与受影响文件。
repomix --compress
# 也可用于远程仓库
repomix --remote yamadashy/repomix --compress--compress 会基于 Tree-sitter 做智能提取,重点保留函数、类、接口等结构信息,同时尽量缩减实现细节对应的 token。
repomix --token-count-tree
# 仅显示大于等于 1000 token 的文件或目录
repomix --token-count-tree 1000这有助于你:
- 找出超大文件
- 更有针对性地设计
--include/--ignore - 决定是否需要
--compress - 为不同 AI 工具准备合适大小的上下文
当代码库较大时,可以使用 --split-output 自动把输出拆成多个文件:
repomix --split-output 1mb生成结果类似:
repomix-output.1.xmlrepomix-output.2.xmlrepomix-output.3.xml
支持的大小格式包括 500kb、1mb、2mb、1.5mb 等。
Note
为了保持上下文连续性,Repomix 会按顶级目录分组,不会把单个文件或目录拆散到多个输出文件中。
repomix --init打包完成后,你可以将结果交给 ChatGPT、Claude、DeepSeek、Perplexity、Gemini、Gemma、Llama、Grok 等生成式 AI 工具。下面是一些常见提示词:
这个文件包含了我的整个代码库。请从可维护性、可扩展性和整体结构出发,对它做一次完整审查,并给出重构建议。
请根据这个文件中的代码库内容,生成一份详细的 README.md,包括项目概览、主要功能、安装方式和使用示例。
请分析这份代码,并为主要函数和类设计一套完整的单元测试,包含边界情况和潜在错误场景。
请检查这份代码是否符合常见编码最佳实践与行业标准,指出在可读性、可维护性和效率方面还能改进的地方,并给出具体建议。
这个文件包含了整个库的代码。请给我一份高层概览,说明它的目标、核心功能和整体架构。
更多示例请参考 提示词示例文档。
Repomix 会生成一个单文件输出,并在文件中清晰分隔代码库的不同部分。为了便于 AI 理解,输出开头还会包含面向 AI 的说明文字。
repomix --style xmlXML 采用分层结构表达目录树、文件内容与附加说明,通常是最适合 AI 解析的默认格式。
repomix --style markdownMarkdown 更方便人类直接阅读,也适合在支持 Markdown 的 AI 工具里使用。
repomix --style jsonJSON 适合程序化处理、API 集成、jq 检索和结构化分析。
常见 jq 示例:
# 列出所有文件路径
cat repomix-output.json | jq -r '.files | keys[]'
# 统计文件总数
cat repomix-output.json | jq '.files | keys | length'
# 提取某个文件内容
cat repomix-output.json | jq -r '.files["README.md"]'repomix --style plain纯文本格式适合对格式要求较低、但希望保持可读性的场景。
更多格式细节请参考 输出格式文档。
Repomix 支持 Model Context Protocol (MCP),允许 AI 助手直接与你的代码库交互,无需先手动准备打包文件。
启动 MCP 服务器:
repomix --mcpVS Code:
code --add-mcp '{"name":"repomix","command":"npx","args":["-y","repomix","--mcp"]}'VS Code Insiders:
code-insiders --add-mcp '{"name":"repomix","command":"npx","args":["-y","repomix","--mcp"]}'Cline / Claude Desktop / 类似客户端配置:
{
"mcpServers": {
"repomix": {
"command": "npx",
"args": [
"-y",
"repomix",
"--mcp"
]
}
}
}Claude Code:
claude mcp add repomix -- npx -y repomix --mcp或者也可以直接使用官方 Repomix 插件,见下文的 Claude Code 插件。
Docker 方式:
{
"mcpServers": {
"repomix-docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/yamadashy/repomix",
"--mcp"
]
}
}
}当作为 MCP 服务器运行时,Repomix 主要提供以下工具:
pack_codebase将本地目录打包成适合 AI 分析的输出。attach_packed_output直接附加已经生成好的 Repomix 输出文件。pack_remote_repository拉取并打包 GitHub 远程仓库。read_repomix_output按行读取 Repomix 输出文件,适合大文件分段浏览。grep_repomix_output使用 JavaScript RegExp 搜索打包输出中的内容。file_system_read_file通过绝对路径安全读取本地文件,内置敏感信息检查。file_system_read_directory安全列出目录内容,帮助 AI 浏览本地项目结构。
详细说明见 MCP 服务器文档。
Repomix 为 Claude Code 提供官方插件,可以直接在 Claude Code 中使用自然语言分析和打包代码库。
先添加 Repomix 插件市场:
/plugin marketplace add yamadashy/repomix
再安装需要的插件:
# MCP 服务器插件(推荐作为基础)
/plugin install repomix-mcp@repomix
# 命令插件
/plugin install repomix-commands@repomix
# 仓库探索器插件
/plugin install repomix-explorer@repomix
也可以直接运行:
/plugin
通过交互式界面浏览和安装可用插件。
repomix-mcp提供基于 MCP 的代码库分析基础能力。repomix-commands提供便捷的斜杠命令,例如打包本地或远程仓库。repomix-explorer提供 AI 驱动的仓库探索能力,可按自然语言指令分析代码结构。
详细说明见 Claude Code 插件文档。
Repomix 可以生成 Claude Agent Skills 格式的输出,把代码库整理成可复用的技能目录,适合作为 AI 助手的长期参考资料。
# 从本地目录生成 Skills
repomix --skill-generate
# 指定 Skills 名称
repomix --skill-generate my-project-reference
# 从远程仓库生成 Skills
repomix --remote https://github.com/user/repo --skill-generate运行后,Repomix 会提示你选择保存位置:
- 个人 Skills:
~/.claude/skills/ - 项目 Skills:
.claude/skills/
# 直接指定输出目录
repomix --skill-generate --skill-output ./my-skills
# 跳过覆盖确认
repomix --skill-generate --skill-output ./my-skills --force
# 远程仓库完整示例
repomix --remote user/repo --skill-generate my-skill --skill-output ./output --force.claude/skills/<skill-name>/
├── SKILL.md
└── references/
├── summary.md
├── project-structure.md
├── files.md
└── tech-stacks.md
更多说明请查看 Agent Skills 生成文档。
Repomix 还提供了现成可用的 Repomix Explorer skill,方便在 Claude Code、Cursor、Codex、GitHub Copilot 等 AI 编码助手中探索仓库。
快速安装:
npx add-skill yamadashy/repomix --skill repomix-explorer示例:
"这个仓库的结构是什么?
https://github.com/facebook/react"
"这个项目里都有什么?
~/projects/my-app"
详情见 Repomix Explorer Skill 文档。
Repomix 支持多种配置文件格式,并会按以下优先级自动查找:
- TypeScript:
repomix.config.ts、repomix.config.mts、repomix.config.cts - JavaScript / ES Module:
repomix.config.js、repomix.config.mjs、repomix.config.cjs - JSON:
repomix.config.json5、repomix.config.jsonc、repomix.config.json
repomix --initrepomix --init --global// repomix.config.ts
import { defineConfig } from 'repomix';
export default defineConfig({
output: {
filePath: 'output.xml',
style: 'xml',
removeComments: true,
},
ignore: {
customPatterns: ['**/node_modules/**', '**/dist/**'],
},
});output.filePath设置输出文件路径output.style输出格式,可选xml、markdown、json、plainoutput.compress是否启用 Tree-sitter 压缩output.removeComments是否删除支持语言中的注释output.showLineNumbers是否在输出中显示行号output.includeFullDirectoryStructure在使用include时,是否仍显示完整目录树output.git.includeDiffs是否包含 Git diffoutput.git.includeLogs是否包含 Git 日志include包含模式ignore.customPatterns自定义忽略模式security.enableSecurityCheck是否启用 Secretlint 安全检查tokenCount.encodingtoken 计数编码,例如o200k_base
{
"$schema": "https://repomix.com/schemas/latest/schema.json",
"output": {
"filePath": "repomix-output.xml",
"style": "xml"
}
}如果你想在输出末尾附加项目上下文或编码规范,可以使用 output.instructionFilePath:
# Coding Guidelines
- Follow the Airbnb JavaScript Style Guide
- Suggest splitting files into smaller, focused units when appropriate
- Add comments for non-obvious logic. Keep all text in English
- All new features should have corresponding unit tests配置方式:
{
"output": {
"instructionFilePath": "repomix-instruction.md"
}
}当 output.removeComments 为 true 时,Repomix 会尝试删除支持语言中的注释,以减少输出体积和噪音。
目前支持的语言包括:
- HTML
- CSS
- JavaScript / TypeScript
- Vue / Svelte
- Python / PHP / Ruby
- C / C# / Java / Go / Rust / Swift / Kotlin / Dart
- Shell / YAML
完整配置说明请参考 配置文档。
Repomix 集成了基于 Secretlint 的安全检查,用于在打包前发现潜在敏感信息,例如 API Key、密码或测试用密钥。
示例输出:
🔍 Security Check:
──────────────────
2 suspicious file(s) detected:
1. src/utils/test.txt
2. tests/utils/secretLintUtils.test.ts
Please review these files for potentially sensitive information.
默认情况下,安全检查处于启用状态。你可以通过配置文件关闭:
{
"security": {
"enableSecurityCheck": false
}
}或使用命令行参数:
repomix --no-security-checkNote
关闭安全检查可能导致敏感信息被打包并分享出去。只有在你确认当前场景安全时才建议关闭。
更多细节请参考 安全文档。
你也可以在 GitHub Actions 里使用 Repomix,把代码库打包流程自动化。
基础示例:
- name: Pack repository with Repomix
uses: yamadashy/repomix/.github/actions/repomix@main
with:
output: repomix-output.xml
style: xml指定 Markdown 输出:
- name: Pack repository with Repomix
uses: yamadashy/repomix/.github/actions/repomix@main
with:
output: repomix-output.md
style: markdown压缩并上传产物:
- name: Pack repository with Repomix
uses: yamadashy/repomix/.github/actions/repomix@main
with:
directories: src
output: repomix-output.txt
compress: true
- name: Upload Repomix output
uses: actions/upload-artifact@v4
with:
name: repomix-output
path: repomix-output.txt更多内容见 GitHub Actions 文档。
除了 CLI 之外,你也可以在 Node.js 应用中把 Repomix 当作库使用。
npm install repomiximport { runCli, type CliOptions } from 'repomix';
async function packProject() {
const options = {
output: 'output.xml',
style: 'xml',
compress: true,
quiet: true
} as CliOptions;
const result = await runCli(['.'], process.cwd(), options);
return result.packResult;
}import { runCli, type CliOptions } from 'repomix';
async function processRemoteRepo(repoUrl) {
const options = {
remote: repoUrl,
output: 'output.xml',
compress: true
} as CliOptions;
return await runCli(['.'], process.cwd(), options);
}import { searchFiles, collectFiles, processFiles, TokenCounter } from 'repomix';
async function analyzeFiles(directory) {
const { filePaths } = await searchFiles(directory, { /* config */ });
const rawFiles = await collectFiles(filePaths, directory);
const processedFiles = await processFiles(rawFiles, { /* config */ });
const tokenCounter = new TokenCounter('o200k_base');
return processedFiles.map(file => ({
path: file.path,
tokens: tokenCounter.countTokens(file.content)
}));
}打包工具(如 Rolldown、esbuild)集成时,还需要注意:
tinypool这类依赖需要保持 externalweb-tree-sitter.wasm需要复制到打包产物对应目录- Tree-sitter 语言文件目录由
REPOMIX_WASM_DIR指定
可参考:
更多内容见 作为库使用文档。
这里整理了一些社区围绕 Repomix 构建的项目:
- Repomix Runner - 用于 VSCode 的扩展,可将文件打包为单个 AI 分析输出
- Repomix Desktop - 使用 Python 和 CustomTkinter 构建的桌面版 GUI
- Python Repomix - 基于 AST 压缩的 Python 实现
- Rulefy - 将 GitHub 仓库转换为 Cursor 规则
- Codebase MCP - 基于 Repomix 的 MCP 代码库分析服务
- vibe-tools - 带有 Web 搜索、仓库分析和浏览器自动化能力的 AI Agent CLI 工具集
更多社区项目请查看 Community Projects 文档。
欢迎社区参与贡献。开始之前请先阅读 Contributing Guide。
请查看 Privacy Policy。
本项目基于 MIT License 开源。



