# mfigurski80/ntpeek architecture

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

- Interactive diagram: https://gitdiagram.com/mfigurski80/ntpeek
- Repository: https://github.com/mfigurski80/ntpeek

## Overview

##### Main Components Identification

- Query Module (/query)
- Filter Module (/filter)
- Render Module (/render)
- Priority Module (/priority)
- Types Module (/types)

##### CLI Interface Layer
- Main entry point (main.go)
- Arguments parsing
- Environment configuration

##### Query Module
- Notion API Client
- Query Builder
- Sort Implementation

##### Filter Module
- Condition Parser
- Filter Syntax Handler
- Validation Logic

##### Render Module
- Output Formatters
- Type-specific Renderers
- Global Modifiers

##### Priority Module
- Priority Management
- Tag Processing

##### External Systems
- Notion API
- User's Terminal
- Environment Variables

- User Terminal → CLI Interface → Query Module → Notion API
- Notion API → Query Module → Filter Module → Render Module → User Terminal

- How modules depend on the Types module
- Configuration flow from environment variables

- Blue: Core processing modules (Query, Filter, Render)
- Green: External interfaces (CLI, Notion API)
- Yellow: Configuration components (Environment variables)
- Gray: Utility modules (Types)

##### Specific Elements

A. Process Flows:
##### Input Flow
- Environment Variables (NOTION_SECRET, NOTION_DEFAULT_DB) → CLI Interface
- User Commands → CLI Interface → Query Builder

##### Processing Flow
- Query Builder → Notion API Client
- Response → Filter Processing → Priority Assignment → Rendering

B. Component Details (Add as annotations):

##### Query Module
- Sort implementation
- Query building
- API client handling

##### Filter Module
- Condition syntax parsing
- Multiple filter combination (AND/OR)
- Type-specific filters

##### Render Module
- Field type renderers
- Global modifiers
- Priority-based formatting

##### Notes

Annotations for:
- Supported field types
- Available modifiers
- Filter syntax examples
- Priority configuration options

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        Terminal[User Terminal]:::external
        NotionAPI[Notion API]:::external
        EnvVars[Environment Variables]:::config
    end

    subgraph CLI
        Main[Main Entry Point]:::cli
        ArgParser[Arguments Parser]:::cli
    end

    subgraph Query
        QueryBuilder[Query Builder]:::query
        APIClient[Notion API Client]:::query
        SortImpl[Sort Implementation]:::query
        QueryArgs[Arguments Handler]:::query
    end

    subgraph Filter
        CondParser[Condition Parser]:::filter
        SyntaxHandler[Filter Syntax Handler]:::filter
        Validator[Validation Logic]:::filter
        FilterArgs[Arguments Handler]:::filter
    end

    subgraph Render
        GlobalMod[Global Modifiers]:::render
        subgraph TypeRenderers
            CheckboxRend[Checkbox Renderer]:::render
            DateRend[Date Renderer]:::render
            MultiSelectRend[MultiSelect Renderer]:::render
            NumberRend[Number Renderer]:::render
            SelectRend[Select Renderer]:::render
            TitleRend[Title Renderer]:::render
        end
        GenericRend[Generic Renderer]:::render
        PriorityRend[Priority Renderer]:::render
    end

    subgraph Priority
        PriorityMgmt[Priority Management]:::priority
        PriorityTypes[Priority Types]:::priority
        PriorityArgs[Arguments Handler]:::priority
    end

    subgraph Types
        CoreTypes[Core Types]:::types
    end

    %% Relationships
    Terminal --> Main
    EnvVars --> Main
    Main --> ArgParser
    ArgParser --> QueryBuilder
    QueryBuilder --> APIClient
    APIClient --> NotionAPI
    NotionAPI --> APIClient
    APIClient --> CondParser
    CondParser --> SyntaxHandler
    SyntaxHandler --> Validator
    Validator --> PriorityMgmt
    PriorityMgmt --> GlobalMod
    GlobalMod --> Terminal

    %% Dependencies on Types
    CoreTypes -.-> QueryBuilder
    CoreTypes -.-> CondParser
    CoreTypes -.-> GlobalMod
    CoreTypes -.-> PriorityMgmt

    %% Click Events
    click Main "https://github.com/mfigurski80/NTPeek/blob/master/main.go"
    click QueryBuilder "https://github.com/mfigurski80/NTPeek/blob/master/query/query.go"
    click APIClient "https://github.com/mfigurski80/NTPeek/blob/master/query/client.go"
    click SortImpl "https://github.com/mfigurski80/NTPeek/blob/master/query/sort.go"
    click QueryArgs "https://github.com/mfigurski80/NTPeek/blob/master/query/arguments.go"
    click CondParser "https://github.com/mfigurski80/NTPeek/blob/master/filter/conditionSyntax.go"
    click SyntaxHandler "https://github.com/mfigurski80/NTPeek/blob/master/filter/filterSyntax.go"
    click Validator "https://github.com/mfigurski80/NTPeek/blob/master/filter/validate.go"
    click FilterArgs "https://github.com/mfigurski80/NTPeek/blob/master/filter/arguments.go"
    click GlobalMod "https://github.com/mfigurski80/NTPeek/blob/master/render/globalModifiers.go"
    click CheckboxRend "https://github.com/mfigurski80/NTPeek/blob/master/render/checkbox.go"
    click DateRend "https://github.com/mfigurski80/NTPeek/blob/master/render/date.go"
    click MultiSelectRend "https://github.com/mfigurski80/NTPeek/blob/master/render/multiSelect.go"
    click NumberRend "https://github.com/mfigurski80/NTPeek/blob/master/render/renderNumber.go"
    click SelectRend "https://github.com/mfigurski80/NTPeek/blob/master/render/select.go"
    click TitleRend "https://github.com/mfigurski80/NTPeek/blob/master/render/title.go"
    click GenericRend "https://github.com/mfigurski80/NTPeek/blob/master/render/renderGeneric.go"
    click PriorityRend "https://github.com/mfigurski80/NTPeek/blob/master/render/priority.go"
    click PriorityMgmt "https://github.com/mfigurski80/NTPeek/blob/master/priority/main.go"
    click PriorityTypes "https://github.com/mfigurski80/NTPeek/blob/master/priority/types.go"
    click PriorityArgs "https://github.com/mfigurski80/NTPeek/blob/master/priority/arguments.go"
    click CoreTypes "https://github.com/mfigurski80/NTPeek/blob/master/types/main.go"

    %% Styling
    classDef external fill:#90EE90
    classDef config fill:#FFD700
    classDef cli fill:#ADD8E6
    classDef query fill:#4682B4
    classDef filter fill:#20B2AA
    classDef render fill:#9370DB
    classDef priority fill:#FF69B4
    classDef types fill:#A9A9A9
```
