# jrbueno/aoc-go architecture

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

- Interactive diagram: https://gitdiagram.com/jrbueno/aoc-go
- Repository: https://github.com/jrbueno/aoc-go

## Overview

##### Main Components

a. CLI Interface Layer
- Root Command Handler (from cmd/root.go)
- Run Command Handler (from cmd/run.go)
- Command-line argument parser

b. Solution Runner Core
- Solution Registry/Manager
- Year/Day Solution Loader
- Execution Engine

c. Solution Implementations
- Year-based organization
- Day-specific solutions
- Test implementations

**┌─ User Input Layer ─────┐**
- CLI Interface        │
- (Cobra Framework)    │
- ┬────────────┘
- ↓
**┌─ Core Logic Layer ────┐**
- Solution Manager     │
- Execution Engine     │
- ┬────────────┘
- ↓
**┌─ Solution Layer ──────┐**
- Year/Day Solutions   │
- Test Cases          │
- ┘

##### Component Relationships

- User input → CLI Interface (command/flags)
- CLI Interface → Solution Manager (year/day selection)
- Solution Manager → Specific Solution Implementation
- Solution Implementation ↔ Test Cases (bidirectional for verification)

##### Important Details

a. Command Flow:
- How commands flow from root.go to run.go
- How year/day parameters are passed

b. Solution Structure:
- Demonstrate the hierarchical organization (year → day)
- Relationship between solution files and their tests

c. Type System:
- Internal/types.go connections to both core and solution layers

##### Technical Specifications to Note

- Go-specific components
- Cobra CLI framework integration
- Test framework integration
- File system interaction for solution loading

##### The testing framework integration

Remember to indicate the Go module structure and any external dependencies (as shown in go.mod) that are crucial to the system's operation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        User(("User Input"))
        RootCmd["Root Command Handler"]:::cli
        RunCmd["Run Command Handler"]:::cli
        ArgParser["Argument Parser"]:::cli
    end

    subgraph Core
        SolutionMgr["Solution Registry/Manager"]:::core
        ExecEngine["Execution Engine"]:::core
        Types["Core Types"]:::core
    end

    subgraph Solutions
        Year2024["Year 2024 Solutions"]:::solution
        subgraph Day1
            Day1Sol["Day 1 Solution"]:::solution
            Day1Test["Day 1 Tests"]:::test
        end
        subgraph Day2
            Day2Sol["Day 2 Solution"]:::solution
            Day2Test["Day 2 Tests"]:::test
        end
        subgraph Day3
            Day3Sol["Day 3 Solution"]:::solution
            Day3Test["Day 3 Tests"]:::test
        end
    end

    subgraph CI
        CICD["CI/CD Workflow"]:::ci
    end

    User --> RootCmd
    RootCmd --> RunCmd
    RunCmd --> ArgParser
    ArgParser --> SolutionMgr
    SolutionMgr --> ExecEngine
    Types --> SolutionMgr
    Types --> ExecEngine
    ExecEngine --> Year2024
    Year2024 --> Day1Sol
    Year2024 --> Day2Sol
    Year2024 --> Day3Sol
    Day1Sol --- Day1Test
    Day2Sol --- Day2Test
    Day3Sol --- Day3Test
    CICD --> Solutions

    %% Click events for component mapping
    click RootCmd "https://github.com/jrbueno/aoc-go/blob/main/cmd/root.go"
    click RunCmd "https://github.com/jrbueno/aoc-go/blob/main/cmd/run.go"
    click Types "https://github.com/jrbueno/aoc-go/blob/main/internal/types.go"
    click Year2024 "https://github.com/jrbueno/aoc-go/tree/main/solutions/year2024/"
    click Day1Sol "https://github.com/jrbueno/aoc-go/blob/main/solutions/year2024/day1/day1.go"
    click Day1Test "https://github.com/jrbueno/aoc-go/blob/main/solutions/year2024/day1/day1_test.go"
    click Day2Sol "https://github.com/jrbueno/aoc-go/blob/main/solutions/year2024/day2/day2.go"
    click Day2Test "https://github.com/jrbueno/aoc-go/blob/main/solutions/year2024/day2/day2_test.go"
    click Day3Sol "https://github.com/jrbueno/aoc-go/blob/main/solutions/year2024/day3/day3.go"
    click Day3Test "https://github.com/jrbueno/aoc-go/blob/main/solutions/year2024/day3/day3_test.go"
    click CICD "https://github.com/jrbueno/aoc-go/blob/main/.github/workflows/go.yml"

    %% Styling
    classDef cli fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#388E3C,color:white
    classDef solution fill:#FFC107,stroke:#FFA000,color:black
    classDef test fill:#9E9E9E,stroke:#616161,color:white
    classDef ci fill:#FF5722,stroke:#E64A19,color:white

    %% Legend
    subgraph Legend
        CLI_L["CLI Component"]:::cli
        Core_L["Core Component"]:::core
        Solution_L["Solution Component"]:::solution
        Test_L["Test Component"]:::test
        CI_L["CI/CD Component"]:::ci
    end
```
