# amonhoorilal/ascii-magic-art architecture

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

- Interactive diagram: https://gitdiagram.com/amonhoorilal/ascii-magic-art
- Repository: https://github.com/amonhoorilal/ascii-magic-art

## Overview

ASCII Magic Art is a library of animated ASCII pieces, with a CLI for browsing and playing them and a browser runtime for embedding them in web pages. A piece produces timed text and optional color frames; rendering can restyle those frames or draw them to a canvas. The README also documents image-based scenes, exports, and prompt generation. Edges are limited to README statements and source-index references; the full CLI and runtime implementations were not inspected.

Main entry points: [`runtime/player.js`](https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/player.js) (Frame player), [`bin/cli.js`](https://github.com/amonhoorilal/ascii-magic-art/blob/main/bin/cli.js) (CLI), [`lib/kit.js`](https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/kit.js) (Grid toolkit), [`runtime/glyphs.js`](https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/glyphs.js) (Glyph restyling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Art catalog"]
  node_piece_library["Piece library"]
  node_landmark_pieces["Landmark scenes"]
  node_interface_pieces["Interface pieces"]
  node_image_pieces["Image scenes<br/>[ocean-sunset.js]"]
end

subgraph group_creation["Piece toolkit"]
  node_grid_toolkit["Grid toolkit<br/>[kit.js]"]
  node_scene_toolkit["Scene toolkit<br/>[scene.js]"]
  node_image_motion["Image motion<br/>[image.js]"]
end

subgraph group_runtime["Rendering runtime"]
  node_frame_player["Frame player<br/>[player.js]"]
  node_glyph_restyling["Glyph restyling<br/>[glyphs.js]"]
  node_canvas_renderer["Canvas renderer<br/>[canvas.js]"]
end

subgraph group_entrypoints["User entrypoints"]
  node_cli["CLI<br/>[cli.js]"]
  node_web_element["Web element<br/>[ascii.js]"]
end

node_terminal_user(("Terminal user"))
node_web_developer(("Web developer"))

node_terminal_user -->|"runs commands"| node_cli
node_web_developer -->|"embeds element"| node_web_element
node_cli -->|"loads pieces"| node_piece_library
node_cli -->|"restyles frames"| node_glyph_restyling
node_cli -->|"applies parameters"| node_frame_player
node_web_element -->|"uses player"| node_frame_player
node_landmark_pieces -->|"draws with"| node_grid_toolkit
node_interface_pieces -->|"draws with"| node_grid_toolkit
node_image_pieces -->|"creates motion"| node_image_motion
node_scene_toolkit -->|"uses helpers"| node_grid_toolkit
node_frame_player -->|"restyles frames"| node_glyph_restyling
node_frame_player -->|"renders frames"| node_canvas_renderer
node_canvas_renderer -->|"uses glyph metrics"| node_glyph_restyling
node_frame_player -.->|"plays pieces"| node_piece_library

click node_cli "https://github.com/amonhoorilal/ascii-magic-art/blob/main/bin/cli.js"
click node_web_element "https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/ascii.js"
click node_piece_library "https://github.com/amonhoorilal/ascii-magic-art/tree/main/pieces"
click node_landmark_pieces "https://github.com/amonhoorilal/ascii-magic-art/blob/main/pieces/east-river-bridge-sunrise.js"
click node_interface_pieces "https://github.com/amonhoorilal/ascii-magic-art/blob/main/pieces/sql-query-runner.js"
click node_image_pieces "https://github.com/amonhoorilal/ascii-magic-art/blob/main/pieces/ocean-sunset.js"
click node_grid_toolkit "https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/kit.js"
click node_scene_toolkit "https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/scene.js"
click node_image_motion "https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/image.js"
click node_frame_player "https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/player.js"
click node_glyph_restyling "https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/glyphs.js"
click node_canvas_renderer "https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/canvas.js"

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_piece_library,node_landmark_pieces,node_interface_pieces,node_image_pieces,node_terminal_user toneBlue
class node_grid_toolkit,node_scene_toolkit,node_image_motion toneAmber
class node_frame_player,node_glyph_restyling,node_canvas_renderer toneMint
class node_cli,node_web_element toneRose
class node_web_developer toneIndigo
```

## Components

### Art catalog

- [Piece library](https://github.com/amonhoorilal/ascii-magic-art/tree/main/pieces): `pieces`
- [Landmark scenes](https://github.com/amonhoorilal/ascii-magic-art/blob/main/pieces/east-river-bridge-sunrise.js): `pieces/east-river-bridge-sunrise.js`
- [Interface pieces](https://github.com/amonhoorilal/ascii-magic-art/blob/main/pieces/sql-query-runner.js): `pieces/sql-query-runner.js`
- [Image scenes](https://github.com/amonhoorilal/ascii-magic-art/blob/main/pieces/ocean-sunset.js): `pieces/ocean-sunset.js`

### Piece toolkit

- [Grid toolkit](https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/kit.js): `lib/kit.js`
- [Scene toolkit](https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/scene.js): `lib/scene.js`
- [Image motion](https://github.com/amonhoorilal/ascii-magic-art/blob/main/lib/image.js): `lib/image.js`

### Rendering runtime

- [Frame player](https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/player.js): `runtime/player.js`
- [Glyph restyling](https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/glyphs.js): `runtime/glyphs.js`
- [Canvas renderer](https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/canvas.js): `runtime/canvas.js`

### User entrypoints

- [CLI](https://github.com/amonhoorilal/ascii-magic-art/blob/main/bin/cli.js): `bin/cli.js`
- [Web element](https://github.com/amonhoorilal/ascii-magic-art/blob/main/runtime/ascii.js): `runtime/ascii.js`

### Other components

- **Terminal user**
- **Web developer**

## Connections

- Terminal user → CLI: runs commands
- Web developer → Web element: embeds element
- CLI → Piece library: loads pieces (evidence: `bin/cli.js`)
- CLI → Glyph restyling: restyles frames (evidence: `bin/cli.js`)
- CLI → Frame player: applies parameters (evidence: `bin/cli.js`)
- Web element → Frame player: uses player (evidence: `runtime/ascii.js`)
- Landmark scenes → Grid toolkit: draws with (evidence: `pieces/east-river-bridge-sunrise.js`)
- Interface pieces → Grid toolkit: draws with (evidence: `pieces/sql-query-runner.js`)
- Image scenes → Image motion: creates motion (evidence: `pieces/ocean-sunset.js`)
- Scene toolkit → Grid toolkit: uses helpers (evidence: `lib/scene.js`)
- Frame player → Glyph restyling: restyles frames (evidence: `runtime/player.js`)
- Frame player → Canvas renderer: renders frames (evidence: `runtime/player.js`)
- Canvas renderer → Glyph restyling: uses glyph metrics (evidence: `runtime/canvas.js`)
- Frame player → Piece library: plays pieces
