How samik930/github_codebase_ai works
Codebase Copilot lets users index a GitHub repository and then ask questions answered from its code. The main flow downloads useful repository files, filters/redacts sensitive content, chunks and indexes them, then retrieves hybrid search results and generates an answer. The UI also exposes repository status, statistics, source viewing, and theme selection. Sampled code supports the ingestion and query wiring shown; source-viewing details and some implementation internals were not sampled, so their connections are omitted.
Main entry points: App.jsx App shell · controller.js Request controllers · retrieve.js Hybrid retrieval · ingest1.js Document ingestion
Components 22
Web client
- App shell
client/src/App.jsx - Ingest card
client/src/components/IngestCard.jsx - Chat interface
client/src/components/ChatInterface.jsx - Header and theme
client/src/components/Header.jsx - Theme picker
client/src/components/ThemePicker.jsx - Repository stats
client/src/components/RepoStats.jsx - Source viewer
client/src/components/SourceViewer.jsx
API orchestration
- Express server
server/src/index.js - API routes
server/src/routes/routes.js - Request controllers
server/src/controllers/controller.js
Repository indexing
- GitHub downloader
server/src/github/downloadRepo.js - Document ingestion
server/src/rag/ingest1.js - Sensitive-data guard
server/src/rag/sensitiveGuard.js - Vector collection
- BM25 index
server/src/rag/bm25.js - BM25 index file
server/data/bm25-index.json
Question answering
- Hybrid retrieval
server/src/rag/retrieve.js - Query rewriting
server/src/rag/queryRewriter.js - Answer generation
server/src/rag/generate.js
Other components
- User
- Google Gemini
- GitHub API
Connections 29
- User → App shell: uses
- App shell → Ingest card: renders
- App shell → Chat interface: renders when indexed
- App shell → Header and theme: renders
- Header and theme → Theme picker: selects theme
- App shell → Repository stats: shows indexed stats
- App shell → Source viewer: provides source view
- Ingest card → Express server: POST /api/ingest
- Chat interface → Express server: POST /api/query
- Express server → API routes: dispatches API
- API routes → Request controllers: dispatches requests
- Request controllers → GitHub downloader: loads repository files
- GitHub downloader → GitHub API: fetches repository data
- Request controllers → Document ingestion: ingests files
- Document ingestion → Sensitive-data guard: filters and redacts
- Document ingestion → Google Gemini: embeds chunks
- Document ingestion → Vector collection: upserts vectors
- Document ingestion → BM25 index: builds index
- BM25 index → BM25 index file: writes index
- Request controllers → Sensitive-data guard: checks query intent
- Request controllers → Hybrid retrieval: retrieves documents
- Hybrid retrieval → Query rewriting: rewrites query
- Query rewriting → Google Gemini: generates search query
- Hybrid retrieval → Vector collection: searches vectors
- Hybrid retrieval → BM25 index: runs sparse search
- Hybrid retrieval → BM25 index file: loads index
- Hybrid retrieval → Google Gemini: embeds query
- Request controllers → Answer generation: generates answer
- Answer generation → Google Gemini: generates response