# max-mend/smidr architecture

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

- Interactive diagram: https://gitdiagram.com/max-mend/smidr
- Repository: https://github.com/max-mend/smidr

## Overview

Smidr is a Cargo-inspired C/C++ project manager: users define projects and dependencies in Smidr.toml, scaffold or load a project, resolve dependencies, then compile and link binaries or libraries. Its runtime also supports workspaces, formatting, linting, dependency edits, and compile_commands.json. The sampled code shows the CLI dispatch and compiler/build-system components; several README-listed command implementations were not sampled, so those capability links are documented rather than source-verified.

Main entry points: [`src/builder.rs`](https://github.com/max-mend/smidr/blob/main/src/builder.rs) (Compile and link), [`src/main.rs`](https://github.com/max-mend/smidr/blob/main/src/main.rs) (Command dispatch), [`src/toolchain.rs`](https://github.com/max-mend/smidr/blob/main/src/toolchain.rs) (Build-system selection), [`src/project.rs`](https://github.com/max-mend/smidr/blob/main/src/project.rs) (Project lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_cli["CLI arguments<br/>[cli.rs]"]
  node_dispatch["Command dispatch<br/>[main.rs]"]
end

subgraph group_projects["Projects and configuration"]
  node_project["Project lifecycle<br/>[project.rs]"]
  node_manifest["Manifest model<br/>[config.rs]"]
  node_templates["Scaffold templates<br/>[main.c]"]
end

subgraph group_dependencies["Dependency resolution"]
  node_resolver["Dependency sources<br/>[resolver.rs]"]
  node_depbuild["Build-system selection<br/>[toolchain.rs]"]
  node_cmake["CMake dependencies<br/>[cmake.rs]"]
  node_meson["Meson dependencies<br/>[meson.rs]"]
  node_make["Make dependencies<br/>[make.rs]"]
  node_custom["Custom commands<br/>[custom.rs]"]
end

subgraph group_build["Compilation and output"]
  node_builder["Compile and link<br/>[builder.rs]"]
  node_compile_db["Compile database<br/>[compile_db.rs]"]
  node_diagnostics["Compiler diagnostics<br/>[diagnostics.rs]"]
  node_errors["Build errors<br/>[error.rs]"]
end

subgraph group_quality["Developer commands"]
  node_quality["Format and lint<br/>[main.rs]"]
  node_depedit["Dependency edits<br/>[project.rs]"]
  node_updater["Self-update<br/>[main.rs]"]
end

node_user(("Developer"))
node_compiler["C/C++ compiler"]
node_clangformat["clang-format"]

node_user -->|"runs commands"| node_cli
node_cli -->|"provides arguments"| node_dispatch
node_dispatch -->|"creates or loads"| node_project
node_dispatch -->|"loads workspace config"| node_manifest
node_dispatch -->|"builds or runs"| node_builder
node_project -->|"reads and writes"| node_manifest
node_project -->|"scaffolds from"| node_templates
node_project -->|"resolves dependencies"| node_resolver
node_resolver -.->|"provides dependency source"| node_depbuild
node_depbuild -->|"selects builder"| node_cmake
node_depbuild -->|"selects builder"| node_meson
node_depbuild -->|"selects builder"| node_make
node_depbuild -->|"selects builder"| node_custom
node_builder -->|"reads build settings"| node_manifest
node_builder -->|"uses resolved dependencies"| node_resolver
node_builder -.->|"builds dependencies"| node_depbuild
node_builder -->|"invokes compiler"| node_compiler
node_builder -->|"writes compile entries"| node_compile_db
node_builder -->|"prints diagnostics"| node_diagnostics
node_builder -->|"returns failures"| node_errors
node_dispatch -.->|"offers format and lint"| node_quality
node_quality -.->|"formats sources"| node_clangformat
node_dispatch -.->|"adds or removes dependencies"| node_depedit
node_dispatch -.->|"offers self-update"| node_updater

click node_cli "https://github.com/max-mend/smidr/blob/main/src/cli.rs"
click node_dispatch "https://github.com/max-mend/smidr/blob/main/src/main.rs"
click node_project "https://github.com/max-mend/smidr/blob/main/src/project.rs"
click node_manifest "https://github.com/max-mend/smidr/blob/main/src/config.rs"
click node_templates "https://github.com/max-mend/smidr/blob/main/templates/main.c"
click node_resolver "https://github.com/max-mend/smidr/blob/main/src/resolver.rs"
click node_depbuild "https://github.com/max-mend/smidr/blob/main/src/toolchain.rs"
click node_cmake "https://github.com/max-mend/smidr/blob/main/src/toolchain/cmake.rs"
click node_meson "https://github.com/max-mend/smidr/blob/main/src/toolchain/meson.rs"
click node_make "https://github.com/max-mend/smidr/blob/main/src/toolchain/make.rs"
click node_custom "https://github.com/max-mend/smidr/blob/main/src/toolchain/custom.rs"
click node_builder "https://github.com/max-mend/smidr/blob/main/src/builder.rs"
click node_compile_db "https://github.com/max-mend/smidr/blob/main/src/compile_db.rs"
click node_diagnostics "https://github.com/max-mend/smidr/blob/main/src/diagnostics.rs"
click node_errors "https://github.com/max-mend/smidr/blob/main/src/error.rs"
click node_quality "https://github.com/max-mend/smidr/blob/main/src/main.rs"
click node_depedit "https://github.com/max-mend/smidr/blob/main/src/project.rs"
click node_updater "https://github.com/max-mend/smidr/blob/main/src/main.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_dispatch toneBlue
class node_project,node_manifest,node_templates toneAmber
class node_resolver,node_depbuild,node_cmake,node_meson,node_make,node_custom toneMint
class node_builder,node_compile_db,node_diagnostics,node_errors toneRose
class node_quality,node_depedit,node_updater,node_user,node_compiler,node_clangformat toneIndigo
```

## Components

### Command entry

- [CLI arguments](https://github.com/max-mend/smidr/blob/main/src/cli.rs): `src/cli.rs`
- [Command dispatch](https://github.com/max-mend/smidr/blob/main/src/main.rs): `src/main.rs`

### Projects and configuration

- [Project lifecycle](https://github.com/max-mend/smidr/blob/main/src/project.rs): `src/project.rs`
- [Manifest model](https://github.com/max-mend/smidr/blob/main/src/config.rs): `src/config.rs`
- [Scaffold templates](https://github.com/max-mend/smidr/blob/main/templates/main.c): `templates/main.c`

### Dependency resolution

- [Dependency sources](https://github.com/max-mend/smidr/blob/main/src/resolver.rs): `src/resolver.rs`
- [Build-system selection](https://github.com/max-mend/smidr/blob/main/src/toolchain.rs): `src/toolchain.rs`
- [CMake dependencies](https://github.com/max-mend/smidr/blob/main/src/toolchain/cmake.rs): `src/toolchain/cmake.rs`
- [Meson dependencies](https://github.com/max-mend/smidr/blob/main/src/toolchain/meson.rs): `src/toolchain/meson.rs`
- [Make dependencies](https://github.com/max-mend/smidr/blob/main/src/toolchain/make.rs): `src/toolchain/make.rs`
- [Custom commands](https://github.com/max-mend/smidr/blob/main/src/toolchain/custom.rs): `src/toolchain/custom.rs`

### Compilation and output

- [Compile and link](https://github.com/max-mend/smidr/blob/main/src/builder.rs): `src/builder.rs`
- [Compile database](https://github.com/max-mend/smidr/blob/main/src/compile_db.rs): `src/compile_db.rs`
- [Compiler diagnostics](https://github.com/max-mend/smidr/blob/main/src/diagnostics.rs): `src/diagnostics.rs`
- [Build errors](https://github.com/max-mend/smidr/blob/main/src/error.rs): `src/error.rs`

### Developer commands

- [Format and lint](https://github.com/max-mend/smidr/blob/main/src/main.rs): `src/main.rs`
- [Dependency edits](https://github.com/max-mend/smidr/blob/main/src/project.rs): `src/project.rs`
- [Self-update](https://github.com/max-mend/smidr/blob/main/src/main.rs): `src/main.rs`

### Other components

- **Developer**
- **C/C++ compiler**
- **clang-format**

## Connections

- Developer → CLI arguments: runs commands (evidence: `README.md`)
- CLI arguments → Command dispatch: provides arguments (evidence: `src/main.rs`)
- Command dispatch → Project lifecycle: creates or loads (evidence: `src/main.rs`)
- Command dispatch → Manifest model: loads workspace config (evidence: `src/main.rs`)
- Command dispatch → Compile and link: builds or runs (evidence: `src/main.rs`)
- Project lifecycle → Manifest model: reads and writes (evidence: `src/project.rs`)
- Project lifecycle → Scaffold templates: scaffolds from (evidence: `README.md`)
- Project lifecycle → Dependency sources: resolves dependencies (evidence: `src/project.rs`)
- Dependency sources → Build-system selection: provides dependency source (evidence: `src/resolver.rs`)
- Build-system selection → CMake dependencies: selects builder (evidence: `src/toolchain.rs`)
- Build-system selection → Meson dependencies: selects builder (evidence: `src/toolchain.rs`)
- Build-system selection → Make dependencies: selects builder (evidence: `src/toolchain.rs`)
- Build-system selection → Custom commands: selects builder (evidence: `src/toolchain.rs`)
- Compile and link → Manifest model: reads build settings (evidence: `src/builder.rs`)
- Compile and link → Dependency sources: uses resolved dependencies (evidence: `src/builder.rs`)
- Compile and link → Build-system selection: builds dependencies (evidence: `src/builder.rs`)
- Compile and link → C/C++ compiler: invokes compiler (evidence: `src/builder.rs`)
- Compile and link → Compile database: writes compile entries (evidence: `src/builder.rs`)
- Compile and link → Compiler diagnostics: prints diagnostics (evidence: `src/builder.rs`)
- Compile and link → Build errors: returns failures (evidence: `src/builder.rs`)
- Command dispatch → Format and lint: offers format and lint (evidence: `README.md`)
- Format and lint → clang-format: formats sources (evidence: `README.md`)
- Command dispatch → Dependency edits: adds or removes dependencies (evidence: `README.md`)
- Command dispatch → Self-update: offers self-update (evidence: `README.md`)
