* feat: add optional --include-submodules flag to CLI and ingestion
- Adds --include-submodules CLI flag to control submodule analysis
- Propagates include_submodules through ingestion, schemas, and clone logic
- Updates tests to cover submodule inclusion
- Adds a helper function (_checkout_partial_clone) to avoid repetition
- Adds include_submodules example in README.md
- Web UI for this option is not implemented for now (https://github.com/cyclotruc/gitingest/pull/313#issuecomment-3019912523)
---------
Co-authored-by: Filip Christiansen <22807962+filipchristiansen@users.noreply.github.com>
* docs: add links to other language versions of README
---------
Co-authored-by: Filip Christiansen <22807962+filipchristiansen@users.noreply.github.com>
* Add subdirectory URL syntax documentation to README
Document how to access specific subdirectories using GitHub tree URLs with gitingest repo examples.
Co-authored-by: Filip Christiansen <22807962+filipchristiansen@users.noreply.github.com>
* Add option to output digest to stdout
This change introduces the ability for users to direct the output of the gitingest tool to standard output (stdout) instead of writing to a file. This is useful for piping the output to other commands or viewing it directly in the terminal.
Co-authored-by: Filip Christiansen <22807962+filipchristiansen@users.noreply.github.com>
* fix: split sparse-checkout & commit checkout when cloning; refresh docs/CLI
* Run `git sparse-checkout set …` and `git checkout <sha>` as two calls—matches Git’s CLI rules and fixes failures.
* Tidy clone path creation via _ensure_directory; use DEFAULT_TIMEOUT.
* Clarify CLI/help strings and schema docstrings.
* Update tests for the new two-step checkout flow.
* feat(auth): support private GitHub repos & correct sparse-checkout flow
* CLI: new `--token/-t` flag (fallback to `GITHUB_TOKEN`)
* clone_repo:
* injects Basic-auth header when a PAT is supplied
* validates PAT format (`github_pat_*`)
* git_utils:
* `create_git_auth_header`, `validate_github_token`, `create_git_command`
* `_check_github_repo_exists` & branch-listing now work with tokens
* os_utils.ensure_directory extracted for reuse
* tests updated to reflect new call signatures
* allow git PAT to start with gth_
* fix GITHUB_PAT_PATTERN and add instructions to README
* fix gph_ to ghp_
* docs: add GITHUB_TOKEN env var example to README
* add GITHUB_TOKEN environment variable also in code
The title attribute for the Microsoft Edge Add-ons link mistakenly referenced "Firefox Add-ons."
Updated it to properly reflect "Microsoft Edge Add-ons" to avoid confusion.
* Add Python 3.9 support by using ParamSpec from typing_extensions and removing match statements
* Add Python 3.7 support by reverting inline generics and removing walrus usage
* Update pyproject.toml
* feat: make parser domain-agnostic to support multiple Git hosts
- added list of known domains/Git hosts in `query_parser.py`
- fixed bug from [#115](https://github.com/cyclotruc/gitingest/pull/115): corrected case handling for URL components—scheme, domain, username, and repository are case-insensitive, but paths beyond (e.g., file names, branches) are case-sensitive
- implemented `try_domains_for_user_and_repo` in `query_parser.py` to iteratively guess the correct domain until success or supported hosts are exhausted
- added helper functions `_get_user_and_repo_from_path`, `_validate_host`, and `_validate_scheme` in `query_parser.py`
- extended `_parse_repo_source` in `query_parser.py` to be Git host agnostic by using `try_domains_for_user_and_repo`
- added tests `test_parse_url_unsupported_host` and `test_parse_query_with_branch` in `test_query_parser.py`
- created new file `test_git_host_agnostic.py` to verify domain/Git host agnostic behavior
* Refactor project structure, enhance logic, update configurations, and improve code quality
Refactoring and Logic Improvements
- Refactored the `_scan_directory` function in `src/gitingest/ingest_from_query.py` by extracting loop logic into the new `_process_item` function, and further separating functionality into `_process_symlink` and `_process_file`
- Replaced multiple return statements with error raising and catching, introducing custom exceptions (`MaxFilesReachedError`, `MaxFileSizeReachedError`, `AlreadyVisitedError`) in the `_process_item` and `_scan_directory` functions
- Enhanced the logic in the `process_query` function in `src/process_query.py` for better flow and maintainability
- Improved the logic in `_generate_token_string` in `src/gitingest/ingest_from_query.py`
- Refined the `download_ingest` function in `src/routers/download.py` for better clarity and functionality
Exception Handling Enhancements
- Replaced broad `Exception` handling with specific `OSError` in the `_read_file_content` function in `src/gitingest/ingest_from_query.py`
- Refined exception handling throughout the codebase, including removing redundant try-except-raise blocks, e.g., in `clone_repo` function in `src/gitingest/clone.py`
- Added custom exceptions to `src/gitingest/exceptions.py`: `MaxFilesReachedError`, `MaxFileSizeReachedError`, and `AlreadyVisitedError`
- Included explicit re-raising of exceptions in various functions for improved error propagation
Test Suite Refactoring
- Cleaned up and reorganized test files:
- Moved tests from `src/gitingest/tests/` to `tests/`
- Consolidated fixtures from `tests/test_ingest.py` into `tests/conftest.py`
- Removed redundant content from `tests/conftest.py`
- Migrated configuration from `pytest.ini` to `pyproject.toml`, deleted `pytest.ini`, and updated `.dockerignore`
Documentation Improvements
- Added `darglint` for enforcing `numpy` docstring style in `.pre-commit-config.yaml` for `src/` files
- Updated docstrings throughout the codebase, including adding module docstrings where needed
- Updated `README.md`:
- Added "GitHub stars" badge
- Moved the "Discord" badge to its own line
- Replaced occurrences of "Gitingest" with "GitIngest" for consistency and clarity
Linting and Code Quality
- Integrated `pylint` into `.pre-commit-config.yaml` for both `src/` and `tests/` directories
- Created `tests/.pylintrc` for linting configuration specific to test files
Code Clean-up
- Removed the redundant `src/__init__.py` file
Naming Conventions and Code Style
- Renamed `logSliderToSize` to `log_slider_to_size` in `src/server_utils.py` for consistency with Python's naming conventions
- Added explicit encoding specification in multiple instances of `open` throughout the code
Code Quality:
- Add markdownlint to pre-commit hooks for consistent markdown formatting
- Add missing type hints to constants and variables
- Prefix helper functions with underscore for better encapsulation
Documentation:
- Update README.md to follow markdown best practices
- Add docstrings to functions in process_query.py, server_utils.py and main.py
Refactoring:
- Remove redundant normalize_pattern function from client.py
- Simplify logic in should_exclude function in ingest_from_query.py
- Improve code organization in clone.py
- Move async_timeout comment into function body for better context
* chore: add pre-commit config, type hints, badges, and lint codebase
- Add .pre-commit-config.yaml and pyproject.toml for Black and isort
- Add missing type hints throughout the code (Dict[...] for Python 3.8 compatibility)
- Added badges and convert existing badges to use <a><img></a> format
- Lint Markdown files
- Lint Jinja templates with djlint
* Resolve error and fix remaining type hint violations
* Fix absolute imports and mock paths in test_clone.py to resolve test failures.
* Replace deprecated 'dotenv' with 'python-dotenv' in requirements.txt to resolve installation errors.
* feat(cli): add comprehensive CLI documentation to README
- Add installation instructions for global CLI usage
- Document all CLI options and flags with examples
- Include detailed usage examples for common scenarios
- Describe output format and automatic file ignoring
- Maintain consistent formatting with existing README sections
* feat: Make TrustedHostMiddleware configurable via ALLOWED_HOSTS env var
* feat: Make TrustedHostMiddleware configurable via ALLOWED_HOSTS env var
* feat: Make TrustedHostMiddleware configurable via ALLOWED_HOSTS env var