# sloria/doitlive architecture

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

- Interactive diagram: https://gitdiagram.com/sloria/doitlive
- Repository: https://github.com/sloria/doitlive

## Overview

doitlive is a terminal presentation tool: a presenter invokes its CLI with a shell-command session file, then watches commands appear as if typed and run in a shell. The CLI also supports recording sessions, prompt-theme utilities, and embedded Python/IPython blocks. The sampled source shows the terminal input, prompt styling, shell execution, and Python-console layers; the excerpts are partial, so some CLI dispatch details are not established and are omitted or marked unverified.

Main entry points: [`src/doitlive/keyboard.py`](https://github.com/sloria/doitlive/blob/main/src/doitlive/keyboard.py) (Keyboard playback), [`src/doitlive/styling.py`](https://github.com/sloria/doitlive/blob/main/src/doitlive/styling.py) (Prompt styling), [`src/doitlive/cli.py`](https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py) (CLI commands), [`src/doitlive/python_consoles.py`](https://github.com/sloria/doitlive/blob/main/src/doitlive/python_consoles.py) (Python player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and sessions"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_session_parser["Session parsing<br/>[cli.py]"]
  node_recorder["Session recorder<br/>[cli.py]"]
end

subgraph group_playback["Command playback"]
  node_playback_runner["Playback runner<br/>[cli.py]"]
  node_keyboard["Keyboard playback<br/>[keyboard.py]"]
end

subgraph group_terminal["Terminal presentation"]
  node_prompt["Prompt styling<br/>[styling.py]"]
  node_terminal_utils["Terminal mode<br/>[termutils.py]"]
  node_vcs["VCS prompt data<br/>[version_control.py]"]
  node_theme_tools["Theme tools<br/>[cli.py]"]
end

subgraph group_consoles["Interactive consoles"]
  node_python_console["Python player<br/>[python_consoles.py]"]
  node_python_recorder["Python recorder<br/>[python_consoles.py]"]
  node_ipython_launcher["IPython launcher<br/>[__init__.py]"]
  node_ipython_app["IPython shell<br/>[app.py]"]
end

node_presenter(("Presenter"))
node_session_file["Session file"]
node_shell["System shell"]

node_presenter -->|"invokes"| node_cli
node_session_file -->|"provides commands"| node_session_parser
node_cli -->|"parses"| node_session_parser
node_session_parser -->|"supplies commands"| node_playback_runner
node_cli -->|"runs session"| node_playback_runner
node_playback_runner -->|"plays commands"| node_keyboard
node_keyboard -->|"executes commands"| node_shell
node_keyboard -->|"renders prompt"| node_prompt
node_keyboard -->|"uses raw mode"| node_terminal_utils
node_playback_runner -->|"records sessions"| node_recorder
node_recorder -->|"captures Python"| node_python_recorder
node_recorder -->|"writes session"| node_session_file
node_theme_tools -->|"previews themes"| node_prompt
node_prompt -->|"gets branch data"| node_vcs
node_python_console -->|"types commands"| node_keyboard
node_python_console -->|"renders prompt"| node_prompt
node_cli -.->|"starts IPython"| node_ipython_launcher
node_ipython_launcher -->|"launches app"| node_ipython_app
node_ipython_app -->|"uses prompt output"| node_prompt

click node_cli "https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py"
click node_session_parser "https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py"
click node_recorder "https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py"
click node_playback_runner "https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py"
click node_keyboard "https://github.com/sloria/doitlive/blob/main/src/doitlive/keyboard.py"
click node_prompt "https://github.com/sloria/doitlive/blob/main/src/doitlive/styling.py"
click node_terminal_utils "https://github.com/sloria/doitlive/blob/main/src/doitlive/termutils.py"
click node_vcs "https://github.com/sloria/doitlive/blob/main/src/doitlive/version_control.py"
click node_theme_tools "https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py"
click node_python_console "https://github.com/sloria/doitlive/blob/main/src/doitlive/python_consoles.py"
click node_python_recorder "https://github.com/sloria/doitlive/blob/main/src/doitlive/python_consoles.py"
click node_ipython_launcher "https://github.com/sloria/doitlive/blob/main/src/doitlive/ipython/__init__.py"
click node_ipython_app "https://github.com/sloria/doitlive/blob/main/src/doitlive/ipython/app.py"

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_cli,node_session_parser,node_recorder toneBlue
class node_playback_runner,node_keyboard toneAmber
class node_prompt,node_terminal_utils,node_vcs,node_theme_tools toneMint
class node_python_console,node_python_recorder,node_ipython_launcher,node_ipython_app toneRose
class node_presenter,node_session_file,node_shell toneIndigo
```

## Components

### CLI and sessions

- [CLI commands](https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py): `src/doitlive/cli.py`
- [Session parsing](https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py): `src/doitlive/cli.py`
- [Session recorder](https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py): `src/doitlive/cli.py`

### Command playback

- [Playback runner](https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py): `src/doitlive/cli.py`
- [Keyboard playback](https://github.com/sloria/doitlive/blob/main/src/doitlive/keyboard.py): `src/doitlive/keyboard.py`

### Terminal presentation

- [Prompt styling](https://github.com/sloria/doitlive/blob/main/src/doitlive/styling.py): `src/doitlive/styling.py`
- [Terminal mode](https://github.com/sloria/doitlive/blob/main/src/doitlive/termutils.py): `src/doitlive/termutils.py`
- [VCS prompt data](https://github.com/sloria/doitlive/blob/main/src/doitlive/version_control.py): `src/doitlive/version_control.py`
- [Theme tools](https://github.com/sloria/doitlive/blob/main/src/doitlive/cli.py): `src/doitlive/cli.py`

### Interactive consoles

- [Python player](https://github.com/sloria/doitlive/blob/main/src/doitlive/python_consoles.py): `src/doitlive/python_consoles.py`
- [Python recorder](https://github.com/sloria/doitlive/blob/main/src/doitlive/python_consoles.py): `src/doitlive/python_consoles.py`
- [IPython launcher](https://github.com/sloria/doitlive/blob/main/src/doitlive/ipython/__init__.py): `src/doitlive/ipython/__init__.py`
- [IPython shell](https://github.com/sloria/doitlive/blob/main/src/doitlive/ipython/app.py): `src/doitlive/ipython/app.py`

### Other components

- **Presenter**
- **Session file**
- **System shell**

## Connections

- Presenter → CLI commands: invokes (evidence: `README.rst`)
- Session file → Session parsing: provides commands (evidence: `README.rst`)
- CLI commands → Session parsing: parses (evidence: `src/doitlive/cli.py`)
- Session parsing → Playback runner: supplies commands (evidence: `src/doitlive/cli.py`)
- CLI commands → Playback runner: runs session (evidence: `src/doitlive/cli.py`)
- Playback runner → Keyboard playback: plays commands (evidence: `src/doitlive/cli.py`)
- Keyboard playback → System shell: executes commands (evidence: `src/doitlive/keyboard.py`)
- Keyboard playback → Prompt styling: renders prompt (evidence: `src/doitlive/keyboard.py`)
- Keyboard playback → Terminal mode: uses raw mode (evidence: `src/doitlive/keyboard.py`)
- Playback runner → Session recorder: records sessions (evidence: `src/doitlive/cli.py`)
- Session recorder → Python recorder: captures Python (evidence: `src/doitlive/cli.py`)
- Session recorder → Session file: writes session (evidence: `src/doitlive/cli.py`)
- Theme tools → Prompt styling: previews themes (evidence: `src/doitlive/cli.py`)
- Prompt styling → VCS prompt data: gets branch data (evidence: `src/doitlive/styling.py`)
- Python player → Keyboard playback: types commands (evidence: `src/doitlive/python_consoles.py`)
- Python player → Prompt styling: renders prompt (evidence: `src/doitlive/python_consoles.py`)
- CLI commands → IPython launcher: starts IPython (evidence: `src/doitlive/cli.py`)
- IPython launcher → IPython shell: launches app (evidence: `src/doitlive/ipython/__init__.py`)
- IPython shell → Prompt styling: uses prompt output (evidence: `src/doitlive/ipython/app.py`)
