about-system 0.0.17 → 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.
- package/README.md +321 -81
- package/dist/about-system-cli.d.ts +5 -0
- package/dist/about-system-cli.js +328 -0
- package/dist/about-system-cli.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/system-info-api.d.ts +259 -0
- package/dist/system-info-api.js +794 -0
- package/dist/system-info-api.js.map +1 -0
- package/package.json +35 -15
- package/src/about-system-cli.ts +516 -0
- package/src/index.ts +18 -0
- package/src/system-info-api.ts +1310 -0
- package/src/systeminfo-types.d.ts +457 -0
- package/src/about-system.js +0 -1642
package/README.md
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</a>
|
|
16
|
-
</p>
|
|
17
|
-
|
|
18
|
-
## Node.js Shell System Info Metadata
|
|
1
|
+
# About System Info
|
|
2
|
+
|
|
3
|
+
A TypeScript/Node.js library to display comprehensive system information with customizable output. Cross-platform support for Windows, macOS, and Linux with caching for optimal performance.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Fast**: Intelligent caching system for quick repeated access
|
|
8
|
+
- 🎨 **Customizable**: Configure colors, emojis, and display order
|
|
9
|
+
- 🔌 **Two Modes**: Use as CLI tool or import as API
|
|
10
|
+
- 🌍 **Cross-platform**: Works on Linux, macOS, and Windows
|
|
11
|
+
- 📊 **Comprehensive**: 30+ system metrics including CPU, GPU, network, containers, and more
|
|
12
|
+
- 💾 **TypeScript**: Full type definitions included
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
19
15
|
|
|
20
16
|
```bash
|
|
21
|
-
|
|
17
|
+
npm install about-system
|
|
22
18
|
```
|
|
19
|
+
|
|
23
20
|
```bash
|
|
24
21
|
npx about-system
|
|
25
22
|
```
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[NPM](https://www.npmjs.com/package/about-system-info)
|
|
24
|
+
```bash
|
|
25
|
+
bunx about-system
|
|
26
|
+
```
|
|
31
27
|
|
|
32
28
|
## Examples
|
|
33
29
|
|
|
@@ -35,73 +31,226 @@ A cross-platform Node.js implementation of the system info script with enhanced
|
|
|
35
31
|
|
|
36
32
|
`👤 deck 🏠 steamdeck 📁 90% 💾 2/14GB 🔝 6% cursor ⏱️ 1d 7h 18m 🌎 174.194.193.230 📍 San Jose 🔗 http://230.sub-174-194-193.myvzw.com 👮 Verizon Business ⚡ SteamOS 📈 AMD Custom APU 0405 💻 Jupiter 🔧 6.11.11-valve12-1-neptune-611-g517a46b477e1 🐚 fish 🚀 npm pip docker nvim bun 📦 docker-node`
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
`👤 u0_a365 🏠 localhost 📁 54% 💾 1/5GB 🔝 1% fish ⏱️ 4d 9h 19m 🌎 174.194.193.230 🌐 192.168.42.229 📍 San Jose 🔗 http://230.sub-174-194-193.myvzw.com 👮 Verizon Business ⚡ Android 13 📈 Kryo-4XX-Silver 💻 SM-G781U 🔧 4.19.113-27223811 🐚 nu 🚀 apt npm pip hx nvim`
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
## CLI Usage
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
- **Smart Caching**: Configurable cache durations for different system info types
|
|
44
|
-
- **Customizable Output**: Control which info blocks to show and their order
|
|
45
|
-
- **Network Info**: Fetches IP, location, and ISP data from ipinfo.io
|
|
46
|
-
- **Emoji Support**: Beautiful emoji-enhanced output (can be disabled)
|
|
47
|
-
- **Settings Management**: Persistent configuration with JSON settings file
|
|
48
|
-
- **Shell Integration**: Easy installation as shell greeting
|
|
49
|
-
- **Performance Optimized**: Caches expensive operations like network requests
|
|
38
|
+
### Basic Usage
|
|
50
39
|
|
|
51
|
-
|
|
40
|
+
```bash
|
|
41
|
+
# Show all system information
|
|
42
|
+
about-system
|
|
43
|
+
|
|
44
|
+
# Show specific fields
|
|
45
|
+
about-system cpu,ram_used,disk_used
|
|
46
|
+
|
|
47
|
+
# Output as JSON
|
|
48
|
+
about-system --json
|
|
49
|
+
|
|
50
|
+
# Get help
|
|
51
|
+
about-system --help
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Installation as Shell Greeting
|
|
52
55
|
|
|
53
|
-
#### Global Installation (Recommended)
|
|
54
56
|
```bash
|
|
55
|
-
|
|
57
|
+
# Install as shell greeting (runs on terminal startup)
|
|
58
|
+
about-system --install
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Configuration
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# View current settings
|
|
65
|
+
about-system --settings-show
|
|
66
|
+
|
|
67
|
+
# Reset settings to defaults
|
|
68
|
+
about-system --settings-reset
|
|
69
|
+
|
|
70
|
+
# Set specific configuration values
|
|
71
|
+
about-system --set display.show_emojis false
|
|
72
|
+
about-system --set colors.user blue
|
|
73
|
+
|
|
74
|
+
# Clear cache
|
|
75
|
+
about-system --refresh
|
|
56
76
|
```
|
|
57
77
|
|
|
58
|
-
|
|
78
|
+
## API Usage
|
|
79
|
+
|
|
80
|
+
### Basic Example
|
|
59
81
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
about-system
|
|
63
|
-
```
|
|
82
|
+
```typescript
|
|
83
|
+
import { getSystemInfo } from 'about-system';
|
|
64
84
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
+
You can import and use individual system info functions:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { infoFunctions } from 'about-system/api';
|
|
102
|
+
|
|
103
|
+
// Create a context with cache
|
|
104
|
+
const cache = {};
|
|
105
|
+
const context = { cache };
|
|
106
|
+
|
|
107
|
+
// Use individual functions
|
|
108
|
+
const cpu = infoFunctions.cpu(context);
|
|
109
|
+
const ram = infoFunctions.ram_used(context);
|
|
110
|
+
const uptime = infoFunctions.uptime();
|
|
111
|
+
|
|
112
|
+
// Build custom monitoring tools
|
|
113
|
+
async function getBasicInfo() {
|
|
114
|
+
return {
|
|
115
|
+
user: infoFunctions.user(),
|
|
116
|
+
hostname: infoFunctions.hostname(),
|
|
117
|
+
uptime: infoFunctions.uptime(),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
```
|
|
69
121
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
+
```
|
|
76
224
|
|
|
77
225
|
### Available Info Blocks
|
|
78
226
|
|
|
79
|
-
| Block
|
|
80
|
-
|
|
81
|
-
| `user`
|
|
82
|
-
| `hostname`
|
|
83
|
-
| `ip`
|
|
84
|
-
| `iplocal`
|
|
85
|
-
| `city`
|
|
86
|
-
| `domain`
|
|
87
|
-
| `isp`
|
|
88
|
-
| `os`
|
|
89
|
-
| `cpu`
|
|
90
|
-
| `gpu`
|
|
91
|
-
| `disk_used`
|
|
92
|
-
| `ram_used`
|
|
93
|
-
| `top_process` | Highest CPU process
|
|
94
|
-
| `uptime`
|
|
95
|
-
| `device`
|
|
96
|
-
| `kernel`
|
|
97
|
-
| `shell`
|
|
98
|
-
| `pacman`
|
|
99
|
-
| `ports`
|
|
100
|
-
| `containers`
|
|
227
|
+
| Block | Description | Example Output |
|
|
228
|
+
| ------------- | -------------------------- | ---------------------------- |
|
|
229
|
+
| `user` | Current username | `👤 username` |
|
|
230
|
+
| `hostname` | System hostname | `🏠 hostname` |
|
|
231
|
+
| `ip` | Public IP address | `🌎 192.168.1.1` |
|
|
232
|
+
| `iplocal` | Local IP addresses | `🌐 192.168.1.100` |
|
|
233
|
+
| `city` | Location based on IP | `📍 San Francisco` |
|
|
234
|
+
| `domain` | Reverse DNS hostname | `🔗 http://example.com` |
|
|
235
|
+
| `isp` | Internet service provider | `👮 Verizon Business` |
|
|
236
|
+
| `os` | Operating system | `⚡ Ubuntu 22.04` |
|
|
237
|
+
| `cpu` | CPU information | `📈 Intel Core i7-8700K` |
|
|
238
|
+
| `gpu` | Graphics card | `🎮 NVIDIA GeForce RTX 3080` |
|
|
239
|
+
| `disk_used` | Disk usage percentage | `📁 75%` |
|
|
240
|
+
| `ram_used` | Memory usage | `💾 8/16GB` |
|
|
241
|
+
| `top_process` | Highest CPU process | `🔝 15% chrome` |
|
|
242
|
+
| `uptime` | System uptime | `⏱️ 2d 5h 30m` |
|
|
243
|
+
| `device` | Device model | `💻 MacBook Pro` |
|
|
244
|
+
| `kernel` | Kernel version | `🔧 5.15.0-56-generic` |
|
|
245
|
+
| `shell` | Current shell | `🐚 fish` |
|
|
246
|
+
| `pacman` | Available package managers | `🚀 apt npm pip docker` |
|
|
247
|
+
| `ports` | Open network ports | `🔌 80http 443https 22ssh` |
|
|
248
|
+
| `containers` | Running Docker containers | `📦 nginx redis postgres` |
|
|
101
249
|
|
|
102
250
|
### Configuration
|
|
103
251
|
|
|
104
252
|
The script uses a JSON settings file located at:
|
|
253
|
+
|
|
105
254
|
- **Linux/macOS**: `~/.config/systeminfo-settings.json`
|
|
106
255
|
- **Windows**: `%APPDATA%\systeminfo-settings.json`
|
|
107
256
|
|
|
@@ -129,8 +278,15 @@ about-system --cache-clear
|
|
|
129
278
|
{
|
|
130
279
|
"version": "1.0.0",
|
|
131
280
|
"display_order": [
|
|
132
|
-
"user",
|
|
133
|
-
"
|
|
281
|
+
"user",
|
|
282
|
+
"hostname",
|
|
283
|
+
"disk_used",
|
|
284
|
+
"ram_used",
|
|
285
|
+
"uptime",
|
|
286
|
+
"ip",
|
|
287
|
+
"os",
|
|
288
|
+
"cpu",
|
|
289
|
+
"shell"
|
|
134
290
|
],
|
|
135
291
|
"colors": {
|
|
136
292
|
"user": "red",
|
|
@@ -166,16 +322,19 @@ about-system --cache-clear
|
|
|
166
322
|
### Platform-Specific Features
|
|
167
323
|
|
|
168
324
|
#### Windows
|
|
325
|
+
|
|
169
326
|
- Detects Windows-specific package managers (choco, winget, scoop)
|
|
170
327
|
- Uses `wmic` for system information
|
|
171
328
|
- Supports PowerShell and Command Prompt integration
|
|
172
329
|
|
|
173
330
|
#### Linux
|
|
331
|
+
|
|
174
332
|
- Detects Linux package managers (apt, yum, pacman, etc.)
|
|
175
333
|
- Reads from `/proc` and `/sys` filesystems
|
|
176
334
|
- Supports various shells (bash, zsh, fish, nushell)
|
|
177
335
|
|
|
178
336
|
#### macOS
|
|
337
|
+
|
|
179
338
|
- Detects macOS-specific tools
|
|
180
339
|
- Uses `system_profiler` for hardware info
|
|
181
340
|
- Supports zsh and bash integration
|
|
@@ -199,19 +358,100 @@ The `--install` flag automatically configures the script as a shell greeting:
|
|
|
199
358
|
- **NuShell**: Adds to `~/.config/nushell/config.nu`
|
|
200
359
|
- **PowerShell**: Provides instructions for profile setup
|
|
201
360
|
|
|
202
|
-
|
|
361
|
+
## Documentation
|
|
362
|
+
|
|
363
|
+
### JSDoc Comments
|
|
364
|
+
|
|
365
|
+
All API functions include comprehensive JSDoc documentation:
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
import { infoFunctions } from 'about-system/api';
|
|
369
|
+
|
|
370
|
+
// Hover over any function in your IDE to see:
|
|
371
|
+
// - Function description
|
|
372
|
+
// - Parameter details
|
|
373
|
+
// - Return type information
|
|
374
|
+
// - Usage examples
|
|
375
|
+
// - Platform-specific notes
|
|
376
|
+
|
|
377
|
+
infoFunctions.cpu(context); // IDE shows full documentation
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Features:**
|
|
381
|
+
- ✅ Every function documented with JSDoc
|
|
382
|
+
- ✅ Parameter and return type descriptions
|
|
383
|
+
- ✅ Real-world usage examples
|
|
384
|
+
- ✅ Platform compatibility notes
|
|
385
|
+
- ✅ IDE autocomplete support
|
|
386
|
+
|
|
387
|
+
### TypeScript Support
|
|
388
|
+
|
|
389
|
+
Full TypeScript definitions with:
|
|
390
|
+
- Complete `SystemInfo` interface
|
|
391
|
+
- All 30+ field types documented
|
|
392
|
+
- Platform-specific type unions
|
|
393
|
+
- Exported helper types
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
import type {
|
|
397
|
+
SystemInfo, // Main info object
|
|
398
|
+
Platform, // Platform type
|
|
399
|
+
SystemInfoOptions, // Config options
|
|
400
|
+
InfoContext, // Context for functions
|
|
401
|
+
} from 'about-system/types';
|
|
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
|
|
203
427
|
|
|
204
428
|
```bash
|
|
205
429
|
# Clone the repository
|
|
206
|
-
git clone https://github.com/
|
|
207
|
-
cd
|
|
430
|
+
git clone https://github.com/OpenSourceAGI/StarterDOCS.git
|
|
431
|
+
cd StarterDOCS/packages/about-system-info
|
|
208
432
|
|
|
209
433
|
# Install dependencies
|
|
210
434
|
npm install
|
|
211
435
|
|
|
212
|
-
#
|
|
436
|
+
# Build TypeScript
|
|
437
|
+
npm run build
|
|
438
|
+
|
|
439
|
+
# Run CLI
|
|
213
440
|
npm start
|
|
214
441
|
|
|
215
|
-
#
|
|
216
|
-
npm
|
|
442
|
+
# Watch mode for development
|
|
443
|
+
npm run dev
|
|
217
444
|
```
|
|
445
|
+
|
|
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
|
+
## Links
|
|
455
|
+
|
|
456
|
+
- [Repository](https://github.com/OpenSourceAGI/StarterDOCS/tree/master/packages/about-system-info)
|
|
457
|
+
- [Issues](https://github.com/OpenSourceAGI/StarterDOCS/issues)
|