# or-yam/clightsaber architecture

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

- Interactive diagram: https://gitdiagram.com/or-yam/clightsaber
- Repository: https://github.com/or-yam/clightsaber

## Overview

##### Main Components

A. CLI Entry Point Layer:
- `bin/clightsaber.js` as the main entry point
- That this handles command-line argument parsing

B. Core Application Layer:
- Center around `src/index.ts` as the main orchestrator
- Following modules:
- `logSaber.ts` - Lightsaber rendering logic
- `logText.ts` - Text output handling
- `texts.ts` - Static text content
- `utils.ts` - Utility functions

**[User Terminal Input] → [CLI Entry Point (bin/clightsaber.js)]**
- ↓
**[Core Application (src/index.ts)]**
- ↓
- ┌──────┴───────┐

- v             v
**[Terminal Output Display]**

##### Component Relationships

- Input/Output components (rectangles)
- Processing modules (rounded rectangles)

##### Important Elements to Highlight

A. Input Processing:
- Command-line argument handling

B. Core Logic:
- ASCII art generation
- Text formatting

C. Output Generation:
- Text rendering

##### Technical Details

- Node.js runtime environment
- TypeScript compilation flow
- NPM package distribution

##### Implementation Notes

- Hexagons for entry points
- Rectangles for core modules
- Rounded rectangles for utilities

##### Testing Layer

- A separate section showing the testing framework
- `tests/utils.test.js` to the relevant components

Remember to include:
- Version information
- Supported Node.js versions
- NPM package details
- GitHub workflow integration points

This will give other developers a clear understanding of how the tool works and how the different components interact with each other.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        UserInput[User Terminal Input]
    end

    subgraph CLI
        EntryPoint[CLI Entry Point]:::entry
    end

    subgraph Core
        MainApp[Core Application]:::core
    end

    subgraph Processing
        ColorSystem[Color System]:::util
        TextSystem[Text System]:::util
        SaberRender[Lightsaber Renderer]:::util
        Utils[Utility Functions]:::util
    end

    subgraph Configuration
        PackageConfig[Package Config]:::config
        TSConfig[TypeScript Config]:::config
    end

    subgraph Testing
        Tests[Test Suite]:::test
    end

    subgraph Documentation
        Docs[Documentation]:::docs
        IssueTemplates[Issue Templates]:::docs
    end

    subgraph CICD
        Pipeline[CI/CD Pipeline]:::cicd
    end

    subgraph Output
        TerminalOutput[Terminal Display]
    end

    UserInput --> EntryPoint
    EntryPoint --> MainApp
    MainApp --> ColorSystem
    MainApp --> TextSystem
    MainApp --> SaberRender
    MainApp --> Utils
    ColorSystem --> TerminalOutput
    TextSystem --> TerminalOutput
    SaberRender --> TerminalOutput
    Utils --> Tests

    %% Click Events
    click EntryPoint "https://github.com/or-yam/clightsaber/blob/main/bin/clightsaber.js"
    click MainApp "https://github.com/or-yam/clightsaber/blob/main/src/index.ts"
    click ColorSystem "https://github.com/or-yam/clightsaber/blob/main/src/colors.ts"
    click TextSystem "https://github.com/or-yam/clightsaber/blob/main/src/logText.ts"
    click SaberRender "https://github.com/or-yam/clightsaber/blob/main/src/logSaber.ts"
    click Utils "https://github.com/or-yam/clightsaber/blob/main/src/utils.ts"
    click Tests "https://github.com/or-yam/clightsaber/blob/main/tests/utils.test.js"
    click Pipeline "https://github.com/or-yam/clightsaber/blob/main/.github/workflows/main.yml"
    click PackageConfig "https://github.com/or-yam/clightsaber/blob/main/package.json"
    click TSConfig "https://github.com/or-yam/clightsaber/blob/main/tsconfig.json"
    click Docs "https://github.com/or-yam/clightsaber/blob/main/README.md"
    click IssueTemplates "https://github.com/or-yam/clightsaber/tree/main/.github/ISSUE_TEMPLATE"

    %% Styling
    classDef entry fill:#f9a,stroke:#333,stroke-width:2px
    classDef core fill:#9af,stroke:#333,stroke-width:2px
    classDef util fill:#af9,stroke:#333,stroke-width:2px
    classDef config fill:#ffa,stroke:#333,stroke-width:2px
    classDef test fill:#e9e,stroke:#333,stroke-width:2px
    classDef docs fill:#aaa,stroke:#333,stroke-width:2px
    classDef cicd fill:#f99,stroke:#333,stroke-width:2px
```
