# anantasam03/type-cli architecture

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

- Interactive diagram: https://gitdiagram.com/anantasam03/type-cli
- Repository: https://github.com/anantasam03/type-cli

## Overview

Go-Type CLI is an interactive typing-practice application. The user selects a mode or a score-management flag; during practice, the CLI chooses a prompt, tracks keystrokes and live statistics, and renders the typing screen. On completion it saves the result and displays the leaderboard, then accepts input for another round or exit. Quotes and code snippets are the prompt source; JSON persistence supports both completed rounds and standalone score viewing. The main workflow is shown in the excerpts; no other runtime subsystem is indicated by the README or source index.

Main entry points: [`main.go`](https://github.com/anantasam03/type-cli/blob/main/main.go) (CLI and round loop), [`storage.go`](https://github.com/anantasam03/type-cli/blob/main/storage.go) (Score persistence), [`highscores.json`](https://github.com/anantasam03/type-cli/blob/main/highscores.json) (JSON leaderboard), [`snippets.go`](https://github.com/anantasam03/type-cli/blob/main/snippets.go) (Prompt selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Practice flow"]
  node_cli["CLI and round loop<br/>[main.go]"]
  node_promptbank["Prompt selection<br/>[snippets.go]"]
  node_telemetry["WPM and accuracy<br/>[main.go]"]
end

subgraph group_interface["Terminal interface"]
  node_typingui["Typing and results UI<br/>[ui.go]"]
end

subgraph group_scores["Scorekeeping"]
  node_scoreops["Score persistence<br/>[storage.go]"]
  node_scorefile[("JSON leaderboard<br/>[highscores.json]")]
  node_standalone["Standalone score listing<br/>[main.go]"]
end

node_user(("Terminal user"))

node_user -->|"starts and controls"| node_cli
node_cli -->|"selects prompt"| node_promptbank
node_cli -->|"calculates stats"| node_telemetry
node_cli -->|"renders screens"| node_typingui
node_cli -->|"saves result"| node_scoreops
node_scoreops -->|"reads and writes"| node_scorefile
node_standalone -->|"loads scores"| node_scoreops
node_cli -->|"deletes on reset"| node_scorefile
node_cli -->|"routes score flag"| node_standalone

click node_cli "https://github.com/anantasam03/type-cli/blob/main/main.go"
click node_promptbank "https://github.com/anantasam03/type-cli/blob/main/snippets.go"
click node_telemetry "https://github.com/anantasam03/type-cli/blob/main/main.go"
click node_typingui "https://github.com/anantasam03/type-cli/blob/main/ui.go"
click node_scoreops "https://github.com/anantasam03/type-cli/blob/main/storage.go"
click node_scorefile "https://github.com/anantasam03/type-cli/blob/main/highscores.json"
click node_standalone "https://github.com/anantasam03/type-cli/blob/main/main.go"

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_promptbank,node_telemetry,node_user toneBlue
class node_typingui toneAmber
class node_scoreops,node_scorefile,node_standalone toneMint
```

## Components

### Practice flow

- [CLI and round loop](https://github.com/anantasam03/type-cli/blob/main/main.go): `main.go`
- [Prompt selection](https://github.com/anantasam03/type-cli/blob/main/snippets.go): `snippets.go`
- [WPM and accuracy](https://github.com/anantasam03/type-cli/blob/main/main.go): `main.go`

### Terminal interface

- [Typing and results UI](https://github.com/anantasam03/type-cli/blob/main/ui.go): `ui.go`

### Scorekeeping

- [Score persistence](https://github.com/anantasam03/type-cli/blob/main/storage.go): `storage.go`
- [JSON leaderboard](https://github.com/anantasam03/type-cli/blob/main/highscores.json): `highscores.json`
- [Standalone score listing](https://github.com/anantasam03/type-cli/blob/main/main.go): `main.go`

### Other components

- **Terminal user**

## Connections

- Terminal user → CLI and round loop: starts and controls (evidence: `README.MD`)
- CLI and round loop → Prompt selection: selects prompt (evidence: `main.go`)
- CLI and round loop → WPM and accuracy: calculates stats (evidence: `main.go`)
- CLI and round loop → Typing and results UI: renders screens (evidence: `main.go`)
- CLI and round loop → Score persistence: saves result (evidence: `main.go`)
- Score persistence → JSON leaderboard: reads and writes (evidence: `storage.go`)
- Standalone score listing → Score persistence: loads scores (evidence: `main.go`)
- CLI and round loop → JSON leaderboard: deletes on reset (evidence: `main.go`)
- CLI and round loop → Standalone score listing: routes score flag (evidence: `main.go`)
