Robix是一種功能強大的工具,可將您的整個存儲庫包裝到一個易於友好的文件中。
當您需要將代碼庫饋送到大型語言模型(LLMS)或其他AI工具(例如Claude,Chatgpt和Gemini)時,它是完美的選擇。
筆記
由於法律考慮,該項目已從“ Repopack”重命名為“ robomix”。只有名稱正在更改; ROPOMIX所有功能和維護器(@yamadashy)保持不變。我們致力於確保所有用戶的平穩過渡。
要繼續使用該工具,只需安裝新軟件包:
# Install new package
npm install -g repomix
# Or use directly with npx
npx repomix可選,您也可以卸載舊包:
npm uninstall -g repopack您現有的配置文件( repopack.config.json和.repopackignore )將在過渡期內繼續工作。
repomix將自動檢測到這些文件,並提出將其遷移到新格式( repomix.config.json和.repomixignore )。
感謝您在此過渡期間的理解與合作。
您可以在項目目錄中立即嘗試不安裝ropomix:
npx repomix或全球安裝以備重複使用:
# Install using npm
npm install -g repomix
# Alternatively using yarn
yarn global add repomix
# Alternatively using Homebrew (macOS)
brew install repomix
# Then run in any project directory
repomix就是這樣! Robix將在您當前目錄中生成repomix-output.txt文件,其中包含您的整個存儲庫,以AI友好的格式。
打包您的整個存儲庫:
repomix包裝特定目錄:
repomix path/to/directory使用球形模式包裝特定的文件或目錄:
repomix --include " src/**/*.ts,**/*.md "排除特定文件或目錄:
repomix --ignore " **/*.log,tmp/ "包裝遠程存儲庫:
repomix --remote https://github.com/yamadashy/repomix
# You can also use GitHub shorthand:
repomix --remote yamadashy/repomix初始化一個新的配置文件( repomix.config.json ):
repomix --init生成包裝的文件後,您可以將其與Claude,Chatgpt和Gemini這樣的生成AI工具使用。
使用Ropomix生成包裝的文件後,您可以將其與Claude,Chatgpt和Gemini等AI工具一起使用。以下是一些示例提示,可以讓您入門:
有關全面的代碼審查和重構建議:
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工具的功能,可以隨意修改這些提示。
查看我們的社區討論用戶共享的地方:
隨時加入討論並分享自己的經驗!您的見解可以幫助他人更好地利用綜合體。
Robix在代碼庫的不同部分之間生成一個帶有清晰分離器的單個文件。
為了增強AI理解,輸出文件從面向AI的解釋開始,使AI模型更容易理解包裝存儲庫的上下文和結構。
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
config/
configLoader.ts
(...remaining directories)
================================================================
Repository Files
================================================================
================
File: src/index.js
================
// File contents here
================
File: src/utils.js
================
// File contents here
(...remaining files)
================================================================
Instruction
================================================================
(Custom instructions from `output.instructionFilePath`)
要以XML格式生成輸出,請使用--style xml選項:
repomix --style xmlXML格式以層次的方式構造內容:
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 >
< repository_structure >
src/
cli/
cliOutput.ts
index.ts
(...remaining directories)
</ repository_structure >
< repository_files >
< file path = " src/index.js " >
// File contents here
</ file >
(...remaining files)
</ repository_files >
< instruction >
(Custom instructions from `output.instructionFilePath`)
</ instruction >對於那些對AI上下文中XML標籤潛力感興趣的人:
https://docs.anththropic.com/en/docs/build-with-with-claude/prompt-engineering/use-xml-tags
當您的提示涉及多個組件(例如上下文,說明和示例)時,XML標籤可能會改變遊戲規則。它們幫助克勞德(Claude)更準確地解析您的提示,從而導致更高質量的輸出。
這意味著來自Robix的XML輸出不僅是一種不同的格式,而且可能是將代碼庫饋送到AI系統中的更有效方法,以進行分析,代碼審查或其他任務。
要以降價格式生成輸出,請使用--style markdown選項:
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 ` )這種格式提供了一種干淨,可讀性的結構,既可以通過人工智能係統友好且易於解析。
-v, --version :顯示工具版本-o, --output <file> :指定輸出文件名--include <patterns> :包括模式的列表(逗號分隔)-i, --ignore <patterns> :其他忽略模式(逗號分隔)-c, --config <path> :通往自定義配置文件的路徑--style <style> :指定輸出樣式( plain , xml , markdown )--top-files-len <number> :在摘要中顯示的頂級文件數量--output-show-line-numbers :輸出中顯示行號--copy :此外,將生成的輸出複製到系統剪貼板--remote <url> :處理一個遠程git存儲庫--verbose :啟用詳細記錄示例:
repomix -o custom-output.txt
repomix -i " *.log,tmp " -v
repomix -c ./custom-config.json
repomix --style xml
repomix --remote https://github.com/user/repo.git
npx repomix src要更新全球安裝的綜合體:
# Using npm
npm update -g repomix
# Using yarn
yarn global upgrade repomix使用npx repomix通常更方便,因為它始終使用最新版本。
Robix支持處理遠程GIT存儲庫,而無需手動克隆。此功能使您可以通過單個命令快速分析任何公共GIT存儲庫。
要處理一個遠程存儲庫,請使用--remote選項,然後使用存儲庫URL:
repomix --remote https://github.com/user/repo.git您也可以使用GitHub的速記格式:
repomix --remote user/repo在您的項目root中創建一個repomix.config.json文件以進行自定義配置。
repomix --init這是配置選項的解釋:
| 選項 | 描述 | 預設 |
|---|---|---|
output.filePath | 輸出文件的名稱 | "repomix-output.txt" |
output.style | 輸出的樣式( plain , xml , markdown ) | "plain" |
output.headerText | 自定義文本要包含在文件標頭中 | null |
output.instructionFilePath | 通往包含詳細自定義說明的文件的路徑 | null |
output.removeComments | 是否從支持的文件類型中刪除註釋 | false |
output.removeEmptyLines | 是否要從輸出中刪除空線 | false |
output.showLineNumbers | 是否將線號添加到輸出中的每一行 | false |
output.copyToClipboard | 除保存文件外,是否將輸出複製到系統剪貼板 | false |
output.topFilesLength | 摘要中要顯示的頂級文件數量。如果設置為0,則不會顯示摘要 | 5 |
output.includeEmptyDirectories | 是否在存儲庫結構中包括空目錄 | false |
include | 要包含的文件模式(使用Glog模式) | [] |
ignore.useGitignore | 是否使用項目的.gitignore文件中的模式 | true |
ignore.useDefaultPatterns | 是否使用默認忽略模式 | true |
ignore.customPatterns | 忽略的其他模式(使用球形模式) | [] |
security.enableSecurityCheck | 是否對文件執行安全檢查 | true |
示例配置:
{
"output" : {
"filePath" : " repomix-output.xml " ,
"style" : " xml " ,
"headerText" : " Custom header information for the packed file. " ,
"removeComments" : false ,
"removeEmptyLines" : false ,
"showLineNumbers" : false ,
"copyToClipboard" : true ,
"topFilesLength" : 5 ,
"includeEmptyDirectories" : false
},
"include" : [ " **/* " ],
"ignore" : {
"useGitignore" : true ,
"useDefaultPatterns" : true ,
"customPatterns" : [ " additional-folder " , " **/*.log " ]
},
"security" : {
"enableSecurityCheck" : true
}
}創建一個全局配置文件:
repomix --init --global全局配置文件將創建在:
%LOCALAPPDATA%Repomixrepomix.config.json$XDG_CONFIG_HOME/repomix/repomix.config.json或~/.config/repomix/repomix.config.json注意:本地配置(如果存在)優先於全局配置。
Robix現在支持指定文件,以包括使用Glob模式。這允許更靈活,更強大的文件選擇:
**/*.js將所有JavaScript文件包含在任何目錄中src/**/*將所有文件包括在src目錄及其子目錄中["src/**/*.js", "**/*.md"]以在src中包含JavaScript文件和所有Markdown Files ropomix提供了多種方法來設置忽略模式,用於在包裝過程中排除特定文件或目錄:
.gitignore文件中列出的模式。可以通過ignore.useGitignore設置來控制此行為。ignore.useDefaultPatterns設置來控制此功能。有關更多詳細信息,請參見Defaultignore.ts。.repomixignore文件,以定義綜合症特定的忽略模式。該文件遵循與.gitignore相同的格式。ignore.customPatterns選項指定其他忽略模式。您可以使用-i, --ignore命令行選項覆蓋此設置。優先順序(從最高到最低):
ignore.customPatterns.repomixignore.gitignore (如果ignore.useGitignore使用。ignore.useDefaultPatterns為true)這種方法允許根據項目的需求進行靈活的文件排除配置。通過確保排除對安全敏感的文件和大型二進製文件,它有助於優化生成的包裝文件的大小,同時防止機密信息的洩漏。
注意:默認情況下,二進製文件不包含在包裝的輸出中,但是它們的路徑在輸出文件的“存儲庫結構”部分中列出。這為存儲庫結構提供了完整的概述,同時保持包裝的文件有效和基於文本。
output.instructionFilePath選項允許您指定一個包含有關項目的詳細說明或上下文的單獨文件。這使AI系統可以理解項目的特定上下文和要求,這可能會導致更相關和量身定制的分析或建議。
這是您如何使用此功能的一個示例:
repomix-instruction.md的文件: # Coding Guidelines
- Follow the Airbnb JavaScript Style Guide
- Suggest splitting files into smaller, focused units when appropriate
- Add comments for non-obvious logic. Keep all text in English
- All new features should have corresponding unit tests
# Generate Comprehensive Output
- Include all content without abbreviation, unless specified otherwise
- Optimize for handling large codebases while maintaining output qualityrepomix.config.json中,添加instructionFilePath選項: {
"output" : {
"instructionFilePath" : "repomix-instruction.md" ,
// other options...
}
}當ropomix生成輸出時,它將在專用部分中包含repomix-instruction.md的內容。
注意:指令內容附加在輸出文件的末尾。此放置對於AI系統可能特別有效。對於那些有興趣了解為什麼這可能是有益的人,眾人可以在其文檔中提供一些見解:
https://docs.anththropic.com/en/docs/build-with-with-claude/prompt-engineering/long-context-tips
將長格式數據放在頂部:將長文檔和輸入(〜20k+令牌)放在提示的頂部,高於查詢,說明和示例之上。這可以顯著提高Claude在所有模型中的性能。最終的查詢可以在測試中提高響應質量高達30%,尤其是複雜的多文件輸入。
當output.removeComments設置為true時,Robix將嘗試從支持的文件類型中刪除註釋。此功能可以幫助減少輸出文件的大小,並專注於基本代碼內容。
支持的語言包括:
HTML,CSS,JavaScript,Typescript,Vue,Svelte,Python,Php,Ruby,C,C#,Java,Go,Rust,Swift,Swift,Kotlin,kotlin,Dart,Shell,Shell和Yaml。
注意:評論刪除過程是保守的,避免意外刪除代碼。在復雜的情況下,可能會保留一些評論。
ROSPOMIX包括一個安全檢查功能,該功能使用Sermerlint檢測文件中潛在的敏感信息。此功能可幫助您在共享包裝存儲庫之前確定可能的安全風險。
包裝過程完成後,安全檢查結果將顯示在CLI輸出中。如果檢測到任何可疑文件,您將看到這些文件的列表以及警告消息。
示例輸出:
? Security Check:
──────────────────
2 suspicious file(s) detected:
1. src/utils/test.txt
2. tests/utils/secretLintUtils.test.ts
Please review these files for potentially sensitive information.
默認情況下,啟用了Robix的安全檢查功能。您可以通過設置security.enableSecurityCheck false
{
"security" : {
"enableSecurityCheck" : false
}
}我們歡迎社區的捐款!要開始,請參考我們的貢獻指南。
該項目已根據MIT許可獲得許可。
回到頂部