# poetaman/arttime architecture

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

- Interactive diagram: https://gitdiagram.com/poetaman/arttime
- Repository: https://github.com/poetaman/arttime

## Overview

##### Project type and purpose
- ArtTime is an open-source, terminal-based time manager & text-art display tool written in Zsh.
- It bundles two executables (`arttime`, `artprint`), a library of text-art assets, shell scripts, man pages, and zsh completion functions.
- It interacts with the OS for notifications, sounds, and reads/writes to the filesystem.

##### Main components
a. Executables
- `bin/arttime` (main CLI application)
- `bin/artprint` (standalone art­printing helper)
b. Core Logic
- `share/arttime/src/arttime.zsh` (Zsh script implementing timers, art selection, input modes)
c. Assets & Data
- `share/arttime/textart/…` (500+ ASCII/ANSI art files)
- `share/arttime/keypoems/…` (preconfigured timer patterns & messages)
- History store (user’s `~/.local/share/arttime/history`)
d. Documentation
- Man pages (`share/man/man1/*.gz`, `share/arttime/doc/*.txt/.ans`)
- README, wiki links
e. Shell Integrations
- Zsh completion functions (`share/zsh/functions/_arttime`, `_artprint`)
f. Installer
- `install.sh` (installs scripts, assets into `~/.local`)
g. OS Services
- Desktop notifications (e.g., `osascript` on macOS, `notify-send` on Linux)
- Sound playback (PulseAudio/PipeWire native or `ogg123` fallback)
h. External feeder programs
- Any external process, pipe, or file feeding keystrokes into ArtTime

##### Relationships and interactions
- User → (invokes) → `arttime` / `artprint` via terminal emulator
- `arttime.zsh`:
- Reads assets from filesystem (textart, keypoems)
- Reads/writes history files
- Handles interactive input and keybindings (via Zsh’s line editor)
- Triggers OS notifications & sound services
- Interfaces with optional tools (e.g., `fzf` for art selection)
- Accepts piped/redirected input from external feeders
- Shell:
- Executes zsh scripts, provides completion via functions
- OS Services:
- Notification daemon ← `arttime`
- Sound server ← `arttime`
- Installer:
- Places executables in `~/.local/bin`
- Copies assets to `~/.local/share/arttime`
- Registers completions in `share/zsh/functions`

##### Architectural patterns & design principles
- Unix philosophy: small, composable scripts + external utilities
- File-based asset repository (no database)
- Shell-centric modularity (core logic separate from assets)
- Plugin-style extensibility: new art or timer patterns simply become files in the asset directories
- Cross-platform abstraction over notifications & sounds

##### Technologies & frameworks
- Primary language: Zsh
- Shell utilities: `curl`, `wget`, `fzf` (optional), `notify-send` / `osascript`, `ogg123`
- Asset formats: plain text, ANSI, PETSCII, Unicode
- Installation: POSIX filesystem, symlinks (`/etc/localtime`), standard user directories (`~/.local/bin`, `~/.local/share`)
- Packaging: .deb, Homebrew, macOS installer script, Docker container

##### Essential elements
- Component labels (e.g., “ArtTime CLI”, “Text-Art Asset Store”)
- Input flow (user & feeder → CLI)
- Data flow (CLI ↔ FS)
- Service calls (CLI → Notification daemon, CLI → Sound server)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Actors
    User["User"]:::ext
    Terminal["Terminal Emulator"]:::script
    User --> Terminal

    %% Runtime
    subgraph "Runtime"
        Zsh["Zsh Runtime"]:::script
    end
    Terminal --> Zsh

    %% Executables
    ArtTimeCLI["ArtTime CLI Executable"]:::exe
    ArtPrintCLI["ArtPrint Helper Executable"]:::exe
    Zsh --> ArtTimeCLI
    Zsh --> ArtPrintCLI

    %% Core Logic
    CoreLogic["Core Logic Script"]:::script
    ArtTimeCLI --> CoreLogic
    click CoreLogic "https://github.com/poetaman/arttime/blob/main/share/arttime/src/arttime.zsh"

    %% Assets & Data
    subgraph "Assets & Data"
        TA["Text-Art Asset Store"]:::asset
        KP["Preconfigured Timer Patterns & Messages"]:::asset
        HS["History Store (~/.local/share/arttime/history)"]:::asset
    end
    CoreLogic --> TA
    CoreLogic --> KP
    CoreLogic -.->|"reads/writes"| HS
    click TA "https://github.com/poetaman/arttime/tree/main/share/arttime/textart/"
    click KP "https://github.com/poetaman/arttime/tree/main/share/arttime/keypoems/"

    %% Shell Integrations & Documentation
    subgraph "Shell Integrations & Documentation"
        ZSHComp["Zsh Completion Functions"]:::shell
        ManPages["Man Pages"]:::docs
        DocFiles["In-Project Documentation"]:::docs
        Readme["README.md"]:::docs
    end
    ArtTimeCLI --> ZSHComp
    ArtPrintCLI --> ZSHComp
    click ZSHComp "https://github.com/poetaman/arttime/tree/main/share/zsh/functions/_arttime"
    click ZSHComp "https://github.com/poetaman/arttime/tree/main/share/zsh/functions/_artprint"
    ArtTimeCLI --> ManPages
    ArtPrintCLI --> ManPages
    click ManPages "https://github.com/poetaman/arttime/blob/main/share/man/man1/arttime.1.gz"
    click ManPages "https://github.com/poetaman/arttime/blob/main/share/man/man1/artprint.1.gz"
    ArtTimeCLI --> DocFiles
    ArtPrintCLI --> DocFiles
    click DocFiles "https://github.com/poetaman/arttime/blob/main/share/arttime/doc/arttime.1.txt"
    click DocFiles "https://github.com/poetaman/arttime/blob/main/share/arttime/doc/arttime.1.ans"
    click DocFiles "https://github.com/poetaman/arttime/blob/main/share/arttime/doc/artprint.1.txt"
    click DocFiles "https://github.com/poetaman/arttime/blob/main/share/arttime/doc/artprint.1.ans"
    ArtTimeCLI --> Readme
    ArtPrintCLI --> Readme
    click Readme "https://github.com/poetaman/arttime/blob/main/README.md"

    %% OS Services
    subgraph "OS Services"
        Notif["Notification Daemon"]:::os
        Sound["Sound Server"]:::os
    end
    CoreLogic --> Notif
    CoreLogic --> Sound

    %% External Feeder
    Feeder["External Feeder"]:::ext
    Feeder --> ArtTimeCLI
    Feeder --> ArtPrintCLI

    %% Installer
    Install["Installer Script"]:::script
    Install -.-> ArtTimeCLI
    Install -.-> ArtPrintCLI
    Install -.-> TA
    Install -.-> KP
    Install -.-> ZSHComp
    click Install "https://github.com/poetaman/arttime/blob/main/install.sh"

    %% Styles
    classDef exe fill:#002266,stroke:#000,color:#fff;
    classDef script fill:#004488,stroke:#000,color:#fff;
    classDef asset fill:#228822,stroke:#000,color:#fff;
    classDef os fill:#e67e22,stroke:#000,color:#fff;
    classDef ext fill:#8e44ad,stroke:#000,color:#fff;
    classDef docs fill:#27ae60,stroke:#000,color:#fff;
    classDef shell fill:#2980b9,stroke:#000,color:#fff;
```
