# turtlethom/fcd architecture

> Architecture diagram of the GitHub repository turtlethom/fcd, 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/turtlethom/fcd
- Repository: https://github.com/turtlethom/fcd

## Overview

fcd is a CLI for saving directory shortcuts and selecting them to obtain a path for navigation. Its main workflow loads user configuration, presents saved shortcuts in an interactive menu, and prints the selected path; separate commands manage shortcuts and themes. The graph also captures path validation and menu rendering. Command files for branch, print, colors list, and completion are present and documented, but their implementations were not sampled, so their internal behavior is not inferred.

Main entry points: [`cmd/root.go`](https://github.com/turtlethom/fcd/blob/main/cmd/root.go) (Command router), [`internal/config.go`](https://github.com/turtlethom/fcd/blob/main/internal/config.go) (Config lifecycle), [`main.go`](https://github.com/turtlethom/fcd/blob/main/main.go) (Program entry), [`cmd/colors.go`](https://github.com/turtlethom/fcd/blob/main/cmd/colors.go) (Theme commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Program entry<br/>[main.go]"]
  node_router["Command router<br/>[root.go]"]
  node_completion["Shell completion<br/>[completion.go]"]
end

subgraph group_shortcuts["Shortcut management"]
  node_config["Config lifecycle<br/>[config.go]"]
  node_configfile[("User config")]
  node_pathcheck["Home path check<br/>[utils.go]"]
  node_add["Add shortcut<br/>[add.go]"]
  node_remove["Remove shortcut<br/>[remove.go]"]
  node_clear["Clear shortcuts<br/>[clear.go]"]
  node_branch["Branch navigation<br/>[branch.go]"]
  node_print["Print shortcuts<br/>[print.go]"]
end

subgraph group_menu["Interactive navigation"]
  node_interactive["Menu setup<br/>[root.go]"]
  node_model["Menu interaction<br/>[model.go]"]
  node_styles["Menu rendering<br/>[styles.go]"]
end

subgraph group_settings["Theme settings"]
  node_colorcmd["Theme commands<br/>[colors.go]"]
  node_colorset["Set theme<br/>[colors_set.go]"]
  node_colorlist["List colors<br/>[colors_list.go]"]
end

node_user(("Shell user"))
node_terminal(("Terminal"))

node_user -->|"invokes"| node_main
node_main -->|"loads config"| node_config
node_main -->|"sets config"| node_router
node_router -->|"uses config"| node_config
node_config -->|"reads / writes"| node_configfile
node_add -->|"adds shortcut"| node_config
node_config -->|"validates path"| node_pathcheck
node_add -->|"saves config"| node_configfile
node_remove -->|"updates shortcuts"| node_config
node_remove -->|"saves config"| node_configfile
node_clear -->|"clears shortcuts"| node_config
node_clear -->|"saves config"| node_configfile
node_router -->|"dispatches"| node_add
node_router -->|"dispatches"| node_remove
node_router -->|"dispatches"| node_clear
node_router -->|"dispatches"| node_branch
node_router -->|"dispatches"| node_print
node_router -->|"dispatches"| node_completion
node_router -->|"dispatches"| node_colorcmd
node_colorcmd -->|"dispatches"| node_colorset
node_colorcmd -->|"dispatches"| node_colorlist
node_colorset -->|"updates colors"| node_config
node_colorset -->|"saves config"| node_configfile
node_router -->|"starts menu"| node_interactive
node_interactive -->|"reads shortcuts"| node_config
node_interactive -->|"creates styles"| node_styles
node_interactive -->|"runs model"| node_model
node_interactive -->|"runs UI"| node_terminal
node_model -->|"renders menu"| node_terminal
node_interactive -->|"prints selection"| node_terminal
node_user -->|"chooses shortcut"| node_terminal

click node_main "https://github.com/turtlethom/fcd/blob/main/main.go"
click node_router "https://github.com/turtlethom/fcd/blob/main/cmd/root.go"
click node_config "https://github.com/turtlethom/fcd/blob/main/internal/config.go"
click node_pathcheck "https://github.com/turtlethom/fcd/blob/main/internal/utils.go"
click node_add "https://github.com/turtlethom/fcd/blob/main/cmd/add.go"
click node_remove "https://github.com/turtlethom/fcd/blob/main/cmd/remove.go"
click node_clear "https://github.com/turtlethom/fcd/blob/main/cmd/clear.go"
click node_branch "https://github.com/turtlethom/fcd/blob/main/cmd/branch.go"
click node_print "https://github.com/turtlethom/fcd/blob/main/cmd/print.go"
click node_completion "https://github.com/turtlethom/fcd/blob/main/cmd/completion.go"
click node_interactive "https://github.com/turtlethom/fcd/blob/main/cmd/root.go"
click node_model "https://github.com/turtlethom/fcd/blob/main/internal/model.go"
click node_styles "https://github.com/turtlethom/fcd/blob/main/internal/styles.go"
click node_colorcmd "https://github.com/turtlethom/fcd/blob/main/cmd/colors.go"
click node_colorset "https://github.com/turtlethom/fcd/blob/main/cmd/colors_set.go"
click node_colorlist "https://github.com/turtlethom/fcd/blob/main/cmd/colors_list.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_router,node_completion,node_user toneBlue
class node_config,node_configfile,node_pathcheck,node_add,node_remove,node_clear,node_branch,node_print toneAmber
class node_interactive,node_model,node_styles toneMint
class node_colorcmd,node_colorset,node_colorlist toneRose
class node_terminal toneIndigo
```

## Components

### CLI entry

- [Program entry](https://github.com/turtlethom/fcd/blob/main/main.go): `main.go`
- [Command router](https://github.com/turtlethom/fcd/blob/main/cmd/root.go): `cmd/root.go`
- [Shell completion](https://github.com/turtlethom/fcd/blob/main/cmd/completion.go): `cmd/completion.go`

### Shortcut management

- [Config lifecycle](https://github.com/turtlethom/fcd/blob/main/internal/config.go): `internal/config.go`
- **User config**
- [Home path check](https://github.com/turtlethom/fcd/blob/main/internal/utils.go): `internal/utils.go`
- [Add shortcut](https://github.com/turtlethom/fcd/blob/main/cmd/add.go): `cmd/add.go`
- [Remove shortcut](https://github.com/turtlethom/fcd/blob/main/cmd/remove.go): `cmd/remove.go`
- [Clear shortcuts](https://github.com/turtlethom/fcd/blob/main/cmd/clear.go): `cmd/clear.go`
- [Branch navigation](https://github.com/turtlethom/fcd/blob/main/cmd/branch.go): `cmd/branch.go`
- [Print shortcuts](https://github.com/turtlethom/fcd/blob/main/cmd/print.go): `cmd/print.go`

### Interactive navigation

- [Menu setup](https://github.com/turtlethom/fcd/blob/main/cmd/root.go): `cmd/root.go`
- [Menu interaction](https://github.com/turtlethom/fcd/blob/main/internal/model.go): `internal/model.go`
- [Menu rendering](https://github.com/turtlethom/fcd/blob/main/internal/styles.go): `internal/styles.go`

### Theme settings

- [Theme commands](https://github.com/turtlethom/fcd/blob/main/cmd/colors.go): `cmd/colors.go`
- [Set theme](https://github.com/turtlethom/fcd/blob/main/cmd/colors_set.go): `cmd/colors_set.go`
- [List colors](https://github.com/turtlethom/fcd/blob/main/cmd/colors_list.go): `cmd/colors_list.go`

### Other components

- **Shell user**
- **Terminal**

## Connections

- Shell user → Program entry: invokes
- Program entry → Config lifecycle: loads config
- Program entry → Command router: sets config
- Command router → Config lifecycle: uses config
- Config lifecycle → User config: reads / writes
- Add shortcut → Config lifecycle: adds shortcut
- Config lifecycle → Home path check: validates path
- Add shortcut → User config: saves config
- Remove shortcut → Config lifecycle: updates shortcuts
- Remove shortcut → User config: saves config
- Clear shortcuts → Config lifecycle: clears shortcuts
- Clear shortcuts → User config: saves config
- Command router → Add shortcut: dispatches
- Command router → Remove shortcut: dispatches
- Command router → Clear shortcuts: dispatches
- Command router → Branch navigation: dispatches
- Command router → Print shortcuts: dispatches
- Command router → Shell completion: dispatches
- Command router → Theme commands: dispatches
- Theme commands → Set theme: dispatches
- Theme commands → List colors: dispatches
- Set theme → Config lifecycle: updates colors
- Set theme → User config: saves config
- Command router → Menu setup: starts menu
- Menu setup → Config lifecycle: reads shortcuts
- Menu setup → Menu rendering: creates styles
- Menu setup → Menu interaction: runs model
- Menu setup → Terminal: runs UI
- Menu interaction → Terminal: renders menu
- Menu setup → Terminal: prints selection
- Shell user → Terminal: chooses shortcut
