@indah_sekar/os-t 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,76 @@
1
+ # OS Troubleshooter
2
+
3
+ Quick access to common troubleshooting commands for **Windows**, **Linux**, and **macOS**.
4
+
5
+ Available as a **web app** and a **CLI tool**.
6
+
7
+ ## Install (CLI)
8
+
9
+ ```bash
10
+ npm install -g os-t
11
+ ```
12
+
13
+ ## CLI Usage
14
+
15
+ ```bash
16
+ # Show help
17
+ os-t --help
18
+
19
+ # List all commands
20
+ os-t --list
21
+
22
+ # List commands for a specific OS
23
+ os-t --os linux --list
24
+
25
+ # List commands in a category
26
+ os-t --os windows --category Network --list
27
+
28
+ # Search for a command
29
+ os-t --search ping
30
+
31
+ # Get a specific command
32
+ os-t "Flush DNS Cache"
33
+
34
+ # Filter by OS
35
+ os-t --os macos "System Info"
36
+
37
+ # Copy command to clipboard
38
+ os-t --copy "Flush DNS Cache"
39
+ ```
40
+
41
+ ## Web App
42
+
43
+ ```bash
44
+ npm install
45
+ npm run dev
46
+ ```
47
+
48
+ Open [http://localhost:5173](http://localhost:5173) in your browser.
49
+
50
+ ## Build
51
+
52
+ ```bash
53
+ npm run build
54
+ npm run preview
55
+ ```
56
+
57
+ ## Programmatic Usage (import as module)
58
+
59
+ ```js
60
+ import commands from "os-t";
61
+
62
+ // commands.windows, commands.linux, commands.macos
63
+ ```
64
+
65
+ ## Features
66
+
67
+ - **Multi-OS Support** — Windows, Linux, and macOS troubleshooting commands
68
+ - **Categorized Commands** — Network, System, Process & Services, Disk, Power, Logs, and more
69
+ - **Search & Filter** — Instantly find commands by name, description, or keyword
70
+ - **Dropdown Selector** — Select commands from a dropdown with detail preview
71
+ - **One-Click Copy** — Copy any command to clipboard
72
+ - **Simulated Terminal** — Execute commands and view history in a visual terminal panel
73
+ - **Recently Used** — Quick access to your most frequently used commands
74
+ - **Export History** — Download terminal history as a text file
75
+ - **Difficulty Indicators** — See at a glance whether a command is easy, medium, or hard
76
+ - **CLI Tool** — Use from the command line after `npm install -g`
package/bin/cli.js ADDED
@@ -0,0 +1,248 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readFileSync } from "fs";
4
+ import { execSync } from "child_process";
5
+ import { fileURLToPath } from "url";
6
+ import { dirname, join } from "path";
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+
11
+ const commandsPath = join(__dirname, "..", "dist", "data", "commands.json");
12
+ let commands;
13
+ try {
14
+ commands = JSON.parse(readFileSync(commandsPath, "utf-8"));
15
+ } catch {
16
+ const srcPath = join(__dirname, "..", "src", "data", "commands.json");
17
+ commands = JSON.parse(readFileSync(srcPath, "utf-8"));
18
+ }
19
+
20
+ const args = process.argv.slice(2);
21
+
22
+ function printHelp() {
23
+ console.log(`
24
+ OS Troubleshooter - Quick troubleshooting commands for Windows, Linux & macOS
25
+
26
+ Usage:
27
+ os-troubleshooter [options] [command-name]
28
+
29
+ Options:
30
+ --help, -h Show this help message
31
+ --list, -l List all available commands
32
+ --os <os> Filter by OS (windows, linux, macos). Default: all
33
+ --category <cat> Filter by category
34
+ --search <query> Search commands by name/description
35
+ --copy Copy command to clipboard (requires xclip/xsel/pbcopy)
36
+
37
+ Examples:
38
+ os-troubleshooter --list
39
+ os-troubleshooter --os linux --list
40
+ os-troubleshooter "Flush DNS Cache"
41
+ os-troubleshooter --os windows "System File Checker"
42
+ os-troubleshooter --search ping
43
+ os-troubleshooter --category Network --os linux
44
+ os-troubleshooter --copy "Flush DNS Cache"
45
+ `);
46
+ }
47
+
48
+ function listCommands(osFilter, categoryFilter, searchQuery) {
49
+ const osList = osFilter ? [osFilter] : Object.keys(commands);
50
+
51
+ let total = 0;
52
+ for (const os of osList) {
53
+ if (!commands[os]) {
54
+ console.log(
55
+ `\n Unknown OS: "${os}". Available: ${Object.keys(commands).join(", ")}`,
56
+ );
57
+ continue;
58
+ }
59
+ const categories = commands[os];
60
+ for (const cat of categories) {
61
+ if (
62
+ categoryFilter &&
63
+ cat.category.toLowerCase() !== categoryFilter.toLowerCase()
64
+ ) {
65
+ continue;
66
+ }
67
+ let cmds = cat.commands;
68
+ if (searchQuery) {
69
+ const q = searchQuery.toLowerCase();
70
+ cmds = cmds.filter(
71
+ (c) =>
72
+ c.name.toLowerCase().includes(q) ||
73
+ c.description.toLowerCase().includes(q) ||
74
+ c.command.toLowerCase().includes(q),
75
+ );
76
+ }
77
+ if (cmds.length === 0) continue;
78
+ console.log(`\n [${os.toUpperCase()}] ${cat.category}`);
79
+ console.log(" " + "-".repeat(50));
80
+ for (const cmd of cmds) {
81
+ console.log(` ${cmd.name}`);
82
+ console.log(` ${cmd.description}`);
83
+ console.log(` $ ${cmd.command}`);
84
+ console.log();
85
+ total++;
86
+ }
87
+ }
88
+ }
89
+ console.log(` Total: ${total} command(s)`);
90
+ }
91
+
92
+ function findCommand(query) {
93
+ const q = query.toLowerCase();
94
+ const results = [];
95
+ for (const [os, categories] of Object.entries(commands)) {
96
+ for (const cat of categories) {
97
+ for (const cmd of cat.commands) {
98
+ if (
99
+ cmd.name.toLowerCase().includes(q) ||
100
+ cmd.command.toLowerCase().includes(q) ||
101
+ cmd.description.toLowerCase().includes(q)
102
+ ) {
103
+ results.push({ os, category: cat.category, ...cmd });
104
+ }
105
+ }
106
+ }
107
+ }
108
+ return results;
109
+ }
110
+
111
+ function copyToClipboard(text) {
112
+ const platform = process.platform;
113
+ try {
114
+ if (platform === "darwin") {
115
+ execSync("pbcopy", { input: text });
116
+ } else if (platform === "linux") {
117
+ try {
118
+ execSync("xclip -selection clipboard", { input: text });
119
+ } catch {
120
+ execSync("xsel --clipboard --input", { input: text });
121
+ }
122
+ } else if (platform === "win32") {
123
+ execSync("clip", { input: text });
124
+ }
125
+ return true;
126
+ } catch {
127
+ return false;
128
+ }
129
+ }
130
+
131
+ function prepareCommand(cmd, os) {
132
+ if (os === "linux") {
133
+ if (cmd.startsWith("sudo ")) return cmd;
134
+ return `sudo ${cmd}`;
135
+ }
136
+ if (os === "macos") {
137
+ if (cmd.startsWith("sudo ")) return cmd;
138
+ return `sudo ${cmd}`;
139
+ }
140
+ return cmd;
141
+ }
142
+
143
+ function printResults(results) {
144
+ for (const r of results) {
145
+ const finalCmd = prepareCommand(r.command, r.os);
146
+ console.log(`\n [${r.os.toUpperCase()}] ${r.category}`);
147
+ console.log(` Name: ${r.name}`);
148
+ console.log(` Description: ${r.description}`);
149
+ console.log(` Difficulty: ${r.difficulty}`);
150
+ console.log(` Command:`);
151
+ console.log(` $ ${finalCmd}`);
152
+ console.log();
153
+ }
154
+ console.log(` Found: ${results.length} command(s)`);
155
+ }
156
+
157
+ function main() {
158
+ if (args.includes("--help") || args.includes("-h") || args.length === 0) {
159
+ printHelp();
160
+ return;
161
+ }
162
+
163
+ const osFlag = args.indexOf("--os");
164
+ let osFilter = null;
165
+ let filteredArgs = [...args];
166
+ if (osFlag !== -1 && args[osFlag + 1]) {
167
+ osFilter = args[osFlag + 1].toLowerCase();
168
+ filteredArgs.splice(osFlag, 2);
169
+ }
170
+
171
+ const catFlag = args.indexOf("--category");
172
+ let categoryFilter = null;
173
+ if (catFlag !== -1 && args[catFlag + 1]) {
174
+ categoryFilter = args[catFlag + 1];
175
+ const catIdx = filteredArgs.indexOf("--category");
176
+ filteredArgs.splice(catIdx, 2);
177
+ }
178
+
179
+ const searchFlag = args.indexOf("--search");
180
+ let searchQuery = null;
181
+ if (searchFlag !== -1 && args[searchFlag + 1]) {
182
+ searchQuery = args[searchFlag + 1];
183
+ const searchIdx = filteredArgs.indexOf("--search");
184
+ filteredArgs.splice(searchIdx, 2);
185
+ }
186
+
187
+ const shouldCopy = filteredArgs.includes("--copy");
188
+ filteredArgs = filteredArgs.filter((a) => a !== "--copy");
189
+
190
+ if (filteredArgs.includes("--list") || filteredArgs.includes("-l")) {
191
+ listCommands(osFilter, categoryFilter, searchQuery);
192
+ return;
193
+ }
194
+
195
+ const query = filteredArgs.join(" ");
196
+ if (!query && !searchQuery && !categoryFilter) {
197
+ printHelp();
198
+ return;
199
+ }
200
+
201
+ const finalQuery = searchQuery || query;
202
+ const results = findCommand(finalQuery);
203
+
204
+ if (results.length === 0) {
205
+ console.log(`\n No commands found matching "${finalQuery}"`);
206
+ console.log(
207
+ " Try: os-troubleshooter --list to see all available commands\n",
208
+ );
209
+ return;
210
+ }
211
+
212
+ if (osFilter) {
213
+ const filtered = results.filter((r) => r.os === osFilter);
214
+ if (filtered.length === 0) {
215
+ console.log(
216
+ `\n No commands found matching "${finalQuery}" for ${osFilter}`,
217
+ );
218
+ return;
219
+ }
220
+ printResults(filtered);
221
+ if (shouldCopy && filtered.length === 1) {
222
+ const cmdToSend = prepareCommand(filtered[0].command, filtered[0].os);
223
+ const copied = copyToClipboard(cmdToSend);
224
+ if (copied) {
225
+ console.log(" Command copied to clipboard!");
226
+ } else {
227
+ console.log(
228
+ " Failed to copy. Install xclip or xsel for clipboard support.",
229
+ );
230
+ }
231
+ }
232
+ } else {
233
+ printResults(results);
234
+ if (shouldCopy && results.length === 1) {
235
+ const cmdToSend = prepareCommand(results[0].command, results[0].os);
236
+ const copied = copyToClipboard(cmdToSend);
237
+ if (copied) {
238
+ console.log(" Command copied to clipboard!");
239
+ } else {
240
+ console.log(
241
+ " Failed to copy. Install xclip or xsel for clipboard support.",
242
+ );
243
+ }
244
+ }
245
+ }
246
+ }
247
+
248
+ main();
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@indah_sekar/os-t",
3
+ "version": "1.0.0",
4
+ "description": "Quick troubleshooting commands for Windows, Linux & macOS. CLI tool + web app.",
5
+ "keywords": [
6
+ "troubleshooting",
7
+ "windows",
8
+ "linux",
9
+ "macos",
10
+ "commands",
11
+ "cli",
12
+ "system-admin",
13
+ "network",
14
+ "diagnostics"
15
+ ],
16
+ "homepage": "https://github.com/indah0503/os-t#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/indah0503/os-t/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/indah0503/os-t.git"
23
+ },
24
+ "license": "MIT",
25
+ "author": "indah sekar",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": "./src/data/commands.json",
29
+ "./data": "./src/data/commands.json"
30
+ },
31
+ "main": "./src/data/commands.json",
32
+ "bin": {
33
+ "os-troubleshooter": "bin/cli.js"
34
+ },
35
+ "files": [
36
+ "bin/",
37
+ "src/data/commands.json",
38
+ "src/data/commands.js"
39
+ ],
40
+ "scripts": {
41
+ "dev": "vite",
42
+ "build": "vite build",
43
+ "start": "node server.js",
44
+ "lint": "oxlint",
45
+ "preview": "vite preview"
46
+ },
47
+ "dependencies": {
48
+ "react": "^19.2.7",
49
+ "react-dom": "^19.2.7"
50
+ },
51
+ "devDependencies": {
52
+ "@types/react": "^19.2.17",
53
+ "@types/react-dom": "^19.2.3",
54
+ "@vitejs/plugin-react": "^6.0.3",
55
+ "oxlint": "^1.71.0",
56
+ "vite": "^8.1.1"
57
+ }
58
+ }