Skip to content

Commit f54b37c

Browse files
Merge branch 'main' into fix/windows-support
2 parents 6805a6d + 2592303 commit f54b37c

File tree

4 files changed

+64
-11
lines changed

4 files changed

+64
-11
lines changed

src/gitingest/cli.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,40 @@ class _CLIArgs(TypedDict):
6161
"--output",
6262
"-o",
6363
default=None,
64-
help="Write to PATH (or '-' for stdout, default: <repo>.txt).",
64+
help="Output file path (default: digest.txt in current directory). Use '-' for stdout.",
6565
)
6666
def main(**cli_kwargs: Unpack[_CLIArgs]) -> None:
67-
"""Run the CLI entry point to analyze a repo / directory and dump its contents."""
67+
"""Run the CLI entry point to analyze a repo / directory and dump its contents.
68+
69+
Parameters
70+
----------
71+
**cli_kwargs : Unpack[_CLIArgs]
72+
A dictionary of keyword arguments forwarded to ``ingest_async``.
73+
74+
Notes
75+
-----
76+
See ``ingest_async`` for a detailed description of each argument.
77+
78+
Examples
79+
--------
80+
Basic usage:
81+
$ gitingest
82+
$ gitingest /path/to/repo
83+
$ gitingest https://github.com/user/repo
84+
85+
Output to stdout:
86+
$ gitingest -o -
87+
$ gitingest https://github.com/user/repo --output -
88+
89+
With filtering:
90+
$ gitingest -i "*.py" -e "*.log"
91+
$ gitingest --include-pattern "*.js" --exclude-pattern "node_modules/*"
92+
93+
Private repositories:
94+
$ gitingest https://github.com/user/private-repo -t ghp_token
95+
$ GITHUB_TOKEN=ghp_token gitingest https://github.com/user/private-repo
96+
97+
"""
6898
asyncio.run(_async_main(**cli_kwargs))
6999

70100

@@ -88,7 +118,7 @@ async def _async_main(
88118
Parameters
89119
----------
90120
source : str
91-
Directory path or Git repository URL.
121+
A directory path or a Git repository URL.
92122
max_size : int
93123
Maximum file size in bytes to ingest (default: 10 MB).
94124
exclude_pattern : tuple[str, ...] | None
@@ -103,7 +133,7 @@ async def _async_main(
103133
GitHub personal access token (PAT) for accessing private repositories.
104134
Can also be set via the ``GITHUB_TOKEN`` environment variable.
105135
output : str | None
106-
Destination file path. If ``None``, the output is written to ``<repo_name>.txt`` in the current directory.
136+
The path where the output file will be written (default: ``digest.txt`` in current directory).
107137
Use ``"-"`` to write to ``stdout``.
108138
109139
Raises

src/gitingest/utils/git_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ async def check_repo_exists(url: str, token: str | None = None) -> bool:
124124
If the curl command returns an unexpected status code.
125125
126126
"""
127-
expected_path_length = 2
128127
if token and is_github_host(url):
129128
return await _check_github_repo_exists(url, token=token)
130129

@@ -143,11 +142,13 @@ async def check_repo_exists(url: str, token: str | None = None) -> bool:
143142
response = stdout.decode()
144143
status_line = response.splitlines()[0].strip()
145144
parts = status_line.split(" ")
145+
146+
expected_path_length = 2
146147
if len(parts) >= expected_path_length:
147-
status_code_str = parts[1]
148-
if status_code_str in ("200", "301"):
148+
status = parts[1]
149+
if status in ("200", "301"):
149150
return True
150-
if status_code_str in ("302", "404"):
151+
if status in ("302", "404"):
151152
return False
152153
msg = f"Unexpected status line: {status_line}"
153154
raise RuntimeError(msg)

src/server/templates/components/git_form.jinja

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,29 @@
145145
name="token"
146146
placeholder="Personal Access Token"
147147
value="{{ token if token else '' }}"
148-
class="py-2 px-2 bg-[#E8F0FE] focus:outline-none w-full rounded">
148+
class="py-2 pl-2 pr-8 bg-[#E8F0FE] focus:outline-none w-full rounded">
149+
<!-- Info icon with tooltip -->
150+
<span class="absolute right-3 top-1/2 -translate-y-1/2">
151+
<!-- Icon -->
152+
<svg class="w-4 h-4 text-gray-600 cursor-pointer peer"
153+
xmlns="http://www.w3.org/2000/svg"
154+
fill="none"
155+
viewBox="0 0 24 24"
156+
stroke="currentColor"
157+
stroke-width="2">
158+
<circle cx="12" cy="12" r="10" />
159+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 16v-4m0-4h.01" />
160+
</svg>
161+
<!-- Tooltip (tooltip listens to peer-hover) -->
162+
<div class="absolute bottom-full mb-2 left-1/2 -translate-x-1/2 bg-gray-900 text-white text-xs leading-tight py-1 px-2 rounded shadow-lg opacity-0 pointer-events-none peer-hover:opacity-100 peer-hover:pointer-events-auto transition-opacity duration-200 whitespace-nowrap">
163+
<ul class="list-disc pl-4">
164+
<li>PAT is never stored in the backend</li>
165+
<li>Used once for cloning, then discarded from memory</li>
166+
<li>No browser caching</li>
167+
<li>Cloned repos are deleted after processing</li>
168+
</ul>
169+
</div>
170+
</span>
149171
</div>
150172
</div>
151173
<!-- Help section -->

src/static/llm.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,20 @@ gitingest https://github.com/user/private-repo -t $GITHUB_TOKEN -o -
176176
# Specific branch analysis (short flag)
177177
gitingest https://github.com/user/repo -b main -o -
178178

179-
# Save to file (default: <repo_name>.txt in current directory)
179+
# Save to file (default: digest.txt in current directory)
180180
gitingest https://github.com/user/repo -o my_analysis.txt
181181

182182
# Ultra-concise example for small files only
183183
gitingest https://github.com/user/repo -i "*.py" -s 51200 -o -
184184
```
185185

186186
**Key Parameters for AI Agents**:
187-
- `-o` / `--output`: Stream to STDOUT with `-` (default saves to `<repo_name>.txt`)
188187
- `-s` / `--max-size`: Maximum file size in bytes to process (default: no limit)
189188
- `-i` / `--include-pattern`: Include files matching Unix shell-style wildcards
190189
- `-e` / `--exclude-pattern`: Exclude files matching Unix shell-style wildcards
191190
- `-b` / `--branch`: Specify branch to analyze (defaults to repository's default branch)
192191
- `-t` / `--token`: GitHub personal access token for private repositories
192+
- `-o` / `--output`: Stream to STDOUT with `-` (default saves to `digest.txt`)
193193

194194
### 4.2 Python Package (Best for Code Integration)
195195
```python

0 commit comments

Comments
 (0)