# knuspii/crunchycleaner architecture

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

- Interactive diagram: https://gitdiagram.com/knuspii/crunchycleaner
- Repository: https://github.com/knuspii/crunchycleaner

## Overview

CrunchyCleaner is a cross-platform CLI/TUI for finding and removing software caches and temporary files. The principal workflow is to identify existing cache locations, show them for selection (or select all in automated mode), then clean selected paths or report what would be cleaned in dry-run mode. The excerpts show the cache catalog, scanning and filesystem helpers, and parts of the UI and cleanup logic; some wiring between startup and scanning is omitted, so that link is documented rather than source-verified.

Main entry points: [`cc_main.go`](https://github.com/knuspii/crunchycleaner/blob/main/cc_main.go) (CLI and TUI), [`cc_funcs.go`](https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.go) (Cache scanning), [`cc_caches.go`](https://github.com/knuspii/crunchycleaner/blob/main/cc_caches.go) (Cache catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["User workflow"]
  node_entry["CLI and TUI<br/>[cc_main.go]"]
  node_cleanup["Cleanup orchestration<br/>[cc_main.go]"]
end

subgraph group_cache["Cache discovery"]
  node_catalog["Cache catalog<br/>[cc_caches.go]"]
  node_scanner["Cache scanning<br/>[cc_funcs.go]"]
end

subgraph group_cleanup["Cleanup runtime"]
  node_filesystem["Path and file operations<br/>[cc_funcs.go]"]
  node_disk["Disk metrics<br/>[cc_funcs.go]"]
end

node_user(("User"))
node_keyboard["Keyboard input"]

node_user -->|"starts tool"| node_entry
node_entry -.->|"offers cache choices"| node_catalog
node_scanner -->|"loads paths"| node_catalog
node_entry -.->|"scans caches"| node_scanner
node_entry -->|"starts cleanup"| node_cleanup
node_cleanup -->|"matches and deletes"| node_filesystem
node_entry -->|"sizes paths"| node_filesystem
node_entry -->|"reads metrics"| node_disk
node_keyboard -->|"provides keys"| node_entry

click node_entry "https://github.com/knuspii/crunchycleaner/blob/main/cc_main.go"
click node_catalog "https://github.com/knuspii/crunchycleaner/blob/main/cc_caches.go"
click node_scanner "https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.go"
click node_cleanup "https://github.com/knuspii/crunchycleaner/blob/main/cc_main.go"
click node_filesystem "https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.go"
click node_disk "https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.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_entry,node_cleanup,node_user toneBlue
class node_catalog,node_scanner toneAmber
class node_filesystem,node_disk toneMint
class node_keyboard toneIndigo
```

## Components

### User workflow

- [CLI and TUI](https://github.com/knuspii/crunchycleaner/blob/main/cc_main.go): `cc_main.go`
- [Cleanup orchestration](https://github.com/knuspii/crunchycleaner/blob/main/cc_main.go): `cc_main.go`

### Cache discovery

- [Cache catalog](https://github.com/knuspii/crunchycleaner/blob/main/cc_caches.go): `cc_caches.go`
- [Cache scanning](https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.go): `cc_funcs.go`

### Cleanup runtime

- [Path and file operations](https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.go): `cc_funcs.go`
- [Disk metrics](https://github.com/knuspii/crunchycleaner/blob/main/cc_funcs.go): `cc_funcs.go`

### Other components

- **User**
- **Keyboard input**

## Connections

- User → CLI and TUI: starts tool (evidence: `README.md`)
- CLI and TUI → Cache catalog: offers cache choices (evidence: `README.md`)
- Cache scanning → Cache catalog: loads paths (evidence: `cc_funcs.go`)
- CLI and TUI → Cache scanning: scans caches
- CLI and TUI → Cleanup orchestration: starts cleanup (evidence: `cc_main.go`)
- Cleanup orchestration → Path and file operations: matches and deletes (evidence: `cc_main.go`)
- CLI and TUI → Path and file operations: sizes paths (evidence: `cc_main.go`)
- CLI and TUI → Disk metrics: reads metrics (evidence: `cc_main.go`)
- Keyboard input → CLI and TUI: provides keys (evidence: `cc_main.go`)
