# tcsenpai/shellquest architecture

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

- Interactive diagram: https://gitdiagram.com/tcsenpai/shellquest
- Repository: https://github.com/tcsenpai/shellquest

## Overview

ShellQuest is a terminal-based escape-room game: players create or load a profile, enter the game menu, solve level puzzles with simulated Linux commands, and progress through registered challenges. The game loop coordinates level input, hints, saves, and completion; core services manage profiles, achievements, and leaderboard records. The README also documents a progress map and expandable levels. Source excerpts show several key calls, but not every UI or persistence interaction, so unsampled relationships are omitted.

Main entry points: [`src/ui/gameUI.ts`](https://github.com/tcsenpai/shellquest/blob/master/src/ui/gameUI.ts) (Game Loop), [`src/ui/mainMenu.ts`](https://github.com/tcsenpai/shellquest/blob/master/src/ui/mainMenu.ts) (Main Menu), [`src/ui/entryMenu.ts`](https://github.com/tcsenpai/shellquest/blob/master/src/ui/entryMenu.ts) (Profile Entry), [`src/core/achievements.ts`](https://github.com/tcsenpai/shellquest/blob/master/src/core/achievements.ts) (Achievements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Player Entry"]
  node_bootstrap["Game Bootstrap<br/>[index.ts]"]
  node_entrymenu["Profile Entry<br/>[entryMenu.ts]"]
end

subgraph group_play["Game Play"]
  node_gamestate["Game State<br/>[gameState.ts]"]
  node_levels["Puzzle Levels"]
  node_registry["Level Registry<br/>[index.ts]"]
  node_levelsystem["Level System<br/>[levelSystem.ts]"]
  node_gameui["Game Loop<br/>[gameUI.ts]"]
  node_mainmenu["Main Menu<br/>[mainMenu.ts]"]
end

subgraph group_progress["Progress Systems"]
  node_profile["Player Profiles<br/>[playerProfile.ts]"]
  node_achievements["Achievements<br/>[achievements.ts]"]
  node_leaderboard["Leaderboard<br/>[leaderboard.ts]"]
  node_progressmap["Progress Map<br/>[progressMap.ts]"]
  node_savefiles[("Save Files")]
  node_leaderboardfile[("Leaderboard File<br/>[leaderboard.json]")]
end

subgraph group_terminal["Terminal UI"]
  node_terminal["Terminal Input<br/>[uiHelpers.ts]"]
  node_history["Command History<br/>[commandHistory.ts]"]
  node_renderer["Level Renderer<br/>[levelRenderer.ts]"]
  node_effects["Visual Effects<br/>[visualEffects.ts]"]
  node_sound["Sound Effects<br/>[soundEffects.ts]"]
end

node_player(("Player"))

node_player -->|"chooses profile"| node_entrymenu
node_bootstrap -->|"opens"| node_entrymenu
node_bootstrap -->|"registers levels"| node_registry
node_entrymenu -->|"loads or creates"| node_profile
node_entrymenu -->|"creates or loads"| node_gamestate
node_entrymenu -->|"opens"| node_mainmenu
node_mainmenu -->|"starts play"| node_gameui
node_gameui -->|"gets and completes"| node_levelsystem
node_gameui -->|"reads and saves"| node_gamestate
node_gameui -->|"prompts input"| node_terminal
node_gameui -->|"records commands"| node_history
node_gameui -->|"triggers checks"| node_achievements
node_gameui -->|"renders level"| node_renderer
node_gameui -->|"plays effects"| node_sound
node_gameui -->|"uses effects"| node_effects
node_registry -->|"registers challenges"| node_levels
node_levelsystem -->|"reads and updates"| node_gamestate
node_levelsystem -->|"updates results"| node_leaderboard
node_gamestate -->|"loads and saves profile"| node_profile
node_gamestate -->|"reads and writes"| node_savefiles
node_profile -->|"reads and writes"| node_savefiles
node_leaderboard -.->|"stores scores"| node_leaderboardfile
node_mainmenu -->|"opens map"| node_progressmap
node_mainmenu -->|"shows achievements"| node_achievements
node_mainmenu -->|"shows rankings"| node_leaderboard
node_achievements -->|"updates progress"| node_profile
node_achievements -->|"shows notification"| node_effects
node_achievements -->|"plays notification"| node_sound
node_progressmap -->|"reads levels"| node_levelsystem
node_progressmap -->|"reads progress"| node_profile

click node_bootstrap "https://github.com/tcsenpai/shellquest/blob/master/src/index.ts"
click node_entrymenu "https://github.com/tcsenpai/shellquest/blob/master/src/ui/entryMenu.ts"
click node_gamestate "https://github.com/tcsenpai/shellquest/blob/master/src/core/gameState.ts"
click node_levels "https://github.com/tcsenpai/shellquest/tree/master/src/levels"
click node_registry "https://github.com/tcsenpai/shellquest/blob/master/src/levels/index.ts"
click node_levelsystem "https://github.com/tcsenpai/shellquest/blob/master/src/core/levelSystem.ts"
click node_gameui "https://github.com/tcsenpai/shellquest/blob/master/src/ui/gameUI.ts"
click node_mainmenu "https://github.com/tcsenpai/shellquest/blob/master/src/ui/mainMenu.ts"
click node_profile "https://github.com/tcsenpai/shellquest/blob/master/src/core/playerProfile.ts"
click node_achievements "https://github.com/tcsenpai/shellquest/blob/master/src/core/achievements.ts"
click node_leaderboard "https://github.com/tcsenpai/shellquest/blob/master/src/core/leaderboard.ts"
click node_progressmap "https://github.com/tcsenpai/shellquest/blob/master/src/ui/progressMap.ts"
click node_savefiles "https://github.com/tcsenpai/shellquest/tree/master/saves"
click node_leaderboardfile "https://github.com/tcsenpai/shellquest/blob/master/leaderboard.json"
click node_terminal "https://github.com/tcsenpai/shellquest/blob/master/src/ui/uiHelpers.ts"
click node_history "https://github.com/tcsenpai/shellquest/blob/master/src/ui/commandHistory.ts"
click node_renderer "https://github.com/tcsenpai/shellquest/blob/master/src/ui/levelRenderer.ts"
click node_effects "https://github.com/tcsenpai/shellquest/blob/master/src/ui/visualEffects.ts"
click node_sound "https://github.com/tcsenpai/shellquest/blob/master/src/ui/soundEffects.ts"

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_bootstrap,node_entrymenu toneBlue
class node_gamestate,node_levels,node_registry,node_levelsystem,node_gameui,node_mainmenu toneAmber
class node_profile,node_achievements,node_leaderboard,node_progressmap,node_savefiles,node_leaderboardfile toneMint
class node_terminal,node_history,node_renderer,node_effects,node_sound toneRose
class node_player toneIndigo
```

## Components

### Player Entry

- [Game Bootstrap](https://github.com/tcsenpai/shellquest/blob/master/src/index.ts): `src/index.ts`
- [Profile Entry](https://github.com/tcsenpai/shellquest/blob/master/src/ui/entryMenu.ts): `src/ui/entryMenu.ts`

### Game Play

- [Game State](https://github.com/tcsenpai/shellquest/blob/master/src/core/gameState.ts): `src/core/gameState.ts`
- [Puzzle Levels](https://github.com/tcsenpai/shellquest/tree/master/src/levels): `src/levels`
- [Level Registry](https://github.com/tcsenpai/shellquest/blob/master/src/levels/index.ts): `src/levels/index.ts`
- [Level System](https://github.com/tcsenpai/shellquest/blob/master/src/core/levelSystem.ts): `src/core/levelSystem.ts`
- [Game Loop](https://github.com/tcsenpai/shellquest/blob/master/src/ui/gameUI.ts): `src/ui/gameUI.ts`
- [Main Menu](https://github.com/tcsenpai/shellquest/blob/master/src/ui/mainMenu.ts): `src/ui/mainMenu.ts`

### Progress Systems

- [Player Profiles](https://github.com/tcsenpai/shellquest/blob/master/src/core/playerProfile.ts): `src/core/playerProfile.ts`
- [Achievements](https://github.com/tcsenpai/shellquest/blob/master/src/core/achievements.ts): `src/core/achievements.ts`
- [Leaderboard](https://github.com/tcsenpai/shellquest/blob/master/src/core/leaderboard.ts): `src/core/leaderboard.ts`
- [Progress Map](https://github.com/tcsenpai/shellquest/blob/master/src/ui/progressMap.ts): `src/ui/progressMap.ts`
- [Save Files](https://github.com/tcsenpai/shellquest/tree/master/saves): `saves`
- [Leaderboard File](https://github.com/tcsenpai/shellquest/blob/master/leaderboard.json): `leaderboard.json`

### Terminal UI

- [Terminal Input](https://github.com/tcsenpai/shellquest/blob/master/src/ui/uiHelpers.ts): `src/ui/uiHelpers.ts`
- [Command History](https://github.com/tcsenpai/shellquest/blob/master/src/ui/commandHistory.ts): `src/ui/commandHistory.ts`
- [Level Renderer](https://github.com/tcsenpai/shellquest/blob/master/src/ui/levelRenderer.ts): `src/ui/levelRenderer.ts`
- [Visual Effects](https://github.com/tcsenpai/shellquest/blob/master/src/ui/visualEffects.ts): `src/ui/visualEffects.ts`
- [Sound Effects](https://github.com/tcsenpai/shellquest/blob/master/src/ui/soundEffects.ts): `src/ui/soundEffects.ts`

### Other components

- **Player**

## Connections

- Player → Profile Entry: chooses profile (evidence: `src/ui/entryMenu.ts`)
- Game Bootstrap → Profile Entry: opens (evidence: `src/index.ts`)
- Game Bootstrap → Level Registry: registers levels (evidence: `src/index.ts`)
- Profile Entry → Player Profiles: loads or creates (evidence: `src/ui/entryMenu.ts`)
- Profile Entry → Game State: creates or loads (evidence: `src/ui/entryMenu.ts`)
- Profile Entry → Main Menu: opens (evidence: `src/ui/entryMenu.ts`)
- Main Menu → Game Loop: starts play (evidence: `src/ui/mainMenu.ts`)
- Game Loop → Level System: gets and completes (evidence: `src/ui/gameUI.ts`)
- Game Loop → Game State: reads and saves (evidence: `src/ui/gameUI.ts`)
- Game Loop → Terminal Input: prompts input (evidence: `src/ui/gameUI.ts`)
- Game Loop → Command History: records commands (evidence: `src/ui/gameUI.ts`)
- Game Loop → Achievements: triggers checks (evidence: `src/ui/gameUI.ts`)
- Game Loop → Level Renderer: renders level (evidence: `src/ui/gameUI.ts`)
- Game Loop → Sound Effects: plays effects (evidence: `src/ui/gameUI.ts`)
- Game Loop → Visual Effects: uses effects (evidence: `src/ui/gameUI.ts`)
- Level Registry → Puzzle Levels: registers challenges (evidence: `src/levels/index.ts`)
- Level System → Game State: reads and updates (evidence: `src/core/levelSystem.ts`)
- Level System → Leaderboard: updates results (evidence: `src/core/levelSystem.ts`)
- Game State → Player Profiles: loads and saves profile (evidence: `src/core/gameState.ts`)
- Game State → Save Files: reads and writes (evidence: `src/core/gameState.ts`)
- Player Profiles → Save Files: reads and writes (evidence: `src/core/playerProfile.ts`)
- Leaderboard → Leaderboard File: stores scores
- Main Menu → Progress Map: opens map (evidence: `src/ui/mainMenu.ts`)
- Main Menu → Achievements: shows achievements (evidence: `src/ui/mainMenu.ts`)
- Main Menu → Leaderboard: shows rankings (evidence: `src/ui/mainMenu.ts`)
- Achievements → Player Profiles: updates progress (evidence: `src/core/achievements.ts`)
- Achievements → Visual Effects: shows notification (evidence: `src/core/achievements.ts`)
- Achievements → Sound Effects: plays notification (evidence: `src/core/achievements.ts`)
- Progress Map → Level System: reads levels (evidence: `src/ui/progressMap.ts`)
- Progress Map → Player Profiles: reads progress (evidence: `src/ui/progressMap.ts`)
