# sivaswami/shell-flow architecture

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

- Interactive diagram: https://gitdiagram.com/sivaswami/shell-flow
- Repository: https://github.com/sivaswami/shell-flow

## Overview

Shell-Flow is a small command-line prototype that reads a shell script, classifies its lines, and emits a Graphviz visualization. Both Python files contain standalone implementations of this workflow; the graph shows their shared design without implying that one calls the other. The sampled code creates command nodes but its edge-building logic is commented out, so no control-flow edges between shell commands are shown.

Main entry points: [`ShellFlow.py`](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py) (Command classifier), [`ShellFlow_new.py`](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow_new.py) (Alternate implementation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Script Analysis"]
  node_loader["Script loader<br/>[ShellFlow.py]"]
  node_normalize["Syntax normalizer<br/>[ShellFlow.py]"]
  node_classifier["Command classifier<br/>[ShellFlow.py]"]
  node_models["Command models<br/>[ShellFlow.py]"]
  node_queue["Command queue<br/>[ShellFlow.py]"]
  node_new_impl["Alternate implementation<br/>[ShellFlow_new.py]"]
end

subgraph group_output["Graph Output"]
  node_dot["Graph builder<br/>[ShellFlow.py]"]
  node_graphviz["Graphviz renderer"]
  node_artifact["siva.gv graph"]
end

node_user(("Script author"))
node_input["Shell script"]

node_user -->|"provides"| node_input
node_input -->|"reads"| node_loader
node_loader -->|"passes lines"| node_normalize
node_normalize -->|"normalizes"| node_classifier
node_classifier -->|"creates"| node_models
node_classifier -->|"enqueues"| node_queue
node_queue -->|"dispatches"| node_models
node_models -->|"adds nodes"| node_dot
node_dot -->|"renders"| node_graphviz
node_graphviz -->|"writes"| node_artifact
node_input -->|"reads"| node_new_impl

click node_loader "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py"
click node_normalize "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py"
click node_classifier "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py"
click node_models "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py"
click node_queue "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py"
click node_new_impl "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow_new.py"
click node_dot "https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py"

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_loader,node_normalize,node_classifier,node_models,node_queue,node_new_impl toneBlue
class node_dot,node_graphviz,node_artifact toneAmber
class node_user,node_input toneIndigo
```

## Components

### Script Analysis

- [Script loader](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py): `ShellFlow.py`
- [Syntax normalizer](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py): `ShellFlow.py`
- [Command classifier](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py): `ShellFlow.py`
- [Command models](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py): `ShellFlow.py`
- [Command queue](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py): `ShellFlow.py`
- [Alternate implementation](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow_new.py): `ShellFlow_new.py`

### Graph Output

- [Graph builder](https://github.com/sivaswami/shell-flow/blob/master/ShellFlow.py): `ShellFlow.py`
- **Graphviz renderer**
- **siva.gv graph**

### Other components

- **Script author**
- **Shell script**

## Connections

- Script author → Shell script: provides (evidence: `README.md`)
- Shell script → Script loader: reads (evidence: `ShellFlow.py`)
- Script loader → Syntax normalizer: passes lines (evidence: `ShellFlow.py`)
- Syntax normalizer → Command classifier: normalizes (evidence: `ShellFlow.py`)
- Command classifier → Command models: creates (evidence: `ShellFlow.py`)
- Command classifier → Command queue: enqueues (evidence: `ShellFlow.py`)
- Command queue → Command models: dispatches (evidence: `ShellFlow.py`)
- Command models → Graph builder: adds nodes (evidence: `ShellFlow.py`)
- Graph builder → Graphviz renderer: renders (evidence: `ShellFlow.py`)
- Graphviz renderer → siva.gv graph: writes
- Shell script → Alternate implementation: reads (evidence: `ShellFlow_new.py`)
