How mr-aicoder/repopilot works
Project type and purpose
• RepoPilot is a monolithic, single-page web application built with Streamlit.
• Its purpose is to provide an AI-powered assistant for interacting with GitHub repositories: loading a repo, performing semantic search over its contents (RAG), visualizing file trees, debugging code, and generating snippets.
• It integrates with external services: GitHub REST API for repo content, a Groq LLM API for chat and code generation, and a Chroma vector store (backed by sqlite3) for embedding-based retrieval.
File structure
• Top-level files:
• .devcontainer/devcontainer.json – VS Code dev container configuration (development environment).
• README.md – project overview, feature list, installation & deployment steps.
• app.py – the entire Streamlit application (UI + backend logic).
• requirements.txt – Python dependencies (Streamlit, LangChain, Chroma, sentence-transformers, etc.).
• No separate “frontend” or “backend” directories—everything lives in app.py.
• Configuration and secrets are managed via .env (GROQ_API_KEY, GITHUB_TOKEN) and Streamlit Cloud secrets.
README for additional insights
• System components described:
• Streamlit UI (two columns: chat/repo overview & debugging/generation).
• Vector store using Chroma (with sqlite3 workaround).
• LLM calls to Groq.
• GitHub repository fetch & semantic chunking (LangChain embeddings).
• Deployment notes emphasize pysqlite3 hack for Streamlit Cloud.
a. Main components
• Client Browser (user)
• Streamlit App (app.py)
• UI Layer: two-column layout
• Controller/Business Logic:
· GitHub Integration Module
· Document Loader + Chunking
· Embeddings & Vector Store (Chroma + sqlite3)
· Query Handler for semantic search
· Debugging / Code Generation Handler
• Service Adapters:
· Groq LLM API
· GitHub REST API
• Vector Store (Chroma DB backed by sqlite3)
• External Services:
• Groq API
• GitHub API
• Development Environment (.devcontainer)
• .env / Secrets Store
b. Relationships & interactions
1. User interacts with the Streamlit UI via browser.
2. Streamlit UI invokes functions in app.py.
3. On “Load Repo”:
– App retrieves files from GitHub API → LangChain document loader → chunks → embeddings → stored in Chroma.
4. On “Ask Question”:
– Query Handler performs semantic search on Chroma → returns top chunks → sends prompt + context to Groq LLM API → receives response → displays in UI.
5. On “Debug / Generate Code”:
– Takes error snippet or request → context lookup in vector store or file tree → crafts prompt → calls Groq API → displays solution.
6. App persists vector store in sqlite3 via pysqlite3 shim.
c. Architectural patterns & design principles
• Monolithic single-process server (Streamlit) with clear logical separation inside a single file.
• Retrieval-Augmented Generation (RAG) pattern: Combine vector store search with LLM.
• Adapter pattern for external services (GitHub, Groq).
• Two-column UI pattern for parallel workflows (overview vs debugging).
d. Key technologies & libraries
• Streamlit – web UI framework
• LangChain – document loading, embeddings orchestration
• sentence-transformers – embedding models
• Chroma – vector database
• Groq API – LLM
• GitHub REST API – repository retrieval
• pysqlite3 – sqlite backend workaround