# musialny/cli-executor architecture

> Architecture diagram of the GitHub repository musialny/cli-executor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/musialny/cli-executor
- Repository: https://github.com/musialny/cli-executor

## Overview

##### Project type and purpose
- This is a C++ CLI-Executor library plus a reference CLI application (“cli-example”) and a suite of tests.
- The library (“cli-preprocessor”) implements a small pipeline for preprocessing and executing CLI commands in modular pieces.

##### File structure
- Top-level:
- CMakeLists.txt + CMakePresets.json – build orchestration
- vcpkg.json / vcpkg-configuration.json – dependency management
- LanguageSubset.md – spec for supported CLI language subset
- Subproject “cli-preprocessor”:
- src/CliPreprocessor.cppm
- src/CliActionsContainer.cppm
- src/CliCommandExecutor.cppm
- src/CliCommandParameters.cppm
- tests/ – unit tests for the executor
- Subproject “cli-example”:
- src/main.cpp – demo entry point
- src/commands/Version.cppm, Commands.cppm – example commands

##### README for additional insights
- Core dependencies: CMake, vcpkg, clang/clang++, ninja
- It is designed to be built via CMake + vcpkg using clang toolchain and ninja
- No external services beyond local toolchain

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Documentation
    README["README.md"]:::doc
    LanguageSpec["LanguageSubset.md"]:::doc
    README -->|references spec| LanguageSpec

    %% Build System
    subgraph "Build System"
        direction TB
        RootCMake["CMakeLists.txt"]:::build
        Presets["CMakePresets.json"]:::build
        VcpkgManifest["vcpkg.json"]:::build
        VcpkgConfig["vcpkg-configuration.json"]:::build
        Ninja["Ninja"]:::external
        Clang["clang/clang++"]:::external
    end

    %% Build orchestration flow
    RootCMake -->|uses| Presets
    RootCMake -->|invokes| Ninja
    Presets -->|configures| Ninja
    VcpkgManifest -->|provides deps| VcpkgConfig
    VcpkgConfig -->|integrates with| RootCMake
    Ninja -->|executes| Clang

    %% CLI-Preprocessor Library
    subgraph "cli-preprocessor library"
        direction TB
        LibCMake["cli-preprocessor/CMakeLists.txt"]:::build
        Preprocessor["CliPreprocessor.cppm"]:::library
        Parameters["CliCommandParameters.cppm"]:::library
        ExecutorMod["CliCommandExecutor.cppm"]:::library
        Actions["CliActionsContainer.cppm"]:::library
    end

    %% Library build
    Clang -->|compiles| LibCMake
    LibCMake -->|builds modules| Preprocessor
    LibCMake -->|builds modules| Parameters
    LibCMake -->|builds modules| ExecutorMod
    LibCMake -->|builds modules| Actions

    %% Internal library pipeline
    Preprocessor -->|parses input| Parameters
    Preprocessor -->|dispatches| ExecutorMod
    ExecutorMod -->|calls| Actions

    %% CLI-Example Application
    subgraph "cli-example application"
        direction TB
        ExampleCMake["cli-example/CMakeLists.txt"]:::build
        MainApp["main.cpp"]:::consumer
        CommandsMod["Commands.cppm"]:::consumer
        VersionMod["Version.cppm"]:::consumer
    end

    %% Example build and link
    Clang -->|compiles| ExampleCMake
    ExampleCMake -->|builds| MainApp
    ExampleCMake -->|builds| CommandsMod
    ExampleCMake -->|builds| VersionMod
    MainApp -->|links against| Preprocessor
    CommandsMod -->|links against| Preprocessor
    VersionMod -->|links against| Preprocessor

    %% Test Suite
    subgraph "Test Suite"
        direction TB
        TestCMake["cli-preprocessor/tests/CMakeLists.txt"]:::build
        ExecutorTests["CliCommandExecutorTests.cpp"]:::consumer
    end

    Clang -->|compiles| TestCMake
    TestCMake -->|builds| ExecutorTests
    ExecutorTests -->|tests| ExecutorMod

    %% Click Events
    click RootCMake "https://github.com/musialny/cli-executor/blob/master//CMakeLists.txt"
    click Presets "https://github.com/musialny/cli-executor/blob/master//CMakePresets.json"
    click VcpkgManifest "https://github.com/musialny/cli-executor/blob/master//vcpkg.json"
    click VcpkgConfig "https://github.com/musialny/cli-executor/blob/master//vcpkg-configuration.json"
    click LanguageSpec "https://github.com/musialny/cli-executor/blob/master//LanguageSubset.md"
    click README "https://github.com/musialny/cli-executor/blob/master//README.md"
    click LibCMake "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/CMakeLists.txt"
    click Preprocessor "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/src/CliPreprocessor.cppm"
    click Parameters "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/src/CliCommandParameters.cppm"
    click ExecutorMod "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/src/CliCommandExecutor.cppm"
    click Actions "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/src/CliActionsContainer.cppm"
    click TestCMake "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/tests/CMakeLists.txt"
    click ExecutorTests "https://github.com/musialny/cli-executor/blob/master/cli-preprocessor/tests/CliCommandExecutorTests.cpp"
    click ExampleCMake "https://github.com/musialny/cli-executor/blob/master/cli-example/CMakeLists.txt"
    click MainApp "https://github.com/musialny/cli-executor/blob/master/cli-example/src/main.cpp"
    click CommandsMod "https://github.com/musialny/cli-executor/blob/master/cli-example/src/commands/Commands.cppm"
    click VersionMod "https://github.com/musialny/cli-executor/blob/master/cli-example/src/commands/Version.cppm"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:1px;
    classDef build fill:#bbf,stroke:#333,stroke-width:1px;
    classDef library fill:#bfb,stroke:#333,stroke-width:1px;
    classDef consumer fill:#ffb,stroke:#333,stroke-width:1px;
    classDef doc fill:#fee,stroke:#333,stroke-width:1px;
```
