# dudesquad999/git-panic architecture

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

- Interactive diagram: https://gitdiagram.com/dudesquad999/git-panic
- Repository: https://github.com/dudesquad999/git-panic

## Overview

git-panic is a local Git recovery CLI: users inspect HEAD reflog entries, search them or browse an interactive timeline, then preview and optionally create a branch for a selected commit. The graph separates command routing, reflog discovery, search, TUI inspection, and recovery. README documents these workflows and the JSON interface; the sampled implementation is one file, so several components share its path. No remote Git service is involved.

Main entry points: [`src/main.rs`](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs) (Command routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_entry["Command routing<br/>[main.rs]"]
  node_reflog["HEAD reflog reader<br/>[main.rs]"]
  node_search["Literal search<br/>[main.rs]"]
  node_timeline["Interactive timeline<br/>[main.rs]"]
  node_json["JSON responses<br/>[main.rs]"]
end

subgraph group_recovery["Commit recovery"]
  node_recover["Branch recovery<br/>[main.rs]"]
end

node_developer(("Developer or assistant"))
node_gitrepo[("Local Git repository")]

node_developer -->|"runs command"| node_entry
node_entry -->|"reads timeline"| node_reflog
node_reflog -->|"reads HEAD reflog"| node_gitrepo
node_entry -->|"routes query"| node_search
node_entry -->|"opens timeline"| node_timeline
node_search -->|"formats results"| node_json
node_entry -->|"routes recovery"| node_recover
node_recover -->|"validates and creates branch"| node_gitrepo
node_recover -->|"formats response"| node_json

click node_entry "https://github.com/dudesquad999/git-panic/blob/main/src/main.rs"
click node_reflog "https://github.com/dudesquad999/git-panic/blob/main/src/main.rs"
click node_search "https://github.com/dudesquad999/git-panic/blob/main/src/main.rs"
click node_timeline "https://github.com/dudesquad999/git-panic/blob/main/src/main.rs"
click node_recover "https://github.com/dudesquad999/git-panic/blob/main/src/main.rs"
click node_json "https://github.com/dudesquad999/git-panic/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_entry,node_reflog,node_search,node_timeline,node_json toneBlue
class node_recover,node_gitrepo toneAmber
class node_developer toneIndigo
```

## Components

### CLI workflows

- [Command routing](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs): `src/main.rs`
- [HEAD reflog reader](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs): `src/main.rs`
- [Literal search](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs): `src/main.rs`
- [Interactive timeline](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs): `src/main.rs`
- [JSON responses](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs): `src/main.rs`

### Commit recovery

- [Branch recovery](https://github.com/dudesquad999/git-panic/blob/main/src/main.rs): `src/main.rs`

### Other components

- **Developer or assistant**
- **Local Git repository**

## Connections

- Developer or assistant → Command routing: runs command (evidence: `README.md`)
- Command routing → HEAD reflog reader: reads timeline (evidence: `README.md`)
- HEAD reflog reader → Local Git repository: reads HEAD reflog (evidence: `src/main.rs`)
- Command routing → Literal search: routes query (evidence: `README.md`)
- Command routing → Interactive timeline: opens timeline (evidence: `README.md`)
- Literal search → JSON responses: formats results (evidence: `README.md`)
- Command routing → Branch recovery: routes recovery (evidence: `README.md`)
- Branch recovery → Local Git repository: validates and creates branch (evidence: `README.md`)
- Branch recovery → JSON responses: formats response (evidence: `README.md`)
