pyre-cli 1.2.0 → 1.4.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
@@ -2,23 +2,41 @@
2
2
 
3
3
  Mac system monitoring CLI: temps, CPU, memory, disk, battery, live dashboard, and export.
4
4
 
5
- ![Version](https://img.shields.io/badge/version-1.0.0-blue)
5
+ ![Version](https://img.shields.io/badge/version-1.3.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
+ ![License](https://img.shields.io/badge/license-MIT-green)
8
9
 
9
- ## Install
10
+ ## Features
11
+
12
+ - **Real-time system stats** — CPU brand, cores, frequency, load, and usage
13
+ - **Memory monitoring** — usage, swap, and total/available
14
+ - **Disk space** — mounted volume usage
15
+ - **Battery & power** — level, power source, condition, charge cycles, max capacity
16
+ - **Thermal state** — CPU temperature via `pmset` and `powermetrics` (sudo for detailed readings)
17
+ - **Network** — RX/TX bytes and per-second rates
18
+ - **Top processes** — sorted by CPU, memory, or PID with live filtering
19
+ - **Interactive live dashboard** — full-screen TUI with keyboard-driven controls
20
+ - **Snapshot export** — JSON, CSV, or TSV output formats
21
+ - **Continuous CSV logging** — automatic per-tick data logging to timestamped files
22
+ - **Visual themes** — four built-in colour themes for the dashboard
23
+
24
+ ## Installation
10
25
 
11
26
  ### npm
27
+
12
28
  ```bash
13
- npm install -g @somalip/pyre
29
+ npm install -g pyre-cli
14
30
  ```
15
31
 
16
32
  ### curl
33
+
17
34
  ```bash
18
35
  curl -fsSL https://raw.githubusercontent.com/somalip/pyre/main/install.sh | bash
19
36
  ```
20
37
 
21
38
  ### Homebrew
39
+
22
40
  ```bash
23
41
  brew tap somalip/tap
24
42
  brew install pyre
@@ -26,26 +44,201 @@ brew install pyre
26
44
 
27
45
  ## Usage
28
46
 
47
+ ### Static snapshot
48
+
29
49
  ```bash
30
- pyre # Show all system stats
50
+ pyre # Show all system stats in a formatted table
31
51
  pyre --detailed # Include sensor / powermetrics detail
32
52
  pyre --json # JSON output
33
53
  pyre --csv # CSV export
34
- pyre live # Live monitoring dashboard
35
- pyre live --interval 3 # Live with custom interval (seconds)
54
+ pyre --tsv # TSV export
55
+ pyre --once # Single static snapshot (same as default without live)
56
+ pyre --out report.json # Also write output to a file
36
57
  ```
37
58
 
38
- ### Output includes
39
- - CPU brand, cores, frequency, load, usage
40
- - Memory usage, swap
41
- - Disk space
42
- - Battery / power status
43
- - Thermal state & temperatures (`pmset`, `powermetrics`)
44
- - Network RX/TX
45
- - Top processes
59
+ ### Live dashboard
60
+
61
+ ```bash
62
+ pyre live # Start the interactive live dashboard
63
+ pyre live --interval 3 # Refresh every 3 seconds
64
+ pyre live --detailed # Live mode with detailed sensor readings
65
+ pyre live --export-dir ./my-exports # Custom directory for snapshot exports and logs
66
+ pyre live --log # Start continuous CSV logging immediately
67
+ pyre live --interval 5 --log # Custom interval with auto-logging
68
+ ```
69
+
70
+ ### Options
71
+
72
+ | Option | Description |
73
+ |---|---|
74
+ | `-j, --json` | Output as JSON |
75
+ | `-c, --csv` | Output as CSV |
76
+ | `-t, --tsv` | Output as TSV |
77
+ | `--detailed` | Include detailed system info and sensor readings |
78
+ | `--interval <seconds>` | Refresh interval for live mode (default: `2`) |
79
+ | `--once` | Show a single static snapshot instead of live feed |
80
+ | `--out <file>` | Write snapshot output to a file |
81
+ | `--export-dir <dir>` | Directory for live-mode snapshot exports and logs (default: `./pyre-exports`) |
82
+ | `--log` | Start continuous CSV logging immediately when live mode starts |
83
+
84
+ ## Live Dashboard Controls
85
+
86
+ When running `pyre live`, use these keyboard shortcuts:
87
+
88
+ | Key | Action |
89
+ |---|---|
90
+ | `q` | Quit the dashboard |
91
+ | `p` | Pause / resume the refresh cycle |
92
+ | `d` | Toggle detailed sensor mode |
93
+ | `g` | Show / hide sparkline graphs |
94
+ | `s` | Cycle sort order (CPU → memory → PID) |
95
+ | `f` | Cycle export format (JSON → CSV → TSV) |
96
+ | `e` | Export a snapshot to the export directory |
97
+ | `l` | Toggle continuous CSV logging |
98
+ | `c` | Open the UI customizer |
99
+ | `/` | Open process filter |
100
+ | `k` | Open process kill (enter PID, then Enter to confirm) |
101
+ | `+` | Increase refresh interval by 1 second |
102
+ | `-` | Decrease refresh interval by 1 second |
103
+ | `↑` / `k` | Navigate customizer options |
104
+ | `↓` / `j` | Navigate customizer options |
105
+ | `Enter` / `Space` | Toggle visibility or select theme in customizer |
106
+ | `Esc` | Close customizer or clear filter/kill input |
107
+
108
+ ### UI Customizer
109
+
110
+ Press `c` to open the customizer overlay. From there you can:
111
+
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
114
+
115
+ ## Themes
116
+
117
+ Four built-in visual themes are available in the live dashboard:
118
+
119
+ | Theme | Description |
120
+ |---|---|
121
+ | **default** | Muted greys and cyan accents; safe for any terminal |
122
+ | **dracula** | The popular Dracula dark palette |
123
+ | **cyberpunk** | High-contrast neon on black |
124
+ | **monochrome** | White-only; useful for colour-blind users or terminals without 256-colour support |
125
+
126
+ Themes are cycled with `c` in the customizer overlay.
127
+
128
+ ## Export Formats
129
+
130
+ ### Snapshot export (`e` key in live mode, or `--out` flag)
131
+
132
+ Snapshots are written to the export directory (`./pyre-exports` by default) with filenames like:
133
+
134
+ ```
135
+ pyre-2026-07-26T10-54-47-191Z.json
136
+ pyre-2026-07-26T10-54-52-306Z.csv
137
+ ```
138
+
139
+ The format is determined by the current export format (cycle with `f` in live mode, or set via `--json`, `--csv`, `--tsv` in static mode).
140
+
141
+ ### Continuous CSV logging (`l` key in live mode, or `--log` flag)
142
+
143
+ When logging is active, each tick appends a row to a timestamped CSV file:
144
+
145
+ ```
146
+ pyre-log-2026-07-26T10-54-47-191Z.csv
147
+ ```
148
+
149
+ Each row contains:
150
+
151
+ ```
152
+ timestamp,cpu_usage,mem_usage_percent,temp_c,net_rx_bytes,net_tx_bytes,thermal_state
153
+ ```
46
154
 
47
155
  ## Requirements
48
156
 
49
- - macOS 14+
50
- - Node.js 18+
51
- - Optional: `sudo` for `powermetrics` detailed temperatures in `--detailed` mode
157
+ - **macOS 14+** (Sonoma or later)
158
+ - **Node.js 18+**
159
+ - **Optional:** `sudo` for `powermetrics` detailed temperatures in `--detailed` mode
160
+
161
+ ## Project Structure
162
+
163
+ ```
164
+ pyre/
165
+ ├── src/
166
+ │ ├── 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
169
+ │ │ ├── types.ts # TypeScript interfaces for all metric types
170
+ │ │ ├── smc.ts # SMC sensor reading with caching
171
+ │ │ ├── collectors.ts # Individual metric collectors and orchestrator
172
+ │ │ └── run.ts # Shared shell-execution helper
173
+ │ ├── formatters/ # Output formatting and rendering
174
+ │ │ ├── index.ts # Public API: formatTable, formatJson, formatCsv, formatTsv, formatGraphs
175
+ │ │ ├── output.ts # JSON/CSV/TSV serialisation and sparkline graphs
176
+ │ │ ├── render.ts # Dashboard table layout, cards, and panels
177
+ │ │ ├── themes.ts # Four built-in colour themes
178
+ │ │ ├── types.ts # TableOptions, VisibleItems, ThemeName
179
+ │ │ └── types.ts # Public-facing type definitions
180
+ │ ├── live/ # Interactive live dashboard
181
+ │ │ ├── index.ts # Public API: startLive, stopLive
182
+ │ │ ├── state.ts # Shared mutable session state
183
+ │ │ ├── input.ts # Keypress handling and session lifecycle
184
+ │ │ ├── render.ts # Screen rendering and alert checking
185
+ │ │ ├── export.ts # Snapshot export and CSV logging
186
+ │ │ └── types.ts # LiveOptions, ExportFormat, InputMode, SortMode
187
+ │ ├── history.ts # Rolling history buffer for sparkline data
188
+ │ ├── sparkline.ts # ASCII sparkline rendering
189
+ │ └── utils/ # Shared utility functions
190
+ ├── dist/ # Built output (esm)
191
+ ├── pyre-exports/ # Default directory for snapshot exports and logs
192
+ ├── Formula/ # Homebrew formula
193
+ ├── install.sh # curl installation script
194
+ ├── package.json
195
+ ├── tsconfig.json
196
+ └── README.md
197
+ ```
198
+
199
+ ## Development
200
+
201
+ ### Setup
202
+
203
+ ```bash
204
+ git clone https://github.com/somalip/pyre.git
205
+ cd pyre
206
+ npm install
207
+ ```
208
+
209
+ ### Build
210
+
211
+ ```bash
212
+ npm run build
213
+ ```
214
+
215
+ This uses `tsup` to compile TypeScript to ESM in `dist/`.
216
+
217
+ ### Run in dev mode
218
+
219
+ ```bash
220
+ npm run dev
221
+ ```
222
+
223
+ Runs the CLI directly via `tsx` without a build step.
224
+
225
+ ### Test
226
+
227
+ ```bash
228
+ npm test
229
+ ```
230
+
231
+ Verifies the built binary runs and responds to `--help`.
232
+
233
+ ### Scripts
234
+
235
+ | Script | Description |
236
+ |---|---|
237
+ | `build` | Compile TypeScript to ESM via tsup |
238
+ | `start` | Run the built binary from `dist/` |
239
+ | `dev` | Run directly via tsx (no build step) |
240
+ | `test` | Verify the built binary responds to `--help` |
241
+
242
+ ## License
243
+
244
+ MIT