# strange-exe/minigit architecture

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

- Interactive diagram: https://gitdiagram.com/strange-exe/minigit
- Repository: https://github.com/strange-exe/minigit

## Overview

MiniGit is a local terminal version-control tool. A user invokes commands through the CLI; the principal workflow initializes a repository, stages non-ignored working-tree files, commits their snapshots and metadata, then inspects commit history. Ignore rules and undo/redo are distinct supporting capabilities. The graph follows documented command routing and the sampled implementation references; some storage and subsystem links rely on README documentation because their implementation was not excerpted.

Main entry points: [`module/src/CLI.cpp`](https://github.com/strange-exe/minigit/blob/main/module/src/CLI.cpp) (Command Dispatcher), [`module/src/AddCommand.cpp`](https://github.com/strange-exe/minigit/blob/main/module/src/AddCommand.cpp) (Add and Remove), [`module/src/CommitCommand.cpp`](https://github.com/strange-exe/minigit/blob/main/module/src/CommitCommand.cpp) (Commit and Undo/Redo), [`module/src/IgnoreManager.cpp`](https://github.com/strange-exe/minigit/blob/main/module/src/IgnoreManager.cpp) (Ignore Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI"]
  node_cli["Command Dispatcher<br/>[CLI.cpp]"]
end

subgraph group_tracking["File Tracking"]
  node_add["Add and Remove<br/>[AddCommand.cpp]"]
  node_ignore["Ignore Manager<br/>[IgnoreManager.cpp]"]
  node_trie["Trie Engine<br/>[Trie.cpp]"]
  node_staging[("Staging Index<br/>[StagingArea.cpp]")]
  node_pathutils["Path Utilities<br/>[PathUtils.h]"]
end

subgraph group_history["Commit History"]
  node_commit["Commit and Undo/Redo<br/>[CommitCommand.cpp]"]
  node_history[("Undo/Redo State<br/>[CommitHistory.cpp]")]
  node_logcmd["Log Command<br/>[LogCommand.cpp]"]
  node_commitlog["Commit List<br/>[CommitLog.cpp]"]
end

subgraph group_storage["Repository Storage"]
  node_init["Repository Init<br/>[InitCommand.cpp]"]
  node_repo[("Repository Data")]
end

node_user(("User"))
node_working["Working Files"]

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches init"| node_init
node_cli -->|"dispatches add/remove"| node_add
node_cli -->|"dispatches ignore"| node_ignore
node_cli -->|"dispatches commit"| node_commit
node_cli -->|"dispatches log"| node_logcmd
node_init -->|"creates structure"| node_repo
node_add -->|"reads paths"| node_working
node_add -->|"checks rules"| node_ignore
node_add -->|"stages paths"| node_staging
node_add -->|"normalizes paths"| node_pathutils
node_ignore -->|"indexes rules"| node_trie
node_ignore -->|"reads/writes rules"| node_repo
node_commit -->|"reads and clears"| node_staging
node_commit -->|"records/restores state"| node_history
node_commit -->|"snapshots files"| node_working
node_commit -->|"writes commits and HEAD"| node_repo
node_staging -->|"persists index"| node_repo
node_history -->|"persists history"| node_repo
node_logcmd -->|"loads and traverses"| node_commitlog
node_commitlog -->|"reads commit ancestry"| node_repo

click node_cli "https://github.com/strange-exe/minigit/blob/main/module/src/CLI.cpp"
click node_init "https://github.com/strange-exe/minigit/blob/main/module/src/InitCommand.cpp"
click node_add "https://github.com/strange-exe/minigit/blob/main/module/src/AddCommand.cpp"
click node_ignore "https://github.com/strange-exe/minigit/blob/main/module/src/IgnoreManager.cpp"
click node_trie "https://github.com/strange-exe/minigit/blob/main/module/src/Trie.cpp"
click node_staging "https://github.com/strange-exe/minigit/blob/main/module/src/StagingArea.cpp"
click node_pathutils "https://github.com/strange-exe/minigit/blob/main/module/include/PathUtils.h"
click node_commit "https://github.com/strange-exe/minigit/blob/main/module/src/CommitCommand.cpp"
click node_history "https://github.com/strange-exe/minigit/blob/main/module/src/CommitHistory.cpp"
click node_logcmd "https://github.com/strange-exe/minigit/blob/main/module/src/LogCommand.cpp"
click node_commitlog "https://github.com/strange-exe/minigit/blob/main/module/src/CommitLog.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_user toneBlue
class node_add,node_ignore,node_trie,node_staging,node_pathutils toneAmber
class node_commit,node_history,node_logcmd,node_commitlog toneMint
class node_init,node_repo toneRose
class node_working toneIndigo
```

## Components

### CLI

- [Command Dispatcher](https://github.com/strange-exe/minigit/blob/main/module/src/CLI.cpp): `module/src/CLI.cpp`

### File Tracking

- [Add and Remove](https://github.com/strange-exe/minigit/blob/main/module/src/AddCommand.cpp): `module/src/AddCommand.cpp`
- [Ignore Manager](https://github.com/strange-exe/minigit/blob/main/module/src/IgnoreManager.cpp): `module/src/IgnoreManager.cpp`
- [Trie Engine](https://github.com/strange-exe/minigit/blob/main/module/src/Trie.cpp): `module/src/Trie.cpp`
- [Staging Index](https://github.com/strange-exe/minigit/blob/main/module/src/StagingArea.cpp): `module/src/StagingArea.cpp`
- [Path Utilities](https://github.com/strange-exe/minigit/blob/main/module/include/PathUtils.h): `module/include/PathUtils.h`

### Commit History

- [Commit and Undo/Redo](https://github.com/strange-exe/minigit/blob/main/module/src/CommitCommand.cpp): `module/src/CommitCommand.cpp`
- [Undo/Redo State](https://github.com/strange-exe/minigit/blob/main/module/src/CommitHistory.cpp): `module/src/CommitHistory.cpp`
- [Log Command](https://github.com/strange-exe/minigit/blob/main/module/src/LogCommand.cpp): `module/src/LogCommand.cpp`
- [Commit List](https://github.com/strange-exe/minigit/blob/main/module/src/CommitLog.cpp): `module/src/CommitLog.cpp`

### Repository Storage

- [Repository Init](https://github.com/strange-exe/minigit/blob/main/module/src/InitCommand.cpp): `module/src/InitCommand.cpp`
- **Repository Data**

### Other components

- **User**
- **Working Files**

## Connections

- User → Command Dispatcher: runs commands
- Command Dispatcher → Repository Init: dispatches init
- Command Dispatcher → Add and Remove: dispatches add/remove
- Command Dispatcher → Ignore Manager: dispatches ignore
- Command Dispatcher → Commit and Undo/Redo: dispatches commit
- Command Dispatcher → Log Command: dispatches log
- Repository Init → Repository Data: creates structure (evidence: `README.md`)
- Add and Remove → Working Files: reads paths (evidence: `module/src/AddCommand.cpp`)
- Add and Remove → Ignore Manager: checks rules
- Add and Remove → Staging Index: stages paths
- Add and Remove → Path Utilities: normalizes paths (evidence: `module/src/AddCommand.cpp`)
- Ignore Manager → Trie Engine: indexes rules (evidence: `module/src/IgnoreManager.cpp`)
- Ignore Manager → Repository Data: reads/writes rules (evidence: `module/src/IgnoreManager.cpp`)
- Commit and Undo/Redo → Staging Index: reads and clears (evidence: `module/src/CommitCommand.cpp`)
- Commit and Undo/Redo → Undo/Redo State: records/restores state (evidence: `module/src/CommitCommand.cpp`)
- Commit and Undo/Redo → Working Files: snapshots files (evidence: `module/src/CommitCommand.cpp`)
- Commit and Undo/Redo → Repository Data: writes commits and HEAD (evidence: `module/src/CommitCommand.cpp`)
- Staging Index → Repository Data: persists index (evidence: `README.md`)
- Undo/Redo State → Repository Data: persists history
- Log Command → Commit List: loads and traverses (evidence: `module/src/LogCommand.cpp`)
- Commit List → Repository Data: reads commit ancestry
