# lillypk/sevx_set-environment-variable-x architecture

> Architecture diagram of the GitHub repository lillypk/sevx_set-environment-variable-x, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lillypk/sevx_set-environment-variable-x
- Repository: https://github.com/lillypk/sevx_set-environment-variable-x

## Overview

SEVX is a Windows command-line tool and C++ library for reading and modifying persistent User or System PATH values in the registry; it does not modify the current process environment. The main workflow parses a command and scope, then dispatches to library operations that read, split, modify or join PATH entries, and persist changes when needed. Persistence broadcasts a Windows environment-change notification. The README also documents raw reads, multi-entry operations, prepend/deduplication, and membership checks. Wiring is based on the sampled CLI and library source.

Main entry points: [`src/sevx.cpp`](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp) (Write registry), [`include/sevx.hpp`](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/include/sevx.hpp) (SEVX API), [`src/main.cpp`](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/main.cpp) (Command dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_cli["Command dispatcher<br/>[main.cpp]"]
  node_batch["Scope batches<br/>[main.cpp]"]
end

subgraph group_library["PATH library"]
  node_public_api["SEVX API<br/>[sevx.hpp]"]
  node_get["Get PATH<br/>[sevx.cpp]"]
  node_set["Set PATH<br/>[sevx.cpp]"]
  node_add["Add entries<br/>[sevx.cpp]"]
  node_remove["Remove entries<br/>[sevx.cpp]"]
  node_contains["Check membership<br/>[sevx.cpp]"]
  node_split["Split PATH<br/>[sevx.cpp]"]
  node_join["Join PATH<br/>[sevx.cpp]"]
end

subgraph group_windows["Windows integration"]
  node_registry_read["Read registry<br/>[sevx.cpp]"]
  node_registry_write["Write registry<br/>[sevx.cpp]"]
  node_user_registry[("User environment key")]
  node_system_registry[("System environment key")]
  node_broadcast["Environment broadcast<br/>[sevx.cpp]"]
end

node_user(("CLI user"))
node_windows["Windows APIs"]

node_user -->|"invokes"| node_cli
node_cli -->|"parses arguments"| node_batch
node_cli -->|"dispatches commands"| node_public_api
node_batch -->|"splits input"| node_split
node_public_api -->|"exposes"| node_get
node_public_api -->|"exposes"| node_set
node_public_api -->|"exposes"| node_add
node_public_api -->|"exposes"| node_remove
node_public_api -->|"exposes"| node_contains
node_get -->|"reads PATH"| node_registry_read
node_get -->|"splits entries"| node_split
node_set -->|"reads old PATH"| node_registry_read
node_set -->|"joins entries"| node_join
node_set -->|"writes changed PATH"| node_registry_write
node_add -->|"loads entries"| node_get
node_add -->|"joins entries"| node_join
node_add -->|"writes changed PATH"| node_registry_write
node_remove -->|"loads entries"| node_get
node_remove -->|"joins entries"| node_join
node_remove -->|"writes changed PATH"| node_registry_write
node_contains -->|"loads entries"| node_get
node_registry_read -->|"reads User scope"| node_user_registry
node_registry_read -->|"reads System scope"| node_system_registry
node_registry_write -->|"writes User scope"| node_user_registry
node_registry_write -->|"writes System scope"| node_system_registry
node_registry_read -->|"uses registry APIs"| node_windows
node_registry_write -->|"uses registry APIs"| node_windows
node_registry_write -->|"notifies after write"| node_broadcast
node_broadcast -->|"broadcasts setting change"| node_windows

click node_cli "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/main.cpp"
click node_batch "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/main.cpp"
click node_public_api "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/include/sevx.hpp"
click node_get "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_set "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_add "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_remove "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_contains "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_split "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_join "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_registry_read "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_registry_write "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"
click node_broadcast "https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp"

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_batch,node_user toneBlue
class node_public_api,node_get,node_set,node_add,node_remove,node_contains,node_split,node_join toneAmber
class node_registry_read,node_registry_write,node_user_registry,node_system_registry,node_broadcast,node_windows toneMint
```

## Components

### Command line

- [Command dispatcher](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/main.cpp): `src/main.cpp`
- [Scope batches](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/main.cpp): `src/main.cpp`

### PATH library

- [SEVX API](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/include/sevx.hpp): `include/sevx.hpp`
- [Get PATH](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Set PATH](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Add entries](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Remove entries](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Check membership](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Split PATH](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Join PATH](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`

### Windows integration

- [Read registry](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- [Write registry](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`
- **User environment key**
- **System environment key**
- [Environment broadcast](https://github.com/lillypk/sevx_set-environment-variable-x/blob/main/src/sevx.cpp): `src/sevx.cpp`

### Other components

- **CLI user**
- **Windows APIs**

## Connections

- CLI user → Command dispatcher: invokes
- Command dispatcher → Scope batches: parses arguments
- Command dispatcher → SEVX API: dispatches commands
- Scope batches → Split PATH: splits input
- SEVX API → Get PATH: exposes
- SEVX API → Set PATH: exposes
- SEVX API → Add entries: exposes
- SEVX API → Remove entries: exposes
- SEVX API → Check membership: exposes
- Get PATH → Read registry: reads PATH
- Get PATH → Split PATH: splits entries
- Set PATH → Read registry: reads old PATH
- Set PATH → Join PATH: joins entries
- Set PATH → Write registry: writes changed PATH
- Add entries → Get PATH: loads entries
- Add entries → Join PATH: joins entries
- Add entries → Write registry: writes changed PATH
- Remove entries → Get PATH: loads entries
- Remove entries → Join PATH: joins entries
- Remove entries → Write registry: writes changed PATH
- Check membership → Get PATH: loads entries
- Read registry → User environment key: reads User scope
- Read registry → System environment key: reads System scope
- Write registry → User environment key: writes User scope
- Write registry → System environment key: writes System scope
- Read registry → Windows APIs: uses registry APIs
- Write registry → Windows APIs: uses registry APIs
- Write registry → Environment broadcast: notifies after write
- Environment broadcast → Windows APIs: broadcasts setting change
