about-system 0.10.10 → 0.10.12

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 (58) hide show
  1. package/README.md +5 -3
  2. package/dist/about-system-cli.js +69 -54
  3. package/dist/about-system-cli.js.map +1 -1
  4. package/dist/index.d.ts +64 -18
  5. package/dist/index.js +1 -1
  6. package/dist/system-info-api-7iy1ZV2o.js +2475 -0
  7. package/dist/system-info-api-7iy1ZV2o.js.map +1 -0
  8. package/dist/system-info-api.d.ts +432 -62
  9. package/dist/system-info-api.js +1 -1
  10. package/dist/web/assets/index--HOsj3jw.js +14 -0
  11. package/dist/web/assets/index-BU_blZyu.css +1 -0
  12. package/dist/web/index.html +13 -0
  13. package/package.json +1 -1
  14. package/src/about-system-cli.ts +42 -3
  15. package/src/cache/cache-config.ts +3 -3
  16. package/src/info/hardware.test.ts +27 -12
  17. package/src/info/hardware.ts +25 -22
  18. package/src/info/network.ts +14 -47
  19. package/src/system-info-api.test.ts +106 -0
  20. package/src/system-info-api.ts +67 -28
  21. package/src/systeminfo-types.d.ts +16 -10
  22. package/src/utils/network.ts +113 -94
  23. package/src/utils/utils.test.ts +84 -75
  24. package/dist/about-system-cli.d.ts.map +0 -1
  25. package/dist/cache/cache-config.d.ts +0 -62
  26. package/dist/cache/cache-config.d.ts.map +0 -1
  27. package/dist/cache/cache.d.ts +0 -53
  28. package/dist/cache/cache.d.ts.map +0 -1
  29. package/dist/index.d.ts.map +0 -1
  30. package/dist/info/hardware.d.ts +0 -76
  31. package/dist/info/hardware.d.ts.map +0 -1
  32. package/dist/info/memory.d.ts +0 -59
  33. package/dist/info/memory.d.ts.map +0 -1
  34. package/dist/info/network.d.ts +0 -54
  35. package/dist/info/network.d.ts.map +0 -1
  36. package/dist/info/platform.d.ts +0 -36
  37. package/dist/info/platform.d.ts.map +0 -1
  38. package/dist/info/process.d.ts +0 -23
  39. package/dist/info/process.d.ts.map +0 -1
  40. package/dist/info/settings.d.ts +0 -185
  41. package/dist/info/settings.d.ts.map +0 -1
  42. package/dist/info/software.d.ts +0 -33
  43. package/dist/info/software.d.ts.map +0 -1
  44. package/dist/info/system-status.d.ts +0 -36
  45. package/dist/info/system-status.d.ts.map +0 -1
  46. package/dist/system-info-api-ByXoHI0m.js +0 -2464
  47. package/dist/system-info-api-ByXoHI0m.js.map +0 -1
  48. package/dist/system-info-api.d.ts.map +0 -1
  49. package/dist/types/internal-types.d.ts +0 -14
  50. package/dist/types/internal-types.d.ts.map +0 -1
  51. package/dist/utils/command.d.ts +0 -18
  52. package/dist/utils/command.d.ts.map +0 -1
  53. package/dist/utils/network.d.ts +0 -27
  54. package/dist/utils/network.d.ts.map +0 -1
  55. package/dist/utils/platform.d.ts +0 -11
  56. package/dist/utils/platform.d.ts.map +0 -1
  57. package/dist/web-server.d.ts +0 -21
  58. package/dist/web-server.d.ts.map +0 -1
@@ -1,62 +1,432 @@
1
- import { SystemInfo, SystemInfoOptions } from './systeminfo-types';
2
- import { user, hostname, os_info, kernel, device } from './info/platform';
3
- import { cpu, gpu, screen_resolution, bench, cpu_bench_info, gpu_bench, gpu_bench_info } from './info/hardware';
4
- import { disk_used, disk_size, ram_used, memory_available, swap_used, mount_points } from './info/memory';
5
- import { top_process, uptime, users_logged_in } from './info/process';
6
- import { ip, iplocal, city, domain, isp, network_interfaces, ports } from './info/network';
7
- import { services_running, temperature, battery, load_average } from './info/system-status';
8
- import { shell, packages, containers } from './info/software';
9
- /**
10
- * Loads cache from disk
11
- */
12
- declare function loadCache(): Cache;
13
- /**
14
- * Saves cache to disk
15
- */
16
- declare function saveCache(cache: Cache): void;
17
- /**
18
- * System information collection functions map
19
- */
20
- export declare const infoFunctions: {
21
- user: typeof user;
22
- hostname: typeof hostname;
23
- ip: typeof ip;
24
- iplocal: typeof iplocal;
25
- city: typeof city;
26
- domain: typeof domain;
27
- isp: typeof isp;
28
- os: typeof os_info;
29
- cpu: typeof cpu;
30
- gpu: typeof gpu;
31
- bench: typeof bench;
32
- cpu_bench_info: typeof cpu_bench_info;
33
- gpu_bench: typeof gpu_bench;
34
- gpu_bench_info: typeof gpu_bench_info;
35
- disk_used: typeof disk_used;
36
- disk_size: typeof disk_size;
37
- ram_used: typeof ram_used;
38
- top_process: typeof top_process;
39
- uptime: typeof uptime;
40
- device: typeof device;
41
- kernel: typeof kernel;
42
- shell: typeof shell;
43
- pacman: typeof packages;
44
- ports: typeof ports;
45
- containers: typeof containers;
46
- memory_available: typeof memory_available;
47
- swap_used: typeof swap_used;
48
- load_average: typeof load_average;
49
- users_logged_in: typeof users_logged_in;
50
- network_interfaces: typeof network_interfaces;
51
- mount_points: typeof mount_points;
52
- services_running: typeof services_running;
53
- temperature: typeof temperature;
54
- battery: typeof battery;
55
- screen_resolution: typeof screen_resolution;
56
- };
57
- /**
58
- * Get all system information as a clean JSON object
59
- */
60
- export declare function getSystemInfo(options?: SystemInfoOptions): Promise<SystemInfo>;
61
- export { loadCache, saveCache };
62
- //# sourceMappingURL=system-info-api.d.ts.map
1
+ import { SystemInfo } from './systeminfo-types';
2
+ import { SystemInfoOptions } from './systeminfo-types';
3
+
4
+ /**
5
+ * Gets battery charge level and charging status
6
+ * Reads from /sys/class/power_supply/BAT0 (Linux laptops only)
7
+ * @param context - Info context with cache
8
+ * @returns Battery percentage with optional + for charging, or empty string
9
+ * @example "85%", "42%+", "100%"
10
+ */
11
+ declare function battery(context: InfoContext): string;
12
+
13
+ /**
14
+ * Gets CPU benchmark score and rank from Geekbench 6 data
15
+ * Uses fuzzy matching to find similar CPU models
16
+ * @param context - Info context with cache
17
+ * @returns Benchmark info with score and rank, or empty string
18
+ * @example "38k #1 Top 1%", "21k #68 Top 7%"
19
+ */
20
+ declare function bench(context: InfoContext): string;
21
+
22
+ /**
23
+ * Cache storage structure
24
+ * @interface Cache
25
+ */
26
+ declare interface Cache {
27
+ [key: string]: CacheEntry;
28
+ }
29
+
30
+ /**
31
+ * Cache management utilities
32
+ * @module cache
33
+ */
34
+ /**
35
+ * Represents a cached value with timestamp
36
+ * @interface CacheEntry
37
+ */
38
+ declare interface CacheEntry {
39
+ /** The cached value */
40
+ value: any;
41
+ /** Unix timestamp when the value was cached */
42
+ timestamp: number;
43
+ }
44
+
45
+ /**
46
+ * Gets geographic city based on public IP
47
+ * @param context - Info context with IP geolocation data
48
+ * @returns City name or empty string
49
+ * @example "San Francisco", "New York", "London"
50
+ */
51
+ declare function city(context: InfoContext): string;
52
+
53
+ /**
54
+ * Gets running Docker container names
55
+ * Lists active Docker containers with their names
56
+ * @param context - Info context with cache
57
+ * @returns Space-separated container names or empty string
58
+ * @example "nginx redis postgres", "web-app db-server"
59
+ */
60
+ declare function containers(context: InfoContext): string;
61
+
62
+ /**
63
+ * Gets CPU model name and specifications
64
+ * Uses platform-specific commands (wmic/lscpu/cpuinfo)
65
+ * Automatically strips "with Radeon Graphics" and similar suffixes
66
+ * @param context - Info context with cache
67
+ * @returns CPU model string or empty string
68
+ * @example "Intel Core i7-12700K", "AMD Ryzen 9 5900HX", "Apple M2 Pro"
69
+ */
70
+ declare function cpu(context: InfoContext): string;
71
+
72
+ /**
73
+ * Gets detailed CPU benchmark information from Geekbench 6 data
74
+ * Includes score, rank, and architecture type (ARM/Intel/AMD)
75
+ * @param context - Info context with cache
76
+ * @returns Detailed benchmark info with architecture, or empty string
77
+ * @example "Geekbench 6: 38k (Rank #1, Top 1%) - ARM", "Geekbench 6: 21k (Rank #68, Top 7%) - Intel"
78
+ */
79
+ declare function cpu_bench_info(context: InfoContext): string;
80
+
81
+ /**
82
+ * Gets device or computer model name
83
+ * Uses WMI on Windows, DMI on Linux, getprop on Android
84
+ * @param context - Info context with cache
85
+ * @returns Device model name or empty string
86
+ * @example "Dell OptiPlex 7090", "MacBook Pro 16-inch", "Valve Steam Deck"
87
+ */
88
+ declare function device(context: InfoContext): string;
89
+
90
+ /**
91
+ * Gets disk size (used/total) for each real disk
92
+ * Uses `df -k` on Linux/macOS, filtering out pseudo filesystems, system/boot
93
+ * partitions (e.g. /boot, /System/Volumes/*), and anything under 10GB, since
94
+ * those aren't disks a user would care about. When exactly one real disk is
95
+ * found (the common case) the result omits the mount point; when multiple
96
+ * real disks are found (e.g. a data drive or external volume), each is
97
+ * labeled by its mount point.
98
+ * @param context - Info context with cache
99
+ * @returns Disk size as "used/total GB" or "mount(used/total GB) ..." or empty string
100
+ * @example "256/512GB", "/(100/500GB) /Volumes/Backup(900/2000GB)"
101
+ */
102
+ declare function disk_size(context: InfoContext): string;
103
+
104
+ /**
105
+ * Gets root filesystem disk usage percentage
106
+ * Uses df command on Linux/Android/macOS
107
+ * @param context - Info context with cache
108
+ * @returns Percentage string or empty string
109
+ * @example "45%", "78%"
110
+ */
111
+ declare function disk_used(context: InfoContext): string;
112
+
113
+ /**
114
+ * Gets reverse DNS hostname with HTTP prefix
115
+ * @param context - Info context with IP info
116
+ * @returns Domain with http:// prefix or empty string
117
+ * @example "http://example.com", "http://host-203-0-113-42.example.net"
118
+ */
119
+ declare function domain(context: InfoContext): string;
120
+
121
+ /**
122
+ * Get system information as a clean JSON object.
123
+ *
124
+ * `options.keys` limits collection to those blocks (all by default).
125
+ * `options.signal` stops collection early: whatever was gathered before the
126
+ * abort is returned, and the remaining blocks are left out.
127
+ */
128
+ export declare function getSystemInfo(options?: SystemInfoOptions): Promise<SystemInfo>;
129
+
130
+ /**
131
+ * Gets graphics card model name
132
+ * Extracts GPU info from lspci (Linux) or WMI (Windows)
133
+ * Filters out basic/generic display adapters
134
+ * @param context - Info context with cache
135
+ * @returns GPU model string or empty string
136
+ * @example "NVIDIA GeForce RTX 4070", "AMD Radeon RX 6800 XT"
137
+ */
138
+ declare function gpu(context: InfoContext): string;
139
+
140
+ /**
141
+ * Gets GPU benchmark score and rank from Geekbench 6 data
142
+ * Uses fuzzy matching to find similar GPU models
143
+ * @param context - Info context with cache
144
+ * @returns Benchmark info with score and rank, or empty string
145
+ * @example "38k #1 Top 1%", "21k #68 Top 7%"
146
+ */
147
+ declare function gpu_bench(context: InfoContext): string;
148
+
149
+ /**
150
+ * Gets detailed GPU benchmark information from Geekbench 6 data
151
+ * Includes score, rank, and vendor detection
152
+ * @param context - Info context with cache
153
+ * @returns Detailed benchmark info with vendor, or empty string
154
+ * @example "Geekbench 6: 38k (Rank #1, Top 1%) - NVIDIA", "Geekbench 6: 21k (Rank #68, Top 7%) - AMD"
155
+ */
156
+ declare function gpu_bench_info(context: InfoContext): string;
157
+
158
+ /**
159
+ * Gets the system hostname
160
+ * @returns Computer hostname/network name
161
+ */
162
+ declare function hostname(): string;
163
+
164
+ /**
165
+ * Context object passed to info collection functions
166
+ * @interface InfoContext
167
+ */
168
+ declare interface InfoContext {
169
+ /** Cache storage */
170
+ cache: Cache;
171
+ /** IP information from external API */
172
+ ipInfo?: IPInfo;
173
+ }
174
+
175
+ /**
176
+ * System information collection functions map
177
+ */
178
+ export declare const infoFunctions: {
179
+ user: typeof user;
180
+ hostname: typeof hostname;
181
+ ip: typeof ip;
182
+ iplocal: typeof iplocal;
183
+ city: typeof city;
184
+ domain: typeof domain;
185
+ isp: typeof isp;
186
+ os: typeof os_info;
187
+ cpu: typeof cpu;
188
+ gpu: typeof gpu;
189
+ bench: typeof bench;
190
+ cpu_bench_info: typeof cpu_bench_info;
191
+ gpu_bench: typeof gpu_bench;
192
+ gpu_bench_info: typeof gpu_bench_info;
193
+ disk_used: typeof disk_used;
194
+ disk_size: typeof disk_size;
195
+ ram_used: typeof ram_used;
196
+ top_process: typeof top_process;
197
+ uptime: typeof uptime;
198
+ device: typeof device;
199
+ kernel: typeof kernel;
200
+ shell: typeof shell;
201
+ pacman: typeof packages;
202
+ ports: typeof ports;
203
+ containers: typeof containers;
204
+ memory_available: typeof memory_available;
205
+ swap_used: typeof swap_used;
206
+ load_average: typeof load_average;
207
+ users_logged_in: typeof users_logged_in;
208
+ network_interfaces: typeof network_interfaces;
209
+ mount_points: typeof mount_points;
210
+ services_running: typeof services_running;
211
+ temperature: typeof temperature;
212
+ battery: typeof battery;
213
+ screen_resolution: typeof screen_resolution;
214
+ };
215
+
216
+ /**
217
+ * Gets public IP address. The ip, city, domain and isp blocks all read the one
218
+ * shared lookup in `context.ipInfo`, which `getSystemInfo` caches for 10 minutes.
219
+ * @param context - Info context with IP info
220
+ * @returns Public IP address or empty string
221
+ * @example "203.0.113.42"
222
+ */
223
+ declare function ip(context: InfoContext): string;
224
+
225
+ /**
226
+ * Network utilities for IP information fetching
227
+ * @module network
228
+ */
229
+ /**
230
+ * IP information from ipinfo.io API
231
+ * @interface IPInfo
232
+ */
233
+ declare interface IPInfo {
234
+ /** Public IP address */
235
+ ip?: string;
236
+ /** City location */
237
+ city?: string;
238
+ /** Reverse DNS hostname */
239
+ hostname?: string;
240
+ /** ISP organization string (includes AS number) */
241
+ org?: string;
242
+ }
243
+
244
+ /**
245
+ * Gets local/private IP address(es)
246
+ * Tries ifconfig and ip commands on Linux, falls back to Node.js API
247
+ * @returns Space-separated local IP addresses (RFC 1918 ranges)
248
+ * @example "192.168.1.100" or "10.0.0.50 192.168.1.100"
249
+ */
250
+ declare function iplocal(): string;
251
+
252
+ /**
253
+ * Gets Internet Service Provider name
254
+ * Strips AS number prefix from organization string
255
+ * @param context - Info context with IP info
256
+ * @returns ISP name or empty string
257
+ * @example "Comcast Cable", "Verizon Business", "Cloudflare Inc"
258
+ */
259
+ declare function isp(context: InfoContext): string;
260
+
261
+ /**
262
+ * Gets kernel version string
263
+ * Returns the operating system kernel version from os.release()
264
+ * @param context - Info context with cache
265
+ * @returns Kernel version string
266
+ * @example "5.15.0-56-generic", "6.11.11-valve12-1-neptune"
267
+ */
268
+ declare function kernel(context: InfoContext): string;
269
+
270
+ /**
271
+ * Gets system load averages
272
+ * Reads 1, 5, and 15 minute load averages from /proc/loadavg (Linux) or
273
+ * os.loadavg() (macOS)
274
+ * @returns Space-separated load averages (1m 5m 15m) or empty string
275
+ * @example "0.52 0.58 0.59", "2.10 1.95 1.88"
276
+ */
277
+ declare function load_average(context: InfoContext): string;
278
+
279
+ /**
280
+ * Loads cache from disk
281
+ */
282
+ export declare function loadCache(): Cache;
283
+
284
+ /**
285
+ * Gets available memory in gigabytes
286
+ * Reads MemAvailable from /proc/meminfo (Linux) or derives it from
287
+ * vm_stat's free+inactive pages (macOS)
288
+ * @returns Available memory with "GB available" suffix or empty string
289
+ * @example "12GB available", "4GB available"
290
+ */
291
+ declare function memory_available(): string;
292
+
293
+ /**
294
+ * Gets mounted filesystem information
295
+ * Lists non-system mount points with usage from df (Linux/macOS)
296
+ * On Linux, excludes /, /dev, /proc, /sys and internal /System/Volumes mounts.
297
+ * On macOS, APFS internal volumes (Data, VM, Preboot, Update, ...) all live
298
+ * under /System/Volumes and are not user-relevant, so only /Volumes (external
299
+ * disks, network shares, disk images) are reported.
300
+ * @param context - Info context with cache
301
+ * @returns Space-separated mount points with usage or empty string
302
+ * @example "/home(45%) /mnt/data(78%)", "/Volumes/Backup(78%)"
303
+ */
304
+ declare function mount_points(context: InfoContext): string;
305
+
306
+ /**
307
+ * Gets active network interface names
308
+ * Lists non-loopback interfaces with IPv4 addresses (Linux/macOS only)
309
+ * @param context - Info context with cache
310
+ * @returns Space-separated interface names or empty string
311
+ * @example "eth0 wlan0", "en0 en1"
312
+ */
313
+ declare function network_interfaces(context: InfoContext): string;
314
+
315
+ /**
316
+ * Gets operating system name and version
317
+ * Platform-specific detection for Windows, macOS, and Linux
318
+ * @param context - Info context with cache
319
+ * @returns OS name and version string
320
+ * @example "Windows 11 Pro", "macOS Ventura 13.2.1", "Ubuntu 22.04.3 LTS"
321
+ */
322
+ declare function os_info(context: InfoContext): string;
323
+
324
+ /**
325
+ * Gets available package managers and development tools
326
+ * Checks for package managers (apt, yum, npm, etc.) and editors (nvim, hx)
327
+ * @param context - Info context with cache
328
+ * @returns Space-separated list of available commands
329
+ * @example "apt npm docker nvim", "yay pacman bun hx"
330
+ */
331
+ declare function packages(context: InfoContext): string;
332
+
333
+ /**
334
+ * Gets open TCP ports with service names
335
+ * Uses lsof to find listening TCP ports (Linux/macOS only)
336
+ * @param context - Info context with cache
337
+ * @returns Space-separated port+process pairs or empty string
338
+ * @example "80http 443http 22ssh", "3000node 5432post"
339
+ */
340
+ declare function ports(context: InfoContext): string;
341
+
342
+ /**
343
+ * Gets memory usage in gigabytes
344
+ * Reads from /proc/meminfo on Linux, falls back to os.totalmem()
345
+ * @param context - Info context with cache
346
+ * @returns Memory usage as "used/total GB"
347
+ * @example "12/32GB", "6/16GB"
348
+ */
349
+ declare function ram_used(context: InfoContext): string;
350
+
351
+ /**
352
+ * Saves cache to disk
353
+ */
354
+ export declare function saveCache(cache: Cache): void;
355
+
356
+ /**
357
+ * Gets screen resolution
358
+ * Uses xrandr on Linux (X11/Xorg only) or system_profiler on macOS
359
+ * @returns Resolution in WIDTHxHEIGHT format or empty string
360
+ * @example "1920x1080", "2560x1440", "3840x2160"
361
+ */
362
+ declare function screen_resolution(): string;
363
+
364
+ /**
365
+ * Gets count of running system services
366
+ * Uses systemctl or service command (Linux only)
367
+ * @param context - Info context with cache
368
+ * @returns Service count with "services" suffix or empty string
369
+ * @example "125 services", "89 services"
370
+ */
371
+ declare function services_running(context: InfoContext): string;
372
+
373
+ /**
374
+ * Gets the current shell name
375
+ * Uses the user's login shell (macOS/Linux), falls back to ps for the
376
+ * parent process shell
377
+ * @returns Shell name or empty string on Windows
378
+ * @example "bash", "zsh", "fish", "nu"
379
+ */
380
+ declare function shell(context: InfoContext): string;
381
+
382
+ /**
383
+ * Gets swap memory usage
384
+ * Calculates swap usage from /proc/meminfo (Linux) or `sysctl vm.swapusage`
385
+ * (macOS)
386
+ * @returns Swap usage as "percentage (size MB) swap" or empty string
387
+ * @example "15% (512MB) swap", "0% (0MB) swap"
388
+ */
389
+ declare function swap_used(): string;
390
+
391
+ /**
392
+ * Gets system temperature in Celsius
393
+ * Reads from thermal zone or hwmon sensors (Linux), or from the
394
+ * `osx-cpu-temp` CLI (macOS, if installed via `brew install osx-cpu-temp`) -
395
+ * macOS has no unprivileged API for this, so nothing is reported without it
396
+ * @param context - Info context with cache
397
+ * @returns Temperature with °C suffix or empty string
398
+ * @example "45°C", "62°C"
399
+ */
400
+ declare function temperature(context: InfoContext): string;
401
+
402
+ /**
403
+ * Gets the highest CPU-consuming process
404
+ * Uses ps command to find top process by CPU usage (Linux/macOS only)
405
+ * @param context - Info context with cache
406
+ * @returns Process info as "percentage processname" or empty string
407
+ * @example "8% firefox", "15% chrome", "3% systemd"
408
+ */
409
+ declare function top_process(context: InfoContext): string;
410
+
411
+ /**
412
+ * Gets system uptime since last boot
413
+ * @returns Uptime formatted as "Xd Yh Zm"
414
+ * @example "2d 14h 23m", "0d 3h 45m"
415
+ */
416
+ declare function uptime(): string;
417
+
418
+ /**
419
+ * Gets the current username
420
+ * @returns Current system username
421
+ */
422
+ declare function user(): string;
423
+
424
+ /**
425
+ * Gets number of logged in users
426
+ * Uses who command to count active user sessions (Linux/macOS only)
427
+ * @returns User count with "users" suffix or empty string
428
+ * @example "3 users", "1 users"
429
+ */
430
+ declare function users_logged_in(): string;
431
+
432
+ export { }
@@ -1,6 +1,6 @@
1
1
  import "os";
2
2
  import "fs";
3
- import { g as i, i as m, l as r, s as n } from "./system-info-api-ByXoHI0m.js";
3
+ import { g as i, i as m, l as r, s as n } from "./system-info-api-7iy1ZV2o.js";
4
4
  import "path";
5
5
  export {
6
6
  i as getSystemInfo,