Skip to content

Commit d195003

Browse files
authored
Merge branch 'main' into patch-1
2 parents cb620cd + d2825ea commit d195003

27 files changed

+739
-334
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ repos:
6666
- id: isort
6767
description: "Sort imports alphabetically, and automatically separated into sections and by type."
6868

69-
- repo: https://github.com/hadialqattan/pycln
70-
rev: v2.4.0
71-
hooks:
72-
- id: pycln
73-
description: "Remove unused import statements."
7469

7570
- repo: https://github.com/djlint/djLint
7671
rev: v1.36.4

README.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
# GitIngest
1+
# Gitingest
22

3-
[![Image](./docs/frontpage.png "GitIngest main page")](https://gitingest.com)
3+
[![Image](./docs/frontpage.png "Gitingest main page")](https://gitingest.com)
44

55
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cyclotruc/gitingest/blob/main/LICENSE)
66
[![PyPI version](https://badge.fury.io/py/gitingest.svg)](https://badge.fury.io/py/gitingest)
77
[![GitHub stars](https://img.shields.io/github/stars/cyclotruc/gitingest?style=social.svg)](https://github.com/cyclotruc/gitingest)
88
[![Downloads](https://pepy.tech/badge/gitingest)](https://pepy.tech/project/gitingest)
9-
[![GitHub issues](https://img.shields.io/github/issues/cyclotruc/gitingest)](https://github.com/cyclotruc/gitingest/issues)
10-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
119

1210
[![Discord](https://dcbadge.limes.pink/api/server/https://discord.com/invite/zerRaGK9EC)](https://discord.com/invite/zerRaGK9EC)
1311

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

16-
You can also replace `hub` with `ingest` in any github url to access the coresponding digest
14+
You can also replace `hub` with `ingest` in any GitHub URL to access the coresponding digest
1715

18-
[gitingest.com](https://gitingest.com)
16+
[gitingest.com](https://gitingest.com/) · [Chrome Extension](https://chromewebstore.google.com/detail/adfjahbijlkjfoicpjkhjicpjpjfaood) · [Firefox Add-on](https://addons.mozilla.org/firefox/addon/gitingest/)
1917

2018
## 🚀 Features
2119

@@ -25,7 +23,7 @@ You can also replace `hub` with `ingest` in any github url to access the corespo
2523
- File and directory structure
2624
- Size of the extract
2725
- Token count
28-
- **CLI tool**: Run it as a command (Currently on Linux only)
26+
- **CLI tool**: Run it as a shell command (currently on Linux only)
2927
- **Python package**: Import it in your code
3028

3129
## 📦 Installation
@@ -34,15 +32,26 @@ You can also replace `hub` with `ingest` in any github url to access the corespo
3432
pip install gitingest
3533
```
3634

37-
## 💡 Command Line usage
35+
## 🧩 Browser Extension Usage
36+
37+
<!-- markdownlint-disable MD033 -->
38+
<a href="https://chromewebstore.google.com/detail/adfjahbijlkjfoicpjkhjicpjpjfaood" target="_blank" title="Get Gitingest Extension from Chrome Web Store"><img height="48" src="https://github.com/user-attachments/assets/20a6e44b-fd46-4e6c-8ea6-aad436035753" alt="Available in the Chrome Web Store" /></a>
39+
<a href="https://addons.mozilla.org/firefox/addon/gitingest/" target="_blank" title="Get Gitingest Extension from Firefox Add-ons"><img height="48" src="https://github.com/user-attachments/assets/c0e99e6b-97cf-4af2-9737-099db7d3538b" alt="Get The Add-on for Firefox" /></a>
40+
<a href="https://microsoftedge.microsoft.com/addons/detail/nfobhllgcekbmpifkjlopfdfdmljmipf" target="_blank" title="Get Gitingest Extension from Firefox Add-ons"><img height="48" src="https://github.com/user-attachments/assets/204157eb-4cae-4c0e-b2cb-db514419fd9e" alt="Get from the Edge Add-ons" /></a>
41+
<!-- markdownlint-enable MD033 -->
42+
43+
The extension is open source at [lcandy2/gitingest-extension](https://github.com/lcandy2/gitingest-extension).
44+
Issues and feature requests are welcome to the repo.
45+
46+
## 💡 Command line usage
3847

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

4150
```bash
4251
# Basic usage
4352
gitingest /path/to/directory
4453

45-
# From url
54+
# From URL
4655
gitingest https://github.com/cyclotruc/gitingest
4756

4857
# See more options
@@ -95,15 +104,19 @@ If you are hosting it on a domain, you can specify the allowed hostnames via env
95104
- [tiktoken](https://github.com/openai/tiktoken) - Token estimation
96105
- [apianalytics.dev](https://www.apianalytics.dev/) - Simple Analytics
97106

107+
### Looking for a javascript/node package?
108+
109+
Check out the NPM alternative 📦 Repomix: <https://github.com/yamadashy/repomix>
110+
98111
## ✔️ Contributing to Gitingest
99112

100113
Gitingest aims to be friendly for first time contributors, with a simple python and html codebase.
101114
If you need any help while working with the code, reach out to us on [discord](https://discord.com/invite/zerRaGK9EC)
102115

103116
### Ways to help (non-technical)
104117

105-
- Provide your feedback and ideas on discord
106-
- Open an Issue on github to report a bug / submit an feature request
118+
- Provide your feedback and ideas on Discord
119+
- Open an issue on GitHub to report a bug / submit a feature request
107120
- Talk about Gitingest on social media
108121

109122
### How to submit a PR
@@ -119,14 +132,14 @@ Gitingest aims to be friendly for first time contributors, with a simple python
119132

120133
### Run web UI locally
121134

122-
1. Clone the repository
135+
1. Clone the repository:
123136

124137
```bash
125138
git clone https://github.com/cyclotruc/gitingest.git
126139
cd gitingest
127140
```
128141

129-
2. Install dependencies
142+
2. Install dependencies:
130143

131144
```bash
132145
pip install -r requirements-dev.txt
@@ -142,7 +155,7 @@ Gitingest aims to be friendly for first time contributors, with a simple python
142155
uvicorn main:app --reload
143156
```
144157

145-
4. Run unit tests
158+
4. Run unit tests:
146159

147160
```bash
148161
pytest
@@ -152,13 +165,13 @@ The application should be available at `http://localhost:8000`
152165

153166
### Working on the CLI
154167

155-
1. Install the package in dev mode
168+
1. Install the package in dev mode:
156169

157170
```bash
158171
pip install -e .
159172
```
160173

161-
2. Run the CLI
174+
2. Run the CLI:
162175

163176
```bash
164177
gitingest --help

src/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
""" Configuration file for the project. """
22

3+
from pathlib import Path
4+
35
MAX_DISPLAY_SIZE: int = 300_000
4-
TMP_BASE_PATH: str = "/tmp/gitingest"
6+
TMP_BASE_PATH = Path("/tmp/gitingest")
57
DELETE_REPO_AFTER: int = 60 * 60 # In seconds
68

79
EXAMPLE_REPOS: list[dict[str, str]] = [
8-
{"name": "GitIngest", "url": "https://github.com/cyclotruc/gitingest"},
10+
{"name": "Gitingest", "url": "https://github.com/cyclotruc/gitingest"},
911
{"name": "FastAPI", "url": "https://github.com/tiangolo/fastapi"},
1012
{"name": "Flask", "url": "https://github.com/pallets/flask"},
1113
{"name": "Tldraw", "url": "https://github.com/tldraw/tldraw"},

src/gitingest/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
""" gitingest: A package for ingesting data from git repositories. """
1+
""" Gitingest: A package for ingesting data from git repositories. """
22

33
from gitingest.clone import clone_repo
44
from gitingest.ingest import ingest
5-
from gitingest.ingest_from_query import ingest_from_query
5+
from gitingest.ingest_from_query import run_ingest_query
66
from gitingest.parse_query import parse_query
77

8-
__all__ = ["ingest_from_query", "clone_repo", "parse_query", "ingest"]
8+
__all__ = ["run_ingest_query", "clone_repo", "parse_query", "ingest"]

src/gitingest/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Command-line interface for the GitIngest package. """
1+
""" Command-line interface for the Gitingest package. """
22

33
# pylint: disable=no-value-for-parameter
44

src/gitingest/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Custom exceptions for the GitIngest package. """
1+
""" Custom exceptions for the Gitingest package. """
22

33

44
class InvalidPatternError(ValueError):

src/gitingest/ignore_patterns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Default ignore patterns for GitIngest. """
1+
""" Default ignore patterns for Gitingest. """
22

33
DEFAULT_IGNORE_PATTERNS: list[str] = [
44
# Python

src/gitingest/ingest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import inspect
55
import shutil
66

7+
from config import TMP_BASE_PATH
78
from gitingest.clone import CloneConfig, clone_repo
8-
from gitingest.ingest_from_query import ingest_from_query
9+
from gitingest.ingest_from_query import run_ingest_query
910
from gitingest.parse_query import parse_query
1011

1112

@@ -63,7 +64,7 @@ def ingest(
6364
# Extract relevant fields for CloneConfig
6465
clone_config = CloneConfig(
6566
url=query["url"],
66-
local_path=query["local_path"],
67+
local_path=str(query["local_path"]),
6768
commit=query.get("commit"),
6869
branch=query.get("branch"),
6970
)
@@ -74,7 +75,7 @@ def ingest(
7475
else:
7576
raise TypeError("clone_repo did not return a coroutine as expected.")
7677

77-
summary, tree, content = ingest_from_query(query)
78+
summary, tree, content = run_ingest_query(query)
7879

7980
if output is not None:
8081
with open(output, "w", encoding="utf-8") as f:
@@ -84,6 +85,5 @@ def ingest(
8485
finally:
8586
# Clean up the temporary directory if it was created
8687
if query["url"]:
87-
# Clean up the temporary directory under /tmp/gitingest
88-
cleanup_path = "/tmp/gitingest"
89-
shutil.rmtree(cleanup_path, ignore_errors=True)
88+
# Clean up the temporary directory
89+
shutil.rmtree(TMP_BASE_PATH, ignore_errors=True)

0 commit comments

Comments
 (0)