sysmon-tui-dashboard 1.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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm install *)"
5
+ ]
6
+ }
7
+ }
package/README-npm.md ADDED
@@ -0,0 +1,100 @@
1
+ # tui-sysmon
2
+
3
+ > Real-time system monitor dashboard in your terminal
4
+
5
+ Beautiful terminal-based system monitoring dashboard showing CPU, RAM, Network, Disk usage and top processes.
6
+
7
+ ![Node.js](https://img.shields.io/badge/node-%3E%3D14.0.0-brightgreen)
8
+ ![License](https://img.shields.io/badge/license-MIT-blue)
9
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)
10
+
11
+ ## Features
12
+
13
+ - πŸ“Š **CPU Usage** - Real-time CPU load with per-core support and history graph
14
+ - πŸ’Ύ **RAM Usage** - Memory usage gauge with history sparkline
15
+ - 🌐 **Network** - Upload/Download speed chart
16
+ - πŸ’Ώ **Disk Usage** - Visual disk space usage per drive
17
+ - πŸ“‹ **Top Processes** - Table of top processes by CPU/RAM
18
+ - ℹ️ **System Info** - OS, CPU, cores, uptime
19
+
20
+ ## Installation
21
+
22
+ ### Global (recommended)
23
+
24
+ ```bash
25
+ npm install -g tui-sysmon
26
+ ```
27
+
28
+ ### Without installation
29
+
30
+ ```bash
31
+ npx tui-sysmon
32
+ ```
33
+
34
+ ### Local project
35
+
36
+ ```bash
37
+ npm install tui-sysmon
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ If installed globally:
43
+ ```bash
44
+ sysmon
45
+ ```
46
+
47
+ Or via npm script:
48
+ ```bash
49
+ npx tui-sysmon
50
+ ```
51
+
52
+ ### Controls
53
+
54
+ | Key | Action |
55
+ |-----|--------|
56
+ | `q` / `Esc` / `Ctrl+C` | Exit |
57
+
58
+ ## Dashboard Layout
59
+
60
+ ```
61
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ CPU ─────────┬───────── RAM ─────────┐
62
+ β”‚ [==== 72% ====] β”‚ [==== 45% ====] β”‚
63
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ History ─────┴───────── History ───────
64
+ β”‚ β–β–ƒβ–…β–‡β–†β–„β–‚β–β–ƒβ–…β–‡β–ˆβ–†β–„β–‚ β”‚ ▂▄▆▅▃▁▂▄▆▅▃▁▂▄▆ β”‚
65
+ β”œβ”€β”€β”€β”€β”€β”€β”€ Network ───────┬──────── Disk ───────────
66
+ β”‚ β•±β•² β•±β•² β”‚ C:\ [β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘] 65% β”‚
67
+ β”‚ β•± β•² β•± β•² β”‚ D:\ [β–ˆβ–ˆβ–‘β–‘β–‘β–‘] 32% β”‚
68
+ β”‚ β•± β•²β•± β•² β”‚ E:\ [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 89% β”‚
69
+ β”œβ”€β”€β”€β”€ System Info ──────┬──── Top Processes ──────
70
+ β”‚ OS: Windows 11 β”‚ PID Name CPU RAM β”‚
71
+ β”‚ CPU: Ryzen 7 5800X β”‚ 1234 chrome 12% 2G β”‚
72
+ β”‚ Cores: 16 β”‚ 5678 node 8% 500Mβ”‚
73
+ β”‚ Uptime: 3d 14h 22m β”‚ 9012 code 5% 800Mβ”‚
74
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
75
+ ```
76
+
77
+ ## Requirements
78
+
79
+ - Node.js >= 14.0.0
80
+ - Works on Windows, Linux, macOS
81
+
82
+ ## Development
83
+
84
+ ```bash
85
+ # Clone and run
86
+ git clone <repo-url>
87
+ cd tui-sysmon
88
+ npm install
89
+ npm start
90
+ ```
91
+
92
+ ## Tech Stack
93
+
94
+ - [blessed](https://github.com/chjj/blessed) - Terminal UI framework
95
+ - [blessed-contrib](https://github.com/yaronn/blessed-contrib) - Terminal widgets (charts, gauges, tables)
96
+ - [systeminformation](https://github.com/sebhildebrandt/systeminformation) - System metrics library
97
+
98
+ ## License
99
+
100
+ MIT
package/dashboard.js ADDED
@@ -0,0 +1,307 @@
1
+ #!/usr/bin/env node
2
+
3
+ const blessed = require('blessed');
4
+ const contrib = require('blessed-contrib');
5
+ const si = require('systeminformation');
6
+
7
+ // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ экран
8
+ const screen = blessed.screen({
9
+ smartCSR: true,
10
+ fullUnicode: true,
11
+ title: 'System Monitor Dashboard'
12
+ });
13
+
14
+ // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ grid layout
15
+ const grid = new contrib.grid({
16
+ rows: 12,
17
+ cols: 12,
18
+ screen: screen
19
+ });
20
+
21
+ // === Π’ΠΈΠ΄ΠΆΠ΅Ρ‚Ρ‹ ===
22
+
23
+ // CPU Usage - gauge
24
+ const cpuGauge = grid.set(0, 0, 2, 6, contrib.gauge, {
25
+ label: 'CPU Usage',
26
+ stroke: 'green',
27
+ fill: 'green',
28
+ stack: []
29
+ });
30
+
31
+ // RAM Usage - gauge
32
+ const ramGauge = grid.set(0, 6, 2, 6, contrib.gauge, {
33
+ label: 'RAM Usage',
34
+ stroke: 'cyan',
35
+ fill: 'cyan',
36
+ stack: []
37
+ });
38
+
39
+ // CPU History - sparkline
40
+ const cpuSpark = grid.set(2, 0, 3, 6, contrib.sparkline, {
41
+ label: 'CPU History (%)',
42
+ tags: true,
43
+ style: { fg: 'green' },
44
+ totalMax: 100
45
+ });
46
+
47
+ // RAM History - sparkline
48
+ const ramSpark = grid.set(2, 6, 3, 6, contrib.sparkline, {
49
+ label: 'RAM History (%)',
50
+ tags: true,
51
+ style: { fg: 'cyan' },
52
+ totalMax: 100
53
+ });
54
+
55
+ // Network - line chart
56
+ const networkChart = grid.set(5, 0, 4, 6, contrib.line, {
57
+ label: 'Network (KB/s)',
58
+ tags: true,
59
+ style: {
60
+ text: 'yellow',
61
+ baseline: 'black'
62
+ },
63
+ xLabelPadding: 3,
64
+ xPadding: 5,
65
+ showLegend: true,
66
+ legend: { width: 15 }
67
+ });
68
+
69
+ // Disk Usage - bar chart
70
+ const diskChart = grid.set(5, 6, 4, 6, contrib.bar, {
71
+ label: 'Disk Usage (%)',
72
+ tags: true,
73
+ style: {
74
+ text: 'white',
75
+ header: 'white',
76
+ baseline: 'black'
77
+ },
78
+ barBgColor: ['red', 'green', 'blue', 'magenta', 'cyan'],
79
+ barFgColor: ['white', 'white', 'white', 'white', 'white'],
80
+ xLabelPadding: 2,
81
+ xPadding: 5
82
+ });
83
+
84
+ // System Info - box
85
+ const sysInfo = grid.set(9, 0, 3, 4, blessed.box, {
86
+ label: 'System Info',
87
+ tags: true,
88
+ border: 'line',
89
+ style: { fg: 'white' },
90
+ content: 'Loading...'
91
+ });
92
+
93
+ // Top Processes - table
94
+ const processTable = grid.set(9, 4, 3, 8, contrib.table, {
95
+ label: 'Top Processes (by CPU)',
96
+ keys: true,
97
+ tags: true,
98
+ interactive: true,
99
+ border: 'line',
100
+ columnSpacing: 2,
101
+ columnWidth: [6, 30, 10, 10, 10]
102
+ });
103
+
104
+ // Π‘ΠΎΠ±ΠΈΡ€Π°Π΅ΠΌ Π΄Π°Π½Π½Ρ‹Π΅ для истории
105
+ const cpuHistory = [];
106
+ const ramHistory = [];
107
+ const networkHistory = { upload: [], download: [] };
108
+ const maxHistoryPoints = 30;
109
+
110
+ // Π€ΠΎΡ€ΠΌΠ°Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Π±Π°ΠΉΡ‚ΠΎΠ²
111
+ function formatBytes(bytes) {
112
+ if (bytes === 0) return '0 B';
113
+ const k = 1024;
114
+ const sizes = ['B', 'KB', 'MB', 'GB'];
115
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
116
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];
117
+ }
118
+
119
+ // Π€ΠΎΡ€ΠΌΠ°Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Π²Ρ€Π΅ΠΌΠ΅Π½ΠΈ Π°ΠΏΡ‚Π°ΠΉΠΌΠ°
120
+ function formatUptime(seconds) {
121
+ const days = Math.floor(seconds / 86400);
122
+ const hours = Math.floor((seconds % 86400) / 3600);
123
+ const minutes = Math.floor((seconds % 3600) / 60);
124
+ if (days > 0) return `${days}d ${hours}h ${minutes}m`;
125
+ if (hours > 0) return `${hours}h ${minutes}m`;
126
+ return `${minutes}m`;
127
+ }
128
+
129
+ // ОбновлСниС CPU gauge
130
+ async function updateCPU() {
131
+ try {
132
+ const cpuData = await si.currentLoad();
133
+ const cpuPercent = cpuData.currentLoad.toFixed(1);
134
+
135
+ cpuGauge.setData([parseFloat(cpuPercent)]);
136
+ cpuGauge.setLabel(`CPU Usage: ${cpuPercent}%`);
137
+
138
+ // Π˜ΡΡ‚ΠΎΡ€ΠΈΡ CPU
139
+ cpuHistory.push(parseFloat(cpuPercent));
140
+ if (cpuHistory.length > maxHistoryPoints) cpuHistory.shift();
141
+
142
+ cpuSpark.setData(['CPU'], [cpuHistory], ['green']);
143
+
144
+ return cpuData;
145
+ } catch (err) {
146
+ console.error('CPU update error:', err);
147
+ return null;
148
+ }
149
+ }
150
+
151
+ // ОбновлСниС RAM gauge
152
+ async function updateRAM() {
153
+ try {
154
+ const memData = await si.mem();
155
+ const memPercent = ((memData.active / memData.total) * 100).toFixed(1);
156
+
157
+ ramGauge.setData([parseFloat(memPercent)]);
158
+ ramGauge.setLabel(`RAM: ${formatBytes(memData.active)} / ${formatBytes(memData.total)}`);
159
+
160
+ // Π˜ΡΡ‚ΠΎΡ€ΠΈΡ RAM
161
+ ramHistory.push(parseFloat(memPercent));
162
+ if (ramHistory.length > maxHistoryPoints) ramHistory.shift();
163
+
164
+ ramSpark.setData(['RAM'], [ramHistory], ['cyan']);
165
+
166
+ return memData;
167
+ } catch (err) {
168
+ console.error('RAM update error:', err);
169
+ return null;
170
+ }
171
+ }
172
+
173
+ // ОбновлСниС сСти
174
+ let lastNetworkData = null;
175
+ async function updateNetwork() {
176
+ try {
177
+ const netData = await si.networkStats();
178
+
179
+ if (netData.length > 0 && lastNetworkData) {
180
+ const mainInterface = netData[0];
181
+ const uploadSpeed = (mainInterface.tx_sec - lastNetworkData.tx_sec) * 1000; // KB/s
182
+ const downloadSpeed = (mainInterface.rx_sec - lastNetworkData.rx_sec) * 1000; // KB/s
183
+
184
+ networkHistory.upload.push(parseFloat((uploadSpeed / 1024).toFixed(2)));
185
+ networkHistory.download.push(parseFloat((downloadSpeed / 1024).toFixed(2)));
186
+
187
+ if (networkHistory.upload.length > maxHistoryPoints) networkHistory.upload.shift();
188
+ if (networkHistory.download.length > maxHistoryPoints) networkHistory.download.shift();
189
+
190
+ const timeLabels = networkHistory.upload.map((_, i) => {
191
+ const secondsAgo = (maxHistoryPoints - i - 1) * 2;
192
+ return secondsAgo === 0 ? 'now' : `-${secondsAgo}s`;
193
+ });
194
+
195
+ networkChart.setData({
196
+ title: 'Upload',
197
+ x: timeLabels.slice(-15),
198
+ y: networkHistory.upload.slice(-15),
199
+ style: 'yellow'
200
+ }, {
201
+ title: 'Download',
202
+ x: timeLabels.slice(-15),
203
+ y: networkHistory.download.slice(-15),
204
+ style: 'green'
205
+ });
206
+ }
207
+
208
+ lastNetworkData = netData[0];
209
+ } catch (err) {
210
+ console.error('Network update error:', err);
211
+ }
212
+ }
213
+
214
+ // ОбновлСниС диска
215
+ async function updateDisk() {
216
+ try {
217
+ const fsData = await si.fsSize();
218
+
219
+ const bars = fsData.slice(0, 5).map(disk => ({
220
+ title: disk.mount,
221
+ value: parseFloat(disk.use.toFixed(1))
222
+ }));
223
+
224
+ diskChart.setData({
225
+ titles: bars.map(b => b.title),
226
+ data: bars.map(b => b.value)
227
+ });
228
+ } catch (err) {
229
+ console.error('Disk update error:', err);
230
+ }
231
+ }
232
+
233
+ // ОбновлСниС систСмной ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ
234
+ async function updateSysInfo() {
235
+ try {
236
+ const osInfo = await si.osInfo();
237
+ const cpuInfo = await si.cpu();
238
+ const time = await si.time();
239
+
240
+ const uptime = formatUptime(time.uptime);
241
+
242
+ const content = [
243
+ `OS: ${osInfo.platform}`,
244
+ `Arch: ${osInfo.arch}`,
245
+ `Kernel: ${osInfo.kernel}`,
246
+ `CPU: ${cpuInfo.brand}`,
247
+ `Cores: ${cpuInfo.cores}`,
248
+ `Uptime: ${uptime}`
249
+ ].join('\n');
250
+
251
+ sysInfo.setContent(content);
252
+ } catch (err) {
253
+ console.error('SysInfo update error:', err);
254
+ }
255
+ }
256
+
257
+ // ОбновлСниС Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹ процСссов
258
+ async function updateProcesses() {
259
+ try {
260
+ const processes = await si.processes();
261
+
262
+ const topProcesses = processes.list
263
+ .sort((a, b) => b.cpu - a.cpu)
264
+ .slice(0, 15)
265
+ .map(p => [
266
+ p.pid.toString(),
267
+ p.name.substring(0, 30),
268
+ p.cpu.toFixed(1) + '%',
269
+ formatBytes(p.memRss || 0),
270
+ p.user || 'system'
271
+ ]);
272
+
273
+ processTable.setData({
274
+ headers: ['PID', 'Name', 'CPU', 'RAM', 'User'],
275
+ data: topProcesses
276
+ });
277
+ } catch (err) {
278
+ console.error('Process update error:', err);
279
+ }
280
+ }
281
+
282
+ // Π“Π»Π°Π²Π½ΠΎΠ΅ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅
283
+ async function updateAll() {
284
+ await Promise.allSettled([
285
+ updateCPU(),
286
+ updateRAM(),
287
+ updateNetwork(),
288
+ updateDisk(),
289
+ updateSysInfo(),
290
+ updateProcesses()
291
+ ]);
292
+
293
+ screen.render();
294
+ }
295
+
296
+ // ΠžΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° Π²Ρ‹Ρ…ΠΎΠ΄Π°
297
+ screen.key(['escape', 'q', 'C-c'], () => {
298
+ return process.exit(0);
299
+ });
300
+
301
+ // Запуск
302
+ updateAll();
303
+
304
+ // ОбновлСниС ΠΊΠ°ΠΆΠ΄Ρ‹Π΅ 2 сСкунды
305
+ setInterval(updateAll, 2000);
306
+
307
+ screen.render();
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "sysmon-tui-dashboard",
3
+ "version": "1.0.0",
4
+ "description": "Real-time system monitor dashboard in your terminal - CPU, RAM, Network, Disk, Processes",
5
+ "main": "dashboard.js",
6
+ "bin": {
7
+ "sysmon": "./dashboard.js"
8
+ },
9
+ "scripts": {
10
+ "start": "node dashboard.js",
11
+ "monitor": "node dashboard.js",
12
+ "test": "echo \"Error: no test specified\" && exit 1"
13
+ },
14
+ "keywords": [
15
+ "system-monitor",
16
+ "terminal-ui",
17
+ "dashboard",
18
+ "cpu",
19
+ "ram",
20
+ "network",
21
+ "disk-usage",
22
+ "processes",
23
+ "blessed",
24
+ "tui",
25
+ "cli",
26
+ "real-time",
27
+ "monitoring"
28
+ ],
29
+ "author": "Professional",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/Professional/tui-sysmon"
34
+ },
35
+ "homepage": "https://github.com/Professional/tui-sysmon#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/Professional/tui-sysmon/issues"
38
+ },
39
+ "engines": {
40
+ "node": ">=14.0.0"
41
+ },
42
+ "os": [
43
+ "win32",
44
+ "linux",
45
+ "darwin"
46
+ ],
47
+ "dependencies": {
48
+ "blessed": "^0.1.81",
49
+ "blessed-contrib": "^4.11.0",
50
+ "systeminformation": "^5.31.5"
51
+ }
52
+ }