Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RepoPilot πŸš€

In progessss............... Local-First AI Software Engineering Intelligence Platform
Part 1: Foundation & Repository Analysis Layer

RepoPilot is an open-source, local-first engineering intelligence platform. It analyzes local Git repositories and codebases, computes physical lines of code (LOC), language distributions, directory hierarchies, technology manifests, and Git version historyβ€”all strictly on your local machine with zero external AI APIs or cloud telemetry.


⚑ Quick Start

1. Prerequisites

  • Python: 3.11+
  • Node.js: 18+ (Node 20+ recommended)
  • Git
  • (Optional) Docker & Docker Compose (for PostgreSQL)

2. Backend Setup

# Navigate to backend directory
cd backend

# Create virtual environment (using venv or uv)
python3 -m venv .venv
# or: uv venv .venv

# Activate virtual environment
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt
# or: uv pip install -r requirements.txt

# Start FastAPI development server
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

The backend API will be available at:

  • API Base: http://localhost:8000/api
  • Interactive Swagger Docs: http://localhost:8000/docs
  • Health Check: http://localhost:8000/health

3. Frontend Setup

# In a new terminal, navigate to frontend directory
cd frontend

# Install dependencies (already initialized)
npm install

# Start Next.js development server
npm run dev

Open your browser to http://localhost:3000 to access the RepoPilot dashboard.


4. Database Setup

RepoPilot supports both PostgreSQL and SQLite:

  • PostgreSQL (Recommended for production/containers):

    docker compose up -d db

    Set in your .env or environment:

    DATABASE_URL=postgresql://postgres:postgres@localhost:5432/repopilot
  • SQLite (Default local fallback): If DATABASE_URL is omitted, RepoPilot automatically uses a local sqlite:///./repopilot.db database with full schema auto-generation, requiring zero external database configuration.


5. Running Tests

To run the automated test suite (including scanner, tech detector, Git analyzer, and FastAPI endpoints):

cd backend
PYTHONPATH=. .venv/bin/pytest tests -v

πŸ—οΈ Architecture

RepoPilot/
β”œβ”€β”€ docker-compose.yml              # PostgreSQL container configuration
β”œβ”€β”€ .env.example                    # Environment configuration template
β”œβ”€β”€ README.md                       # Comprehensive platform documentation
β”‚
β”œβ”€β”€ backend/                        # Python FastAPI Backend
β”‚   β”œβ”€β”€ requirements.txt            # Python dependencies (FastAPI, SQLAlchemy, GitPython, etc.)
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py                 # FastAPI application, lifespan, CORS & router mounting
β”‚   β”‚   β”œβ”€β”€ config.py               # Pydantic Settings & configuration
β”‚   β”‚   β”œβ”€β”€ logging_config.py       # Structured logger
β”‚   β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”‚   β”œβ”€β”€ session.py          # SQLAlchemy engine & session factory (Postgres / SQLite)
β”‚   β”‚   β”‚   └── models.py           # Repository & AnalysisReport SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ schemas/                # Pydantic v2 schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ repository.py       # Repo import, metadata, and list schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ analysis.py         # Summary statistics, language breakdowns, tree models
β”‚   β”‚   β”‚   └── git_info.py         # Git commits, contributors, branches, and diff models
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”œβ”€β”€ repository_service.py # Orchestrator for analysis, storage, and retrieval
β”‚   β”‚   β”‚   β”œβ”€β”€ scanner.py          # Codebase walker, LOC counter, file filter, tree builder
β”‚   β”‚   β”‚   β”œβ”€β”€ technology_detector.py # Parses package.json, requirements, Cargo, go.mod, etc.
β”‚   β”‚   β”‚   └── git_analyzer.py     # GitPython wrapper for commits, branches, contributors, diffs
β”‚   β”‚   β”œβ”€β”€ routers/                # REST API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ repositories.py     # POST /api/repositories/analyze & GET /api/repositories
β”‚   β”‚   β”‚   β”œβ”€β”€ statistics.py       # GET /api/repositories/{id}/statistics
β”‚   β”‚   β”‚   β”œβ”€β”€ languages.py        # GET /api/repositories/{id}/languages
β”‚   β”‚   β”‚   β”œβ”€β”€ directory.py        # GET /api/repositories/{id}/tree
β”‚   β”‚   β”‚   └── git.py              # GET /api/repositories/{id}/git
β”‚   β”‚   └── utils/
β”‚   β”‚       β”œβ”€β”€ file_filters.py     # Exclusion patterns, binary heuristics, language mappings
β”‚   β”‚       └── path_validator.py   # Absolute path validation & permission checker
β”‚   └── tests/                      # Automated Pytest suite
β”‚       β”œβ”€β”€ conftest.py             # Temporary Git repo fixture generator
β”‚       β”œβ”€β”€ test_scanner.py         # File scanner, LOC, and directory tree unit tests
β”‚       β”œβ”€β”€ test_technology_detector.py # Manifest parser unit tests
β”‚       β”œβ”€β”€ test_git_analyzer.py    # Git history & contributor unit tests
β”‚       └── test_api.py             # FastAPI client integration tests
β”‚
└── frontend/                       # Next.js 15 + TypeScript + Tailwind CSS Frontend
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ app/
    β”‚   β”‚   β”œβ”€β”€ layout.tsx          # Root layout
    β”‚   β”‚   β”œβ”€β”€ page.tsx            # Main interactive dashboard view
    β”‚   β”‚   └── globals.css         # Dark theme & styling tokens
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ Header.tsx          # Top bar with repo selector, branch tag & health status
    β”‚   β”‚   β”œβ”€β”€ MetricCards.tsx     # LOC, files, size, primary language, commits
    β”‚   β”‚   β”œβ”€β”€ LanguageBreakdown.tsx # Multi-color distribution bar & percentage table
    β”‚   β”‚   β”œβ”€β”€ TechStackBadges.tsx # Detected frameworks, package managers & runtimes
    β”‚   β”‚   β”œβ”€β”€ DirectoryTreeViewer.tsx # Searchable, expandable directory tree browser
    β”‚   β”‚   β”œβ”€β”€ GitActivity.tsx     # Commit history, author leaderboard & diff changes
    β”‚   β”‚   β”œβ”€β”€ LargestFilesList.tsx# Largest codebase files by byte size & LOC
    β”‚   β”‚   β”œβ”€β”€ RepoImportModal.tsx # Local path modal with validation & quick pre-fill
    β”‚   β”‚   └── ErrorAlert.tsx      # Clean error banner with actionable guidance
    β”‚   β”œβ”€β”€ services/
    β”‚   β”‚   └── api.ts              # Fully-typed API client service layer
    β”‚   └── types/
    β”‚       └── repopilot.ts        # TypeScript interfaces mirroring Pydantic schemas

πŸ›‘οΈ Part 1 Verification & Guarantees

  • No external AI calls: Zero calls to OpenAI, Gemini, Anthropic, or external inference APIs.
  • No mock data: Every metric (LOC, file size, language percentage, commit author, SHA, branch) is computed from the repository being analyzed.
  • Safe Scanning: Automatically excludes .git internals, node_modules, .venv, __pycache__, dist, build, .next, binaries, and large generated lockfiles.
  • Robust Error Handling: Clean feedback for invalid directory paths, permission issues, or non-Git directories.

About

RepoPilot is a local-first AI software engineering platform that understands entire codebases, analyzes architecture, detects security issues, investigates bugs, reviews Git changes, and assists developers using a locally running AI modelβ€”without requiring paid AI APIs.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages