# faris0x/mut architecture

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

- Interactive diagram: https://gitdiagram.com/faris0x/mut
- Repository: https://github.com/faris0x/mut

## Overview

μT is a terminal LaTeX studio: users open or initialize a project, edit and manage its files, build with its in-process TeX engine, then inspect rendered pages and diagnostics. The graph also preserves project validation, completion, Git, settings, and crash-safe file handling. Several implementation links are supported only by README descriptions or the source index; where neither provides direct evidence, links are omitted rather than inferred.

Main entry points: [`src/app/mod.rs`](https://github.com/faris0x/mut/blob/v2/src/app/mod.rs) (Editor app), [`src/cli.rs`](https://github.com/faris0x/mut/blob/v2/src/cli.rs) (CLI entry), [`src/tex/embedded.rs`](https://github.com/faris0x/mut/blob/v2/src/tex/embedded.rs) (Embedded TeX engine), [`src/project/check.rs`](https://github.com/faris0x/mut/blob/v2/src/project/check.rs) (Project checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workspace workflow"]
  node_cli["CLI entry<br/>[cli.rs]"]
  node_app["Editor app<br/>[mod.rs]"]
  node_editor["Text editor<br/>[editor.rs]"]
  node_completion["LaTeX completion<br/>[index.rs]"]
  node_files["File operations<br/>[fileops.rs]"]
  node_workspace["Workspace files<br/>[workspace.rs]"]
end

subgraph group_tex["TeX and preview"]
  node_texengine["Embedded TeX engine<br/>[embedded.rs]"]
  node_shelf[("Shelf packages<br/>[shelf_source.rs]")]
  node_texknowledge[("TeX knowledge<br/>[knowledge.rs]")]
  node_pdf["PDF rasterizer<br/>[mod.rs]"]
  node_kitty["Kitty preview<br/>[kitty.rs]"]
  node_synctex["Source navigation<br/>[synctex.rs]"]
end

subgraph group_project["Project services"]
  node_project["Project manifest<br/>[manifest.rs]"]
  node_scaffold["Project scaffold<br/>[scaffold.rs]"]
  node_checks["Project checks<br/>[check.rs]"]
  node_refs["Reference rewriting<br/>[refs.rs]"]
  node_git["Git integration<br/>[mod.rs]"]
end

subgraph group_support["State and interface"]
  node_save["Atomic saves<br/>[save.rs]"]
  node_recovery[("Crash recovery<br/>[recovery.rs]")]
  node_config["User settings<br/>[mod.rs]"]
  node_paths["App directories<br/>[paths.rs]"]
  node_inspector["Inspector panels<br/>[inspector.rs]"]
  node_commands["Command registry<br/>[mod.rs]"]
end

node_user(("Terminal user"))
node_gitservice["Git executable"]
node_terminal["Terminal interface"]

node_user -->|"opens or initializes"| node_cli
node_cli -->|"starts editor"| node_app
node_user -->|"edits document"| node_app
node_app -->|"renders editor"| node_editor
node_editor -.->|"offers suggestions"| node_completion
node_app -->|"manages files"| node_files
node_files -.->|"updates tree"| node_workspace
node_app -.->|"builds document"| node_texengine
node_texengine -->|"loads TeX files"| node_shelf
node_texengine -.->|"produces PDF"| node_pdf
node_pdf -.->|"renders preview"| node_kitty
node_kitty -.->|"jumps to source"| node_synctex
node_app -->|"loads project"| node_project
node_app -.->|"requests checks"| node_checks
node_project -->|"validates project"| node_checks
node_cli -.->|"creates project"| node_scaffold
node_app -.->|"rewrites references"| node_refs
node_app -->|"requests Git actions"| node_git
node_checks -->|"reads tracked files"| node_git
node_git -->|"runs commands"| node_gitservice
node_app -.->|"saves buffers"| node_save
node_app -->|"stores snapshots"| node_recovery
node_recovery -->|"keeps backups"| node_save
node_config -->|"resolves config path"| node_paths
node_app -->|"loads preferences"| node_config
node_app -->|"renders inspector"| node_inspector
node_app -->|"dispatches commands"| node_commands
node_app -->|"draws interface"| node_terminal

click node_cli "https://github.com/faris0x/mut/blob/v2/src/cli.rs"
click node_app "https://github.com/faris0x/mut/blob/v2/src/app/mod.rs"
click node_editor "https://github.com/faris0x/mut/blob/v2/src/ui/editor.rs"
click node_completion "https://github.com/faris0x/mut/blob/v2/src/tex/index.rs"
click node_files "https://github.com/faris0x/mut/blob/v2/src/fs/fileops.rs"
click node_workspace "https://github.com/faris0x/mut/blob/v2/src/fs/workspace.rs"
click node_texengine "https://github.com/faris0x/mut/blob/v2/src/tex/embedded.rs"
click node_shelf "https://github.com/faris0x/mut/blob/v2/src/tex/shelf_source.rs"
click node_texknowledge "https://github.com/faris0x/mut/blob/v2/src/tex/knowledge.rs"
click node_pdf "https://github.com/faris0x/mut/blob/v2/src/pdf/mod.rs"
click node_kitty "https://github.com/faris0x/mut/blob/v2/src/term/kitty.rs"
click node_synctex "https://github.com/faris0x/mut/blob/v2/src/tex/synctex.rs"
click node_project "https://github.com/faris0x/mut/blob/v2/src/project/manifest.rs"
click node_scaffold "https://github.com/faris0x/mut/blob/v2/src/project/scaffold.rs"
click node_checks "https://github.com/faris0x/mut/blob/v2/src/project/check.rs"
click node_refs "https://github.com/faris0x/mut/blob/v2/src/project/refs.rs"
click node_git "https://github.com/faris0x/mut/blob/v2/src/git/mod.rs"
click node_save "https://github.com/faris0x/mut/blob/v2/src/fs/save.rs"
click node_recovery "https://github.com/faris0x/mut/blob/v2/src/fs/recovery.rs"
click node_config "https://github.com/faris0x/mut/blob/v2/src/config/mod.rs"
click node_paths "https://github.com/faris0x/mut/blob/v2/src/config/paths.rs"
click node_inspector "https://github.com/faris0x/mut/blob/v2/src/ui/inspector.rs"
click node_commands "https://github.com/faris0x/mut/blob/v2/src/commands/mod.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_cli,node_app,node_editor,node_completion,node_files,node_workspace,node_user toneBlue
class node_texengine,node_shelf,node_texknowledge,node_pdf,node_kitty,node_synctex toneAmber
class node_project,node_scaffold,node_checks,node_refs,node_git toneMint
class node_save,node_recovery,node_config,node_paths,node_inspector,node_commands toneRose
class node_gitservice,node_terminal toneIndigo
```

## Components

### Workspace workflow

- [CLI entry](https://github.com/faris0x/mut/blob/v2/src/cli.rs): `src/cli.rs`
- [Editor app](https://github.com/faris0x/mut/blob/v2/src/app/mod.rs): `src/app/mod.rs`
- [Text editor](https://github.com/faris0x/mut/blob/v2/src/ui/editor.rs): `src/ui/editor.rs`
- [LaTeX completion](https://github.com/faris0x/mut/blob/v2/src/tex/index.rs): `src/tex/index.rs`
- [File operations](https://github.com/faris0x/mut/blob/v2/src/fs/fileops.rs): `src/fs/fileops.rs`
- [Workspace files](https://github.com/faris0x/mut/blob/v2/src/fs/workspace.rs): `src/fs/workspace.rs`

### TeX and preview

- [Embedded TeX engine](https://github.com/faris0x/mut/blob/v2/src/tex/embedded.rs): `src/tex/embedded.rs`
- [Shelf packages](https://github.com/faris0x/mut/blob/v2/src/tex/shelf_source.rs): `src/tex/shelf_source.rs`
- [TeX knowledge](https://github.com/faris0x/mut/blob/v2/src/tex/knowledge.rs): `src/tex/knowledge.rs`
- [PDF rasterizer](https://github.com/faris0x/mut/blob/v2/src/pdf/mod.rs): `src/pdf/mod.rs`
- [Kitty preview](https://github.com/faris0x/mut/blob/v2/src/term/kitty.rs): `src/term/kitty.rs`
- [Source navigation](https://github.com/faris0x/mut/blob/v2/src/tex/synctex.rs): `src/tex/synctex.rs`

### Project services

- [Project manifest](https://github.com/faris0x/mut/blob/v2/src/project/manifest.rs): `src/project/manifest.rs`
- [Project scaffold](https://github.com/faris0x/mut/blob/v2/src/project/scaffold.rs): `src/project/scaffold.rs`
- [Project checks](https://github.com/faris0x/mut/blob/v2/src/project/check.rs): `src/project/check.rs`
- [Reference rewriting](https://github.com/faris0x/mut/blob/v2/src/project/refs.rs): `src/project/refs.rs`
- [Git integration](https://github.com/faris0x/mut/blob/v2/src/git/mod.rs): `src/git/mod.rs`

### State and interface

- [Atomic saves](https://github.com/faris0x/mut/blob/v2/src/fs/save.rs): `src/fs/save.rs`
- [Crash recovery](https://github.com/faris0x/mut/blob/v2/src/fs/recovery.rs): `src/fs/recovery.rs`
- [User settings](https://github.com/faris0x/mut/blob/v2/src/config/mod.rs): `src/config/mod.rs`
- [App directories](https://github.com/faris0x/mut/blob/v2/src/config/paths.rs): `src/config/paths.rs`
- [Inspector panels](https://github.com/faris0x/mut/blob/v2/src/ui/inspector.rs): `src/ui/inspector.rs`
- [Command registry](https://github.com/faris0x/mut/blob/v2/src/commands/mod.rs): `src/commands/mod.rs`

### Other components

- **Terminal user**
- **Git executable**
- **Terminal interface**

## Connections

- Terminal user → CLI entry: opens or initializes
- CLI entry → Editor app: starts editor (evidence: `src/lib.rs`)
- Terminal user → Editor app: edits document
- Editor app → Text editor: renders editor (evidence: `src/ui/mod.rs`)
- Text editor → LaTeX completion: offers suggestions
- Editor app → File operations: manages files (evidence: `src/app/mod.rs`)
- File operations → Workspace files: updates tree
- Editor app → Embedded TeX engine: builds document (evidence: `src/app/mod.rs`)
- Embedded TeX engine → Shelf packages: loads TeX files (evidence: `src/tex/embedded.rs`)
- Embedded TeX engine → PDF rasterizer: produces PDF
- PDF rasterizer → Kitty preview: renders preview
- Kitty preview → Source navigation: jumps to source
- Editor app → Project manifest: loads project (evidence: `src/app/mod.rs`)
- Editor app → Project checks: requests checks (evidence: `src/app/mod.rs`)
- Project manifest → Project checks: validates project (evidence: `src/project/check.rs`)
- CLI entry → Project scaffold: creates project
- Editor app → Reference rewriting: rewrites references (evidence: `src/app/mod.rs`)
- Editor app → Git integration: requests Git actions (evidence: `src/app/mod.rs`)
- Project checks → Git integration: reads tracked files (evidence: `src/project/check.rs`)
- Git integration → Git executable: runs commands (evidence: `src/git/mod.rs`)
- Editor app → Atomic saves: saves buffers (evidence: `src/app/mod.rs`)
- Editor app → Crash recovery: stores snapshots (evidence: `src/app/mod.rs`)
- Crash recovery → Atomic saves: keeps backups (evidence: `src/fs/recovery.rs`)
- User settings → App directories: resolves config path (evidence: `src/config/mod.rs`)
- Editor app → User settings: loads preferences (evidence: `src/config/mod.rs`)
- Editor app → Inspector panels: renders inspector (evidence: `src/ui/mod.rs`)
- Editor app → Command registry: dispatches commands (evidence: `src/commands/mod.rs`)
- Editor app → Terminal interface: draws interface
