# turtlethom/pathpin architecture

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

- Interactive diagram: https://gitdiagram.com/turtlethom/pathpin
- Repository: https://github.com/turtlethom/pathpin

## Overview

fcd is a terminal shortcut manager: users save directories under their home directory, then print, remove, clear, jump to one by label, or select one in an interactive menu. Startup loads shared configuration before Cobra dispatches commands. The interactive route builds a styled list, runs the Bubble Tea model, and prints the selected path; management commands update the same persisted configuration. Colors and shell completion are additional documented capabilities. Evidence is limited to the README and indexed excerpts; unexcerpted command implementations are represented only where their capability is documented.

Main entry points: [`cmd/root.go`](https://github.com/turtlethom/pathpin/blob/main/cmd/root.go) (Command router), [`internal/config.go`](https://github.com/turtlethom/pathpin/blob/main/internal/config.go) (Config handling), [`main.go`](https://github.com/turtlethom/pathpin/blob/main/main.go) (Startup), [`cmd/colors.go`](https://github.com/turtlethom/pathpin/blob/main/cmd/colors.go) (Colors command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Startup<br/>[main.go]"]
  node_commands["Command router<br/>[root.go]"]
end

subgraph group_shortcuts["Shortcut workflows"]
  node_add["Add shortcut<br/>[add.go]"]
  node_remove["Remove shortcut<br/>[remove.go]"]
  node_clear["Clear shortcuts<br/>[clear.go]"]
  node_print["Print shortcuts<br/>[print.go]"]
  node_branch["Branch by label<br/>[branch.go]"]
end

subgraph group_menu["Interactive menu"]
  node_menu["Menu orchestration<br/>[root.go]"]
  node_model["Menu interaction<br/>[model.go]"]
  node_styles["Menu styling<br/>[styles.go]"]
end

subgraph group_settings["Settings and completion"]
  node_colors["Colors command<br/>[colors.go]"]
  node_color_set["Set colors<br/>[colors_set.go]"]
  node_color_list["List colors<br/>[colors_list.go]"]
  node_completion["Shell completion<br/>[completion.go]"]
end

subgraph group_state["Configuration state"]
  node_config["Config handling<br/>[config.go]"]
  node_config_file[("User config file")]
end

node_user(("User"))
node_terminal["Terminal output"]

node_user -->|"runs fcd"| node_main
node_main -->|"loads config"| node_config
node_main -->|"starts commands"| node_commands
node_commands -->|"dispatches"| node_add
node_commands -->|"dispatches"| node_remove
node_commands -->|"dispatches"| node_clear
node_commands -->|"dispatches"| node_print
node_commands -->|"dispatches"| node_branch
node_commands -->|"dispatches"| node_colors
node_commands -->|"dispatches"| node_completion
node_commands -->|"runs by default"| node_menu
node_config -->|"loads and saves"| node_config_file
node_add -->|"adds and saves"| node_config
node_remove -->|"saves changes"| node_config
node_clear -->|"saves changes"| node_config
node_print -->|"prints list"| node_terminal
node_branch -->|"prints path"| node_terminal
node_menu -->|"reads shortcuts"| node_config
node_menu -->|"creates styles"| node_styles
node_menu -->|"runs model"| node_model
node_styles -->|"styles list view"| node_model
node_menu -->|"prints selected path"| node_terminal
node_colors -->|"offers set"| node_color_set
node_colors -->|"offers list"| node_color_list
node_color_set -->|"saves colors"| node_config
node_user -->|"requests scripts"| node_completion

click node_main "https://github.com/turtlethom/pathpin/blob/main/main.go"
click node_commands "https://github.com/turtlethom/pathpin/blob/main/cmd/root.go"
click node_config "https://github.com/turtlethom/pathpin/blob/main/internal/config.go"
click node_add "https://github.com/turtlethom/pathpin/blob/main/cmd/add.go"
click node_remove "https://github.com/turtlethom/pathpin/blob/main/cmd/remove.go"
click node_clear "https://github.com/turtlethom/pathpin/blob/main/cmd/clear.go"
click node_print "https://github.com/turtlethom/pathpin/blob/main/cmd/print.go"
click node_branch "https://github.com/turtlethom/pathpin/blob/main/cmd/branch.go"
click node_menu "https://github.com/turtlethom/pathpin/blob/main/cmd/root.go"
click node_model "https://github.com/turtlethom/pathpin/blob/main/internal/model.go"
click node_styles "https://github.com/turtlethom/pathpin/blob/main/internal/styles.go"
click node_colors "https://github.com/turtlethom/pathpin/blob/main/cmd/colors.go"
click node_color_set "https://github.com/turtlethom/pathpin/blob/main/cmd/colors_set.go"
click node_color_list "https://github.com/turtlethom/pathpin/blob/main/cmd/colors_list.go"
click node_completion "https://github.com/turtlethom/pathpin/blob/main/cmd/completion.go"

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_main,node_commands,node_user toneBlue
class node_add,node_remove,node_clear,node_print,node_branch toneAmber
class node_menu,node_model,node_styles toneMint
class node_colors,node_color_set,node_color_list,node_completion toneRose
class node_config,node_config_file,node_terminal toneIndigo
```

## Components

### CLI entry

- [Startup](https://github.com/turtlethom/pathpin/blob/main/main.go): `main.go`
- [Command router](https://github.com/turtlethom/pathpin/blob/main/cmd/root.go): `cmd/root.go`

### Shortcut workflows

- [Add shortcut](https://github.com/turtlethom/pathpin/blob/main/cmd/add.go): `cmd/add.go`
- [Remove shortcut](https://github.com/turtlethom/pathpin/blob/main/cmd/remove.go): `cmd/remove.go`
- [Clear shortcuts](https://github.com/turtlethom/pathpin/blob/main/cmd/clear.go): `cmd/clear.go`
- [Print shortcuts](https://github.com/turtlethom/pathpin/blob/main/cmd/print.go): `cmd/print.go`
- [Branch by label](https://github.com/turtlethom/pathpin/blob/main/cmd/branch.go): `cmd/branch.go`

### Interactive menu

- [Menu orchestration](https://github.com/turtlethom/pathpin/blob/main/cmd/root.go): `cmd/root.go`
- [Menu interaction](https://github.com/turtlethom/pathpin/blob/main/internal/model.go): `internal/model.go`
- [Menu styling](https://github.com/turtlethom/pathpin/blob/main/internal/styles.go): `internal/styles.go`

### Settings and completion

- [Colors command](https://github.com/turtlethom/pathpin/blob/main/cmd/colors.go): `cmd/colors.go`
- [Set colors](https://github.com/turtlethom/pathpin/blob/main/cmd/colors_set.go): `cmd/colors_set.go`
- [List colors](https://github.com/turtlethom/pathpin/blob/main/cmd/colors_list.go): `cmd/colors_list.go`
- [Shell completion](https://github.com/turtlethom/pathpin/blob/main/cmd/completion.go): `cmd/completion.go`

### Configuration state

- [Config handling](https://github.com/turtlethom/pathpin/blob/main/internal/config.go): `internal/config.go`
- **User config file**

### Other components

- **User**
- **Terminal output**

## Connections

- User → Startup: runs fcd (evidence: `README.md`)
- Startup → Config handling: loads config (evidence: `main.go`)
- Startup → Command router: starts commands (evidence: `main.go`)
- Command router → Add shortcut: dispatches (evidence: `cmd/root.go`)
- Command router → Remove shortcut: dispatches (evidence: `cmd/root.go`)
- Command router → Clear shortcuts: dispatches (evidence: `cmd/root.go`)
- Command router → Print shortcuts: dispatches (evidence: `cmd/root.go`)
- Command router → Branch by label: dispatches (evidence: `cmd/root.go`)
- Command router → Colors command: dispatches (evidence: `cmd/root.go`)
- Command router → Shell completion: dispatches (evidence: `cmd/root.go`)
- Command router → Menu orchestration: runs by default (evidence: `cmd/root.go`)
- Config handling → User config file: loads and saves (evidence: `internal/config.go`)
- Add shortcut → Config handling: adds and saves (evidence: `cmd/add.go`)
- Remove shortcut → Config handling: saves changes (evidence: `cmd/remove.go`)
- Clear shortcuts → Config handling: saves changes (evidence: `cmd/clear.go`)
- Print shortcuts → Terminal output: prints list (evidence: `cmd/print.go`)
- Branch by label → Terminal output: prints path (evidence: `cmd/branch.go`)
- Menu orchestration → Config handling: reads shortcuts (evidence: `cmd/root.go`)
- Menu orchestration → Menu styling: creates styles (evidence: `cmd/root.go`)
- Menu orchestration → Menu interaction: runs model (evidence: `cmd/root.go`)
- Menu styling → Menu interaction: styles list view (evidence: `internal/styles.go`)
- Menu orchestration → Terminal output: prints selected path (evidence: `cmd/root.go`)
- Colors command → Set colors: offers set (evidence: `README.md`)
- Colors command → List colors: offers list (evidence: `README.md`)
- Set colors → Config handling: saves colors (evidence: `cmd/colors_set.go`)
- User → Shell completion: requests scripts (evidence: `README.md`)
