# demonkingswarn/josh architecture

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

- Interactive diagram: https://gitdiagram.com/demonkingswarn/josh
- Repository: https://github.com/demonkingswarn/josh

## Overview

Josh is a Jai terminal emulator. The documented user workflow is to launch it, run a program in a real PTY, process that program’s VT output into terminal state, and display the result; users can also configure appearance and interact through keyboard, mouse, selection, and search. The tree contains dependency headers but no Josh application source, so app-level wiring and several integrations cannot be verified. Dashed links indicate documented capabilities whose implementation path or connection is not shown; Raylib modules are included as dependencies without assuming Josh invokes them.

Main entry points: [`modules/libghostty-vt-jai/include/ghostty/vt/terminal.h`](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/terminal.h) (VT processing), [`modules/libghostty-vt-jai/include/ghostty/vt/screen.h`](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/screen.h) (Screen and scrollback), [`modules/Raylib/include/raylib.h`](https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/raylib.h) (Raylib interface), [`modules/Raylib/include/rcamera.h`](https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/rcamera.h) (Camera utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Terminal runtime"]
  node_josh["Josh terminal"]
  node_pty["PTY session"]
  node_config["Dix configuration"]
end

subgraph group_terminal["VT engine"]
  node_vt["VT processing<br/>[terminal.h]"]
  node_screen[("Screen and scrollback<br/>[screen.h]")]
  node_render["Terminal rendering<br/>[render.h]"]
  node_graphics["Kitty graphics<br/>[kitty_graphics.h]"]
end

subgraph group_interaction["Terminal interaction"]
  node_key["Keyboard encoding<br/>[encoder.h]"]
  node_mouse["Mouse encoding<br/>[encoder.h]"]
  node_selection["Text selection<br/>[selection.h]"]
  node_search["Terminal search<br/>[search.h]"]
end

subgraph group_graphics["Graphics dependencies"]
  node_raylib["Raylib interface<br/>[raylib.h]"]
  node_rlgl["OpenGL abstraction<br/>[rlgl.h]"]
  node_raymath["Raylib math<br/>[raymath.h]"]
  node_rcamera["Camera utilities<br/>[rcamera.h]"]
end

node_user(("User"))

node_user -.->|"launches"| node_josh
node_josh -.->|"starts PTY"| node_pty
node_pty -.->|"provides VT output"| node_vt
node_vt -.->|"maintains state"| node_screen
node_screen -.->|"renders state"| node_render
node_user -.->|"types keys"| node_key
node_user -.->|"reports mouse"| node_mouse
node_user -.->|"selects text"| node_selection
node_user -.->|"searches contents"| node_search
node_user -.->|"configures terminal"| node_config
node_josh -.->|"supports images"| node_graphics
node_raylib --> node_rlgl
node_rcamera -->|"uses math"| node_raymath

click node_vt "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/terminal.h"
click node_screen "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/screen.h"
click node_render "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/render.h"
click node_graphics "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/kitty_graphics.h"
click node_key "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/key/encoder.h"
click node_mouse "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/mouse/encoder.h"
click node_selection "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/selection.h"
click node_search "https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/search.h"
click node_raylib "https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/raylib.h"
click node_rlgl "https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/rlgl.h"
click node_raymath "https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/raymath.h"
click node_rcamera "https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/rcamera.h"

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_josh,node_pty,node_config,node_user toneBlue
class node_vt,node_screen,node_render,node_graphics toneAmber
class node_key,node_mouse,node_selection,node_search toneMint
class node_raylib,node_rlgl,node_raymath,node_rcamera toneRose
```

## Components

### Terminal runtime

- **Josh terminal**
- **PTY session**
- **Dix configuration**

### VT engine

- [VT processing](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/terminal.h): `modules/libghostty-vt-jai/include/ghostty/vt/terminal.h`
- [Screen and scrollback](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/screen.h): `modules/libghostty-vt-jai/include/ghostty/vt/screen.h`
- [Terminal rendering](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/render.h): `modules/libghostty-vt-jai/include/ghostty/vt/render.h`
- [Kitty graphics](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/kitty_graphics.h): `modules/libghostty-vt-jai/include/ghostty/vt/kitty_graphics.h`

### Terminal interaction

- [Keyboard encoding](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/key/encoder.h): `modules/libghostty-vt-jai/include/ghostty/vt/key/encoder.h`
- [Mouse encoding](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/mouse/encoder.h): `modules/libghostty-vt-jai/include/ghostty/vt/mouse/encoder.h`
- [Text selection](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/selection.h): `modules/libghostty-vt-jai/include/ghostty/vt/selection.h`
- [Terminal search](https://github.com/demonkingswarn/josh/blob/master/modules/libghostty-vt-jai/include/ghostty/vt/search.h): `modules/libghostty-vt-jai/include/ghostty/vt/search.h`

### Graphics dependencies

- [Raylib interface](https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/raylib.h): `modules/Raylib/include/raylib.h`
- [OpenGL abstraction](https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/rlgl.h): `modules/Raylib/include/rlgl.h`
- [Raylib math](https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/raymath.h): `modules/Raylib/include/raymath.h`
- [Camera utilities](https://github.com/demonkingswarn/josh/blob/master/modules/Raylib/include/rcamera.h): `modules/Raylib/include/rcamera.h`

### Other components

- **User**

## Connections

- User → Josh terminal: launches
- Josh terminal → PTY session: starts PTY
- PTY session → VT processing: provides VT output
- VT processing → Screen and scrollback: maintains state
- Screen and scrollback → Terminal rendering: renders state
- User → Keyboard encoding: types keys
- User → Mouse encoding: reports mouse
- User → Text selection: selects text
- User → Terminal search: searches contents
- User → Dix configuration: configures terminal
- Josh terminal → Kitty graphics: supports images
- Raylib interface → OpenGL abstraction
- Camera utilities → Raylib math: uses math (evidence: `modules/Raylib/include/rcamera.h`)
