# feliscatus/switchyomega architecture

> Architecture diagram of the GitHub repository feliscatus/switchyomega, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/feliscatus/switchyomega
- Repository: https://github.com/feliscatus/switchyomega

## Overview

SwitchyOmega is a proxy-profile manager and switcher delivered as a browser extension. The user selects or configures a profile in the popup or options UI; the browser target bridges those actions to shared options/profile logic and applies proxy behavior. The README documents PAC generation and the separation between browser-independent management and target-specific APIs. Several background and profile subsystems are represented by their exact enclosing directories because their source was not excerpted; links to them are dashed where implementation-level calls could not be verified.

Main entry points: [`omega-target/src/options.coffee`](https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/options.coffee) (Options manager), [`omega-pac/src/profiles.coffee`](https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/profiles.coffee) (PAC profiles), [`omega-target-chromium-extension/src/coffee/background.coffee`](https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/coffee/background.coffee) (Extension background), [`omega-target-chromium-extension/src/js/omega_webext_proxy_script.js`](https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js) (Proxy script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interfaces"]
  node_popup["Profile popup<br/>[profiles.js]"]
  node_options_ui["Options interface"]
  node_profile_types["Profile controllers"]
end

subgraph group_core["Profile and options core"]
  node_options_manager["Options manager<br/>[options.coffee]"]
  node_option_storage[("Options storage<br/>[storage.coffee]")]
  node_pac_profiles["PAC profiles<br/>[profiles.coffee]"]
  node_pac_generator["PAC generator"]
  node_conditions["Request conditions<br/>[conditions.coffee]"]
  node_rule_lists["Rule lists<br/>[rule_list.coffee]"]
  node_uglify["JavaScript minifier<br/>[uglifyjs.js]"]
end

subgraph group_target["Browser target"]
  node_popup_bridge["Popup bridge"]
  node_target_web["Web target adapter"]
  node_target_background["Extension background<br/>[background.coffee]"]
  node_browser_storage["Browser storage"]
end

subgraph group_runtime["Proxy runtime"]
  node_proxy_impl["Proxy application"]
  node_proxy_script["Proxy script"]
end

node_user(("Extension user"))
node_browser(("Browser proxy API"))

node_user -->|"selects profile"| node_popup
node_popup -->|"requests profile change"| node_popup_bridge
node_user -->|"configures profiles"| node_options_ui
node_options_ui -.->|"uses browser adapter"| node_target_web
node_target_web -.->|"bridges to core"| node_options_manager
node_popup_bridge -->|"sends runtime messages"| node_target_background
node_target_background -.->|"applies profile state"| node_options_manager
node_options_manager -.->|"persists options"| node_option_storage
node_options_manager -.->|"uses target storage"| node_browser_storage
node_options_manager -.->|"manages profiles"| node_pac_profiles
node_pac_profiles -.->|"matches requests"| node_conditions
node_pac_profiles -.->|"evaluates rule lists"| node_rule_lists
node_pac_profiles -->|"compiles PAC scripts"| node_pac_generator
node_pac_generator -.->|"minifies script"| node_uglify
node_target_background -.->|"configures proxy"| node_proxy_impl
node_proxy_impl -.->|"sets proxy behavior"| node_browser
node_proxy_script -->|"matches active profile"| node_pac_profiles
node_proxy_script -->|"returns proxy result"| node_browser

click node_popup "https://github.com/feliscatus/switchyomega/blob/master/omega-web/src/popup/js/profiles.js"
click node_popup_bridge "https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/js/omega_target_popup.js"
click node_options_ui "https://github.com/feliscatus/switchyomega/tree/master/omega-web/src/omega/controllers"
click node_target_web "https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/coffee/omega_target_web.coffee"
click node_target_background "https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/coffee/background.coffee"
click node_options_manager "https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/options.coffee"
click node_option_storage "https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/storage.coffee"
click node_browser_storage "https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/browser_storage.coffee"
click node_profile_types "https://github.com/feliscatus/switchyomega/tree/master/omega-web/src/omega/controllers"
click node_pac_profiles "https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/profiles.coffee"
click node_pac_generator "https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/pac_generator.coffee"
click node_conditions "https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/conditions.coffee"
click node_rule_lists "https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/rule_list.coffee"
click node_uglify "https://github.com/feliscatus/switchyomega/blob/master/omega-pac/uglifyjs.js"
click node_proxy_impl "https://github.com/feliscatus/switchyomega/tree/master/omega-target-chromium-extension/src/module/proxy"
click node_proxy_script "https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_popup,node_options_ui,node_profile_types,node_user,node_browser toneBlue
class node_options_manager,node_option_storage,node_pac_profiles,node_pac_generator,node_conditions,node_rule_lists,node_uglify toneAmber
class node_popup_bridge,node_target_web,node_target_background,node_browser_storage toneMint
class node_proxy_impl,node_proxy_script toneRose
```

## Components

### User interfaces

- [Profile popup](https://github.com/feliscatus/switchyomega/blob/master/omega-web/src/popup/js/profiles.js): `omega-web/src/popup/js/profiles.js`
- [Options interface](https://github.com/feliscatus/switchyomega/tree/master/omega-web/src/omega/controllers): `omega-web/src/omega/controllers`
- [Profile controllers](https://github.com/feliscatus/switchyomega/tree/master/omega-web/src/omega/controllers): `omega-web/src/omega/controllers`

### Profile and options core

- [Options manager](https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/options.coffee): `omega-target/src/options.coffee`
- [Options storage](https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/storage.coffee): `omega-target/src/storage.coffee`
- [PAC profiles](https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/profiles.coffee): `omega-pac/src/profiles.coffee`
- [PAC generator](https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/pac_generator.coffee): `omega-pac/src/pac_generator.coffee`
- [Request conditions](https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/conditions.coffee): `omega-pac/src/conditions.coffee`
- [Rule lists](https://github.com/feliscatus/switchyomega/blob/master/omega-pac/src/rule_list.coffee): `omega-pac/src/rule_list.coffee`
- [JavaScript minifier](https://github.com/feliscatus/switchyomega/blob/master/omega-pac/uglifyjs.js): `omega-pac/uglifyjs.js`

### Browser target

- [Popup bridge](https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/js/omega_target_popup.js): `omega-target-chromium-extension/src/js/omega_target_popup.js`
- [Web target adapter](https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/coffee/omega_target_web.coffee): `omega-target-chromium-extension/src/coffee/omega_target_web.coffee`
- [Extension background](https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/coffee/background.coffee): `omega-target-chromium-extension/src/coffee/background.coffee`
- [Browser storage](https://github.com/feliscatus/switchyomega/blob/master/omega-target/src/browser_storage.coffee): `omega-target/src/browser_storage.coffee`

### Proxy runtime

- [Proxy application](https://github.com/feliscatus/switchyomega/tree/master/omega-target-chromium-extension/src/module/proxy): `omega-target-chromium-extension/src/module/proxy`
- [Proxy script](https://github.com/feliscatus/switchyomega/blob/master/omega-target-chromium-extension/src/js/omega_webext_proxy_script.js): `omega-target-chromium-extension/src/js/omega_webext_proxy_script.js`

### Other components

- **Extension user**
- **Browser proxy API**

## Connections

- Extension user → Profile popup: selects profile (evidence: `README.md`)
- Profile popup → Popup bridge: requests profile change (evidence: `omega-web/src/popup/js/profiles.js`)
- Extension user → Options interface: configures profiles (evidence: `README.md`)
- Options interface → Web target adapter: uses browser adapter (evidence: `README.md`)
- Web target adapter → Options manager: bridges to core (evidence: `README.md`)
- Popup bridge → Extension background: sends runtime messages (evidence: `omega-target-chromium-extension/src/js/omega_target_popup.js`)
- Extension background → Options manager: applies profile state
- Options manager → Options storage: persists options
- Options manager → Browser storage: uses target storage (evidence: `README.md`)
- Options manager → PAC profiles: manages profiles (evidence: `README.md`)
- PAC profiles → Request conditions: matches requests
- PAC profiles → Rule lists: evaluates rule lists
- PAC profiles → PAC generator: compiles PAC scripts (evidence: `README.md`)
- PAC generator → JavaScript minifier: minifies script
- Extension background → Proxy application: configures proxy
- Proxy application → Browser proxy API: sets proxy behavior
- Proxy script → PAC profiles: matches active profile (evidence: `omega-target-chromium-extension/src/js/omega_webext_proxy_script.js`)
- Proxy script → Browser proxy API: returns proxy result (evidence: `omega-target-chromium-extension/src/js/omega_webext_proxy_script.js`)
