# guionardo/gs-dev architecture

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

- Interactive diagram: https://gitdiagram.com/guionardo/gs-dev
- Repository: https://github.com/guionardo/gs-dev

## Overview

##### Main Components Identification

a. Command Layer (Top Level)
- Root command structure from the 'cmd' directory
- Major commands: calendar, dev, init, install, pad, todo, url

b. Application Logic Layer (Middle Level)
- 'app' directory modules
- How each command connects to its corresponding application logic

c. Core Infrastructure Layer (Bottom Level)
- Config management
- Internal utilities
- Git integration
- Shell interaction

##### Component Relationships

**[CLI Interface Layer]**

- v
**[Command Handler Layer] --> [Configuration Management]**

- v
**[Application Modules] -----> [Internal Services]**

- v                           v
**[Infrastructure Layer] <--> [External Systems]**

##### Specific Implementation Details

- Rectangles: Core commands and modules
- Hexagons: Infrastructure components
- Clouds: External services (like Azure, GitHub)

- Blue: CLI and command components
- Green: Application logic
- Yellow: Infrastructure services
- Gray: External systems

##### Key Relationships to Highlight

- How commands in 'cmd' directory connect to their implementations in 'app'
- Configuration flow from 'config' to various modules
- Demonstrate how internal utilities support all layers
- Platform-specific implementations (e.g., url_darwin.go, url_linux.go, url_windows.go)

##### Important Architectural Elements

- Configuration Management System
- Relationship between config files and their generators
- Configuration repository pattern

- Command Pattern Implementation
- Demonstrate how Cobra framework is integrated
- Command hierarchy

- Cross-cutting Concerns
- Logger
- Path Tools
- Git Integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef command fill:#2196F3,stroke:#1565C0,color:white
    classDef app fill:#4CAF50,stroke:#388E3C,color:white
    classDef infra fill:#FFC107,stroke:#FFA000,color:black
    classDef config fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef external fill:#757575,stroke:#616161,color:white
    classDef platform fill:#00BCD4,stroke:#0097A7,color:white

    %% CLI Interface Layer
    Root["Root Command"]:::command
    click Root "https://github.com/guionardo/gs-dev/blob/develop/cmd/root.go"

    %% Commands
    Calendar["Calendar Command"]:::command
    Dev["Dev Command"]:::command
    Init["Init Command"]:::command
    Install["Install Command"]:::command
    Pad["Pad Command"]:::command
    Todo["Todo Command"]:::command
    URL["URL Command"]:::command

    click Calendar "https://github.com/guionardo/gs-dev/blob/develop/cmd/calendar.go"
    click Dev "https://github.com/guionardo/gs-dev/blob/develop/cmd/dev.go"
    click Init "https://github.com/guionardo/gs-dev/blob/develop/cmd/init.go"
    click Install "https://github.com/guionardo/gs-dev/blob/develop/cmd/install.go"
    click Pad "https://github.com/guionardo/gs-dev/blob/develop/cmd/pad.go"
    click Todo "https://github.com/guionardo/gs-dev/blob/develop/cmd/todo.go"
    click URL "https://github.com/guionardo/gs-dev/blob/develop/cmd/url.go"

    %% Application Modules
    CalendarApp["Calendar Module"]:::app
    DevApp["Dev Module"]:::app
    InitApp["Init Module"]:::app
    InstallApp["Install Module"]:::app
    PadApp["Pad Module"]:::app
    TodoApp["Todo Module"]:::app
    URLApp["URL Module"]:::app

    click CalendarApp "https://github.com/guionardo/gs-dev/tree/develop/app/calendar/"
    click DevApp "https://github.com/guionardo/gs-dev/tree/develop/app/dev/"
    click InitApp "https://github.com/guionardo/gs-dev/tree/develop/app/init_shell/"
    click InstallApp "https://github.com/guionardo/gs-dev/tree/develop/app/install/"
    click PadApp "https://github.com/guionardo/gs-dev/tree/develop/app/pad/"
    click TodoApp "https://github.com/guionardo/gs-dev/tree/develop/app/todo/"
    click URLApp "https://github.com/guionardo/gs-dev/tree/develop/app/url/"

    %% Infrastructure Components
    ConfigRepo["Config Repository"]:::config
    ConfigInterfaces["Configuration Interfaces"]:::config
    RootConfig["Root Configuration"]:::config

    click ConfigRepo "https://github.com/guionardo/gs-dev/blob/develop/config/config_repository.go"
    click ConfigInterfaces "https://github.com/guionardo/gs-dev/blob/develop/config/interfaces.go"
    click RootConfig "https://github.com/guionardo/gs-dev/blob/develop/configs/root_config.go"

    %% Core Infrastructure
    GitIntegration["Git Integration"]:::infra
    Logger["Logger"]:::infra
    PathTools["Path Tools"]:::infra
    ShellInteraction["Shell Interaction"]:::infra

    click GitIntegration "https://github.com/guionardo/gs-dev/tree/develop/internal/git/"
    click Logger "https://github.com/guionardo/gs-dev/tree/develop/internal/logger/"
    click PathTools "https://github.com/guionardo/gs-dev/tree/develop/internal/path_tools/"
    click ShellInteraction "https://github.com/guionardo/gs-dev/blob/develop/shell/shell_info.go"

    %% Platform-Specific
    subgraph PlatformImpl["Platform Implementations"]
        Darwin["URL Darwin"]:::platform
        Linux["URL Linux"]:::platform
        Windows["URL Windows"]:::platform
    end

    click Darwin "https://github.com/guionardo/gs-dev/blob/develop/app/url/url_darwin.go"
    click Linux "https://github.com/guionardo/gs-dev/blob/develop/app/url/url_linux.go"
    click Windows "https://github.com/guionardo/gs-dev/blob/develop/app/url/url_windows.go"

    %% Config Generators
    CalendarConfig["Calendar Config"]:::config
    DevConfig["Dev Config"]:::config
    PadConfig["Pad Config"]:::config
    TodoConfig["Todo Config"]:::config

    click CalendarConfig "https://github.com/guionardo/gs-dev/blob/develop/config/calendar_config_gen.go"
    click DevConfig "https://github.com/guionardo/gs-dev/blob/develop/config/dev_config_gen.go"
    click PadConfig "https://github.com/guionardo/gs-dev/blob/develop/config/pad_config_gen.go"
    click TodoConfig "https://github.com/guionardo/gs-dev/blob/develop/config/todo_config_gen.go"

    %% Relationships
    Root --> Calendar & Dev & Init & Install & Pad & Todo & URL

    Calendar --> CalendarApp
    Dev --> DevApp
    Init --> InitApp
    Install --> InstallApp
    Pad --> PadApp
    Todo --> TodoApp
    URL --> URLApp

    CalendarApp & DevApp & InitApp & InstallApp & PadApp & TodoApp & URLApp --> ConfigRepo
    ConfigRepo --> ConfigInterfaces
    ConfigRepo --> RootConfig

    URLApp --> PlatformImpl

    CalendarApp --> CalendarConfig
    DevApp --> DevConfig
    PadApp --> PadConfig
    TodoApp --> TodoConfig

    CalendarApp & DevApp & InitApp & InstallApp & PadApp & TodoApp & URLApp --> GitIntegration & Logger & PathTools & ShellInteraction

    %% Legend
    subgraph Legend
        CMD["Command Layer"]:::command
        APP["Application Layer"]:::app
        INF["Infrastructure"]:::infra
        CFG["Configuration"]:::config
        PLT["Platform-Specific"]:::platform
    end
```
