Skip to content

Replace 'hub' with 'ingest' in any github url to get a prompt-friendly extract of a codebase

License

Notifications You must be signed in to change notification settings

cyclotruc/gitingest

Repository files navigation

GitIngest

Image

License PyPI version GitHub stars Downloads GitHub issues Code style: black

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 coresponding digest

gitingest.com Β· Chrome Extension Β· Firefox Add-on

πŸš€ 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 (currently on Linux only)
  • Python package: Import it in your code

πŸ“¦ Installation

pip 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. For anyone who wants install it manually, you may download it here. 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
gitingest /path/to/directory

# From URL
gitingest https://github.com/cyclotruc/gitingest

# See more options
gitingest --help

This will write the digest in a text file (default digest.txt) in your current working directory.

πŸ› Python package usage

from gitingest import ingest

summary, tree, content = ingest("path/to/directory")

# or from URL
summary, tree, content = ingest("https://github.com/cyclotruc/gitingest")

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

🌐 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"

πŸ› οΈ Stack

βœ”οΈ Contributing to Gitingest

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

Ways to help (non-technical)

  • Provide your feedback and ideas on Discord
  • Open an issue on GitHub to report a bug / submit a feature request
  • Talk about Gitingest on social media

How to submit a PR

  1. Fork the repository & clone it locally
  2. Setup the dev environment (see Development section bellow)
  3. Run unit tests with pytest
  4. Commit your changes and run pre-commit
  5. Open a pull request on Github for review and feedback
  6. (Optionnal) Invite project maintainer to your branch for easier collaboration

πŸ”§ Development

Run web UI locally

  1. Clone the repository:

    git clone https://github.com/cyclotruc/gitingest.git
    cd gitingest
  2. Install dependencies:

    pip install -r requirements-dev.txt
    python -m venv .venv
    source .venv/bin/activate
    pre-commit install
  3. Run the application:

    cd src
    uvicorn main:app --reload
  4. Run unit tests:

    pytest

The application should be available at http://localhost:8000

Working on the CLI

  1. Install the package in dev mode:

    pip install -e .
  2. Run the CLI:

    gitingest --help