# rhythmx/lucky architecture

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

- Interactive diagram: https://gitdiagram.com/rhythmx/lucky
- Repository: https://github.com/rhythmx/lucky

## Overview

##### Main Components

a) Core Components:
- Lucky Shell Script Manager (lucky.sh)
- Module System (mods-available & mods-enabled directories)
- Dotfiles Manager
- Binary Scripts (bin directory)
- Ports System

b) Module Management Layer:
- Module Enable/Disable System
- Module Priority Handler
- Module Reload Mechanism

**┌─────────────────────────────────────────────┐**
- User Interface               │
- (lucky.sh CLI & Shell Interface)     │
- ┤
- Module Management Layer           │
- (Enable/Disable/Reload/Priority Logic)   │
- ┤
- Module Registry                │
- ┌────────────┐            ┌────────────┐  │
- mods-    │  ─────►    │   mods-   │  │
- available │            │  enabled   │  │
- ┘            └────────────┘  │
- ┤
- Configuration Assets            │
- ┌────────┐  ┌─────┐  ┌────────┐         │
- dotfiles│  │ bin │  │ ports  │         │
- ┘  └─────┘  └────────┘         │
- ┘

##### Important Relationships

a) Module Management:
- How lucky.sh interfaces with mods-available and mods-enabled
- Symlink relationship between enabled and available modules
- Priority system (00-99 prefix in module names)

b) Configuration Management:
- How dotfiles are managed and linked to the home directory
- Relationship between binary scripts and the system

##### Implementation Details to Highlight

- Module naming convention (XX_name.sh)
- Configuration file symlink system
- Binary script distribution mechanism
- Ports system for managing external dependencies

Top Section:
- User interaction layer (lucky.sh commands)
- Module management interface

Middle Section:
- Module registry and priority system
- Enable/disable mechanism

Bottom Section:
- Configuration assets and system integration
- External tool integration points

Remember to:
- Both static structure and dynamic relationships
- Configuration flow and evaluation order

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        Lucky["Lucky Shell Script Manager"]:::core
        click Lucky "https://github.com/rhythmx/lucky/blob/master/lucky.sh"
    end

    subgraph MM["Module Management Layer"]
        ModEnable["Enable/Disable System"]
        ModPriority["Priority Handler"]
        ModReload["Reload Mechanism"]
    end

    subgraph MR["Module Registry"]
        direction TB
        Available["mods-available"]:::available
        click Available "https://github.com/rhythmx/lucky/tree/master/mods-available/"
        Enabled["mods-enabled"]:::enabled
        click Enabled "https://github.com/rhythmx/lucky/tree/master/mods-enabled/"

        subgraph Core["Core Modules"]
            LuckyCore["00_lucky_core.sh"]:::core
            click LuckyCore "https://github.com/rhythmx/lucky/blob/master/mods-available/00_lucky_core.sh"
            Colors["01_colors.sh"]:::core
            click Colors "https://github.com/rhythmx/lucky/blob/master/mods-available/01_colors.sh"
            Utils["01_utils.sh"]:::core
            click Utils "https://github.com/rhythmx/lucky/blob/master/mods-available/01_utils.sh"
            General["05_general.sh"]:::core
            click General "https://github.com/rhythmx/lucky/blob/master/mods-available/05_general.sh"
        end

        subgraph Shell["Shell Customization"]
            Aliases["10_aliases.sh"]:::shell
            click Aliases "https://github.com/rhythmx/lucky/blob/master/mods-available/10_aliases.sh"
            MOTD["20_motd.sh"]:::shell
            click MOTD "https://github.com/rhythmx/lucky/blob/master/mods-available/20_motd.sh"
            Prompt["50_prompt.sh"]:::shell
            click Prompt "https://github.com/rhythmx/lucky/blob/master/mods-available/50_prompt.sh"
            LinePrompt["52_line_prompt.sh"]:::shell
            click LinePrompt "https://github.com/rhythmx/lucky/blob/master/mods-available/52_line_prompt.sh"
        end

        subgraph Tools["External Tools"]
            Emacs["89_emacs.sh"]:::tools
            click Emacs "https://github.com/rhythmx/lucky/blob/master/mods-available/89_emacs.sh"
            Android["91_android.sh"]:::tools
            click Android "https://github.com/rhythmx/lucky/blob/master/mods-available/91_android.sh"
            Ghidra["92_ghidra.sh"]:::tools
            click Ghidra "https://github.com/rhythmx/lucky/blob/master/mods-available/92_ghidra.sh"
            Burp["93_burp.sh"]:::tools
            click Burp "https://github.com/rhythmx/lucky/blob/master/mods-available/93_burp.sh"
        end
    end

    subgraph Assets["Configuration Assets"]
        direction TB
        Dotfiles["Dotfiles Manager"]:::assets
        click Dotfiles "https://github.com/rhythmx/lucky/tree/master/dotfiles/"
        Bin["Binary Scripts"]:::assets
        click Bin "https://github.com/rhythmx/lucky/tree/master/bin/"
        Ports["Ports System"]:::assets
        click Ports "https://github.com/rhythmx/lucky/tree/master/ports/"

        subgraph Config["Configuration Files"]
            BashRC["bashrc"]:::config
            click BashRC "https://github.com/rhythmx/lucky/tree/master/dotfiles/bashrc"
            BashProfile["bash_profile"]:::config
            click BashProfile "https://github.com/rhythmx/lucky/tree/master/dotfiles/bash_profile"
            Spacemacs[".spacemacs"]:::config
            click Spacemacs "https://github.com/rhythmx/lucky/blob/master/dotfiles/.spacemacs"
            Xscreen[".xscreensaver"]:::config
            click Xscreen "https://github.com/rhythmx/lucky/blob/master/dotfiles/.xscreensaver"
            Xbind["xbindkeysrc.scm"]:::config
            click Xbind "https://github.com/rhythmx/lucky/blob/master/dotfiles/xbindkeysrc.scm"
        end

        subgraph Scripts["Utility Scripts"]
            Wallpaper["earth_wallpaper.sh"]:::scripts
            click Wallpaper "https://github.com/rhythmx/lucky/blob/master/bin/earth_wallpaper.sh"
            Firefox["firefox_throwaway.sh"]:::scripts
            click Firefox "https://github.com/rhythmx/lucky/blob/master/bin/firefox_throwaway.sh"
            Monitor["monitor_hotplug.sh"]:::scripts
            click Monitor "https://github.com/rhythmx/lucky/blob/master/bin/monitor_hotplug.sh"
            RDP["rdp.sh"]:::scripts
            click RDP "https://github.com/rhythmx/lucky/blob/master/bin/rdp.sh"
        end
    end

    Lucky --> ModEnable
    Lucky --> ModPriority
    Lucky --> ModReload
    ModEnable --> Available
    ModEnable --> Enabled
    ModPriority --> Available
    ModReload --> Enabled
    Available --> Core
    Available --> Shell
    Available --> Tools
    Enabled -.-> Core
    Enabled -.-> Shell
    Enabled -.-> Tools
    Lucky --> Dotfiles
    Lucky --> Bin
    Lucky --> Ports
    Dotfiles --> Config
    Bin --> Scripts

    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef available fill:#9E9E9E,stroke:#616161,color:white
    classDef enabled fill:#4CAF50,stroke:#2E7D32,color:white
    classDef shell fill:#FF9800,stroke:#EF6C00,color:white
    classDef tools fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef assets fill:#FF5722,stroke:#D84315,color:white
    classDef config fill:#795548,stroke:#4E342E,color:white
    classDef scripts fill:#607D8B,stroke:#37474F,color:white
```
