about-system 0.0.16 → 0.0.18

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,259 @@
1
+ import { SystemInfo } from './systeminfo-types.js';
2
+ import { SystemInfoOptions } from './systeminfo-types.js';
3
+
4
+ /**
5
+ * Cache storage structure
6
+ * @interface Cache
7
+ */
8
+ declare interface Cache {
9
+ [key: string]: CacheEntry;
10
+ }
11
+
12
+ /**
13
+ * Represents a cached value with timestamp
14
+ * @interface CacheEntry
15
+ */
16
+ declare interface CacheEntry {
17
+ /** The cached value */
18
+ value: any;
19
+ /** Unix timestamp when the value was cached */
20
+ timestamp: number;
21
+ }
22
+
23
+ /**
24
+ * Get all system information as a clean JSON object
25
+ * @param options Configuration options
26
+ * @returns Promise resolving to SystemInfo object
27
+ */
28
+ export declare function getSystemInfo(options?: SystemInfoOptions): Promise<SystemInfo>;
29
+
30
+ /**
31
+ * Context object passed to info collection functions
32
+ * @interface InfoContext
33
+ */
34
+ declare interface InfoContext {
35
+ /** Cache storage */
36
+ cache: Cache;
37
+ /** IP information from external API */
38
+ ipInfo?: IPInfo;
39
+ }
40
+
41
+ /**
42
+ * System information collection functions
43
+ * Each function returns a clean string value without formatting
44
+ * @namespace infoFunctions
45
+ */
46
+ export declare const infoFunctions: {
47
+ /**
48
+ * Gets the current username
49
+ * @returns Current system username
50
+ */
51
+ user(): string;
52
+ /**
53
+ * Gets the system hostname
54
+ * @returns Computer hostname/network name
55
+ */
56
+ hostname(): string;
57
+ /**
58
+ * Gets public IP address from ipinfo.io
59
+ * @param context - Info context with cache and IP info
60
+ * @returns Public IPv4 address or empty string
61
+ * @example "203.0.113.42"
62
+ */
63
+ ip(context: InfoContext): Promise<string>;
64
+ /**
65
+ * Gets local/private IP address(es)
66
+ * Tries ifconfig and ip commands on Linux, falls back to Node.js API
67
+ * @returns Space-separated local IP addresses (RFC 1918 ranges)
68
+ * @example "192.168.1.100" or "10.0.0.50 192.168.1.100"
69
+ */
70
+ iplocal(): string;
71
+ /**
72
+ * Gets geographic city based on public IP
73
+ * @param context - Info context with IP geolocation data
74
+ * @returns City name or empty string
75
+ * @example "San Francisco", "New York", "London"
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;
230
+ };
231
+
232
+ /**
233
+ * IP information from ipinfo.io API
234
+ * @interface IPInfo
235
+ */
236
+ declare interface IPInfo {
237
+ /** Public IP address */
238
+ ip?: string;
239
+ /** City location */
240
+ city?: string;
241
+ /** Reverse DNS hostname */
242
+ hostname?: string;
243
+ /** ISP organization string (includes AS number) */
244
+ org?: string;
245
+ }
246
+
247
+ /**
248
+ * Loads cache from disk
249
+ * @returns {Cache} Cached data or empty object if cache doesn't exist or is corrupted
250
+ */
251
+ export declare function loadCache(): Cache;
252
+
253
+ /**
254
+ * Saves cache to disk
255
+ * @param {Cache} cache - Cache object to save
256
+ */
257
+ export declare function saveCache(cache: Cache): void;
258
+
259
+ export { }