SuperAPI AI 工具集

repomix

编程与开发

查看项目

更新于 10-16 04:31

技能介绍

用途:Repomix 把整个代码仓库打包成单个、对 AI 友好的文件,用于把代码库作为上下文喂给 Claude、ChatGPT、Gemini 等大语言模型。适用场景包括为 AI 分析打包代码库、生成仓库快照作为 LLM 上下文、分析第三方库、准备安全审计、生成文档上下文、跨大型代码库排查缺陷。

主要能力:以 AI 优化格式打包仓库,带清晰分隔符;支持 XML、Markdown、JSON、纯文本多种输出格式;遵循 .gitignore 的 Git 感知处理;统计 Token 数量以管理 LLM 上下文;通过 Secretlint 检测 API 密钥、密码、凭据、私钥、AWS 密钥等敏感信息;支持不克隆直接处理远程仓库(含指定 commit);可移除 HTML、CSS、JavaScript、TypeScript、Vue、Svelte、Python、PHP、Ruby、C、C#、Java、Go、Rust、Swift、Kotlin、Dart、Shell、YAML 等语言的注释。

使用方式:检查安装用 repomix --version;安装可用 npm install -g repomix 或 brew install repomix。基本用法:repomix 打包当前目录并生成 repomix-output.xml;repomix --style markdown 或 --style json 指定格式;npx repomix --remote owner/repo 打包远程仓库;repomix --include "src/**/*.ts" --remove-comments -o output.md 自定义输出与过滤。文件选择可用 --include、-i 忽略模式、--no-gitignore;输出可用 --style、-o、--remove-comments、--copy;配置可用 -c custom-config.json 或 --init 生成 repomix.config.json。Token 管理可用 repomix --token-count-tree 查看层级 Token 分布,并可加阈值如 repomix --token-count-tree 1000。

限制与注意:分享前应始终检查输出,用 .repomixignore 排除敏感文件,避免打包 .env 文件,检查硬编码凭据;必要时可用 repomix --no-security-check 关闭安全检查。典型 LLM 上下文上限:Claude Sonnet 4.5 约 200K tokens,GPT-4 约 128K,GPT-3.5 约 16K。更多资料见 GitHub https://github.com/yamadashy/repomix 与文档 https://repomix.com/guide/,另有 MCP Server 可用于 AI 助手集成。