# timothebot/lacy architecture

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

- Interactive diagram: https://gitdiagram.com/timothebot/lacy
- Repository: https://github.com/timothebot/lacy

## Overview

##### Main Components

A. Core Components:
- Command Parser (src/cmd.rs)
- Query Engine (src/query.rs)
- Shell Integration (src/init.rs)
- User Interface (src/ui.rs)
- Main Program Flow (src/main.rs)

B. External Interactions:
- Shell Environment
- File System
- User Input/Output

**┌─ User/Shell Layer ─────────────────────┐**

- Shell Environment                     │
- (zsh integration)                     │

- Application Layer ────────────────────┤

- ┌─ Command Parser ─┐  ┌─ UI Layer ─┐  │

- Path Analysis   │──▶  Display   │  │
- Arg Processing  │  │  Output    │  │
- ┘  └────────────┘  │

- ┌─ Query Engine ──┐                   │

- Path Matching   │                   │
- Fuzzy Search    │                   │
- ┘                   │

- System Layer ──────────────────────────┤

- File System Access                    │

- ┘

##### Key Interactions to Highlight

a. Input Flow:
- User input → Shell → Command Parser
- Command Parser → Query Engine
- Query Engine → File System
- Query Engine → UI Layer → User Output

b. Integration Flow:
- Shell initialization (init.rs) → Shell Environment
- Command processing (cmd.rs) → Query Engine (query.rs)
- Result presentation (ui.rs) → Shell

##### Implementation Details

- Rust-based implementation
- Shell script integration
- File system interaction points
- Command-line interface

##### The file system interaction layer

**Input: "y / user timo - lacy sr"**
**↓**
**Processed: "/Users/timothebot/*/lacy/src"**
**↓**
**Final: "/Users/timothebot/projects/lacy/src"**

This will help viewers quickly understand the tool's main feature.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef shell fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef system fill:#FFB347,stroke:#333
    classDef example fill:#f9f9f9,stroke:#333,stroke-dasharray: 5 5

    %% User/Shell Layer
    subgraph ShellLayer["User/Shell Layer"]
        ShellEnv["Shell Environment"]
        ShellInt["Shell Integration"]
        UserIO["User Input/Output"]
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        MainFlow["Main Program Flow"]:::core
        CmdParser["Command Parser"]:::core
        QueryEngine["Query Engine"]:::core
        UI["User Interface"]:::core
    end

    %% System Layer
    subgraph SysLayer["System Layer"]
        FileSystem["File System Access"]:::system
    end

    %% Example Box
    subgraph Example["Path Transformation Example"]
        Input["Input: y / user timo - lacy sr"]:::example
        Processed["Processed: /Users/timothebot/*/lacy/src"]:::example
        Final["Final: /Users/timothebot/projects/lacy/src"]:::example
    end

    %% Relationships
    UserIO --> ShellInt
    ShellInt --> MainFlow
    MainFlow --> CmdParser
    CmdParser --> QueryEngine
    QueryEngine --> UI
    QueryEngine --> FileSystem
    UI --> UserIO
    Input --> Processed
    Processed --> Final

    %% Legend
    subgraph Legend["Legend"]
        L1["Shell Component"]:::shell
        L2["Core Component"]:::core
        L3["System Component"]:::system
    end

    %% Click Events
    click CmdParser "https://github.com/timothebot/lacy/blob/main/src/cmd.rs"
    click QueryEngine "https://github.com/timothebot/lacy/blob/main/src/query.rs"
    click ShellInt "https://github.com/timothebot/lacy/blob/main/src/init.rs"
    click UI "https://github.com/timothebot/lacy/blob/main/src/ui.rs"
    click MainFlow "https://github.com/timothebot/lacy/blob/main/src/main.rs"

    %% Style Applications
    class ShellEnv,ShellInt,UserIO shell
    class MainFlow,CmdParser,QueryEngine,UI core
    class FileSystem system
```
