CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Repomix

$ repomix 社区开源 低风险
Kazuki Yamada (yamadashy) · Agent 桥接与元工具 · MIT · macos / linux / windows

Repomix 能遵循 .gitignore 将整个代码库打包为结构化文档(--style xml|markdown|json|plain),附带逐文件 Token 统计与内置 Secretlint 密钥扫描。支持 --remote owner/repo 远程拉取、--include/--ignore 过滤及 --output - 标准输出流。

FCRS-1.0 综合评分
91 /100
极佳 (Excellent)
中置信度 (源码/文档)
零摩擦安装命令
brew install repomix
CLI vs MCP 选型建议 CLI + MCP 搭配

repomix CLI 可直接按目录筛选与 Secretlint 扫描将代码打包为 XML/Markdown/JSON;同时也内置了可选的 --mcp 模式。

Agent 友好度体检单

✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 23 / 25

支持 --style xml|markdown|json|plain、--output -、--include/--ignore、--compress 与完全非交互运行。

  • Supports --style json, --output -, --include, --compress, and --remote
安全与权限边界 23 / 25

默认启用 Secretlint 检测敏感密钥泄露,且自动遵循 .gitignore 规则。

  • Built-in Secretlint security check and .gitignore respect
安装与运行摩擦 14 / 15

可通过 npx repomix、npm install -g repomix 或 brew install repomix 跨全平台运行。

  • Available via Homebrew, npm, and npx repomix
能力覆盖与边际价值 15 / 15

支持 Tree-sitter --compress 压缩与文件级 Token 计数的顶级代码打包工具。

  • Tree-sitter --compress, token counts, and remote repo packing
维护与来源背书 8 / 10

由 yamadashy/repomix 在 MIT 协议下高频活跃维护。

  • Active yamadashy/repomix repo
文档与可验证性 8 / 10

repomix.com/guide/ 文档清晰覆盖全部 CLI 参数与 MCP 模式。

  • Official docs at repomix.com/guide/

安全边界、鉴权与放权指南

鉴权方式
无需鉴权
凭证存储位置

本地仓库无需凭证;拉取私有远程仓库时沿用本地 git 凭证。

潜在副作用
只读查询 本地写入
费用与配额提示

基于 MIT 协议 100% 免费开源。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# 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 高频安全命令配方

只读查询(安全推荐)

按路径过滤并以 Markdown 打包输出到 stdout
npx repomix --include "src/**/*.ts" --style markdown --output -

仅打包匹配的文件并流式输出到标准输出,不在磁盘留下临时文件。

将远程 GitHub 仓库打包为 JSON
npx repomix --remote owner/repo --style json --output repo-pack.json

无需手动克隆即可抓取远程仓库并生成结构化 JSON 摘要。

受控写入与预演

启用 AST 压缩大幅削减 Token 占用
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,生成文件仍会十分庞大。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI