# whispin/cursor_windsurf_reset architecture

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

- Interactive diagram: https://gitdiagram.com/whispin/cursor_windsurf_reset
- Repository: https://github.com/whispin/cursor_windsurf_reset

## Overview

##### Project type and purpose
- This is a cross-platform desktop utility written in Go (Golang).
- It provides both a modern GUI (built with Fyne) and a command-line interface for “smart reset” of Cursor and Windsurf apps: detecting installations, backing up data, clearing caches/session data, and restoring if needed.

##### File structure
- Top level:
- main.go – application entry point (initializes CLI or GUI)
- version/ – version-check logic
- config/ – configuration loader and manager
- cleaner/ – core engine for detection and reset (with OS-specific code)
- gui/ – Fyne-based GUI modules (app setup, themes, embedded resources)
- i18n/ – internationalization (JSON resources + embed code)
- screenshot/ – UI illustration (not part of runtime)
- Build/deploy: go.mod, go.sum, .github/workflows/release.yml, .gitignore

##### README for additional insights
- Tech stack: Go 1.21+, Fyne v2
- Features: cross-platform support (Win/macOS/Linux), dual interface (GUI + CLI), safe backup mechanism
- No external databases; uses file system for backup and config

a. Main components
- User Interfaces:
– GUI layer (Fyne windows, buttons, status panels)
– CLI layer (command parsing, flags)
- Controller/Orchestrator: main.go
- Cleaning Engine: cleaner/engine.go + process_unix.go + process_windows.go
- Configuration Manager: config/config.go + reset_config.json
- Version Service: version/check.go (optional remote check)
- i18n Service: i18n/embed.go + language JSON files
- File System & OS APIs: for detection, backup, deletion
b. Relationships & interactions
– UI layer calls the Controller
– Controller loads Config and i18n, checks Version if needed
– Controller invokes Cleaning Engine, which uses OS APIs to locate app data, back up files, clear caches
– Engine reports progress/status back to UI or CLI
c. Architectural patterns & principles
– Modular package structure (separation of concerns)
– Adapter pattern for OS-specific processes
– Singleton/centralized configuration loader
– Embedded resources for portable binaries (i18n, UI assets)
d. Core technologies/frameworks
– Go modules, goroutines (if concurrent resets)
– Fyne v2 for GUI
– go:embed for resources and i18n JSON
– GitHub Actions for CI/CD (release workflow)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Actor
    User["User"]:::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        subgraph "GUI Layer"
            GUIApp["app.go"]:::ui
            GUIRes["resources.go"]:::ui
            GUITheme["theme.go"]:::ui
        end
        CLI["CLI Layer"]:::ui
    end

    %% Application Core
    subgraph "Application Core"
        Controller["Controller / Orchestrator (main.go)"]:::core
    end

    %% Services Layer
    subgraph "Services Layer"
        Config["Config Manager"]:::service
        Version["Version Service"]:::service
        subgraph "i18n Service"
            I18nEmbed["embed.go"]:::service
            I18nMain["i18n.go"]:::service
            enJSON["en.json"]:::service
            zhJSON["zh.json"]:::service
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        CleaningEngine["Cleaning Engine"]:::core
        UnixAdapter["Unix Adapter"]:::core
        WinAdapter["Windows Adapter"]:::core
    end

    %% Infrastructure Layer
    FS["File System & OS APIs"]:::infra

    %% Build & Metadata
    subgraph "Build & Metadata"
        BuildRelease["Release Workflow"]:::infra
        GoMod["go.mod"]:::infra
        GoSum["go.sum"]:::infra
        Gitignore[".gitignore"]:::infra
    end

    %% Connections
    User --> GUIApp
    User --> CLI

    GUIApp -->|invokes| Controller
    CLI -->|invokes| Controller

    Controller -->|loads| Config
    Controller -->|checks| Version
    Controller -->|loads| I18nMain

    Controller -->|triggers| CleaningEngine

    CleaningEngine -->|uses| UnixAdapter
    CleaningEngine -->|uses| WinAdapter

    UnixAdapter -->|calls| FS
    WinAdapter -->|calls| FS

    CleaningEngine -->|reports status| GUIApp
    CleaningEngine -->|reports status| CLI

    %% Click Events
    click GUIApp "https://github.com/whispin/cursor_windsurf_reset/blob/main/gui/app.go"
    click GUIRes "https://github.com/whispin/cursor_windsurf_reset/blob/main/gui/resources.go"
    click GUITheme "https://github.com/whispin/cursor_windsurf_reset/blob/main/gui/theme.go"
    click CLI "https://github.com/whispin/cursor_windsurf_reset/blob/main/main.go"
    click Controller "https://github.com/whispin/cursor_windsurf_reset/blob/main/main.go"
    click Config "https://github.com/whispin/cursor_windsurf_reset/blob/main/config/config.go"
    click Version "https://github.com/whispin/cursor_windsurf_reset/blob/main/version/check.go"
    click I18nEmbed "https://github.com/whispin/cursor_windsurf_reset/blob/main/i18n/embed.go"
    click I18nMain "https://github.com/whispin/cursor_windsurf_reset/blob/main/i18n/i18n.go"
    click enJSON "https://github.com/whispin/cursor_windsurf_reset/blob/main/i18n/en.json"
    click zhJSON "https://github.com/whispin/cursor_windsurf_reset/blob/main/i18n/zh.json"
    click CleaningEngine "https://github.com/whispin/cursor_windsurf_reset/blob/main/cleaner/engine.go"
    click UnixAdapter "https://github.com/whispin/cursor_windsurf_reset/blob/main/cleaner/process_unix.go"
    click WinAdapter "https://github.com/whispin/cursor_windsurf_reset/blob/main/cleaner/process_windows.go"
    click BuildRelease "https://github.com/whispin/cursor_windsurf_reset/blob/main/.github/workflows/release.yml"
    click GoMod "https://github.com/whispin/cursor_windsurf_reset/blob/main/go.mod"
    click GoSum "https://github.com/whispin/cursor_windsurf_reset/blob/main/go.sum"
    click Gitignore "https://github.com/whispin/cursor_windsurf_reset/blob/main/.gitignore"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085;
    classDef core fill:#d4edda,stroke:#155724;
    classDef service fill:#fff3cd,stroke:#856404;
    classDef infra fill:#e2e3e5,stroke:#6c757d;
    classDef external fill:#f8d7da,stroke:#721c24;
```
