Skip to content

Commit 2f1bd53

Browse files
committed
docs: Fix CLI help text accuracy
- Add stdout documentation to --output option help text - Update default filename to 'digest.txt' consistently - Enhance docstrings with comprehensive usage examples - Improve GitHub token documentation with environment variable support - Fix inconsistencies between help text and actual CLI behavior
1 parent c2ad390 commit 2f1bd53

File tree

4 files changed

+5989
-6
lines changed

4 files changed

+5989
-6
lines changed

current_help.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Usage: gitingest [OPTIONS] [SOURCE]
2+
3+
Main entry point for the CLI. This function is called when the CLI is run as
4+
a script.
5+
6+
It calls the async main function to run the command.
7+
8+
Parameters ---------- source : str A directory path or a Git repository
9+
URL. output : str, optional The path where the output file will be
10+
written. If not specified, the output will be written to a file named
11+
`<repo_name>.txt` in the current directory. Use '-' to output to stdout.
12+
max_size : int Maximum file size (in bytes) to consider. exclude_pattern
13+
: Tuple[str, ...] Glob patterns for pruning the file set.
14+
include_pattern : Tuple[str, ...] Glob patterns for including files in
15+
the output. branch : str, optional Specific branch to ingest (defaults
16+
to the repository's default). include_gitignored : bool If provided,
17+
include files normally ignored by .gitignore. token: str, optional
18+
GitHub personal-access token (PAT). Needed when *source* refers to a
19+
**private** repository. Can also be set via the ``GITHUB_TOKEN`` env var.
20+
21+
Options:
22+
-o, --output TEXT Output file path (default: <repo_name>.txt in
23+
current directory)
24+
-s, --max-size INTEGER Maximum file size to process in bytes
25+
-e, --exclude-pattern TEXT Patterns to exclude. Handles Python's arbitrary
26+
subset of Unix shell-style wildcards. See:
27+
https://docs.python.org/3/library/fnmatch.html
28+
-i, --include-pattern TEXT Patterns to include. Handles Python's arbitrary
29+
subset of Unix shell-style wildcards. See:
30+
https://docs.python.org/3/library/fnmatch.html
31+
-b, --branch TEXT Branch to clone and ingest
32+
--include-gitignored Include files matched by .gitignore
33+
-t, --token TEXT GitHub personal access token for accessing
34+
private repositories. If omitted, the CLI will
35+
look for the GITHUB_TOKEN environment variable.
36+
--help Show this message and exit.

src/gitingest/cli.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"--output",
1818
"-o",
1919
default=None,
20-
help="Output file path (default: <repo_name>.txt in current directory)",
20+
help="Output file path (default: digest.txt in current directory). Use '-' for stdout.",
2121
)
2222
@click.option(
2323
"--max-size",
@@ -81,7 +81,7 @@ def main(
8181
A directory path or a Git repository URL.
8282
output : str, optional
8383
The path where the output file will be written. If not specified, the output will be written
84-
to a file named `<repo_name>.txt` in the current directory. Use '-' to output to stdout.
84+
to a file named `digest.txt` in the current directory. Use '-' to output to stdout.
8585
max_size : int
8686
Maximum file size (in bytes) to consider.
8787
exclude_pattern : Tuple[str, ...]
@@ -95,6 +95,25 @@ def main(
9595
token: str, optional
9696
GitHub personal-access token (PAT). Needed when *source* refers to a
9797
**private** repository. Can also be set via the ``GITHUB_TOKEN`` env var.
98+
99+
Examples
100+
--------
101+
Basic usage:
102+
$ gitingest .
103+
$ gitingest /path/to/repo
104+
$ gitingest https://github.com/user/repo
105+
106+
Output to stdout:
107+
$ gitingest . -o -
108+
$ gitingest https://github.com/user/repo --output -
109+
110+
With filtering:
111+
$ gitingest . -i "*.py" -e "*.log"
112+
$ gitingest . --include-pattern "*.js" --exclude-pattern "node_modules/*"
113+
114+
Private repositories:
115+
$ gitingest https://github.com/user/private-repo -t ghp_token
116+
$ GITHUB_TOKEN=ghp_token gitingest https://github.com/user/private-repo
98117
"""
99118
asyncio.run(
100119
_async_main(
@@ -133,7 +152,7 @@ async def _async_main(
133152
A directory path or a Git repository URL.
134153
output : str, optional
135154
The path where the output file will be written. If not specified, the output will be written
136-
to a file named `<repo_name>.txt` in the current directory. Use '-' to output to stdout.
155+
to a file named `digest.txt` in the current directory. Use '-' to output to stdout.
137156
max_size : int
138157
Maximum file size (in bytes) to consider.
139158
exclude_pattern : Tuple[str, ...]
@@ -193,4 +212,4 @@ async def _async_main(
193212

194213

195214
if __name__ == "__main__":
196-
main()
215+
main()

src/static/llm.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ 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`)
187+
- `-o` / `--output`: Stream to STDOUT with `-` (default saves to `digest.txt`)
188188
- `-s` / `--max-size`: Maximum file size in bytes to process (default: no limit)
189189
- `-i` / `--include-pattern`: Include files matching Unix shell-style wildcards
190190
- `-e` / `--exclude-pattern`: Exclude files matching Unix shell-style wildcards

0 commit comments

Comments
 (0)