pyre-cli 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,18 +1,21 @@
1
1
  # pyre
2
2
 
3
- Mac system monitoring CLI: temps, CPU, memory, disk, battery, live dashboard, and export.
3
+ Mac system monitoring CLI: temps, CPU, memory, disk, battery, live dashboard, packet monitor, battery predictor, export, and P2P live data streaming.
4
4
 
5
- ![Version](https://img.shields.io/badge/version-1.3.0-blue)
5
+ ![Version](https://img.shields.io/badge/version-2.0.0-blue)
6
6
  ![macOS](https://img.shields.io/badge/macos-14%2B-lightgrey)
7
7
  ![Node](https://img.shields.io/badge/node-18%2B-green)
8
8
  ![License](https://img.shields.io/badge/license-MIT-green)
9
9
 
10
10
  ## Features
11
11
 
12
+ - **P2P live data streaming** — send live system stats to another system over TCP with password authentication
12
13
  - **Real-time system stats** — CPU brand, cores, frequency, load, and usage
13
14
  - **Memory monitoring** — usage, swap, and total/available
14
15
  - **Disk space** — mounted volume usage
15
- - **Battery & power** — level, power source, condition, charge cycles, max capacity
16
+ - **Battery & power** — level, power source, condition, charge cycles, max capacity, estimated time to empty, discharge rate, power draw in watts
17
+ - **Packet monitor** — network packet counts, packet rates, active TCP connections, top network processes
18
+ - **Task list** — running tasks/applications sorted by CPU with PID, user, memory, state, and runtime
16
19
  - **Thermal state** — CPU temperature via `pmset` and `powermetrics` (sudo for detailed readings)
17
20
  - **Network** — RX/TX bytes and per-second rates
18
21
  - **Top processes** — sorted by CPU, memory, or PID with live filtering
@@ -54,6 +57,7 @@ pyre --csv # CSV export
54
57
  pyre --tsv # TSV export
55
58
  pyre --once # Single static snapshot (same as default without live)
56
59
  pyre --out report.json # Also write output to a file
60
+ pyre --packets # Include packet monitor panel
57
61
  ```
58
62
 
59
63
  ### Live dashboard
@@ -80,6 +84,62 @@ pyre live --interval 5 --log # Custom interval with auto-logging
80
84
  | `--out <file>` | Write snapshot output to a file |
81
85
  | `--export-dir <dir>` | Directory for live-mode snapshot exports and logs (default: `./pyre-exports`) |
82
86
  | `--log` | Start continuous CSV logging immediately when live mode starts |
87
+ | `--packets` | Include packet monitor panel in static output |
88
+
89
+ ## P2P Live Data Streaming
90
+
91
+ Send live system stats to another system over a TCP connection with password authentication.
92
+
93
+ ### Start a P2P server (host)
94
+
95
+ On the machine that will send data:
96
+
97
+ ```bash
98
+ pyre p2p server --p2p-host 0.0.0.0 --p2p-port 9876 --p2p-password mysecret
99
+ ```
100
+
101
+ The server binds to the specified host and port, and streams live system stats to any authenticated peer.
102
+
103
+ | Option | Description |
104
+ |---|---|
105
+ | `--p2p-host <host>` | Bind address (default: `0.0.0.0`) |
106
+ | `--p2p-port <port>` | Port number (default: `9876`) |
107
+ | `--p2p-password <password>` | Password for authentication (required) |
108
+ | `--interval <seconds>` | Data refresh interval (default: `2`) |
109
+ | `--detailed` | Include detailed sensor readings |
110
+
111
+ ### Connect a P2P client (peer)
112
+
113
+ On the machine that will receive data:
114
+
115
+ ```bash
116
+ pyre p2p connect --p2p-host <server-ip> --p2p-port 9876 --p2p-password mysecret
117
+ ```
118
+
119
+ The client connects to the server, authenticates with the password, and displays live system stats.
120
+
121
+ | Option | Description |
122
+ |---|---|
123
+ | `--p2p-host <host>` | Server address (default: `127.0.0.1`) |
124
+ | `--p2p-port <port>` | Server port (default: `9876`) |
125
+ | `--p2p-password <password>` | Password for authentication (required) |
126
+
127
+ ### P2P Protocol
128
+
129
+ The P2P connection uses a length-prefixed JSON protocol over TCP:
130
+
131
+ 1. Client connects to the server
132
+ 2. Client sends an `auth` message with the password
133
+ 3. Server validates the password and responds with `auth-ok` or `auth-fail`
134
+ 4. Once authenticated, the server streams `data` messages containing `StatsData` snapshots at the configured interval
135
+ 5. Both sides exchange `ping`/`pong` keepalive messages every 15 seconds
136
+ 6. Either side can send a `disconnect` message to close gracefully
137
+
138
+ ### P2P Controls
139
+
140
+ While connected, the client displays live system stats in a formatted table. Press `Ctrl+C` to disconnect.
141
+
142
+ On the server, type `status` to see the number of connected peers, or `q`/`quit`/`exit` to shut down.
83
143
 
84
144
  ## Live Dashboard Controls
85
145
 
@@ -109,12 +169,12 @@ When running `pyre live`, use these keyboard shortcuts:
109
169
 
110
170
  Press `c` to open the customizer overlay. From there you can:
111
171
 
112
- - Cycle through four built-in themes (Default, Dracula, Cyberpunk, Monochrome)
113
- - Toggle individual panels (CPU, Memory, Power, Battery, Thermal, Network, Disk, Processes) on or off
172
+ - Cycle through six built-in themes (Default, Dracula, Cyberpunk, Monochrome, Nord, Gruvbox)
173
+ - Toggle individual panels (CPU, Memory, GPU, Power, Battery, Thermal, Network, Packets, Tasks, Disk, Processes) on or off
114
174
 
115
175
  ## Themes
116
176
 
117
- Four built-in visual themes are available in the live dashboard:
177
+ Six built-in visual themes are available in the live dashboard:
118
178
 
119
179
  | Theme | Description |
120
180
  |---|---|
@@ -122,6 +182,8 @@ Four built-in visual themes are available in the live dashboard:
122
182
  | **dracula** | The popular Dracula dark palette |
123
183
  | **cyberpunk** | High-contrast neon on black |
124
184
  | **monochrome** | White-only; useful for colour-blind users or terminals without 256-colour support |
185
+ | **nord** | Arctic-inspired cool tones |
186
+ | **gruvbox** | Retro warm palette |
125
187
 
126
188
  Themes are cycled with `c` in the customizer overlay.
127
189
 
@@ -149,7 +211,7 @@ pyre-log-2026-07-26T10-54-47-191Z.csv
149
211
  Each row contains:
150
212
 
151
213
  ```
152
- timestamp,cpu_usage,mem_usage_percent,temp_c,net_rx_bytes,net_tx_bytes,thermal_state
214
+ timestamp,cpu_usage,mem_usage_percent,temp_c,net_rx_bytes,net_tx_bytes,net_rx_packets,net_tx_packets,connections,thermal_state
153
215
  ```
154
216
 
155
217
  ## Requirements
@@ -164,8 +226,8 @@ timestamp,cpu_usage,mem_usage_percent,temp_c,net_rx_bytes,net_tx_bytes,thermal_s
164
226
  pyre/
165
227
  ├── src/
166
228
  │ ├── index.ts # CLI entry point (commander definitions, main())
167
- │ ├── monitors/ # System metric collection (CPU, memory, disk, battery, thermal, network)
168
- │ │ ├── index.ts # Public API: collectAll, collectPower
229
+ │ ├── monitors/ # System metric collection (CPU, memory, disk, battery, thermal, network, packets, power, tasks)
230
+ │ │ ├── index.ts # Public API: collectAll, collectPower, collectPackets, collectTasks
169
231
  │ │ ├── types.ts # TypeScript interfaces for all metric types
170
232
  │ │ ├── smc.ts # SMC sensor reading with caching
171
233
  │ │ ├── collectors.ts # Individual metric collectors and orchestrator
@@ -174,7 +236,7 @@ pyre/
174
236
  │ │ ├── index.ts # Public API: formatTable, formatJson, formatCsv, formatTsv, formatGraphs
175
237
  │ │ ├── output.ts # JSON/CSV/TSV serialisation and sparkline graphs
176
238
  │ │ ├── render.ts # Dashboard table layout, cards, and panels
177
- │ │ ├── themes.ts # Four built-in colour themes
239
+ │ │ ├── themes.ts # Six built-in colour themes
178
240
  │ │ ├── types.ts # TableOptions, VisibleItems, ThemeName
179
241
  │ │ └── types.ts # Public-facing type definitions
180
242
  │ ├── live/ # Interactive live dashboard
@@ -184,6 +246,12 @@ pyre/
184
246
  │ │ ├── render.ts # Screen rendering and alert checking
185
247
  │ │ ├── export.ts # Snapshot export and CSV logging
186
248
  │ │ └── types.ts # LiveOptions, ExportFormat, InputMode, SortMode
249
+ │ ├── p2p/ # P2P live data streaming (server + client)
250
+ │ │ ├── index.ts # Public API: P2PServer, P2PClient
251
+ │ │ ├── types.ts # P2P protocol type definitions
252
+ │ │ ├── protocol.ts # Length-prefixed JSON message framing
253
+ │ │ ├── server.ts # TCP server that authenticates and streams stats
254
+ │ │ └── client.ts # TCP client that connects and displays live data
187
255
  │ ├── history.ts # Rolling history buffer for sparkline data
188
256
  │ ├── sparkline.ts # ASCII sparkline rendering
189
257
  │ └── utils/ # Shared utility functions