# k0p1-git/ip architecture

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

- Interactive diagram: https://gitdiagram.com/k0p1-git/ip
- Repository: https://github.com/k0p1-git/ip

## Overview

##### Project type and purpose
- This is a standalone Java command-line application (an open-source CLI tool) called ChattyBot.
- Purpose: Accept user commands via a text UI, parse them into “task” operations (todo, deadline, event), store tasks persistently in a local file, and display results back to the user.

##### File structure
- Top-level build: Gradle (build.gradle, gradlew, gradle/).
- Source packages under src/main/java/chatty:
- app: entry point ChattyBot.java
- ui: Ui.java handles I/O with the console
- parser: Parser.java converts raw text to command objects
- storage: Storage.java loads/saves a file on disk
- task: Task, Todo, Deadline, Event, TaskList
- exceptions: custom exception hierarchy for invalid input, I/O, unknown commands
- Tests mirror parser and task functionality under src/test/java/chatty.

##### README for additional insights
- No database or network calls—persistence is file-based.

##### Detailed capture of essential elements
- Entry point ChattyBot.java and note its orchestration role.
- Exception channels (e.g., malformed input triggers EmptyDescriptionException → Ui prints error).
- Persistence on startup/shutdown: Storage.load → TaskList, then on every add/delete: Storage.save.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    User["User (Console)"]:::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        ChattyBot["ChattyBot (Entry Point)"]:::app
        Ui["Ui"]:::ui
    end

    %% Parser Layer
    subgraph "Parser Layer"
        Parser["Parser"]:::parser
    end

    %% Domain Layer
    subgraph "Domain Layer"
        TaskList["TaskList"]:::domain
        Task["Task (Base Class)"]:::domain
        Todo["Todo"]:::domain
        Deadline["Deadline"]:::domain
        Event["Event"]:::domain
    end

    %% Storage Layer
    subgraph "Storage Layer"
        Storage["Storage"]:::storage
    end

    %% External File System
    FileSystem["File System\n(tasks.txt)"]:::external

    %% Exceptions
    subgraph "Exception Hierarchy"
        ChattyException["ChattyException"]:::exceptions
        ChattyFileException["ChattyFileException"]:::exceptions
        EmptyDescriptionException["EmptyDescriptionException"]:::exceptions
        MalformedArgumentsException["MalformedArgumentsException"]:::exceptions
        UnknownCommandException["UnknownCommandException"]:::exceptions
    end

    %% Tests
    subgraph "Tests"
        ParserTest["ParserTest"]:::test
        TaskListTest["TaskListTest"]:::test
        ExpectedTxt["EXPECTED.TXT"]:::external
    end

    %% Data Flows
    User --> Ui
    Ui -->|"reads input"| ChattyBot
    ChattyBot -->|"initializes"| Storage
    Storage -->|"load()"| TaskList
    ChattyBot -->|"passes command"| Ui
    Ui -->|"raw text"| Parser
    Parser -->|"parses to command"| TaskList
    TaskList -->|"mutates tasks"| Storage
    Storage -->|"write()"| FileSystem
    TaskList -->|"results"| Ui
    Ui --> User

    %% Exception Flows
    Parser -->|throws| UnknownCommandException
    Parser -->|throws| MalformedArgumentsException
    TaskList -->|throws| EmptyDescriptionException
    Storage -->|throws| ChattyFileException
    AnyException["Any Component"] -.->|extends| ChattyException

    %% Test Relationships
    ParserTest --> Parser
    TaskListTest --> TaskList
    ParserTest --> ExpectedTxt
    TaskListTest --> ExpectedTxt

    %% Click Events
    click ChattyBot "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/app/ChattyBot.java"
    click Ui "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/ui/Ui.java"
    click Parser "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/parser/Parser.java"
    click Storage "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/storage/Storage.java"
    click TaskList "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/task/TaskList.java"
    click Task "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/task/Task.java"
    click Todo "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/task/Todo.java"
    click Deadline "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/task/Deadline.java"
    click Event "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/task/Event.java"
    click ChattyException "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/exceptions/ChattyException.java"
    click ChattyFileException "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/exceptions/ChattyFileException.java"
    click EmptyDescriptionException "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/exceptions/EmptyDescriptionException.java"
    click MalformedArgumentsException "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/exceptions/MalformedArgumentsException.java"
    click UnknownCommandException "https://github.com/k0p1-git/ip/blob/master/src/main/java/chatty/exceptions/UnknownCommandException.java"
    click ParserTest "https://github.com/k0p1-git/ip/blob/master/src/test/java/chatty/parser/ParserTest.java"
    click TaskListTest "https://github.com/k0p1-git/ip/blob/master/src/test/java/chatty/task/TaskListTest.java"
    click ExpectedTxt "https://github.com/k0p1-git/ip/blob/master/text-ui-test/EXPECTED.TXT"

    %% Styles
    classDef app fill:#a8dadc,stroke:#1d3557,color:#1d3557;
    classDef ui fill:#457b9d,stroke:#1d3557,color:#ececec;
    classDef parser fill:#8ecae6,stroke:#1d3557,color:#1d3557;
    classDef domain fill:#a5d6a7,stroke:#1d3557,color:#1d3557;
    classDef storage fill:#f4a261,stroke:#1d3557,color:#1d3557;
    classDef external fill:#cccccc,stroke:#666666,color:#1d3557;
    classDef exceptions fill:#e76f51,stroke:#1d3557,color:#ffffff;
    classDef test fill:#b18904,stroke:#1d3557,color:#ffffff;
```
