# shatakshi192007-sketch/gitaudit architecture

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

- Interactive diagram: https://gitdiagram.com/shatakshi192007-sketch/gitaudit
- Repository: https://github.com/shatakshi192007-sketch/gitaudit

## Overview

GitAudit is a local pre-commit credential scanner. A commit-triggered run gets staged paths and added-line diffs from Git, scans those lines against credential signatures, then exits with a pass or failure status so insecure commits can be blocked. The README also describes Git-hook integration and cross-platform UTF-8 handling; the hook itself is not present in the supplied tree, so it is represented only as a documented trigger. The graph follows the sampled runtime code and README; no separate storage layer exists.

Main entry points: [`main.py`](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/main.py) (Audit runner), [`core/git_helper.py`](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/core/git_helper.py) (Git diff helper), [`scanner.py`](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/scanner.py) (Regex scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Scan orchestration"]
  node_audit["Audit runner<br/>[main.py]"]
  node_status["Commit status<br/>[main.py]"]
end

subgraph group_git["Staged Git changes"]
  node_git_helper["Git diff helper<br/>[git_helper.py]"]
end

subgraph group_detection["Credential detection"]
  node_scanner["Regex scanner<br/>[scanner.py]"]
end

node_commit(("Commit attempt"))
node_git_cli["Git CLI"]

node_commit -->|"triggers scan"| node_audit
node_audit -->|"gets staged files"| node_git_helper
node_audit -->|"gets staged diff"| node_git_helper
node_git_helper -->|"runs diff"| node_git_cli
node_audit -->|"scans added lines"| node_scanner
node_scanner -->|"returns findings"| node_audit
node_audit -->|"sets exit status"| node_status
node_status -->|"blocks on leaks"| node_commit

click node_audit "https://github.com/shatakshi192007-sketch/gitaudit/blob/main/main.py"
click node_status "https://github.com/shatakshi192007-sketch/gitaudit/blob/main/main.py"
click node_git_helper "https://github.com/shatakshi192007-sketch/gitaudit/blob/main/core/git_helper.py"
click node_scanner "https://github.com/shatakshi192007-sketch/gitaudit/blob/main/scanner.py"

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_audit,node_status toneBlue
class node_git_helper toneAmber
class node_scanner toneMint
class node_commit,node_git_cli toneIndigo
```

## Components

### Scan orchestration

- [Audit runner](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/main.py): `main.py`
- [Commit status](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/main.py): `main.py`

### Staged Git changes

- [Git diff helper](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/core/git_helper.py): `core/git_helper.py`

### Credential detection

- [Regex scanner](https://github.com/shatakshi192007-sketch/gitaudit/blob/main/scanner.py): `scanner.py`

### Other components

- **Commit attempt**
- **Git CLI**

## Connections

- Commit attempt → Audit runner: triggers scan (evidence: `README.md`)
- Audit runner → Git diff helper: gets staged files (evidence: `main.py`)
- Audit runner → Git diff helper: gets staged diff (evidence: `main.py`)
- Git diff helper → Git CLI: runs diff (evidence: `core/git_helper.py`)
- Audit runner → Regex scanner: scans added lines (evidence: `main.py`)
- Regex scanner → Audit runner: returns findings (evidence: `main.py`)
- Audit runner → Commit status: sets exit status (evidence: `main.py`)
- Commit status → Commit attempt: blocks on leaks (evidence: `README.md`)
