# denysdovhan/wtfjs architecture

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

- Interactive diagram: https://gitdiagram.com/denysdovhan/wtfjs
- Repository: https://github.com/denysdovhan/wtfjs

## Overview

WTFJS is a JavaScript quirks handbook, also delivered as a pager-based CLI. The user selects the default English manuscript or a language translation; the CLI checks that file, reads it, optionally prepends an update notice, renders its Markdown, and pipes the result to the configured pager. The README additionally presents the collection as educational explanations and a reference for JavaScript behavior. The graph shows the CLI workflow and manuscript capabilities; source evidence is limited to the README and the two indexed excerpts.

Main entry points: [`wtfjs.js`](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js) (Language selection), [`README.md`](https://github.com/denysdovhan/wtfjs/blob/master/README.md) (English manuscript), [`README-pt-br.md`](https://github.com/denysdovhan/wtfjs/blob/master/README-pt-br.md) (Translated manuscripts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI Reader"]
  node_cli["CLI entry<br/>[wtfjs.js]"]
  node_translation["Language selection<br/>[wtfjs.js]"]
  node_filecheck["Manuscript check<br/>[wtfjs.js]"]
  node_stream["File stream<br/>[wtfjs.js]"]
  node_notice["Update notice<br/>[wtfjs.js]"]
  node_markdown["Markdown rendering<br/>[wtfjs.js]"]
  node_pager["Pager output<br/>[wtfjs.js]"]
end

subgraph group_content["Handbook Content"]
  node_manual["English manuscript<br/>[README.md]"]
  node_translations["Translated manuscripts<br/>[README-pt-br.md]"]
  node_examples["JavaScript examples<br/>[README.md]"]
  node_explanations["Quirk explanations<br/>[README.md]"]
  node_reference["Learning reference<br/>[README.md]"]
end

node_reader(("Reader"))

node_reader -->|"runs"| node_cli
node_cli -->|"parses options"| node_translation
node_translation -->|"selects file"| node_filecheck
node_filecheck -->|"checks then reads"| node_stream
node_translation -->|"defaults to"| node_manual
node_translation -->|"selects language"| node_translations
node_stream -->|"checks update"| node_notice
node_stream -->|"renders content"| node_markdown
node_notice -->|"precedes output"| node_pager
node_markdown -->|"pipes result"| node_pager
node_manual -->|"collects"| node_examples
node_manual -->|"explains"| node_explanations
node_manual -->|"serves as"| node_reference

click node_cli "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_translation "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_filecheck "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_stream "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_notice "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_markdown "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_pager "https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js"
click node_manual "https://github.com/denysdovhan/wtfjs/blob/master/README.md"
click node_translations "https://github.com/denysdovhan/wtfjs/blob/master/README-pt-br.md"
click node_examples "https://github.com/denysdovhan/wtfjs/blob/master/README.md"
click node_explanations "https://github.com/denysdovhan/wtfjs/blob/master/README.md"
click node_reference "https://github.com/denysdovhan/wtfjs/blob/master/README.md"

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_translation,node_filecheck,node_stream,node_notice,node_markdown,node_pager toneBlue
class node_manual,node_translations,node_examples,node_explanations,node_reference toneAmber
class node_reader toneIndigo
```

## Components

### CLI Reader

- [CLI entry](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`
- [Language selection](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`
- [Manuscript check](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`
- [File stream](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`
- [Update notice](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`
- [Markdown rendering](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`
- [Pager output](https://github.com/denysdovhan/wtfjs/blob/master/wtfjs.js): `wtfjs.js`

### Handbook Content

- [English manuscript](https://github.com/denysdovhan/wtfjs/blob/master/README.md): `README.md`
- [Translated manuscripts](https://github.com/denysdovhan/wtfjs/blob/master/README-pt-br.md): `README-pt-br.md`
- [JavaScript examples](https://github.com/denysdovhan/wtfjs/blob/master/README.md): `README.md`
- [Quirk explanations](https://github.com/denysdovhan/wtfjs/blob/master/README.md): `README.md`
- [Learning reference](https://github.com/denysdovhan/wtfjs/blob/master/README.md): `README.md`

### Other components

- **Reader**

## Connections

- Reader → CLI entry: runs (evidence: `README.md`)
- CLI entry → Language selection: parses options (evidence: `wtfjs.js`)
- Language selection → Manuscript check: selects file (evidence: `wtfjs.js`)
- Manuscript check → File stream: checks then reads (evidence: `wtfjs.js`)
- Language selection → English manuscript: defaults to (evidence: `wtfjs.js`)
- Language selection → Translated manuscripts: selects language (evidence: `wtfjs.js`)
- File stream → Update notice: checks update (evidence: `wtfjs.js`)
- File stream → Markdown rendering: renders content (evidence: `wtfjs.js`)
- Update notice → Pager output: precedes output (evidence: `wtfjs.js`)
- Markdown rendering → Pager output: pipes result (evidence: `wtfjs.js`)
- English manuscript → JavaScript examples: collects (evidence: `README.md`)
- English manuscript → Quirk explanations: explains (evidence: `README.md`)
- English manuscript → Learning reference: serves as (evidence: `README.md`)
