# chhoumann/quickadd architecture

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

- Interactive diagram: https://gitdiagram.com/chhoumann/quickadd
- Repository: https://github.com/chhoumann/quickadd

## Overview

##### Main Components Identification
The system should be divided into these core components:

a) Core Engine Layer:
- QuickAddEngine (central coordinator)
- Choice-specific engines (Template, Capture, Macro, Multi)
- Single execution engines for individual operations

b) Choice Management Layer:
- Choice types (Template, Capture, Macro, Multi)
- Choice executors
- Macros manager

c) GUI Layer:
- Choice builders
- Generic UI components (prompts, suggesters, dialogs)
- Settings interfaces

d) AI Integration Layer:
- AI Assistant
- OpenAI integration
- Provider management

##### Relationship Structure

**[User Interface Layer]**
- ↕
**[Choice Management Layer]**
- ↕
**[Core Engine Layer]**
- ↕
**[Obsidian API]**

##### Specific Component Details

Key elements:

a) User Interface Components:
- Choice List
- Builder interfaces
- Suggesters
- Input prompts
- Settings panel

b) Choice System:
- Template processor
- Handler
- Macro executor
- Multi-choice coordinator

c) Supporting Systems:
- Formatter system
- Logger system
- Migration handler
- AI integration

##### Flow Representation

Key flows:

**User Input → Choice Selection → Choice Executor → Engine Processing → File System Operation**

##### Integration Points

Integration with:
- Obsidian API
- Template system
- File system
- OpenAI API
- Custom user scripts

##### Technical Details

- TypeScript/JavaScript execution environment
- Svelte components for UI
- Configuration management
- Error handling system
- Migration pathways

This architecture reflects a well-structured plugin system with clear separation of concerns, modular design, and extensible components, making it easier to maintain and extend the functionality.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        direction TB
        ChoiceList["Choice List"]:::ui
        BuilderInterfaces["Builder Interfaces"]:::ui
        Suggesters["Suggesters"]:::ui
        InputPrompts["Input Prompts"]:::ui
        SettingsPanel["Settings Panel"]:::ui
    end

    subgraph CM["Choice Management Layer"]
        direction TB
        ChoiceTypes{{"Choice Types"}}:::choice
        ChoiceExecutor["Choice Executor"]:::executor
        MacrosManager["Macros Manager"]:::manager
    end

    subgraph CE["Core Engine Layer"]
        direction TB
        QuickAddEngine["QuickAdd Engine"]:::core
        TemplateEngine["Template Engine"]:::engine
        CaptureEngine["Capture Engine"]:::engine
        MacroEngine["Macro Engine"]:::engine
        MultiEngine["Multi Engine"]:::engine
    end

    subgraph AI["AI Integration Layer"]
        direction TB
        AIAssistant["AI Assistant"]:::ai
        OpenAIIntegration["OpenAI Integration"]:::ai
        ProviderMgmt["Provider Management"]:::ai
    end

    subgraph SS["Supporting Systems"]
        direction TB
        Formatter["Formatter System"]:::support
        Logger["Logger System"]:::support
        Migration["Migration Handler"]:::support
        Settings["Settings Store"]:::support
    end

    ObsidianAPI["Obsidian API"]:::external

    %% Relationships
    UI --> CM
    CM --> CE
    CE --> ObsidianAPI
    CE --> AI
    SS --> CE

    %% Click Events
    click QuickAddEngine "https://github.com/chhoumann/quickadd/blob/master/src/engine/QuickAddEngine.ts"
    click TemplateEngine "https://github.com/chhoumann/quickadd/blob/master/src/engine/TemplateChoiceEngine.ts"
    click CaptureEngine "https://github.com/chhoumann/quickadd/blob/master/src/engine/CaptureChoiceEngine.ts"
    click MacroEngine "https://github.com/chhoumann/quickadd/blob/master/src/engine/MacroChoiceEngine.ts"
    click ChoiceTypes "https://github.com/chhoumann/quickadd/tree/master/src/types/choices"
    click ChoiceExecutor "https://github.com/chhoumann/quickadd/blob/master/src/choiceExecutor.ts"
    click MacrosManager "https://github.com/chhoumann/quickadd/blob/master/src/MacrosManager.ts"
    click BuilderInterfaces "https://github.com/chhoumann/quickadd/tree/master/src/gui/ChoiceBuilder"
    click Suggesters "https://github.com/chhoumann/quickadd/tree/master/src/gui/GenericSuggester"
    click InputPrompts "https://github.com/chhoumann/quickadd/tree/master/src/gui/GenericInputPrompt"
    click SettingsPanel "https://github.com/chhoumann/quickadd/blob/master/src/quickAddSettingsTab.ts"
    click ChoiceList "https://github.com/chhoumann/quickadd/tree/master/src/gui/choiceList"
    click AIAssistant "https://github.com/chhoumann/quickadd/blob/master/src/ai/AIAssistant.ts"
    click OpenAIIntegration "https://github.com/chhoumann/quickadd/blob/master/src/ai/OpenAIRequest.ts"
    click ProviderMgmt "https://github.com/chhoumann/quickadd/blob/master/src/ai/Provider.ts"
    click Formatter "https://github.com/chhoumann/quickadd/tree/master/src/formatters"
    click Logger "https://github.com/chhoumann/quickadd/tree/master/src/logger"
    click Migration "https://github.com/chhoumann/quickadd/tree/master/src/migrations"
    click Settings "https://github.com/chhoumann/quickadd/blob/master/src/settingsStore.ts"

    %% Styling
    classDef core fill:#2b6cb0
    classDef engine fill:#4299e1
    classDef ui fill:#48bb78,color:#000
    classDef choice fill:#ecc94b
    classDef executor fill:#ed8936
    classDef manager fill:#9f7aea
    classDef ai fill:#667eea
    classDef support fill:#a0aec0
    classDef external fill:#718096

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Engine Components"]:::engine
        L3["UI Elements"]:::ui
        L4["Choice Components"]:::choice
        L5["Executors"]:::executor
        L6["Managers"]:::manager
        L7["AI Components"]:::ai
        L8["Support Systems"]:::support
        L9["External Systems"]:::external
    end
```
