A structured Python application that analyzes a public GitHub repository using deterministic metrics plus an LLM provider.
Supported LLM providers:
- Ollama (local)
- Gemini API
It analyzes:
- stars, forks, watchers, open issues
- primary/core language and language percentages
- README quality
- selected source code
- repository structure and health signals
- detected project stack
- AI-generated summary and recommendations
- Python 3.10+
- Git
- A GitHub personal access token (recommended for higher API rate limits)
- Either:
- Ollama installed and running locally, or
- a Gemini API key
python -m venv .venv
.\.venv\Scripts\Activate.ps1python -m venv .venv
.venv\Scripts\activatepython3 -m venv .venv
source .venv/bin/activatepython -m pip install --upgrade pip
pip install -r requirements.txtCopy the example environment file:
copy .env.example .envcp .env.example .envEdit .env.
For Ollama:
LLM_PROVIDER=ollama
GITHUB_TOKEN=your_github_token
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=qwen2.5-coder:7bFor Gemini:
LLM_PROVIDER=gemini
GITHUB_TOKEN=your_github_token
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.5-flashDo not commit .env.
Install Ollama, then pull the model configured in .env, for example:
ollama pull qwen2.5-coder:7bEnsure Ollama is running before starting the analyzer.
Interactive:
python app.pyOr:
python app.py https://github.com/owner/repositoryChoose a provider for one run:
python app.py https://github.com/owner/repository --provider ollamaor:
python app.py https://github.com/owner/repository --provider geminiSave the normalized report:
python app.py https://github.com/owner/repository --json report.jsonpython -m unittest discover -s tests -vgithub-repo-analyzer/
├── app.py
├── config.py
├── requirements.txt
├── .env.example
├── .gitignore
├── github/
│ ├── client.py
│ └── file_fetcher.py
├── analyzers/
│ ├── language_analyzer.py
│ ├── readme_analyzer.py
│ ├── code_analyzer.py
│ ├── structure_analyzer.py
│ └── health_analyzer.py
├── llm/
│ ├── base.py
│ ├── factory.py
│ ├── ollama_client.py
│ ├── gemini_client.py
│ ├── prompts.py
│ └── parsing.py
├── models/
│ └── repository_report.py
├── services/
│ └── analysis_service.py
├── output/
│ ├── console_reporter.py
│ └── json_reporter.py
├── utils/
│ └── github_url.py
└── tests/
- Parse the GitHub URL.
- Fetch repository metadata, languages, README, and the repository tree.
- Select a limited number of useful source/config files.
- Calculate deterministic language and repository-health metrics.
- Send README and selected code to the configured LLM.
- Normalize everything into one report.
- Print the report and optionally write JSON.
The analyzer intentionally does not send the entire repository to the LLM. Generated/vendor/binary files and common dependency/build directories are ignored, and source input is capped.
- Keep
.envprivate. - Use least-privilege GitHub credentials.
- Repository code is untrusted input. This project reads code but does not execute it.
- With Ollama, prompts stay with your configured local Ollama server.
- With Gemini, selected repository content is sent to the Gemini API. Do not analyze private/sensitive repositories unless that is acceptable for your environment.
Good next additions:
- commit/contributor activity
- stale repository detection
- dependency vulnerability tooling
- AST-based complexity metrics
- test-framework detection
- GitHub Actions analysis
- repository comparison
- web dashboard using FastAPI/Streamlit
- HTML/PDF report export