# kingparks/cursor-vip architecture

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

- Interactive diagram: https://gitdiagram.com/kingparks/cursor-vip
- Repository: https://github.com/kingparks/cursor-vip

## Overview

##### Main Components
- Entry Point: Highlight main.go as the entry point of the application.
- Terminal User Interface (TUI): Represent the “tui” module which includes several subcomponents:
– client (tui/client): Handles interactions with the ‘cursor’ editor backend.
– locales (tui/locales): Contains internationalization/international language support files.
– params (tui/params): Manages configuration parameters and variable definitions.
– shortcut (tui/shortcut): Deals with key bindings or shortcut management.
– tool (tui/tool): Contains OS-specific proxy setting implementations (with separate files for Linux, macOS, and Windows).
– tui.go: Likely the central UI orchestration logic.
- Build & Deployment: The “build” folder (with scripts such as i.sh, ic.sh, and install.sh) serves to automate the installation and deployment process.
- Documentation: The “docs” folder outlines additional user guides, FAQ, and specific use cases like proxy mode and custom models.
- Configuration: Indicate that user configuration is managed via a JSON file (~/.cursor-viprc) which the program reads at runtime.

##### Relationships and Interactions
- Flow from main.go (Entry Point) into the TUI layer, which directs user interactions.
- The TUI uses the locales for multilingual support, ensuring that users see proper language-specific messages.
- The params and shortcut packages serve to configure and facilitate user input and operational behavior.
- The tool package abstracts platform-specific details for proxy management (with separate implementations per OS) which may be activated depending on the current mode.
- Build scripts interface externally (as a deployment layer) that packages and installs the binary, tying into OS-level deployment aspects.
- External Interaction: Although the README mentions integration with the official CURSOR code editor (by virtue of its functionality and promotion guidelines), this external dependency should also be noted—even if it is not directly operated by the tool.

##### Architectural Patterns and Design Principles
- Modularity: The project is split into distinct packages (client, locales, params, shortcut, tool) to separate concerns.
- Cross-Platform Handling: OS-specific implementations for setting the proxy (within tui/tool) that highlight platform abstraction.
- Configurability: The dynamic configuration using a JSON file ensures that behavior can be altered without recompilation.
- Extensibility for Localization: The locales directory demonstrates an extensible design for adding further language supports.

##### Incorporate Technologies and Frameworks
- Go (as seen from go.mod, go.sum, and main.go) as the core technology.
- Shell/Bash scripting used in the build/ directory for installation and setup.
- JSON configuration file for user settings.
- External binary releases (referenced in the README) for distribution on supported OS’s.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Application"
        A["Main Entry (main.go)"]:::module
        B["TUI Module (tui/tui.go)"]:::module
    end

    subgraph "TUI Subcomponents"
        C["Client (tui/client)"]:::module
        D["Locales (tui/locales)"]:::module
        E["Params (tui/params)"]:::module
        F["Shortcut (tui/shortcut)"]:::module
        G["Tool (tui/tool)"]:::module
    end

    H["Configuration (~/.cursor-viprc JSON)"]:::config
    I["Build & Deployment Scripts (build)"]:::build
    J["Documentation & User Guides (docs)"]:::doc
    K["External: CURSOR Code Editor"]:::external

    %% Relationships among components
    A -->|"start"| B
    B -->|"uses"| C
    B -->|"uses"| D
    B -->|"uses"| E
    B -->|"uses"| F
    B -->|"uses"| G

    A ---|"reads"| H
    H -->|"configures"| E
    H -->|"configures"| G

    I ---|"deploys"| A
    J ---|"supports"| A

    B ---|"integrates with"| K

    %% Click Events
    click A "https://github.com/kingparks/cursor-vip/blob/main/main.go"
    click B "https://github.com/kingparks/cursor-vip/blob/main/tui/tui.go"
    click C "https://github.com/kingparks/cursor-vip/blob/main/tui/client/client.go"
    click D "https://github.com/kingparks/cursor-vip/tree/main/tui/locales"
    click E "https://github.com/kingparks/cursor-vip/tree/main/tui/params"
    click F "https://github.com/kingparks/cursor-vip/blob/main/tui/shortcut/shortcut.go"
    click G "https://github.com/kingparks/cursor-vip/tree/main/tui/tool"
    click I "https://github.com/kingparks/cursor-vip/tree/main/build"
    click J "https://github.com/kingparks/cursor-vip/tree/main/docs"

    %% Styling classes
    classDef module fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef config fill:#c8e6c9,stroke:#1b5e20,stroke-width:2px;
    classDef build fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef doc fill:#d1c4e9,stroke:#512da8,stroke-width:2px;
    classDef external fill:#ffccbc,stroke:#bf360c,stroke-width:2px,stroke-dasharray: 5, 5;
```
