# yuzhian/linkit architecture

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

- Interactive diagram: https://gitdiagram.com/yuzhian/linkit
- Repository: https://github.com/yuzhian/linkit

## Overview

Linkit is a command-line dotfiles manager. A user invokes commands through the CLI; it loads the registered repository configuration, then dispatches repository setup or an entry operation. Linking moves a system path into the repository, creates a symlink, and records the mapping; unlinking restores the file, removal deletes it, and deployment applies manifest mappings. The manifest also configures an optional open command. The excerpts show command dispatch and persistence calls; the README is empty, so broader capabilities are limited to those evident in the CLI and handler.

Main entry points: [`src/main.rs`](https://github.com/yuzhian/linkit/blob/main/src/main.rs) (Command dispatch), [`src/config.rs`](https://github.com/yuzhian/linkit/blob/main/src/config.rs) (Manifest persistence), [`src/handler.rs`](https://github.com/yuzhian/linkit/blob/main/src/handler.rs) (Repository setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and dispatch"]
  node_commands["Command dispatch<br/>[main.rs]"]
end

subgraph group_repository["Repository operations"]
  node_repository_setup["Repository setup<br/>[handler.rs]"]
  node_link["Link entries<br/>[handler.rs]"]
  node_unlink["Unlink entries<br/>[handler.rs]"]
  node_remove["Remove entries<br/>[handler.rs]"]
  node_deploy["Deploy mappings<br/>[handler.rs]"]
  node_open["Open repository<br/>[handler.rs]"]
end

subgraph group_state["Configuration and state"]
  node_config[("Config persistence<br/>[config.rs]")]
  node_manifest[("Manifest persistence<br/>[config.rs]")]
end

subgraph group_integrations["System integrations"]
  node_filesystem[("Local filesystem")]
  node_git["Git executable"]
  node_shell["Command shell"]
end

node_user(("User"))

node_user -->|"invokes"| node_commands
node_commands -->|"loads config"| node_config
node_commands -->|"dispatches setup"| node_repository_setup
node_commands -->|"dispatches link"| node_link
node_commands -->|"dispatches unlink"| node_unlink
node_commands -->|"dispatches remove"| node_remove
node_commands -->|"dispatches deploy"| node_deploy
node_commands -->|"dispatches open"| node_open
node_repository_setup -->|"saves config"| node_config
node_repository_setup -->|"runs git"| node_git
node_repository_setup -->|"creates files"| node_filesystem
node_link -->|"reads and saves"| node_manifest
node_link -->|"moves and links"| node_filesystem
node_unlink -->|"reads and saves"| node_manifest
node_unlink -->|"restores file"| node_filesystem
node_remove -->|"reads and saves"| node_manifest
node_remove -->|"deletes files"| node_filesystem
node_deploy -->|"loads mappings"| node_manifest
node_deploy -->|"creates links"| node_filesystem
node_open -->|"loads command"| node_manifest
node_open -->|"runs command"| node_shell

click node_commands "https://github.com/yuzhian/linkit/blob/main/src/main.rs"
click node_repository_setup "https://github.com/yuzhian/linkit/blob/main/src/handler.rs"
click node_link "https://github.com/yuzhian/linkit/blob/main/src/handler.rs"
click node_unlink "https://github.com/yuzhian/linkit/blob/main/src/handler.rs"
click node_remove "https://github.com/yuzhian/linkit/blob/main/src/handler.rs"
click node_deploy "https://github.com/yuzhian/linkit/blob/main/src/handler.rs"
click node_open "https://github.com/yuzhian/linkit/blob/main/src/handler.rs"
click node_config "https://github.com/yuzhian/linkit/blob/main/src/config.rs"
click node_manifest "https://github.com/yuzhian/linkit/blob/main/src/config.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_commands,node_user toneBlue
class node_repository_setup,node_link,node_unlink,node_remove,node_deploy,node_open toneAmber
class node_config,node_manifest toneMint
class node_filesystem,node_git,node_shell toneRose
```

## Components

### CLI and dispatch

- [Command dispatch](https://github.com/yuzhian/linkit/blob/main/src/main.rs): `src/main.rs`

### Repository operations

- [Repository setup](https://github.com/yuzhian/linkit/blob/main/src/handler.rs): `src/handler.rs`
- [Link entries](https://github.com/yuzhian/linkit/blob/main/src/handler.rs): `src/handler.rs`
- [Unlink entries](https://github.com/yuzhian/linkit/blob/main/src/handler.rs): `src/handler.rs`
- [Remove entries](https://github.com/yuzhian/linkit/blob/main/src/handler.rs): `src/handler.rs`
- [Deploy mappings](https://github.com/yuzhian/linkit/blob/main/src/handler.rs): `src/handler.rs`
- [Open repository](https://github.com/yuzhian/linkit/blob/main/src/handler.rs): `src/handler.rs`

### Configuration and state

- [Config persistence](https://github.com/yuzhian/linkit/blob/main/src/config.rs): `src/config.rs`
- [Manifest persistence](https://github.com/yuzhian/linkit/blob/main/src/config.rs): `src/config.rs`

### System integrations

- **Local filesystem**
- **Git executable**
- **Command shell**

### Other components

- **User**

## Connections

- User → Command dispatch: invokes (evidence: `src/main.rs`)
- Command dispatch → Config persistence: loads config (evidence: `src/main.rs`)
- Command dispatch → Repository setup: dispatches setup (evidence: `src/main.rs`)
- Command dispatch → Link entries: dispatches link (evidence: `src/main.rs`)
- Command dispatch → Unlink entries: dispatches unlink (evidence: `src/main.rs`)
- Command dispatch → Remove entries: dispatches remove (evidence: `src/main.rs`)
- Command dispatch → Deploy mappings: dispatches deploy (evidence: `src/main.rs`)
- Command dispatch → Open repository: dispatches open (evidence: `src/main.rs`)
- Repository setup → Config persistence: saves config (evidence: `src/handler.rs`)
- Repository setup → Git executable: runs git (evidence: `src/handler.rs`)
- Repository setup → Local filesystem: creates files (evidence: `src/handler.rs`)
- Link entries → Manifest persistence: reads and saves (evidence: `src/handler.rs`)
- Link entries → Local filesystem: moves and links (evidence: `src/handler.rs`)
- Unlink entries → Manifest persistence: reads and saves (evidence: `src/handler.rs`)
- Unlink entries → Local filesystem: restores file (evidence: `src/handler.rs`)
- Remove entries → Manifest persistence: reads and saves (evidence: `src/handler.rs`)
- Remove entries → Local filesystem: deletes files (evidence: `src/handler.rs`)
- Deploy mappings → Manifest persistence: loads mappings (evidence: `src/handler.rs`)
- Deploy mappings → Local filesystem: creates links (evidence: `src/handler.rs`)
- Open repository → Manifest persistence: loads command (evidence: `src/handler.rs`)
- Open repository → Command shell: runs command (evidence: `src/handler.rs`)
