GitリポジトリをLLM向けのプロンプトに適したテキスト形式に変換します。
GitHubのURLでhub
をingest
に置き換えるだけで、対応するダイジェストにアクセスできます。
gitingest.com · Chrome拡張機能 · Firefoxアドオン
Deutsch | Español | Français | 日本語 | 한국어 | Português | Русский | 中文
GitingestはPyPIで利用可能です。
pip
を使用してインストールできます:
pip install gitingest
ただし、pipx
を使用してインストールするのが良いでしょう。
pipx
はお好みのパッケージマネージャーでインストールできます。
brew install pipx
apt install pipx
scoop install pipx
...
pipxを初めて使用する場合は、以下を実行してください:
pipx ensurepath
# install gitingest
pipx install gitingest
拡張機能はオープンソースで、lcandy2/gitingest-extensionで公開されています。
問題や機能リクエストはリポジトリへお願いします。
gitingest
コマンドラインツールを使用すると、コードベースを分析し、その内容をテキストダンプとして作成できます。
# Basic usage (writes to digest.txt by default)
gitingest /path/to/directory
# From URL
gitingest https://github.com/cyclotruc/gitingest
# or from specific subdirectory
gitingest https://github.com/cyclotruc/gitingest/tree/main/src/gitingest/utils
プライベートリポジトリの場合は、--token/-t
オプションを使用してください。
# Get your token from https://github.com/settings/personal-access-tokens
gitingest https://github.com/username/private-repo --token github_pat_...
# Or set it as an environment variable
export GITHUB_TOKEN=github_pat_...
gitingest https://github.com/username/private-repo
デフォルトでは、.gitignore
にリストされたファイルはスキップされます。ダイジェストにこれらのファイルを含める必要がある場合は、--include-gitignored
を使用してください。
デフォルトでは、ダイジェストは現在の作業ディレクトリ内のテキストファイル(digest.txt
)に書き込まれます。出力をカスタマイズするには2つの方法があります:
--output/-o <filename>
を使用して特定のファイルに書き込みます--output/-o -
を使用して直接STDOUT
に出力します(他のツールにパイプする場合に便利)詳細なオプションと使用方法は以下で確認できます:
gitingest --help
# Synchronous usage
from gitingest import ingest
summary, tree, content = ingest("path/to/directory")
# or from URL
summary, tree, content = ingest("https://github.com/cyclotruc/gitingest")
# or from a specific subdirectory
summary, tree, content = ingest("https://github.com/cyclotruc/gitingest/tree/main/src/gitingest/utils")
プライベートリポジトリの場合は、トークンを渡せます:
# Using token parameter
summary, tree, content = ingest("https://github.com/username/private-repo", token="github_pat_...")
# Or set it as an environment variable
import os
os.environ["GITHUB_TOKEN"] = "github_pat_..."
summary, tree, content = ingest("https://github.com/username/private-repo")
デフォルトではファイルは書き込まれませんが、output
引数で有効にできます。
# Asynchronous usage
from gitingest import ingest_async
import asyncio
result = asyncio.run(ingest_async("path/to/directory"))
from gitingest import ingest_async
# Use await directly in Jupyter
summary, tree, content = await ingest_async("path/to/directory")
これはJupyter notebookがデフォルトで非同期であるためです。
イメージをビルド:
docker build -t gitingest .
コンテナを実行:
docker run -d --name gitingest -p 8000:8000 gitingest
アプリケーションはhttp://localhost:8000
で利用可能になります。
ドメインでホスティングする場合は、環境変数ALLOWED_HOSTS
で許可するホスト名を指定できます。
# Default: "gitingest.com, *.gitingest.com, localhost, 127.0.0.1".
ALLOWED_HOSTS="example.com, localhost, 127.0.0.1"
Gitingestは初めてのコントリビューターにも優しい、シンプルなPythonとHTMLのコードベースを目指しています。コード作業中に助けが必要な場合は、Discordでお問い合わせください。プルリクエストの作成方法の詳細は、CONTRIBUTING.mdを参照してください。
NPMの代替品📦 Repomixをチェック: https://github.com/yamadashy/repomix