# progrium/go-vscode architecture

> Architecture diagram of the GitHub repository progrium/go-vscode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/progrium/go-vscode
- Repository: https://github.com/progrium/go-vscode

## Overview

##### Main Components

a) Core Components:
- VSCode Web Frontend (from embedded vscode-web artifact)
- Go Library Interface Layer
- Virtual File System Interface
- Terminal (PTY) Interface
- HTTP Server Component

b) Integration Points:
- Custom Application Integration
- Browser Client
- File System Implementation
- Terminal Implementation

**[Browser Client Layer]**
- ↕
**[HTTP Server Layer (Workbench Handler)]**
- ↕
**[Go Library Core]**
- ↙   ↓   ↘
**[FS] [PTY] [Product Config]**

##### Component Details

a) Client Layer:
- Browser (Web Client)
- VSCode Web UI (assets/index.html + embedded vscode-web)
- Bridge.js (assets/bridge.js)

b) Server Layer:
- Workbench Handler (workbench.go)
- HTTP Server Interface

c) Core Library Components:
- Workbench Configuration
- Virtual File System (internal/zipfs)
- PTY Interface (pty.go)
- Product Configuration (product/product.go)

##### Connection Types

- HTTP/WebSocket connections (between browser and server)
- Internal API calls (between components)
- File system operations (between FS interface and implementation)
- Terminal I/O (between PTY interface and implementation)

##### Implementation Notes

- Custom FS implementations
- Custom Terminal implementations
- Custom Product configurations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser"]
        VSCodeWeb["VSCode Web Frontend"]:::vscode
        Bridge["Client Bridge Interface"]:::bridge
    end

    subgraph Server
        HTTPServer["HTTP Server"]:::server
        WorkbenchHandler["Core Workbench Handler"]:::core
    end

    subgraph CoreLibrary
        FSInterface["Virtual File System Interface"]:::fs
        PTYInterface["Terminal Interface"]:::pty
        ProductConfig["Product Configuration"]:::config
    end

    subgraph Implementation
        CustomFS["Custom FS Implementation"]:::custom
        CustomPTY["Custom PTY Implementation"]:::custom
        ZipFS["Zip FS Implementation"]:::impl
    end

    subgraph Extensions
        VSCodeExt["VSCode Extension"]:::ext
        HostFS["Host FS Extension"]:::ext
    end

    %% Connections
    Browser --> HTTPServer
    Browser --> VSCodeWeb
    VSCodeWeb --> Bridge
    Bridge --> HTTPServer
    HTTPServer --> WorkbenchHandler
    WorkbenchHandler --> FSInterface
    WorkbenchHandler --> PTYInterface
    WorkbenchHandler --> ProductConfig
    FSInterface --> CustomFS
    FSInterface --> ZipFS
    PTYInterface --> CustomPTY
    VSCodeExt --> HostFS
    HostFS --> FSInterface

    %% Click Events
    click VSCodeWeb "https://github.com/progrium/go-vscode/blob/main/assets/vscode-web.zip"
    click Bridge "https://github.com/progrium/go-vscode/blob/main/assets/bridge.js"
    click WorkbenchHandler "https://github.com/progrium/go-vscode/blob/main/workbench.go"
    click FSInterface "https://github.com/progrium/go-vscode/blob/main/fs.go"
    click ZipFS "https://github.com/progrium/go-vscode/blob/main/internal/zipfs/fs.go"
    click PTYInterface "https://github.com/progrium/go-vscode/blob/main/pty.go"
    click ProductConfig "https://github.com/progrium/go-vscode/blob/main/product/product.go"
    click VSCodeExt "https://github.com/progrium/go-vscode/blob/main/extension/src/web/extension.ts"
    click HostFS "https://github.com/progrium/go-vscode/blob/main/extension/src/web/hostfs.ts"

    %% Styles
    classDef vscode fill:#2196F3,color:white
    classDef bridge fill:#64B5F6,color:white
    classDef server fill:#90A4AE,color:white
    classDef core fill:#7E57C2,color:white
    classDef fs fill:#4CAF50,color:white
    classDef pty fill:#FFA726,color:white
    classDef config fill:#EC407A,color:white
    classDef custom fill:#78909C,stroke-dasharray: 5 5
    classDef impl fill:#81C784,color:white
    classDef ext fill:#BA68C8,color:white

    %% Legend
    subgraph Legend
        L1["VSCode Components"]:::vscode
        L2["File System"]:::fs
        L3["Terminal"]:::pty
        L4["Configuration"]:::config
        L5["Custom Implementation"]:::custom
        L6["Extensions"]:::ext
    end
```
