# smoonlee/oh-my-posh-profile architecture

> Architecture diagram of the GitHub repository smoonlee/oh-my-posh-profile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smoonlee/oh-my-posh-profile
- Repository: https://github.com/smoonlee/oh-my-posh-profile

## Overview

##### Project type and purpose
- This is a “dotfiles/configuration” repository that provides PowerShell profile setup scripts, terminal configuration, Oh-My-Posh theme JSON, and CI/CD workflows to automate releases. Its purpose is to bootstrap a consistent, cross-platform shell environment (Windows PowerShell, Windows Terminal, WSL/Linux) with modules, fonts, themes, and custom functions.

##### File structure
- Top-level files:
- Microsoft.PowerShell_profile.ps1 (base profile)
- New-OhMyPoshProfile.ps1 (Windows install script)
- New-OhMyPoshProfile.sh (Linux/WSL install script)
- quick-term-cloud.omp.json (Oh-My-Posh theme config)
- windows-terminal-settings.json (Windows Terminal settings)
- readme.md
- assets/: images (header, previews) and any additional theme resources.
- .github/workflows/: two YAML pipelines for release and tagging.

##### README for additional insights
- Scripts automate: setting execution policy, cloning repo, installing Nerd Fonts, PowerShell modules (Az, PSReadLine, etc.), Winget packages (AWSCLI, Terraform, kubectl, etc.), linking WSL .kube folder.
- Custom functions added (Get-MyPublicIP, Get-AzSystemUptime, etc.).
- CI/CD pipelines release new versions and tag builds.

a. Main components:
- User Environment
- Windows PowerShell host
- Windows Terminal
- WSL/Linux shell
- Bootstrap Scripts
- New-OhMyPoshProfile.ps1
- New-OhMyPoshProfile.sh
- Configuration Artifacts
- Microsoft.PowerShell_profile.ps1
- quick-term-cloud.omp.json
- windows-terminal-settings.json
- assets/
- External Services
- PowerShell Gallery (module repo)
- Winget (package manager)
- GitHub (repo, raw scripts, Actions)
- Nerd Fonts download site
- External APIs (endoflife.date)
- CI/CD
- GitHub Actions (action-profile-release, action-tag-build-tag)

b. Relationships / interactions:
- User invokes install script → script pulls repo from GitHub → reads configuration files → calls PowerShell Gallery & Winget to install modules and packages → downloads/install Nerd Font → updates Windows Terminal settings → links WSL .kube folder → updates $PROFILE.
- Scripts reference quick-term-cloud.omp.json to configure the Oh-My-Posh prompt.
- CI workflows trigger on tag or push to release updated artifacts (bump version, publish to GitHub Releases).

c. Architectural patterns / principles:
- Single responsibility: separate install logic per platform (PS1 vs. SH).
- Idempotent bootstrapping: re-runnable scripts that detect existing modules/fonts.
- Declarative config: use JSON for theme and terminal settings.
- CI/CD automation: GitHub Actions manage versioning and release.

d. Key technologies / libraries:
- PowerShell (PS 7+, PSReadLine, Posh-Git, Az module…)
- Oh-My-Posh (theme engine)
- Winget
- Git/GitHub
- Windows Terminal JSON schema
- Bash (for Linux/WSL)

##### Detailed coverage
- Scripts, configs, assets, module/package sources, and CI pipelines
- Data flows:
- GitHub → clone → script → system
- script → PowerShell Gallery & Winget → local installs
- script → modify Windows Terminal JSON → apply settings
- CI Actions → bump version → create Git tag → GitHub Releases

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Swimlanes
    subgraph "User Machine"
        direction TB
        user((User)):::user
        WinPS["Windows PowerShell Host"]:::user
        WinTerm["Windows Terminal"]:::user
        WSL["WSL/Linux Shell"]:::user

        NewPS["New-OhMyPoshProfile.ps1"]:::script
        NewSH["New-OhMyPoshProfile.sh"]:::script
        Profile["Microsoft.PowerShell_profile.ps1"]:::config
        Theme["quick-term-cloud.omp.json"]:::config
        TerminalCfg["windows-terminal-settings.json"]:::config
        Assets["assets/"]:::config
        Readme["readme.md"]:::config
    end

    subgraph "External Services"
        direction TB
        PSGallery[(PowerShell Gallery)]:::external
        Winget[(Winget)]:::external
        GitHub[(GitHub)]:::external
        NerdFonts[(Nerd Fonts Download)]:::external
        EndOfLife[(endoflife.date API)]:::external
    end

    subgraph "CI/CD"
        direction TB
        ReleaseAction["action-profile-release"]:::ci
        TagAction["action-tag-build-tag"]:::ci
    end

    %% User to Scripts
    user -->|"invoke PS install"| NewPS
    user -->|"invoke SH install"| NewSH

    %% Scripts clone repo
    NewPS -->|"clone repo"| GitHub
    NewSH -->|"clone repo"| GitHub

    %% Scripts load configs
    NewPS -->|reads| Profile
    NewPS -->|reads| Theme
    NewPS -->|reads| TerminalCfg
    NewPS -->|reads| Assets

    NewSH -->|reads| Profile
    NewSH -->|reads| Theme

    %% Scripts install services
    NewPS -->|install modules| PSGallery
    NewPS -->|install packages| Winget
    NewPS -->|download fonts| NerdFonts
    NewPS -->|fetch versions| EndOfLife

    NewSH -->|install modules| PSGallery
    NewSH -->|fetch versions| EndOfLife

    %% Scripts configure environments
    NewPS -->|apply profile| WinPS
    NewPS -->|apply terminal settings| WinTerm
    NewPS -->|link .kube folder| WSL

    NewSH -->|apply profile| WSL

    %% CI/CD workflows
    GitHub -.->|on push/tag| ReleaseAction
    GitHub -.->|on push/tag| TagAction
    ReleaseAction -->|bump version & publish| GitHub
    TagAction -->|create release tag| GitHub

    %% User clone after release
    user -->|clone updated repo| GitHub

    %% Click events
    click NewPS "https://github.com/smoonlee/oh-my-posh-profile/blob/main/New-OhMyPoshProfile.ps1"
    click NewSH "https://github.com/smoonlee/oh-my-posh-profile/blob/main/New-OhMyPoshProfile.sh"
    click Profile "https://github.com/smoonlee/oh-my-posh-profile/blob/main/Microsoft.PowerShell_profile.ps1"
    click Theme "https://github.com/smoonlee/oh-my-posh-profile/blob/main/quick-term-cloud.omp.json"
    click TerminalCfg "https://github.com/smoonlee/oh-my-posh-profile/blob/main/windows-terminal-settings.json"
    click Assets "https://github.com/smoonlee/oh-my-posh-profile/tree/main/assets/"
    click ReleaseAction "https://github.com/smoonlee/oh-my-posh-profile/blob/main/.github/workflows/action-profile-release.yaml"
    click TagAction "https://github.com/smoonlee/oh-my-posh-profile/blob/main/.github/workflows/action-tag-build-tag.yaml"
    click Readme "https://github.com/smoonlee/oh-my-posh-profile/blob/main/readme.md"

    %% Styles
    classDef script fill:#ADD8E6,stroke:#000
    classDef config fill:#87CEFA,stroke:#000
    classDef external fill:#90EE90,stroke:#000
    classDef user fill:#FFA500,stroke:#000
    classDef ci fill:#DDA0DD,stroke:#000
```
