# autowert/autowert architecture

> Architecture diagram of the GitHub repository autowert/autowert, 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/autowert/autowert
- Repository: https://github.com/autowert/autowert

## Overview

##### Relationships and Data Flow

- Command flow: User Input → Command Handler → Specific Command Implementation
- Plugin interactions: Core Bot → Plugin System → Individual Plugins
- Task execution: Commands/Plugins → Task System → Specific Tasks
- Utility service usage: All components → Utility Services

##### Important Architectural Elements to Highlight

a. Modular Design:
- Clear separation between commands, plugins, and tasks
- Plugin architecture for extensibility

b. Task Management:
- Task system's hierarchy (task.ts as base)
- Different task categories (chest, game, items)

c. Service Layer:
- Utility services as a separate layer
- How they support other components

##### Technical Details

- Node.js Runtime Environment
- TypeScript Implementation
- External Minecraft Server Connection
- Configuration System (config.template.ts)

##### Specific Implementation Notes

- Relationship between BaseCommand and its implementations
- Plugin initialization and lifecycle
- Demonstrate task queue/execution flow
- Error handling and logging paths

- Any abbreviations or special symbols used

This structure will effectively communicate both the overall architecture and the specific implementation details of this Minecraft bot project.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Module]
        L2((Service))
        L3[/Command/]
        L4[(Plugin)]
        L5{{Task}}
        style L1 fill:#2b5797
        style L2 fill:#647687
        style L3 fill:#70a370
        style L4 fill:#ff9933
        style L5 fill:#9673a6
    end

    subgraph Core["Core Bot Engine"]
        Entry[Entry Point]:::core
        CmdHandler[Command Handler]:::core
        PluginSys[Plugin System]:::core
    end

    subgraph Commands["Command System"]
        BaseCmd[Base Command]:::command
        CmdImpl[Command Implementations]:::command
    end

    subgraph Plugins["Plugin System"]
        subgraph FuncPlugins["Functional Plugins"]
            FuncP[(Functions)]:::plugin
        end
        
        subgraph GamePlugins["Game Mechanics"]
            EFly[(EFly)]:::plugin
            Queue[(Queue Handler)]:::plugin
        end
        
        subgraph UtilPlugins["Utility Plugins"]
            Stats[(Statistics)]:::plugin
            Uptime[(Uptime)]:::plugin
            LogP[(Logging)]:::plugin
        end
    end

    subgraph Tasks["Task System"]
        BaseTask{{Base Task}}:::task
        ChestOps{{Chest Operations}}:::task
        GameOps{{Game Operations}}:::task
        ItemOps{{Item Operations}}:::task
    end

    subgraph Utils["Utility Services"]
        HTTP((HTTP Server)):::service
        Notif((Notifications)):::service
        PLog((Persistent Logging)):::service
        Cool((Cooldown Manager)):::service
    end

    Entry --> CmdHandler
    Entry --> PluginSys
    CmdHandler --> BaseCmd
    BaseCmd --> CmdImpl
    PluginSys --> FuncPlugins
    PluginSys --> GamePlugins
    PluginSys --> UtilPlugins
    CmdImpl --> Tasks
    BaseTask --> ChestOps
    BaseTask --> GameOps
    BaseTask --> ItemOps

    %% Component connections to utilities
    CmdImpl --> Utils
    FuncPlugins --> Utils
    GamePlugins --> Utils
    Tasks --> Utils

    %% Click events
    click Entry "https://github.com/autowert/autowert/blob/main/src/index.ts"
    click CmdHandler "https://github.com/autowert/autowert/blob/main/src/plugins/commandHandlerPlugin.ts"
    click BaseCmd "https://github.com/autowert/autowert/blob/main/src/commands/BaseCommand.ts"
    click CmdImpl "https://github.com/autowert/autowert/tree/main/src/commands"
    click FuncP "https://github.com/autowert/autowert/tree/main/src/plugins/functions"
    click EFly "https://github.com/autowert/autowert/blob/main/src/plugins/eflyPlugin.ts"
    click Queue "https://github.com/autowert/autowert/blob/main/src/plugins/queueHandlerPlugin.ts"
    click Stats "https://github.com/autowert/autowert/blob/main/src/plugins/statisticsPlugin.ts"
    click Uptime "https://github.com/autowert/autowert/blob/main/src/plugins/uptimePlugin.ts"
    click LogP "https://github.com/autowert/autowert/blob/main/src/plugins/logPlugin.ts"
    click BaseTask "https://github.com/autowert/autowert/blob/main/src/tasks/task.ts"
    click ChestOps "https://github.com/autowert/autowert/tree/main/src/tasks/chest"
    click GameOps "https://github.com/autowert/autowert/tree/main/src/tasks/game"
    click ItemOps "https://github.com/autowert/autowert/tree/main/src/tasks/items"
    click HTTP "https://github.com/autowert/autowert/blob/main/src/util/httpServer.ts"
    click Notif "https://github.com/autowert/autowert/blob/main/src/util/notifications.ts"
    click PLog "https://github.com/autowert/autowert/blob/main/src/util/persistentLog.ts"
    click Cool "https://github.com/autowert/autowert/blob/main/src/util/CooldownManager.ts"

    classDef core fill:#2b5797,color:#fff
    classDef command fill:#70a370,color:#fff
    classDef plugin fill:#ff9933,color:#fff
    classDef task fill:#9673a6,color:#fff
    classDef service fill:#647687,color:#fff
```
