Skip to main content

CLI tool to analyze and create text dumps of codebases for LLMs

Project description

Gitingest

Image

License PyPI version GitHub stars Downloads

Discord

Turn any Git repository into a prompt-friendly text ingest for LLMs.

You can also replace hub with ingest in any GitHub URL to access the corresponding digest.

gitingest.com · Chrome Extension · Firefox Add-on

Deutsch | Español | Français | 日本語 | 한국어 | Português | Русский | 中文

🚀 Features

  • Easy code context: Get a text digest from a Git repository URL or a directory
  • Smart Formatting: Optimized output format for LLM prompts
  • Statistics about:
    • File and directory structure
    • Size of the extract
    • Token count
  • CLI tool: Run it as a shell command
  • Python package: Import it in your code

📚 Requirements

📦 Installation

Gitingest is available on PyPI. You can install it using pip:

pip install gitingest

However, it might be a good idea to use pipx to install it. You can install pipx using your preferred package manager.

brew install pipx
apt install pipx
scoop install pipx
...

If you are using pipx for the first time, run:

pipx ensurepath
# install gitingest
pipx install gitingest

🧩 Browser Extension Usage

Available in the Chrome Web Store Get The Add-on for Firefox Get from the Edge Add-ons

The extension is open source at lcandy2/gitingest-extension.

Issues and feature requests are welcome to the repo.

💡 Command line usage

The gitingest command line tool allows you to analyze codebases and create a text dump of their contents.

# 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

For private repositories, use the --token/-t option.

# 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

By default, files listed in .gitignore are skipped. Use --include-gitignored if you need those files in the digest.

By default, the digest is written to a text file (digest.txt) in your current working directory. You can customize the output in two ways:

  • Use --output/-o <filename> to write to a specific file.
  • Use --output/-o - to output directly to STDOUT (useful for piping to other tools).

See more options and usage details with:

gitingest --help

🐍 Python package usage

# 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")

For private repositories, you can pass a token:

# 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")

By default, this won't write a file but can be enabled with the output argument.

# Asynchronous usage
from gitingest import ingest_async
import asyncio

result = asyncio.run(ingest_async("path/to/directory"))

Jupyter notebook usage

from gitingest import ingest_async

# Use await directly in Jupyter
summary, tree, content = await ingest_async("path/to/directory")

This is because Jupyter notebooks are asynchronous by default.

🐳 Self-host

  1. Build the image:

    docker build -t gitingest .
    
  2. Run the container:

    docker run -d --name gitingest -p 8000:8000 gitingest
    

The application will be available at http://localhost:8000.

If you are hosting it on a domain, you can specify the allowed hostnames via env variable ALLOWED_HOSTS.

# Default: "gitingest.com, *.gitingest.com, localhost, 127.0.0.1".
ALLOWED_HOSTS="example.com, localhost, 127.0.0.1"

🤝 Contributing

Non-technical ways to contribute

  • Create an Issue: If you find a bug or have an idea for a new feature, please create an issue on GitHub. This will help us track and prioritize your request.
  • Spread the Word: If you like Gitingest, please share it with your friends, colleagues, and on social media. This will help us grow the community and make Gitingest even better.
  • Use Gitingest: The best feedback comes from real-world usage! If you encounter any issues or have ideas for improvement, please let us know by creating an issue on GitHub or by reaching out to us on Discord.

Technical ways to contribute

Gitingest aims to be friendly for first time contributors, with a simple Python and HTML codebase. If you need any help while working with the code, reach out to us on Discord. For detailed instructions on how to make a pull request, see CONTRIBUTING.md.

🛠️ Stack

Looking for a JavaScript/FileSystemNode package?

Check out the NPM alternative 📦 Repomix: https://github.com/yamadashy/repomix

🚀 Project Growth

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitingest-0.1.5.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

gitingest-0.1.5-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file gitingest-0.1.5.tar.gz.

File metadata

  • Download URL: gitingest-0.1.5.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gitingest-0.1.5.tar.gz
Algorithm Hash digest
SHA256 34f36a99e5c24ce54f2a5c39b884ebffdc97ff70b33e7459182713098c04abe7
MD5 c7b8885f2580ea273c0117927926aebe
BLAKE2b-256 eca46733a09bb901d0b9a7fca72f2413d38dbdd556f263737129f60ae4a7887c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitingest-0.1.5.tar.gz:

Publisher: publish.yml on cyclotruc/gitingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitingest-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: gitingest-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gitingest-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6060670d6aa1e664ceec6e203525b6863a6eca78c044ad19a09841756657767b
MD5 7d8c532996991a4d174c3116b411dfe5
BLAKE2b-256 48ade2597f6431d0aa192b1690c7e75eb4fbd8c74720f96bab60abc503105838

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitingest-0.1.5-py3-none-any.whl:

Publisher: publish.yml on cyclotruc/gitingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page