# sriram-pr/pwsh-neofetch architecture

> Architecture diagram of the GitHub repository sriram-pr/pwsh-neofetch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sriram-pr/pwsh-neofetch
- Repository: https://github.com/sriram-pr/pwsh-neofetch

## Overview

##### Project Type and Purpose
- Type: A CLI tool (PowerShell script + module) for Windows.
- Purpose: Display system information with ASCII art, support caching, multi-threading, benchmarking, and easy configuration.

##### File Structure
Top-level folders & files:
- .github/… : CI/CD (GitHub Actions)
- assets/… : Images and ASCII-art examples
- direct-installer.ps1 / direct-uninstaller.ps1 : Install/uninstall scripts
- module_relocator.ps1 : Fixes module path issues
- ps-gallery-build/… : Packaging module for PowerShell Gallery (psd1 + psm1)
- standalone-script/… : Single-file script distribution
- README.md, LICENSE, .gitignore : Project metadata

Patterns:
- Separation of packaging (ps-gallery-build) vs. standalone script
- CI config for automatic publishing

##### README Insights
- Core features: data collection, caching, ASCII art, benchmarking, config wizard
- Distribution channels: PowerShell Gallery vs. GitHub clone + installer
- Configuration stored in user profile (dotfiles)
- No external services beyond OS and file system calls

##### Main Components & Their Interactions
A. Developer / CI Pipeline
- Source Repo (GitHub)
- GitHub Actions workflow (build, version bump, publish to PSGallery & GitHub Releases)
B. Distribution Artifacts
- PowerShell Gallery Module package
- Standalone .ps1 script
- Installer / Uninstaller scripts
C. End-User Runtime Environment
1. CLI Entry Point (“neofetch” command)
2. Module Loader (Import-Module pwsh-neofetch)
3. Core Engine
- Data Collector (multi-threaded system probes via WMI/Win32 APIs)
- Cache Manager (reads/writes cache in user profile)
- ASCII Art Loader (loads default or custom art files)
- Benchmark Runner (CPU, memory, disk speed tests)
- Config Wizard (interactive setup)
4. Configuration Store (files in user profile directory)
5. Output Renderer (terminal text + ASCII art)

Relationships:
- CLI → Module Loader → Core Engine subcomponents
- Core Engine ↔ Cache Manager & Config Store
- Benchmark Runner reads hardware, writes to Output Renderer
- ASCII Art Loader reads assets/ directory or user art file

##### Architectural Patterns & Principles
- Modular separation: standalone script vs. module package
- Single responsibility: each .ps1/.psm1 controller handles one concern (installation, relocation, engine)
- CI/CD Automation: guarantee that any merge triggers packaging and publishing
- Local-first: no external network dependencies at runtime

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development & CI
    subgraph "Development & CI"
        direction TB
        Dev["Developer"]:::devci
        CI["GitHub Actions Workflow"]:::devci
        click CI "https://github.com/sriram-pr/pwsh-neofetch/blob/main/.github/workflows/publish.yml"
    end

    %% Distribution & Packaging
    subgraph "Distribution & Packaging"
        direction TB
        PSGallery["PowerShell Gallery Module Package"]:::dist
        PSManifest["Module Manifest (.psd1)"]:::dist
        PSScript["Module Script (.psm1)"]:::dist
        click PSManifest "https://github.com/sriram-pr/pwsh-neofetch/blob/main/ps-gallery-build/pwsh-neofetch/pwsh-neofetch.psd1"
        click PSScript "https://github.com/sriram-pr/pwsh-neofetch/blob/main/ps-gallery-build/pwsh-neofetch/pwsh-neofetch.psm1"
        Standalone["Standalone Script (.ps1)"]:::dist
        click Standalone "https://github.com/sriram-pr/pwsh-neofetch/blob/main/standalone-script/pwsh-neofetch.ps1"
        Installer["Installer Script"]:::dist
        click Installer "https://github.com/sriram-pr/pwsh-neofetch/blob/main/direct-installer.ps1"
        Uninstaller["Uninstaller Script"]:::dist
        click Uninstaller "https://github.com/sriram-pr/pwsh-neofetch/blob/main/direct-uninstaller.ps1"
        Relocator["Module Relocator"]:::dist
        click Relocator "https://github.com/sriram-pr/pwsh-neofetch/blob/main/module_relocator.ps1"
    end

    %% Project Metadata
    subgraph "Project Metadata & Docs"
        direction TB
        README["README.md"]:::dist
        LICENSE["LICENSE"]:::dist
        GITIGNORE[".gitignore"]:::dist
        click README "https://github.com/sriram-pr/pwsh-neofetch/blob/main/README.md"
        click LICENSE "https://github.com/sriram-pr/pwsh-neofetch/tree/main/LICENSE"
        click GITIGNORE "https://github.com/sriram-pr/pwsh-neofetch/blob/main/.gitignore"
    end

    Dev --> CI
    CI --> PSGallery
    CI --> Standalone

    %% Distribution Channels
    PSGallery -->|"Publish to PSGallery"| Gallery["PowerShell Gallery"]:::dist
    Standalone -->|"Release artifact"| Releases["GitHub Releases"]:::dist

    %% End-User Runtime
    subgraph "End-User Runtime" 
        direction TB
        CLI["CLI Entry Point \"neofetch\""]:::runtime
        ModuleLoader["Module Loader (Import-Module)"]:::runtime
        CoreEngine["Core Engine"]:::runtime
        subgraph "Core Engine Components"
            direction TB
            DataCollector["Data Collector"]:::runtime
            CacheManager["Cache Manager"]:::runtime
            ASCIIArtLoader["ASCII Art Loader"]:::runtime
            BenchmarkRunner["Benchmark Runner"]:::runtime
            ConfigWizard["Config Wizard"]:::runtime
            OutputRenderer["Output Renderer"]:::runtime
        end
        ConfigStore["Configuration Store"]:::fsos
        CacheStore["Cache Files"]:::fsos
        Assets["ASCII Art Assets"]:::fsos
        OS["OS / WMI / Win32 APIs"]:::fsos
        click Assets "https://github.com/sriram-pr/pwsh-neofetch/tree/main/assets/"
    end

    %% Runtime Flow
    CLI --> ModuleLoader
    ModuleLoader --> CoreEngine
    CoreEngine --> DataCollector
    CoreEngine --> CacheManager
    CoreEngine --> ASCIIArtLoader
    CoreEngine --> BenchmarkRunner
    CoreEngine --> ConfigWizard
    CoreEngine --> OutputRenderer

    DataCollector --> OS
    CacheManager --> CacheStore
    ASCIIArtLoader --> Assets
    ConfigWizard --> ConfigStore
    OutputRenderer --> OS

    %% Styles
    classDef devci fill:#AED6F1,stroke:#21618C,color:#1B4F72,stroke-width:1px;
    classDef dist fill:#ABEBC6,stroke:#1D8348,color:#145A32,stroke-width:1px;
    classDef runtime fill:#F5CBA7,stroke:#D35400,color:#7E5109,stroke-width:1px;
    classDef fsos fill:#D5DBDB,stroke:#424949,color:#17202A,stroke-width:1px;
```
