pyre-cli 1.3.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 +278 -17
- package/dist/index.js +1763 -350
- package/package.json +6 -3
- package/parity.md +542 -0
- package/src/formatters/index.ts +17 -0
- package/src/formatters/output.ts +165 -0
- package/src/formatters/render.ts +659 -0
- package/src/formatters/themes.ts +115 -0
- package/src/formatters/types.ts +62 -0
- package/src/history.ts +153 -0
- package/src/index.ts +201 -0
- package/src/live/export.ts +76 -0
- package/src/live/index.ts +16 -0
- package/src/live/input.ts +443 -0
- package/src/live/render.ts +146 -0
- package/src/live/state.ts +103 -0
- package/src/live/types.ts +23 -0
- package/src/monitors/collectors.ts +687 -0
- package/src/monitors/index.ts +14 -0
- package/src/monitors/run.ts +18 -0
- package/src/monitors/smc.ts +107 -0
- package/src/monitors/types.ts +148 -0
- package/src/p2p/client.ts +197 -0
- package/src/p2p/index.ts +3 -0
- package/src/p2p/protocol.ts +71 -0
- package/src/p2p/server.ts +219 -0
- package/src/p2p/types.ts +71 -0
- package/src/pyre_img +0 -0
- package/src/sparkline.ts +34 -0
- package/src/splash.ts +102 -0
- package/tsconfig.json +19 -0
package/README.md
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
# pyre
|
|
2
2
|
|
|
3
|
-
Mac system monitoring CLI: temps, CPU, memory, disk, battery, live dashboard, and
|
|
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
|
-

|
|
6
6
|

|
|
7
7
|

|
|
8
|
+

|
|
8
9
|
|
|
9
|
-
##
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **P2P live data streaming** — send live system stats to another system over TCP with password authentication
|
|
13
|
+
- **Real-time system stats** — CPU brand, cores, frequency, load, and usage
|
|
14
|
+
- **Memory monitoring** — usage, swap, and total/available
|
|
15
|
+
- **Disk space** — mounted volume usage
|
|
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
|
|
19
|
+
- **Thermal state** — CPU temperature via `pmset` and `powermetrics` (sudo for detailed readings)
|
|
20
|
+
- **Network** — RX/TX bytes and per-second rates
|
|
21
|
+
- **Top processes** — sorted by CPU, memory, or PID with live filtering
|
|
22
|
+
- **Interactive live dashboard** — full-screen TUI with keyboard-driven controls
|
|
23
|
+
- **Snapshot export** — JSON, CSV, or TSV output formats
|
|
24
|
+
- **Continuous CSV logging** — automatic per-tick data logging to timestamped files
|
|
25
|
+
- **Visual themes** — four built-in colour themes for the dashboard
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
10
28
|
|
|
11
29
|
### npm
|
|
30
|
+
|
|
12
31
|
```bash
|
|
13
32
|
npm install -g pyre-cli
|
|
14
33
|
```
|
|
15
34
|
|
|
16
35
|
### curl
|
|
36
|
+
|
|
17
37
|
```bash
|
|
18
38
|
curl -fsSL https://raw.githubusercontent.com/somalip/pyre/main/install.sh | bash
|
|
19
39
|
```
|
|
20
40
|
|
|
21
41
|
### Homebrew
|
|
42
|
+
|
|
22
43
|
```bash
|
|
23
44
|
brew tap somalip/tap
|
|
24
45
|
brew install pyre
|
|
@@ -26,26 +47,266 @@ brew install pyre
|
|
|
26
47
|
|
|
27
48
|
## Usage
|
|
28
49
|
|
|
50
|
+
### Static snapshot
|
|
51
|
+
|
|
29
52
|
```bash
|
|
30
|
-
pyre # Show all system stats
|
|
53
|
+
pyre # Show all system stats in a formatted table
|
|
31
54
|
pyre --detailed # Include sensor / powermetrics detail
|
|
32
55
|
pyre --json # JSON output
|
|
33
56
|
pyre --csv # CSV export
|
|
34
|
-
pyre
|
|
35
|
-
pyre
|
|
57
|
+
pyre --tsv # TSV export
|
|
58
|
+
pyre --once # Single static snapshot (same as default without live)
|
|
59
|
+
pyre --out report.json # Also write output to a file
|
|
60
|
+
pyre --packets # Include packet monitor panel
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Live dashboard
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pyre live # Start the interactive live dashboard
|
|
67
|
+
pyre live --interval 3 # Refresh every 3 seconds
|
|
68
|
+
pyre live --detailed # Live mode with detailed sensor readings
|
|
69
|
+
pyre live --export-dir ./my-exports # Custom directory for snapshot exports and logs
|
|
70
|
+
pyre live --log # Start continuous CSV logging immediately
|
|
71
|
+
pyre live --interval 5 --log # Custom interval with auto-logging
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Options
|
|
75
|
+
|
|
76
|
+
| Option | Description |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `-j, --json` | Output as JSON |
|
|
79
|
+
| `-c, --csv` | Output as CSV |
|
|
80
|
+
| `-t, --tsv` | Output as TSV |
|
|
81
|
+
| `--detailed` | Include detailed system info and sensor readings |
|
|
82
|
+
| `--interval <seconds>` | Refresh interval for live mode (default: `2`) |
|
|
83
|
+
| `--once` | Show a single static snapshot instead of live feed |
|
|
84
|
+
| `--out <file>` | Write snapshot output to a file |
|
|
85
|
+
| `--export-dir <dir>` | Directory for live-mode snapshot exports and logs (default: `./pyre-exports`) |
|
|
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
|
|
36
117
|
```
|
|
37
118
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
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.
|
|
143
|
+
|
|
144
|
+
## Live Dashboard Controls
|
|
145
|
+
|
|
146
|
+
When running `pyre live`, use these keyboard shortcuts:
|
|
147
|
+
|
|
148
|
+
| Key | Action |
|
|
149
|
+
|---|---|
|
|
150
|
+
| `q` | Quit the dashboard |
|
|
151
|
+
| `p` | Pause / resume the refresh cycle |
|
|
152
|
+
| `d` | Toggle detailed sensor mode |
|
|
153
|
+
| `g` | Show / hide sparkline graphs |
|
|
154
|
+
| `s` | Cycle sort order (CPU → memory → PID) |
|
|
155
|
+
| `f` | Cycle export format (JSON → CSV → TSV) |
|
|
156
|
+
| `e` | Export a snapshot to the export directory |
|
|
157
|
+
| `l` | Toggle continuous CSV logging |
|
|
158
|
+
| `c` | Open the UI customizer |
|
|
159
|
+
| `/` | Open process filter |
|
|
160
|
+
| `k` | Open process kill (enter PID, then Enter to confirm) |
|
|
161
|
+
| `+` | Increase refresh interval by 1 second |
|
|
162
|
+
| `-` | Decrease refresh interval by 1 second |
|
|
163
|
+
| `↑` / `k` | Navigate customizer options |
|
|
164
|
+
| `↓` / `j` | Navigate customizer options |
|
|
165
|
+
| `Enter` / `Space` | Toggle visibility or select theme in customizer |
|
|
166
|
+
| `Esc` | Close customizer or clear filter/kill input |
|
|
167
|
+
|
|
168
|
+
### UI Customizer
|
|
169
|
+
|
|
170
|
+
Press `c` to open the customizer overlay. From there you can:
|
|
171
|
+
|
|
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
|
|
174
|
+
|
|
175
|
+
## Themes
|
|
176
|
+
|
|
177
|
+
Six built-in visual themes are available in the live dashboard:
|
|
178
|
+
|
|
179
|
+
| Theme | Description |
|
|
180
|
+
|---|---|
|
|
181
|
+
| **default** | Muted greys and cyan accents; safe for any terminal |
|
|
182
|
+
| **dracula** | The popular Dracula dark palette |
|
|
183
|
+
| **cyberpunk** | High-contrast neon on black |
|
|
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 |
|
|
187
|
+
|
|
188
|
+
Themes are cycled with `c` in the customizer overlay.
|
|
189
|
+
|
|
190
|
+
## Export Formats
|
|
191
|
+
|
|
192
|
+
### Snapshot export (`e` key in live mode, or `--out` flag)
|
|
193
|
+
|
|
194
|
+
Snapshots are written to the export directory (`./pyre-exports` by default) with filenames like:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
pyre-2026-07-26T10-54-47-191Z.json
|
|
198
|
+
pyre-2026-07-26T10-54-52-306Z.csv
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The format is determined by the current export format (cycle with `f` in live mode, or set via `--json`, `--csv`, `--tsv` in static mode).
|
|
202
|
+
|
|
203
|
+
### Continuous CSV logging (`l` key in live mode, or `--log` flag)
|
|
204
|
+
|
|
205
|
+
When logging is active, each tick appends a row to a timestamped CSV file:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
pyre-log-2026-07-26T10-54-47-191Z.csv
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Each row contains:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
timestamp,cpu_usage,mem_usage_percent,temp_c,net_rx_bytes,net_tx_bytes,net_rx_packets,net_tx_packets,connections,thermal_state
|
|
215
|
+
```
|
|
46
216
|
|
|
47
217
|
## Requirements
|
|
48
218
|
|
|
49
|
-
- macOS 14
|
|
50
|
-
- Node.js 18
|
|
51
|
-
- Optional
|
|
219
|
+
- **macOS 14+** (Sonoma or later)
|
|
220
|
+
- **Node.js 18+**
|
|
221
|
+
- **Optional:** `sudo` for `powermetrics` detailed temperatures in `--detailed` mode
|
|
222
|
+
|
|
223
|
+
## Project Structure
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
pyre/
|
|
227
|
+
├── src/
|
|
228
|
+
│ ├── index.ts # CLI entry point (commander definitions, main())
|
|
229
|
+
│ ├── monitors/ # System metric collection (CPU, memory, disk, battery, thermal, network, packets, power, tasks)
|
|
230
|
+
│ │ ├── index.ts # Public API: collectAll, collectPower, collectPackets, collectTasks
|
|
231
|
+
│ │ ├── types.ts # TypeScript interfaces for all metric types
|
|
232
|
+
│ │ ├── smc.ts # SMC sensor reading with caching
|
|
233
|
+
│ │ ├── collectors.ts # Individual metric collectors and orchestrator
|
|
234
|
+
│ │ └── run.ts # Shared shell-execution helper
|
|
235
|
+
│ ├── formatters/ # Output formatting and rendering
|
|
236
|
+
│ │ ├── index.ts # Public API: formatTable, formatJson, formatCsv, formatTsv, formatGraphs
|
|
237
|
+
│ │ ├── output.ts # JSON/CSV/TSV serialisation and sparkline graphs
|
|
238
|
+
│ │ ├── render.ts # Dashboard table layout, cards, and panels
|
|
239
|
+
│ │ ├── themes.ts # Six built-in colour themes
|
|
240
|
+
│ │ ├── types.ts # TableOptions, VisibleItems, ThemeName
|
|
241
|
+
│ │ └── types.ts # Public-facing type definitions
|
|
242
|
+
│ ├── live/ # Interactive live dashboard
|
|
243
|
+
│ │ ├── index.ts # Public API: startLive, stopLive
|
|
244
|
+
│ │ ├── state.ts # Shared mutable session state
|
|
245
|
+
│ │ ├── input.ts # Keypress handling and session lifecycle
|
|
246
|
+
│ │ ├── render.ts # Screen rendering and alert checking
|
|
247
|
+
│ │ ├── export.ts # Snapshot export and CSV logging
|
|
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
|
|
255
|
+
│ ├── history.ts # Rolling history buffer for sparkline data
|
|
256
|
+
│ ├── sparkline.ts # ASCII sparkline rendering
|
|
257
|
+
│ └── utils/ # Shared utility functions
|
|
258
|
+
├── dist/ # Built output (esm)
|
|
259
|
+
├── pyre-exports/ # Default directory for snapshot exports and logs
|
|
260
|
+
├── Formula/ # Homebrew formula
|
|
261
|
+
├── install.sh # curl installation script
|
|
262
|
+
├── package.json
|
|
263
|
+
├── tsconfig.json
|
|
264
|
+
└── README.md
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Development
|
|
268
|
+
|
|
269
|
+
### Setup
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
git clone https://github.com/somalip/pyre.git
|
|
273
|
+
cd pyre
|
|
274
|
+
npm install
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Build
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
npm run build
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
This uses `tsup` to compile TypeScript to ESM in `dist/`.
|
|
284
|
+
|
|
285
|
+
### Run in dev mode
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
npm run dev
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Runs the CLI directly via `tsx` without a build step.
|
|
292
|
+
|
|
293
|
+
### Test
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
npm test
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Verifies the built binary runs and responds to `--help`.
|
|
300
|
+
|
|
301
|
+
### Scripts
|
|
302
|
+
|
|
303
|
+
| Script | Description |
|
|
304
|
+
|---|---|
|
|
305
|
+
| `build` | Compile TypeScript to ESM via tsup |
|
|
306
|
+
| `start` | Run the built binary from `dist/` |
|
|
307
|
+
| `dev` | Run directly via tsx (no build step) |
|
|
308
|
+
| `test` | Verify the built binary responds to `--help` |
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
MIT
|