# plesiv/hac architecture

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

- Interactive diagram: https://gitdiagram.com/plesiv/hac
- Repository: https://github.com/plesiv/hac

## Overview

##### Main Components

a. Core System Components:
- CLI Interface Layer
- Configuration Management
- Site Handlers
- Language Processors
- Runner System
- Test Case Management

b. External Integrations:
- Competition Websites (Codeforces, Rosalind, SPOJ, Codechef)
- Local File System
- Package Management (pip)

##### Component Details

CLI Interface:
- Commands and flags
- Parse_cli.py functionality
- Version and help information display

Configuration Management:
- ~/.config/hac directory
- Language templates
- Runner configurations

Site Handlers:
- Supported platform (Codeforces, Rosalind, SPOJ, Codechef)
- Data flow for contest/problem fetching

Language Processing:
- Supported languages (C, C++, Python, Java, Pascal)
- Template management

Runner System:
- Compilation and execution workflows
- Debug and testing paths

##### Key Relationships to Highlight

- CLI → Core Processing: Command interpretation flow
- Core → Site Handlers: Problem fetching
- Core → Language Processors: Template selection
- Runner System → Language Processors: Execution flow
- Configuration → All Components: Settings distribution

Input Section:
- CLI commands
- Configuration files
- Website URLs

Processing Section:
- Command parsing
- Site handling
- Template processing
- Runner generation

Output Section:
- Directory structures
- Source files
- Runner scripts
- Test cases

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        CLI_Interface["CLI Interface"]:::cli
        Commands["Commands Processor"]:::cli
    end

    subgraph Core
        Config["Configuration Manager"]:::core
        Core_Process["Core Processor"]:::core
        Data_Manager["Data Manager"]:::core
        Util_Common["Common Utilities"]:::core
    end

    subgraph "Site Handlers"
        Codeforces["Codeforces Handler"]:::site
        Codechef["Codechef Handler"]:::site
        SPOJ["SPOJ Handler"]:::site
        Rosalind["Rosalind Handler"]:::site
        Local["Local Handler"]:::site
    end

    subgraph "Language Support"
        C_Lang["C Templates"]:::lang
        CPP_Lang["C++ Templates"]:::lang
        Java_Lang["Java Templates"]:::lang
        Pascal_Lang["Pascal Templates"]:::lang
        Python_Lang["Python Templates"]:::lang
    end

    subgraph "Runner System"
        Exec_Compile["Execution Compiler"]:::runner
        Exec_Run["Execution Runner"]:::runner
        Debug_Compile["Debug Compiler"]:::runner
        Debug_Run["Debug Runner"]:::runner
    end

    subgraph "Test Management"
        Test_Cases["Test Case Manager"]:::test
        Test_Data["Test Data Storage"]:::test
    end

    %% Relationships
    CLI_Interface --> Commands
    Commands --> Core_Process
    Core_Process --> Config
    Core_Process --> Data_Manager
    Core_Process --> Util_Common

    Config --> |Site Config| Codeforces
    Config --> |Site Config| Codechef
    Config --> |Site Config| SPOJ
    Config --> |Site Config| Rosalind
    Config --> |Site Config| Local

    Config --> |Lang Config| C_Lang
    Config --> |Lang Config| CPP_Lang
    Config --> |Lang Config| Java_Lang
    Config --> |Lang Config| Pascal_Lang
    Config --> |Lang Config| Python_Lang

    Core_Process --> |Runner Management| Exec_Compile
    Core_Process --> |Runner Management| Exec_Run
    Core_Process --> |Runner Management| Debug_Compile
    Core_Process --> |Runner Management| Debug_Run

    Data_Manager --> Test_Cases
    Test_Cases --> Test_Data

    %% Click Events
    click CLI_Interface "https://github.com/plesiv/hac/blob/master/hac/parse_cli.py"
    click Commands "https://github.com/plesiv/hac/blob/master/hac/commands.py"
    click Config "https://github.com/plesiv/hac/blob/master/hac/parse_config.py"
    click Core_Process "https://github.com/plesiv/hac/blob/master/hac/core.py"
    click Data_Manager "https://github.com/plesiv/hac/blob/master/hac/data.py"
    click Util_Common "https://github.com/plesiv/hac/blob/master/hac/util_common.py"
    click Codeforces "https://github.com/plesiv/hac/blob/master/hac/config/site/codeforces.py"
    click Codechef "https://github.com/plesiv/hac/blob/master/hac/config/site/codechef.py"
    click SPOJ "https://github.com/plesiv/hac/blob/master/hac/config/site/spoj.py"
    click Rosalind "https://github.com/plesiv/hac/blob/master/hac/config/site/rosalind.py"
    click Local "https://github.com/plesiv/hac/blob/master/hac/config/site/local.py"
    click C_Lang "https://github.com/plesiv/hac/blob/master/hac/config/lang/temp.5.c"
    click CPP_Lang "https://github.com/plesiv/hac/blob/master/hac/config/lang/temp.5.cpp"
    click Java_Lang "https://github.com/plesiv/hac/blob/master/hac/config/lang/temp.5.java"
    click Pascal_Lang "https://github.com/plesiv/hac/blob/master/hac/config/lang/temp.5.pas"
    click Python_Lang "https://github.com/plesiv/hac/blob/master/hac/config/lang/temp.5.py"
    click Exec_Compile "https://github.com/plesiv/hac/tree/master/hac/config/runner"
    click Test_Cases "https://github.com/plesiv/hac/blob/master/hac/data.py"

    %% Styles
    classDef cli fill:#2374AB
    classDef core fill:#557B83
    classDef site fill:#39A2AE
    classDef lang fill:#A2D729
    classDef runner fill:#E8C547
    classDef test fill:#FF8966

    %% Legend
    subgraph Legend
        L1["CLI Components"]:::cli
        L2["Core Components"]:::core
        L3["Site Handlers"]:::site
        L4["Language Support"]:::lang
        L5["Runner Components"]:::runner
        L6["Test Components"]:::test
    end
```
