# mohit-rocky-25/repopilot architecture

> Architecture diagram of the GitHub repository mohit-rocky-25/repopilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohit-rocky-25/repopilot
- Repository: https://github.com/mohit-rocky-25/repopilot

## Overview

RepoPilot is a repository exploration and code-intelligence platform. A user imports a public GitHub repository, pins a revision, then browses and searches its files, views architecture, asks grounded questions, or investigates a stack trace and reviews a proposed patch. The graph includes documented capabilities whose implementation paths are present in the tree, but not sampled. Edges are limited to relationships visible in excerpts or explicitly documented in the README; unsampled wiring is not inferred.

Main entry points: [`src/app/api/ai/ask/route.ts`](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/api/ai/ask/route.ts) (Assistant endpoint), [`packages/github/src/client.ts`](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/client.ts) (GitHub client), [`src/app/api/debugging/analyze/route.ts`](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/api/debugging/analyze/route.ts) (Analysis endpoint), [`src/app/explore/page.tsx`](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/explore/page.tsx) (File browser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Product interface"]
  node_workspace["Workspace<br/>[page.tsx]"]
  node_repo_state["Repository state"]
  node_file_browser["File browser<br/>[page.tsx]"]
  node_file_tree["File tree<br/>[FileTree.tsx]"]
  node_code_viewer["Code viewer<br/>[CodeViewer.tsx]"]
  node_search_ui["Search interface<br/>[page.tsx]"]
  node_architecture_ui["Architecture view<br/>[page.tsx]"]
  node_architecture_map["Interactive map"]
  node_assistant_ui["Assistant interface<br/>[page.tsx]"]
  node_debug_ui["Debug interface<br/>[page.tsx]"]
  node_patch_review["Patch review<br/>[page.tsx]"]
end

subgraph group_repo["Repository access"]
  node_github_api(("GitHub API"))
  node_github_client["GitHub client<br/>[client.ts]"]
  node_github_cache[("Response cache<br/>[cache.ts]")]
  node_url_validator["URL validation<br/>[validator.ts]"]
end

subgraph group_intel["Code intelligence"]
  node_schemas["Shared contracts<br/>[schemas.ts]"]
  node_symbol_parser["Symbol extraction<br/>[symbolExtractor.ts]"]
  node_search_engine["Ranked search<br/>[searchEngine.ts]"]
  node_architecture_analyzer["Architecture analysis"]
  node_ai_route["Assistant endpoint<br/>[route.ts]"]
  node_prompt_builder["Prompt builder<br/>[promptBuilder.ts]"]
  node_ollama["Local inference<br/>[ollamaClient.ts]"]
  node_citation_validator["Citation validation"]
end

subgraph group_investigation["Debugging and review"]
  node_debug_route["Analysis endpoint<br/>[route.ts]"]
  node_trace_parser["Stack parser"]
  node_hypothesis_engine["Hypothesis engine"]
  node_execution_policy["Execution policy<br/>[executionPolicy.ts]"]
end

node_developer(("Developer"))

node_developer -->|"opens"| node_workspace
node_workspace -->|"updates"| node_repo_state
node_repo_state -->|"supplies repository"| node_file_browser
node_file_browser -->|"renders"| node_file_tree
node_file_browser -.->|"shows source"| node_code_viewer
node_developer -->|"imports repository"| node_github_api
node_github_api -->|"serves requests"| node_github_client
node_github_client -->|"caches responses"| node_github_cache
node_github_client -.->|"validates references"| node_url_validator
node_github_client -.->|"provides pinned files"| node_repo_state
node_developer -->|"searches code"| node_search_ui
node_search_ui -.->|"submits query"| node_search_engine
node_search_engine -->|"searches extracted symbols"| node_symbol_parser
node_developer -->|"views architecture"| node_architecture_ui
node_architecture_ui -->|"renders graph"| node_architecture_map
node_architecture_ui -.->|"requests analysis"| node_architecture_analyzer
node_architecture_analyzer -->|"uses contracts"| node_schemas
node_developer -->|"asks question"| node_assistant_ui
node_assistant_ui -.->|"submits question"| node_ai_route
node_ai_route -->|"fetches repository"| node_github_client
node_ai_route -->|"retrieves matches"| node_search_engine
node_ai_route -->|"builds prompt"| node_prompt_builder
node_ai_route -->|"runs inference"| node_ollama
node_ai_route -->|"validates citations"| node_citation_validator
node_developer -->|"submits trace"| node_debug_ui
node_debug_ui -.->|"requests analysis"| node_debug_route
node_debug_route -->|"loads repository"| node_github_client
node_debug_route -->|"parses trace"| node_trace_parser
node_debug_route -->|"ranks causes"| node_hypothesis_engine
node_hypothesis_engine -->|"uses parsed frames"| node_trace_parser
node_hypothesis_engine -.->|"proposes patch"| node_patch_review
node_patch_review -->|"presents for review"| node_developer
node_developer -->|"reviews safely"| node_execution_policy

click node_workspace "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/page.tsx"
click node_repo_state "https://github.com/mohit-rocky-25/repopilot/blob/main/src/context/RepositoryContext.tsx"
click node_file_browser "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/explore/page.tsx"
click node_file_tree "https://github.com/mohit-rocky-25/repopilot/blob/main/src/components/explorer/FileTree.tsx"
click node_code_viewer "https://github.com/mohit-rocky-25/repopilot/blob/main/src/components/ui/CodeViewer.tsx"
click node_search_ui "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/search/page.tsx"
click node_architecture_ui "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/architecture/page.tsx"
click node_architecture_map "https://github.com/mohit-rocky-25/repopilot/blob/main/src/components/architecture/ArchitectureMap3D.tsx"
click node_assistant_ui "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/assistant/page.tsx"
click node_debug_ui "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/debugging/page.tsx"
click node_patch_review "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/patches/page.tsx"
click node_github_client "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/client.ts"
click node_github_cache "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/cache.ts"
click node_url_validator "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/validator.ts"
click node_schemas "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/core/src/schemas.ts"
click node_symbol_parser "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/indexer/src/symbolExtractor.ts"
click node_search_engine "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/search/src/searchEngine.ts"
click node_architecture_analyzer "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/analysis/src/architectureAnalyzer.ts"
click node_ai_route "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/api/ai/ask/route.ts"
click node_prompt_builder "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/ai/src/promptBuilder.ts"
click node_ollama "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/ai/src/ollamaClient.ts"
click node_citation_validator "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/ai/src/citationValidator.ts"
click node_debug_route "https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/api/debugging/analyze/route.ts"
click node_trace_parser "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/debugging/src/stackTraceParser.ts"
click node_hypothesis_engine "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/debugging/src/hypothesisEngine.ts"
click node_execution_policy "https://github.com/mohit-rocky-25/repopilot/blob/main/packages/execution/src/executionPolicy.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workspace,node_repo_state,node_file_browser,node_file_tree,node_code_viewer,node_search_ui,node_architecture_ui,node_architecture_map,node_assistant_ui,node_debug_ui,node_patch_review toneBlue
class node_github_api,node_github_client,node_github_cache,node_url_validator toneAmber
class node_schemas,node_symbol_parser,node_search_engine,node_architecture_analyzer,node_ai_route,node_prompt_builder,node_ollama,node_citation_validator toneMint
class node_debug_route,node_trace_parser,node_hypothesis_engine,node_execution_policy toneRose
class node_developer toneIndigo
```

## Components

### Product interface

- [Workspace](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Repository state](https://github.com/mohit-rocky-25/repopilot/blob/main/src/context/RepositoryContext.tsx): `src/context/RepositoryContext.tsx`
- [File browser](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/explore/page.tsx): `src/app/explore/page.tsx`
- [File tree](https://github.com/mohit-rocky-25/repopilot/blob/main/src/components/explorer/FileTree.tsx): `src/components/explorer/FileTree.tsx`
- [Code viewer](https://github.com/mohit-rocky-25/repopilot/blob/main/src/components/ui/CodeViewer.tsx): `src/components/ui/CodeViewer.tsx`
- [Search interface](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/search/page.tsx): `src/app/search/page.tsx`
- [Architecture view](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/architecture/page.tsx): `src/app/architecture/page.tsx`
- [Interactive map](https://github.com/mohit-rocky-25/repopilot/blob/main/src/components/architecture/ArchitectureMap3D.tsx): `src/components/architecture/ArchitectureMap3D.tsx`
- [Assistant interface](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/assistant/page.tsx): `src/app/assistant/page.tsx`
- [Debug interface](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/debugging/page.tsx): `src/app/debugging/page.tsx`
- [Patch review](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/patches/page.tsx): `src/app/patches/page.tsx`

### Repository access

- **GitHub API**
- [GitHub client](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/client.ts): `packages/github/src/client.ts`
- [Response cache](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/cache.ts): `packages/github/src/cache.ts`
- [URL validation](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/github/src/validator.ts): `packages/github/src/validator.ts`

### Code intelligence

- [Shared contracts](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/core/src/schemas.ts): `packages/core/src/schemas.ts`
- [Symbol extraction](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/indexer/src/symbolExtractor.ts): `packages/indexer/src/symbolExtractor.ts`
- [Ranked search](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/search/src/searchEngine.ts): `packages/search/src/searchEngine.ts`
- [Architecture analysis](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/analysis/src/architectureAnalyzer.ts): `packages/analysis/src/architectureAnalyzer.ts`
- [Assistant endpoint](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/api/ai/ask/route.ts): `src/app/api/ai/ask/route.ts`
- [Prompt builder](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/ai/src/promptBuilder.ts): `packages/ai/src/promptBuilder.ts`
- [Local inference](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/ai/src/ollamaClient.ts): `packages/ai/src/ollamaClient.ts`
- [Citation validation](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/ai/src/citationValidator.ts): `packages/ai/src/citationValidator.ts`

### Debugging and review

- [Analysis endpoint](https://github.com/mohit-rocky-25/repopilot/blob/main/src/app/api/debugging/analyze/route.ts): `src/app/api/debugging/analyze/route.ts`
- [Stack parser](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/debugging/src/stackTraceParser.ts): `packages/debugging/src/stackTraceParser.ts`
- [Hypothesis engine](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/debugging/src/hypothesisEngine.ts): `packages/debugging/src/hypothesisEngine.ts`
- [Execution policy](https://github.com/mohit-rocky-25/repopilot/blob/main/packages/execution/src/executionPolicy.ts): `packages/execution/src/executionPolicy.ts`

### Other components

- **Developer**

## Connections

- Developer → Workspace: opens (evidence: `README.md`)
- Workspace → Repository state: updates (evidence: `src/app/page.tsx`)
- Repository state → File browser: supplies repository
- File browser → File tree: renders
- File browser → Code viewer: shows source
- Developer → GitHub API: imports repository (evidence: `README.md`)
- GitHub API → GitHub client: serves requests (evidence: `packages/github/src/client.ts`)
- GitHub client → Response cache: caches responses (evidence: `packages/github/src/client.ts`)
- GitHub client → URL validation: validates references
- GitHub client → Repository state: provides pinned files
- Developer → Search interface: searches code (evidence: `README.md`)
- Search interface → Ranked search: submits query
- Ranked search → Symbol extraction: searches extracted symbols (evidence: `README.md`)
- Developer → Architecture view: views architecture (evidence: `README.md`)
- Architecture view → Interactive map: renders graph (evidence: `src/app/architecture/page.tsx`)
- Architecture view → Architecture analysis: requests analysis
- Architecture analysis → Shared contracts: uses contracts (evidence: `packages/analysis/src/architectureAnalyzer.ts`)
- Developer → Assistant interface: asks question (evidence: `README.md`)
- Assistant interface → Assistant endpoint: submits question
- Assistant endpoint → GitHub client: fetches repository (evidence: `src/app/api/ai/ask/route.ts`)
- Assistant endpoint → Ranked search: retrieves matches (evidence: `src/app/api/ai/ask/route.ts`)
- Assistant endpoint → Prompt builder: builds prompt (evidence: `src/app/api/ai/ask/route.ts`)
- Assistant endpoint → Local inference: runs inference (evidence: `src/app/api/ai/ask/route.ts`)
- Assistant endpoint → Citation validation: validates citations (evidence: `src/app/api/ai/ask/route.ts`)
- Developer → Debug interface: submits trace (evidence: `README.md`)
- Debug interface → Analysis endpoint: requests analysis
- Analysis endpoint → GitHub client: loads repository (evidence: `src/app/api/debugging/analyze/route.ts`)
- Analysis endpoint → Stack parser: parses trace (evidence: `src/app/api/debugging/analyze/route.ts`)
- Analysis endpoint → Hypothesis engine: ranks causes (evidence: `src/app/api/debugging/analyze/route.ts`)
- Hypothesis engine → Stack parser: uses parsed frames (evidence: `packages/debugging/src/hypothesisEngine.ts`)
- Hypothesis engine → Patch review: proposes patch
- Patch review → Developer: presents for review (evidence: `README.md`)
- Developer → Execution policy: reviews safely (evidence: `README.md`)
