Spaces:
Sleeping
Sleeping
|
Download README.md from toasted1920/GitRead: direct link, hf CLI and curl.
- Browser
- Download file 6.93 kB
-
https://huggingface.co/spaces/toasted1920/GitRead/resolve/main/README.md
- Command line
-
hf download hf://spaces/toasted1920/GitRead/README.md
-
curl -L -o README.md https://huggingface.co/spaces/toasted1920/GitRead/resolve/main/README.md
6.93 kB
| title: GitRead | |
| emoji: π | |
| colorFrom: red | |
| colorTo: red | |
| sdk: docker | |
| pinned: false | |
| <div align="center"> | |
| <br /> | |
| <img src="https://img.shields.io/badge/GitRead-FF6A00?style=for-the-badge&logoColor=white" alt="GitRead" height="40"/> | |
| <br /><br /> | |
| # GitRead | |
| ### Chat with any GitHub repository β instantly. | |
| Paste a GitHub URL. Ask anything about the codebase. | |
| No docs. No setup. No confusion. | |
| <br /> | |
| [](https://python.org) | |
| [](https://fastapi.tiangolo.com) | |
| [](https://langchain-ai.github.io/langgraph) | |
| [](LICENSE) | |
| [](https://github.com/vidit1920/GitRead/stargazers) | |
| <br /> | |
|  | |
| </div> | |
| --- | |
| ## π§ What is GitRead? | |
| **GitRead** is an AI-powered developer tool that lets you have a natural language conversation with any GitHub repository. | |
| Instead of spending hours reading source code, digging through READMEs, or guessing how things connect β just paste a GitHub URL and ask. GitRead clones the repo, indexes it using local vector embeddings, and lets you chat with the entire codebase in plain English. | |
| --- | |
| ## β¨ Features | |
| | Feature | Description | | |
| |---|---| | |
| | π **Any GitHub URL** | Works with any public repository | | |
| | β‘ **Instant Analysis** | Clones, indexes and understands code in seconds | | |
| | π§ **AI Chat** | Ask anything β architecture, bugs, how to run, dependencies | | |
| | πΊ **Code Map** | Understand how files and modules connect | | |
| | π **Bug Finder** | Spot issues without reading every line | | |
| | π¦ **Zero Docs Needed** | GitRead reads the code so you don't have to | | |
| | π **Bring Your Own Key** | Use your own Gemini, OpenAI or Claude API key | | |
| | π **Local Embeddings** | SFR-Embedding-Code-400M runs on the server via ONNX Runtime (no torch needed) | | |
| --- | |
| ## π Tech Stack | |
| ``` | |
| Frontend β HTML Β· CSS Β· Vanilla JavaScript | |
| Backend β Python Β· FastAPI Β· Uvicorn | |
| AI / LLM β Gemini / OpenAI / Claude (your key) Β· LangGraph | |
| Vector Search β ChromaDB Β· Local Embeddings | |
| Architecture β Agentic RAG Pipeline | |
| ``` | |
| --- | |
| ## π Getting Started | |
| ### Prerequisites | |
| - Python 3.10+ | |
| - Git | |
| - An API key from Google Gemini ([free](https://aistudio.google.com/app/apikey)), OpenAI or Anthropic β pasted in the app's Settings, not in `.env` | |
| ### Installation | |
| ```bash | |
| # 1. Clone the repository | |
| git clone https://github.com/vidit1920/GitRead.git | |
| cd GitRead | |
| # 2. Create and activate virtual environment | |
| python -m venv venv | |
| # Windows | |
| venv\Scripts\activate | |
| # Mac / Linux | |
| source venv/bin/activate | |
| # 3. Install dependencies (for a GPU, replace onnxruntime with onnxruntime-gpu) | |
| pip install -r requirements.txt | |
| # 4. (Optional) environment variables | |
| cp .env.example .env | |
| # 5. Start the app (serves the frontend too) | |
| uvicorn back_end.main:app --host 127.0.0.1 --port 8000 | |
| # 6. Open http://127.0.0.1:8000 and add your API key via the key icon | |
| ``` | |
| --- | |
| ## π¬ Example Questions | |
| Once you paste a GitHub URL and hit **Analyse**, you can ask: | |
| ``` | |
| "How do I run this project locally?" | |
| "Explain the overall architecture" | |
| "What are all the dependencies and what do they do?" | |
| "Where is the main entry point?" | |
| "Find any potential bugs or issues" | |
| "Generate a code map of this repo" | |
| "What does the authentication flow look like?" | |
| ``` | |
| --- | |
| ## π Project Structure | |
| ``` | |
| GitRead/ | |
| βββ back_end/ | |
| β βββ agent/ | |
| β β βββ graph.py # LangGraph agent definition | |
| β β βββ tools.py # Agent tools | |
| β βββ core/ | |
| β β βββ downloader.py # GitHub repo cloner | |
| β β βββ embeddings.py # Vector embedding pipeline | |
| β β βββ loader.py # File loader | |
| β β βββ splitter.py # Code chunker | |
| β βββ config.py # App + security configuration | |
| β βββ llm.py # Bring-your-own-key provider factory | |
| β βββ security.py # Rate limiting + security headers | |
| β βββ sessions.py # Per-visitor isolated sessions | |
| β βββ main.py # FastAPI entry point | |
| βββ front_end/ | |
| β βββ index.html # Main UI | |
| β βββ style.css # Styles | |
| β βββ app.js # Frontend logic | |
| β βββ bg.js # Background animation | |
| βββ requirements.txt | |
| βββ README.md | |
| ``` | |
| --- | |
| ## βοΈ Environment Variables | |
| Users bring their own LLM key, so **no secret is required** to run GitRead. | |
| All settings are optional β see [`.env.example`](.env.example) for the full list: | |
| | Variable | Default | Purpose | | |
| |---|---|---| | |
| | `ALLOW_SERVER_KEY_FALLBACK` | `false` | If `true`, visitors without a key use `GOOGLE_API_KEY` (your quota!) | | |
| | `GOOGLE_API_KEY` | β | Only used with the fallback above. Set it as a **Secret** on Hugging Face | | |
| | `ALLOWED_ORIGINS` | empty | Extra origins allowed to call the API cross-origin | | |
| | `MAX_LOADED_REPOS` | `20` | Repos held in memory at once (idle ones are evicted first) | | |
| | `RATE_LIMIT_CHAT_PER_MIN` | `12` | Chat requests per session per minute | | |
| | `EMBEDDING_TIME_BUDGET_SECONDS` | `600` | If embedding a repo would take longer than this on the current hardware, fall back to keyword + file search | | |
| | `MAX_CHUNKS_TO_EMBED` | `4000` | Hard cap on chunks to embed | | |
| | `EMBEDDING_DEVICE` | `auto` | `auto` (CUDA when `onnxruntime-gpu` is installed) or `cpu` | | |
| > **Speed:** the 400M embedding model is heavy for a CPU. On a free 2-vCPU Space expect roughly | |
| > 1β3 chunks per minute, so only small repos get semantic search within the default 10-minute budget; | |
| > larger ones automatically use keyword (BM25) + exact/file search. A GPU or larger CPU Space removes the limit. | |
| > The embedding model `Salesforce/SFR-Embedding-Code-400M_R` is licensed **CC-BY-NC-4.0** (non-commercial use only). | |
| --- | |
| ## π€ Contributing | |
| Contributions are welcome! Feel free to open an issue or submit a pull request. | |
| 1. Fork the repo | |
| 2. Create your branch (`git checkout -b feature/amazing-feature`) | |
| 3. Commit your changes (`git commit -m 'add amazing feature'`) | |
| 4. Push to the branch (`git push origin feature/amazing-feature`) | |
| 5. Open a Pull Request | |
| --- | |
| ## π License | |
| Distributed under the MIT License. See [`LICENSE`](LICENSE) for more information. | |
| --- | |
| <div align="center"> | |
| Built with β€οΈ by [vidit1920](https://github.com/vidit1920) | |
| β Star this repo if you found it useful! | |
| </div> | |