graph LR
CLI_Entrypoint["CLI Entrypoint"]
Command_Dispatcher["Command Dispatcher"]
Analysis_Options_Loader["Analysis Options Loader"]
Analyzer_Adapter["Analyzer Adapter"]
Image_Analyse_Core["Image Analyse Core"]
CI_Evaluator["CI Evaluator"]
Exporter_Adapter["Exporter Adapter"]
UI_App["UI App"]
Unclassified["Unclassified"]
CLI_Entrypoint -- "creates & executes" --> Command_Dispatcher
Command_Dispatcher -- "loads" --> Analysis_Options_Loader
Command_Dispatcher -- "invokes" --> Analyzer_Adapter
Analyzer_Adapter -- "delegates" --> Image_Analyse_Core
Command_Dispatcher -- "passes" --> UI_App
Command_Dispatcher -- "passes" --> CI_Evaluator
CI_Evaluator -- "exports" --> Exporter_Adapter
Command_Dispatcher -- "exports" --> Exporter_Adapter
click Command_Dispatcher href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/dive/Command_Dispatcher.md" "Details"
The cmd/dive/cli subsystem is the command‑driven front‑end of Dive. The entry point (cli.Application / cli.Command) builds a clio.Application and creates the root Cobra command, which is handed to the Command Dispatcher. The dispatcher loads configuration via the Analysis Options Loader, then orchestrates the execution path: in run mode it uses the Analyzer Adapter to delegate to the pure Image Analyse Core, producing an image.Analysis that is fed to the UI App for terminal rendering; in CI mode it passes the analysis to the CI Evaluator which runs rule checks and yields a report. When the user requests export, the Exporter Adapter serialises the analysis (or CI evaluation) to JSON/YAML and writes it to the host file system via afero. This clean separation—entry point → dispatcher → options → core analysis → UI / CI / export—provides a concise, high‑level flow ideal for documentation and diagramming.
Builds a clio.Application, creates the root Cobra command and launches it.
Related Classes/Methods:
Command Dispatcher [Expand]
Registers top‑level commands, wires flags, selects UI, and orchestrates the run‑pipeline.
Related Classes/Methods:
Parses CLI flags, config files and environment variables into strongly‑typed option structs.
Related Classes/Methods:
Calls the pure core image.Analyze and publishes progress events on the internal bus.
Related Classes/Methods:
Pure business logic – builds layer trees, computes efficiency, and identifies inefficiencies.
Related Classes/Methods:
Executes the configured CI rule set against an image.Analysis and produces a pass/fail report.
Related Classes/Methods:
cmd/dive/cli/internal/command/ci/evaluator.go:NewEvaluatorcmd/dive/cli/internal/command/ci/evaluator.go:Evaluate
Serialises an image.Analysis (or CI evaluation) to JSON/YAML and writes it to the host file system via afero.
Related Classes/Methods:
cmd/dive/cli/internal/command/adapter/exporter.go:NewExportercmd/dive/cli/internal/command/adapter/exporter.go:ExportTo
Renders the analysis in a terminal UI, binds the LayerSetState view‑model to UI widgets, and handles key‑bindings and the event loop.
Related Classes/Methods:
Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)
Related Classes/Methods: None