Skip to content

Commit 1ab39dd

Browse files
refactor: standardize terminology and documentation
- Standardized capitalization of 'Git', 'GitHub', and 'URL' - Removed trailing slashes in links and added missing sentence periods in `README.md` - Adjusted docstrings to adhere to PEP 257 by using imperative tense - Standardized docstrings in `exceptions.py` - Replaced 'GitHub' with 'Git' when referring to broader context - Renamed templates: `github.jinja` → `git.jinja`, `github_form.jinja` → `git_form.jinja` - Renamed variables: `github_url` → `repo_url`
1 parent 6d92ed9 commit 1ab39dd

File tree

16 files changed

+53
-52
lines changed

16 files changed

+53
-52
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ FROM python:3.12-slim
2020
ENV PYTHONUNBUFFERED=1
2121
ENV PYTHONDONTWRITEBYTECODE=1
2222

23-
# Install git
23+
# Install Git
2424
RUN apt-get update \
2525
&& apt-get install -y --no-install-recommends git curl\
2626
&& rm -rf /var/lib/apt/lists/*

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

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

14-
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.
1515

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

1818
## 🚀 Features
1919

20-
- **Easy code context**: Get a text digest from a git repository URL or a directory
20+
- **Easy code context**: Get a text digest from a Git repository URL or a directory
2121
- **Smart Formatting**: Optimized output format for LLM prompts
2222
- **Statistics about**:
2323
- File and directory structure
@@ -36,11 +36,12 @@ pip install gitingest
3636

3737
<!-- markdownlint-disable MD033 -->
3838
<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>
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>
4040
<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>
4141
<!-- markdownlint-enable MD033 -->
4242

4343
The extension is open source at [lcandy2/gitingest-extension](https://github.com/lcandy2/gitingest-extension).
44+
4445
Issues and feature requests are welcome to the repo.
4546

4647
## 💡 Command line usage
@@ -71,7 +72,7 @@ summary, tree, content = ingest("path/to/directory")
7172
summary, tree, content = ingest("https://github.com/cyclotruc/gitingest")
7273
```
7374

74-
By default, this won't write a file but can be enabled with the `output` argument
75+
By default, this won't write a file but can be enabled with the `output` argument.
7576

7677
## 🌐 Self-host
7778

@@ -87,31 +88,30 @@ By default, this won't write a file but can be enabled with the `output` argumen
8788
docker run -d --name gitingest -p 8000:8000 gitingest
8889
```
8990

90-
The application will be available at `http://localhost:8000`
91+
The application will be available at `http://localhost:8000`.
9192

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

9495
```bash
95-
#Default: "gitingest.com,*.gitingest.com,localhost, 127.0.0.1".
96+
# Default: "gitingest.com, *.gitingest.com, localhost, 127.0.0.1".
9697
ALLOWED_HOSTS="example.com, localhost, 127.0.0.1"
9798
```
9899

99100
## 🛠️ Stack
100101

101-
- [Tailwind CSS](https://tailwindcss.com/) - Frontend
102+
- [Tailwind CSS](https://tailwindcss.com) - Frontend
102103
- [FastAPI](https://github.com/fastapi/fastapi) - Backend framework
103-
- [Jinja2](https://jinja.palletsprojects.com/) - HTML templating
104+
- [Jinja2](https://jinja.palletsprojects.com) - HTML templating
104105
- [tiktoken](https://github.com/openai/tiktoken) - Token estimation
105-
- [apianalytics.dev](https://www.apianalytics.dev/) - Simple Analytics
106+
- [apianalytics.dev](https://www.apianalytics.dev) - Simple Analytics
106107

107-
### Looking for a javascript/node package?
108+
### Looking for a JavaScript/Node package?
108109

109110
Check out the NPM alternative 📦 Repomix: <https://github.com/yamadashy/repomix>
110111

111112
## ✔️ Contributing to Gitingest
112113

113-
Gitingest aims to be friendly for first time contributors, with a simple python and html codebase.
114-
If you need any help while working with the code, reach out to us on [discord](https://discord.com/invite/zerRaGK9EC)
114+
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](https://discord.com/invite/zerRaGK9EC).
115115

116116
### Ways to help (non-technical)
117117

@@ -125,7 +125,7 @@ Gitingest aims to be friendly for first time contributors, with a simple python
125125
2. Setup the dev environment (see Development section bellow)
126126
3. Run unit tests with `pytest`
127127
4. Commit your changes and run `pre-commit`
128-
5. Open a pull request on Github for review and feedback
128+
5. Open a pull request on GitHub for review and feedback
129129
6. (Optionnal) Invite project maintainer to your branch for easier collaboration
130130

131131
## 🔧 Development
@@ -161,7 +161,7 @@ Gitingest aims to be friendly for first time contributors, with a simple python
161161
pytest
162162
```
163163

164-
The application should be available at `http://localhost:8000`
164+
The application should be available at `http://localhost:8000`.
165165

166166
### Working on the CLI
167167

src/gitingest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Gitingest: A package for ingesting data from git repositories. """
1+
""" Gitingest: A package for ingesting data from Git repositories. """
22

33
from gitingest.query_ingestion import run_ingest_query
44
from gitingest.query_parser import parse_query

src/gitingest/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, pattern: str) -> None:
2323

2424
class AsyncTimeoutError(Exception):
2525
"""
26-
Raised when an async operation exceeds its timeout limit.
26+
Exception raised when an async operation exceeds its timeout limit.
2727
2828
This exception is used by the `async_timeout` decorator to signal that the wrapped
2929
asynchronous function has exceeded the specified time limit for execution.
@@ -38,7 +38,7 @@ def __init__(self, max_files: int) -> None:
3838

3939

4040
class MaxFileSizeReachedError(Exception):
41-
"""Raised when the maximum file size is reached."""
41+
"""Exception raised when the maximum file size is reached."""
4242

4343
def __init__(self, max_size: int):
4444
super().__init__(f"Maximum file size limit ({max_size/1024/1024:.1f}MB) reached.")

src/gitingest/query_ingestion.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ def _read_file_content(file_path: Path) -> str:
170170

171171
def _sort_children(children: list[dict[str, Any]]) -> list[dict[str, Any]]:
172172
"""
173-
Sort children nodes with:
173+
Sort the children nodes of a directory according to a specific order.
174+
175+
Order of sorting:
174176
1. README.md first
175177
2. Regular files (not starting with dot)
176178
3. Hidden files (starting with dot)

src/gitingest/repository_clone.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CloneConfig:
3737
@async_timeout(CLONE_TIMEOUT)
3838
async def clone_repo(config: CloneConfig) -> tuple[bytes, bytes]:
3939
"""
40-
Clones a repository to a local path based on the provided configuration.
40+
Clone a repository to a local path based on the provided configuration.
4141
4242
This function handles the process of cloning a Git repository to the local file system.
4343
It can clone a specific branch or commit if provided, and it raises exceptions if
@@ -55,7 +55,7 @@ async def clone_repo(config: CloneConfig) -> tuple[bytes, bytes]:
5555
Returns
5656
-------
5757
tuple[bytes, bytes]
58-
A tuple containing the stdout and stderr of the git commands executed.
58+
A tuple containing the stdout and stderr of the Git commands executed.
5959
6060
Raises
6161
------
@@ -101,13 +101,12 @@ async def clone_repo(config: CloneConfig) -> tuple[bytes, bytes]:
101101

102102
async def _check_repo_exists(url: str) -> bool:
103103
"""
104-
Check if a repository exists at the given URL using an HTTP HEAD request.
104+
Check if a Git repository exists at the provided URL.
105105
106106
Parameters
107107
----------
108108
url : str
109-
The URL of the repository.
110-
109+
The URL of the Git repository to check.
111110
Returns
112111
-------
113112
bool
@@ -130,22 +129,22 @@ async def _check_repo_exists(url: str) -> bool:
130129

131130
async def _run_git_command(*args: str) -> tuple[bytes, bytes]:
132131
"""
133-
Executes a git command asynchronously and captures its output.
132+
Execute a Git command asynchronously and captures its output.
134133
135134
Parameters
136135
----------
137136
*args : str
138-
The git command and its arguments to execute.
137+
The Git command and its arguments to execute.
139138
140139
Returns
141140
-------
142141
tuple[bytes, bytes]
143-
A tuple containing the stdout and stderr of the git command.
142+
A tuple containing the stdout and stderr of the Git command.
144143
145144
Raises
146145
------
147146
RuntimeError
148-
If the git command exits with a non-zero status.
147+
If the Git command exits with a non-zero status.
149148
"""
150149
proc = await asyncio.create_subprocess_exec(
151150
*args,

src/gitingest/repository_ingest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def ingest(
2727
Parameters
2828
----------
2929
source : str
30-
The source to analyze, which can be a URL (for a GitHub repository) or a local directory path.
30+
The source to analyze, which can be a URL (for a Git repository) or a local directory path.
3131
max_file_size : int
3232
Maximum allowed file size for file ingestion. Files larger than this size are ignored, by default
3333
10*1024*1024 (10 MB).

src/query_processor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ async def process_query(
2626
"""
2727
Process a query by parsing input, cloning a repository, and generating a summary.
2828
29-
Handle user input, process GitHub repository data, and prepare
29+
Handle user input, process Git repository data, and prepare
3030
a response for rendering a template with the processed results or an error message.
3131
3232
Parameters
3333
----------
3434
request : Request
3535
The HTTP request object.
3636
input_text : str
37-
Input text provided by the user, typically a GitHub repository URL or slug.
37+
Input text provided by the user, typically a Git repository URL or slug.
3838
slider_position : int
3939
Position of the slider, representing the maximum file size in the query.
4040
pattern_type : str
@@ -63,13 +63,13 @@ async def process_query(
6363
else:
6464
raise ValueError(f"Invalid pattern type: {pattern_type}")
6565

66-
template = "index.jinja" if is_index else "github.jinja"
66+
template = "index.jinja" if is_index else "git.jinja"
6767
template_response = partial(templates.TemplateResponse, name=template)
6868
max_file_size = log_slider_to_size(slider_position)
6969

7070
context = {
7171
"request": request,
72-
"github_url": input_text,
72+
"repo_url": input_text,
7373
"examples": EXAMPLE_REPOS if is_index else [],
7474
"default_file_size": slider_position,
7575
"pattern_type": pattern_type,

src/routers/dynamic.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414
@router.get("/{full_path:path}")
1515
async def catch_all(request: Request, full_path: str) -> HTMLResponse:
1616
"""
17-
Renders a page with a GitHub URL based on the provided path.
17+
Render a page with a Git URL based on the provided path.
1818
19-
This endpoint catches all GET requests with a dynamic path, constructs a GitHub URL
20-
using the `full_path` parameter, and renders the `github.jinja` template with that URL.
19+
This endpoint catches all GET requests with a dynamic path, constructs a Git URL
20+
using the `full_path` parameter, and renders the `git.jinja` template with that URL.
2121
2222
Parameters
2323
----------
2424
request : Request
2525
The incoming request object, which provides context for rendering the response.
2626
full_path : str
27-
The full path extracted from the URL, which is used to build the GitHub URL.
27+
The full path extracted from the URL, which is used to build the Git URL.
2828
2929
Returns
3030
-------
3131
HTMLResponse
32-
An HTML response containing the rendered template, with the GitHub URL
32+
An HTML response containing the rendered template, with the Git URL
3333
and other default parameters such as loading state and file size.
3434
"""
3535
return templates.TemplateResponse(
36-
"github.jinja",
36+
"git.jinja",
3737
{
3838
"request": request,
39-
"github_url": f"https://github.com/{full_path}",
39+
"repo_url": full_path,
4040
"loading": True,
4141
"default_file_size": 243,
4242
},
@@ -53,7 +53,7 @@ async def process_catch_all(
5353
pattern: str = Form(...),
5454
) -> HTMLResponse:
5555
"""
56-
Processes the form submission with user input for query parameters.
56+
Process the form submission with user input for query parameters.
5757
5858
This endpoint handles POST requests, processes the input parameters (e.g., text, file size, pattern),
5959
and calls the `process_query` function to handle the query logic, returning the result as an HTML response.

src/routers/index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@router.get("/", response_class=HTMLResponse)
1616
async def home(request: Request) -> HTMLResponse:
1717
"""
18-
Renders the home page with example repositories and default parameters.
18+
Render the home page with example repositories and default parameters.
1919
2020
This endpoint serves the home page of the application, rendering the `index.jinja` template
2121
and providing it with a list of example repositories and default file size values.
@@ -51,7 +51,7 @@ async def index_post(
5151
pattern: str = Form(...),
5252
) -> HTMLResponse:
5353
"""
54-
Processes the form submission with user input for query parameters.
54+
Process the form submission with user input for query parameters.
5555
5656
This endpoint handles POST requests from the home page form. It processes the user-submitted
5757
input (e.g., text, file size, pattern type) and invokes the `process_query` function to handle

0 commit comments

Comments
 (0)