# mnemoo/cli architecture

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

## Overview

stakecli is a CLI/TUI and MCP application for browsing Stake Engine teams and games, validating and uploading game assets, and publishing releases. Users enter through the CLI or interactive TUI; adapters call application use cases in service, which coordinate compliance, upload planning and execution, then publish through Stake’s API. The repository also provides approval conversations with persistent read state and hooks, MLR and repack tools, and an optional encrypted upload relay. README documents these capabilities; unsampled subsystem links are included only where the documented workflow supports them.

Main entry points: [`internal/service/service.go`](https://github.com/mnemoo/cli/blob/main/internal/service/service.go) (Application service), [`internal/tui/app/app.go`](https://github.com/mnemoo/cli/blob/main/internal/tui/app/app.go) (Interactive TUI), [`internal/cli`](https://github.com/mnemoo/cli/tree/main/internal/cli) (CLI commands), [`internal/conversations/manager.go`](https://github.com/mnemoo/cli/blob/main/internal/conversations/manager.go) (Conversation manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["CLI commands"]
  node_tui["Interactive TUI<br/>[app.go]"]
end

subgraph group_workflow["Asset workflows"]
  node_service["Application service<br/>[service.go]"]
  node_compliance["Math compliance<br/>[compliance.go]"]
  node_mlr["MLR reweighting<br/>[mlr.go]"]
  node_repack["Book repacking<br/>[apply.go]"]
  node_uploader["Upload execution<br/>[uploader.go]"]
end

subgraph group_platform["Stake integration"]
  node_auth["Session and accounts<br/>[auth.go]"]
  node_api["Stake API client<br/>[client.go]"]
  node_updater["Self updater<br/>[check.go]"]
end

subgraph group_collaboration["Approvals and agents"]
  node_conversations["Conversation manager<br/>[manager.go]"]
  node_conversationstore[("Read state and receipts<br/>[store.go]")]
  node_hooks["Message hooks<br/>[hooks.go]"]
  node_mcp["MCP server<br/>[server.go]"]
  node_daemon["Upload daemon<br/>[daemon.go]"]
  node_operations[("Operation state<br/>[store.go]")]
end

subgraph group_relay["Upload acceleration"]
  node_acceleratorclient["Relay client<br/>[client.go]"]
  node_acceleratorserver["Relay server<br/>[server.go]"]
end

node_user(("CLI/TUI user"))
node_stake(("Stake Engine"))
node_objectstore[("Presigned object storage")]
node_hooktarget(("Hook destinations"))
node_mcpclient(("Coding agent"))
node_relayoperator(("Relay operator"))

node_user -->|"runs commands"| node_cli
node_user -->|"opens interface"| node_tui
node_cli -->|"invokes use cases"| node_service
node_tui -->|"invokes use cases"| node_service
node_tui -->|"selects account"| node_auth
node_service -->|"checks math"| node_compliance
node_cli -->|"runs MLR"| node_mlr
node_tui -.->|"offers reweighting"| node_mlr
node_cli -->|"estimates or repacks"| node_repack
node_tui -->|"offers confirmed repack"| node_repack
node_service -->|"plans and executes"| node_uploader
node_service -->|"reads and publishes"| node_api
node_uploader -->|"requests upload plan"| node_api
node_api -->|"calls API"| node_stake
node_uploader -->|"transfers presigned parts"| node_objectstore
node_auth -->|"provides session"| node_api
node_tui -->|"views approvals"| node_conversations
node_mcp -->|"handles review tools"| node_conversations
node_conversations -->|"fetches and sends threads"| node_service
node_conversations -->|"persists read state"| node_conversationstore
node_conversations -->|"dispatches message events"| node_hooks
node_hooks -->|"delivers notifications"| node_hooktarget
node_user -->|"uses coding agent"| node_mcpclient
node_mcpclient -->|"connects over stdio"| node_mcp
node_mcp -->|"invokes tools"| node_service
node_mcp -->|"queues upload work"| node_daemon
node_daemon -->|"executes upload use cases"| node_service
node_service -->|"tracks upload operation"| node_operations
node_cli -->|"configures or tests relay"| node_acceleratorclient
node_tui -.->|"selects relay upload"| node_acceleratorclient
node_service -.->|"uses alternate transport"| node_acceleratorclient
node_acceleratorclient -.->|"sends encrypted stream"| node_acceleratorserver
node_relayoperator -->|"runs relay daemon"| node_acceleratorserver
node_acceleratorserver -.->|"delivers queued parts"| node_objectstore
node_cli -->|"checks and installs update"| node_updater

click node_cli "https://github.com/mnemoo/cli/tree/main/internal/cli"
click node_tui "https://github.com/mnemoo/cli/blob/main/internal/tui/app/app.go"
click node_service "https://github.com/mnemoo/cli/blob/main/internal/service/service.go"
click node_compliance "https://github.com/mnemoo/cli/blob/main/internal/upload/compliance.go"
click node_mlr "https://github.com/mnemoo/cli/blob/main/internal/mlr/mlr.go"
click node_repack "https://github.com/mnemoo/cli/blob/main/internal/repack/apply.go"
click node_uploader "https://github.com/mnemoo/cli/blob/main/internal/upload/uploader.go"
click node_auth "https://github.com/mnemoo/cli/blob/main/internal/auth/auth.go"
click node_api "https://github.com/mnemoo/cli/blob/main/internal/api/client.go"
click node_conversations "https://github.com/mnemoo/cli/blob/main/internal/conversations/manager.go"
click node_conversationstore "https://github.com/mnemoo/cli/blob/main/internal/conversations/store.go"
click node_hooks "https://github.com/mnemoo/cli/blob/main/internal/conversations/hooks.go"
click node_mcp "https://github.com/mnemoo/cli/blob/main/internal/mcpserver/server.go"
click node_daemon "https://github.com/mnemoo/cli/blob/main/internal/daemon/daemon.go"
click node_operations "https://github.com/mnemoo/cli/blob/main/internal/operations/store.go"
click node_acceleratorclient "https://github.com/mnemoo/cli/blob/main/internal/accelerator/client.go"
click node_acceleratorserver "https://github.com/mnemoo/cli/blob/main/internal/accelerator/server.go"
click node_updater "https://github.com/mnemoo/cli/blob/main/internal/updater/check.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_cli,node_tui,node_user toneBlue
class node_service,node_compliance,node_mlr,node_repack,node_uploader,node_objectstore toneAmber
class node_auth,node_api,node_updater toneMint
class node_conversations,node_conversationstore,node_hooks,node_mcp,node_daemon,node_operations toneRose
class node_acceleratorclient,node_acceleratorserver,node_stake,node_hooktarget,node_mcpclient,node_relayoperator toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/mnemoo/cli/tree/main/internal/cli): `internal/cli`
- [Interactive TUI](https://github.com/mnemoo/cli/blob/main/internal/tui/app/app.go): `internal/tui/app/app.go`

### Asset workflows

- [Application service](https://github.com/mnemoo/cli/blob/main/internal/service/service.go): `internal/service/service.go`
- [Math compliance](https://github.com/mnemoo/cli/blob/main/internal/upload/compliance.go): `internal/upload/compliance.go`
- [MLR reweighting](https://github.com/mnemoo/cli/blob/main/internal/mlr/mlr.go): `internal/mlr/mlr.go`
- [Book repacking](https://github.com/mnemoo/cli/blob/main/internal/repack/apply.go): `internal/repack/apply.go`
- [Upload execution](https://github.com/mnemoo/cli/blob/main/internal/upload/uploader.go): `internal/upload/uploader.go`

### Stake integration

- [Session and accounts](https://github.com/mnemoo/cli/blob/main/internal/auth/auth.go): `internal/auth/auth.go`
- [Stake API client](https://github.com/mnemoo/cli/blob/main/internal/api/client.go): `internal/api/client.go`
- [Self updater](https://github.com/mnemoo/cli/blob/main/internal/updater/check.go): `internal/updater/check.go`

### Approvals and agents

- [Conversation manager](https://github.com/mnemoo/cli/blob/main/internal/conversations/manager.go): `internal/conversations/manager.go`
- [Read state and receipts](https://github.com/mnemoo/cli/blob/main/internal/conversations/store.go): `internal/conversations/store.go`
- [Message hooks](https://github.com/mnemoo/cli/blob/main/internal/conversations/hooks.go): `internal/conversations/hooks.go`
- [MCP server](https://github.com/mnemoo/cli/blob/main/internal/mcpserver/server.go): `internal/mcpserver/server.go`
- [Upload daemon](https://github.com/mnemoo/cli/blob/main/internal/daemon/daemon.go): `internal/daemon/daemon.go`
- [Operation state](https://github.com/mnemoo/cli/blob/main/internal/operations/store.go): `internal/operations/store.go`

### Upload acceleration

- [Relay client](https://github.com/mnemoo/cli/blob/main/internal/accelerator/client.go): `internal/accelerator/client.go`
- [Relay server](https://github.com/mnemoo/cli/blob/main/internal/accelerator/server.go): `internal/accelerator/server.go`

### Other components

- **CLI/TUI user**
- **Stake Engine**
- **Presigned object storage**
- **Hook destinations**
- **Coding agent**
- **Relay operator**

## Connections

- CLI/TUI user → CLI commands: runs commands
- CLI/TUI user → Interactive TUI: opens interface
- CLI commands → Application service: invokes use cases
- Interactive TUI → Application service: invokes use cases
- Interactive TUI → Session and accounts: selects account
- Application service → Math compliance: checks math
- CLI commands → MLR reweighting: runs MLR
- Interactive TUI → MLR reweighting: offers reweighting
- CLI commands → Book repacking: estimates or repacks
- Interactive TUI → Book repacking: offers confirmed repack
- Application service → Upload execution: plans and executes
- Application service → Stake API client: reads and publishes
- Upload execution → Stake API client: requests upload plan
- Stake API client → Stake Engine: calls API
- Upload execution → Presigned object storage: transfers presigned parts
- Session and accounts → Stake API client: provides session
- Interactive TUI → Conversation manager: views approvals
- MCP server → Conversation manager: handles review tools
- Conversation manager → Application service: fetches and sends threads
- Conversation manager → Read state and receipts: persists read state
- Conversation manager → Message hooks: dispatches message events
- Message hooks → Hook destinations: delivers notifications
- CLI/TUI user → Coding agent: uses coding agent
- Coding agent → MCP server: connects over stdio
- MCP server → Application service: invokes tools
- MCP server → Upload daemon: queues upload work
- Upload daemon → Application service: executes upload use cases
- Application service → Operation state: tracks upload operation
- CLI commands → Relay client: configures or tests relay
- Interactive TUI → Relay client: selects relay upload
- Application service → Relay client: uses alternate transport
- Relay client → Relay server: sends encrypted stream
- Relay operator → Relay server: runs relay daemon
- Relay server → Presigned object storage: delivers queued parts
- CLI commands → Self updater: checks and installs update
