# gothenburgbitfactory/taskwarrior architecture

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

- Interactive diagram: https://gitdiagram.com/gothenburgbitfactory/taskwarrior
- Repository: https://github.com/gothenburgbitfactory/taskwarrior

## Overview

##### Main Components

a. Core Components:
- Task Management Engine (src/Task.cpp, src/TDB2.cpp)
- Command Line Interface (src/CLI2.cpp)
- Data Object Model (src/DOM.cpp)
- Configuration System (src/Context.cpp)
- Hook System (src/Hooks.cpp)

b. Supporting Systems:
- Database Layer (TDB2)
- Filter System (src/Filter.cpp)
- Command Processing System (src/commands/*)
- Column Display System (src/columns/*)
- Sync Infrastructure (src/commands/CmdSync.cpp)

##### Architectural Relationships

**CLI Layer → Command Processing → Task Management Engine → Database Layer**
- ↓
- Hook System
- ↓
- External Scripts/Add-ons

##### Key Design Elements

- Blue: Core components (Task Engine, DOM)
- Green: Interface components (CLI, Commands)
- Yellow: Data storage components (TDB2)
- Orange: Extension points (Hooks)
- Purple: External integrations

b. Component Types:
- Use rectangles for core modules
- Use hexagons for interface points

##### Detailed Component Breakdown

a. Task Management Core:
**Task Engine**
- Task Object Model
- Recurrence Engine
- Dependency Manager
- Urgency Calculator

b. Interface Layer:
**CLI**
- Command Parser
- Filter Processor
- Output Formatter

c. Storage Layer:
**TDB2**
- Data Storage
- GC Management
- Sync Protocol

##### Integration Points

External integration capabilities:
- Hook System connections
- Sync protocol interfaces
- -on script integration
- Theme system
- UDA (User Defined Attributes)

##### Implementation Notes

- Maintain consistent spacing and alignment
- Related components visually
- Use clear, readable labels
- Version information

This architecture reflects a well-structured command-line application with clear separation of concerns between UI, business logic, and data storage, while maintaining extensibility through a robust hook system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Components
    subgraph Core
        TaskEngine["Task Management Engine"]:::core
        DOM["Data Object Model"]:::core
        RecEngine["Recurrence Engine"]:::core
        DepManager["Dependency Manager"]:::core
        UrgCalc["Urgency Calculator"]:::core
    end

    %% Interface Layer
    subgraph Interface
        CLI["Command Line Interface"]:::interface
        CmdParser["Command Parser"]:::interface
        FilterProc["Filter Processor"]:::interface
        OutFormat["Output Formatter"]:::interface
    end

    %% Storage Layer
    subgraph Storage
        TDB2["Database Layer (TDB2)"]:::storage
        DataStore["Data Storage"]:::storage
        GCMgmt["GC Management"]:::storage
        SyncProto["Sync Protocol"]:::storage
    end

    %% Extension System
    subgraph Extensions
        HookSystem["Hook System"]:::extension
        AddOns["External Scripts/Add-ons"]:::extension
        UDA["User Defined Attributes"]:::extension
    end

    %% Command and Display Systems
    subgraph Processing
        CmdSystem["Command Processing System"]:::processing
        ColSystem["Column Display System"]:::processing
        ConfigSystem["Configuration System"]:::processing
    end

    %% Relationships
    CLI --> CmdParser
    CmdParser --> CmdSystem
    CmdSystem --> TaskEngine
    TaskEngine --> DOM
    DOM --> TDB2
    TaskEngine --> RecEngine
    TaskEngine --> DepManager
    TaskEngine --> UrgCalc
    CmdSystem --> HookSystem
    HookSystem --> AddOns
    FilterProc --> TaskEngine
    CLI --> OutFormat
    OutFormat --> ColSystem
    TDB2 --> DataStore
    TDB2 --> GCMgmt
    TDB2 --> SyncProto
    ConfigSystem --> TaskEngine
    ConfigSystem --> CLI
    TaskEngine --> UDA

    %% Click Events
    click TaskEngine "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/Task.cpp"
    click CLI "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/CLI2.cpp"
    click DOM "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/DOM.cpp"
    click ConfigSystem "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/Context.cpp"
    click HookSystem "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/Hooks.cpp"
    click TDB2 "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/TDB2.cpp"
    click FilterProc "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/Filter.cpp"
    click CmdSystem "https://github.com/gothenburgbitfactory/taskwarrior/tree/develop/src/commands"
    click ColSystem "https://github.com/gothenburgbitfactory/taskwarrior/tree/develop/src/columns"
    click SyncProto "https://github.com/gothenburgbitfactory/taskwarrior/blob/develop/src/commands/CmdSync.cpp"

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef interface fill:#4CAF50,stroke:#2E7D32,color:white
    classDef storage fill:#FFC107,stroke:#FFA000,color:black
    classDef extension fill:#FF9800,stroke:#F57C00,color:white
    classDef processing fill:#9C27B0,stroke:#7B1FA2,color:white

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        InterfaceComp["Interface Component"]:::interface
        StorageComp["Storage Component"]:::storage
        ExtensionComp["Extension Component"]:::extension
        ProcessingComp["Processing Component"]:::processing
    end
```
