# purplemashu/me-cli architecture

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

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

## Overview

MYnyak Engsel is a Python CLI for managing an Indonesian mobile-service account and browsing or purchasing packages. The main workflow is account selection, profile and balance display, then menu-driven package discovery and purchase; other menus cover family plans, circles, sharing, notifications, and the store. Authentication, API clients, encryption, purchase settlement, and decoy-package handling are distinct internal layers. Some menu and client files were not excerpted, so uncertain connections are shown only as unverified dashed edges.

Main entry points: [`main.py`](https://github.com/purplemashu/me-cli/blob/main/main.py) (Main loop), [`app/menus/package.py`](https://github.com/purplemashu/me-cli/blob/main/app/menus/package.py) (Package menus), [`app/client/engsel.py`](https://github.com/purplemashu/me-cli/blob/main/app/client/engsel.py) (Service API), [`app/menus/hot.py`](https://github.com/purplemashu/me-cli/blob/main/app/menus/hot.py) (Hot offers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_main["Main loop<br/>[main.py]"]
  node_account_menu["Account menu<br/>[account.py]"]
  node_package_menu["Package menus<br/>[package.py]"]
  node_hot_menu["Hot offers<br/>[hot.py]"]
  node_other_menus["Other menus"]
end

subgraph group_account["Account services"]
  node_auth["Auth manager<br/>[auth.py]"]
  node_bookmark["Bookmarks<br/>[bookmark.py]"]
  node_decoy["Decoy packages<br/>[decoy.py]"]
end

subgraph group_catalog["Packages and purchase"]
end

subgraph group_clients["Provider clients"]
  node_auth_api["CIAM login<br/>[ciam.py]"]
  node_engsel["Service API<br/>[engsel.py]"]
  node_crypto["Signing and encryption<br/>[encrypt.py]"]
  node_purchase_api["Purchase settlement"]
  node_store_api["Store queries"]
end

node_user(("CLI user"))
node_provider{{"Provider API"}}
node_signature_service{{"Signature service"}}
node_token_file[("Refresh-token file")]

node_user -->|"uses"| node_main
node_main -->|"opens"| node_account_menu
node_main -->|"opens"| node_hot_menu
node_main -.->|"routes to"| node_package_menu
node_main -.->|"routes to"| node_other_menus
node_main -->|"checks session"| node_auth
node_auth -->|"reads and writes"| node_token_file
node_auth -->|"refreshes tokens"| node_auth_api
node_main -.->|"fetches balance"| node_engsel
node_package_menu -->|"requests package data"| node_engsel
node_package_menu -.->|"uses bookmarks"| node_bookmark
node_package_menu -.->|"settles purchases"| node_purchase_api
node_hot_menu -.->|"offers purchase"| node_purchase_api
node_hot_menu -.->|"uses decoys"| node_decoy
node_other_menus -.->|"queries store"| node_store_api
node_auth_api -.->|"uses signing"| node_crypto
node_engsel -.->|"encrypts requests"| node_crypto
node_engsel -.->|"calls"| node_provider
node_crypto -.->|"requests signatures"| node_signature_service

click node_main "https://github.com/purplemashu/me-cli/blob/main/main.py"
click node_account_menu "https://github.com/purplemashu/me-cli/blob/main/app/menus/account.py"
click node_package_menu "https://github.com/purplemashu/me-cli/blob/main/app/menus/package.py"
click node_hot_menu "https://github.com/purplemashu/me-cli/blob/main/app/menus/hot.py"
click node_other_menus "https://github.com/purplemashu/me-cli/tree/main/app/menus"
click node_auth "https://github.com/purplemashu/me-cli/blob/main/app/service/auth.py"
click node_bookmark "https://github.com/purplemashu/me-cli/blob/main/app/service/bookmark.py"
click node_decoy "https://github.com/purplemashu/me-cli/blob/main/app/service/decoy.py"
click node_auth_api "https://github.com/purplemashu/me-cli/blob/main/app/client/ciam.py"
click node_engsel "https://github.com/purplemashu/me-cli/blob/main/app/client/engsel.py"
click node_crypto "https://github.com/purplemashu/me-cli/blob/main/app/client/encrypt.py"
click node_purchase_api "https://github.com/purplemashu/me-cli/tree/main/app/client/purchase"
click node_store_api "https://github.com/purplemashu/me-cli/tree/main/app/client/store"

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_account_menu,node_package_menu,node_hot_menu,node_other_menus,node_user toneBlue
class node_auth,node_bookmark,node_decoy,node_token_file toneAmber
class node_auth_api,node_engsel,node_crypto,node_purchase_api,node_store_api toneRose
class node_provider toneMint
class node_signature_service toneIndigo
```

## Components

### CLI workflow

- [Main loop](https://github.com/purplemashu/me-cli/blob/main/main.py): `main.py`
- [Account menu](https://github.com/purplemashu/me-cli/blob/main/app/menus/account.py): `app/menus/account.py`
- [Package menus](https://github.com/purplemashu/me-cli/blob/main/app/menus/package.py): `app/menus/package.py`
- [Hot offers](https://github.com/purplemashu/me-cli/blob/main/app/menus/hot.py): `app/menus/hot.py`
- [Other menus](https://github.com/purplemashu/me-cli/tree/main/app/menus): `app/menus`

### Account services

- [Auth manager](https://github.com/purplemashu/me-cli/blob/main/app/service/auth.py): `app/service/auth.py`
- [Bookmarks](https://github.com/purplemashu/me-cli/blob/main/app/service/bookmark.py): `app/service/bookmark.py`
- [Decoy packages](https://github.com/purplemashu/me-cli/blob/main/app/service/decoy.py): `app/service/decoy.py`

### Provider clients

- [CIAM login](https://github.com/purplemashu/me-cli/blob/main/app/client/ciam.py): `app/client/ciam.py`
- [Service API](https://github.com/purplemashu/me-cli/blob/main/app/client/engsel.py): `app/client/engsel.py`
- [Signing and encryption](https://github.com/purplemashu/me-cli/blob/main/app/client/encrypt.py): `app/client/encrypt.py`
- [Purchase settlement](https://github.com/purplemashu/me-cli/tree/main/app/client/purchase): `app/client/purchase`
- [Store queries](https://github.com/purplemashu/me-cli/tree/main/app/client/store): `app/client/store`

### Other components

- **CLI user**
- **Provider API**
- **Signature service**
- **Refresh-token file**

## Connections

- CLI user → Main loop: uses (evidence: `main.py`)
- Main loop → Account menu: opens (evidence: `main.py`)
- Main loop → Hot offers: opens (evidence: `main.py`)
- Main loop → Package menus: routes to (evidence: `main.py`)
- Main loop → Other menus: routes to (evidence: `main.py`)
- Main loop → Auth manager: checks session (evidence: `main.py`)
- Auth manager → Refresh-token file: reads and writes (evidence: `app/service/auth.py`)
- Auth manager → CIAM login: refreshes tokens (evidence: `app/service/auth.py`)
- Main loop → Service API: fetches balance (evidence: `main.py`)
- Package menus → Service API: requests package data (evidence: `app/menus/package.py`)
- Package menus → Bookmarks: uses bookmarks (evidence: `app/menus/package.py`)
- Package menus → Purchase settlement: settles purchases (evidence: `app/menus/package.py`)
- Hot offers → Purchase settlement: offers purchase (evidence: `app/menus/hot.py`)
- Hot offers → Decoy packages: uses decoys
- Other menus → Store queries: queries store (evidence: `app/menus/store/search.py`)
- CIAM login → Signing and encryption: uses signing (evidence: `app/client/ciam.py`)
- Service API → Signing and encryption: encrypts requests (evidence: `app/client/engsel.py`)
- Service API → Provider API: calls
- Signing and encryption → Signature service: requests signatures
