about-system 0.0.18 → 0.0.21
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 +99 -207
- package/dist/about-system-cli.d.ts +0 -0
- package/dist/about-system-cli.js +113 -205
- package/dist/about-system-cli.js.map +1 -1
- package/dist/index.d.ts +3 -9
- package/dist/index.js +4 -4
- package/dist/index.js.map +0 -0
- package/dist/system-info-api-DAF2cjeE.js +837 -0
- package/dist/system-info-api-DAF2cjeE.js.map +1 -0
- package/dist/system-info-api.d.ts +313 -194
- package/dist/system-info-api.js +9 -791
- package/dist/system-info-api.js.map +1 -1
- package/package.json +6 -6
- package/src/about-system-cli.ts +124 -221
- package/src/cache/cache-config.ts +68 -0
- package/src/cache/cache.ts +95 -0
- package/src/index.ts +0 -0
- package/src/info/hardware.ts +173 -0
- package/src/info/memory.ts +215 -0
- package/src/info/network.ts +213 -0
- package/src/info/platform.ts +145 -0
- package/src/info/process.ts +72 -0
- package/src/info/settings.ts +209 -0
- package/src/info/software.ts +192 -0
- package/src/info/system-status.ts +152 -0
- package/src/system-info-api.ts +78 -1117
- package/src/systeminfo-types.d.ts +0 -0
- package/src/types/internal-types.ts +21 -0
- package/src/utils/command.ts +47 -0
- package/src/utils/network.ts +58 -0
- package/src/utils/platform.ts +13 -0
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { SystemInfo } from './systeminfo-types
|
|
2
|
-
import { SystemInfoOptions } from './systeminfo-types
|
|
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;
|
|
3
12
|
|
|
4
13
|
/**
|
|
5
14
|
* Cache storage structure
|
|
@@ -9,6 +18,17 @@ declare interface Cache {
|
|
|
9
18
|
[key: string]: CacheEntry;
|
|
10
19
|
}
|
|
11
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Cache storage structure
|
|
23
|
+
*/
|
|
24
|
+
declare interface Cache_2 {
|
|
25
|
+
[key: string]: CacheEntry_2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Cache management utilities
|
|
30
|
+
* @module cache
|
|
31
|
+
*/
|
|
12
32
|
/**
|
|
13
33
|
* Represents a cached value with timestamp
|
|
14
34
|
* @interface CacheEntry
|
|
@@ -20,13 +40,88 @@ declare interface CacheEntry {
|
|
|
20
40
|
timestamp: number;
|
|
21
41
|
}
|
|
22
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Represents a cached value with timestamp
|
|
45
|
+
*/
|
|
46
|
+
declare interface CacheEntry_2 {
|
|
47
|
+
value: any;
|
|
48
|
+
timestamp: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Gets geographic city based on public IP
|
|
53
|
+
* @param context - Info context with IP geolocation data
|
|
54
|
+
* @returns City name or empty string
|
|
55
|
+
* @example "San Francisco", "New York", "London"
|
|
56
|
+
*/
|
|
57
|
+
declare function city(context: InfoContext): Promise<string>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets running Docker container names
|
|
61
|
+
* Lists active Docker containers with their names
|
|
62
|
+
* @param context - Info context with cache
|
|
63
|
+
* @returns Space-separated container names or empty string
|
|
64
|
+
* @example "nginx redis postgres", "web-app db-server"
|
|
65
|
+
*/
|
|
66
|
+
declare function containers(context: InfoContext): string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets CPU model name and specifications
|
|
70
|
+
* Uses platform-specific commands (wmic/lscpu/cpuinfo)
|
|
71
|
+
* Automatically strips "with Radeon Graphics" and similar suffixes
|
|
72
|
+
* @param context - Info context with cache
|
|
73
|
+
* @returns CPU model string or empty string
|
|
74
|
+
* @example "Intel Core i7-12700K", "AMD Ryzen 9 5900HX", "Apple M2 Pro"
|
|
75
|
+
*/
|
|
76
|
+
declare function cpu(context: InfoContext): string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Gets device or computer model name
|
|
80
|
+
* Uses WMI on Windows, DMI on Linux, getprop on Android
|
|
81
|
+
* @param context - Info context with cache
|
|
82
|
+
* @returns Device model name or empty string
|
|
83
|
+
* @example "Dell OptiPlex 7090", "MacBook Pro 16-inch", "Valve Steam Deck"
|
|
84
|
+
*/
|
|
85
|
+
declare function device(context: InfoContext): string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Gets root filesystem disk usage percentage
|
|
89
|
+
* Uses df command on Linux/Android
|
|
90
|
+
* @param context - Info context with cache
|
|
91
|
+
* @returns Percentage string or empty string
|
|
92
|
+
* @example "45%", "78%"
|
|
93
|
+
*/
|
|
94
|
+
declare function disk_used(context: InfoContext): string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Gets reverse DNS hostname with HTTP prefix
|
|
98
|
+
* @param context - Info context with IP info
|
|
99
|
+
* @returns Domain with http:// prefix or empty string
|
|
100
|
+
* @example "http://example.com", "http://host-203-0-113-42.example.net"
|
|
101
|
+
*/
|
|
102
|
+
declare function domain(context: InfoContext): Promise<string>;
|
|
103
|
+
|
|
23
104
|
/**
|
|
24
105
|
* Get all system information as a clean JSON object
|
|
25
|
-
* @param options Configuration options
|
|
26
|
-
* @returns Promise resolving to SystemInfo object
|
|
27
106
|
*/
|
|
28
107
|
export declare function getSystemInfo(options?: SystemInfoOptions): Promise<SystemInfo>;
|
|
29
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Gets graphics card model name
|
|
111
|
+
* Extracts GPU info from lspci (Linux) or WMI (Windows)
|
|
112
|
+
* Filters out basic/generic display adapters
|
|
113
|
+
* @param context - Info context with cache
|
|
114
|
+
* @returns GPU model string or empty string
|
|
115
|
+
* @example "NVIDIA GeForce RTX 4070", "AMD Radeon RX 6800 XT"
|
|
116
|
+
*/
|
|
117
|
+
declare function gpu(context: InfoContext): string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Gets the system hostname
|
|
121
|
+
* @returns Computer hostname/network name
|
|
122
|
+
*/
|
|
123
|
+
declare function hostname(): string;
|
|
124
|
+
|
|
30
125
|
/**
|
|
31
126
|
* Context object passed to info collection functions
|
|
32
127
|
* @interface InfoContext
|
|
@@ -39,196 +134,53 @@ declare interface InfoContext {
|
|
|
39
134
|
}
|
|
40
135
|
|
|
41
136
|
/**
|
|
42
|
-
* System information collection functions
|
|
43
|
-
* Each function returns a clean string value without formatting
|
|
44
|
-
* @namespace infoFunctions
|
|
137
|
+
* System information collection functions map
|
|
45
138
|
*/
|
|
46
139
|
export declare const infoFunctions: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
city(context: InfoContext): Promise<string>;
|
|
78
|
-
/**
|
|
79
|
-
* Gets reverse DNS hostname with HTTP prefix
|
|
80
|
-
* @param context - Info context with IP info
|
|
81
|
-
* @returns Domain with http:// prefix or empty string
|
|
82
|
-
* @example "http://example.com", "http://host-203-0-113-42.example.net"
|
|
83
|
-
*/
|
|
84
|
-
domain(context: InfoContext): Promise<string>;
|
|
85
|
-
/**
|
|
86
|
-
* Gets Internet Service Provider name
|
|
87
|
-
* Strips AS number prefix from organization string
|
|
88
|
-
* @param context - Info context with IP info
|
|
89
|
-
* @returns ISP name or empty string
|
|
90
|
-
* @example "Comcast Cable", "Verizon Business", "Cloudflare Inc"
|
|
91
|
-
*/
|
|
92
|
-
isp(context: InfoContext): Promise<string>;
|
|
93
|
-
/**
|
|
94
|
-
* Gets operating system name and version
|
|
95
|
-
* Platform-specific detection for Windows, macOS, and Linux
|
|
96
|
-
* @param context - Info context with cache
|
|
97
|
-
* @returns OS name and version string
|
|
98
|
-
* @example "Windows 11 Pro", "macOS Ventura 13.2.1", "Ubuntu 22.04.3 LTS"
|
|
99
|
-
*/
|
|
100
|
-
os(context: InfoContext): string;
|
|
101
|
-
/**
|
|
102
|
-
* Gets CPU model name and specifications
|
|
103
|
-
* Uses platform-specific commands (wmic/lscpu/cpuinfo)
|
|
104
|
-
* Automatically strips "with Radeon Graphics" and similar suffixes
|
|
105
|
-
* @param context - Info context with cache
|
|
106
|
-
* @returns CPU model string or empty string
|
|
107
|
-
* @example "Intel Core i7-12700K", "AMD Ryzen 9 5900HX", "Apple M2 Pro"
|
|
108
|
-
*/
|
|
109
|
-
cpu(context: InfoContext): string;
|
|
110
|
-
/**
|
|
111
|
-
* Gets graphics card model name
|
|
112
|
-
* Extracts GPU info from lspci (Linux) or WMI (Windows)
|
|
113
|
-
* Filters out basic/generic display adapters
|
|
114
|
-
* @param context - Info context with cache
|
|
115
|
-
* @returns GPU model string or empty string
|
|
116
|
-
* @example "NVIDIA GeForce RTX 4070", "AMD Radeon RX 6800 XT"
|
|
117
|
-
*/
|
|
118
|
-
gpu(context: InfoContext): string;
|
|
119
|
-
/**
|
|
120
|
-
* Gets root filesystem disk usage percentage
|
|
121
|
-
* Uses df command on Linux/Android
|
|
122
|
-
* @param context - Info context with cache
|
|
123
|
-
* @returns Percentage string or empty string
|
|
124
|
-
* @example "45%", "78%"
|
|
125
|
-
*/
|
|
126
|
-
disk_used(context: InfoContext): string;
|
|
127
|
-
/**
|
|
128
|
-
* Gets memory usage in gigabytes
|
|
129
|
-
* Reads from /proc/meminfo on Linux, falls back to os.totalmem()
|
|
130
|
-
* @param context - Info context with cache
|
|
131
|
-
* @returns Memory usage as "used/total GB"
|
|
132
|
-
* @example "12/32GB", "6/16GB"
|
|
133
|
-
*/
|
|
134
|
-
ram_used(context: InfoContext): string;
|
|
135
|
-
/**
|
|
136
|
-
* Gets the highest CPU-consuming process
|
|
137
|
-
* Uses ps command to find top process by CPU usage (Linux only)
|
|
138
|
-
* @param context - Info context with cache
|
|
139
|
-
* @returns Process info as "percentage processname" or empty string
|
|
140
|
-
* @example "8% firefox", "15% chrome", "3% systemd"
|
|
141
|
-
*/
|
|
142
|
-
top_process(context: InfoContext): string;
|
|
143
|
-
/**
|
|
144
|
-
* Gets system uptime since last boot
|
|
145
|
-
* @returns Uptime formatted as "Xd Yh Zm"
|
|
146
|
-
* @example "2d 14h 23m", "0d 3h 45m"
|
|
147
|
-
*/
|
|
148
|
-
uptime(): string;
|
|
149
|
-
/**
|
|
150
|
-
* Gets device or computer model name
|
|
151
|
-
* Uses WMI on Windows, DMI on Linux, getprop on Android
|
|
152
|
-
* @param context - Info context with cache
|
|
153
|
-
* @returns Device model name or empty string
|
|
154
|
-
* @example "Dell OptiPlex 7090", "MacBook Pro 16-inch", "Valve Steam Deck"
|
|
155
|
-
*/
|
|
156
|
-
device(context: InfoContext): string;
|
|
157
|
-
/**
|
|
158
|
-
* Gets kernel version string
|
|
159
|
-
* Returns the operating system kernel version from os.release()
|
|
160
|
-
* @param context - Info context with cache
|
|
161
|
-
* @returns Kernel version string
|
|
162
|
-
* @example "5.15.0-56-generic", "6.11.11-valve12-1-neptune"
|
|
163
|
-
*/
|
|
164
|
-
kernel(context: InfoContext): string;
|
|
165
|
-
/**
|
|
166
|
-
* Gets the current shell name
|
|
167
|
-
* Uses ps command to find parent process shell (Linux/Unix only)
|
|
168
|
-
* @returns Shell name or empty string on Windows
|
|
169
|
-
* @example "bash", "zsh", "fish", "nu"
|
|
170
|
-
*/
|
|
171
|
-
shell(): string;
|
|
172
|
-
/**
|
|
173
|
-
* Gets available package managers and development tools
|
|
174
|
-
* Checks for package managers (apt, yum, npm, etc.) and editors (nvim, hx)
|
|
175
|
-
* @param context - Info context with cache
|
|
176
|
-
* @returns Space-separated list of available commands
|
|
177
|
-
* @example "apt npm docker nvim", "yay pacman bun hx"
|
|
178
|
-
*/
|
|
179
|
-
pacman(context: InfoContext): string;
|
|
180
|
-
/**
|
|
181
|
-
* Gets open TCP ports with service names
|
|
182
|
-
* Uses lsof to find listening TCP ports (Linux only)
|
|
183
|
-
* @param context - Info context with cache
|
|
184
|
-
* @returns Space-separated port+process pairs or empty string
|
|
185
|
-
* @example "80http 443http 22ssh", "3000node 5432post"
|
|
186
|
-
*/
|
|
187
|
-
ports(context: InfoContext): string;
|
|
188
|
-
/**
|
|
189
|
-
* Gets running Docker container names
|
|
190
|
-
* Lists active Docker containers with their names
|
|
191
|
-
* @param context - Info context with cache
|
|
192
|
-
* @returns Space-separated container names or empty string
|
|
193
|
-
* @example "nginx redis postgres", "web-app db-server"
|
|
194
|
-
*/
|
|
195
|
-
containers(context: InfoContext): string;
|
|
196
|
-
/**
|
|
197
|
-
* Gets available memory in gigabytes
|
|
198
|
-
* Reads MemAvailable from /proc/meminfo (Linux only)
|
|
199
|
-
* @returns Available memory with "GB available" suffix or empty string
|
|
200
|
-
* @example "12GB available", "4GB available"
|
|
201
|
-
*/
|
|
202
|
-
memory_available(): string;
|
|
203
|
-
/**
|
|
204
|
-
* Gets swap memory usage
|
|
205
|
-
* Calculates swap usage from /proc/meminfo (Linux only)
|
|
206
|
-
* @returns Swap usage as "percentage (size MB) swap" or empty string
|
|
207
|
-
* @example "15% (512MB) swap", "0% (0MB) swap"
|
|
208
|
-
*/
|
|
209
|
-
swap_used(): string;
|
|
210
|
-
/**
|
|
211
|
-
* Gets system load averages
|
|
212
|
-
* Reads 1, 5, and 15 minute load averages from /proc/loadavg (Linux only)
|
|
213
|
-
* @returns Space-separated load averages (1m 5m 15m) or empty string
|
|
214
|
-
* @example "0.52 0.58 0.59", "2.10 1.95 1.88"
|
|
215
|
-
*/
|
|
216
|
-
load_average(): string;
|
|
217
|
-
/**
|
|
218
|
-
* Gets number of logged in users
|
|
219
|
-
* Uses who command to count active user sessions (Linux only)
|
|
220
|
-
* @returns User count with "users" suffix or empty string
|
|
221
|
-
* @example "3 users", "1 users"
|
|
222
|
-
*/
|
|
223
|
-
users_logged_in(): string;
|
|
224
|
-
network_interfaces(context: InfoContext): string;
|
|
225
|
-
mount_points(context: InfoContext): string;
|
|
226
|
-
services_running(context: InfoContext): string;
|
|
227
|
-
temperature(context: InfoContext): string;
|
|
228
|
-
battery(context: InfoContext): string;
|
|
229
|
-
screen_resolution(): string;
|
|
140
|
+
user: typeof user;
|
|
141
|
+
hostname: typeof hostname;
|
|
142
|
+
ip: typeof ip;
|
|
143
|
+
iplocal: typeof iplocal;
|
|
144
|
+
city: typeof city;
|
|
145
|
+
domain: typeof domain;
|
|
146
|
+
isp: typeof isp;
|
|
147
|
+
os: typeof os_info;
|
|
148
|
+
cpu: typeof cpu;
|
|
149
|
+
gpu: typeof gpu;
|
|
150
|
+
disk_used: typeof disk_used;
|
|
151
|
+
ram_used: typeof ram_used;
|
|
152
|
+
top_process: typeof top_process;
|
|
153
|
+
uptime: typeof uptime;
|
|
154
|
+
device: typeof device;
|
|
155
|
+
kernel: typeof kernel;
|
|
156
|
+
shell: typeof shell;
|
|
157
|
+
pacman: typeof packages;
|
|
158
|
+
ports: typeof ports;
|
|
159
|
+
containers: typeof containers;
|
|
160
|
+
memory_available: typeof memory_available;
|
|
161
|
+
swap_used: typeof swap_used;
|
|
162
|
+
load_average: typeof load_average;
|
|
163
|
+
users_logged_in: typeof users_logged_in;
|
|
164
|
+
network_interfaces: typeof network_interfaces;
|
|
165
|
+
mount_points: typeof mount_points;
|
|
166
|
+
services_running: typeof services_running;
|
|
167
|
+
temperature: typeof temperature;
|
|
168
|
+
battery: typeof battery;
|
|
169
|
+
screen_resolution: typeof screen_resolution;
|
|
230
170
|
};
|
|
231
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Gets public IP address from ipinfo.io
|
|
174
|
+
* @param context - Info context with cache and IP info
|
|
175
|
+
* @returns Public IPv4 address or empty string
|
|
176
|
+
* @example "203.0.113.42"
|
|
177
|
+
*/
|
|
178
|
+
declare function ip(context: InfoContext): Promise<string>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Network utilities for IP information fetching
|
|
182
|
+
* @module network
|
|
183
|
+
*/
|
|
232
184
|
/**
|
|
233
185
|
* IP information from ipinfo.io API
|
|
234
186
|
* @interface IPInfo
|
|
@@ -244,16 +196,183 @@ declare interface IPInfo {
|
|
|
244
196
|
org?: string;
|
|
245
197
|
}
|
|
246
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Gets local/private IP address(es)
|
|
201
|
+
* Tries ifconfig and ip commands on Linux, falls back to Node.js API
|
|
202
|
+
* @returns Space-separated local IP addresses (RFC 1918 ranges)
|
|
203
|
+
* @example "192.168.1.100" or "10.0.0.50 192.168.1.100"
|
|
204
|
+
*/
|
|
205
|
+
declare function iplocal(): string;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Gets Internet Service Provider name
|
|
209
|
+
* Strips AS number prefix from organization string
|
|
210
|
+
* @param context - Info context with IP info
|
|
211
|
+
* @returns ISP name or empty string
|
|
212
|
+
* @example "Comcast Cable", "Verizon Business", "Cloudflare Inc"
|
|
213
|
+
*/
|
|
214
|
+
declare function isp(context: InfoContext): Promise<string>;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Gets kernel version string
|
|
218
|
+
* Returns the operating system kernel version from os.release()
|
|
219
|
+
* @param context - Info context with cache
|
|
220
|
+
* @returns Kernel version string
|
|
221
|
+
* @example "5.15.0-56-generic", "6.11.11-valve12-1-neptune"
|
|
222
|
+
*/
|
|
223
|
+
declare function kernel(context: InfoContext): string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Gets system load averages
|
|
227
|
+
* Reads 1, 5, and 15 minute load averages from /proc/loadavg (Linux only)
|
|
228
|
+
* @returns Space-separated load averages (1m 5m 15m) or empty string
|
|
229
|
+
* @example "0.52 0.58 0.59", "2.10 1.95 1.88"
|
|
230
|
+
*/
|
|
231
|
+
declare function load_average(context: InfoContext): string;
|
|
232
|
+
|
|
247
233
|
/**
|
|
248
234
|
* Loads cache from disk
|
|
249
|
-
* @returns {Cache} Cached data or empty object if cache doesn't exist or is corrupted
|
|
250
235
|
*/
|
|
251
|
-
export declare function loadCache():
|
|
236
|
+
export declare function loadCache(): Cache_2;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Gets available memory in gigabytes
|
|
240
|
+
* Reads MemAvailable from /proc/meminfo (Linux only)
|
|
241
|
+
* @returns Available memory with "GB available" suffix or empty string
|
|
242
|
+
* @example "12GB available", "4GB available"
|
|
243
|
+
*/
|
|
244
|
+
declare function memory_available(): string;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Gets mounted filesystem information
|
|
248
|
+
* Lists non-system mount points with usage from df (Linux only)
|
|
249
|
+
* Excludes /, /dev, /proc, and /sys mounts
|
|
250
|
+
* @param context - Info context with cache
|
|
251
|
+
* @returns Space-separated mount points with usage or empty string
|
|
252
|
+
* @example "/home(45%) /mnt/data(78%)", "/media/usb(12%)"
|
|
253
|
+
*/
|
|
254
|
+
declare function mount_points(context: InfoContext): string;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Gets active network interface names
|
|
258
|
+
* Lists non-loopback interfaces with IPv4 addresses (Linux only)
|
|
259
|
+
* @param context - Info context with cache
|
|
260
|
+
* @returns Space-separated interface names or empty string
|
|
261
|
+
* @example "eth0 wlan0", "enp0s3"
|
|
262
|
+
*/
|
|
263
|
+
declare function network_interfaces(context: InfoContext): string;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Gets operating system name and version
|
|
267
|
+
* Platform-specific detection for Windows, macOS, and Linux
|
|
268
|
+
* @param context - Info context with cache
|
|
269
|
+
* @returns OS name and version string
|
|
270
|
+
* @example "Windows 11 Pro", "macOS Ventura 13.2.1", "Ubuntu 22.04.3 LTS"
|
|
271
|
+
*/
|
|
272
|
+
declare function os_info(context: InfoContext): string;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Gets available package managers and development tools
|
|
276
|
+
* Checks for package managers (apt, yum, npm, etc.) and editors (nvim, hx)
|
|
277
|
+
* @param context - Info context with cache
|
|
278
|
+
* @returns Space-separated list of available commands
|
|
279
|
+
* @example "apt npm docker nvim", "yay pacman bun hx"
|
|
280
|
+
*/
|
|
281
|
+
declare function packages(context: InfoContext): string;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Gets open TCP ports with service names
|
|
285
|
+
* Uses lsof to find listening TCP ports (Linux only)
|
|
286
|
+
* @param context - Info context with cache
|
|
287
|
+
* @returns Space-separated port+process pairs or empty string
|
|
288
|
+
* @example "80http 443http 22ssh", "3000node 5432post"
|
|
289
|
+
*/
|
|
290
|
+
declare function ports(context: InfoContext): string;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Gets memory usage in gigabytes
|
|
294
|
+
* Reads from /proc/meminfo on Linux, falls back to os.totalmem()
|
|
295
|
+
* @param context - Info context with cache
|
|
296
|
+
* @returns Memory usage as "used/total GB"
|
|
297
|
+
* @example "12/32GB", "6/16GB"
|
|
298
|
+
*/
|
|
299
|
+
declare function ram_used(context: InfoContext): string;
|
|
252
300
|
|
|
253
301
|
/**
|
|
254
302
|
* Saves cache to disk
|
|
255
|
-
* @param {Cache} cache - Cache object to save
|
|
256
303
|
*/
|
|
257
|
-
export declare function saveCache(cache:
|
|
304
|
+
export declare function saveCache(cache: Cache_2): void;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Gets screen resolution from X11 display
|
|
308
|
+
* Uses xrandr command (Linux with X11/Xorg only)
|
|
309
|
+
* @returns Resolution in WIDTHxHEIGHT format or empty string
|
|
310
|
+
* @example "1920x1080", "2560x1440", "3840x2160"
|
|
311
|
+
*/
|
|
312
|
+
declare function screen_resolution(): string;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Gets count of running system services
|
|
316
|
+
* Uses systemctl or service command (Linux only)
|
|
317
|
+
* @param context - Info context with cache
|
|
318
|
+
* @returns Service count with "services" suffix or empty string
|
|
319
|
+
* @example "125 services", "89 services"
|
|
320
|
+
*/
|
|
321
|
+
declare function services_running(context: InfoContext): string;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Gets the current shell name
|
|
325
|
+
* Uses ps command to find parent process shell (Linux/Unix only)
|
|
326
|
+
* @returns Shell name or empty string on Windows
|
|
327
|
+
* @example "bash", "zsh", "fish", "nu"
|
|
328
|
+
*/
|
|
329
|
+
declare function shell(context: InfoContext): string;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Gets swap memory usage
|
|
333
|
+
* Calculates swap usage from /proc/meminfo (Linux only)
|
|
334
|
+
* @returns Swap usage as "percentage (size MB) swap" or empty string
|
|
335
|
+
* @example "15% (512MB) swap", "0% (0MB) swap"
|
|
336
|
+
*/
|
|
337
|
+
declare function swap_used(): string;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Gets system temperature in Celsius
|
|
341
|
+
* Reads from thermal zone or hwmon sensors (Linux only)
|
|
342
|
+
* @param context - Info context with cache
|
|
343
|
+
* @returns Temperature with °C suffix or empty string
|
|
344
|
+
* @example "45°C", "62°C"
|
|
345
|
+
*/
|
|
346
|
+
declare function temperature(context: InfoContext): string;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Gets the highest CPU-consuming process
|
|
350
|
+
* Uses ps command to find top process by CPU usage (Linux only)
|
|
351
|
+
* @param context - Info context with cache
|
|
352
|
+
* @returns Process info as "percentage processname" or empty string
|
|
353
|
+
* @example "8% firefox", "15% chrome", "3% systemd"
|
|
354
|
+
*/
|
|
355
|
+
declare function top_process(context: InfoContext): string;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Gets system uptime since last boot
|
|
359
|
+
* @returns Uptime formatted as "Xd Yh Zm"
|
|
360
|
+
* @example "2d 14h 23m", "0d 3h 45m"
|
|
361
|
+
*/
|
|
362
|
+
declare function uptime(): string;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Gets the current username
|
|
366
|
+
* @returns Current system username
|
|
367
|
+
*/
|
|
368
|
+
declare function user(): string;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Gets number of logged in users
|
|
372
|
+
* Uses who command to count active user sessions (Linux only)
|
|
373
|
+
* @returns User count with "users" suffix or empty string
|
|
374
|
+
* @example "3 users", "1 users"
|
|
375
|
+
*/
|
|
376
|
+
declare function users_logged_in(): string;
|
|
258
377
|
|
|
259
378
|
export { }
|