# utkucgln/repograph architecture

> Architecture diagram of the GitHub repository utkucgln/repograph, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/utkucgln/repograph
- Repository: https://github.com/utkucgln/repograph

## Overview

##### Project type and purpose
- RepoGraph is a Python-based, CLI-driven, multi-agent system for automated code repository analysis.

##### File structure
- Top-level:
- main.py + CLI entrypoint
- requirements.txt, .env.example, LICENSE
- samples/ for example workflows
- src/
- src/agents/: five agent categories
- repository: loader, QA agent
- analysis: file_analyzer, report_generator
- security: security_analyzer, critical_method_analyzer
- code_quality: peer_review, code_fix, test_generator
- visualization: architecture_diagrammer
- src/core/: orchestration
- agent_factory, supervisor, workflow, state_manager
- src/llm/: LLM abstraction (provider, parser)
- src/models/: domain models (findings, report, repository)
- src/config/: settings, defaults
- src/utils/: concurrency, file, logging, progress, security patterns

##### Insights from README
- Modular, agent-based architecture.
- CLI commands: advanced, review, security, fix, qa.
- Configurable via JSON (LLM provider, worker pool, output location).

##### Detail
- Configuration injection at startup.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Layer
    subgraph "CLI Layer"
        CLI["CLI Entrypoint\n(main.py)"]:::cli
    end

    %% Core Orchestrator
    subgraph "Core Orchestrator"
        WF["Workflow Manager"]:::core
        SM["State Manager"]:::core
        AF["Agent Factory"]:::core
        SP["Supervisor"]:::core
        AB["Base Agent"]:::core
    end

    %% Agents
    subgraph "Agents"
        subgraph "Repository Agents"
            RL["Repository Loader"]:::agent
            QA["QA Agent"]:::agent
        end
        subgraph "Analysis Agents"
            FA["File Analyzer"]:::agent
            RG["Report Generator"]:::agent
        end
        subgraph "Security Agents"
            SA["Security Analyzer"]:::agent
            CMA["Critical Method Analyzer"]:::agent
        end
        subgraph "Code Quality Agents"
            PR["Peer Review Agent"]:::agent
            CF["Code Fix Agent"]:::agent
            TG["Test Generator Agent"]:::agent
        end
        subgraph "Visualization Agent"
            AD["Architecture Diagrammer"]:::agent
        end
    end

    %% LLM Layer
    subgraph "LLM Abstraction Layer"
        PV["Provider Interface"]:::llm
        RP["Response Parser"]:::llm
    end

    %% Models
    subgraph "Domain Models"
        FM["Findings Model"]:::model
        RM["Report Model"]:::model
        RepoM["Repository Model"]:::model
    end

    %% Config & Utils
    subgraph "Configuration Store & Utilities"
        SC["Settings"]:::config
        DF["Defaults"]:::config
        CU["Concurrency Utils"]:::util
        FU["File Utils"]:::util
        LU["Logging Utils"]:::util
        PRG["Progress Tracking"]:::util
        SPu["Security Patterns"]:::util
    end

    %% External Services & Outputs
    subgraph "External & Outputs"
        API["External LLM API"]:::external
        FS["Output Directory"]:::external
    end

    %% Relationships
    CLI -->|"load config"| SC
    CLI -->|"load defaults"| DF
    CLI -->|"start workflow"| WF
    SC --> WF
    DF --> WF
    WF -->|"create agents"| AF
    WF -->|"coordinate"| SP
    AF --> RL
    AF --> QA
    AF --> FA
    AF --> RG
    AF --> SA
    AF --> CMA
    AF --> PR
    AF --> CF
    AF --> TG
    AF --> AD
    RL -->|"RepoPath"| RepoM
    RL --> PV
    QA --> PV
    FA -->|"FileContents"| PV
    RG --> PV
    SA --> PV
    CMA --> PV
    PR --> PV
    CF --> PV
    TG --> PV
    AD --> PV
    PV -->|"LLMRequest"| API
    API -->|"LLMResponse"| RP
    RP --> RL
    RP --> QA
    RP --> FA
    RP --> RG
    RP --> SA
    RP --> CMA
    RP --> PR
    RP --> CF
    RP --> TG
    RP --> AD
    RL -->|"update state"| SM
    QA --> SM
    FA --> SM
    RG --> SM
    SA --> SM
    CMA --> SM
    PR --> SM
    CF --> SM
    TG --> SM
    AD --> SM
    RL --> RepoM
    QA --> RepoM
    FA --> FM
    RG --> RM
    SA --> FM
    CMA --> FM
    PR --> FM
    CF --> FM
    TG --> FM
    AD --> RM
    SP --> AD
    AD --> FS

    %% Click Events
    click CLI "https://github.com/utkucgln/repograph/blob/main/main.py"
    click SC "https://github.com/utkucgln/repograph/blob/main/src/config/settings.py"
    click DF "https://github.com/utkucgln/repograph/blob/main/src/config/defaults.py"
    click WF "https://github.com/utkucgln/repograph/blob/main/src/core/workflow.py"
    click SM "https://github.com/utkucgln/repograph/blob/main/src/core/state_manager.py"
    click AF "https://github.com/utkucgln/repograph/blob/main/src/core/agent_factory.py"
    click SP "https://github.com/utkucgln/repograph/blob/main/src/core/supervisor.py"
    click AB "https://github.com/utkucgln/repograph/blob/main/src/core/agent_base.py"
    click RL "https://github.com/utkucgln/repograph/blob/main/src/agents/repository/loader.py"
    click QA "https://github.com/utkucgln/repograph/blob/main/src/agents/repository/qa_agent.py"
    click FA "https://github.com/utkucgln/repograph/blob/main/src/agents/analysis/file_analyzer.py"
    click RG "https://github.com/utkucgln/repograph/blob/main/src/agents/analysis/report_generator.py"
    click SA "https://github.com/utkucgln/repograph/blob/main/src/agents/security/security_analyzer.py"
    click CMA "https://github.com/utkucgln/repograph/blob/main/src/agents/security/critical_method_analyzer.py"
    click PR "https://github.com/utkucgln/repograph/blob/main/src/agents/code_quality/peer_review_agent.py"
    click CF "https://github.com/utkucgln/repograph/blob/main/src/agents/code_quality/code_fix_agent.py"
    click TG "https://github.com/utkucgln/repograph/blob/main/src/agents/code_quality/test_generator_agent.py"
    click AD "https://github.com/utkucgln/repograph/blob/main/src/agents/visualization/architecture_diagrammer.py"
    click PV "https://github.com/utkucgln/repograph/blob/main/src/llm/provider.py"
    click RP "https://github.com/utkucgln/repograph/blob/main/src/llm/response_parser.py"
    click FM "https://github.com/utkucgln/repograph/blob/main/src/models/findings.py"
    click RM "https://github.com/utkucgln/repograph/blob/main/src/models/report.py"
    click RepoM "https://github.com/utkucgln/repograph/blob/main/src/models/repository.py"
    click CU "https://github.com/utkucgln/repograph/blob/main/src/utils/concurrency.py"
    click FU "https://github.com/utkucgln/repograph/blob/main/src/utils/file_utils.py"
    click LU "https://github.com/utkucgln/repograph/blob/main/src/utils/logging_utils.py"
    click PRG "https://github.com/utkucgln/repograph/blob/main/src/utils/progress.py"
    click SPu "https://github.com/utkucgln/repograph/blob/main/src/utils/security_patterns.py"

    %% Styles
    classDef cli fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef core fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef agent fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20
    classDef llm fill:#ffe0b2,stroke:#e65100,color:#e65100
    classDef model fill:#fff9c4,stroke:#f57f17,color:#f57f17
    classDef config fill:#f0f0f0,stroke:#9e9e9e,color:#616161
    classDef util fill:#f5f5f5,stroke:#9e9e9e,color:#424242
    classDef external fill:#ffffff,stroke-dasharray: 5 5,stroke:#757575,color:#212121
```
