# sitylist94/ml-cli architecture

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

- Interactive diagram: https://gitdiagram.com/sitylist94/ml-cli
- Repository: https://github.com/sitylist94/ml-cli

## Overview

mlcli is a Rust CLI for interactively configuring and generating machine-learning project directories. Its principal workflow collects project details and options, checks whether the selected template is supported, renders the Scikit-learn template with project context, then writes generated files and optional setup scaffolding while refusing to overwrite an existing directory. The README also documents embedded templates and conditional project features; PyTorch and TensorFlow are selectable but not implemented. The map follows the shown runtime calls and documented capabilities; no unsampled command behavior is inferred.

Main entry points: [`src/generator/renderer.rs`](https://github.com/sitylist94/ml-cli/blob/main/src/generator/renderer.rs) (Template renderer), [`src/generator/engine.rs`](https://github.com/sitylist94/ml-cli/blob/main/src/generator/engine.rs) (Generation engine), [`src/commands/init.rs`](https://github.com/sitylist94/ml-cli/blob/main/src/commands/init.rs) (Init prompts), [`src/generator/scaffold.rs`](https://github.com/sitylist94/ml-cli/blob/main/src/generator/scaffold.rs) (Optional scaffolding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and configuration"]
  node_cli["CLI dispatch<br/>[cli.rs]"]
  node_init["Init prompts<br/>[init.rs]"]
  node_config["Project options<br/>[config.rs]"]
end

subgraph group_generation["Generation pipeline"]
  node_registry["Template registry<br/>[registry.rs]"]
  node_engine["Generation engine<br/>[engine.rs]"]
  node_renderer["Template renderer<br/>[renderer.rs]"]
  node_context["Render context<br/>[context.rs]"]
  node_embedded["Embedded templates"]
  node_filesystem["File operations<br/>[filesystem.rs]"]
end

subgraph group_outputs["Project contents"]
  node_template["Scikit-learn template"]
  node_scaffold["Optional scaffolding<br/>[scaffold.rs]"]
  node_project["Generated project"]
end

node_user(("CLI user"))

node_user -->|"runs"| node_cli
node_cli -->|"dispatches"| node_init
node_user -->|"answers prompts"| node_init
node_init -->|"builds options"| node_config
node_init -->|"starts generation"| node_engine
node_engine -->|"passes config"| node_config
node_engine -->|"checks support"| node_registry
node_engine -->|"renders supported"| node_renderer
node_renderer -->|"reads templates"| node_embedded
node_renderer -->|"builds context"| node_context
node_renderer -->|"collects and writes"| node_filesystem
node_renderer -->|"writes options"| node_scaffold
node_template -->|"embedded at build"| node_embedded
node_renderer -->|"creates output"| node_project
node_scaffold -->|"writes files"| node_filesystem
node_scaffold -->|"adds optional files"| node_project

click node_cli "https://github.com/sitylist94/ml-cli/blob/main/src/cli.rs"
click node_init "https://github.com/sitylist94/ml-cli/blob/main/src/commands/init.rs"
click node_config "https://github.com/sitylist94/ml-cli/blob/main/src/config.rs"
click node_registry "https://github.com/sitylist94/ml-cli/blob/main/src/templates/registry.rs"
click node_engine "https://github.com/sitylist94/ml-cli/blob/main/src/generator/engine.rs"
click node_renderer "https://github.com/sitylist94/ml-cli/blob/main/src/generator/renderer.rs"
click node_context "https://github.com/sitylist94/ml-cli/blob/main/src/generator/context.rs"
click node_embedded "https://github.com/sitylist94/ml-cli/blob/main/src/embedded_templates.rs"
click node_template "https://github.com/sitylist94/ml-cli/tree/main/templates/scikit-learn"
click node_filesystem "https://github.com/sitylist94/ml-cli/blob/main/src/generator/filesystem.rs"
click node_scaffold "https://github.com/sitylist94/ml-cli/blob/main/src/generator/scaffold.rs"

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_init,node_config,node_user toneBlue
class node_registry,node_engine,node_renderer,node_context,node_embedded,node_filesystem toneAmber
class node_template,node_scaffold,node_project toneMint
```

## Components

### CLI and configuration

- [CLI dispatch](https://github.com/sitylist94/ml-cli/blob/main/src/cli.rs): `src/cli.rs`
- [Init prompts](https://github.com/sitylist94/ml-cli/blob/main/src/commands/init.rs): `src/commands/init.rs`
- [Project options](https://github.com/sitylist94/ml-cli/blob/main/src/config.rs): `src/config.rs`

### Generation pipeline

- [Template registry](https://github.com/sitylist94/ml-cli/blob/main/src/templates/registry.rs): `src/templates/registry.rs`
- [Generation engine](https://github.com/sitylist94/ml-cli/blob/main/src/generator/engine.rs): `src/generator/engine.rs`
- [Template renderer](https://github.com/sitylist94/ml-cli/blob/main/src/generator/renderer.rs): `src/generator/renderer.rs`
- [Render context](https://github.com/sitylist94/ml-cli/blob/main/src/generator/context.rs): `src/generator/context.rs`
- [Embedded templates](https://github.com/sitylist94/ml-cli/blob/main/src/embedded_templates.rs): `src/embedded_templates.rs`
- [File operations](https://github.com/sitylist94/ml-cli/blob/main/src/generator/filesystem.rs): `src/generator/filesystem.rs`

### Project contents

- [Scikit-learn template](https://github.com/sitylist94/ml-cli/tree/main/templates/scikit-learn): `templates/scikit-learn`
- [Optional scaffolding](https://github.com/sitylist94/ml-cli/blob/main/src/generator/scaffold.rs): `src/generator/scaffold.rs`
- **Generated project**

### Other components

- **CLI user**

## Connections

- CLI user → CLI dispatch: runs (evidence: `README.md`)
- CLI dispatch → Init prompts: dispatches (evidence: `src/cli.rs`)
- CLI user → Init prompts: answers prompts (evidence: `src/commands/init.rs`)
- Init prompts → Project options: builds options (evidence: `src/commands/init.rs`)
- Init prompts → Generation engine: starts generation (evidence: `src/commands/init.rs`)
- Generation engine → Project options: passes config (evidence: `src/generator/engine.rs`)
- Generation engine → Template registry: checks support (evidence: `src/generator/engine.rs`)
- Generation engine → Template renderer: renders supported (evidence: `src/generator/engine.rs`)
- Template renderer → Embedded templates: reads templates (evidence: `src/generator/renderer.rs`)
- Template renderer → Render context: builds context (evidence: `src/generator/renderer.rs`)
- Template renderer → File operations: collects and writes (evidence: `src/generator/renderer.rs`)
- Template renderer → Optional scaffolding: writes options (evidence: `src/generator/renderer.rs`)
- Scikit-learn template → Embedded templates: embedded at build (evidence: `README.md`)
- Template renderer → Generated project: creates output (evidence: `src/generator/renderer.rs`)
- Optional scaffolding → File operations: writes files (evidence: `src/generator/scaffold.rs`)
- Optional scaffolding → Generated project: adds optional files (evidence: `src/generator/scaffold.rs`)
