# stevelacey/wifi-cli-macos architecture

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

- Interactive diagram: https://gitdiagram.com/stevelacey/wifi-cli-macos
- Repository: https://github.com/stevelacey/wifi-cli-macos

## Overview

Wi-Fi CLI MacOS is a macOS command-line utility for discovering networks and managing connections and network settings. The principal workflow starts at the CLI, optionally scans and prompts for a network, then connects through the native scanner; other commands inspect or change DNS, IP, router, and MAC settings. Separate capabilities include saved-network/keychain access, iPhone hotspot discovery, QR sharing, and speed tests. The graph follows relationships shown in excerpts or the README; the Swift scanner’s build-to-source relationship and some unsampled command wiring are not asserted.

Main entry points: [`index.js`](https://github.com/stevelacey/wifi-cli-macos/blob/main/index.js) (Command handlers), [`wifi.js`](https://github.com/stevelacey/wifi-cli-macos/blob/main/wifi.js) (Wi-Fi operations), [`network.js`](https://github.com/stevelacey/wifi-cli-macos/blob/main/network.js) (DNS, IP, router, MAC), [`support.js`](https://github.com/stevelacey/wifi-cli-macos/blob/main/support.js) (Process and utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI interaction"]
  node_commands["Command handlers<br/>[index.js]"]
  node_prompts["Interactive prompts<br/>[prompts.js]"]
  node_terminal["Terminal output and QR<br/>[terminal.js]"]
  node_settings_data["DNS presets and version<br/>[settings.js]"]
end

subgraph group_discovery["Network discovery"]
  node_scanner_api["Scanner commands<br/>[scanner.js]"]
  node_native_scanner["Wi-Fi and BLE scanner<br/>[wifi-scanner.swift]"]
end

subgraph group_settings["Network configuration"]
  node_network_config["DNS, IP, router, MAC<br/>[network.js]"]
  node_wifi_ops["Wi-Fi operations<br/>[wifi.js]"]
end

subgraph group_system["macOS integration"]
  node_system_info["Device identification<br/>[system.js]"]
  node_support["Process and utilities<br/>[support.js]"]
end

node_user(("CLI user"))
node_macos{{"macOS network services"}}
node_keychain[("macOS Keychain")]
node_apple_speed{{"Apple network speed test"}}

node_user -->|"runs commands"| node_commands
node_commands -->|"requests input"| node_prompts
node_commands -->|"scans and connects"| node_scanner_api
node_commands -->|"reads and sets"| node_network_config
node_commands -->|"invokes operations"| node_wifi_ops
node_commands -->|"formats output"| node_terminal
node_commands -->|"reads presets"| node_settings_data
node_commands -->|"generates MAC"| node_support
node_scanner_api -->|"runs processes"| node_support
node_network_config -->|"runs commands"| node_support
node_network_config -->|"uses device details"| node_system_info
node_network_config -->|"restarts Wi-Fi"| node_wifi_ops
node_wifi_ops -->|"runs processes"| node_support
node_wifi_ops -->|"uses device details"| node_system_info
node_terminal -->|"uses product name"| node_settings_data
node_scanner_api -->|"invokes system tools"| node_macos
node_network_config -->|"configures networking"| node_macos
node_wifi_ops -.->|"retrieves passwords"| node_keychain
node_wifi_ops -->|"runs speed test"| node_apple_speed
node_commands -.->|"generates QR"| node_terminal

click node_commands "https://github.com/stevelacey/wifi-cli-macos/blob/main/index.js"
click node_prompts "https://github.com/stevelacey/wifi-cli-macos/blob/main/prompts.js"
click node_terminal "https://github.com/stevelacey/wifi-cli-macos/blob/main/terminal.js"
click node_settings_data "https://github.com/stevelacey/wifi-cli-macos/blob/main/settings.js"
click node_scanner_api "https://github.com/stevelacey/wifi-cli-macos/blob/main/scanner.js"
click node_native_scanner "https://github.com/stevelacey/wifi-cli-macos/blob/main/wifi-scanner.swift"
click node_network_config "https://github.com/stevelacey/wifi-cli-macos/blob/main/network.js"
click node_wifi_ops "https://github.com/stevelacey/wifi-cli-macos/blob/main/wifi.js"
click node_system_info "https://github.com/stevelacey/wifi-cli-macos/blob/main/system.js"
click node_support "https://github.com/stevelacey/wifi-cli-macos/blob/main/support.js"

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_commands,node_prompts,node_terminal,node_settings_data,node_user toneBlue
class node_scanner_api,node_native_scanner,node_keychain toneAmber
class node_network_config,node_wifi_ops toneMint
class node_system_info,node_support toneRose
class node_macos,node_apple_speed toneIndigo
```

## Components

### CLI interaction

- [Command handlers](https://github.com/stevelacey/wifi-cli-macos/blob/main/index.js): `index.js`
- [Interactive prompts](https://github.com/stevelacey/wifi-cli-macos/blob/main/prompts.js): `prompts.js`
- [Terminal output and QR](https://github.com/stevelacey/wifi-cli-macos/blob/main/terminal.js): `terminal.js`
- [DNS presets and version](https://github.com/stevelacey/wifi-cli-macos/blob/main/settings.js): `settings.js`

### Network discovery

- [Scanner commands](https://github.com/stevelacey/wifi-cli-macos/blob/main/scanner.js): `scanner.js`
- [Wi-Fi and BLE scanner](https://github.com/stevelacey/wifi-cli-macos/blob/main/wifi-scanner.swift): `wifi-scanner.swift`

### Network configuration

- [DNS, IP, router, MAC](https://github.com/stevelacey/wifi-cli-macos/blob/main/network.js): `network.js`
- [Wi-Fi operations](https://github.com/stevelacey/wifi-cli-macos/blob/main/wifi.js): `wifi.js`

### macOS integration

- [Device identification](https://github.com/stevelacey/wifi-cli-macos/blob/main/system.js): `system.js`
- [Process and utilities](https://github.com/stevelacey/wifi-cli-macos/blob/main/support.js): `support.js`

### Other components

- **CLI user**
- **macOS network services**
- **macOS Keychain**
- **Apple network speed test**

## Connections

- CLI user → Command handlers: runs commands (evidence: `README.md`)
- Command handlers → Interactive prompts: requests input (evidence: `index.js`)
- Command handlers → Scanner commands: scans and connects (evidence: `index.js`)
- Command handlers → DNS, IP, router, MAC: reads and sets (evidence: `index.js`)
- Command handlers → Wi-Fi operations: invokes operations (evidence: `index.js`)
- Command handlers → Terminal output and QR: formats output (evidence: `index.js`)
- Command handlers → DNS presets and version: reads presets (evidence: `index.js`)
- Command handlers → Process and utilities: generates MAC (evidence: `index.js`)
- Scanner commands → Process and utilities: runs processes (evidence: `scanner.js`)
- DNS, IP, router, MAC → Process and utilities: runs commands (evidence: `network.js`)
- DNS, IP, router, MAC → Device identification: uses device details (evidence: `network.js`)
- DNS, IP, router, MAC → Wi-Fi operations: restarts Wi-Fi (evidence: `network.js`)
- Wi-Fi operations → Process and utilities: runs processes (evidence: `wifi.js`)
- Wi-Fi operations → Device identification: uses device details (evidence: `wifi.js`)
- Terminal output and QR → DNS presets and version: uses product name (evidence: `terminal.js`)
- Scanner commands → macOS network services: invokes system tools (evidence: `scanner.js`)
- DNS, IP, router, MAC → macOS network services: configures networking (evidence: `network.js`)
- Wi-Fi operations → macOS Keychain: retrieves passwords (evidence: `wifi.js`)
- Wi-Fi operations → Apple network speed test: runs speed test (evidence: `wifi.js`)
- Command handlers → Terminal output and QR: generates QR (evidence: `index.js`)
