特别感谢:
Warp,开发人员的代理终端
可用于MacOS,Linux和Windows
在线使用repomix ! repomix .com
需要讨论吗?加入我们的不和谐!
分享您的经验和技巧
保持最新有关新功能
获得配置和用法的帮助
repomix是一种功能强大的工具,可将整个存储库包装到一个易于友好的文件中。
当您需要将代码库馈送到大型语言模型(LLMS)或其他AI工具(例如Claude,Chatgpt,DeepSeek,Pelplexity,Gemini,Gemini,Gemma,Gemma,Llame,Grok等)时,它是完美的。
?开源奖励提名
我们很荣幸! repomix已在JSnation开源奖2025年获得AI类别的提名。
没有所有人使用和支持repomix ,这是不可能的。谢谢你!
如果repomix帮助您分析或打包代码库AI工具,我们将感谢您在AI类别中投票的投票。
?New: repomix网站和Discord社区!
- 在repomix .com上尝试在浏览器中的repomix
- 加入我们的Discord服务器进行支持和讨论
我们期待在那里见到您!
?功能
- AI优化:以AI容易理解和处理的方式格式化您的代码库。
- 令牌计数:为每个文件和整个存储库提供令牌计数,对LLM上下文限制有用。
- 易于使用:您只需要一个命令即可包装整个存储库。
- 可自定义:轻松配置要包含或排除的内容。
- Git-Aware :自动尊重您的.gitignore文件和.git/info/dubl。
- 以安全性为中心:合并用于鲁棒安全检查的Seriglint,以检测并防止纳入敏感信息。
- 代码压缩:-Compress Option使用树特工来提取密钥代码元素,在保留结构时减少令牌计数。
快速开始
使用CLI工具> _
您可以在项目目录中立即尝试不安装repomix :
npx repomix @latest
或全球安装以备重复使用:
repomix
# Alternatively using yarn
yarn global add repomix
# Alternatively using bun
bun add -g repomix
# Alternatively using Homebrew (macOS/Linux)
brew install repomix
# Then run in any project directory
repomix \”>
# Install using npm npm install -g repomix # Alternatively using yarn yarn global add repomix # Alternatively using bun bun add -g repomix # Alternatively using Homebrew (macOS/Linux) brew install repomix # Then run in any project directory repomix
就是这样! repomix将在您当前目录中生成repomix -output.xml文件,其中包含整个存储库以AI友好的格式。
然后,您可以将此文件发送给AI助理,并以下提示:
This file contains all the files in the repository combined into one. I want to refactor the code, so please review it first.
当您提出特定的更改时,AI可能能够相应地生成代码。借助Claude的工件之类的功能,您可以潜在地输出多个文件,从而可以生成多个相互依存的代码。
愉快的编码!
使用网站
想快速尝试吗?访问官方网站repomix .com。只需输入您的存储库名称,填写任何可选的详细信息,然后单击“包装”按钮以查看生成的输出。
可用选项
该网站提供了几个方便的功能:
- 可自定义的输出格式(XML,Markdown或纯文本)
- 即时令牌计数估计
- 更多!
使用浏览器扩展?
直接从任何GitHub存储库中获得即时访问repomix !我们的Chrome Extension为GitHub存储库页面添加了一个方便的“ repomix ”按钮。
安装
- Chrome扩展名: repomix -Chrome网络商店
- Firefox附加组件: repomix Firefox附加组件
特征
- 任何GITHUB存储库的一键式访问repomix
- 即将推出更多令人兴奋的功能!
使用VSCODE扩展⚡️
一个称为repomix Runner(由Massdo创建的)社区维护的VSCODE扩展程序,您只需单击几下即可在编辑器内运行repomix 。在任何文件夹上运行它,无缝管理输出,并通过VSCODE的直观接口控制所有内容。
想要您的输出作为文件还是内容?需要自动清理吗?此扩展名已覆盖。另外,它可以与您现有的repomix .config.json合作。
立即在Vscode Marketplace上尝试!源代码可在GitHub上找到。
替代工具
如果您使用的是Python,则可能需要检查Gitingest,这更适合Python生态系统和数据科学工作流程:https://github.com/cyclotruc/gitingest
用法
打包您的整个存储库:
repomix
包装特定目录:
repomix path/to/directory
使用球形模式包装特定的文件或目录:
repomix --include \" src/**/*.ts,**/*.md \"
排除特定文件或目录:
repomix --ignore \" **/*.log,tmp/ \"
包装远程存储库:
repomix –remote https://g**i*thub.com/yamadashy/repomix
# You can also use GitHub shorthand:
repomix –remote yamadashy/ repomix
# You can specify the branch name, tag, or commit hash:
repomix –remote https://g**i*thub.com/yamadashy/repomix –remote-branch main
# Or use a specific commit hash:
repomix –remote https://g**i*thub.com/yamadashy/repomix –remote-branch 935b695
# Another convenient way is specifying the branch\’s URL
repomix –remote https://g**i*thub.com/yamadashy/repomix/tree/main
# Commit\’s URL is also supported
repomix –remote https://g**i*thub.com/yamadashy/repomix/commit/836abcd7335137228ad77feb28655d85712680f1
\”>
repomix --remote https://g**i*thub.com/yamadashy/repomix # You can also use GitHub shorthand: repomix --remote yamadashy/ repomix # You can specify the branch name, tag, or commit hash: repomix --remote https://g**i*thub.com/yamadashy/repomix --remote-branch main # Or use a specific commit hash: repomix --remote https://g**i*thub.com/yamadashy/repomix --remote-branch 935b695 # Another convenient way is specifying the branch\'s URL repomix --remote https://g**i*thub.com/yamadashy/repomix/tree/main # Commit\'s URL is also supported repomix --remote https://g**i*thub.com/yamadashy/repomix/commit/836abcd7335137228ad77feb28655d85712680f1
从文件列表中打包文件(通过stdin的管道):
repomix –stdin
# Using git to get tracked files
git ls-files \”*.ts\” | repomix –stdin
# Using grep to find files containing specific content
grep -l \”TODO\” **/*.ts | repomix –stdin
# Using ripgrep to find files with specific content
rg -l \”TODO|FIXME\” –type ts | repomix –stdin
# Using ripgrep (rg) to find files
rg –files –type ts | repomix –stdin
# Using sharkdp/fd to find files
fd -e ts | repomix –stdin
# Using fzf to select from all files
fzf -m | repomix –stdin
# Interactive file selection with fzf
find . -name \”*.ts\” -type f | fzf -m | repomix –stdin
# Using ls with glob patterns
ls src/**/*.ts | repomix –stdin
# From a file containing file paths
cat file-list.txt | repomix –stdin
# Direct input with echo
echo -e \”src/index.ts\\nsrc/utils.ts\” | repomix –stdin\”>
# Using find command find src -name \" *.ts \" -type f | repomix --stdin # Using git to get tracked files git ls-files \" *.ts \" | repomix --stdin # Using grep to find files containing specific content grep -l \" TODO \" ** / * .ts | repomix --stdin # Using ripgrep to find files with specific content rg -l \" TODO|FIXME \" --type ts | repomix --stdin # Using ripgrep (rg) to find files rg --files --type ts | repomix --stdin # Using sharkdp/fd to find files fd -e ts | repomix --stdin # Using fzf to select from all files fzf -m | repomix --stdin # Interactive file selection with fzf find . -name \" *.ts \" -type f | fzf -m | repomix --stdin # Using ls with glob patterns ls src/ ** / * .ts | repomix --stdin # From a file containing file paths cat file-list.txt | repomix --stdin # Direct input with echo echo -e \" src/index.ts\\nsrc/utils.ts \" | repomix --stdin
-stdin选项允许您将文件路径列表输送到repomix ,从而为您选择要包装哪些文件时的最终灵活性。
使用-stdin时,指定的文件将有效地添加到包含模式中。这意味着正常的包含行为和忽略行为仍然适用 – 如果忽略模式匹配,则通过stdin指定的文件仍将被排除在外。
笔记
使用-stdin时,文件路径可以是相对或绝对的,并且repomix将自动处理路径分辨率和重复数据删除。
压缩输出:
repomix –compress
# You can also use it with remote repositories:
repomix –remote yamadashy/ repomix –compress\”>
repomix --compress
# You can also use it with remote repositories:
repomix --remote yamadashy/ repomix --compress
初始化一个新的配置文件( repomix .config.json):
repomix --init
生成包装的文件后,您可以将其与生成的AI工具一起使用,例如Chatgpt,DeepSeek,Perplexity,Gemini,Gemini,Gemma,Llame,Grok等。
docker用法?
您还可以使用Docker运行repomix 。
如果您想在孤立的环境中运行repomix或更喜欢使用容器,这将很有用。
基本用法(当前目录):
docker run -v .:/app -it --rm ghcr.io/yamadashy/ repomix
包装特定目录:
docker run -v .:/app -it --rm ghcr.io/yamadashy/ repomix path/to/directory
处理远程存储库并输出到输出目录:
docker run -v ./output:/app -it --rm ghcr.io/yamadashy/ repomix --remote https://g**i*thub.com/yamadashy/repomix
及时的例子
一旦您使用repomix生成包装的文件,就可以将其与AI工具(例如Chatgpt,DeepSeek,Pelplexity,Gemini,Gemini,Gemma,Lllama,Grok等)一起使用。以下是一些示例提示,可以让您入门:
代码审查和重构
有关全面的代码审查和重构建议:
This file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability.
文档生成
生成项目文档:
Based on the codebase in this file, please generate a detailed README.md that includes an overview of the project, its main features, setup instructions, and usage examples.
测试案例生成
用于生成测试案例:
Analyze the code in this file and suggest a comprehensive set of unit tests for the main functions and classes. Include edge cases and potential error scenarios.
代码质量评估
评估代码质量和遵守最佳实践:
Review the codebase for adherence to coding best practices and industry standards. Identify areas where the code could be improved in terms of readability, maintainability, and efficiency. Suggest specific changes to align the code with best practices.
库概述
对图书馆有高级理解
This file contains the entire codebase of library. Please provide a comprehensive overview of the library, including its main purpose, key features, and overall architecture.
根据您的特定需求和您使用的AI工具的功能,可以随意修改这些提示。
社区讨论
查看我们的社区讨论用户共享的地方:
- 他们使用的AI工具与repomix一起使用
- 他们发现的有效提示
- repomix如何帮助他们
- 提示和技巧,以充分利用AI代码分析
随时加入讨论并分享自己的经验!您的见解可以帮助他人更好地利用repomix 。
输出文件格式
repomix在代码库的不同部分之间生成一个带有清晰分离器的单个文件。
为了增强AI理解,输出文件从面向AI的解释开始,使AI模型更容易理解包装存储库的上下文和结构。
XML格式(默认)
XML格式以层次的方式构造内容:
This file is a merged representation of the entire codebase, combining all repository files into a single document. < file_summary > (Metadata and usage AI instructions) </ file_summary > < directory_structure > src/ cli/ cliOutput.ts index.ts (...remaining directories) </ directory_structure > < files > < file path = \" src/index.js \" > // File contents here </ file > (...remaining files) </ files > < instruction > (Custom instructions from `output.instructionFilePath`) </ instruction >
对于那些对AI上下文中XML标签潜力感兴趣的人:
https://docs.an*ththro**pic.com/en/docs/build-with-with-claude/prompt-engineering/use-xml-tags
当您的提示涉及多个组件(例如上下文,说明和示例)时,XML标签可能会改变游戏规则。它们帮助克劳德(Claude)更准确地解析您的提示,从而导致更高质量的输出。
这意味着来自repomix的XML输出不仅是一种不同的格式,而且可能是将代码库馈送到AI系统中的更有效方法,以进行分析,代码审查或其他任务。
降价格式
要以降价格式生成输出,请使用 – 风格的标记选项:
repomix --style markdown
降价格式以层次的方式结构内容:
This file is a merged representation of the entire codebase, combining all repository files into a single document. # File Summary (Metadata and usage AI instructions) # Repository Structure ``` src/ cli/ cliOutput.ts index.ts ``` (...remaining directories) # Repository Files ## File: src/index.js ``` // File contents here ``` (...remaining files) # Instruction (Custom instructions from ` output.instructionFilePath ` )
这种格式提供了一种干净,可读性的结构,既可以通过人工智能系统友好且易于解析。
纯文本格式
要以纯文本格式生成输出,请使用 – 风格的普通选项:
repomix --style plain
This file is a merged representation of the entire codebase, combining all repository files into a single document.
================================================================
File Summary
================================================================
(Metadata and usage AI instructions)
================================================================
Directory Structure
================================================================
src/
cli/
cliOutput.ts
index.ts
config/
configLoader.ts
(...remaining directories)
================================================================
Files
================================================================
================
File: src/index.js
================
// File contents here
================
File: src/utils.js
================
// File contents here
(...remaining files)
================================================================
Instruction
================================================================
(Custom instructions from `output.instructionFilePath`)
命令行选项
基本选项
- -v, – version:显示工具版本
输出选项
- -o, – 输出<file>:指定输出文件名
- -Stdout:输出到Stdout而不是写入文件(不能与-输出选项一起使用)
- – 风格<样式>:指定输出样式(XML,Markdown,Plain)
- – 可放松的风格:基于所选样式架构启用可放松输出。请注意,这可能会增加令牌计数。
- – 压缩:执行智能代码提取,专注于基本功能和类签名以减少令牌计数
- – 输出表 – 单行数:输出中显示行号
- – 复制:此外,将生成的输出复制到系统剪贴板
- -No-File-Summary:禁用文件摘要部分输出
- -NO-directory结构:禁用目录结构部分输出
- – 示例 – 复合:从受支持的文件类型中删除注释
- – 示范 – 空线:从输出中删除空线
- – Truncate-Base64:启用基本64数据字符串的截断
- -HEADER-TEXT <text>:要包含在文件标头中的自定义文本
- – Instruction-File-Path <Path>:通往包含详细自定义说明的文件的路径
- – 符号 – 主导级:在输出中包括空目录
- – 包括 – 陷阱:在输出中包括git差异(包括工作树和分阶段更改)
- -No-Git-sort-by-Changes:通过GIT更改计数禁用排序文件(默认启用)
过滤器选项
- – include <模式>:包括模式的列表(逗号分隔)
- -i,-ignore <pattern>:其他忽略模式(逗号分隔)
- -stdin:从stdin读取文件路径,而不是自动发现文件
- -No-Gitignore:disable .gitignore文件使用情况
- – 不默认模式:禁用默认模式
远程存储库选项
- – 示例<url>:处理一个远程git存储库
- – 远程 – 分支<名称>:指定远程分支名称,标签或提交哈希(默认为存储库默认分支)
配置选项
- -c,-config <Path>:通往自定义配置文件的路径
- – init:创建配置文件
- – 全球:使用Global Config
安全选项
- -No-Security-Check:禁用安全检查
令牌计数选项
- -token-count-ensoding <编码>:指定由Openai的Tiktoken Tokenizer使用的代币计数(例如,GPT-4O的O200K_Base,cl100k_base,gpt-4/3.5)。有关编码详细信息,请参见tiktoken model.py。
MCP
- -MCP:作为MCP(模型上下文协议)服务器运行
其他选项
- -top-files len <数字>:在摘要中显示的顶级文件数量
- – Verbose:启用详细记录
- – Quiet:将所有输出禁用到Stdout
示例:
repomix
# Custom output
repomix -o output.xml –style xml
# Output to stdout
repomix –stdout > custom-output.txt
# Send output to stdout, then pipe into another command (for example, simonw/llm)
repomix –stdout | llm \”Please explain what this code does.\”
# Custom output with compression
repomix –compress
# Process specific files
repomix –include \”src/**/*.ts\” –ignore \”**/*.test.ts\”
# Remote repository with branch
repomix –remote https://git*hub.*co*m/user/repo/tree/main
# Remote repository with commit
repomix –remote https://git*hub.**com/user/repo/commit/836abcd7335137228ad77feb28655d85712680f1
# Remote repository with shorthand
repomix –remote user/repo\”>
# Basic usage repomix # Custom output repomix -o output.xml --style xml # Output to stdout repomix --stdout > custom-output.txt # Send output to stdout, then pipe into another command (for example, simonw/llm) repomix --stdout | llm \" Please explain what this code does. \" # Custom output with compression repomix --compress # Process specific files repomix --include \" src/**/*.ts \" --ignore \" **/*.test.ts \" # Remote repository with branch repomix --remote https://git*hub.*co*m/user/repo/tree/main # Remote repository with commit repomix --remote https://git*hub.**com/user/repo/commit/836abcd7335137228ad77feb28655d85712680f1 # Remote repository with shorthand repomix --remote user/repo
更新repomix
要更新全球安装的repomix :
repomix
# Using yarn
yarn global upgrade repomix
# Using bun
bun update -g repomix \”>
# Using npm npm update -g repomix # Using yarn yarn global upgrade repomix # Using bun bun update -g repomix
使用NPX repomix通常更方便,因为它始终使用最新版本。
远程存储库处理
repomix支持处理远程GIT存储库,而无需手动克隆。此功能使您可以通过单个命令快速分析任何公共GIT存储库。
要处理一个远程存储库,请使用-lemote选项,然后使用存储库URL:
repomix --remote https://g**i*thub.com/yamadashy/repomix
您也可以使用GitHub的速记格式:
repomix \”>
repomix --remote yamadashy/ repomix
您可以指定分支名称,标签或提交哈希:
repomix –remote https://g**i*thub.com/yamadashy/repomix –remote-branch main
# Using branch\’s URL
repomix –remote https://g**i*thub.com/yamadashy/repomix/tree/main\”>
# Using --remote-branch option repomix --remote https://g**i*thub.com/yamadashy/repomix --remote-branch main # Using branch\'s URL repomix --remote https://g**i*thub.com/yamadashy/repomix/tree/main
或使用特定的提交哈希:
repomix –remote https://g**i*thub.com/yamadashy/repomix –remote-branch 935b695
# Using commit\’s URL
repomix –remote https://g**i*thub.com/yamadashy/repomix/commit/836abcd7335137228ad77feb28655d85712680f1\”>
# Using --remote-branch option repomix --remote https://g**i*thub.com/yamadashy/repomix --remote-branch 935b695 # Using commit\'s URL repomix --remote https://g**i*thub.com/yamadashy/repomix/commit/836abcd7335137228ad77feb28655d85712680f1
代码压缩
– 压缩选项利用树特来执行智能代码提取,重点介绍基本功能和班级签名,同时删除实现详细信息。这可以帮助减少令牌计数,同时保留重要的结构信息。
repomix --compress
例如,此代码:
import { ShoppingItem } from \'./shopping-item\' ; /** * Calculate the total price of shopping items */ const calculateTotal = ( items : ShoppingItem [ ] ) => { let total = 0 ; for ( const item of items ) { total += item . price * item . quantity ; } return total ; } // Shopping item interface interface Item { name : string ; price : number ; quantity : number ; }
将被压缩到:
import { ShoppingItem } from \'./shopping-item\' ; ⋮ -- -- /** * Calculate the total price of shopping items */ const calculateTotal = ( items : ShoppingItem [ ] ) => { ⋮ -- -- // Shopping item interface interface Item { name : string ; price : number ; quantity : number ; }
笔记
这是一个实验功能,我们将根据用户反馈和现实世界的使用来积极改进
MCP服务器集成
repomix支持模型上下文协议(MCP),使AI助手可以直接与您的代码库进行交互。当作为MCP服务器运行时, repomix提供了工具,使AI助手可以包装本地或远程存储库进行分析,而无需手动文件准备。
repomix --mcp
配置MCP服务器
要将repomix用作MCP服务器与Claude这样的AI助手,您需要配置MCP设置:
对于VS代码:
您可以使用以下一种方法之一在VS代码中安装repomix MCP服务器:
- 使用安装徽章:
- 使用命令行:
repomix \”,\”–mcp\”]}\’\”>
code --add-mcp \' {\"name\":\" repomix \",\"command\":\"npx\",\"args\":[\"-y\",\" repomix \",\"--mcp\"]} \'
对于VS代码内部人员:
repomix \”,\”–mcp\”]}\’\”>
code-insiders --add-mcp \' {\"name\":\" repomix \",\"command\":\"npx\",\"args\":[\"-y\",\" repomix \",\"--mcp\"]} \'
对于Cline(VS代码扩展):
编辑cline_mcp_settings.json文件:
repomix\”: {
\”command\”: \”npx\”,
\”args\”: [
\”-y\”,
\” repomix \”,
\”–mcp\”
]
}
}
}\”>
{
\"mcpServers\" : {
\" repomix \" : {
\"command\" : \" npx \" ,
\"args\" : [
\" -y \" ,
\" repomix \" ,
\" --mcp \"
]
}
}
}
对于光标:
在光标中,从光标设置> MCP> +添加新的MCP服务器> +添加具有类似于Cline的配置的新全局MCP服务器。
对于Claude桌面:
编辑具有与Cline的配置相似的配置的Claude_desktop_config.json文件。
对于克劳德代码:
要将repomix配置为Claude代码中的MCP服务器,请使用以下命令:
repomix –mcp\”>
claude mcp add repomix -- npx -y repomix --mcp
使用Docker代替NPX:
您可以将Docker用作NPX作为MCP服务器运行repomix的替代方法:
repomix-docker\”: {
\”command\”: \”docker\”,
\”args\”: [
\”run\”,
\”-i\”,
\”–rm\”,
\”ghcr.io/yamadashy/ repomix \”,
\”–mcp\”
]
}
}
}\”>
{
\"mcpServers\" : {
\" repomix -docker\" : {
\"command\" : \" docker \" ,
\"args\" : [
\" run \" ,
\" -i \" ,
\" --rm \" ,
\" ghcr.io/yamadashy/ repomix \" ,
\" --mcp \"
]
}
}
}
配置后,您的AI助手可以直接使用repomix的功能来分析无手动文件准备的代码库,从而使代码分析工作流程更有效。
可用的MCP工具
作为MCP服务器运行时, repomix提供以下工具:
- pack_codebase :将本地代码目录包装到合并的XML文件中以进行AI分析
- 参数:
- 目录:通往包装目录的绝对路径
- compress :(可选,默认值:false)启用树木压缩以在删除实现详细信息的同时提取基本代码签名和结构。在保留语义含义的同时,将令牌用法减少了约70%。通常不需要,因为grep_ repomix _Output允许增量内容检索。仅当您专门需要大型存储库的整个代码库内容时使用。
- includepatterns :(可选)指定文件,以包括使用快速整体模式。多种模式可以进行逗号分隔(例如, “ / *。仅处理匹配的文件。
- ignorePatterns :(可选)指定其他文件,以使用快速图模式排除。可以进行多种模式分开(例如,“ test/ ,*。spec.js”,“ node_modules/ ,dist/ **”)。这些模式补充了。吉特尼尔和内置的排除。
- topFilesLength :(可选,默认值:10)按大小按大小显示的最大文件数,以在指标摘要中显示代码库分析。
- pack_remote_repository :获取,克隆和包装github存储库中的合并XML文件进行AI分析
- 参数:
- 远程:github存储库URL或用户/repo格式(例如,“ yamadashy/ repomix ”,“ https://githu*b*.co*m/user/repo”或“ https://github.com/user.com/user/repo/repo/tree/rranch”)
- compress :(可选,默认值:false)启用树木压缩以在删除实现详细信息的同时提取基本代码签名和结构。在保留语义含义的同时,将令牌用法减少了约70%。通常不需要,因为grep_ repomix _Output允许增量内容检索。仅当您专门需要大型存储库的整个代码库内容时使用。
- includepatterns :(可选)指定文件,以包括使用快速整体模式。多种模式可以进行逗号分隔(例如, “ / *。仅处理匹配的文件。
- ignorePatterns :(可选)指定其他文件,以使用快速图模式排除。可以进行多种模式分开(例如,“ test/ ,*。spec.js”,“ node_modules/ ,dist/ **”)。这些模式补充了。吉特尼尔和内置的排除。
- topFilesLength :(可选,默认值:10)按大小按大小显示的最大文件数,以在指标摘要中显示代码库分析。
- read_ repomix _Output :读取repomix生成的输出文件的内容。支持大型文件的部分读取线范围规范。
- 参数:
- outputiD: repomix输出文件的ID
- startline :(可选)起点号(基于1,包含)。如果未指定,请从头开始读取。
- endline :(可选)端线号(基于1,包含1)。如果未指定,请读取要结束。
- 特征:
- 专为基于Web的环境或沙盒应用程序而设计
- 使用其ID检索先前生成的输出的内容
- 在不需要文件系统访问的情况下提供安全访问包装的代码库
- 支持大型文件的部分读数
- grep_ repomix _output :使用JavaScript Regexp语法搜索repomix输出文件中的模式
- 参数:
- outputID: repomix输出文件的ID
- 模式:搜索模式(JavaScript Regexp正则表达语法)
- ContextLines :(可选,默认值:0)每次匹配之前和之后要显示的上下文行数。如果指定,则被beforelines/parterline覆盖。
- Beforelines :(可选)每次匹配之前要显示的上下文行数(例如GREP -B)。优先于上下文。
- 以下:(可选)每次匹配后要显示的上下文行数(例如GREP -A)。优先于上下文。
- ignorecase :(可选,默认值:false)执行案例不敏感的匹配
- 特征:
- 使用JavaScript Regexp语法进行功能强大的模式匹配
- 支持上下文行以更好地理解比赛
- 允许单独控制上下文行之前/之后
- 病例敏感和不敏感的搜索选项
- file_system_read_file :使用绝对路径从本地文件系统读取文件。包括内置的安全验证,以检测并防止访问包含敏感信息的文件。
- 参数:
- 路径:要读取文件的绝对路径
- 安全功能:
- 使用Sertrint实施安全验证
- 防止访问包含敏感信息的文件(API密钥,密码,秘密)
- 验证绝对路径以防止目录遍历攻击
- file_system_read_directory :使用绝对路径列出目录的内容。返回一个格式的列表,显示带有清晰指示器的文件和子目录。
- 参数:
- 路径:通往列表目录的绝对路径
- 特征:
- 显示带有清晰指示器([文件]或[dir])的文件和目录
- 提供适当的错误处理的安全目录遍历
- 验证路径并确保它们是绝对的
- 对于探索项目结构和理解代码库组织有用
配置
在您的项目root中创建一个repomix .config.json文件以进行自定义配置。
repomix --init
这是配置选项的解释:
| 选项 | 描述 | 默认 |
|---|---|---|
| input.maxfilesize | 在处理中的最大文件大小。大于此大的文件将被跳过 | 50000000 |
| output.filepath | 输出文件的名称 | “ repomix -output.xml” |
| 输出。风格 | 输出的样式(XML,Markdown,Plain) | “ XML” |
| output.parsablestyle | 是否根据所选样式模式逃脱输出。请注意,这可能会增加令牌计数。 | 错误的 |
| output.compress | 是否执行智能代码提取以减少令牌计数 | 错误的 |
| output.headertext | 自定义文本要包含在文件标头中 | 无效的 |
| 输出 | 通往包含详细自定义说明的文件的路径 | 无效的 |
| output.filesummary | 是否要在输出开始时包含摘要部分 | 真的 |
| output.DirectoryStructure | 是否将目录结构包括在输出中 | 真的 |
| output.files | 是否将文件内容包括在输出中 | 真的 |
| output.removecomments | 是否从支持的文件类型中删除注释 | 错误的 |
| output.emoveEmptylines | 是否要从输出中删除空线 | 错误的 |
| output.showlineNumbers | 是否将线号添加到输出中的每一行 | 错误的 |
| output.truncatebase64 | 是否要截断长基本64数据字符串(例如,图像)以减少令牌计数 | 错误的 |
| output.copytoclipboard | 除保存文件外,是否将输出复制到系统剪贴板 | 错误的 |
| output.topfileslength | 摘要中要显示的顶级文件数量。如果设置为0,则不会显示摘要 | 5 |
| 输出 | 是否在存储库结构中包括空目录 | 错误的 |
| output.git.sortbychanges | 是否按git更改计数对文件进行排序(文件底部显示更多更改的文件) | 真的 |
| output.git.sortbychangesmaxcommits | 最大的投入分析GIT变化数量 | 100 |
| output.git.crudediffs | 是否将git差异包括在输出中(分别包括工作树和分阶段变化) | 错误的 |
| 包括 | 要包含的文件模式(使用Glog模式) | [] |
| ignore.usegitignore | 是否使用项目的.gitignore文件中的模式 | 真的 |
| ignore.usedefaultPatterns | 是否使用默认忽略模式 | 真的 |
| 忽略 | 忽略的其他模式(使用球形模式) | [] |
| 安全性 | 是否对文件执行安全检查 | 真的 |
| tokencount.Concoding | openai的tiktoken tokenizer使用的代币计数(例如,gpt-4o的O200K_Base,cl100k_base for gpt-4/3.5)。有关编码详细信息,请参见tiktoken model.py。 | “ o200k_base” |
配置文件支持JSON5语法,该语法允许:
- 评论(单线和多行)
- 在物体和阵列中落后逗号
- 未引用的属性名称
- 更轻松的弦语法
示例配置:
repomix-output.xml\”,
\”style\”: \”xml\”,
\”parsableStyle\”: false,
\”compress\”: false,
\”headerText\”: \”Custom header information for the packed file.\”,
\”fileSummary\”: true,
\”directoryStructure\”: true,
\”files\”: true,
\”removeComments\”: false,
\”removeEmptyLines\”: false,
\”topFilesLength\”: 5,
\”showLineNumbers\”: false,
\”truncateBase64\”: false,
\”copyToClipboard\”: false,
\”includeEmptyDirectories\”: false,
\”git\”: {
\”sortByChanges\”: true,
\”sortByChangesMaxCommits\”: 100,
\”includeDiffs\”: false
}
},
\”include\”: [\”**/*\”],
\”ignore\”: {
\”useGitignore\”: true,
\”useDefaultPatterns\”: true,
// Patterns can also be specified in . repomix ignore
\”customPatterns\”: [
\”additional-folder\”,
\”**/*.log\”
],
},
\”security\”: {
\”enableSecurityCheck\”: true
},
\”tokenCount\”: {
\”encoding\”: \”o200k_base\”
}
}\”>
{ \"input\" : { \"maxFileSize\" : 50000000 } , \"output\" : { \"filePath\" : \" repomix -output.xml\" , \"style\" : \"xml\" , \"parsableStyle\" : false , \"compress\" : false , \"headerText\" : \"Custom header information for the packed file.\" , \"fileSummary\" : true , \"directoryStructure\" : true , \"files\" : true , \"removeComments\" : false , \"removeEmptyLines\" : false , \"topFilesLength\" : 5 , \"showLineNumbers\" : false , \"truncateBase64\" : false , \"copyToClipboard\" : false , \"includeEmptyDirectories\" : false , \"git\" : { \"sortByChanges\" : true , \"sortByChangesMaxCommits\" : 100 , \"includeDiffs\" : false } } , \"include\" : [ \"**/*\" ] , \"ignore\" : { \"useGitignore\" : true , \"useDefaultPatterns\" : true , // Patterns can also be specified in . repomix ignore \"customPatterns\" : [ \"additional-folder\" , \"**/*.log\" ] , } , \"security\" : { \"enableSecurityCheck\" : true } , \"tokenCount\" : { \"encoding\" : \"o200k_base\" } }
全局配置
<p dir=\"auto
