# yacine204/cit architecture

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

- Interactive diagram: https://gitdiagram.com/yacine204/cit
- Repository: https://github.com/yacine204/cit

## Overview

cit is a small custom version-control tool: the user initializes a repository, then invokes a commit that snapshots tracked files and stores per-file changes and content in `.cit`. The main path is visible in `main.c`; README documents the snapshot format and exclusions. The sampled tree code shows recursive scanning and diff generation, while commit code loads and writes snapshots. The hash helper exists, but its call site was not shown, so no hashing relationship is asserted.

Main entry points: [`main.c`](https://github.com/yacine204/cit/blob/master/main.c) (CLI and initialization), [`src/tree.c`](https://github.com/yacine204/cit/blob/master/src/tree.c) (Tree scanner), [`src/commit.c`](https://github.com/yacine204/cit/blob/master/src/commit.c) (Latest commit loader), [`.cit`](https://github.com/yacine204/cit/tree/master/.cit) (`.cit` snapshots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_cli["CLI and initialization<br/>[main.c]"]
end

subgraph group_snapshot["Snapshot construction"]
  node_tree_builder["Tree scanner<br/>[tree.c]"]
  node_file_node["File nodes<br/>[tree.c]"]
  node_diff["Line diff<br/>[tree.c]"]
  node_hash_helper["Node hash helper<br/>[hash.c]"]
end

subgraph group_history["Commit history"]
  node_commit_loader["Latest commit loader<br/>[commit.c]"]
  node_snapshot_parser["Snapshot parser<br/>[tree.c]"]
  node_commit_builder["Commit builder<br/>[commit.c]"]
  node_tree_writer["Tree serializer<br/>[commit.c]"]
  node_commit_store[("&#96;.cit&#96; snapshots<br/>[.cit]")]
end

node_user(("User"))
node_working_files[("Working files")]

node_user -->|"invokes"| node_cli
node_cli -->|"initializes"| node_commit_store
node_cli -->|"builds snapshot"| node_tree_builder
node_tree_builder -->|"reads files"| node_working_files
node_tree_builder -->|"scans directories"| node_tree_builder
node_tree_builder -->|"creates nodes"| node_file_node
node_file_node -->|"generates changes"| node_diff
node_cli -->|"loads history"| node_commit_loader
node_commit_loader -->|"reads latest"| node_commit_store
node_commit_loader -->|"parses snapshot"| node_snapshot_parser
node_cli -->|"creates commit"| node_commit_builder
node_commit_builder -->|"writes tree"| node_tree_writer
node_tree_writer -->|"writes snapshot"| node_commit_store

click node_cli "https://github.com/yacine204/cit/blob/master/main.c"
click node_tree_builder "https://github.com/yacine204/cit/blob/master/src/tree.c"
click node_file_node "https://github.com/yacine204/cit/blob/master/src/tree.c"
click node_diff "https://github.com/yacine204/cit/blob/master/src/tree.c"
click node_hash_helper "https://github.com/yacine204/cit/blob/master/src/hash.c"
click node_commit_loader "https://github.com/yacine204/cit/blob/master/src/commit.c"
click node_snapshot_parser "https://github.com/yacine204/cit/blob/master/src/tree.c"
click node_commit_builder "https://github.com/yacine204/cit/blob/master/src/commit.c"
click node_tree_writer "https://github.com/yacine204/cit/blob/master/src/commit.c"
click node_commit_store "https://github.com/yacine204/cit/tree/master/.cit"

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_tree_builder,node_file_node,node_diff,node_hash_helper,node_working_files toneAmber
class node_commit_loader,node_snapshot_parser,node_commit_builder,node_tree_writer,node_commit_store toneMint
```

## Components

### Command entry

- [CLI and initialization](https://github.com/yacine204/cit/blob/master/main.c): `main.c`

### Snapshot construction

- [Tree scanner](https://github.com/yacine204/cit/blob/master/src/tree.c): `src/tree.c`
- [File nodes](https://github.com/yacine204/cit/blob/master/src/tree.c): `src/tree.c`
- [Line diff](https://github.com/yacine204/cit/blob/master/src/tree.c): `src/tree.c`
- [Node hash helper](https://github.com/yacine204/cit/blob/master/src/hash.c): `src/hash.c`

### Commit history

- [Latest commit loader](https://github.com/yacine204/cit/blob/master/src/commit.c): `src/commit.c`
- [Snapshot parser](https://github.com/yacine204/cit/blob/master/src/tree.c): `src/tree.c`
- [Commit builder](https://github.com/yacine204/cit/blob/master/src/commit.c): `src/commit.c`
- [Tree serializer](https://github.com/yacine204/cit/blob/master/src/commit.c): `src/commit.c`
- [`.cit` snapshots](https://github.com/yacine204/cit/tree/master/.cit): `.cit`

### Other components

- **User**
- **Working files**

## Connections

- User → CLI and initialization: invokes (evidence: `README.md`)
- CLI and initialization → `.cit` snapshots: initializes (evidence: `main.c`)
- CLI and initialization → Tree scanner: builds snapshot (evidence: `main.c`)
- Tree scanner → Working files: reads files (evidence: `README.md`)
- Tree scanner → Tree scanner: scans directories (evidence: `src/tree.c`)
- Tree scanner → File nodes: creates nodes (evidence: `src/tree.c`)
- File nodes → Line diff: generates changes (evidence: `src/tree.c`)
- CLI and initialization → Latest commit loader: loads history (evidence: `main.c`)
- Latest commit loader → `.cit` snapshots: reads latest (evidence: `src/commit.c`)
- Latest commit loader → Snapshot parser: parses snapshot (evidence: `src/commit.c`)
- CLI and initialization → Commit builder: creates commit (evidence: `main.c`)
- Commit builder → Tree serializer: writes tree (evidence: `src/commit.c`)
- Tree serializer → `.cit` snapshots: writes snapshot (evidence: `src/commit.c`)
