Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions src/gitingest/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"--output",
"-o",
default=None,
help="Output file path (default: <repo_name>.txt in current directory)",
help="Output file path (default: digest.txt in current directory). Use '-' for stdout.",
)
@click.option(
"--max-size",
Expand Down Expand Up @@ -81,7 +81,7 @@ def main(
A directory path or a Git repository URL.
output : str, optional
The path where the output file will be written. If not specified, the output will be written
to a file named `<repo_name>.txt` in the current directory. Use '-' to output to stdout.
to a file named `digest.txt` in the current directory. Use '-' to output to stdout.
max_size : int
Maximum file size (in bytes) to consider.
exclude_pattern : Tuple[str, ...]
Expand All @@ -95,6 +95,25 @@ def main(
token: str, optional
GitHub personal-access token (PAT). Needed when *source* refers to a
**private** repository. Can also be set via the ``GITHUB_TOKEN`` env var.

Examples
--------
Basic usage:
$ gitingest .
$ gitingest /path/to/repo
$ gitingest https://github.com/user/repo

Output to stdout:
$ gitingest . -o -
$ gitingest https://github.com/user/repo --output -

With filtering:
$ gitingest . -i "*.py" -e "*.log"
$ gitingest . --include-pattern "*.js" --exclude-pattern "node_modules/*"

Private repositories:
$ gitingest https://github.com/user/private-repo -t ghp_token
$ GITHUB_TOKEN=ghp_token gitingest https://github.com/user/private-repo
"""
asyncio.run(
_async_main(
Expand Down Expand Up @@ -133,7 +152,7 @@ async def _async_main(
A directory path or a Git repository URL.
output : str, optional
The path where the output file will be written. If not specified, the output will be written
to a file named `<repo_name>.txt` in the current directory. Use '-' to output to stdout.
to a file named `digest.txt` in the current directory. Use '-' to output to stdout.
max_size : int
Maximum file size (in bytes) to consider.
exclude_pattern : Tuple[str, ...]
Expand Down Expand Up @@ -193,4 +212,4 @@ async def _async_main(


if __name__ == "__main__":
main()
main()
4 changes: 2 additions & 2 deletions src/static/llm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ gitingest https://github.com/user/private-repo -t $GITHUB_TOKEN -o -
# Specific branch analysis (short flag)
gitingest https://github.com/user/repo -b main -o -

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

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

**Key Parameters for AI Agents**:
- `-o` / `--output`: Stream to STDOUT with `-` (default saves to `<repo_name>.txt`)
- `-o` / `--output`: Stream to STDOUT with `-` (default saves to `digest.txt`)
- `-s` / `--max-size`: Maximum file size in bytes to process (default: no limit)
- `-i` / `--include-pattern`: Include files matching Unix shell-style wildcards
- `-e` / `--exclude-pattern`: Exclude files matching Unix shell-style wildcards
Expand Down
Loading