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
package/README.md
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://i.imgur.com/1kwKBTR.png" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# About System Info
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A TypeScript/Node.js library to display comprehensive system information with customizable output.
|
|
6
8
|
|
|
7
|
-
-
|
|
9
|
+
- 📊 **Comprehensive**: 30+ system metrics including CPU, GPU, network, containers, and more
|
|
10
|
+
- 🌍 **Cross-platform**: Works on Linux, macOS, and Windows, and Android
|
|
8
11
|
- 🎨 **Customizable**: Configure colors, emojis, and display order
|
|
9
12
|
- 🔌 **Two Modes**: Use as CLI tool or import as API
|
|
10
|
-
-
|
|
11
|
-
- 📊 **Comprehensive**: 30+ system metrics including CPU, GPU, network, containers, and more
|
|
13
|
+
- 🚀 **Cached**: Intelligent caching system for quick repeated access
|
|
12
14
|
- 💾 **TypeScript**: Full type definitions included
|
|
13
15
|
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
|
|
19
|
+
npx about-system
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
|
-
|
|
23
|
+
npm install -g about-system
|
|
24
|
+
about-system
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
```bash
|
|
25
|
-
|
|
28
|
+
bun x about-system
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
## Examples
|
|
@@ -70,6 +73,8 @@ about-system --settings-reset
|
|
|
70
73
|
# Set specific configuration values
|
|
71
74
|
about-system --set display.show_emojis false
|
|
72
75
|
about-system --set colors.user blue
|
|
76
|
+
about-system --set emojis.cpu "🚀 "
|
|
77
|
+
about-system --set labels.cpu "Processor"
|
|
73
78
|
|
|
74
79
|
# Clear cache
|
|
75
80
|
about-system --refresh
|
|
@@ -77,28 +82,10 @@ about-system --refresh
|
|
|
77
82
|
|
|
78
83
|
## API Usage
|
|
79
84
|
|
|
80
|
-
### Basic Example
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
import { getSystemInfo } from 'about-system';
|
|
84
|
-
|
|
85
|
-
// Get all system information as JSON
|
|
86
|
-
const info = await getSystemInfo();
|
|
87
|
-
|
|
88
|
-
console.log(info.user); // Current username
|
|
89
|
-
console.log(info.hostname); // Computer hostname
|
|
90
|
-
console.log(info.os); // Operating system
|
|
91
|
-
console.log(info.cpu); // CPU model
|
|
92
|
-
console.log(info.ram_used); // RAM usage (e.g., "8/16GB")
|
|
93
|
-
console.log(info.disk_used); // Disk usage (e.g., "45%")
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Using Individual Info Functions
|
|
97
|
-
|
|
98
85
|
You can import and use individual system info functions:
|
|
99
86
|
|
|
100
87
|
```typescript
|
|
101
|
-
import { infoFunctions } from
|
|
88
|
+
import { infoFunctions, getSystemInfo } from "about-system";
|
|
102
89
|
|
|
103
90
|
// Create a context with cache
|
|
104
91
|
const cache = {};
|
|
@@ -119,113 +106,10 @@ async function getBasicInfo() {
|
|
|
119
106
|
}
|
|
120
107
|
```
|
|
121
108
|
|
|
122
|
-
### Multiple Import Styles
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
// Default import (complete API)
|
|
126
|
-
import { getSystemInfo } from 'about-system';
|
|
127
|
-
|
|
128
|
-
// Direct API import with individual functions
|
|
129
|
-
import { getSystemInfo, infoFunctions } from 'about-system/api';
|
|
130
|
-
|
|
131
|
-
// CLI functions
|
|
132
|
-
import { displaySystemInfo } from 'about-system/cli';
|
|
133
|
-
|
|
134
|
-
// Types only
|
|
135
|
-
import type { SystemInfo, Platform } from 'about-system/types';
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### All Available Fields
|
|
139
|
-
|
|
140
|
-
See the [systeminfo-types.d.ts](src/systeminfo-types.d.ts) file for complete TypeScript definitions with detailed JSDoc comments.
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
interface SystemInfo {
|
|
144
|
-
// System Identity
|
|
145
|
-
timestamp: string; // ISO 8601 timestamp
|
|
146
|
-
hostname: string; // Computer hostname
|
|
147
|
-
user: string; // Current username
|
|
148
|
-
platform: 'linux' | 'windows' | 'macos' | 'unknown';
|
|
149
|
-
|
|
150
|
-
// Operating System
|
|
151
|
-
os: string; // OS name and version
|
|
152
|
-
kernel: string; // Kernel version
|
|
153
|
-
shell: string; // Shell program (Linux/Unix)
|
|
154
|
-
|
|
155
|
-
// Hardware
|
|
156
|
-
cpu: string; // CPU model
|
|
157
|
-
gpu: string; // GPU model
|
|
158
|
-
device: string; // Device/computer model
|
|
159
|
-
|
|
160
|
-
// Real-time Resources
|
|
161
|
-
disk_used: string; // Disk usage percentage
|
|
162
|
-
ram_used: string; // RAM usage (used/total GB)
|
|
163
|
-
top_process: string; // Top CPU-consuming process
|
|
164
|
-
uptime: string; // System uptime (Xd Yh Zm)
|
|
165
|
-
|
|
166
|
-
// Network
|
|
167
|
-
ip: string; // Public IP address
|
|
168
|
-
iplocal: string; // Local IP address(es)
|
|
169
|
-
city: string; // Geographic location
|
|
170
|
-
isp: string; // Internet service provider
|
|
171
|
-
|
|
172
|
-
// Linux-specific
|
|
173
|
-
temperature: string; // System temperature
|
|
174
|
-
battery: string; // Battery percentage
|
|
175
|
-
load_average: string; // System load
|
|
176
|
-
services_running: string; // Active services count
|
|
177
|
-
|
|
178
|
-
// And 20+ more fields...
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Advanced Examples
|
|
183
|
-
|
|
184
|
-
See [examples/api-usage.js](examples/api-usage.js) for more examples.
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
import { getSystemInfo } from 'about-system';
|
|
188
|
-
|
|
189
|
-
// Example: Monitor system resources
|
|
190
|
-
async function monitorResources() {
|
|
191
|
-
const info = await getSystemInfo();
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
cpu: info.cpu,
|
|
195
|
-
ram: info.ram_used,
|
|
196
|
-
disk: info.disk_used,
|
|
197
|
-
temperature: info.temperature,
|
|
198
|
-
topProcess: info.top_process
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Example: Create custom dashboard
|
|
203
|
-
import { infoFunctions } from 'about-system/api';
|
|
204
|
-
|
|
205
|
-
async function getDashboardData(context) {
|
|
206
|
-
return {
|
|
207
|
-
hardware: {
|
|
208
|
-
cpu: infoFunctions.cpu(context),
|
|
209
|
-
gpu: infoFunctions.gpu(context),
|
|
210
|
-
device: infoFunctions.device(context),
|
|
211
|
-
},
|
|
212
|
-
resources: {
|
|
213
|
-
ram: infoFunctions.ram_used(context),
|
|
214
|
-
disk: infoFunctions.disk_used(context),
|
|
215
|
-
uptime: infoFunctions.uptime(),
|
|
216
|
-
},
|
|
217
|
-
network: {
|
|
218
|
-
localIP: infoFunctions.iplocal(),
|
|
219
|
-
publicIP: await infoFunctions.ip(context),
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
109
|
### Available Info Blocks
|
|
226
110
|
|
|
227
|
-
| Block
|
|
228
|
-
|
|
|
111
|
+
| Block | Description | Example Output |
|
|
112
|
+
| --------------- | -------------------------- | ------------------------------ |
|
|
229
113
|
| `user` | Current username | `👤 username` |
|
|
230
114
|
| `hostname` | System hostname | `🏠 hostname` |
|
|
231
115
|
| `ip` | Public IP address | `🌎 192.168.1.1` |
|
|
@@ -239,7 +123,7 @@ async function getDashboardData(context) {
|
|
|
239
123
|
| `disk_used` | Disk usage percentage | `📁 75%` |
|
|
240
124
|
| `ram_used` | Memory usage | `💾 8/16GB` |
|
|
241
125
|
| `top_process` | Highest CPU process | `🔝 15% chrome` |
|
|
242
|
-
| `uptime` | System uptime | `⏱️ 2d 5h 30m`
|
|
126
|
+
| `uptime` | System uptime | `⏱️ 2d 5h 30m` |
|
|
243
127
|
| `device` | Device model | `💻 MacBook Pro` |
|
|
244
128
|
| `kernel` | Kernel version | `🔧 5.15.0-56-generic` |
|
|
245
129
|
| `shell` | Current shell | `🐚 fish` |
|
|
@@ -266,6 +150,8 @@ about-system --settings-reset
|
|
|
266
150
|
# Set individual values
|
|
267
151
|
about-system --set display.show_emojis false
|
|
268
152
|
about-system --set colors.user blue
|
|
153
|
+
about-system --set emojis.cpu "🚀 "
|
|
154
|
+
about-system --set labels.hostname "Computer"
|
|
269
155
|
about-system --set cache.enabled true
|
|
270
156
|
|
|
271
157
|
# Clear cache
|
|
@@ -278,15 +164,17 @@ about-system --cache-clear
|
|
|
278
164
|
{
|
|
279
165
|
"version": "1.0.0",
|
|
280
166
|
"display_order": [
|
|
281
|
-
"user",
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
167
|
+
["user", "hostname", "os", "device", "kernel", "cpu", "gpu"],
|
|
168
|
+
[
|
|
169
|
+
"disk_used",
|
|
170
|
+
"ram_used",
|
|
171
|
+
"top_process",
|
|
172
|
+
"uptime",
|
|
173
|
+
"temperature",
|
|
174
|
+
"battery"
|
|
175
|
+
],
|
|
176
|
+
["ip", "iplocal", "city", "domain", "isp"],
|
|
177
|
+
["shell", "pacman", "services_running", "containers"]
|
|
290
178
|
],
|
|
291
179
|
"colors": {
|
|
292
180
|
"user": "red",
|
|
@@ -299,26 +187,78 @@ about-system --cache-clear
|
|
|
299
187
|
"cpu": "orange",
|
|
300
188
|
"shell": "orange"
|
|
301
189
|
},
|
|
190
|
+
"emojis": {
|
|
191
|
+
"user": "👤 ",
|
|
192
|
+
"hostname": "🏠 ",
|
|
193
|
+
"cpu": "📈 ",
|
|
194
|
+
"gpu": "🎮 ",
|
|
195
|
+
"disk_used": "📁 ",
|
|
196
|
+
"ram_used": "💾 ",
|
|
197
|
+
"ip": "🌎 ",
|
|
198
|
+
"shell": "🐚 "
|
|
199
|
+
},
|
|
200
|
+
"labels": {
|
|
201
|
+
"user": "User",
|
|
202
|
+
"hostname": "Host",
|
|
203
|
+
"cpu": "CPU",
|
|
204
|
+
"gpu": "GPU",
|
|
205
|
+
"disk_used": "Disk",
|
|
206
|
+
"ram_used": "RAM",
|
|
207
|
+
"ip": "IP",
|
|
208
|
+
"shell": "Shell"
|
|
209
|
+
},
|
|
302
210
|
"display": {
|
|
303
211
|
"show_emojis": true,
|
|
304
|
-
"
|
|
305
|
-
"
|
|
306
|
-
},
|
|
307
|
-
"cache": {
|
|
308
|
-
"enabled": true
|
|
212
|
+
"single_line": false,
|
|
213
|
+
"line_wrap_length": 100
|
|
309
214
|
},
|
|
310
215
|
"network": {
|
|
311
|
-
"timeout": 5000,
|
|
312
216
|
"show_offline_message": true
|
|
217
|
+
},
|
|
218
|
+
"advanced": {
|
|
219
|
+
"debug": false
|
|
313
220
|
}
|
|
314
221
|
}
|
|
315
222
|
```
|
|
316
223
|
|
|
317
|
-
###
|
|
224
|
+
### Customization Options
|
|
225
|
+
|
|
226
|
+
#### Colors
|
|
227
|
+
|
|
228
|
+
Available color options for each info block:
|
|
318
229
|
|
|
319
230
|
- `red`, `orange`, `yellow`, `green`, `blue`, `cyan`, `purple`, `magenta`, `gray`, `lightblue`
|
|
320
231
|
- Use `multicolor` for ports to get a rainbow effect
|
|
321
232
|
|
|
233
|
+
```bash
|
|
234
|
+
about-system --set colors.user blue
|
|
235
|
+
about-system --set colors.hostname green
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Emojis
|
|
239
|
+
|
|
240
|
+
Customize the emoji displayed for each info block. Emojis can be toggled on/off globally with `display.show_emojis` or individually customized:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Toggle emojis on/off
|
|
244
|
+
about-system --set display.show_emojis false
|
|
245
|
+
|
|
246
|
+
# Customize individual emojis
|
|
247
|
+
about-system --set emojis.cpu "🚀 "
|
|
248
|
+
about-system --set emojis.hostname "🖥️ "
|
|
249
|
+
about-system --set emojis.battery "🔋 "
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### Labels
|
|
253
|
+
|
|
254
|
+
Customize the text labels for each info block:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
about-system --set labels.cpu "Processor"
|
|
258
|
+
about-system --set labels.hostname "Computer"
|
|
259
|
+
about-system --set labels.ram_used "Memory"
|
|
260
|
+
```
|
|
261
|
+
|
|
322
262
|
### Platform-Specific Features
|
|
323
263
|
|
|
324
264
|
#### Windows
|
|
@@ -365,7 +305,7 @@ The `--install` flag automatically configures the script as a shell greeting:
|
|
|
365
305
|
All API functions include comprehensive JSDoc documentation:
|
|
366
306
|
|
|
367
307
|
```typescript
|
|
368
|
-
import { infoFunctions } from
|
|
308
|
+
import { infoFunctions } from "about-system/api";
|
|
369
309
|
|
|
370
310
|
// Hover over any function in your IDE to see:
|
|
371
311
|
// - Function description
|
|
@@ -374,10 +314,11 @@ import { infoFunctions } from 'about-system/api';
|
|
|
374
314
|
// - Usage examples
|
|
375
315
|
// - Platform-specific notes
|
|
376
316
|
|
|
377
|
-
infoFunctions.cpu(context);
|
|
317
|
+
infoFunctions.cpu(context); // IDE shows full documentation
|
|
378
318
|
```
|
|
379
319
|
|
|
380
320
|
**Features:**
|
|
321
|
+
|
|
381
322
|
- ✅ Every function documented with JSDoc
|
|
382
323
|
- ✅ Parameter and return type descriptions
|
|
383
324
|
- ✅ Real-world usage examples
|
|
@@ -387,6 +328,7 @@ infoFunctions.cpu(context); // IDE shows full documentation
|
|
|
387
328
|
### TypeScript Support
|
|
388
329
|
|
|
389
330
|
Full TypeScript definitions with:
|
|
331
|
+
|
|
390
332
|
- Complete `SystemInfo` interface
|
|
391
333
|
- All 30+ field types documented
|
|
392
334
|
- Platform-specific type unions
|
|
@@ -394,63 +336,13 @@ Full TypeScript definitions with:
|
|
|
394
336
|
|
|
395
337
|
```typescript
|
|
396
338
|
import type {
|
|
397
|
-
SystemInfo,
|
|
398
|
-
Platform,
|
|
399
|
-
SystemInfoOptions,
|
|
400
|
-
InfoContext,
|
|
401
|
-
} from
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
## Project Structure
|
|
405
|
-
|
|
406
|
-
```
|
|
407
|
-
about-system-info/
|
|
408
|
-
├── src/
|
|
409
|
-
│ ├── system-info-api.ts # Core API with JSDoc (exported infoFunctions)
|
|
410
|
-
│ ├── about-system-cli.ts # CLI interface
|
|
411
|
-
│ ├── index.ts # Main entry point
|
|
412
|
-
│ └── systeminfo-types.d.ts # TypeScript type definitions
|
|
413
|
-
├── dist/ # Compiled JavaScript output (Vite build)
|
|
414
|
-
│ ├── index.js # Main entry (0.19 KB)
|
|
415
|
-
│ ├── system-info-api.js # Core API (21 KB)
|
|
416
|
-
│ ├── about-system-cli.js # CLI (10 KB)
|
|
417
|
-
│ └── *.d.ts # Type definitions
|
|
418
|
-
├── examples/
|
|
419
|
-
│ └── api-usage.js # Example API usage
|
|
420
|
-
├── vite.config.ts # Vite build configuration
|
|
421
|
-
├── tsconfig.json # TypeScript configuration
|
|
422
|
-
├── package.json
|
|
423
|
-
└── README.md
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
## Development
|
|
427
|
-
|
|
428
|
-
```bash
|
|
429
|
-
# Clone the repository
|
|
430
|
-
git clone https://github.com/OpenSourceAGI/StarterDOCS.git
|
|
431
|
-
cd StarterDOCS/packages/about-system-info
|
|
432
|
-
|
|
433
|
-
# Install dependencies
|
|
434
|
-
npm install
|
|
435
|
-
|
|
436
|
-
# Build TypeScript
|
|
437
|
-
npm run build
|
|
438
|
-
|
|
439
|
-
# Run CLI
|
|
440
|
-
npm start
|
|
441
|
-
|
|
442
|
-
# Watch mode for development
|
|
443
|
-
npm run dev
|
|
339
|
+
SystemInfo, // Main info object
|
|
340
|
+
Platform, // Platform type
|
|
341
|
+
SystemInfoOptions, // Config options
|
|
342
|
+
InfoContext, // Context for functions
|
|
343
|
+
} from "about-system/types";
|
|
444
344
|
```
|
|
445
345
|
|
|
446
|
-
## Contributing
|
|
447
|
-
|
|
448
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
449
|
-
|
|
450
|
-
## License
|
|
451
|
-
|
|
452
|
-
rights.institute/prosper
|
|
453
|
-
|
|
454
346
|
## Links
|
|
455
347
|
|
|
456
348
|
- [Repository](https://github.com/OpenSourceAGI/StarterDOCS/tree/master/packages/about-system-info)
|
|
File without changes
|