# aelindeman/xelabash architecture

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

- Interactive diagram: https://gitdiagram.com/aelindeman/xelabash
- Repository: https://github.com/aelindeman/xelabash

## Overview

##### Project Type and Purpose
- xelabash is an open-source CLI enhancement tool: a set of Bash scripts and utilities that provide a compact, informative shell prompt plus “better-than-default” autocomplete.
- It’s not a web app or microservice architecture, but a single‐process extension to your interactive Bash session, with optional integrations (Git, Kubernetes).

##### File-Structure Analysis
- Top-Level
– xela.bash         ← main loader script you source from your .bash_profile
– README.md         ← project description, features, install instructions
- config.d/           ← modular config files (aliases, functions, env vars)
- bin/               ← small standalone executables (abspath, mkpw, watts, etc.)
- images/            ← documentation screenshots
- .gitignore         ← excludes build/artifacts

Patterns: A central loader (xela.bash) + plug-in modules (config.d) + helper binaries (bin).

##### README Insights
- Describes prompt features (exit status coloring, Git branch+dirty, kube context, remote host display).
- Notes opt-in flags (GIT_PROMPT, KUBE_PROMPT).
- Mentions no external dependencies beyond Bash 4.4+, Git, kubectl (optional), and direnv (optional).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Project Metadata & Docs
    subgraph "Project Metadata & Docs"
        README["README.md"]:::docs
        Gitignore[".gitignore"]:::docs
        Profile["Xelabash.terminal"]:::docs
        Images["images/"]:::docs
    end

    %% Bin Utilities
    subgraph "Bin Utilities"
        BinDir["bin/"]:::ext
        Abspath["abspath"]:::ext
        Mkpw["mkpw"]:::ext
        Mkphash["mkpwhash"]:::ext
        Mksri["mksri"]:::ext
        Mkuuid["mkuuid"]:::ext
        Watts["watts"]:::ext
    end

    %% Config Modules
    subgraph "Config Modules"
        ConfigDir["config.d/"]:::ext
        Aliases["01-aliases.bash"]:::ext
        Functions["02-functions.bash"]:::ext
        UserExt["user-extensions"]:::ext
    end

    %% Core Loader & Prompt Logic
    subgraph "Core Loader & Prompt Logic"
        Xela["xela.bash"]:::loader
        subgraph "Prompt Logic"
            CoreBuilder["Core Prompt Builder"]:::logic
            ExitStatus["Exit-Status Checker"]:::logic
            GitModule["Git-Status Module"]:::optional
            KubeModule["Kube-Status Module"]:::optional
            SSHDetect["SSH-Session Detector"]:::logic
        end
    end

    %% Shell & Terminal
    Terminal["Terminal Emulator"]:::frontend
    Bash["Bash Shell"]:::frontend

    %% External Services
    subgraph "External Tools"
        GitCLI[(Git CLI)]:::external
        Kubectl[(kubectl)]:::external
        Direnv[(direnv)]:::external
    end

    %% Flows
    Terminal -->|"starts"| Bash
    Bash -->|"sources xela.bash"| Xela
    Xela -->|"loads modules"| ConfigDir
    ConfigDir -->|"includes"| Aliases
    ConfigDir -->|"includes"| Functions
    ConfigDir -->|"includes"| UserExt

    Xela -->|"initializes prompt logic"| CoreBuilder
    CoreBuilder -->|"checks status"| ExitStatus
    CoreBuilder -->|"queries"| GitModule
    CoreBuilder -->|"queries"| KubeModule
    CoreBuilder -->|"detects session"| SSHDetect
    CoreBuilder -->|"builds prompt"| Terminal

    CoreBuilder -->|"invokes"| BinDir
    BinDir --> Abspath
    BinDir --> Mkpw
    BinDir --> Mkphash
    BinDir --> Mksri
    BinDir --> Mkuuid
    BinDir --> Watts

    GitModule -->|"calls"| GitCLI
    KubeModule -->|"calls"| Kubectl
    CoreBuilder -.->|"optional"| Direnv

    %% Click Events
    click README "https://github.com/aelindeman/xelabash/blob/master/README.md"
    click Gitignore "https://github.com/aelindeman/xelabash/blob/master/.gitignore"
    click Profile "https://github.com/aelindeman/xelabash/blob/master/Xelabash.terminal"
    click Images "https://github.com/aelindeman/xelabash/tree/master/images/"
    click BinDir "https://github.com/aelindeman/xelabash/tree/master/bin/"
    click Abspath "https://github.com/aelindeman/xelabash/tree/master/bin/abspath"
    click Mkpw "https://github.com/aelindeman/xelabash/tree/master/bin/mkpw"
    click Mkphash "https://github.com/aelindeman/xelabash/tree/master/bin/mkpwhash"
    click Mksri "https://github.com/aelindeman/xelabash/tree/master/bin/mksri"
    click Mkuuid "https://github.com/aelindeman/xelabash/tree/master/bin/mkuuid"
    click Watts "https://github.com/aelindeman/xelabash/tree/master/bin/watts"
    click ConfigDir "https://github.com/aelindeman/xelabash/tree/master/config.d/"
    click Aliases "https://github.com/aelindeman/xelabash/blob/master/config.d/01-aliases.bash"
    click Functions "https://github.com/aelindeman/xelabash/blob/master/config.d/02-functions.bash"
    click Xela "https://github.com/aelindeman/xelabash/blob/master/xela.bash"

    %% Styles
    classDef frontend fill:#A3BE8C,stroke:#2E3440,color:#2E3440
    classDef loader fill:#5E81AC,stroke:#2E3440,color:#ECEFF4
    classDef logic fill:#88C0D0,stroke:#2E3440,color:#2E3440
    classDef ext fill:#D08770,stroke:#2E3440,color:#2E3440
    classDef external fill:#BF616A,stroke:#2E3440,color:#ECEFF4
    classDef optional fill:#EBCB8B,stroke:#2E3440,color:#2E3440
    classDef docs fill:#B48EAD,stroke:#2E3440,color:#ECEFF4
```
