# lukeed/mri architecture

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

- Interactive diagram: https://gitdiagram.com/lukeed/mri
- Repository: https://github.com/lukeed/mri

## Overview

mri is a small JavaScript library that parses CLI argument arrays into an argv object. A caller supplies arguments and optional alias, type-casting, default, and unknown-flag options; the parser normalizes options, scans tokens, and returns the result. The implementation also delegates option normalization and value conversion to helpers in the same source file. The callback relationship is supported by the implementation, though its use is optional. This map focuses on runtime behavior, not build or test tooling.

Main entry points: [`src/index.js`](https://github.com/lukeed/mri/blob/master/src/index.js) (Argument parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("CLI caller"))
node_parser["Argument parser<br/>[index.js]"]
node_normalize["Option normalization<br/>[index.js]"]
node_convert["Value conversion<br/>[index.js]"]
node_unknown["Unknown callback"]

node_caller -->|"passes arguments"| node_parser
node_parser -->|"normalizes options"| node_normalize
node_parser -->|"converts values"| node_convert
node_parser -->|"calls on unknown"| node_unknown
node_parser -->|"returns argv"| node_caller

click node_parser "https://github.com/lukeed/mri/blob/master/src/index.js"
click node_normalize "https://github.com/lukeed/mri/blob/master/src/index.js"
click node_convert "https://github.com/lukeed/mri/blob/master/src/index.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_caller,node_unknown toneIndigo
class node_parser,node_normalize,node_convert toneTeal
```

## Components

### Other components

- **CLI caller**
- [Argument parser](https://github.com/lukeed/mri/blob/master/src/index.js): `src/index.js`
- [Option normalization](https://github.com/lukeed/mri/blob/master/src/index.js): `src/index.js`
- [Value conversion](https://github.com/lukeed/mri/blob/master/src/index.js): `src/index.js`
- **Unknown callback**

## Connections

- CLI caller → Argument parser: passes arguments (evidence: `readme.md`)
- Argument parser → Option normalization: normalizes options (evidence: `src/index.js`)
- Argument parser → Value conversion: converts values (evidence: `src/index.js`)
- Argument parser → Unknown callback: calls on unknown (evidence: `src/index.js`)
- Argument parser → CLI caller: returns argv (evidence: `src/index.js`)
