pyre-cli 10.3.0 → 10.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.
Files changed (88) hide show
  1. package/README.md +41 -0
  2. package/dist/{alertChannels-TPSQIJ7S.js → alertChannels-MNX4XH6J.js} +1 -0
  3. package/dist/{anomaliesCmd-25OFKYPK.js → anomaliesCmd-HHTY5LYL.js} +2 -0
  4. package/dist/benchGitCmd-HIXUC5EK.js +87 -0
  5. package/dist/{benchmarkCmd-A3ETK6VY.js → benchmarkCmd-B7DLP2VC.js} +2 -0
  6. package/dist/{blender-FGH3ASEQ.js → blender-6ZX5SPYC.js} +3 -1
  7. package/dist/{brewHealth-P2GW5Y5C.js → brewHealth-VFW33QB3.js} +1 -0
  8. package/dist/budgetCmd-TGO3RYLN.js +11 -0
  9. package/dist/{buildCmd-CDPZ2ZFA.js → buildCmd-E7KUCFYG.js} +3 -1
  10. package/dist/{checkCmd-WQAHAUWO.js → checkCmd-QLYTP77Y.js} +5 -3
  11. package/dist/chunk-3RG5ZIWI.js +10 -0
  12. package/dist/{chunk-VIACN2RU.js → chunk-FYCBGUTW.js} +41 -19
  13. package/dist/chunk-JH7P6KLN.js +143 -0
  14. package/dist/{chunk-QM5L43EK.js → chunk-LDJB5V4N.js} +5 -1
  15. package/dist/chunk-NMGQVRCA.js +111 -0
  16. package/dist/chunk-OCL7P7N7.js +936 -0
  17. package/dist/{chunk-23YWCI3O.js → chunk-QEH4LR6P.js} +28 -686
  18. package/dist/{chunk-KVUMOA6C.js → chunk-RKPGPVTO.js} +77 -4
  19. package/dist/chunk-UF3XQ3R3.js +3800 -0
  20. package/dist/{collectors-JDN5Y7EV.js → collectors-V7SCIIDH.js} +5 -3
  21. package/dist/{completions-ZVTNE52B.js → completions-FTPXDSR2.js} +44 -3
  22. package/dist/{config-J4YMADEF.js → config-5WW5M63G.js} +2 -1
  23. package/dist/containersCmd-FSMYOBG2.js +84 -0
  24. package/dist/{doctor-LHFW4UJP.js → doctor-O4DIAMHK.js} +3 -2
  25. package/dist/{explainCmd-MF6PIMLW.js → explainCmd-7PBPA7O5.js} +1 -0
  26. package/dist/{extensions-XJGHG7X3.js → extensions-QQEV7U3D.js} +1 -0
  27. package/dist/{firebaseSync-ON3RZ6KX.js → firebaseSync-LRN67UTV.js} +2 -0
  28. package/dist/flightRecorder-GJIAQOXC.js +162 -0
  29. package/dist/index.js +736 -4125
  30. package/dist/inspectCmd-5FXJBJTK.js +137 -0
  31. package/dist/menu-AJFGDLBP.js +1233 -0
  32. package/dist/monitors/platform/windows-ui.ps1 +31 -29
  33. package/dist/{netUsageCmd-67IBZZYN.js → netUsageCmd-JP6YKBPF.js} +7 -5
  34. package/dist/optimizeCmd-WZKLFYZU.js +1110 -0
  35. package/dist/{pipeCmd-2N4JPKYE.js → pipeCmd-CPK6FVKB.js} +5 -3
  36. package/dist/playbookCmd-FRROIEXR.js +145 -0
  37. package/dist/{profileProcCmd-N4H6MCBT.js → profileProcCmd-5Y3733E7.js} +64 -13
  38. package/dist/{prometheus-5BL5PVLC.js → prometheus-CYNUR3QT.js} +1 -0
  39. package/dist/{prometheusCmd-LEUM5WCZ.js → prometheusCmd-G2CSEZRQ.js} +5 -3
  40. package/dist/{replayCmd-Z3PYXY7V.js → replayCmd-ODB5SPOQ.js} +25 -6
  41. package/dist/{run-HOGQDDTA.js → run-UJQYT2TO.js} +1 -0
  42. package/dist/{serveCmd-L7LVJOZN.js → serveCmd-KDPWLVQI.js} +5 -3
  43. package/dist/{service-7GIX3YNC.js → service-LIYYR3UI.js} +1 -0
  44. package/dist/{smartCmd-ODWKSFNG.js → smartCmd-2BJJ37GV.js} +130 -5
  45. package/dist/statuslineCmd-EUKYRR2G.js +75 -0
  46. package/dist/{stressCmd-MFXMFXYX.js → stressCmd-GKHGY26X.js} +2 -0
  47. package/dist/{syncCmd-42IRF633.js → syncCmd-MIBFKX24.js} +16 -5
  48. package/dist/topoCmd-RTXQJ6XA.js +189 -0
  49. package/dist/{updateCheck-52X6LJG5.js → updateCheck-LJHEMG3G.js} +2 -0
  50. package/dist/{watchdogCmd-6GR4UN6B.js → watchdogCmd-XM6OPTKM.js} +41 -6
  51. package/dist/{wizard-JQMQWFAW.js → wizard-PRDOJROQ.js} +2 -1
  52. package/package.json +2 -2
  53. package/src/benchGitCmd.ts +110 -0
  54. package/src/budgetCmd.ts +199 -0
  55. package/src/completions.ts +42 -3
  56. package/src/containersCmd.ts +106 -0
  57. package/src/doctor.ts +86 -6
  58. package/src/easy_features.test.ts +83 -0
  59. package/src/flightRecorder.ts +214 -0
  60. package/src/index.ts +181 -8
  61. package/src/inspectCmd.ts +165 -0
  62. package/src/live/input.ts +70 -3
  63. package/src/live/render.ts +1 -1
  64. package/src/live/state.ts +2 -1
  65. package/src/menu/commands.ts +754 -0
  66. package/src/menu/index.ts +358 -0
  67. package/src/menu/render.ts +272 -0
  68. package/src/menu/types.ts +63 -0
  69. package/src/menu.test.ts +110 -0
  70. package/src/monitors/blender.ts +49 -19
  71. package/src/monitors/buildTracker.ts +72 -54
  72. package/src/monitors/platform/windows-ui.ps1 +31 -29
  73. package/src/monitors/platform/windows.ts +613 -280
  74. package/src/optimizeCmd.ts +1248 -0
  75. package/src/platform.test.ts +135 -0
  76. package/src/playbookCmd.ts +156 -0
  77. package/src/power_features.test.ts +251 -0
  78. package/src/profileProcCmd.ts +68 -21
  79. package/src/replayCmd.ts +15 -6
  80. package/src/smartCmd.ts +149 -10
  81. package/src/state/config.ts +13 -0
  82. package/src/statuslineCmd.ts +87 -0
  83. package/src/syncCmd.ts +12 -0
  84. package/src/topoCmd.ts +83 -50
  85. package/src/watchdogCmd.ts +40 -3
  86. package/src/xbar.ts +195 -17
  87. package/dist/chunk-M73HCQD2.js +0 -95
  88. package/dist/topoCmd-DZ3YS5IL.js +0 -148
@@ -0,0 +1,137 @@
1
+ import {
2
+ formatBytes
3
+ } from "./chunk-JH7P6KLN.js";
4
+ import "./chunk-3RG5ZIWI.js";
5
+
6
+ // src/inspectCmd.ts
7
+ import os from "os";
8
+ import { execSync } from "child_process";
9
+ import chalk from "chalk";
10
+ function inspectProcess(pid) {
11
+ try {
12
+ process.kill(pid, 0);
13
+ } catch (err) {
14
+ if (err.code === "ESRCH") {
15
+ throw new Error(`Process with PID ${pid} not found or permission denied.`);
16
+ }
17
+ }
18
+ let name = "unknown";
19
+ let user = "unknown";
20
+ let ppid = 0;
21
+ let threads = 1;
22
+ let nice = 0;
23
+ let cpuPct = 0;
24
+ let memRssBytes = 0;
25
+ try {
26
+ const psOut = execSync(`ps -p ${pid} -o user,ppid,nice,%cpu,rss,comm 2>/dev/null`, { encoding: "utf-8" });
27
+ const lines = psOut.trim().split("\n");
28
+ if (lines.length > 1) {
29
+ const parts = lines[1].trim().split(/\s+/);
30
+ user = parts[0] || "unknown";
31
+ ppid = parseInt(parts[1], 10) || 0;
32
+ nice = parseInt(parts[2], 10) || 0;
33
+ cpuPct = parseFloat(parts[3]) || 0;
34
+ memRssBytes = (parseInt(parts[4], 10) || 0) * 1024;
35
+ name = parts.slice(5).join(" ") || "unknown";
36
+ }
37
+ } catch {
38
+ if (pid === process.pid) {
39
+ try {
40
+ user = os.userInfo().username || "current";
41
+ } catch {
42
+ user = process.env.USER || "current";
43
+ }
44
+ ppid = process.ppid || 0;
45
+ name = process.title || "node";
46
+ memRssBytes = process.memoryUsage().rss;
47
+ threads = 1;
48
+ }
49
+ }
50
+ const openFiles = [];
51
+ const sockets = [];
52
+ try {
53
+ const lsofOut = execSync(`lsof -p ${pid} -F tn 2>/dev/null`, { encoding: "utf-8" });
54
+ const lines = lsofOut.split("\n");
55
+ let curType = "";
56
+ for (const l of lines) {
57
+ if (l.startsWith("t")) {
58
+ curType = l.slice(1).trim();
59
+ } else if (l.startsWith("n")) {
60
+ const nameVal = l.slice(1).trim();
61
+ if (curType === "IPv4" || curType === "IPv6" || nameVal.includes(":") || nameVal.includes("->")) {
62
+ sockets.push(nameVal);
63
+ } else if (nameVal.startsWith("/") && !openFiles.includes(nameVal)) {
64
+ openFiles.push(nameVal);
65
+ }
66
+ }
67
+ }
68
+ } catch {
69
+ }
70
+ return {
71
+ pid,
72
+ name,
73
+ user,
74
+ ppid,
75
+ threads,
76
+ nice,
77
+ cpuPct,
78
+ memRssBytes,
79
+ openFiles: openFiles.slice(0, 15),
80
+ sockets: sockets.slice(0, 15)
81
+ };
82
+ }
83
+ async function runInspectCommand(pid, opts) {
84
+ if (isNaN(pid) || pid <= 0) {
85
+ console.error(chalk.red(" \u2716 Invalid PID. Usage: pyre inspect <pid>"));
86
+ return;
87
+ }
88
+ if (opts?.nice !== void 0) {
89
+ try {
90
+ execSync(`renice ${opts.nice} -p ${pid}`, { stdio: "inherit" });
91
+ console.log(chalk.green(` \u2714 Successfully set nice priority for PID ${pid} to ${opts.nice}
92
+ `));
93
+ } catch (err) {
94
+ console.error(chalk.red(` \u2716 Failed to renice PID ${pid}: ${err.message}`));
95
+ }
96
+ }
97
+ try {
98
+ const details = inspectProcess(pid);
99
+ if (opts?.json) {
100
+ console.log(JSON.stringify(details, null, 2));
101
+ return;
102
+ }
103
+ console.log(chalk.bold(`
104
+ \u{1F525} pyre inspect \u2014 Process Deep Dive (PID ${details.pid})
105
+ `));
106
+ console.log(` Process: ${chalk.bold.hex("#ff6a39")(details.name)}`);
107
+ console.log(` User: ${details.user}`);
108
+ console.log(` PPID: ${details.ppid}`);
109
+ console.log(` CPU Usage: ${details.cpuPct.toFixed(1)}%`);
110
+ console.log(` Memory RSS: ${formatBytes(details.memRssBytes)}`);
111
+ console.log(` Nice Value: ${details.nice} (Priority: ${details.nice < 0 ? "High" : details.nice > 0 ? "Low" : "Normal"})`);
112
+ console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
113
+ console.log(chalk.bold.cyan("\n Active Network Sockets:"));
114
+ if (details.sockets.length === 0) {
115
+ console.log(chalk.dim(" No open sockets detected (or permission denied)."));
116
+ } else {
117
+ details.sockets.forEach((s) => console.log(` \u2022 ${s}`));
118
+ }
119
+ console.log(chalk.bold.yellow("\n Open File Descriptors:"));
120
+ if (details.openFiles.length === 0) {
121
+ console.log(chalk.dim(" No open file handles detected."));
122
+ } else {
123
+ details.openFiles.forEach((f) => console.log(` \u2022 ${chalk.dim(f)}`));
124
+ }
125
+ console.log(chalk.dim("\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
126
+ console.log(chalk.dim(` Adjust priority: pyre inspect ${pid} --nice <value -20 to 19>
127
+ `));
128
+ } catch (err) {
129
+ console.error(chalk.red(`
130
+ \u2716 ${err.message}
131
+ `));
132
+ }
133
+ }
134
+ export {
135
+ inspectProcess,
136
+ runInspectCommand
137
+ };