# azat-io/todoctor architecture

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

- Interactive diagram: https://gitdiagram.com/azat-io/todoctor
- Repository: https://github.com/azat-io/todoctor

## Overview

##### Main Components

a. Core Analysis Engine (Rust):
- Git Integration Module
- Comment Parser Module
- File System Handler
- Data Collection & Processing

b. Output Generation:
- HTML Report Generator
- JSON Generator
- CSV Generator

c. Preview/Visualization Layer (Svelte):
- Data Visualization Components
- UI Components
- Theme System

**┌─────────────────────────────────────────┐**
- CLI Interface                │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Core Analysis Engine            │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Report Generation Layer         │
- ┘

##### Detailed Component Breakdown

a. Core Analysis Engine:
**┌─────────────── Git Integration ──────────────┐**
- Repository Validation                      │
- Blame Data Collection                      │
- File History Analysis                      │
- Modified Files Detection                   │
- ┬───────────────────────┘
- ↓
**┌─────────────── Comment Analysis ────────────┐**
- File Type Detection                       │
- TODO/FIXME Pattern Matching              │
- Comment Extraction                        │
- ┬──────────────────────┘
- ↓
**┌─────────────── Data Processing ────────────┐**
- History Collection                       │
- Data Enrichment                          │
- Statistics Generation                    │
- ┘

##### Report Generation Layer
**┌─────────────── Output Formats ──────────────┐**
- ┌─────────┐    ┌────────┐    ┌─────────┐   │
- HTML   │    │  JSON  │    │   CSV   │   │
- ┘    └────────┘    └─────────┘   │
- ┘

##### Visualization Components (Preview)
**┌─────────────── UI Components ──────────────┐**
- Graphs (Line, Doughnut)                  │
- Tables                                   │
- Information Blocks                       │
- Theme System                             │
- ┘

##### Data Flow Indicators

- Input: Git repository → Core Engine
- Processing: Core Engine → Data Processing
- Output: Data Processing → Report Generation
- Visualization: Report Data → UI Components

##### Additional Elements

Annotations for:
- Supported file types
- Comment keywords
- Configuration options
- External dependencies (Git)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CLI["CLI Interface"]
        CLI_MAIN["CLI Entry Point"]
    end

    subgraph Core["Core Analysis Engine"]
        subgraph Git["Git Integration"]
            REPO["Repository Validation"]:::git
            BLAME["Blame Data Collection"]:::git
            HISTORY["File History Analysis"]:::git
            MODIFIED["Modified Files Detection"]:::git
        end

        subgraph Parser["Comment Parser"]
            FILE_TYPE["File Type Detection"]:::parser
            PATTERN["TODO/FIXME Pattern Matching"]:::parser
            EXTRACT["Comment Extraction"]:::parser
        end

        subgraph FS["File System Handler"]
            DIR_OPS["Directory Operations"]:::fs
            PATH_MGT["Path Management"]:::fs
        end

        subgraph Processing["Data Processing"]
            DATA_COLLECT["Data Collection"]:::processing
            HIST_COLLECT["History Collection"]:::processing
            DATA_ENRICH["Data Enrichment"]:::processing
        end
    end

    subgraph Output["Report Generation Layer"]
        GEN_OUTPUT["Report Generation"]:::output
        JSON_GEN["JSON Generation"]:::output
    end

    subgraph Visual["Visualization Layer"]
        subgraph UI["UI Components"]
            LAYOUT["Layout Components"]:::ui
            CORE_EL["Core Elements"]:::ui
            DATA_DISP["Data Display"]:::ui
        end

        subgraph Charts["Data Visualization"]
            LINE["Line Chart"]:::chart
            DOUGH["Doughnut Chart"]:::chart
            TABLE["Tables"]:::chart
            INFO["Information Blocks"]:::chart
        end

        subgraph Store["Data Store"]
            DATA_STORE["Data Management"]:::store
            THEME["Theme System"]:::store
        end
    end

    %% Relationships
    CLI_MAIN --> REPO
    REPO --> BLAME
    BLAME --> HISTORY
    HISTORY --> MODIFIED
    MODIFIED --> FILE_TYPE
    FILE_TYPE --> PATTERN
    PATTERN --> EXTRACT
    EXTRACT --> DIR_OPS
    DIR_OPS --> PATH_MGT
    PATH_MGT --> DATA_COLLECT
    DATA_COLLECT --> HIST_COLLECT
    HIST_COLLECT --> DATA_ENRICH
    DATA_ENRICH --> GEN_OUTPUT
    DATA_ENRICH --> JSON_GEN
    JSON_GEN --> DATA_STORE
    DATA_STORE --> LINE
    DATA_STORE --> DOUGH
    DATA_STORE --> TABLE
    DATA_STORE --> INFO
    THEME --> LAYOUT
    LAYOUT --> CORE_EL
    CORE_EL --> DATA_DISP

    %% Click Events
    click REPO "https://github.com/azat-io/todoctor/blob/main/src/git/check_git_repository.rs"
    click BLAME "https://github.com/azat-io/todoctor/blob/main/src/git/get_blame_data.rs"
    click HISTORY "https://github.com/azat-io/todoctor/blob/main/src/git/get_history.rs"
    click MODIFIED "https://github.com/azat-io/todoctor/blob/main/src/git/get_modified_files.rs"
    click FILE_TYPE "https://github.com/azat-io/todoctor/blob/main/src/comments/identify_supported_file.rs"
    click PATTERN "https://github.com/azat-io/todoctor/blob/main/src/comments/identify_todo_comment.rs"
    click EXTRACT "https://github.com/azat-io/todoctor/blob/main/src/comments/get_comments.rs"
    click DIR_OPS "https://github.com/azat-io/todoctor/blob/main/src/fs/copy_dir_recursive.rs"
    click PATH_MGT "https://github.com/azat-io/todoctor/blob/main/src/fs/get_dist_path.rs"
    click DATA_COLLECT "https://github.com/azat-io/todoctor/blob/main/src/project/collect_todo_data.rs"
    click HIST_COLLECT "https://github.com/azat-io/todoctor/blob/main/src/project/collect_todo_history.rs"
    click DATA_ENRICH "https://github.com/azat-io/todoctor/blob/main/src/project/enrich_todo_data_with_blame.rs"
    click GEN_OUTPUT "https://github.com/azat-io/todoctor/blob/main/src/project/generate_output.rs"
    click JSON_GEN "https://github.com/azat-io/todoctor/blob/main/src/project/prepare_json_data.rs"
    click LINE "https://github.com/azat-io/todoctor/blob/main/preview/elements/chart-line.svelte"
    click DOUGH "https://github.com/azat-io/todoctor/blob/main/preview/elements/chart-doughnut.svelte"
    click TABLE "https://github.com/azat-io/todoctor/blob/main/preview/elements/table.svelte"
    click INFO "https://github.com/azat-io/todoctor/blob/main/preview/blocks/info.svelte"
    click THEME "https://github.com/azat-io/todoctor/blob/main/preview/stores/theme.ts"
    click LAYOUT "https://github.com/azat-io/todoctor/blob/main/preview/blocks/header.svelte"
    click DATA_DISP "https://github.com/azat-io/todoctor/blob/main/preview/elements/table-comment.svelte"
    click DATA_STORE "https://github.com/azat-io/todoctor/blob/main/preview/stores/data.ts"

    %% Styling
    classDef git fill:#2374ab
    classDef parser fill:#48a9a6
    classDef fs fill:#4b7f52
    classDef processing fill:#5aa17f
    classDef output fill:#c17767
    classDef ui fill:#9c528b
    classDef chart fill:#8b5e83
    classDef store fill:#634b66
```
