# sindresorhus/pure architecture

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

- Interactive diagram: https://gitdiagram.com/sindresorhus/pure
- Repository: https://github.com/sindresorhus/pure

## Overview

Pure is a Zsh prompt: after a command runs, the shell renders a concise prompt with status, duration, location, and optional context such as Git state. The README documents asynchronous Git updates, environment integrations, terminal titles, VI-mode indication, and customization. The source excerpts contain no runtime code, so component paths identify the available prompt and async files; relationships below are limited to documented behavior rather than inferred calls.

Main entry points: [`pure.zsh`](https://github.com/sindresorhus/pure/blob/main/pure.zsh) (Pure prompt), [`async.zsh`](https://github.com/sindresorhus/pure/blob/main/async.zsh) (Async worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prompt["Prompt display"]
  node_pure["Pure prompt<br/>[pure.zsh]"]
  node_prompt_symbol["Prompt symbol<br/>[pure.zsh]"]
  node_command_status["Command status<br/>[pure.zsh]"]
  node_execution_time["Execution time<br/>[pure.zsh]"]
  node_path_display["Current path<br/>[pure.zsh]"]
end

subgraph group_git["Git status"]
  node_git_status["Git branch and dirtiness<br/>[pure.zsh]"]
  node_git_remote["Remote commit status<br/>[pure.zsh]"]
  node_async_worker["Async worker<br/>[async.zsh]"]
end

subgraph group_context["Shell context"]
  node_environment["Environment indicators<br/>[pure.zsh]"]
  node_host["Host and user<br/>[pure.zsh]"]
  node_terminal_title["Terminal title<br/>[pure.zsh]"]
  node_vi_mode["VI-mode indicator<br/>[pure.zsh]"]
end

subgraph group_custom["Customization"]
  node_custom_hook["Custom prompt hook<br/>[pure.zsh]"]
end

node_user(("Shell user"))
node_zsh["Zsh shell"]
node_git["Git"]
node_terminal["Terminal"]

node_user -->|"runs commands"| node_zsh
node_zsh -->|"renders prompt"| node_pure
node_pure -->|"shows symbol"| node_prompt_symbol
node_pure -->|"indicates failure"| node_command_status
node_pure -->|"shows duration"| node_execution_time
node_pure -->|"shows current path"| node_path_display
node_pure -->|"shows branch state"| node_git_status
node_pure -->|"checks remote commits"| node_git_remote
node_pure -->|"checks asynchronously"| node_async_worker
node_async_worker -->|"checks commits"| node_git
node_pure -->|"shows environment"| node_environment
node_pure -->|"shows when relevant"| node_host
node_pure -->|"sets title"| node_terminal_title
node_terminal_title -->|"updates title"| node_terminal
node_pure -->|"indicates mode"| node_vi_mode
node_pure -->|"calls hook"| node_custom_hook

click node_pure "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_prompt_symbol "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_command_status "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_execution_time "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_path_display "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_git_status "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_git_remote "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_async_worker "https://github.com/sindresorhus/pure/blob/main/async.zsh"
click node_environment "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_host "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_terminal_title "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_vi_mode "https://github.com/sindresorhus/pure/blob/main/pure.zsh"
click node_custom_hook "https://github.com/sindresorhus/pure/blob/main/pure.zsh"

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_pure,node_prompt_symbol,node_command_status,node_execution_time,node_path_display,node_user toneBlue
class node_git_status,node_git_remote,node_async_worker toneAmber
class node_environment,node_host,node_terminal_title,node_vi_mode toneMint
class node_custom_hook toneRose
class node_zsh,node_git,node_terminal toneIndigo
```

## Components

### Prompt display

- [Pure prompt](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Prompt symbol](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Command status](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Execution time](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Current path](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`

### Git status

- [Git branch and dirtiness](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Remote commit status](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Async worker](https://github.com/sindresorhus/pure/blob/main/async.zsh): `async.zsh`

### Shell context

- [Environment indicators](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Host and user](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [Terminal title](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`
- [VI-mode indicator](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`

### Customization

- [Custom prompt hook](https://github.com/sindresorhus/pure/blob/main/pure.zsh): `pure.zsh`

### Other components

- **Shell user**
- **Zsh shell**
- **Git**
- **Terminal**

## Connections

- Shell user → Zsh shell: runs commands (evidence: `readme.md`)
- Zsh shell → Pure prompt: renders prompt (evidence: `readme.md`)
- Pure prompt → Prompt symbol: shows symbol (evidence: `readme.md`)
- Pure prompt → Command status: indicates failure (evidence: `readme.md`)
- Pure prompt → Execution time: shows duration (evidence: `readme.md`)
- Pure prompt → Current path: shows current path (evidence: `readme.md`)
- Pure prompt → Git branch and dirtiness: shows branch state (evidence: `readme.md`)
- Pure prompt → Remote commit status: checks remote commits (evidence: `readme.md`)
- Pure prompt → Async worker: checks asynchronously (evidence: `readme.md`)
- Async worker → Git: checks commits (evidence: `readme.md`)
- Pure prompt → Environment indicators: shows environment (evidence: `readme.md`)
- Pure prompt → Host and user: shows when relevant (evidence: `readme.md`)
- Pure prompt → Terminal title: sets title (evidence: `readme.md`)
- Terminal title → Terminal: updates title (evidence: `readme.md`)
- Pure prompt → VI-mode indicator: indicates mode (evidence: `readme.md`)
- Pure prompt → Custom prompt hook: calls hook (evidence: `readme.md`)
