Skip to content

Commit 2b2efe1

Browse files
authored
Merge branch 'main' into no-error-with-networkerror
2 parents 79fa53a + a63ed9e commit 2b2efe1

File tree

13 files changed

+68
-49
lines changed

13 files changed

+68
-49
lines changed

.github/workflows/publish_to_pypi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
run: |
3232
python -m pip install --upgrade pip
3333
python -m pip install build twine
34+
python -m build
3435
twine check dist/*
3536
- name: Upload dist artefact
3637
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{".":"0.2.0"}
1+
{".":"0.2.1"}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.2.1](https://github.com/coderamp-labs/gitingest/compare/v0.2.0...v0.2.1) (2025-07-27)
4+
5+
6+
### Bug Fixes
7+
8+
* remove logarithm conversion from the backend and correctly process max file size in kb ([#464](https://github.com/coderamp-labs/gitingest/issues/464)) ([932bfef](https://github.com/coderamp-labs/gitingest/commit/932bfef85db66704985c83f3f7c427756bd14023))
9+
310
## [0.2.0](https://github.com/coderamp-labs/gitingest/compare/v0.1.5...v0.2.0) (2025-07-26)
411

512
### Features

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "gitingest"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description="CLI tool to analyze and create text dumps of codebases for LLMs"
55
readme = {file = "README.md", content-type = "text/markdown" }
66
requires-python = ">= 3.8"

src/gitingest/schemas/ingestion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class IngestionQuery(BaseModel): # pylint: disable=too-many-instance-attributes
4141
tag : str | None
4242
The tag of the repository.
4343
max_file_size : int
44-
The maximum file size to ingest (default: 10 MB).
44+
The maximum file size to ingest in bytes (default: 10 MB).
4545
ignore_patterns : set[str]
4646
The patterns to ignore (default: ``set()``).
4747
include_patterns : set[str] | None

src/server/models.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
from __future__ import annotations
44

55
from enum import Enum
6-
from typing import Union
6+
from typing import TYPE_CHECKING, Union
77

88
from pydantic import BaseModel, Field, field_validator
99

1010
from gitingest.utils.compat_func import removesuffix
11+
from server.server_config import MAX_FILE_SIZE_KB
1112

1213
# needed for type checking (pydantic)
13-
from server.form_types import IntForm, OptStrForm, StrForm # noqa: TC001 (typing-only-first-party-import)
14+
if TYPE_CHECKING:
15+
from server.form_types import IntForm, OptStrForm, StrForm
1416

1517

1618
class PatternType(str, Enum):
@@ -39,7 +41,7 @@ class IngestRequest(BaseModel):
3941
"""
4042

4143
input_text: str = Field(..., description="Git repository URL or slug to ingest")
42-
max_file_size: int = Field(..., ge=0, le=500, description="File size slider position (0-500)")
44+
max_file_size: int = Field(..., ge=1, le=MAX_FILE_SIZE_KB, description="File size in KB")
4345
pattern_type: PatternType = Field(default=PatternType.EXCLUDE, description="Pattern type for file filtering")
4446
pattern: str = Field(default="", description="Glob/regex pattern for file filtering")
4547
token: str | None = Field(default=None, description="GitHub PAT for private repositories")

src/server/query_processor.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
from server.models import IngestErrorResponse, IngestResponse, IngestSuccessResponse, PatternType
1414
from server.s3_utils import generate_s3_file_path, is_s3_enabled, upload_to_s3
1515
from server.server_config import MAX_DISPLAY_SIZE
16-
from server.server_utils import Colors, log_slider_to_size
16+
from server.server_utils import Colors
1717

1818

1919
async def process_query(
2020
input_text: str,
21-
slider_position: int,
21+
max_file_size: int,
2222
pattern_type: PatternType,
2323
pattern: str,
2424
token: str | None = None,
@@ -32,8 +32,8 @@ async def process_query(
3232
----------
3333
input_text : str
3434
Input text provided by the user, typically a Git repository URL or slug.
35-
slider_position : int
36-
Position of the slider, representing the maximum file size in the query.
35+
max_file_size : int
36+
Max file size in KB to be include in the digest.
3737
pattern_type : PatternType
3838
Type of pattern to use (either "include" or "exclude")
3939
pattern : str
@@ -55,8 +55,6 @@ async def process_query(
5555
if token:
5656
validate_github_token(token)
5757

58-
max_file_size = log_slider_to_size(slider_position)
59-
6058
try:
6159
query = await parse_remote_repo(input_text, token=token)
6260
except Exception as exc:
@@ -65,7 +63,7 @@ async def process_query(
6563
return IngestErrorResponse(error=str(exc))
6664

6765
query.url = cast("str", query.url)
68-
query.max_file_size = max_file_size
66+
query.max_file_size = max_file_size * 1024 # Convert to bytes since we currently use KB in higher levels
6967
query.ignore_patterns, query.include_patterns = process_patterns(
7068
exclude_patterns=pattern if pattern_type == PatternType.EXCLUDE else None,
7169
include_patterns=pattern if pattern_type == PatternType.INCLUDE else None,
@@ -142,7 +140,7 @@ async def process_query(
142140
digest_url=digest_url,
143141
tree=tree,
144142
content=content,
145-
default_max_file_size=slider_position,
143+
default_max_file_size=max_file_size,
146144
pattern_type=pattern_type,
147145
pattern=pattern,
148146
)

src/server/routers/ingest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from server.models import IngestRequest
1212
from server.routers_utils import COMMON_INGEST_RESPONSES, _perform_ingestion
1313
from server.s3_utils import is_s3_enabled
14-
from server.server_config import MAX_DISPLAY_SIZE
14+
from server.server_config import DEFAULT_FILE_SIZE_KB
1515
from server.server_utils import limiter
1616

1717
ingest_counter = Counter("gitingest_ingest_total", "Number of ingests", ["status", "url"])
@@ -58,7 +58,7 @@ async def api_ingest_get(
5858
request: Request, # noqa: ARG001 (unused-function-argument) # pylint: disable=unused-argument
5959
user: str,
6060
repository: str,
61-
max_file_size: int = MAX_DISPLAY_SIZE,
61+
max_file_size: int = DEFAULT_FILE_SIZE_KB,
6262
pattern_type: str = "exclude",
6363
pattern: str = "",
6464
token: str = "",
@@ -74,7 +74,7 @@ async def api_ingest_get(
7474
- **repository** (`str`): GitHub repository name
7575
7676
**Query Parameters**
77-
- **max_file_size** (`int`, optional): Maximum file size to include in the digest (default: 50 KB)
77+
- **max_file_size** (`int`, optional): Maximum file size in KB to include in the digest (default: 5120 KB)
7878
- **pattern_type** (`str`, optional): Type of pattern to use ("include" or "exclude", default: "exclude")
7979
- **pattern** (`str`, optional): Pattern to include or exclude in the query (default: "")
8080
- **token** (`str`, optional): GitHub personal access token for private repositories (default: "")

src/server/routers_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def _perform_ingestion(
3333

3434
result = await process_query(
3535
input_text=input_text,
36-
slider_position=max_file_size,
36+
max_file_size=max_file_size,
3737
pattern_type=pattern_type,
3838
pattern=pattern,
3939
token=token,

src/server/server_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
DELETE_REPO_AFTER: int = 60 * 60 # In seconds (1 hour)
1111

1212
# Slider configuration (if updated, update the logSliderToSize function in src/static/js/utils.js)
13-
MAX_FILE_SIZE_KB: int = 100 * 1024 # 100 MB
14-
MAX_SLIDER_POSITION: int = 500 # Maximum slider position
13+
DEFAULT_FILE_SIZE_KB: int = 5 * 1024 # 5 mb
14+
MAX_FILE_SIZE_KB: int = 100 * 1024 # 100 mb
1515

1616
EXAMPLE_REPOS: list[dict[str, str]] = [
1717
{"name": "Gitingest", "url": "https://github.com/coderamp-labs/gitingest"},

0 commit comments

Comments
 (0)