# mukh4w/cbox architecture

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

- Interactive diagram: https://gitdiagram.com/mukh4w/cbox
- Repository: https://github.com/mukh4w/cbox

## Overview

cbox is a small Rust terminal command launcher: users save project-local or global commands, search and select them, then inject a selection into the shell or execute it. The graph separates shell integration, the interactive workflow, and command persistence. The README documents the supported shell flows; sampled source confirms the TUI/store operations, but omitted portions limit detail on some runtime relationships.

Main entry points: [`src/main.rs`](https://github.com/mukh4w/cbox/blob/main/src/main.rs) (Interactive TUI), [`src/store.rs`](https://github.com/mukh4w/cbox/blob/main/src/store.rs) (Command store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Shell integration"]
  node_shell["Bash, Zsh, Fish"]
  node_init["Integration scripts<br/>[main.rs]"]
end

subgraph group_app["Command launcher"]
  node_tui["Interactive TUI<br/>[main.rs]"]
  node_search["Fuzzy search<br/>[main.rs]"]
  node_selection["Select or edit<br/>[main.rs]"]
  node_result["Inject or execute<br/>[main.rs]"]
end

subgraph group_storage["Command storage"]
  node_store["Command store<br/>[store.rs]"]
  node_command_files[("Local and global files<br/>[store.rs]")]
end

node_user(("Shell user"))

node_user -->|"uses"| node_shell
node_shell -->|"loads scripts"| node_init
node_init -->|"opens launcher"| node_tui
node_user -->|"opens directly"| node_tui
node_tui -->|"loads commands"| node_store
node_tui -.->|"filters entries"| node_search
node_search -.->|"ranks matches"| node_selection
node_selection -->|"adds or deletes"| node_store
node_selection -->|"returns selection"| node_result
node_result -->|"injects or runs"| node_shell
node_store -->|"reads and writes"| node_command_files

click node_init "https://github.com/mukh4w/cbox/blob/main/src/main.rs"
click node_tui "https://github.com/mukh4w/cbox/blob/main/src/main.rs"
click node_search "https://github.com/mukh4w/cbox/blob/main/src/main.rs"
click node_selection "https://github.com/mukh4w/cbox/blob/main/src/main.rs"
click node_result "https://github.com/mukh4w/cbox/blob/main/src/main.rs"
click node_store "https://github.com/mukh4w/cbox/blob/main/src/store.rs"
click node_command_files "https://github.com/mukh4w/cbox/blob/main/src/store.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_shell,node_init,node_user toneBlue
class node_tui,node_search,node_selection,node_result toneAmber
class node_store,node_command_files toneMint
```

## Components

### Shell integration

- **Bash, Zsh, Fish**
- [Integration scripts](https://github.com/mukh4w/cbox/blob/main/src/main.rs): `src/main.rs`

### Command launcher

- [Interactive TUI](https://github.com/mukh4w/cbox/blob/main/src/main.rs): `src/main.rs`
- [Fuzzy search](https://github.com/mukh4w/cbox/blob/main/src/main.rs): `src/main.rs`
- [Select or edit](https://github.com/mukh4w/cbox/blob/main/src/main.rs): `src/main.rs`
- [Inject or execute](https://github.com/mukh4w/cbox/blob/main/src/main.rs): `src/main.rs`

### Command storage

- [Command store](https://github.com/mukh4w/cbox/blob/main/src/store.rs): `src/store.rs`
- [Local and global files](https://github.com/mukh4w/cbox/blob/main/src/store.rs): `src/store.rs`

### Other components

- **Shell user**

## Connections

- Shell user → Bash, Zsh, Fish: uses (evidence: `README.md`)
- Bash, Zsh, Fish → Integration scripts: loads scripts (evidence: `README.md`)
- Integration scripts → Interactive TUI: opens launcher (evidence: `src/main.rs`)
- Shell user → Interactive TUI: opens directly (evidence: `README.md`)
- Interactive TUI → Command store: loads commands (evidence: `README.md`)
- Interactive TUI → Fuzzy search: filters entries (evidence: `src/main.rs`)
- Fuzzy search → Select or edit: ranks matches (evidence: `src/main.rs`)
- Select or edit → Command store: adds or deletes (evidence: `src/main.rs`)
- Select or edit → Inject or execute: returns selection (evidence: `src/main.rs`)
- Inject or execute → Bash, Zsh, Fish: injects or runs (evidence: `README.md`)
- Command store → Local and global files: reads and writes (evidence: `src/store.rs`)
