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

🚀 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 command (Currently on Linux only)
  • Python package: Import it in your code

📦 Installation

pip install gitingest

💡 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 an 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

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks