# alexkorol/repo2gpt architecture

> Architecture diagram of the GitHub repository alexkorol/repo2gpt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexkorol/repo2gpt
- Repository: https://github.com/alexkorol/repo2gpt

## Overview

##### Main Components

a) Input Layer:
- GitHub Repository URL Handler
- Local Directory Path Handler

b) Core Processing Engine:
- Repository Cloner (for GitHub URLs)
- File System Scanner
- Code Parser/Analyzer

c) Output Generators:
- Repomap Generator
- Code Consolidator

**┌─────────────────┐**
- Input Layer  │
- ┬────────┘
- ↓
**┌─────────────────┐**
- Core Engine    │
- ┬────────┘
- ↓
**┌─────────────────┐**
- Output Layer    │
- ┘

##### Detailed Component Breakdown

a) Input Handlers (Use rounded rectangles, blue):
- GitHub URL Parser
- Local Path Validator

b) Core Processing (Use rectangles, green):
- Repository Cloner Module
- File System Traversal Engine
- Code Analysis Module
- Class Detector
- Method/Function Extractor
- File Type Identifier

c) Output Generators (Use parallelograms, orange):
- Repomap.txt Generator
- Consolidated_code.txt Generator

##### Data Flow Indicators

- Input → Validation → Processing
- Processing → Analysis → Output Generation
- File System Operations
- Data Transformation Steps

##### Technical Stack Indicators

- Python as primary language
- Git integration components
- File system interaction modules

##### Future Extension Points

- ASM Traversal Module
- Web Interface/VS Code Extension
- Enhanced File Type Detection
- Improved Encoding Handler

- Clear hierarchical layout
- Proper spacing for readability
- Ability to show both current and planned features

For this specific project, emphasize:
##### The error handling paths for different input types and file encodings

This will create a comprehensive yet understandable representation of Repo2GPT's architecture that aligns with its current implementation and future plans.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        GH["GitHub URL Parser"]
        LP["Local Path Validator"]
    end

    subgraph Core
        RC["Repository Cloner"]
        FS["File System Scanner"]
        CA["Code Analyzer"]
        subgraph Analysis
            CD["Class Detector"]
            ME["Method Extractor"]
            FT["File Type Identifier"]
        end
    end

    subgraph Output
        RM["Repomap Generator"]
        CC["Code Consolidator"]
    end

    subgraph Future["Future Extensions"]
        ASM["ASM Traversal"]:::planned
        WEB["Web Interface"]:::planned
        EFT["Enhanced File Detection"]:::planned
        ENC["Encoding Handler"]:::planned
    end

    %% Main Flow
    GH --> RC
    LP --> FS
    RC --> FS
    FS --> CA
    CA --> CD
    CA --> ME
    CA --> FT
    CD --> RM
    ME --> RM
    FT --> CC
    CD --> CC
    ME --> CC

    %% Component Mappings
    click GH "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click LP "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click RC "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click FS "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click CA "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click RM "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click CC "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click CD "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click ME "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click FT "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click ASM "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click WEB "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click EFT "https://github.com/alexkorol/repo2GPT/blob/master/main.py"
    click ENC "https://github.com/alexkorol/repo2GPT/blob/master/main.py"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef input fill:#d4e6f1,stroke:#2874a6
    classDef core fill:#d4efdf,stroke:#196f3d
    classDef output fill:#fae5d3,stroke:#ba4a00
    classDef planned fill:#f2f3f4,stroke:#333,stroke-dasharray: 5 5
    classDef analysis fill:#e8f8f5,stroke:#148f77

    class GH,LP input
    class RC,FS,CA core
    class CD,ME,FT analysis
    class RM,CC output
    class ASM,WEB,EFT,ENC planned

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Processing"]:::core
        L3["Analysis Components"]:::analysis
        L4["Output Components"]:::output
        L5["Planned Features"]:::planned
    end
```
