Repomix
Pack an entire repository into a single AI-friendly XML or Markdown file with .gitignore filtering, secret scanning, and token counts.一键将整个代码仓库打包为适合喂给大模型的单文件(XML/Markdown),内置 .gitignore 过滤、密钥扫描与 Token 统计。
01 Friction Solved消除的小摩擦
When asking a long-context model for an architectural audit, security review, or refactor plan, manually copying twenty files into chat loses directory structure and risks accidentally pasting .env secrets. Repomix packages any local or remote repo cleanly while respecting ignore rules and running Secretlint checks locally.需要让长上下文大模型做全库架构评审、安全审计或重构方案时,手动复制几十个文件既丢失目录结构,又容易不小心把 .env 里的密钥贴出去。Repomix 会在本地自动遵循忽略规则、扫描敏感密钥,并生成带目录树和 Token 统计的单一上下文文件。
02 Best-Fit Scenarios最适合的使用场景
- Preparing a clean, structured codebase snapshot for deep architecture or security reviews in long-context LLMs.
- Onboarding onto an unfamiliar open-source GitHub repository in minutes via `npx repomix --remote owner/repo`.
- Checking exact per-file token budgets before deciding which folders to include in an automated review prompt.
- 为长上下文模型准备干净、带完整目录树的代码快照,用于全库架构评审或安全审计。
- 接手陌生开源项目时,用 `npx repomix --remote owner/repo` 快速生成结构化上下文并梳理核心脉络。
- 在构造自动化评审 Prompt 前,直观查看每个文件的 Token 占比,精准裁剪冗余目录。
03 Human & Agent Setup人类与 Agent 快速接入
# Pack current repository into repomix-output.xml (respects .gitignore)
npx repomix
# Compress to signatures/interfaces (~70% fewer tokens) in Markdown format
npx repomix --compress --style markdown --output context.md
# Pack a public GitHub repo directly without cloning
npx repomix --remote yamadashy/repomix --include "src/**/*.ts"
04 Reality Check & Trade-offs真实边界与局限
- Large monorepos easily exceed even 200K–1M token windows; always scope with --include/--ignore or enable --compress for big projects.
- Secretlint catches common API key patterns, but custom internal tokens or proprietary business data still require human review before sending to cloud models.
- Tree-sitter --compress strips function bodies—great for architecture maps, unsuitable when debugging a subtle line-level bug.
- 大型 Monorepo 打包后极易超出 200K–1M 上下文窗口,务必配合 --include/--ignore 限定范围或开启 --compress。
- 内置 Secretlint 能拦截常见格式的 API Key,但自定义内部凭证或敏感业务逻辑在发往云端模型前仍需人工核查。
- --compress 压缩模式会省略函数实现细节,适合全局架构梳理,不适合排查具体某一行代码 Bug。
05 Why VYAGENT Picked ItVYAGENT 选品评语
A clean Unix-style utility that bridges local Git repos and long-context models without forcing you into a proprietary IDE or cloud indexer.极具 Unix 哲学的干净小工具:不绑定任何商业 IDE 或云端索引服务,就能把本地 Git 仓库优雅地变成大模型可读上下文。
Need reversible redaction for emails, IPs, or customer names inside packed files? Run them locally in-browser with Oktangle AI PII Redactor.如果打包后的文本仍含客户邮箱、IP 或内部域名,可用 Oktangle 在浏览器本地做可逆脱敏后再粘贴。
Strip remaining PII locally before pasting into LLMs →发给云端大模型前用 Oktangle 做最后一道本地脱敏 →06 Frequently Asked Questions常见问题 (FAQ)
How does Repomix keep binary files and node_modules out of the bundle?Repomix 如何避免把二进制文件和 node_modules 打包进去?
It automatically honors .gitignore, .repomixignore, and default ignore lists for lockfiles, build artifacts, and binaries.它默认遵循 .gitignore、.repomixignore 以及内置忽略清单,会自动跳过 lockfile、构建产物与二进制文件。
Which output style works best for LLMs: XML, Markdown, or plain text?XML、Markdown 和纯文本三种导出格式选哪种更好?
XML is the default because explicit file tags help models avoid confusing code blocks with prompt instructions; Markdown is easier for humans to skim.默认推荐 XML,明确的文件边界标签能防止大模型把代码里的反引号误判为指令分隔符;若需要人眼快速通读可选 Markdown。