pyre-cli 3.1.0 → 3.2.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/dist/index.js CHANGED
@@ -2515,6 +2515,29 @@ function restartTicker() {
2515
2515
  if (state.intervalHandle) clearInterval(state.intervalHandle);
2516
2516
  state.intervalHandle = setInterval(tick, state.interval * 1e3);
2517
2517
  }
2518
+ async function doWarmup() {
2519
+ try {
2520
+ const data = await collectAll({ detailed: state.detailed, processLimit: processRowBudget() });
2521
+ state.lastData = data;
2522
+ const temp = data.cpu.temperature ?? data.thermal.temperatures?.cpu_die ?? null;
2523
+ state.history.push({
2524
+ cpuUsage: data.cpu.usage,
2525
+ memUsage: data.memory.usagePercent,
2526
+ temp,
2527
+ rxBytes: data.network.rxBytes,
2528
+ txBytes: data.network.txBytes,
2529
+ gpuUtil: data.gpu?.utilization,
2530
+ powerWatts: data.power?.combinedWatts ?? data.power?.cpuWatts ?? 0,
2531
+ rxPackets: data.network.rxPackets,
2532
+ txPackets: data.network.txPackets,
2533
+ connections: data.network.connections ?? 0
2534
+ });
2535
+ writeLogRow(data);
2536
+ checkAlerts(data);
2537
+ syncP2PEvents();
2538
+ } catch {
2539
+ }
2540
+ }
2518
2541
  async function tick() {
2519
2542
  if (state.paused) return;
2520
2543
  try {
@@ -2540,7 +2563,7 @@ async function tick() {
2540
2563
  } catch {
2541
2564
  }
2542
2565
  }
2543
- async function startLive(opts2) {
2566
+ async function startLive(opts2, splashPromise) {
2544
2567
  if (state.running) return;
2545
2568
  state.running = true;
2546
2569
  state.paused = false;
@@ -2551,6 +2574,10 @@ async function startLive(opts2) {
2551
2574
  state.termHeight = process.stdout.rows || 24;
2552
2575
  state.history.reset();
2553
2576
  state.history.setMaxLen(Math.max(20, Math.min(200, state.termWidth - 30)));
2577
+ const warmupPromise = doWarmup();
2578
+ if (splashPromise) {
2579
+ await splashPromise;
2580
+ }
2554
2581
  process.stdout.write("\x1B[?1049h");
2555
2582
  process.stdout.write("\x1B[?25l");
2556
2583
  process.stdout.write("\x1B[2J\x1B[H");
@@ -2558,7 +2585,8 @@ async function startLive(opts2) {
2558
2585
  if (state.mouseEnabled) {
2559
2586
  process.stdout.write("\x1B[?1000h");
2560
2587
  }
2561
- await tick();
2588
+ await warmupPromise;
2589
+ render();
2562
2590
  restartTicker();
2563
2591
  if (opts2.autoLog) startLogging();
2564
2592
  readline.emitKeypressEvents(process.stdin);
@@ -2963,14 +2991,14 @@ async function main() {
2963
2991
  if (cmd === "live") {
2964
2992
  program.args.shift();
2965
2993
  }
2966
- await showSplash();
2994
+ const splashPromise = showSplash();
2967
2995
  const interval = parseFloat(opts.interval) || 2;
2968
2996
  await startLive({
2969
2997
  interval,
2970
2998
  detailed: opts.detailed,
2971
2999
  exportDir: opts.exportDir,
2972
3000
  autoLog: opts.log
2973
- });
3001
+ }, splashPromise);
2974
3002
  return;
2975
3003
  }
2976
3004
  if (cmd === "p2p") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-cli",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "CLI Mac monitoring tool: temps, system stats, live dashboard, packet monitor, battery predictor, export",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -69,14 +69,14 @@ async function main() {
69
69
  if (cmd === 'live') {
70
70
  program.args.shift();
71
71
  }
72
- await showSplash();
72
+ const splashPromise = showSplash();
73
73
  const interval = parseFloat(opts.interval) || 2;
74
74
  await startLive({
75
75
  interval,
76
76
  detailed: opts.detailed,
77
77
  exportDir: opts.exportDir,
78
78
  autoLog: opts.log,
79
- });
79
+ }, splashPromise);
80
80
  return;
81
81
  }
82
82
 
package/src/live/input.ts CHANGED
@@ -199,6 +199,33 @@ function killProcess(pidStr: string, signal: string = 'SIGTERM') {
199
199
  state.intervalHandle = setInterval(tick, state.interval * 1000);
200
200
  }
201
201
 
202
+ async function doWarmup() {
203
+ try {
204
+ const data = await collectAll({ detailed: state.detailed, processLimit: processRowBudget() });
205
+ state.lastData = data;
206
+
207
+ const temp = data.cpu.temperature ?? data.thermal.temperatures?.cpu_die ?? null;
208
+ state.history.push({
209
+ cpuUsage: data.cpu.usage,
210
+ memUsage: data.memory.usagePercent,
211
+ temp,
212
+ rxBytes: data.network.rxBytes,
213
+ txBytes: data.network.txBytes,
214
+ gpuUtil: data.gpu?.utilization,
215
+ powerWatts: data.power?.combinedWatts ?? data.power?.cpuWatts ?? 0,
216
+ rxPackets: data.network.rxPackets,
217
+ txPackets: data.network.txPackets,
218
+ connections: data.network.connections ?? 0,
219
+ });
220
+
221
+ writeLogRow(data);
222
+ checkAlerts(data);
223
+ syncP2PEvents();
224
+ } catch {
225
+ // skip bad warmup
226
+ }
227
+ }
228
+
202
229
  async function tick() {
203
230
  if (state.paused) return;
204
231
  try {
@@ -235,7 +262,7 @@ function killProcess(pidStr: string, signal: string = 'SIGTERM') {
235
262
  * rendering interval. Idempotent — calling while already
236
263
  * running is a no-op.
237
264
  */
238
- export async function startLive(opts: LiveOptions) {
265
+ export async function startLive(opts: LiveOptions, splashPromise?: Promise<void>) {
239
266
  if (state.running) return;
240
267
  state.running = true;
241
268
  state.paused = false;
@@ -247,6 +274,12 @@ function killProcess(pidStr: string, signal: string = 'SIGTERM') {
247
274
  state.history.reset();
248
275
  state.history.setMaxLen(Math.max(20, Math.min(200, state.termWidth - 30)));
249
276
 
277
+ const warmupPromise = doWarmup();
278
+
279
+ if (splashPromise) {
280
+ await splashPromise;
281
+ }
282
+
250
283
  process.stdout.write('\x1b[?1049h');
251
284
  process.stdout.write('\x1b[?25l');
252
285
  process.stdout.write('\x1b[2J\x1b[H');
@@ -256,7 +289,9 @@ function killProcess(pidStr: string, signal: string = 'SIGTERM') {
256
289
  process.stdout.write('\x1b[?1000h');
257
290
  }
258
291
 
259
- await tick();
292
+ await warmupPromise;
293
+ render();
294
+
260
295
  restartTicker();
261
296
 
262
297
  if (opts.autoLog) startLogging();