# krayoristine/subterrminalex architecture

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

- Interactive diagram: https://gitdiagram.com/krayoristine/subterrminalex
- Repository: https://github.com/krayoristine/subterrminalex

## Overview

SubTerminalEX is a game plugin that extends the in-game terminal: it registers added commands, aliases and hooks, then intercepts terminal interpretation to parse input, validate and dispatch commands. Startup also loads optional alias definitions and patches terminal boot behavior. The README names no additional capabilities; the source index identifies the core modules, but excerpts do not show every manager operation or how the hook registry is dispatched, so those links are omitted.

Main entry points: [`Plugin.cs`](https://github.com/krayoristine/subterrminalex/blob/master/Plugin.cs) (Plugin startup), [`TerminalCommandManager.cs`](https://github.com/krayoristine/subterrminalex/blob/master/TerminalCommandManager.cs) (Command manager), [`Patches/TerminalInterpreterInterpretPatches.cs`](https://github.com/krayoristine/subterrminalex/blob/master/Patches/TerminalInterpreterInterpretPatches.cs) (Input interpreter), [`Features/ExtraTerminalCommand.cs`](https://github.com/krayoristine/subterrminalex/blob/master/Features/ExtraTerminalCommand.cs) (Extra commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Plugin lifecycle"]
  node_plugin["Plugin startup<br/>[Plugin.cs]"]
  node_roompatch["Room startup patch"]
  node_bootpatch["Terminal boot patch"]
  node_logger["Plugin logging<br/>[Logger.cs]"]
  node_identity["Plugin identity<br/>[SubterexInfo.cs]"]
end

subgraph group_commands["Terminal commands"]
  node_interpreter["Input interpreter"]
  node_manager["Command manager"]
  node_command["Command definition"]
  node_suggestions["Command suggestions<br/>[Shared.cs]"]
end

subgraph group_hooks["Command hooks"]
  node_hookdata["Hook metadata<br/>[STEHookData.cs]"]
  node_hookpriority["Hook priorities<br/>[STEHookPriority.cs]"]
  node_hooktarget["Hook timing<br/>[STEHookTarget.cs]"]
end

subgraph group_extras["Built-in features"]
  node_extras["Extra commands"]
  node_aliasfile["Alias definition file"]
end

node_player(("Player"))
node_terminal["Game terminal"]

node_player -->|"enters input"| node_terminal
node_terminal -->|"interprets input"| node_interpreter
node_interpreter -->|"looks up command"| node_manager
node_interpreter -->|"requests suggestions"| node_suggestions
node_interpreter -->|"checks arguments"| node_command
node_interpreter -->|"starts action"| node_terminal
node_manager -->|"creates definitions"| node_command
node_manager -->|"stores hooks"| node_hookdata
node_manager -->|"orders hooks"| node_hookpriority
node_hookdata -->|"records timing"| node_hooktarget
node_roompatch -->|"starts game setup"| node_plugin
node_plugin -->|"caches commands"| node_manager
node_plugin -->|"updates terminal"| node_manager
node_plugin -->|"registers features"| node_extras
node_plugin -->|"optionally loads"| node_aliasfile
node_bootpatch -->|"reads boot setting"| node_plugin
node_plugin -->|"initializes logging"| node_logger
node_plugin -->|"uses metadata"| node_identity
node_extras -->|"registers aliases"| node_manager
node_extras -->|"reads and writes"| node_aliasfile
node_extras -->|"removes aliases"| node_manager
node_extras -->|"invokes game commands"| node_interpreter

click node_plugin "https://github.com/krayoristine/subterrminalex/blob/master/Plugin.cs"
click node_roompatch "https://github.com/krayoristine/subterrminalex/blob/master/Patches/NetworkManagerOnJoinedRoomPatches.cs"
click node_bootpatch "https://github.com/krayoristine/subterrminalex/blob/master/Patches/TerminalManagerAwakePatches.cs"
click node_interpreter "https://github.com/krayoristine/subterrminalex/blob/master/Patches/TerminalInterpreterInterpretPatches.cs"
click node_manager "https://github.com/krayoristine/subterrminalex/blob/master/TerminalCommandManager.cs"
click node_command "https://github.com/krayoristine/subterrminalex/blob/master/TerminalCommandEX.cs"
click node_suggestions "https://github.com/krayoristine/subterrminalex/blob/master/Shared.cs"
click node_hookdata "https://github.com/krayoristine/subterrminalex/blob/master/STEHookData.cs"
click node_hookpriority "https://github.com/krayoristine/subterrminalex/blob/master/STEHookPriority.cs"
click node_hooktarget "https://github.com/krayoristine/subterrminalex/blob/master/STEHookTarget.cs"
click node_extras "https://github.com/krayoristine/subterrminalex/blob/master/Features/ExtraTerminalCommand.cs"
click node_logger "https://github.com/krayoristine/subterrminalex/blob/master/Logger.cs"
click node_identity "https://github.com/krayoristine/subterrminalex/blob/master/SubterexInfo.cs"

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_plugin,node_roompatch,node_bootpatch,node_logger,node_identity toneBlue
class node_interpreter,node_manager,node_command,node_suggestions toneAmber
class node_hookdata,node_hookpriority,node_hooktarget toneMint
class node_extras,node_aliasfile toneRose
class node_player,node_terminal toneIndigo
```

## Components

### Plugin lifecycle

- [Plugin startup](https://github.com/krayoristine/subterrminalex/blob/master/Plugin.cs): `Plugin.cs`
- [Room startup patch](https://github.com/krayoristine/subterrminalex/blob/master/Patches/NetworkManagerOnJoinedRoomPatches.cs): `Patches/NetworkManagerOnJoinedRoomPatches.cs`
- [Terminal boot patch](https://github.com/krayoristine/subterrminalex/blob/master/Patches/TerminalManagerAwakePatches.cs): `Patches/TerminalManagerAwakePatches.cs`
- [Plugin logging](https://github.com/krayoristine/subterrminalex/blob/master/Logger.cs): `Logger.cs`
- [Plugin identity](https://github.com/krayoristine/subterrminalex/blob/master/SubterexInfo.cs): `SubterexInfo.cs`

### Terminal commands

- [Input interpreter](https://github.com/krayoristine/subterrminalex/blob/master/Patches/TerminalInterpreterInterpretPatches.cs): `Patches/TerminalInterpreterInterpretPatches.cs`
- [Command manager](https://github.com/krayoristine/subterrminalex/blob/master/TerminalCommandManager.cs): `TerminalCommandManager.cs`
- [Command definition](https://github.com/krayoristine/subterrminalex/blob/master/TerminalCommandEX.cs): `TerminalCommandEX.cs`
- [Command suggestions](https://github.com/krayoristine/subterrminalex/blob/master/Shared.cs): `Shared.cs`

### Command hooks

- [Hook metadata](https://github.com/krayoristine/subterrminalex/blob/master/STEHookData.cs): `STEHookData.cs`
- [Hook priorities](https://github.com/krayoristine/subterrminalex/blob/master/STEHookPriority.cs): `STEHookPriority.cs`
- [Hook timing](https://github.com/krayoristine/subterrminalex/blob/master/STEHookTarget.cs): `STEHookTarget.cs`

### Built-in features

- [Extra commands](https://github.com/krayoristine/subterrminalex/blob/master/Features/ExtraTerminalCommand.cs): `Features/ExtraTerminalCommand.cs`
- **Alias definition file**

### Other components

- **Player**
- **Game terminal**

## Connections

- Player → Game terminal: enters input
- Game terminal → Input interpreter: interprets input (evidence: `Patches/TerminalInterpreterInterpretPatches.cs`)
- Input interpreter → Command manager: looks up command (evidence: `Patches/TerminalInterpreterInterpretPatches.cs`)
- Input interpreter → Command suggestions: requests suggestions (evidence: `Patches/TerminalInterpreterInterpretPatches.cs`)
- Input interpreter → Command definition: checks arguments (evidence: `TerminalCommandEX.cs`)
- Input interpreter → Game terminal: starts action (evidence: `Patches/TerminalInterpreterInterpretPatches.cs`)
- Command manager → Command definition: creates definitions (evidence: `TerminalCommandManager.cs`)
- Command manager → Hook metadata: stores hooks (evidence: `TerminalCommandManager.cs`)
- Command manager → Hook priorities: orders hooks (evidence: `TerminalCommandManager.cs`)
- Hook metadata → Hook timing: records timing (evidence: `STEHookData.cs`)
- Room startup patch → Plugin startup: starts game setup (evidence: `Patches/NetworkManagerOnJoinedRoomPatches.cs`)
- Plugin startup → Command manager: caches commands (evidence: `Plugin.cs`)
- Plugin startup → Command manager: updates terminal (evidence: `Plugin.cs`)
- Plugin startup → Extra commands: registers features (evidence: `Plugin.cs`)
- Plugin startup → Alias definition file: optionally loads (evidence: `Plugin.cs`)
- Terminal boot patch → Plugin startup: reads boot setting (evidence: `Patches/TerminalManagerAwakePatches.cs`)
- Plugin startup → Plugin logging: initializes logging (evidence: `Plugin.cs`)
- Plugin startup → Plugin identity: uses metadata (evidence: `Plugin.cs`)
- Extra commands → Command manager: registers aliases (evidence: `Features/ExtraTerminalCommand.cs`)
- Extra commands → Alias definition file: reads and writes (evidence: `Features/ExtraTerminalCommand.cs`)
- Extra commands → Command manager: removes aliases (evidence: `Features/ExtraTerminalCommand.cs`)
- Extra commands → Input interpreter: invokes game commands (evidence: `Features/ExtraTerminalCommand.cs`)
