about-system 0.0.18 → 0.0.19
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 +128 -67
- 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/system-info-api-Bc0iSNdN.js +837 -0
- package/dist/system-info-api-Bc0iSNdN.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 +4 -4
- 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/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/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
package/README.md
CHANGED
|
@@ -4,25 +4,26 @@ A TypeScript/Node.js library to display comprehensive system information with cu
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 📊 **Comprehensive**: 30+ system metrics including CPU, GPU, network, containers, and more
|
|
8
|
+
- 🌍 **Cross-platform**: Works on Linux, macOS, and Windows, and Android
|
|
8
9
|
- 🎨 **Customizable**: Configure colors, emojis, and display order
|
|
9
10
|
- 🔌 **Two Modes**: Use as CLI tool or import as API
|
|
10
|
-
-
|
|
11
|
-
- 📊 **Comprehensive**: 30+ system metrics including CPU, GPU, network, containers, and more
|
|
11
|
+
- 🚀 **Cached**: Intelligent caching system for quick repeated access
|
|
12
12
|
- 💾 **TypeScript**: Full type definitions included
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
|
|
17
|
+
npx about-system
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
21
|
+
npm install -g about-system
|
|
22
|
+
about-system
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
|
-
|
|
26
|
+
bun x about-system
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
## Examples
|
|
@@ -70,6 +71,8 @@ about-system --settings-reset
|
|
|
70
71
|
# Set specific configuration values
|
|
71
72
|
about-system --set display.show_emojis false
|
|
72
73
|
about-system --set colors.user blue
|
|
74
|
+
about-system --set emojis.cpu "🚀 "
|
|
75
|
+
about-system --set labels.cpu "Processor"
|
|
73
76
|
|
|
74
77
|
# Clear cache
|
|
75
78
|
about-system --refresh
|
|
@@ -80,17 +83,17 @@ about-system --refresh
|
|
|
80
83
|
### Basic Example
|
|
81
84
|
|
|
82
85
|
```typescript
|
|
83
|
-
import { getSystemInfo } from
|
|
86
|
+
import { getSystemInfo } from "about-system";
|
|
84
87
|
|
|
85
88
|
// Get all system information as JSON
|
|
86
89
|
const info = await getSystemInfo();
|
|
87
90
|
|
|
88
|
-
console.log(info.user);
|
|
89
|
-
console.log(info.hostname);
|
|
90
|
-
console.log(info.os);
|
|
91
|
-
console.log(info.cpu);
|
|
92
|
-
console.log(info.ram_used);
|
|
93
|
-
console.log(info.disk_used);
|
|
91
|
+
console.log(info.user); // Current username
|
|
92
|
+
console.log(info.hostname); // Computer hostname
|
|
93
|
+
console.log(info.os); // Operating system
|
|
94
|
+
console.log(info.cpu); // CPU model
|
|
95
|
+
console.log(info.ram_used); // RAM usage (e.g., "8/16GB")
|
|
96
|
+
console.log(info.disk_used); // Disk usage (e.g., "45%")
|
|
94
97
|
```
|
|
95
98
|
|
|
96
99
|
### Using Individual Info Functions
|
|
@@ -98,7 +101,7 @@ console.log(info.disk_used); // Disk usage (e.g., "45%")
|
|
|
98
101
|
You can import and use individual system info functions:
|
|
99
102
|
|
|
100
103
|
```typescript
|
|
101
|
-
import { infoFunctions } from
|
|
104
|
+
import { infoFunctions } from "about-system/api";
|
|
102
105
|
|
|
103
106
|
// Create a context with cache
|
|
104
107
|
const cache = {};
|
|
@@ -123,16 +126,16 @@ async function getBasicInfo() {
|
|
|
123
126
|
|
|
124
127
|
```typescript
|
|
125
128
|
// Default import (complete API)
|
|
126
|
-
import { getSystemInfo } from
|
|
129
|
+
import { getSystemInfo } from "about-system";
|
|
127
130
|
|
|
128
131
|
// Direct API import with individual functions
|
|
129
|
-
import { getSystemInfo, infoFunctions } from
|
|
132
|
+
import { getSystemInfo, infoFunctions } from "about-system/api";
|
|
130
133
|
|
|
131
134
|
// CLI functions
|
|
132
|
-
import { displaySystemInfo } from
|
|
135
|
+
import { displaySystemInfo } from "about-system/cli";
|
|
133
136
|
|
|
134
137
|
// Types only
|
|
135
|
-
import type { SystemInfo, Platform } from
|
|
138
|
+
import type { SystemInfo, Platform } from "about-system/types";
|
|
136
139
|
```
|
|
137
140
|
|
|
138
141
|
### All Available Fields
|
|
@@ -142,38 +145,38 @@ See the [systeminfo-types.d.ts](src/systeminfo-types.d.ts) file for complete Typ
|
|
|
142
145
|
```typescript
|
|
143
146
|
interface SystemInfo {
|
|
144
147
|
// System Identity
|
|
145
|
-
timestamp: string;
|
|
146
|
-
hostname: string;
|
|
147
|
-
user: string;
|
|
148
|
-
platform:
|
|
148
|
+
timestamp: string; // ISO 8601 timestamp
|
|
149
|
+
hostname: string; // Computer hostname
|
|
150
|
+
user: string; // Current username
|
|
151
|
+
platform: "linux" | "windows" | "macos" | "unknown";
|
|
149
152
|
|
|
150
153
|
// Operating System
|
|
151
|
-
os: string;
|
|
152
|
-
kernel: string;
|
|
153
|
-
shell: string;
|
|
154
|
+
os: string; // OS name and version
|
|
155
|
+
kernel: string; // Kernel version
|
|
156
|
+
shell: string; // Shell program (Linux/Unix)
|
|
154
157
|
|
|
155
158
|
// Hardware
|
|
156
|
-
cpu: string;
|
|
157
|
-
gpu: string;
|
|
158
|
-
device: string;
|
|
159
|
+
cpu: string; // CPU model
|
|
160
|
+
gpu: string; // GPU model
|
|
161
|
+
device: string; // Device/computer model
|
|
159
162
|
|
|
160
163
|
// Real-time Resources
|
|
161
|
-
disk_used: string;
|
|
162
|
-
ram_used: string;
|
|
163
|
-
top_process: string;
|
|
164
|
-
uptime: string;
|
|
164
|
+
disk_used: string; // Disk usage percentage
|
|
165
|
+
ram_used: string; // RAM usage (used/total GB)
|
|
166
|
+
top_process: string; // Top CPU-consuming process
|
|
167
|
+
uptime: string; // System uptime (Xd Yh Zm)
|
|
165
168
|
|
|
166
169
|
// Network
|
|
167
|
-
ip: string;
|
|
168
|
-
iplocal: string;
|
|
169
|
-
city: string;
|
|
170
|
-
isp: string;
|
|
170
|
+
ip: string; // Public IP address
|
|
171
|
+
iplocal: string; // Local IP address(es)
|
|
172
|
+
city: string; // Geographic location
|
|
173
|
+
isp: string; // Internet service provider
|
|
171
174
|
|
|
172
175
|
// Linux-specific
|
|
173
|
-
temperature: string;
|
|
174
|
-
battery: string;
|
|
175
|
-
load_average: string;
|
|
176
|
-
services_running: string;
|
|
176
|
+
temperature: string; // System temperature
|
|
177
|
+
battery: string; // Battery percentage
|
|
178
|
+
load_average: string; // System load
|
|
179
|
+
services_running: string; // Active services count
|
|
177
180
|
|
|
178
181
|
// And 20+ more fields...
|
|
179
182
|
}
|
|
@@ -184,7 +187,7 @@ interface SystemInfo {
|
|
|
184
187
|
See [examples/api-usage.js](examples/api-usage.js) for more examples.
|
|
185
188
|
|
|
186
189
|
```typescript
|
|
187
|
-
import { getSystemInfo } from
|
|
190
|
+
import { getSystemInfo } from "about-system";
|
|
188
191
|
|
|
189
192
|
// Example: Monitor system resources
|
|
190
193
|
async function monitorResources() {
|
|
@@ -195,12 +198,12 @@ async function monitorResources() {
|
|
|
195
198
|
ram: info.ram_used,
|
|
196
199
|
disk: info.disk_used,
|
|
197
200
|
temperature: info.temperature,
|
|
198
|
-
topProcess: info.top_process
|
|
201
|
+
topProcess: info.top_process,
|
|
199
202
|
};
|
|
200
203
|
}
|
|
201
204
|
|
|
202
205
|
// Example: Create custom dashboard
|
|
203
|
-
import { infoFunctions } from
|
|
206
|
+
import { infoFunctions } from "about-system/api";
|
|
204
207
|
|
|
205
208
|
async function getDashboardData(context) {
|
|
206
209
|
return {
|
|
@@ -217,7 +220,7 @@ async function getDashboardData(context) {
|
|
|
217
220
|
network: {
|
|
218
221
|
localIP: infoFunctions.iplocal(),
|
|
219
222
|
publicIP: await infoFunctions.ip(context),
|
|
220
|
-
}
|
|
223
|
+
},
|
|
221
224
|
};
|
|
222
225
|
}
|
|
223
226
|
```
|
|
@@ -266,6 +269,8 @@ about-system --settings-reset
|
|
|
266
269
|
# Set individual values
|
|
267
270
|
about-system --set display.show_emojis false
|
|
268
271
|
about-system --set colors.user blue
|
|
272
|
+
about-system --set emojis.cpu "🚀 "
|
|
273
|
+
about-system --set labels.hostname "Computer"
|
|
269
274
|
about-system --set cache.enabled true
|
|
270
275
|
|
|
271
276
|
# Clear cache
|
|
@@ -278,15 +283,17 @@ about-system --cache-clear
|
|
|
278
283
|
{
|
|
279
284
|
"version": "1.0.0",
|
|
280
285
|
"display_order": [
|
|
281
|
-
"user",
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
["user", "hostname", "os", "device", "kernel", "cpu", "gpu"],
|
|
287
|
+
[
|
|
288
|
+
"disk_used",
|
|
289
|
+
"ram_used",
|
|
290
|
+
"top_process",
|
|
291
|
+
"uptime",
|
|
292
|
+
"temperature",
|
|
293
|
+
"battery"
|
|
294
|
+
],
|
|
295
|
+
["ip", "iplocal", "city", "domain", "isp"],
|
|
296
|
+
["shell", "pacman", "services_running", "containers"]
|
|
290
297
|
],
|
|
291
298
|
"colors": {
|
|
292
299
|
"user": "red",
|
|
@@ -299,26 +306,78 @@ about-system --cache-clear
|
|
|
299
306
|
"cpu": "orange",
|
|
300
307
|
"shell": "orange"
|
|
301
308
|
},
|
|
309
|
+
"emojis": {
|
|
310
|
+
"user": "👤 ",
|
|
311
|
+
"hostname": "🏠 ",
|
|
312
|
+
"cpu": "📈 ",
|
|
313
|
+
"gpu": "🎮 ",
|
|
314
|
+
"disk_used": "📁 ",
|
|
315
|
+
"ram_used": "💾 ",
|
|
316
|
+
"ip": "🌎 ",
|
|
317
|
+
"shell": "🐚 "
|
|
318
|
+
},
|
|
319
|
+
"labels": {
|
|
320
|
+
"user": "User",
|
|
321
|
+
"hostname": "Host",
|
|
322
|
+
"cpu": "CPU",
|
|
323
|
+
"gpu": "GPU",
|
|
324
|
+
"disk_used": "Disk",
|
|
325
|
+
"ram_used": "RAM",
|
|
326
|
+
"ip": "IP",
|
|
327
|
+
"shell": "Shell"
|
|
328
|
+
},
|
|
302
329
|
"display": {
|
|
303
330
|
"show_emojis": true,
|
|
304
|
-
"
|
|
305
|
-
"
|
|
306
|
-
},
|
|
307
|
-
"cache": {
|
|
308
|
-
"enabled": true
|
|
331
|
+
"single_line": false,
|
|
332
|
+
"line_wrap_length": 100
|
|
309
333
|
},
|
|
310
334
|
"network": {
|
|
311
|
-
"timeout": 5000,
|
|
312
335
|
"show_offline_message": true
|
|
336
|
+
},
|
|
337
|
+
"advanced": {
|
|
338
|
+
"debug": false
|
|
313
339
|
}
|
|
314
340
|
}
|
|
315
341
|
```
|
|
316
342
|
|
|
317
|
-
###
|
|
343
|
+
### Customization Options
|
|
344
|
+
|
|
345
|
+
#### Colors
|
|
346
|
+
|
|
347
|
+
Available color options for each info block:
|
|
318
348
|
|
|
319
349
|
- `red`, `orange`, `yellow`, `green`, `blue`, `cyan`, `purple`, `magenta`, `gray`, `lightblue`
|
|
320
350
|
- Use `multicolor` for ports to get a rainbow effect
|
|
321
351
|
|
|
352
|
+
```bash
|
|
353
|
+
about-system --set colors.user blue
|
|
354
|
+
about-system --set colors.hostname green
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
#### Emojis
|
|
358
|
+
|
|
359
|
+
Customize the emoji displayed for each info block. Emojis can be toggled on/off globally with `display.show_emojis` or individually customized:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Toggle emojis on/off
|
|
363
|
+
about-system --set display.show_emojis false
|
|
364
|
+
|
|
365
|
+
# Customize individual emojis
|
|
366
|
+
about-system --set emojis.cpu "🚀 "
|
|
367
|
+
about-system --set emojis.hostname "🖥️ "
|
|
368
|
+
about-system --set emojis.battery "🔋 "
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### Labels
|
|
372
|
+
|
|
373
|
+
Customize the text labels for each info block:
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
about-system --set labels.cpu "Processor"
|
|
377
|
+
about-system --set labels.hostname "Computer"
|
|
378
|
+
about-system --set labels.ram_used "Memory"
|
|
379
|
+
```
|
|
380
|
+
|
|
322
381
|
### Platform-Specific Features
|
|
323
382
|
|
|
324
383
|
#### Windows
|
|
@@ -365,7 +424,7 @@ The `--install` flag automatically configures the script as a shell greeting:
|
|
|
365
424
|
All API functions include comprehensive JSDoc documentation:
|
|
366
425
|
|
|
367
426
|
```typescript
|
|
368
|
-
import { infoFunctions } from
|
|
427
|
+
import { infoFunctions } from "about-system/api";
|
|
369
428
|
|
|
370
429
|
// Hover over any function in your IDE to see:
|
|
371
430
|
// - Function description
|
|
@@ -374,10 +433,11 @@ import { infoFunctions } from 'about-system/api';
|
|
|
374
433
|
// - Usage examples
|
|
375
434
|
// - Platform-specific notes
|
|
376
435
|
|
|
377
|
-
infoFunctions.cpu(context);
|
|
436
|
+
infoFunctions.cpu(context); // IDE shows full documentation
|
|
378
437
|
```
|
|
379
438
|
|
|
380
439
|
**Features:**
|
|
440
|
+
|
|
381
441
|
- ✅ Every function documented with JSDoc
|
|
382
442
|
- ✅ Parameter and return type descriptions
|
|
383
443
|
- ✅ Real-world usage examples
|
|
@@ -387,6 +447,7 @@ infoFunctions.cpu(context); // IDE shows full documentation
|
|
|
387
447
|
### TypeScript Support
|
|
388
448
|
|
|
389
449
|
Full TypeScript definitions with:
|
|
450
|
+
|
|
390
451
|
- Complete `SystemInfo` interface
|
|
391
452
|
- All 30+ field types documented
|
|
392
453
|
- Platform-specific type unions
|
|
@@ -394,11 +455,11 @@ Full TypeScript definitions with:
|
|
|
394
455
|
|
|
395
456
|
```typescript
|
|
396
457
|
import type {
|
|
397
|
-
SystemInfo,
|
|
398
|
-
Platform,
|
|
399
|
-
SystemInfoOptions,
|
|
400
|
-
InfoContext,
|
|
401
|
-
} from
|
|
458
|
+
SystemInfo, // Main info object
|
|
459
|
+
Platform, // Platform type
|
|
460
|
+
SystemInfoOptions, // Config options
|
|
461
|
+
InfoContext, // Context for functions
|
|
462
|
+
} from "about-system/types";
|
|
402
463
|
```
|
|
403
464
|
|
|
404
465
|
## Project Structure
|