nixsnap 1.0.0

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 ADDED
@@ -0,0 +1,51 @@
1
+ # nixsnap šŸ“ø
2
+
3
+ A CLI tool that shows your Linux system info in one command — CPU, RAM, Disk, Processes and more.
4
+
5
+ Instead of typing 5 different commands, just type:
6
+
7
+ ```bash
8
+ nixsnap snap
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - šŸ–„ļø CPU usage and model
14
+ - 🧠 RAM usage
15
+ - šŸ’¾ Disk usage
16
+ - āš™ļø Top 10 running processes
17
+ - šŸ‘ļø Live watch mode
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install -g nixsnap
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ # Full system snapshot
29
+ nixsnap snap
30
+
31
+ # Top 10 running processes
32
+ nixsnap processes
33
+
34
+ # Live monitor (updates every 2 seconds)
35
+ nixsnap watch
36
+ ```
37
+
38
+ ## Built With
39
+
40
+ - TypeScript
41
+ - Node.js
42
+ - Commander.js
43
+ - systeminformation
44
+
45
+ ## Author
46
+
47
+ Christina Rajakumari — [@ChristinaRajakumari2005](https://github.com/ChristinaRajakumari2005)
48
+
49
+ ## License
50
+
51
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const systeminformation_1 = __importDefault(require("systeminformation"));
9
+ const program = new commander_1.Command();
10
+ program
11
+ .name("nixsnap")
12
+ .description("A Linux system monitor CLI tool")
13
+ .version("1.0.0");
14
+ // Main command - shows everything
15
+ program
16
+ .command("snap")
17
+ .description("Show full system snapshot")
18
+ .action(async () => {
19
+ console.log("\nšŸ“ø nixsnap — System Snapshot\n");
20
+ console.log("================================");
21
+ // CPU
22
+ const cpu = await systeminformation_1.default.cpu();
23
+ const cpuLoad = await systeminformation_1.default.currentLoad();
24
+ console.log(`\nšŸ–„ļø CPU`);
25
+ console.log(` Model : ${cpu.manufacturer} ${cpu.brand}`);
26
+ console.log(` Cores : ${cpu.cores}`);
27
+ console.log(` Load : ${cpuLoad.currentLoad.toFixed(1)}%`);
28
+ // RAM
29
+ const mem = await systeminformation_1.default.mem();
30
+ const usedRam = ((mem.used / mem.total) * 100).toFixed(1);
31
+ const totalGB = (mem.total / 1024 / 1024 / 1024).toFixed(1);
32
+ const usedGB = (mem.used / 1024 / 1024 / 1024).toFixed(1);
33
+ console.log(`\n🧠 RAM`);
34
+ console.log(` Total : ${totalGB} GB`);
35
+ console.log(` Used : ${usedGB} GB (${usedRam}%)`);
36
+ // Disk
37
+ const disk = await systeminformation_1.default.fsSize();
38
+ console.log(`\nšŸ’¾ Disk`);
39
+ disk.forEach((d) => {
40
+ const total = (d.size / 1024 / 1024 / 1024).toFixed(1);
41
+ const used = (d.used / 1024 / 1024 / 1024).toFixed(1);
42
+ const percent = ((d.used / d.size) * 100).toFixed(1);
43
+ console.log(` ${d.mount} : ${used}GB / ${total}GB (${percent}%)`);
44
+ });
45
+ // OS
46
+ const os = await systeminformation_1.default.osInfo();
47
+ console.log(`\n🐧 OS`);
48
+ console.log(` Platform : ${os.platform}`);
49
+ console.log(` Distro : ${os.distro}`);
50
+ console.log(` Arch : ${os.arch}`);
51
+ console.log("\n================================\n");
52
+ });
53
+ // Processes command
54
+ program
55
+ .command("processes")
56
+ .description("Show top 10 running processes")
57
+ .action(async () => {
58
+ console.log("\nāš™ļø nixsnap — Top Processes\n");
59
+ console.log("================================");
60
+ const procs = await systeminformation_1.default.processes();
61
+ const top10 = procs.list
62
+ .sort((a, b) => b.cpu - a.cpu)
63
+ .slice(0, 10);
64
+ top10.forEach((p, i) => {
65
+ console.log(`${i + 1}. ${p.name.padEnd(25)} CPU: ${p.cpu.toFixed(1)}% MEM: ${p.mem.toFixed(1)}%`);
66
+ });
67
+ console.log("\n================================\n");
68
+ });
69
+ // Watch command - live updates
70
+ program
71
+ .command("watch")
72
+ .description("Live system monitor, updates every 2 seconds")
73
+ .action(async () => {
74
+ console.clear();
75
+ console.log("šŸ‘ļø nixsnap watch mode — Press Ctrl+C to exit\n");
76
+ const update = async () => {
77
+ console.clear();
78
+ console.log("šŸ‘ļø nixsnap — Live Monitor (Ctrl+C to exit)\n");
79
+ console.log("================================");
80
+ const cpuLoad = await systeminformation_1.default.currentLoad();
81
+ const mem = await systeminformation_1.default.mem();
82
+ const usedRam = ((mem.used / mem.total) * 100).toFixed(1);
83
+ const usedGB = (mem.used / 1024 / 1024 / 1024).toFixed(1);
84
+ const totalGB = (mem.total / 1024 / 1024 / 1024).toFixed(1);
85
+ console.log(`\nšŸ–„ļø CPU Load : ${cpuLoad.currentLoad.toFixed(1)}%`);
86
+ console.log(`🧠 RAM : ${usedGB}GB / ${totalGB}GB (${usedRam}%)`);
87
+ const disk = await systeminformation_1.default.fsSize();
88
+ disk.forEach((d) => {
89
+ const total = (d.size / 1024 / 1024 / 1024).toFixed(1);
90
+ const used = (d.used / 1024 / 1024 / 1024).toFixed(1);
91
+ const percent = ((d.used / d.size) * 100).toFixed(1);
92
+ console.log(`šŸ’¾ Disk : ${used}GB / ${total}GB (${percent}%)`);
93
+ });
94
+ console.log("\n================================");
95
+ console.log(`ā±ļø Updated at: ${new Date().toLocaleTimeString()}`);
96
+ };
97
+ await update();
98
+ const timer = setInterval(update, 2000);
99
+ process.on("SIGINT", () => {
100
+ clearInterval(timer);
101
+ console.log("\n\nšŸ‘‹ nixsnap watch stopped. Bye!\n");
102
+ process.exit(0);
103
+ });
104
+ });
105
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "nixsnap",
3
+ "version": "1.0.0",
4
+ "description": "A CLI tool that shows your Linux system info in one command",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "nixsnap": "dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc"
11
+ },
12
+ "keywords": [
13
+ "linux",
14
+ "cli",
15
+ "system-monitor",
16
+ "devtools"
17
+ ],
18
+ "author": "Christina Rajakumari",
19
+ "license": "MIT",
20
+ "dependencies": {
21
+ "commander": "^12.0.0",
22
+ "systeminformation": "^5.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^20.0.0",
26
+ "typescript": "^5.0.0"
27
+ }
28
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}
package/src/index.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const program = new commander_1.Command();
6
+ program
7
+ .name("nixsnap")
8
+ .description("A Linux system monitor CLI tool")
9
+ .version("1.0.0");
10
+ program
11
+ .command("hello")
12
+ .description("Test if nixsnap is working")
13
+ .action(() => {
14
+ console.log("šŸ‘‹ Hello from nixsnap! It works!");
15
+ });
16
+ program.parse(process.argv);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AAEpC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,iCAAiC,CAAC;KAC9C,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,GAAG,EAAE;IACX,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAClD,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/src/index.ts ADDED
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import si from "systeminformation";
4
+
5
+ const program = new Command();
6
+
7
+ program
8
+ .name("nixsnap")
9
+ .description("A Linux system monitor CLI tool")
10
+ .version("1.0.0");
11
+
12
+ // Main command - shows everything
13
+ program
14
+ .command("snap")
15
+ .description("Show full system snapshot")
16
+ .action(async () => {
17
+ console.log("\nšŸ“ø nixsnap — System Snapshot\n");
18
+ console.log("================================");
19
+
20
+ // CPU
21
+ const cpu = await si.cpu();
22
+ const cpuLoad = await si.currentLoad();
23
+ console.log(`\nšŸ–„ļø CPU`);
24
+ console.log(` Model : ${cpu.manufacturer} ${cpu.brand}`);
25
+ console.log(` Cores : ${cpu.cores}`);
26
+ console.log(` Load : ${cpuLoad.currentLoad.toFixed(1)}%`);
27
+
28
+ // RAM
29
+ const mem = await si.mem();
30
+ const usedRam = ((mem.used / mem.total) * 100).toFixed(1);
31
+ const totalGB = (mem.total / 1024 / 1024 / 1024).toFixed(1);
32
+ const usedGB = (mem.used / 1024 / 1024 / 1024).toFixed(1);
33
+ console.log(`\n🧠 RAM`);
34
+ console.log(` Total : ${totalGB} GB`);
35
+ console.log(` Used : ${usedGB} GB (${usedRam}%)`);
36
+
37
+ // Disk
38
+ const disk = await si.fsSize();
39
+ console.log(`\nšŸ’¾ Disk`);
40
+ disk.forEach((d) => {
41
+ const total = (d.size / 1024 / 1024 / 1024).toFixed(1);
42
+ const used = (d.used / 1024 / 1024 / 1024).toFixed(1);
43
+ const percent = ((d.used / d.size) * 100).toFixed(1);
44
+ console.log(` ${d.mount} : ${used}GB / ${total}GB (${percent}%)`);
45
+ });
46
+
47
+ // OS
48
+ const os = await si.osInfo();
49
+ console.log(`\n🐧 OS`);
50
+ console.log(` Platform : ${os.platform}`);
51
+ console.log(` Distro : ${os.distro}`);
52
+ console.log(` Arch : ${os.arch}`);
53
+
54
+ console.log("\n================================\n");
55
+ });
56
+ // Processes command
57
+ program
58
+ .command("processes")
59
+ .description("Show top 10 running processes")
60
+ .action(async () => {
61
+ console.log("\nāš™ļø nixsnap — Top Processes\n");
62
+ console.log("================================");
63
+ const procs = await si.processes();
64
+ const top10 = procs.list
65
+ .sort((a, b) => b.cpu - a.cpu)
66
+ .slice(0, 10);
67
+ top10.forEach((p, i) => {
68
+ console.log(`${i + 1}. ${p.name.padEnd(25)} CPU: ${p.cpu.toFixed(1)}% MEM: ${p.mem.toFixed(1)}%`);
69
+ });
70
+ console.log("\n================================\n");
71
+ });
72
+ // Watch command - live updates
73
+ program
74
+ .command("watch")
75
+ .description("Live system monitor, updates every 2 seconds")
76
+ .action(async () => {
77
+ console.clear();
78
+ console.log("šŸ‘ļø nixsnap watch mode — Press Ctrl+C to exit\n");
79
+
80
+ const update = async () => {
81
+ console.clear();
82
+ console.log("šŸ‘ļø nixsnap — Live Monitor (Ctrl+C to exit)\n");
83
+ console.log("================================");
84
+
85
+ const cpuLoad = await si.currentLoad();
86
+ const mem = await si.mem();
87
+ const usedRam = ((mem.used / mem.total) * 100).toFixed(1);
88
+ const usedGB = (mem.used / 1024 / 1024 / 1024).toFixed(1);
89
+ const totalGB = (mem.total / 1024 / 1024 / 1024).toFixed(1);
90
+
91
+ console.log(`\nšŸ–„ļø CPU Load : ${cpuLoad.currentLoad.toFixed(1)}%`);
92
+ console.log(`🧠 RAM : ${usedGB}GB / ${totalGB}GB (${usedRam}%)`);
93
+
94
+ const disk = await si.fsSize();
95
+ disk.forEach((d) => {
96
+ const total = (d.size / 1024 / 1024 / 1024).toFixed(1);
97
+ const used = (d.used / 1024 / 1024 / 1024).toFixed(1);
98
+ const percent = ((d.used / d.size) * 100).toFixed(1);
99
+ console.log(`šŸ’¾ Disk : ${used}GB / ${total}GB (${percent}%)`);
100
+ });
101
+
102
+ console.log("\n================================");
103
+ console.log(`ā±ļø Updated at: ${new Date().toLocaleTimeString()}`);
104
+ };
105
+
106
+ await update();
107
+ const timer = setInterval(update, 2000);
108
+ process.on("SIGINT", () => {
109
+ clearInterval(timer);
110
+ console.log("\n\nšŸ‘‹ nixsnap watch stopped. Bye!\n");
111
+ process.exit(0);
112
+ });
113
+ });
114
+
115
+
116
+ program.parse(process.argv);
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "moduleResolution": "bundler",
6
+ "esModuleInterop": true,
7
+ "outDir": "./dist",
8
+ "rootDir": "./src",
9
+ "strict": false,
10
+ "types": ["node"],
11
+ "ignoreDeprecations": "5.0"
12
+ }
13
+ }