repomix Detailed Guide
Version 1.18.0~1.18.0 | Category runtime | Security (reviewed) | Sources: official project docs (English README) + local measurements (2026-08-29/30)
Companion: site docs (manifest + guide + evidence) | Quick version: site docs
1. Scenario: when to use it
You want AI to see a whole repository at once — code review, documentation, cross-repo comparison. The problem: repos run to tens of thousands of lines, the AI context window is limited, and force-feeding either truncates or drops files. repomix packs the entire repository into a single file with token-budget control (--compress to compress, --include to scope), acting as the input-side "feeding" tool for AI analysis.
Use it when:
- You want to pack a repo (or a scoped subset) for AI analysis/review;
- You need to control the token budget (big repos: --compress + --include);
- You want a single-file output to share/archive;
- You are using combo-ai-code-review (repomix + code-review-graph + swe-rex) as its input side: pack → review → sandbox verify.
Don't use it when: the repo is huge and you don't need everything — scope with --include; or you only need a single file's content — just hand the file over, no packing needed.
China network reality: the npm package installs instantly with the npmmirror prefix (measured 2026-08-29); the single-binary Release lives on GitHub (not tested, slow to reach directly).
2. Capability list
| Capability | What it does |
|---|---|
| Repo packing | Entire repository → single file (measured) |
| Token budget control | --compress (measured), --include scoping (measured 2026-08-30) |
| Output path | --output (measured) |
| Config generation | --init generates repomix.config.json (measured 2026-08-30) |
| No-install form | npx -y repomix (measured) |
| Security scan | automatic check while packing (No suspicious files) |
3. Quick install
# Source: Trove detailed guide · verified 2026-08-29
npm_config_registry=https://registry.npmmirror.com npm install -g repomix
repomix --version
Expected output: 1.18.0 (measured 2026-08-29)
Prerequisites: Node >= 18 (npm/npx forms); an official single-binary Release exists without Node (not tested).
Verify after install:
- --version prints 1.18.0;
- running repomix . in any repo root prints a Pack Summary.
Install variants (deep dive)
| Path | Command | Measured |
|---|---|---|
| npm global (measured) | npmmirror-prefixed install of repomix | ✅ 2026-08-29, instant |
| No-install | npm_config_registry=https://registry.npmmirror.com npx -y repomix <dir> | ✅ 2026-08-29 (npx --version + pack) |
| Single-binary Release | GitHub Release download | officially supported (not tested) |
| brew (macOS) | brew install repomix | officially supported (not tested) |
4. Why it works this way (mechanism & shared surface) (deep dive)
repomix is a pure CLI: run it in the target repo root, it walks the files (excluding .gitignore matches by default), merges them into one file and prints a Pack Summary (Total Files / Total Tokens / Output path). --compress compacts the output (code blocks merged with a separator), --include scopes with globs, --output changes the destination. It is not a daemon, no background process — it runs and exits.
Key concepts:
- Pack Summary: the packing report (Total Files / Total Tokens / Output path);
- --compress: compressed packing (measured);
- --include: scope limiting (measured 2026-08-30);
- --output: output path (measured);
- --init: generates repomix.config.json (measured 2026-08-30).
What it touches after install: writes no user-level config; at runtime it reads optional global config under ~/.config/repomix/; the output single file lands in the current directory (default repomix-output.txt — add it to .gitignore); the npx no-install form caches under ~/.npm.
5. Common operations
Step 1: pack the repository into a single file
# Source: Trove detailed guide · verified 2026-08-29
repomix . --compress --output repomix-output.txt
Expected output: Pack Summary (Total Files / Total Tokens / Output path; measured 2026-08-29: 2 files → 421 tokens/1983 chars)
If stuck:
- Pack Summary errors → confirm you are in the repo root and the directory is readable;
- output file lands in git → add repomix-output.txt to .gitignore (packed files shouldn't be committed).
Step 2: control scope and token budget
# Source: Trove detailed guide · verified 2026-08-29
repomix . --compress --include "src/**/*.ts,README.md"
Expected output: only matching files are packed (--compress measured; --include measured 2026-08-30, excluded files absent from output)
If stuck:
- --include behaves unexpectedly → check --help/official docs, verify the glob syntax;
- still too big → narrow the glob scope or write to a temp path with --output first to see the token count.
Step 3: specify the output path
# Source: Trove detailed guide · verified 2026-08-29
repomix . --output /tmp/repo-context.txt
Expected output: single file written to the given path (--output measured working 2026-08-29)
If stuck:
- output path not writable → switch to a writable directory;
- big repo slow → scope with --include (measured: full site docs → 62KB/959-line single file).
6. Conflicts (summary)
Same source as the tool-page matrix; full pairs, status and evidence at conflict matrix (co-install). Known relations:
- code-review-graph / swe-rex × repomix: members of combo-ai-code-review (three-stage split: feed → review → sandbox verify), write surfaces don't overlap (output file / review reports / fix diffs), judged possible-compatible, co-install not tested;
- vite-deploy × repomix: possible-compatible (build output dist/ and packing output don't interfere);
- Remaining 20+ pairs: all possible-compatible — repomix has no shared config write surface (single output file + npx cache), statically judged co-installable.
7. Troubleshooting quick reference
- Symptom: packing errors / no output → confirm you are in the repo root and the directory is readable
- Symptom: output file landed in git → add repomix-output.txt to .gitignore (default excludes .gitignore matches, but explicitly ignore the output file itself)
- Symptom: --include doesn't filter as expected → official feature, follow --help/official docs (basic usage measured 2026-08-30)
- Symptom: npm install fails/slow → confirm the npmmirror prefix
- Symptom: Node version error → confirm >= 18
Full four-section entries (symptom→cause→fix→evidence): site docs (if recorded)
8. Uninstall & cleanup
# Source: Trove detailed guide · verified 2026-08-29
npm uninstall -g repomix
command -v repomix >/dev/null 2>&1 && echo "残留: repomix 仍存在" || echo "repomix removed: OK"
Expected output: repomix removed: OK (npm removal output precedes)
Note: residue after uninstall = the output file (default repomix-output.txt in the current dir, or the --output path) and an optional repomix.config.json (if generated with --init, in the workspace); the npx cache under ~/.npm needs no cleanup.
9. FAQ
- Q: Will it change my config? A: No user-level config is written; at runtime it reads optional global config under ~/.config/repomix/ (--init-generated config lives in the workspace); the output single file lands in the current directory.
- Q: Conflict with code-review-graph / swe-rex when installed together? A: Judged possible-compatible — write surfaces don't overlap (output file / review reports / fix diffs), co-install not tested.
- Q: Token limit exceeded on big repos? A: --compress to compress + --include to scope (measured: full site docs → 62KB/959-line single file).
- Q: Will the output file enter git? A: .gitignore matches are excluded by default, but add the output file itself to .gitignore.
- Q: npm install fails in China? A: use the npmmirror prefix from the install section (measured instant 2026-08-29).
- Q: Where do I report issues? A: install/uninstall issues go through this entry's feedback; project issues go to the author repo.
- Version: 1.18.0 (manifest locked; measured 2026-08-29/30).
- Environment: Node >= 18 (npm/npx forms); single-binary Release without Node (not tested).
- Network: npm via npmmirror prefix (measured instant).
- Write surface: no user-level config; single output file in the current directory (default repomix-output.txt, suggest .gitignore).
- Co-install: possible-compatible with code-review-graph / swe-rex (combo-ai-code-review members), co-install not tested.
10. Sources
- Sources: official project docs (English README) + local measurements (2026-08-29/30)
- Entry signature: repomix install | repo packing | code context | AI context
- Measured:
local repro log 2026-08-29(npm install + version + pack + --output full chain);local repro log 2026-08-30(npx form + --compress --include exclusion measured);local repro log 2026-08-30(--init config generation + file check) - Not tested: single-binary Release; brew (macOS); real co-install with code-review-graph/swe-rex.
External tutorials (unverified)
Third-party tutorials are not individually verified; check against this page and official docs.
- 官方 README:Quick Start(npx 免安装 / 全局安装 / 输出与用法) [官方文档 · repomix 官方 · 2026-08-30(v1.18.0 README)]
免安装 `npx repomix@latest`(项目目录直接跑);全局安装四路(npm -g / yarn global / bun add -g / brew);默认输出 `repomix-output.xml`(AI 友好单文件,含 file_summary);配 prompt 用法(「这个文件是仓库合并表示,我要重构代码,请先审阅」) - 官方 README:Usage(目录/glob/ignore/remote/stdin/logs/compress) [官方文档 · repomix 官方 · 2026-08-30(v1.18.0 README)]
六类用法——①`repomix`/指定目录;②`--include "src/**/*.ts,**"` glob 限定;③`--ignore "**,tmp/"` 排除;④`--remote <仓库>`(GitHub shorthand/分支/commit/URL 都支持);⑤`--stdin` 管道(find/git ls-files/rg/fd/fzf 组合喂文件列表,忽略规则仍生效、自动去重);⑥`--include-logs`(git 日志默认 50 条,可 --include-logs-count N、--include-diffs 组合);`--compress` 压缩输出 - 官方 README:--init 配置生成(交互向导语义) [官方文档 · repomix 官方 · 2026-08-30(v1.18.0 README)]
`repomix --init` 生成 repomix.config.json(项目级;另有全局配置 ~/.config/repomix/repomix.config.*,支持 ts/mts/js/json5/jsonc/json 等 9 种后缀);未建配置时运行会提示可加配置文件 - 官方 README:网站 / 浏览器扩展 / VSCode 扩展(其他入口) [官方文档 · repomix 官方 · 2026-08-31(官方 README 复核)]
repomix.com 网页版(输入仓库名打包,可选 XML/Markdown/Plain Text + token 估算);Chrome/Firefox 扩展(GitHub 仓库页一键 Repomix);VSCode 扩展 Repomix Runner(社区维护,文件夹打包/管理输出/自动清理)
Merged sources
This page merges multiple source articles — deduplicated by content hash, measured, and rewritten by AI. Sources are not scattered; they all live on this single page.
No merged sources yet: this page distills local verification and community rewrites; provenance details live on the linked solution page.
← Back to repomix solution page | Coding Agents & Terminal domain