Repomix
$ repomix 社区开源 低风险Repomix 能遵循 .gitignore 将整个代码库打包为结构化文档(--style xml|markdown|json|plain),附带逐文件 Token 统计与内置 Secretlint 密钥扫描。支持 --remote owner/repo 远程拉取、--include/--ignore 过滤及 --output - 标准输出流。
brew install repomix repomix CLI 可直接按目录筛选与 Secretlint 扫描将代码打包为 XML/Markdown/JSON;同时也内置了可选的 --mcp 模式。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
支持 --style xml|markdown|json|plain、--output -、--include/--ignore、--compress 与完全非交互运行。
- Supports
--style json,--output -,--include,--compress, and--remote
默认启用 Secretlint 检测敏感密钥泄露,且自动遵循 .gitignore 规则。
- Built-in Secretlint security check and
.gitignorerespect
可通过 npx repomix、npm install -g repomix 或 brew install repomix 跨全平台运行。
- Available via Homebrew, npm, and
npx repomix
支持 Tree-sitter --compress 压缩与文件级 Token 计数的顶级代码打包工具。
- Tree-sitter
--compress, token counts, and remote repo packing
由 yamadashy/repomix 在 MIT 协议下高频活跃维护。
- Active
yamadashy/repomixrepo
repomix.com/guide/ 文档清晰覆盖全部 CLI 参数与 MCP 模式。
- Official docs at repomix.com/guide/
安全边界、鉴权与放权指南
本地仓库无需凭证;拉取私有远程仓库时沿用本地 git 凭证。
基于 MIT 协议 100% 免费开源。
# Repomix Agent Rules - Use `--include` / `--ignore` and `--compress` on large repos so outputs fit within context budgets. - Keep default Secretlint security check enabled (never disable `--no-security-check` blindly). - Pass `--output -` to stream to stdout when avoiding temporary files.
Agent 高频安全命令配方
只读查询(安全推荐)
npx repomix --include "src/**/*.ts" --style markdown --output -
仅打包匹配的文件并流式输出到标准输出,不在磁盘留下临时文件。
npx repomix --remote owner/repo --style json --output repo-pack.json
无需手动克隆即可抓取远程仓库并生成结构化 JSON 摘要。
受控写入与预演
npx repomix --compress --style xml --output repomix-compressed.xml
使用 Tree-sitter 提取函数签名与接口定义,显著缩小输出体积。
核心优势
- + 内置 Secretlint 扫描防止将本地 API 密钥误打包进 LLM 提示词。
- +
--compress借助 Tree-sitter 保留代码结构签名并削减约 70% Token。 - +
--remote owner/repo一条命令打包外部 GitHub 仓库。
注意事项与踩坑点
- ! 面对大型 Monorepo 若未搭配
--include或--compress,生成文件仍会十分庞大。