How utkarshshukla1180/github-repository-copilot works
Repository Copilot lets a user add a public Python repository, index its code, and ask questions answered from retrieved source. The documented flow clones and AST-chunks files, embeds and stores chunks, then rewrites questions, combines semantic and keyword retrieval, expands dependencies, and generates a grounded answer. The graph preserves the documented frontend, authentication, persistence, and AI-service capabilities. Some indexing and UI wiring is documented rather than shown in excerpts; those edges cite the README.
Main entry points: backend.py Index and answer orchestration · App.tsx App and screens · app.py HTTP orchestration · hybrid.py Hybrid retrieval
Components 31
Web client
- App and screens
repository-copilot-frontend/src/App.tsx - API client
repository-copilot-frontend/src/services/api.ts - Chat interface
repository-copilot-frontend/src/components/ChatWindow/ChatWindow.tsx - Chat state
repository-copilot-frontend/src/hooks/useChat.ts - Repository indexing UI
repository-copilot-frontend/src/hooks/useCloneRepository.ts - Session history
repository-copilot-frontend/src/hooks/useSessions.ts
API and accounts
- Token verification
auth.py - HTTP orchestration
app.py - Account and chat data
database/crud.py - Persistence schema
database/models.py
Repository indexing
- Repository clone
clone_repo.py - Source file loading
read_files.py - AST chunking
chunker.py - Embedding generation
embeddings.py - Chunk and BM25 store
chunk_store.py - Collection management
vector_store.py
Question answering
- Index and answer orchestration
backend.py - Hybrid retrieval
retrieval/hybrid.py - Semantic search
retrieval/retrieve.py - Keyword search
retrieval/keyword_search.py - Rank fusion
retrieval/rrf.py - Dependency expansion
retrieval/dependency.py - Question rewriting
llm/rewrite.py - Answer generation
llm/generate.py - Model provider
llm/provider.py
Other components
- User
- PostgreSQL
- Qdrant
- Gemini API
- Ollama
- Supabase Auth
Connections 37
- User → App and screens: uses
README.md - App and screens → API client: requests
- App and screens → Chat interface: renders
- App and screens → Chat state: uses
- App and screens → Repository indexing UI: uses
- App and screens → Session history: loads
- API client → HTTP orchestration: calls
README.md - HTTP orchestration → Token verification: checks tokens
app.py - Token verification → Supabase Auth: verifies token
auth.py - HTTP orchestration → Index and answer orchestration: starts indexing and asks
app.py - HTTP orchestration → Account and chat data: reads and writes
app.py - Account and chat data → Persistence schema: uses models
database/crud.py - Persistence schema → PostgreSQL: persists records
README.md - Index and answer orchestration → Repository clone: clones repository
backend.py - Index and answer orchestration → Source file loading: loads source
backend.py - Index and answer orchestration → AST chunking: chunks code
backend.py - Index and answer orchestration → Embedding generation: embeds chunks
backend.py - Index and answer orchestration → Chunk and BM25 store: stores chunks
backend.py - Index and answer orchestration → Collection management: manages collection
backend.py - Chunk and BM25 store → Collection management: uses client
chunk_store.py - Collection management → Qdrant: stores vectors
README.md - Embedding generation → Gemini API: requests embeddings
embeddings.py - Index and answer orchestration → Question rewriting: rewrites question
backend.py - Index and answer orchestration → Hybrid retrieval: retrieves chunks
backend.py - Hybrid retrieval → Semantic search: runs semantic search
retrieval/hybrid.py - Hybrid retrieval → Keyword search: runs keyword search
retrieval/hybrid.py - Hybrid retrieval → Rank fusion: merges rankings
retrieval/hybrid.py - Semantic search → Embedding generation: embeds query
retrieval/retrieve.py - Semantic search → Collection management: queries collection
retrieval/retrieve.py - Keyword search → Chunk and BM25 store: gets BM25 index
retrieval/keyword_search.py - Index and answer orchestration → Dependency expansion: expands references
backend.py - Dependency expansion → Keyword search: searches referenced code
retrieval/dependency.py - Index and answer orchestration → Answer generation: generates grounded answer
backend.py - Question rewriting → Answer generation: uses completion
llm/rewrite.py - Answer generation → Model provider: delegates completion
llm/generate.py - Model provider → Gemini API: calls when configured
llm/provider.py - Model provider → Ollama: calls when configured
llm/provider.py