# s4tyendra/envman architecture

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

- Interactive diagram: https://gitdiagram.com/s4tyendra/envman
- Repository: https://github.com/s4tyendra/envman

## Overview

##### Main Components Identification

a. Core Components:
- Command Handler (Main Entry Point)
- Profile Manager
- Shell Integration
- Storage System
- User Interface Layer

##### Component Relationships

**User Input Layer**
- ↓
**Command Handler Layer**
- ↓
**Profile Management Layer**
- ↓
**Storage Layer**

##### Specific Implementation Details

a. Top Level (User Interface):
- CLI interface accepting commands (init, profile, load)

b. Middle Level (Business Logic):
- Profile Creation
- Profile Editing
- Profile Viewing
- Profile Listing
- Profile Deletion
- How these components interact with the storage layer

c. Bottom Level (Storage & Integration):
- Local storage system for profiles
- Shell integration components
- Environment variable management system

##### Important Elements

a. Data Flow:
- How environment variables flow from profiles to shell
- Read/write operations to storage
- Command processing paths

b. Key Processes:
- Profile initialization process
- Profile loading process
- Shell integration process

##### Specific Implementation Notes

- main.go: Entry point and command routing
- helpers.go: Utility functions
- models.go: Data structures
- profile_*.go files: Individual profile operations

##### Technical Details
- File system interaction for profile storage
- Shell script integration points
- Environment variable manipulation flow

- Clear labels for all components

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef shell fill:#9b59b6,stroke:#8e44ad,color:white

    %% User Interface Layer
    UI[User Interface]:::ui
    click UI "https://github.com/s4tyendra/envman/blob/main/outputs.go"
    CLI[CLI Commands]:::ui

    %% Command Handler Layer
    CMD[Command Handler]:::core
    click CMD "https://github.com/s4tyendra/envman/blob/main/main.go"

    %% Profile Management Layer
    subgraph ProfileManagement[Profile Management]
        Init[Profile Initialization]:::core
        click Init "https://github.com/s4tyendra/envman/blob/main/profile_init.go"
        Create[Profile Creation]:::core
        click Create "https://github.com/s4tyendra/envman/blob/main/profile_create.go"
        Edit[Profile Editing]:::core
        click Edit "https://github.com/s4tyendra/envman/blob/main/profile_edit.go"
        View[Profile Viewing]:::core
        click View "https://github.com/s4tyendra/envman/blob/main/profile_view.go"
        List[Profile Listing]:::core
        click List "https://github.com/s4tyendra/envman/blob/main/profile_list.go"
        Delete[Profile Deletion]:::core
        click Delete "https://github.com/s4tyendra/envman/blob/main/profile_delete.go"
    end

    %% Storage Layer
    Store[Storage System]:::storage
    click Store "https://github.com/s4tyendra/envman/blob/main/models.go"
    Utils[Utility Functions]:::core
    click Utils "https://github.com/s4tyendra/envman/blob/main/helpers.go"

    %% Shell Integration Layer
    subgraph ShellIntegration[Shell Integration]
        ShellInstall[Shell Installation]:::shell
        click ShellInstall "https://github.com/s4tyendra/envman/blob/main/install.sh"
        LinuxBuild[Linux Build Script]:::shell
        click LinuxBuild "https://github.com/s4tyendra/envman/blob/main/build_for_linux.zsh"
    end

    %% Relationships
    UI --> CLI
    CLI --> CMD
    CMD --> ProfileManagement
    Init --> Store
    Create --> Store
    Edit --> Store
    View --> Store
    List --> Store
    Delete --> Store
    Store --> Utils
    ProfileManagement --> ShellIntegration

    %% Legend
    subgraph Legend
        UI_Legend[User Interface]:::ui
        Core_Legend[Core Components]:::core
        Storage_Legend[Storage Components]:::storage
        Shell_Legend[Shell Integration]:::shell
    end
```
