about-system 0.0.17 → 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 CHANGED
@@ -1,33 +1,30 @@
1
- <p align="center">
2
- <img src="https://i.imgur.com/1kwKBTR.png">
3
- </p>
4
- <p align="center">
5
- <img alt="GitHub Stars" src="https://img.shields.io/github/stars/vtempest/server-shell-setup">
6
- <a href="https://github.com/vtempest/server-shell-setup/discussions">
7
- <img alt="GitHub Discussions"
8
- src="https://img.shields.io/github/discussions/vtempest/server-shell-setup">
9
- </a>
10
- <a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request">
11
- <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
12
- </a>
13
- <a href="https://codespaces.new/vtempest/server-shell-setup">
14
- <img src="https://github.com/codespaces/badge.svg" width="150" height="20">
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
+ - 📊 **Comprehensive**: 30+ system metrics including CPU, GPU, network, containers, and more
8
+ - 🌍 **Cross-platform**: Works on Linux, macOS, and Windows, and Android
9
+ - 🎨 **Customizable**: Configure colors, emojis, and display order
10
+ - 🔌 **Two Modes**: Use as CLI tool or import as API
11
+ - 🚀 **Cached**: Intelligent caching system for quick repeated access
12
+ - 💾 **TypeScript**: Full type definitions included
13
+
14
+ ## Installation
19
15
 
20
- ```bash
21
- bunx about-system
22
- ```
23
16
  ```bash
24
17
  npx about-system
25
18
  ```
26
19
 
20
+ ```bash
21
+ npm install -g about-system
22
+ about-system
23
+ ```
27
24
 
28
- A cross-platform Node.js implementation of the system info script with enhanced features, caching, and full customization support.
29
-
30
- [NPM](https://www.npmjs.com/package/about-system-info)
25
+ ```bash
26
+ bun x about-system
27
+ ```
31
28
 
32
29
  ## Examples
33
30
 
@@ -35,73 +32,228 @@ A cross-platform Node.js implementation of the system info script with enhanced
35
32
 
36
33
  `👤 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
34
 
38
- `👤 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`
35
+ `👤 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`
36
+
37
+ ## CLI Usage
38
+
39
+ ### Basic Usage
40
+
41
+ ```bash
42
+ # Show all system information
43
+ about-system
44
+
45
+ # Show specific fields
46
+ about-system cpu,ram_used,disk_used
39
47
 
40
- ### Features
48
+ # Output as JSON
49
+ about-system --json
41
50
 
42
- - **Cross-Platform**: Works on any Linux, Windows PowerShell (most features), macOS, Android Termux
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
51
+ # Get help
52
+ about-system --help
53
+ ```
50
54
 
51
- ### Installation
55
+ ### Installation as Shell Greeting
52
56
 
53
- #### Global Installation (Recommended)
54
57
  ```bash
55
- npx about-system
58
+ # Install as shell greeting (runs on terminal startup)
59
+ about-system --install
56
60
  ```
57
61
 
58
- ### Quick Start
62
+ ### Configuration
63
+
64
+ ```bash
65
+ # View current settings
66
+ about-system --settings-show
67
+
68
+ # Reset settings to defaults
69
+ about-system --settings-reset
70
+
71
+ # Set specific configuration values
72
+ about-system --set display.show_emojis false
73
+ about-system --set colors.user blue
74
+ about-system --set emojis.cpu "🚀 "
75
+ about-system --set labels.cpu "Processor"
76
+
77
+ # Clear cache
78
+ about-system --refresh
79
+ ```
80
+
81
+ ## API Usage
82
+
83
+ ### Basic Example
84
+
85
+ ```typescript
86
+ import { getSystemInfo } from "about-system";
87
+
88
+ // Get all system information as JSON
89
+ const info = await getSystemInfo();
90
+
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%")
97
+ ```
98
+
99
+ ### Using Individual Info Functions
100
+
101
+ You can import and use individual system info functions:
102
+
103
+ ```typescript
104
+ import { infoFunctions } from "about-system/api";
105
+
106
+ // Create a context with cache
107
+ const cache = {};
108
+ const context = { cache };
109
+
110
+ // Use individual functions
111
+ const cpu = infoFunctions.cpu(context);
112
+ const ram = infoFunctions.ram_used(context);
113
+ const uptime = infoFunctions.uptime();
114
+
115
+ // Build custom monitoring tools
116
+ async function getBasicInfo() {
117
+ return {
118
+ user: infoFunctions.user(),
119
+ hostname: infoFunctions.hostname(),
120
+ uptime: infoFunctions.uptime(),
121
+ };
122
+ }
123
+ ```
124
+
125
+ ### Multiple Import Styles
126
+
127
+ ```typescript
128
+ // Default import (complete API)
129
+ import { getSystemInfo } from "about-system";
130
+
131
+ // Direct API import with individual functions
132
+ import { getSystemInfo, infoFunctions } from "about-system/api";
133
+
134
+ // CLI functions
135
+ import { displaySystemInfo } from "about-system/cli";
136
+
137
+ // Types only
138
+ import type { SystemInfo, Platform } from "about-system/types";
139
+ ```
140
+
141
+ ### All Available Fields
142
+
143
+ See the [systeminfo-types.d.ts](src/systeminfo-types.d.ts) file for complete TypeScript definitions with detailed JSDoc comments.
144
+
145
+ ```typescript
146
+ interface SystemInfo {
147
+ // System Identity
148
+ timestamp: string; // ISO 8601 timestamp
149
+ hostname: string; // Computer hostname
150
+ user: string; // Current username
151
+ platform: "linux" | "windows" | "macos" | "unknown";
152
+
153
+ // Operating System
154
+ os: string; // OS name and version
155
+ kernel: string; // Kernel version
156
+ shell: string; // Shell program (Linux/Unix)
157
+
158
+ // Hardware
159
+ cpu: string; // CPU model
160
+ gpu: string; // GPU model
161
+ device: string; // Device/computer model
162
+
163
+ // Real-time Resources
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)
168
+
169
+ // Network
170
+ ip: string; // Public IP address
171
+ iplocal: string; // Local IP address(es)
172
+ city: string; // Geographic location
173
+ isp: string; // Internet service provider
174
+
175
+ // Linux-specific
176
+ temperature: string; // System temperature
177
+ battery: string; // Battery percentage
178
+ load_average: string; // System load
179
+ services_running: string; // Active services count
180
+
181
+ // And 20+ more fields...
182
+ }
183
+ ```
184
+
185
+ ### Advanced Examples
186
+
187
+ See [examples/api-usage.js](examples/api-usage.js) for more examples.
59
188
 
60
- 1. **Run the script**:
61
- ```bash
62
- about-system
63
- ```
189
+ ```typescript
190
+ import { getSystemInfo } from "about-system";
64
191
 
65
- 2. **Install as shell greeting**:
66
- ```bash
67
- about-system --install
68
- ```
192
+ // Example: Monitor system resources
193
+ async function monitorResources() {
194
+ const info = await getSystemInfo();
69
195
 
70
- 3. **Customize settings**:
71
- ```bash
72
- about-system --set display.show_emojis false
73
- about-system --set colors.user blue
74
- about-system --set display_order '["user","hostname","uptime"]'
75
- ```
196
+ return {
197
+ cpu: info.cpu,
198
+ ram: info.ram_used,
199
+ disk: info.disk_used,
200
+ temperature: info.temperature,
201
+ topProcess: info.top_process,
202
+ };
203
+ }
204
+
205
+ // Example: Create custom dashboard
206
+ import { infoFunctions } from "about-system/api";
207
+
208
+ async function getDashboardData(context) {
209
+ return {
210
+ hardware: {
211
+ cpu: infoFunctions.cpu(context),
212
+ gpu: infoFunctions.gpu(context),
213
+ device: infoFunctions.device(context),
214
+ },
215
+ resources: {
216
+ ram: infoFunctions.ram_used(context),
217
+ disk: infoFunctions.disk_used(context),
218
+ uptime: infoFunctions.uptime(),
219
+ },
220
+ network: {
221
+ localIP: infoFunctions.iplocal(),
222
+ publicIP: await infoFunctions.ip(context),
223
+ },
224
+ };
225
+ }
226
+ ```
76
227
 
77
228
  ### Available Info Blocks
78
229
 
79
- | Block | Description | Example Output |
80
- |-------|-------------|----------------|
81
- | `user` | Current username | `👤 username` |
82
- | `hostname` | System hostname | `🏠 hostname` |
83
- | `ip` | Public IP address | `🌎 192.168.1.1` |
84
- | `iplocal` | Local IP addresses | `🌐 192.168.1.100` |
85
- | `city` | Location based on IP | `📍 San Francisco` |
86
- | `domain` | Reverse DNS hostname | `🔗 http://example.com` |
87
- | `isp` | Internet service provider | `👮 Verizon Business` |
88
- | `os` | Operating system | `⚡ Ubuntu 22.04` |
89
- | `cpu` | CPU information | `📈 Intel Core i7-8700K` |
90
- | `gpu` | Graphics card | `🎮 NVIDIA GeForce RTX 3080` |
91
- | `disk_used` | Disk usage percentage | `📁 75%` |
92
- | `ram_used` | Memory usage | `💾 8/16GB` |
93
- | `top_process` | Highest CPU process | `🔝 15% chrome` |
94
- | `uptime` | System uptime | `⏱️ 2d 5h 30m` |
95
- | `device` | Device model | `💻 MacBook Pro` |
96
- | `kernel` | Kernel version | `🔧 5.15.0-56-generic` |
97
- | `shell` | Current shell | `🐚 fish` |
98
- | `pacman` | Available package managers | `🚀 apt npm pip docker` |
99
- | `ports` | Open network ports | `🔌 80http 443https 22ssh` |
100
- | `containers` | Running Docker containers | `📦 nginx redis postgres` |
230
+ | Block | Description | Example Output |
231
+ | ------------- | -------------------------- | ---------------------------- |
232
+ | `user` | Current username | `👤 username` |
233
+ | `hostname` | System hostname | `🏠 hostname` |
234
+ | `ip` | Public IP address | `🌎 192.168.1.1` |
235
+ | `iplocal` | Local IP addresses | `🌐 192.168.1.100` |
236
+ | `city` | Location based on IP | `📍 San Francisco` |
237
+ | `domain` | Reverse DNS hostname | `🔗 http://example.com` |
238
+ | `isp` | Internet service provider | `👮 Verizon Business` |
239
+ | `os` | Operating system | `⚡ Ubuntu 22.04` |
240
+ | `cpu` | CPU information | `📈 Intel Core i7-8700K` |
241
+ | `gpu` | Graphics card | `🎮 NVIDIA GeForce RTX 3080` |
242
+ | `disk_used` | Disk usage percentage | `📁 75%` |
243
+ | `ram_used` | Memory usage | `💾 8/16GB` |
244
+ | `top_process` | Highest CPU process | `🔝 15% chrome` |
245
+ | `uptime` | System uptime | `⏱️ 2d 5h 30m` |
246
+ | `device` | Device model | `💻 MacBook Pro` |
247
+ | `kernel` | Kernel version | `🔧 5.15.0-56-generic` |
248
+ | `shell` | Current shell | `🐚 fish` |
249
+ | `pacman` | Available package managers | `🚀 apt npm pip docker` |
250
+ | `ports` | Open network ports | `🔌 80http 443https 22ssh` |
251
+ | `containers` | Running Docker containers | `📦 nginx redis postgres` |
101
252
 
102
253
  ### Configuration
103
254
 
104
255
  The script uses a JSON settings file located at:
256
+
105
257
  - **Linux/macOS**: `~/.config/systeminfo-settings.json`
106
258
  - **Windows**: `%APPDATA%\systeminfo-settings.json`
107
259
 
@@ -117,6 +269,8 @@ about-system --settings-reset
117
269
  # Set individual values
118
270
  about-system --set display.show_emojis false
119
271
  about-system --set colors.user blue
272
+ about-system --set emojis.cpu "🚀 "
273
+ about-system --set labels.hostname "Computer"
120
274
  about-system --set cache.enabled true
121
275
 
122
276
  # Clear cache
@@ -129,8 +283,17 @@ about-system --cache-clear
129
283
  {
130
284
  "version": "1.0.0",
131
285
  "display_order": [
132
- "user", "hostname", "disk_used", "ram_used", "uptime",
133
- "ip", "os", "cpu", "shell"
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"]
134
297
  ],
135
298
  "colors": {
136
299
  "user": "red",
@@ -143,39 +306,94 @@ about-system --cache-clear
143
306
  "cpu": "orange",
144
307
  "shell": "orange"
145
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
+ },
146
329
  "display": {
147
330
  "show_emojis": true,
148
- "separator": " ",
149
- "max_width": 120
150
- },
151
- "cache": {
152
- "enabled": true
331
+ "single_line": false,
332
+ "line_wrap_length": 100
153
333
  },
154
334
  "network": {
155
- "timeout": 5000,
156
335
  "show_offline_message": true
336
+ },
337
+ "advanced": {
338
+ "debug": false
157
339
  }
158
340
  }
159
341
  ```
160
342
 
161
- ### Available Colors
343
+ ### Customization Options
344
+
345
+ #### Colors
346
+
347
+ Available color options for each info block:
162
348
 
163
349
  - `red`, `orange`, `yellow`, `green`, `blue`, `cyan`, `purple`, `magenta`, `gray`, `lightblue`
164
350
  - Use `multicolor` for ports to get a rainbow effect
165
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
+
166
381
  ### Platform-Specific Features
167
382
 
168
383
  #### Windows
384
+
169
385
  - Detects Windows-specific package managers (choco, winget, scoop)
170
386
  - Uses `wmic` for system information
171
387
  - Supports PowerShell and Command Prompt integration
172
388
 
173
389
  #### Linux
390
+
174
391
  - Detects Linux package managers (apt, yum, pacman, etc.)
175
392
  - Reads from `/proc` and `/sys` filesystems
176
393
  - Supports various shells (bash, zsh, fish, nushell)
177
394
 
178
395
  #### macOS
396
+
179
397
  - Detects macOS-specific tools
180
398
  - Uses `system_profiler` for hardware info
181
399
  - Supports zsh and bash integration
@@ -199,19 +417,102 @@ The `--install` flag automatically configures the script as a shell greeting:
199
417
  - **NuShell**: Adds to `~/.config/nushell/config.nu`
200
418
  - **PowerShell**: Provides instructions for profile setup
201
419
 
202
- ### Development
420
+ ## Documentation
421
+
422
+ ### JSDoc Comments
423
+
424
+ All API functions include comprehensive JSDoc documentation:
425
+
426
+ ```typescript
427
+ import { infoFunctions } from "about-system/api";
428
+
429
+ // Hover over any function in your IDE to see:
430
+ // - Function description
431
+ // - Parameter details
432
+ // - Return type information
433
+ // - Usage examples
434
+ // - Platform-specific notes
435
+
436
+ infoFunctions.cpu(context); // IDE shows full documentation
437
+ ```
438
+
439
+ **Features:**
440
+
441
+ - ✅ Every function documented with JSDoc
442
+ - ✅ Parameter and return type descriptions
443
+ - ✅ Real-world usage examples
444
+ - ✅ Platform compatibility notes
445
+ - ✅ IDE autocomplete support
446
+
447
+ ### TypeScript Support
448
+
449
+ Full TypeScript definitions with:
450
+
451
+ - Complete `SystemInfo` interface
452
+ - All 30+ field types documented
453
+ - Platform-specific type unions
454
+ - Exported helper types
455
+
456
+ ```typescript
457
+ import type {
458
+ SystemInfo, // Main info object
459
+ Platform, // Platform type
460
+ SystemInfoOptions, // Config options
461
+ InfoContext, // Context for functions
462
+ } from "about-system/types";
463
+ ```
464
+
465
+ ## Project Structure
466
+
467
+ ```
468
+ about-system-info/
469
+ ├── src/
470
+ │ ├── system-info-api.ts # Core API with JSDoc (exported infoFunctions)
471
+ │ ├── about-system-cli.ts # CLI interface
472
+ │ ├── index.ts # Main entry point
473
+ │ └── systeminfo-types.d.ts # TypeScript type definitions
474
+ ├── dist/ # Compiled JavaScript output (Vite build)
475
+ │ ├── index.js # Main entry (0.19 KB)
476
+ │ ├── system-info-api.js # Core API (21 KB)
477
+ │ ├── about-system-cli.js # CLI (10 KB)
478
+ │ └── *.d.ts # Type definitions
479
+ ├── examples/
480
+ │ └── api-usage.js # Example API usage
481
+ ├── vite.config.ts # Vite build configuration
482
+ ├── tsconfig.json # TypeScript configuration
483
+ ├── package.json
484
+ └── README.md
485
+ ```
486
+
487
+ ## Development
203
488
 
204
489
  ```bash
205
490
  # Clone the repository
206
- git clone https://github.com/vtempest/server-shell-setup.git
207
- cd server-shell-setup
491
+ git clone https://github.com/OpenSourceAGI/StarterDOCS.git
492
+ cd StarterDOCS/packages/about-system-info
208
493
 
209
494
  # Install dependencies
210
495
  npm install
211
496
 
212
- # Run the script
497
+ # Build TypeScript
498
+ npm run build
499
+
500
+ # Run CLI
213
501
  npm start
214
502
 
215
- # Run with custom settings
216
- npm start -- --set display.show_emojis false
503
+ # Watch mode for development
504
+ npm run dev
217
505
  ```
506
+
507
+ ## Contributing
508
+
509
+ Contributions are welcome! Please feel free to submit a Pull Request.
510
+
511
+ ## License
512
+
513
+ rights.institute/prosper
514
+
515
+ ## Links
516
+
517
+ - [Repository](https://github.com/OpenSourceAGI/StarterDOCS/tree/master/packages/about-system-info)
518
+ - [Issues](https://github.com/OpenSourceAGI/StarterDOCS/issues)
@@ -0,0 +1,5 @@
1
+ export declare function displaySystemInfo(customDisplayOrder?: string[][] | null): Promise<void>;
2
+
3
+ export declare function installShellGreeting(): void;
4
+
5
+ export { }