# mlohajner/quote_history architecture

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

- Interactive diagram: https://gitdiagram.com/mlohajner/quote_history
- Repository: https://github.com/mlohajner/quote_history

## Overview

quote_history adds a secondary history stream to an interactive Bash session: external-command output is captured, quoted content is extracted into a separate history file, and keyboard shortcuts let the user browse or purge snippets. The README documents these responsibilities and the extractor’s output, but the shell-script excerpts were not provided, so their precise call sequence and the roles of the tee-named script cannot be verified.

Main entry points: [`qh_extension.sh`](https://github.com/mlohajner/quote_history/blob/main/qh_extension.sh) (History extension), [`bashrc`](https://github.com/mlohajner/quote_history/blob/main/bashrc) (Bash startup), [`qh_extension-tee.sh`](https://github.com/mlohajner/quote_history/blob/main/qh_extension-tee.sh) (Output capture), [`qh_extract.c`](https://github.com/mlohajner/quote_history/blob/main/qh_extract.c) (Quote extractor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Shell Integration"]
  node_bashrc["Bash startup"]
  node_extension["History extension<br/>[qh_extension.sh]"]
end

subgraph group_capture["Capture and Extraction"]
  node_capture["Output capture"]
  node_extractor["Quote extractor<br/>[qh_extract.c]"]
end

subgraph group_history["Snippet History"]
  node_historyfile[("Quote history")]
end

node_user(("Terminal user"))
node_script["PTY capture tool"]

node_user -->|"enables extension"| node_bashrc
node_bashrc -->|"sources"| node_extension
node_extension -.->|"captures output"| node_capture
node_capture -.->|"uses PTY capture"| node_script
node_extension -.->|"runs extraction"| node_extractor
node_extractor -->|"appends snippets"| node_historyfile
node_user -->|"browses or purges"| node_extension

click node_bashrc "https://github.com/mlohajner/quote_history/blob/main/bashrc"
click node_extension "https://github.com/mlohajner/quote_history/blob/main/qh_extension.sh"
click node_capture "https://github.com/mlohajner/quote_history/blob/main/qh_extension-tee.sh"
click node_extractor "https://github.com/mlohajner/quote_history/blob/main/qh_extract.c"

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_bashrc,node_extension,node_user toneBlue
class node_capture,node_extractor toneAmber
class node_historyfile toneMint
class node_script toneIndigo
```

## Components

### Shell Integration

- [Bash startup](https://github.com/mlohajner/quote_history/blob/main/bashrc): `bashrc`
- [History extension](https://github.com/mlohajner/quote_history/blob/main/qh_extension.sh): `qh_extension.sh`

### Capture and Extraction

- [Output capture](https://github.com/mlohajner/quote_history/blob/main/qh_extension-tee.sh): `qh_extension-tee.sh`
- [Quote extractor](https://github.com/mlohajner/quote_history/blob/main/qh_extract.c): `qh_extract.c`

### Snippet History

- **Quote history**

### Other components

- **Terminal user**
- **PTY capture tool**

## Connections

- Terminal user → Bash startup: enables extension (evidence: `README.md`)
- Bash startup → History extension: sources (evidence: `README.md`)
- History extension → Output capture: captures output
- Output capture → PTY capture tool: uses PTY capture
- History extension → Quote extractor: runs extraction
- Quote extractor → Quote history: appends snippets (evidence: `README.md`)
- Terminal user → History extension: browses or purges (evidence: `README.md`)
