# jammutkarsh/pms architecture

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

- Interactive diagram: https://gitdiagram.com/jammutkarsh/pms
- Repository: https://github.com/jammutkarsh/pms

## Overview

##### Main components of the system
- Main Application Entry: The main.go file serves as the entry point to the application.
- Command Handlers: Under the “cmd” directory, you have multiple command files (e.g., root.go, add.go) that define the CLI commands and how they are parsed and executed.
- TUI Layer: The TUI functionality (for interactive project search and selection) is integrated within the same command-driven structure (as indicated by the README’s “TUI” section), likely routed through the root and associated commands.
- Utility Functions: The “utils” directory contains supporting functionality such as configuration handling (in config.go) and TUI enhancements (in charm.go). These helpers encapsulate behaviors and manage settings such as the default editor.

##### Relationships and interactions
- User Interaction: The user interacts via the terminal, either by executing commands (e.g., “pms add [dir]”) or by engaging with the TUI.
- From main.go, the application initializes the command routing (probably invoking a CLI framework) that defers control to the subcommands (like add).
- The “cmd” directory acts as the command dispatcher: when a command is recognized it calls the corresponding business logic.
- Utility modules are used for tasks such as reading/writing configuration and applying TUI charm (likely for styling or interacting with the terminal UI).
- The configuration layer ensures that any project settings (especially the default editor) are correctly applied throughout the application.

##### Recognize important architectural patterns and design principles
- Command Pattern: The separation of command handlers (cmd/add.go, cmd/root.go) implements a command pattern, which is common in CLI applications.
- Separation of Concerns: Functionality is divided between application initialization, command routing, TUI interaction, and utility operations.
- Modularity: By isolating TUI helpers and configuration management in a “utils” package, the design allows for easier testing and future modifications.

##### Specific technologies, frameworks, or libraries
- Language: Go (as indicated by go.mod, go.sum, and Go source files).
- TUI: The project likely uses a TUI library (possibly from “charm”, as hinted by utils/charm.go) to manage terminal UI.
- CLI handling: The structure with a “cmd” directory and subcommands suggests the use of a CLI framework (like Cobra or similar) for command parsing and dispatching.

##### Be detailed
- Each component should be individually represented.
- Even if the project is relatively small, emphasize the separation between command routing, TUI logic, and utility functions.
- That any assumptions (e.g., the use of a specific CLI or TUI library) are clearly noted.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User Input"]:::user
    A["PMS Main Application (main.go)"]:::core
    B["Command Dispatcher (cmd/)"]:::core
    B1["Root Command Handler (cmd/root.go)"]:::core
    B2["Add Command Handler (cmd/add.go)"]:::core
    C["TUI Component"]:::ui
    D1["Configuration Handler (utils/config.go)"]:::utils
    D2["TUI Enhancers (utils/charm.go)"]:::utils
    E["Design Decisions (DesignDecisions.md)"]:::doc

    User -->|"executes"| A
    A -->|"initializes"| B
    B -->|"routes_to"| B1
    B -->|"routes_to"| B2
    B1 -->|"invokes_TUI"| C
    B1 -->|"retrieves_config"| D1
    B2 -->|"retrieves_config"| D1
    C -->|"applies_enhancements"| D2
    A -->|"guides_architecture"| E

    click A "https://github.com/jammutkarsh/pms/blob/main/main.go"
    click B1 "https://github.com/jammutkarsh/pms/blob/main/cmd/root.go"
    click B2 "https://github.com/jammutkarsh/pms/blob/main/cmd/add.go"
    click C "https://github.com/jammutkarsh/pms/blob/main/utils/charm.go"
    click D1 "https://github.com/jammutkarsh/pms/blob/main/utils/config.go"
    click E "https://github.com/jammutkarsh/pms/blob/main/DesignDecisions.md"

    classDef core fill:#b3cde0,stroke:#03396c,stroke-width:2px;
    classDef ui fill:#ccebc5,stroke:#006400,stroke-width:2px;
    classDef utils fill:#decbe4,stroke:#7b4173,stroke-width:2px;
    classDef doc fill:#fed9a6,stroke:#ff8c00,stroke-width:2px;
    classDef user fill:#ffff99,stroke:#ffcc00,stroke-width:2px;
```
