# forloopcodes/unvibe architecture

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

- Interactive diagram: https://gitdiagram.com/forloopcodes/unvibe
- Repository: https://github.com/forloopcodes/unvibe

## Overview

##### Project type and purpose
- This is a Node.js-based command-line interface (CLI) application (“AI File Assistant”) that orchestrates AI-powered file operations, terminal commands, error checking, and a memory/history system.
- It integrates with multiple external AI providers (Ollama, Google Gemini, Mistral, OpenAI, Anthropic) to process user requests.

##### File structure
- Top-level:
- index.js – the single entry point for CLI logic and orchestration
- package.json / package-lock.json – dependency management and scripts
- README.md / .gitignore
- No subdirectories; modules and services are implemented within index.js or required files.

##### Extract architectural clues from the README
- Core features: provider adapter support, secure key entry, retry/error logic, memory/history, file I/O, terminal execution.
- Interaction modes: Agent, Chat, Command—each driving different internal flows.
- Providers are pluggable via a strategy/adapter pattern.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    User["User"]:::external
    User -->|"stdin"| CLI

    %% CLI Layer
    subgraph "CLI Layer"
        CLI["CLI Interface"]:::internal
    end
    click CLI "https://github.com/forloopcodes/unvibe/blob/main/index.js"

    %% Parsing Layer
    subgraph "Parsing Layer"
        Parser["Command Parser & Mode Selector"]:::internal
    end
    click Parser "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    CLI -->|"parse input"| Parser

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        FileMgr["File Operation Manager"]:::internal
        ShellExec["Terminal Command Executor"]:::internal
        Validator["Syntax Validator & Error Checker"]:::internal
    end
    click FileMgr "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    click ShellExec "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    click Validator "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    Parser -->|"select mode"| FileMgr
    Parser -->|"select mode"| ShellExec
    FileMgr -->|"validate"| Validator
    ShellExec -->|"validate"| Validator

    %% Provider Adapter Layer
    subgraph "Provider Adapter Layer"
        OllamaAdapter["Ollama Adapter"]:::internal
        GoogleAdapter["Google Gemini Adapter"]:::internal
        MistralAdapter["Mistral Adapter"]:::internal
        OpenAIAdapter["OpenAI Adapter"]:::internal
        AnthropicAdapter["Anthropic Adapter"]:::internal
    end
    click OllamaAdapter "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    click GoogleAdapter "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    click MistralAdapter "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    click OpenAIAdapter "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    click AnthropicAdapter "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    Validator -->|"prepare request"| OllamaAdapter
    Validator -->|"prepare request"| GoogleAdapter
    Validator -->|"prepare request"| MistralAdapter
    Validator -->|"prepare request"| OpenAIAdapter
    Validator -->|"prepare request"| AnthropicAdapter

    %% External AI Providers
    subgraph "External AI Providers"
        Ollama["Ollama"]:::external
        Google["Google Gemini"]:::external
        Mistral["Mistral"]:::external
        OpenAI["OpenAI"]:::external
        Anthropic["Anthropic"]:::external
    end
    OllamaAdapter -->|"local API call"| Ollama
    GoogleAdapter -->|"HTTP call"| Google
    MistralAdapter -->|"HTTP call"| Mistral
    OpenAIAdapter -->|"HTTP call"| OpenAI
    AnthropicAdapter -->|"HTTP call"| Anthropic

    %% Storage & Shell
    subgraph "System I/O"
        FS["File System"]:::os
        Shell["OS Shell"]:::os
        Memory["Memory & History Store"]:::store
    end
    click Memory "https://github.com/forloopcodes/unvibe/blob/main/index.js"
    FileMgr -->|"fs operations"| FS
    ShellExec -->|"shell commands"| Shell
    FileMgr -->|"record operation"| Memory
    ShellExec -->|"record operation"| Memory
    OllamaAdapter -->|"log request"| Memory
    GoogleAdapter -->|"log request"| Memory
    MistralAdapter -->|"log request"| Memory
    OpenAIAdapter -->|"log request"| Memory
    AnthropicAdapter -->|"log request"| Memory

    %% Output to User
    FileMgr -->|"results"| CLI
    ShellExec -->|"results"| CLI
    Validator -->|"errors"| CLI
    CLI -->|"stdout"| User

    %% Config and Docs
    subgraph "Project Files"
        Config["package.json"]:::config
        Docs["README.md"]:::docs
        Ignore[".gitignore"]:::ignore
    end
    click Config "https://github.com/forloopcodes/unvibe/blob/main/package.json"
    click Docs "https://github.com/forloopcodes/unvibe/blob/main/README.md"
    click Ignore "https://github.com/forloopcodes/unvibe/blob/main/.gitignore"

    %% Legend
    subgraph Legend
        I["Internal Modules"]:::internal
        E["External Services"]:::external
        S["Storage"]:::store
        O["OS/FS"]:::os
    end

    %% Styles
    classDef internal fill:#D0E6FF,stroke:#2E6FB6,stroke-width:1px
    classDef external fill:#DFFFE0,stroke:#2E7D32,stroke-width:1px
    classDef store fill:#FFE8B3,stroke:#FF8C00,stroke-width:1px
    classDef os fill:#E0E0E0,stroke:#757575,stroke-width:1px
    classDef config fill:#FCE4EC,stroke:#C2185B,stroke-width:1px
    classDef docs fill:#E8EAF6,stroke:#3949AB,stroke-width:1px
    classDef ignore fill:#F3E5F5,stroke:#6A1B9A,stroke-width:1px
```
