# xav1ersue/code-glow architecture

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

- Interactive diagram: https://gitdiagram.com/xav1ersue/code-glow
- Repository: https://github.com/xav1ersue/code-glow

## Overview

#### Purpose and Entry Points

Code Glow is a VS Code extension that adds a neon-like text glow effect while adapting to the active editor theme. The extension is activated and controlled through VS Code commands:

- Extension host entry point: `src/extension.ts`
- Glow styling payload: `src/script.js`
- Package/runtime integration is defined by `package.json`

#### Extension Host Control Layer

`src/extension.ts` is the TypeScript extension-host component. It is responsible for registering the enable/disable command handlers, accessing VS Code APIs, and coordinating injection or removal of the glow effect.

The command-driven boundary keeps VS Code extension APIs separate from the editor/UI manipulation code:

- `src/extension.ts`
- `package.json`

#### Editor UI Injection Layer

`src/script.js` contains the code executed against VS Code’s rendered workbench/editor surface to apply the visual glow treatment. This is the browser/DOM-facing side of the extension, distinct from the Node.js-based extension host.

This boundary is material because glow styling must interact with VS Code’s internal rendered UI rather than editor document contents:

- `src/script.js`
- `src/extension.ts`

#### Enable/Disable Flow

1. A user invokes `code-glow.enableGlow` or `code-glow.disableGlow` through the Command Palette.
2. VS Code dispatches the command to handlers registered by `src/extension.ts`.
3. The extension host applies or removes the script-driven visual modification.
4. `src/script.js` updates the rendered editor appearance to add/remove text glow.

The effect is presentation-only: it does not alter source files, language services, or workspace state.

#### Theme Adaptation Boundary

The core product behavior is automatic adaptation to the user’s active VS Code theme. The glow implementation therefore depends on values and DOM/UI state exposed by the VS Code workbench rather than a fixed bundled color theme.

Relevant implementation split:

- Theme-aware visual logic: `src/script.js`
- Lifecycle and command orchestration: `src/extension.ts`

#### Build and Distribution

TypeScript extension-host code and JavaScript injection code are packaged for VS Code extension distribution. Webpack is the central bundling boundary, producing a deployable extension artifact from `src/`:

- `webpack.config.js`
- `tsconfig.json`
- `package.json`

The material runtime is VS Code’s extension host plus its Electron-rendered workbench. No standalone server, database, or external service is indicated.

Main entry points: [`webpack.config.js`](https://github.com/xav1ersue/code-glow/blob/main/webpack.config.js) (Webpack Bundle), [`src/extension.ts`](https://github.com/xav1ersue/code-glow/blob/main/src/extension.ts) (Command Orchestrator), [`src/script.js`](https://github.com/xav1ersue/code-glow/blob/main/src/script.js) (Theme-Aware Glow Script), [`package.json`](https://github.com/xav1ersue/code-glow/blob/main/package.json) (Extension Manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["VS Code Runtime"]
  node_user(("User<br/>actor"))
  node_command_palette["Command Palette<br/>VS Code UI"]
  node_vs_code_api["VS Code APIs<br/>extension API"]
  node_extension_host{{"Extension Host<br/>Node.js runtime"}}
  node_workbench["Rendered Workbench<br/>Electron DOM"]
end

subgraph group_source["Extension Source"]
  node_extension_entry["Command Orchestrator<br/>TypeScript<br/>[extension.ts]"]
  node_glow_script["Theme-Aware Glow Script<br/>workbench JavaScript<br/>[script.js]"]
end

subgraph group_build["Build &amp; Distribution"]
  node_manifest["Extension Manifest<br/>package metadata<br/>[package.json]"]
  node_webpack["Webpack Bundle<br/>bundler config<br/>[webpack.config.js]"]
  node_tsconfig["TypeScript Config<br/>compiler config<br/>[tsconfig.json]"]
  node_extension_package["Deployable Extension<br/>VS Code package"]
end

node_user -->|"invokes enable/disable"| node_command_palette
node_command_palette -->|"dispatches command"| node_vs_code_api
node_manifest -->|"contributes commands"| node_vs_code_api
node_vs_code_api -->|"activates and routes"| node_extension_host
node_extension_host -->|"runs"| node_extension_entry
node_extension_entry -->|"registers handlers"| node_vs_code_api
node_extension_entry -->|"injects or removes"| node_glow_script
node_glow_script -->|"updates glow styling"| node_workbench
node_workbench -.->|"provides theme and DOM state"| node_glow_script
node_tsconfig -->|"compiles TypeScript"| node_webpack
node_extension_entry -->|"bundled from"| node_webpack
node_glow_script -->|"bundled from"| node_webpack
node_manifest -->|"packages with"| node_webpack
node_webpack -->|"produces"| node_extension_package
node_extension_package -->|"installed and loaded by"| node_extension_host

click node_extension_entry "https://github.com/xav1ersue/code-glow/blob/main/src/extension.ts"
click node_glow_script "https://github.com/xav1ersue/code-glow/blob/main/src/script.js"
click node_manifest "https://github.com/xav1ersue/code-glow/blob/main/package.json"
click node_webpack "https://github.com/xav1ersue/code-glow/blob/main/webpack.config.js"
click node_tsconfig "https://github.com/xav1ersue/code-glow/blob/main/tsconfig.json"

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_user,node_command_palette,node_vs_code_api,node_extension_host,node_workbench toneBlue
class node_extension_entry,node_glow_script toneAmber
class node_manifest,node_webpack,node_tsconfig,node_extension_package toneMint
```

## Components

### VS Code Runtime

- **User**: actor
- **Command Palette**: VS Code UI
- **VS Code APIs**: extension API
- **Extension Host**: Node.js runtime · Runs command lifecycle code separately from the workbench.
- **Rendered Workbench**: Electron DOM · The editor UI surface receiving presentation-only styling.

### Extension Source

- [Command Orchestrator](https://github.com/xav1ersue/code-glow/blob/main/src/extension.ts): TypeScript · Registers enable/disable handlers and coordinates injection or removal. · `src/extension.ts`
- [Theme-Aware Glow Script](https://github.com/xav1ersue/code-glow/blob/main/src/script.js): workbench JavaScript · Applies or removes glow using active workbench theme and DOM state. · `src/script.js`

### Build & Distribution

- [Extension Manifest](https://github.com/xav1ersue/code-glow/blob/main/package.json): package metadata · Defines VS Code integration and extension runtime packaging. · `package.json`
- [Webpack Bundle](https://github.com/xav1ersue/code-glow/blob/main/webpack.config.js): bundler config · Central bundling boundary for deployable extension output. · `webpack.config.js`
- [TypeScript Config](https://github.com/xav1ersue/code-glow/blob/main/tsconfig.json): compiler config · `tsconfig.json`
- **Deployable Extension**: VS Code package

## Connections

- User → Command Palette: invokes enable/disable
- Command Palette → VS Code APIs: dispatches command
- Extension Manifest → VS Code APIs: contributes commands
- VS Code APIs → Extension Host: activates and routes
- Extension Host → Command Orchestrator: runs
- Command Orchestrator → VS Code APIs: registers handlers
- Command Orchestrator → Theme-Aware Glow Script: injects or removes
- Theme-Aware Glow Script → Rendered Workbench: updates glow styling
- Rendered Workbench → Theme-Aware Glow Script: provides theme and DOM state
- TypeScript Config → Webpack Bundle: compiles TypeScript
- Command Orchestrator → Webpack Bundle: bundled from
- Theme-Aware Glow Script → Webpack Bundle: bundled from
- Extension Manifest → Webpack Bundle: packages with
- Webpack Bundle → Deployable Extension: produces
- Deployable Extension → Extension Host: installed and loaded by
