Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🔍 RepoLens

An AI-powered repository analysis tool that allows you to chat with your codebase. Clone any repository and ask intelligent questions about the code structure, functionality, patterns, and more.

✨ Features

  • 🚀 Repository Cloning: Clone any GitHub repository for analysis
  • 📊 Intelligent Scanning: Automatically scans and indexes Python, JavaScript, and TypeScript files
  • 🧠 AI-Powered Chat: Ask questions about your codebase using natural language
  • 🔍 Semantic Search: Advanced vector-based search through your code
  • 💬 Chat Sessions: Persistent chat sessions with conversation history
  • ⚡ Streaming Responses: Real-time streaming chat responses
  • 🎯 Context-Aware: Provides relevant code context in responses

Demo Video

RepoLens.mp4

🏗️ Architecture

RepoLens uses a sophisticated multi-agent architecture powered by LangGraph:

  • Intent Analysis: Understands user queries and determines the best approach
  • Vector Retrieval: Finds relevant code snippets using semantic search
  • AI Explanation: Generates intelligent responses based on retrieved context
  • Verification: Ensures response accuracy and relevance

🛠️ Tech Stack

Backend

  • FastAPI: High-performance async API framework
  • LangChain: AI/ML framework for building LLM applications
  • LangGraph: Multi-agent workflow orchestration
  • ChromaDB: Vector database for semantic search
  • OpenAI GPT: Language model for intelligent responses
  • Sentence Transformers: Text embedding generation

Frontend

  • Next.js: React-based web framework
  • Tailwind CSS: Utility-first CSS framework
  • Radix UI: Accessible component primitives
  • Axios: HTTP client for API communication

📋 Prerequisites

  • Python 3.12+
  • Node.js 18+
  • OpenAI API key

🚀 Installation

Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Install Python dependencies:
pip install -e .
  1. Create a .env file in the backend directory:
OPENAI_API_KEY=your_openai_api_key_here

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install Node.js dependencies:
npm install

🎮 Usage

Starting the Application

  1. Start the backend server:
cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000
  1. Start the frontend development server:
cd frontend
npm run dev
  1. Access the application:

Using RepoLens

  1. Clone a Repository: Enter a GitHub repository URL and click "Clone Repository"
  2. Wait for Indexing: The system will clone and index the repository (Python, JS, TS files under 800 lines)
  3. Start Chatting: Ask questions about the codebase in natural language
  4. Explore: Ask about:
    • Code structure and architecture
    • Function implementations
    • Design patterns used
    • Dependencies and imports
    • Code quality and best practices

🔌 API Endpoints

Repository Management

  • POST /repos/clone - Clone and index a repository
  • GET /repos/session/{session_id} - Get session information

Chat & Analysis

  • POST /repos/ask - Ask a question about the repository
  • POST /repos/ask/stream - Stream chat responses in real-time

Health Check

  • GET /health - API health status

💭 Example Queries

  • "What does this repository do?"
  • "Show me the main entry points of the application"
  • "How is error handling implemented?"
  • "What design patterns are used in this codebase?"
  • "Find all the API endpoints"
  • "Explain the database models"
  • "What are the main dependencies?"

📁 Project Structure

RepoLens/
├── backend/
│   ├── main.py                 # FastAPI application entry point
│   ├── pyproject.toml         # Python dependencies
│   └── app/
│       ├── agents/
│       │   └── graph.py       # LangGraph agent workflow
│       ├── api/
│       │   └── repos.py       # Repository API endpoints
│       ├── core/
│       │   └── ignore.py      # File filtering logic
│       └── services/
│           ├── chat_service.py      # Chat session management
│           ├── repo_cloner.py       # Repository cloning
│           ├── repo_scanner.py      # File scanning and analysis
│           ├── vector_store.py      # Vector database operations
│           ├── lazy_emberdder.py    # Embedding generation
│           └── dependency_extractor.py
├── frontend/
│   ├── package.json           # Node.js dependencies
│   ├── next.config.mjs        # Next.js configuration
│   └── app/
│       ├── page.jsx           # Main application page
│       ├── layout.jsx         # App layout
│       └── globals.css        # Global styles
└── README.md

🐛 Troubleshooting

Repository not cloning?

  • Ensure the repository URL is valid and publicly accessible
  • Check your internet connection

Chat not working?

  • Verify your OpenAI API key is set correctly
  • Ensure the backend server is running
  • Check that the repository was successfully indexed

Performance issues?

  • Large repositories may take longer to index
  • Only files under 800 lines are currently indexed for optimal performance

🚀 Future Enhancements

  • Support for more programming languages
  • Advanced code analysis features
  • Integration with more LLM providers
  • Collaborative analysis features
  • Repository comparison tools
  • Advanced visualization of code relationships

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages