Repomixは、リポジトリ全体を単一のAIに優しいファイルに詰め込む強力なツールです。
コードベースを大規模な言語モデル(LLMS)またはClaude、ChatGpt、Geminiなどの他のAIツールにフィードする必要がある場合に最適です。
注記
法的考慮事項により、このプロジェクトは「リポパック」から「Repomix」に改名されています。名前だけが変更されています。 Repomixすべての機能とメンテナー(@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 )に移行することを申し出ます。
この移行中のご理解と協力に感謝します。
インストールなしでプロジェクトディレクトリで即座にrepomixを試すことができます。
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それでおしまい! Repomixは、現在のディレクトリに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ツールで使用できます。
Repomixを使用して梱包されたファイルを生成したら、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ツールの機能に基づいて、これらのプロンプトを自由に変更してください。
ユーザーが共有するコミュニティディスカッションをチェックしてください。
ディスカッションに自由に参加して、自分の経験を共有してください!あなたの洞察は、他の人がRepomixをよりよく使用するのに役立ちます。
Repomixは、コードベースの異なる部分の間にクリアセパレーターを使用して単一のファイルを生成します。
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.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags
プロンプトにコンテキスト、命令、例などの複数のコンポーネントが含まれる場合、XMLタグはゲームチェンジャーになります。クロードはあなたのプロンプトをより正確に解析し、高品質の出力につながります。
これは、RepomixからのXML出力は単なる別の形式ではなく、分析、コードレビュー、またはその他のタスクのためにコードベースをAIシステムに送るためのより効果的な方法であることを意味します。
Markdown形式で出力を生成するには、 --style markdownオプションを使用します。
repomix --style markdownMarkdownフォーマットは、階層的な方法でコンテンツを構成します。
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 ` )この形式は、人間に優しい、AIシステムによって簡単に解凍できるクリーンで読みやすい構造を提供します。
-v, --version :ツールバージョンを表示します-o, --output <file> :出力ファイル名を指定します--include <patterns> :インクルードパターンのリスト(Commaseparated)-i, --ignore <patterns> :追加の無視パターン(Commaseparated)-c, --config <path> :カスタム構成ファイルへのパス--style <style> :出力スタイルを指定します( plain 、 xml 、 markdown )--top-files-len <number> :要約に表示するトップファイルの数--output-show-line-numbers :出力のライン番号を表示します--copy :生成された出力をシステムクリップボードにさらにコピーします--remote <url> :リモートGITリポジトリを処理します--verbose :verbose loggingを有効にします例:
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グローバルにインストールされているRepomixを更新するには:
# Using npm
npm update -g repomix
# Using yarn
yarn global upgrade repomix npx repomixを使用すると、最新バージョンを常に使用するため、一般的に便利です。
Repomixは、手動クローニングを必要とせずにリモートGITリポジトリの処理をサポートしています。この機能を使用すると、1つのコマンドでパブリックGitリポジトリをすばやく分析できます。
リモートリポジトリを処理するには、 --remoteオプションを使用してリポジトリURLを使用します。
repomix --remote https://github.com/user/repo.gitGithubの速記形式を使用することもできます。
repomix --remote user/repoカスタム構成のプロジェクトルートに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 | 含めるファイルのパターン(グローブパターンを使用) | [] |
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注:ローカル構成(存在する場合)は、グローバル構成よりも優先されます。
Repomixは、グローブパターンを使用するようにファイルの指定をサポートするようになりました。これにより、より柔軟で強力なファイルの選択が可能になります:
**/*.jsを使用して、すべてのJavaScriptファイルを任意のディレクトリに含めるsrc/**/*を使用して、 srcディレクトリ内にすべてのファイルとそのサブディレクトリを含める["src/**/*.js", "**/*.md"]などの複数のパターンを組み合わせて、 srcおよびすべてのマークダウンファイルにJavaScriptファイルを含めるRepomixは、梱包プロセス中に特定のファイルまたはディレクトリを除外するためのパターンを無視するための複数の方法を提供します。
.gitignoreファイルにリストされているパターンが使用されます。この動作は、 ignore.useGitignoreの設定で制御できます。ignore.useDefaultPatterns設定で制御できます。詳細については、defaultignore.tsをご覧ください。.repomixignoreファイルを作成して、Repomix固有の無視パターンを定義できます。このファイルは、 .gitignoreと同じ形式に従います。ignore.customPatternsオプションを使用して指定できます。この設定を-i, --ignoreコマンドラインオプションで上書きすることができます。優先順序(最高から最低まで):
ignore.customPatterns.repomixignore.gitignore ( ignore.useGitignoreの場合。susegitignoreが真実です)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...
}
} Repomixが出力を生成すると、専用のセクションにrepomix-instruction.mdの内容が含まれます。
注:命令コンテンツは、出力ファイルの最後に追加されます。この配置は、AIシステムに特に効果的です。これがなぜ有益であるかを理解することに興味がある人のために、人類は彼らのドキュメントにいくつかの洞察を提供します。
https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/long-context-tips
長い形式のデータを上部に配置します:クエリ、指示、例の上に、プロンプトの上部に長いドキュメントと入力(〜20k+トークン)を置きます。これにより、すべてのモデルでクロードのパフォーマンスが大幅に向上する可能性があります。最後のクエリは、特に複雑でマルチドキュメント入力を使用して、テストで最大30%の応答品質を改善できます。
output.removeCommentsがtrueに設定されると、Repomixはサポートされているファイルタイプからコメントを削除しようとします。この機能は、出力ファイルのサイズを縮小し、必須のコードコンテンツに焦点を当てるのに役立ちます。
サポートされている言語には以下が含まれます。
HTML、CSS、JavaScript、TypeScript、Vue、Svelte、Python、PHP、Ruby、C、C#、Java、Go、Rust、Swift、Kotlin、Dart、Shell、およびYaml。
注:コメントの削除プロセスは、誤ってコードを削除することを避けるために保守的です。複雑な場合、いくつかのコメントが保持される場合があります。
Repomixには、SecretLintを使用してファイル内の潜在的に機密情報を検出するセキュリティチェック機能が含まれています。この機能は、梱包されたリポジトリを共有する前に、可能なセキュリティリスクを特定するのに役立ちます。
セキュリティチェック結果は、梱包プロセスが完了した後に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.
デフォルトでは、Repomixのセキュリティチェック機能が有効になっています。 security.enableSecurityCheckを設定することで無効にできます。設定ファイルでeNablesecuritycheckにfalseになります。
{
"security" : {
"enableSecurityCheck" : false
}
}コミュニティからの貢献を歓迎します!開始するには、寄稿ガイドを参照してください。
このプロジェクトは、MITライセンスの下でライセンスされています。
トップに戻ります