# qqwst/cli architecture

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

- Interactive diagram: https://gitdiagram.com/qqwst/cli
- Repository: https://github.com/qqwst/cli

## Overview

Task Manager is a command-line tool for creating, listing, prioritizing, starting, and transitioning background tasks, with file persistence and JSON or human-readable output. The main workflow is CLI command dispatch to TaskManager, which applies task-state changes, maintains a priority queue and lookup structures, and saves or loads task records. The graph includes the indexed collection and the queue/hash-table implementations as internal layers. Source excerpts show these relationships; the data file is selected at runtime, so its path is not a repository source path.

Main entry points: [`src/task_manager.h`](https://github.com/qqwst/cli/blob/main/src/task_manager.h) (Task manager), [`src/structs/queue.h`](https://github.com/qqwst/cli/blob/main/src/structs/queue.h) (Priority queue), [`src/structs/array.h`](https://github.com/qqwst/cli/blob/main/src/structs/array.h) (Dynamic array), [`src/main.cpp`](https://github.com/qqwst/cli/blob/main/src/main.cpp) (Command CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Command interface"]
  node_cli["Command CLI<br/>[main.cpp]"]
end

subgraph group_lifecycle["Task lifecycle"]
  node_manager["Task manager<br/>[task_manager.h]"]
  node_task["Task model<br/>[task.h]"]
end

subgraph group_structures["Internal structures"]
  node_array["Dynamic array<br/>[array.h]"]
  node_hash["ID index<br/>[hash_table.h]"]
  node_queue["Priority queue<br/>[queue.h]"]
end

node_user(("CLI user"))
node_datafile[("Task data file")]

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches operations"| node_manager
node_manager -->|"creates and transitions"| node_task
node_manager -->|"loads and saves"| node_datafile
node_manager -->|"stores task records"| node_array
node_manager -->|"indexes task IDs"| node_hash
node_manager -->|"queues and selects tasks"| node_queue
node_hash -->|"stores buckets"| node_array
node_queue -->|"stores heap"| node_array
node_queue -->|"orders tasks"| node_task

click node_cli "https://github.com/qqwst/cli/blob/main/src/main.cpp"
click node_manager "https://github.com/qqwst/cli/blob/main/src/task_manager.h"
click node_task "https://github.com/qqwst/cli/blob/main/src/structs/task.h"
click node_array "https://github.com/qqwst/cli/blob/main/src/structs/array.h"
click node_hash "https://github.com/qqwst/cli/blob/main/src/structs/hash_table.h"
click node_queue "https://github.com/qqwst/cli/blob/main/src/structs/queue.h"

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_cli,node_user toneBlue
class node_manager,node_task,node_datafile toneAmber
class node_array,node_hash,node_queue toneMint
```

## Components

### Command interface

- [Command CLI](https://github.com/qqwst/cli/blob/main/src/main.cpp): `src/main.cpp`

### Task lifecycle

- [Task manager](https://github.com/qqwst/cli/blob/main/src/task_manager.h): `src/task_manager.h`
- [Task model](https://github.com/qqwst/cli/blob/main/src/structs/task.h): `src/structs/task.h`

### Internal structures

- [Dynamic array](https://github.com/qqwst/cli/blob/main/src/structs/array.h): `src/structs/array.h`
- [ID index](https://github.com/qqwst/cli/blob/main/src/structs/hash_table.h): `src/structs/hash_table.h`
- [Priority queue](https://github.com/qqwst/cli/blob/main/src/structs/queue.h): `src/structs/queue.h`

### Other components

- **CLI user**
- **Task data file**

## Connections

- CLI user → Command CLI: runs commands (evidence: `src/main.cpp`)
- Command CLI → Task manager: dispatches operations (evidence: `src/main.cpp`)
- Task manager → Task model: creates and transitions (evidence: `src/task_manager.h`)
- Task manager → Task data file: loads and saves (evidence: `src/task_manager.h`)
- Task manager → Dynamic array: stores task records (evidence: `src/task_manager.h`)
- Task manager → ID index: indexes task IDs (evidence: `src/task_manager.h`)
- Task manager → Priority queue: queues and selects tasks (evidence: `src/task_manager.h`)
- ID index → Dynamic array: stores buckets (evidence: `src/structs/hash_table.h`)
- Priority queue → Dynamic array: stores heap (evidence: `src/structs/queue.h`)
- Priority queue → Task model: orders tasks (evidence: `src/structs/queue.h`)
