# seruman/git-wt architecture

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

- Interactive diagram: https://gitdiagram.com/seruman/git-wt
- Repository: https://github.com/seruman/git-wt

## Overview

git-wt is a macOS command-line tool for creating, listing, locating, and removing Git worktrees, with optional APFS copy-on-write transfer of ignored local files. The main workflow runs from CLI parsing through command dispatch; creation resolves a branch and destination, adds a Git worktree, and optionally carries local files before reporting the path. The source excerpts are partial, so the graph omits uncertain internal call details while retaining README-documented capabilities.

Main entry points: [`src/lib.rs`](https://github.com/seruman/git-wt/blob/main/src/lib.rs) (Command workflow), [`src/main.rs`](https://github.com/seruman/git-wt/blob/main/src/main.rs) (CLI entry), [`src/git.rs`](https://github.com/seruman/git-wt/blob/main/src/git.rs) (Git operations), [`src/clone.rs`](https://github.com/seruman/git-wt/blob/main/src/clone.rs) (Clone planning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interface"]
  node_entry["CLI entry<br/>[main.rs]"]
end

subgraph group_lifecycle["Worktree lifecycle"]
  node_dispatch["Command workflow<br/>[lib.rs]"]
end

subgraph group_environment["Local environment transfer"]
  node_clone_plan["Clone planning<br/>[clone.rs]"]
  node_clone_populate["Clone population<br/>[clone.rs]"]
  node_native["APFS clone primitive<br/>[native.rs]"]
end

subgraph group_git["Git and naming"]
  node_git_adapter["Git operations<br/>[git.rs]"]
  node_naming["Remote naming<br/>[naming.rs]"]
end

node_user(("Shell user"))
node_git_cli["Git executable"]
node_filesystem["Local filesystem"]
node_stdout["Command output"]

node_user -->|"runs commands"| node_entry
node_entry -->|"dispatches"| node_dispatch
node_dispatch -->|"queries and mutates"| node_git_adapter
node_dispatch -->|"resolves paths"| node_naming
node_dispatch -->|"plans transfer"| node_clone_plan
node_dispatch -->|"populates clone"| node_clone_populate
node_dispatch -->|"reserves and cleans"| node_filesystem
node_git_adapter -->|"runs Git"| node_git_cli
node_naming -->|"reads remote config"| node_git_adapter
node_clone_plan -->|"lists files"| node_git_adapter
node_clone_plan -->|"walks source"| node_filesystem
node_clone_populate -->|"clones files"| node_native
node_clone_populate -->|"creates entries"| node_filesystem
node_native -->|"APFS clonefile"| node_filesystem
node_dispatch -->|"returns output"| node_entry
node_entry -->|"writes result"| node_stdout

click node_entry "https://github.com/seruman/git-wt/blob/main/src/main.rs"
click node_dispatch "https://github.com/seruman/git-wt/blob/main/src/lib.rs"
click node_git_adapter "https://github.com/seruman/git-wt/blob/main/src/git.rs"
click node_naming "https://github.com/seruman/git-wt/blob/main/src/naming.rs"
click node_clone_plan "https://github.com/seruman/git-wt/blob/main/src/clone.rs"
click node_clone_populate "https://github.com/seruman/git-wt/blob/main/src/clone.rs"
click node_native "https://github.com/seruman/git-wt/blob/main/src/native.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_entry,node_user toneBlue
class node_dispatch toneAmber
class node_clone_plan,node_clone_populate,node_native toneMint
class node_git_adapter,node_naming toneRose
class node_git_cli,node_filesystem,node_stdout toneIndigo
```

## Components

### CLI interface

- [CLI entry](https://github.com/seruman/git-wt/blob/main/src/main.rs): `src/main.rs`

### Worktree lifecycle

- [Command workflow](https://github.com/seruman/git-wt/blob/main/src/lib.rs): `src/lib.rs`

### Local environment transfer

- [Clone planning](https://github.com/seruman/git-wt/blob/main/src/clone.rs): `src/clone.rs`
- [Clone population](https://github.com/seruman/git-wt/blob/main/src/clone.rs): `src/clone.rs`
- [APFS clone primitive](https://github.com/seruman/git-wt/blob/main/src/native.rs): `src/native.rs`

### Git and naming

- [Git operations](https://github.com/seruman/git-wt/blob/main/src/git.rs): `src/git.rs`
- [Remote naming](https://github.com/seruman/git-wt/blob/main/src/naming.rs): `src/naming.rs`

### Other components

- **Shell user**
- **Git executable**
- **Local filesystem**
- **Command output**

## Connections

- Shell user → CLI entry: runs commands
- CLI entry → Command workflow: dispatches
- Command workflow → Git operations: queries and mutates
- Command workflow → Remote naming: resolves paths
- Command workflow → Clone planning: plans transfer
- Command workflow → Clone population: populates clone
- Command workflow → Local filesystem: reserves and cleans
- Git operations → Git executable: runs Git
- Remote naming → Git operations: reads remote config
- Clone planning → Git operations: lists files
- Clone planning → Local filesystem: walks source
- Clone population → APFS clone primitive: clones files
- Clone population → Local filesystem: creates entries
- APFS clone primitive → Local filesystem: APFS clonefile
- Command workflow → CLI entry: returns output
- CLI entry → Command output: writes result
