# alajmo/mani architecture

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

- Interactive diagram: https://gitdiagram.com/alajmo/mani
- Repository: https://github.com/alajmo/mani

## Overview

##### Main Components Identification

The system can be broken down into these major components:

a. Command Layer (cmd/)
- Entry points for different CLI commands
- Handles user interaction and command parsing

b. Core Layer (core/)
- Business logic implementation
- Multiple sub-components:
- DAO (Data Access Objects)
- Execution Engine
- Print/Output System
- TUI (Terminal User Interface)

##### Key Architectural Patterns

The system follows these patterns:
- Command Pattern (for CLI commands)
- MVC-like structure (separation of data, logic, and presentation)
- Plugin-style architecture for different output formats

**┌─────────────────────────────────────────────────────────┐**
- User Interface                        │
- ┬───────────────────────┬─────────────────┤
- CLI Mode    │      TUI Mode         │  Output Formats │
- (cmd/)      │     (core/tui)        │  (core/print)   │
- ┬───────┴──────────┬────────────┴────────┬────────┘

**┌───────▼──────────────────▼─────────────────────▼────────┐**
- Core Layer                           │
- ┬────────────────┬────────────────────────┤
- DAO           │  Exec Engine   │     Theme Engine       │
- (core/dao)     │  (core/exec)   │     (core/dao/theme)   │
- ┴───────┬────────┴────────────────────────┘

**┌───────────────────────▼─────────────────────────────────┐**
- External Systems                         │
- ┬────────────────┬────────────────────────┤
- Git Repos     │    Shell       │     File System        │
- ┴────────────────┴────────────────────────┘

##### Component Relationships

- Double lines: Data flow

##### Additional Elements

- Config file handling (mani.yaml)
- Project management flows
- Task execution pipelines
- Theme customization system

##### Key Technical Details to Highlight

- Parallel execution capability
- Cross-platform support
- Plugin-based output system
- TUI component architecture

##### Implementation Notes

- How the system handles different operating systems
- Where configuration is stored and processed
- Points of extension/customization

##### Scale and Detail Level

- Keep high-level architecture visible at a glance
- Provide zoom-in sections for complex subsystems
- Callouts for important features

Remember to emphasize:
- The modular nature of the system
- Clear separation of concerns
- The flexibility of the execution engine
- Multiple user interface options (CLI/TUI)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        CLI["CLI Mode"]
        TUI["TUI Mode"]
        OUT["Output Formats"]
    end

    subgraph Core["Core Layer"]
        DAO["Data Access Objects"]
        EXEC["Execution Engine"]
        THEME["Theme Engine"]
    end

    subgraph External["External Systems"]
        GIT["Git Repositories"]
        SHELL["Shell"]
        FS["File System"]
    end

    subgraph TUIComponents["TUI Components"]
        VIEWS["Views"]
        PAGES["Pages"]
        COMP["Components"]
    end

    subgraph Execution["Cross-Platform Execution"]
        UNIX["Unix System"]
        WIN["Windows System"]
    end

    CLI --> DAO
    CLI --> EXEC
    TUI --> DAO
    TUI --> EXEC
    OUT --> DAO

    TUI --> TUIComponents
    VIEWS --> THEME
    PAGES --> THEME
    COMP --> THEME

    DAO --> FS
    EXEC --> SHELL
    EXEC --> GIT
    EXEC --> Execution

    %% Component Mappings
    click CLI "https://github.com/alajmo/mani/blob/main/cmd/root.go"
    click TUI "https://github.com/alajmo/mani/blob/main/cmd/tui.go"
    click DAO "https://github.com/alajmo/mani/tree/main/core/dao"
    click EXEC "https://github.com/alajmo/mani/tree/main/core/exec"
    click OUT "https://github.com/alajmo/mani/blob/main/core/print/lib.go"
    click THEME "https://github.com/alajmo/mani/blob/main/core/dao/theme.go"
    click VIEWS "https://github.com/alajmo/mani/tree/main/core/tui/views"
    click PAGES "https://github.com/alajmo/mani/tree/main/core/tui/pages"
    click COMP "https://github.com/alajmo/mani/tree/main/core/tui/components"
    click UNIX "https://github.com/alajmo/mani/blob/main/core/exec/unix.go"
    click WIN "https://github.com/alajmo/mani/blob/main/core/exec/windows.go"

    %% Styling
    classDef ui fill:#2374ab
    classDef core fill:#2a9d8f
    classDef external fill:#grey
    classDef components fill:#e9c46a

    class CLI,TUI,OUT ui
    class DAO,EXEC,THEME core
    class GIT,SHELL,FS external
    class VIEWS,PAGES,COMP components

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        CORE_L["Core Components"]:::core
        EXT_L["External Systems"]:::external
        COMP_L["TUI Components"]:::components
    end
```
