# 5a6f65/zinit-annex-modular-hooks architecture

> Architecture diagram of the GitHub repository 5a6f65/zinit-annex-modular-hooks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/5a6f65/zinit-annex-modular-hooks
- Repository: https://github.com/5a6f65/zinit-annex-modular-hooks

## Overview

This small Zinit annex lets users move per-plugin or per-snippet hooks into separate files. The documented workflow configures `mhook`, loads a plugin or snippet, and has the annex read matching hook files, which run in the plugin or snippet directory unless `nocd` is set. Source excerpts were unavailable, so relationships beyond those documented are omitted.

Main entry points: [`z-a-modular-hooks.plugin.zsh`](https://github.com/5a6f65/zinit-annex-modular-hooks/blob/main/z-a-modular-hooks.plugin.zsh) (Modular hooks annex), [`z-a-modular-hooks.zsh`](https://github.com/5a6f65/zinit-annex-modular-hooks/blob/main/z-a-modular-hooks.zsh) (Annex runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Zsh user"))
node_zinit(("Zinit"))
node_annex["Modular hooks annex"]
node_runtime["Annex runtime"]
node_hooks["Hook files"]

node_user -->|"loads plugin"| node_zinit
node_zinit -->|"loads annex"| node_annex
node_annex -->|"uses runtime"| node_runtime
node_runtime -->|"reads hooks"| node_hooks

click node_annex "https://github.com/5a6f65/zinit-annex-modular-hooks/blob/main/z-a-modular-hooks.plugin.zsh"
click node_runtime "https://github.com/5a6f65/zinit-annex-modular-hooks/blob/main/z-a-modular-hooks.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_user toneBlue
class node_zinit,node_hooks toneIndigo
class node_annex,node_runtime toneTeal
```

## Components

### Other components

- **Zsh user**
- **Zinit**
- [Modular hooks annex](https://github.com/5a6f65/zinit-annex-modular-hooks/blob/main/z-a-modular-hooks.plugin.zsh): `z-a-modular-hooks.plugin.zsh`
- [Annex runtime](https://github.com/5a6f65/zinit-annex-modular-hooks/blob/main/z-a-modular-hooks.zsh): `z-a-modular-hooks.zsh`
- **Hook files**

## Connections

- Zsh user → Zinit: loads plugin
- Zinit → Modular hooks annex: loads annex
- Modular hooks annex → Annex runtime: uses runtime
- Annex runtime → Hook files: reads hooks
