# nikolaeu/numi architecture

> Architecture diagram of the GitHub repository nikolaeu/numi, 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/nikolaeu/numi
- Repository: https://github.com/nikolaeu/numi

## Overview

##### Main Components
- Core Calculation Engine: This is the central module that parses natural language inputs and computes results. It is likely embedded within both the terminal CLI implementation and the desktop app.
- Command-Line Interface (CLI): The terminal version (numi-cli) that processes user-provided expressions like “20 inches in cm”.
- Desktop App Interface: Although the desktop version is packaged separately, its integration and dependency on the core engine should be represented.
- Alfred Workflow Extension: The “alfred” directory contains files (index.js, info.plist, and Packal configuration) for integration with Alfred on macOS. This component should be shown as a separate integration point connected to the core engine.
- Plugins/Extensions System: Under the “plugins” directory, especially within “plugins/CommunityExtensions”, there are many independent modules (such as BasicCombinatorics, ChangeMoneyCAD, DataRates, etc.) that provide additional functionalities. These should be depicted as extendable modules or plug-in components interacting with the core engine.

##### Relationships and Interactions
- Input Processing Layer: All interfaces route input to the core engine where the natural language parsing and calculation occur.
- External Dependencies and Data: If applicable (for example, external conversion rates or localization services), these should be depicted though they are not heavily emphasized in the README or file structure.

##### Important Architectural Patterns
- Modular/Plugin-Based Architecture: Emphasize that the project is designed to be extended via plugins. Each plugin is an independent module that can be added or updated without altering the core calculation engine.
- Separation of Concerns: Clearly separate the different interfaces (CLI, Alfred, desktop) from the core computation logic.
- Integration with macOS-specific Ecosystem: Show how the Alfred workflow and potential desktop packaging (with its separate configuration files like “info.plist” and the Packal package.xml) integrate with the larger system.

##### Incorporate Relevant Technologies, Frameworks, or Libraries
- JavaScript/Node.js: Given the use of .js files across the core and plugins, and the index.js in the Alfred directory, note that Node.js is likely the runtime.
- macOS-Specific Components: The presence of configuration files (info.plist, package.xml) implies integration points specific to macOS systems.
- Package/Plugin Management: Although not explicitly detailed, the directory structure of plugins indicates that plugin discovery and dynamic loading are central, and that should be illustrated.

##### Final Assembly
- Detail: Include any intermediary modules that might be inferred (e.g., a “Plugin Manager” inside the core engine if one exists, even if not explicitly visible in the file tree).

## Diagram (Mermaid)

```mermaid
graph TD
    User["User Input"]:::user

    subgraph "User Interfaces"
        CLI["CLI Interface"]:::interface
        Desktop["Desktop App Interface"]:::interface
        Alfred["Alfred Workflow Extension"]:::interface
    end

    Engine["Core Calculation Engine"]:::engine
    Plugins["Plugins/CommunityExtensions"]:::plugin

    User -->|"input"| CLI
    User -->|"input"| Desktop
    User -->|"input"| Alfred

    CLI -->|"sends_expression"| Engine
    Desktop -->|"sends_expression"| Engine
    Alfred -->|"sends_expression"| Engine

    Engine -->|"invokes_plugins"| Plugins

    click Engine "https://github.com/nikolaeu/numi/blob/master/sample.js"
    click CLI "https://github.com/nikolaeu/numi/blob/master/sample.js"
    click Alfred "https://github.com/nikolaeu/numi/tree/master/alfred"
    click Plugins "https://github.com/nikolaeu/numi/tree/master/plugins/CommunityExtensions"

    classDef user fill:#aee1f9,stroke:#333,stroke-width:2px;
    classDef interface fill:#f4d03f,stroke:#333,stroke-width:2px;
    classDef engine fill:#82e0aa,stroke:#333,stroke-width:2px;
    classDef plugin fill:#d2b4de,stroke:#333,stroke-width:2px;
```
