# maxmukhtarov/dkview architecture

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

- Interactive diagram: https://gitdiagram.com/maxmukhtarov/dkview
- Repository: https://github.com/maxmukhtarov/dkview

## Overview

dkview is a Python CLI for making Docker and Swarm operations readable on a terminal. The main workflow dispatches a command to either an operational view or a Docker command, gathers or transforms its output, and renders a width-fitted table or live view. Documented operational branches include health diagnosis, grouped log errors, a host dashboard, image cleanup, inspection, and logs. Source excerpts and the SOURCE INDEX support the main dispatch and rendering relationships; unsampled feature internals are represented without inferred internal call chains.

Main entry points: [`src/dkview/cli.py`](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/cli.py) (CLI dispatch), [`src/dkview/runner.py`](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/runner.py) (Process runner), [`src/dkview/table.py`](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/table.py) (Table model), [`src/dkview/features/doctor.py`](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/doctor.py) (Service diagnosis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_cli["CLI dispatch<br/>[cli.py]"]
  node_options["View options<br/>[options.py]"]
end

subgraph group_operations["Operator views"]
  node_doctor["Service diagnosis<br/>[doctor.py]"]
  node_errors["Log error grouping<br/>[errors.py]"]
  node_dashboard["Host dashboard<br/>[dashboard.py]"]
  node_clean["Image cleanup<br/>[clean.py]"]
  node_images["Image views<br/>[images.py]"]
  node_inspect["Object inspection<br/>[inspect.py]"]
  node_logs["Log viewing<br/>[logs.py]"]
  node_live["Live refresh<br/>[live.py]"]
  node_tables["Docker table views<br/>[tables.py]"]
end

subgraph group_docker["Docker interaction"]
  node_engine["Engine selection<br/>[engine.py]"]
  node_docker_command["Command classification<br/>[docker.py]"]
  node_runner["Process runner<br/>[runner.py]"]
end

subgraph group_data["Output processing"]
  node_formats["Output formats<br/>[formats.py]"]
  node_transform["Table transforms<br/>[transform.py]"]
  node_units["Unit formatting<br/>[units.py]"]
  node_table["Table model<br/>[table.py]"]
end

subgraph group_render["Terminal rendering"]
  node_layout["Width-fit layout<br/>[layout.py]"]
  node_styles["Output styling<br/>[styles.py]"]
  node_ansi["ANSI and terminal<br/>[ansi.py]"]
end

node_operator(("Operator"))
node_docker_cli["Docker or Podman"]

node_operator -->|"runs command"| node_cli
node_cli -->|"builds options"| node_options
node_cli -->|"selects engine"| node_engine
node_cli -->|"classifies command"| node_docker_command
node_cli -->|"dispatches diagnosis"| node_doctor
node_cli -->|"dispatches errors"| node_errors
node_cli -->|"dispatches dashboard"| node_dashboard
node_cli -->|"dispatches cleanup"| node_clean
node_cli -->|"dispatches images"| node_images
node_cli -->|"dispatches inspection"| node_inspect
node_cli -->|"dispatches logs"| node_logs
node_cli -->|"dispatches refresh"| node_live
node_cli -->|"dispatches tables"| node_tables
node_cli -->|"passes through"| node_runner
node_docker_command -->|"resolves engine"| node_engine
node_runner -->|"runs process"| node_docker_cli
node_doctor -->|"captures commands"| node_runner
node_errors -->|"captures logs"| node_runner
node_tables -->|"selects formats"| node_formats
node_formats -->|"checks command"| node_docker_command
node_formats -->|"builds table"| node_table
node_transform -->|"transforms table"| node_table
node_layout -->|"renders table"| node_table
node_layout -->|"measures output"| node_ansi
node_table -->|"strips colors"| node_ansi
node_styles -->|"applies color"| node_ansi
node_images -->|"captures images"| node_runner
node_dashboard -->|"captures host data"| node_runner
node_doctor -.->|"builds report"| node_table
node_errors -.->|"builds report"| node_table
node_dashboard -.->|"renders view"| node_layout
node_units -.->|"formats units"| node_transform

click node_cli "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/cli.py"
click node_options "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/options.py"
click node_engine "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/engine.py"
click node_docker_command "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/docker.py"
click node_runner "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/runner.py"
click node_doctor "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/doctor.py"
click node_errors "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/errors.py"
click node_dashboard "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/dashboard.py"
click node_clean "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/clean.py"
click node_images "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/images.py"
click node_inspect "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/inspect.py"
click node_logs "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/logs.py"
click node_live "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/live.py"
click node_tables "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/tables.py"
click node_formats "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/formats.py"
click node_transform "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/transform.py"
click node_units "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/units.py"
click node_table "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/table.py"
click node_layout "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/layout.py"
click node_styles "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/styles.py"
click node_ansi "https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/ansi.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_cli,node_options toneBlue
class node_doctor,node_errors,node_dashboard,node_clean,node_images,node_inspect,node_logs,node_live,node_tables toneAmber
class node_engine,node_docker_command,node_runner toneMint
class node_formats,node_transform,node_units,node_table toneRose
class node_layout,node_styles,node_ansi,node_operator,node_docker_cli toneIndigo
```

## Components

### Command entry

- [CLI dispatch](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/cli.py): `src/dkview/cli.py`
- [View options](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/options.py): `src/dkview/options.py`

### Operator views

- [Service diagnosis](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/doctor.py): `src/dkview/features/doctor.py`
- [Log error grouping](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/errors.py): `src/dkview/features/errors.py`
- [Host dashboard](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/dashboard.py): `src/dkview/features/dashboard.py`
- [Image cleanup](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/clean.py): `src/dkview/features/clean.py`
- [Image views](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/images.py): `src/dkview/features/images.py`
- [Object inspection](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/inspect.py): `src/dkview/features/inspect.py`
- [Log viewing](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/logs.py): `src/dkview/features/logs.py`
- [Live refresh](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/live.py): `src/dkview/features/live.py`
- [Docker table views](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/features/tables.py): `src/dkview/features/tables.py`

### Docker interaction

- [Engine selection](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/engine.py): `src/dkview/engine.py`
- [Command classification](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/docker.py): `src/dkview/docker.py`
- [Process runner](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/runner.py): `src/dkview/runner.py`

### Output processing

- [Output formats](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/formats.py): `src/dkview/formats.py`
- [Table transforms](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/transform.py): `src/dkview/transform.py`
- [Unit formatting](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/units.py): `src/dkview/units.py`
- [Table model](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/table.py): `src/dkview/table.py`

### Terminal rendering

- [Width-fit layout](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/layout.py): `src/dkview/layout.py`
- [Output styling](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/styles.py): `src/dkview/styles.py`
- [ANSI and terminal](https://github.com/maxmukhtarov/dkview/blob/feature/src/dkview/ansi.py): `src/dkview/ansi.py`

### Other components

- **Operator**
- **Docker or Podman**

## Connections

- Operator → CLI dispatch: runs command (evidence: `README.md`)
- CLI dispatch → View options: builds options (evidence: `src/dkview/cli.py`)
- CLI dispatch → Engine selection: selects engine (evidence: `src/dkview/cli.py`)
- CLI dispatch → Command classification: classifies command (evidence: `src/dkview/cli.py`)
- CLI dispatch → Service diagnosis: dispatches diagnosis (evidence: `src/dkview/cli.py`)
- CLI dispatch → Log error grouping: dispatches errors (evidence: `src/dkview/cli.py`)
- CLI dispatch → Host dashboard: dispatches dashboard (evidence: `src/dkview/cli.py`)
- CLI dispatch → Image cleanup: dispatches cleanup (evidence: `src/dkview/cli.py`)
- CLI dispatch → Image views: dispatches images (evidence: `src/dkview/cli.py`)
- CLI dispatch → Object inspection: dispatches inspection (evidence: `src/dkview/cli.py`)
- CLI dispatch → Log viewing: dispatches logs (evidence: `src/dkview/cli.py`)
- CLI dispatch → Live refresh: dispatches refresh (evidence: `src/dkview/cli.py`)
- CLI dispatch → Docker table views: dispatches tables (evidence: `src/dkview/cli.py`)
- CLI dispatch → Process runner: passes through (evidence: `src/dkview/cli.py`)
- Command classification → Engine selection: resolves engine (evidence: `src/dkview/docker.py`)
- Process runner → Docker or Podman: runs process (evidence: `src/dkview/runner.py`)
- Service diagnosis → Process runner: captures commands (evidence: `src/dkview/features/doctor.py`)
- Log error grouping → Process runner: captures logs (evidence: `src/dkview/features/errors.py`)
- Docker table views → Output formats: selects formats (evidence: `src/dkview/features/tables.py`)
- Output formats → Command classification: checks command (evidence: `src/dkview/formats.py`)
- Output formats → Table model: builds table (evidence: `src/dkview/formats.py`)
- Table transforms → Table model: transforms table (evidence: `src/dkview/transform.py`)
- Width-fit layout → Table model: renders table (evidence: `src/dkview/layout.py`)
- Width-fit layout → ANSI and terminal: measures output (evidence: `src/dkview/layout.py`)
- Table model → ANSI and terminal: strips colors (evidence: `src/dkview/table.py`)
- Output styling → ANSI and terminal: applies color (evidence: `src/dkview/styles.py`)
- Image views → Process runner: captures images (evidence: `src/dkview/features/images.py`)
- Host dashboard → Process runner: captures host data (evidence: `src/dkview/features/dashboard.py`)
- Service diagnosis → Table model: builds report (evidence: `src/dkview/features/doctor.py`)
- Log error grouping → Table model: builds report (evidence: `src/dkview/features/errors.py`)
- Host dashboard → Width-fit layout: renders view (evidence: `src/dkview/features/dashboard.py`)
- Unit formatting → Table transforms: formats units
