@xaidenlabs/uso 1.1.67 → 1.1.68
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/package.json +36 -36
- package/src/commands/doctor.js +202 -126
- package/src/commands/uninstall.js +374 -199
- package/src/commands/workflow.js +443 -356
- package/src/platforms/linux.js +1 -1
- package/src/platforms/wsl.js +286 -195
package/src/platforms/linux.js
CHANGED
package/src/platforms/wsl.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
const shell = require(
|
|
2
|
-
const { log, spinner } = require(
|
|
3
|
-
const { isWslInstalled, runWsl, toWslPath } = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const fs = require(
|
|
6
|
-
const os = require(
|
|
7
|
-
const { spawnSync } = require(
|
|
8
|
-
const chalk = require(
|
|
1
|
+
const shell = require("shelljs");
|
|
2
|
+
const { log, spinner } = require("../utils/logger");
|
|
3
|
+
const { isWslInstalled, runWsl, toWslPath } = require("../utils/wsl-bridge");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const { spawnSync } = require("child_process");
|
|
8
|
+
const chalk = require("chalk");
|
|
9
|
+
const WSL_DISTRO = "Ubuntu";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Installs the WSL Windows Feature via an elevated PowerShell UAC prompt.
|
|
@@ -13,107 +14,156 @@ const chalk = require('chalk');
|
|
|
13
14
|
* Returns true if WSL is now available after the attempt, false otherwise.
|
|
14
15
|
*/
|
|
15
16
|
const installWslFeature = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
log.warn(
|
|
18
|
+
"⚠️ WSL (Windows Subsystem for Linux) is not installed on this machine.",
|
|
19
|
+
);
|
|
20
|
+
log.info("🛡️ Administrator permission is required to install WSL.");
|
|
21
|
+
log.info(
|
|
22
|
+
"👉 A UAC (User Account Control) popup will appear — please click 'Yes' to allow the installation.",
|
|
23
|
+
);
|
|
24
|
+
console.log("");
|
|
25
|
+
|
|
26
|
+
// Run `wsl --install --no-distribution` elevated.
|
|
27
|
+
// --no-distribution: only enables the WSL feature, does not pull a distro yet.
|
|
28
|
+
// We wait for it to finish (-Wait) so we can check the result.
|
|
29
|
+
const elevateCmd = `powershell -Command "Start-Process -FilePath 'wsl.exe' -ArgumentList '--install', '--no-distribution' -Verb RunAs -Wait"`;
|
|
30
|
+
const result = shell.exec(elevateCmd, { silent: false });
|
|
31
|
+
|
|
32
|
+
if (result.code !== 0) {
|
|
33
|
+
// User likely denied UAC or the command failed
|
|
34
|
+
log.error("❌ WSL installation was cancelled or failed.");
|
|
35
|
+
log.warn(
|
|
36
|
+
"👉 To install manually, open PowerShell as Administrator and run:",
|
|
37
|
+
);
|
|
38
|
+
console.log(chalk.bold.yellow(" wsl --install"));
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Verify wsl is now available
|
|
43
|
+
const check = shell.exec("wsl --status", { silent: true });
|
|
44
|
+
if (check.code !== 0) {
|
|
45
|
+
// WSL was just installed — a reboot is almost certainly required
|
|
46
|
+
log.warn(
|
|
47
|
+
"⚠️ WSL feature has been installed, but a system restart is required to complete setup.",
|
|
48
|
+
);
|
|
49
|
+
log.warn(
|
|
50
|
+
"👉 Please RESTART your computer, then run `uso install` again to set up the toolchain.",
|
|
51
|
+
);
|
|
52
|
+
return false; // Signal caller that we need a restart before proceeding
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
log.success("✅ WSL feature installed successfully.");
|
|
56
|
+
return true;
|
|
46
57
|
};
|
|
47
58
|
|
|
48
59
|
const installWsl = async () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
log.header("🐧 Configuring Stealth WSL Environment...");
|
|
61
|
+
|
|
62
|
+
// 1. Check if WSL is enabled
|
|
63
|
+
if (!shell.which("wsl")) {
|
|
64
|
+
log.error("❌ WSL is not enabled on this Windows machine.");
|
|
65
|
+
log.warn(
|
|
66
|
+
"👉 Please enable 'Windows Subsystem for Linux' in 'Turn Windows features on or off'.",
|
|
67
|
+
);
|
|
68
|
+
log.warn("👉 Or run this in PowerShell as Admin: wsl --install");
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 2. Install Ubuntu silently (Branded as Uso Engine)
|
|
73
|
+
// We use 'wsl -d Ubuntu -e true' to check if it's installed and runnable.
|
|
74
|
+
// 'wsl -l -v' output is notoriously unreliable due to charset encoding (UTF-16) on Windows.
|
|
75
|
+
const checkDistro = shell.exec(`wsl -d ${WSL_DISTRO} -e true`, {
|
|
76
|
+
silent: true,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// If exit code is 0, it's installed and working.
|
|
80
|
+
if (checkDistro.code !== 0) {
|
|
81
|
+
log.info(
|
|
82
|
+
"📦 Configuring Uso Engine (Please approve UAC prompt if asked)...",
|
|
83
|
+
);
|
|
84
|
+
log.warn("⏳ This may take a few minutes (Downloading ~500MB)...");
|
|
85
|
+
|
|
86
|
+
// Helper to try install commands
|
|
87
|
+
const tryInstall = (args, description) => {
|
|
88
|
+
log.info(`👉 Attempting: ${description}...`);
|
|
89
|
+
// Fix Deprecation: shell: false is safer and prevents warning
|
|
90
|
+
const proc = spawnSync("wsl", args, { stdio: "inherit", shell: false });
|
|
91
|
+
return proc.status === 0;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Attempt 1: Standard Install
|
|
95
|
+
let success = tryInstall(
|
|
96
|
+
["--install", "-d", WSL_DISTRO],
|
|
97
|
+
"Standard Install",
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// Attempt 2: Update WSL Kernel (Fixes network/protocol issues)
|
|
101
|
+
if (!success) {
|
|
102
|
+
log.warn(
|
|
103
|
+
"⚠️ Standard install failed. Attempting to update WSL kernel...",
|
|
104
|
+
);
|
|
105
|
+
spawnSync("wsl", ["--update"], { stdio: "inherit", shell: false });
|
|
106
|
+
success = tryInstall(
|
|
107
|
+
["--install", "-d", WSL_DISTRO],
|
|
108
|
+
"Install after Update",
|
|
109
|
+
);
|
|
57
110
|
}
|
|
58
111
|
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
log.warn("⏳ This may take a few minutes (Downloading ~500MB)...");
|
|
68
|
-
|
|
69
|
-
// Helper to try install commands
|
|
70
|
-
const tryInstall = (args, description) => {
|
|
71
|
-
log.info(`👉 Attempting: ${description}...`);
|
|
72
|
-
// Fix Deprecation: shell: false is safer and prevents warning
|
|
73
|
-
const proc = spawnSync('wsl', args, { stdio: 'inherit', shell: false });
|
|
74
|
-
return proc.status === 0;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// Attempt 1: Standard Install
|
|
78
|
-
let success = tryInstall(['--install', '-d', 'Ubuntu'], 'Standard Install');
|
|
79
|
-
|
|
80
|
-
// Attempt 2: Update WSL Kernel (Fixes network/protocol issues)
|
|
81
|
-
if (!success) {
|
|
82
|
-
log.warn("⚠️ Standard install failed. Attempting to update WSL kernel...");
|
|
83
|
-
spawnSync('wsl', ['--update'], { stdio: 'inherit', shell: false });
|
|
84
|
-
success = tryInstall(['--install', '-d', 'Ubuntu'], 'Install after Update');
|
|
85
|
-
}
|
|
112
|
+
// Attempt 3: Web Download (Bypasses Microsoft Store blocks)
|
|
113
|
+
if (!success) {
|
|
114
|
+
log.warn("⚠️ Still failing. Trying --web-download (Bypasses Store)...");
|
|
115
|
+
success = tryInstall(
|
|
116
|
+
["--install", "-d", WSL_DISTRO, "--web-download"],
|
|
117
|
+
"Web Download Install",
|
|
118
|
+
);
|
|
119
|
+
}
|
|
86
120
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
121
|
+
// Final Failure Handler
|
|
122
|
+
if (!success) {
|
|
123
|
+
log.error("❌ Failed to configure Uso Engine.");
|
|
124
|
+
log.error("🛑 Possible Causes: Internet Timeout, Firewall, or VPN.");
|
|
125
|
+
log.warn(
|
|
126
|
+
"\n👉 ACTION REQUIRED: Run this command manually in PowerShell as Administrator:",
|
|
127
|
+
);
|
|
128
|
+
console.log(
|
|
129
|
+
chalk.bold.yellow(
|
|
130
|
+
` wsl --install -d ${WSL_DISTRO} --web-download`,
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
log.warn(
|
|
134
|
+
"\nOnce that completes successfully, run 'uso setup --wsl' again.",
|
|
135
|
+
);
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
92
138
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
log.success("✅ Uso Engine is ready.");
|
|
139
|
+
const verifyInstall = shell.exec(`wsl -d ${WSL_DISTRO} -e true`, {
|
|
140
|
+
silent: true,
|
|
141
|
+
});
|
|
142
|
+
if (verifyInstall.code !== 0) {
|
|
143
|
+
log.warn(
|
|
144
|
+
`⚠️ ${WSL_DISTRO} is not ready yet. WSL installation usually needs a full system reboot before the distro becomes available.`,
|
|
145
|
+
);
|
|
146
|
+
log.warn(
|
|
147
|
+
"👉 Restart Windows, then run 'uso install' again to continue the setup.",
|
|
148
|
+
);
|
|
149
|
+
return false;
|
|
105
150
|
}
|
|
106
151
|
|
|
107
|
-
|
|
108
|
-
|
|
152
|
+
log.success("✅ Uso Engine configured.");
|
|
153
|
+
} else {
|
|
154
|
+
log.success("✅ Uso Engine is ready.");
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 2.5 Hide from Windows Terminal (Stealth Mode)
|
|
158
|
+
hideFromWindowsTerminal();
|
|
109
159
|
|
|
110
|
-
|
|
111
|
-
|
|
160
|
+
// 3. Configure Internal Environment (Rust + Solana + Anchor)
|
|
161
|
+
// We create a shell script and run it inside WSL.
|
|
112
162
|
|
|
113
|
-
|
|
163
|
+
log.info("⚙️ Initializing Uso Engine environment...");
|
|
114
164
|
|
|
115
|
-
|
|
116
|
-
|
|
165
|
+
// --- PHASE 1: System Dependencies (as root, no sudo needed) ---
|
|
166
|
+
const rootScript = `
|
|
117
167
|
#!/bin/bash
|
|
118
168
|
set -e
|
|
119
169
|
export DEBIAN_FRONTEND=noninteractive
|
|
@@ -126,25 +176,27 @@ if ! command -v cc &> /dev/null || ! command -v pkg-config &> /dev/null; then
|
|
|
126
176
|
else
|
|
127
177
|
echo "✅ Build tools already present."
|
|
128
178
|
fi
|
|
129
|
-
`.replace(/\r\n/g,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
179
|
+
`.replace(/\r\n/g, "\n");
|
|
180
|
+
|
|
181
|
+
const rootScriptPath = path.join(process.cwd(), "uso_root_setup.sh");
|
|
182
|
+
fs.writeFileSync(rootScriptPath, rootScript);
|
|
183
|
+
const wslRootScriptPath = toWslPath(rootScriptPath);
|
|
184
|
+
|
|
185
|
+
const spin1 = spinner("Phase 1/2: Installing system dependencies...").start();
|
|
186
|
+
const rootRes = shell.exec(
|
|
187
|
+
`wsl -d ${WSL_DISTRO} -u root -e bash "${wslRootScriptPath}"`,
|
|
188
|
+
);
|
|
189
|
+
fs.unlinkSync(rootScriptPath);
|
|
190
|
+
|
|
191
|
+
if (rootRes.code !== 0) {
|
|
192
|
+
spin1.fail("System dependency installation failed.");
|
|
193
|
+
log.error(rootRes.stderr || "Unknown error during root setup.");
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
spin1.succeed("System dependencies ready.");
|
|
197
|
+
|
|
198
|
+
// --- PHASE 2: User Tools (Rust, Solana, Anchor as normal user) ---
|
|
199
|
+
const userScript = `
|
|
148
200
|
#!/bin/bash
|
|
149
201
|
# NO set -e — we handle errors per-step
|
|
150
202
|
FAILURES=""
|
|
@@ -154,17 +206,41 @@ touch ~/.hushlogin
|
|
|
154
206
|
|
|
155
207
|
# --- Rust ---
|
|
156
208
|
source $HOME/.cargo/env 2>/dev/null || true
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
209
|
+
|
|
210
|
+
# rustc can exist but still fail if component/toolchain is broken.
|
|
211
|
+
if command -v rustc &> /dev/null && rustc --version >/dev/null 2>&1; then
|
|
212
|
+
echo "✅ Rust already installed."
|
|
213
|
+
else
|
|
214
|
+
# If rustup exists, try repairing first.
|
|
215
|
+
if command -v rustup &> /dev/null; then
|
|
216
|
+
echo "🦀 Repairing Rust toolchain..."
|
|
217
|
+
rustup toolchain install stable >/dev/null 2>&1 || true
|
|
218
|
+
rustup default stable >/dev/null 2>&1 || true
|
|
219
|
+
rustup component add rustc cargo >/dev/null 2>&1 || true
|
|
160
220
|
source $HOME/.cargo/env 2>/dev/null || true
|
|
161
|
-
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
if command -v rustc &> /dev/null && rustc --version >/dev/null 2>&1; then
|
|
224
|
+
echo "✅ Rust repaired."
|
|
162
225
|
else
|
|
163
|
-
|
|
164
|
-
|
|
226
|
+
echo "🦀 Installing Rust..."
|
|
227
|
+
if curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; then
|
|
228
|
+
source $HOME/.cargo/env 2>/dev/null || true
|
|
229
|
+
rustup toolchain install stable >/dev/null 2>&1 || true
|
|
230
|
+
rustup default stable >/dev/null 2>&1 || true
|
|
231
|
+
rustup component add rustc cargo >/dev/null 2>&1 || true
|
|
232
|
+
|
|
233
|
+
if command -v rustc &> /dev/null && rustc --version >/dev/null 2>&1; then
|
|
234
|
+
echo "✅ Rust installed."
|
|
235
|
+
else
|
|
236
|
+
FAILURES="$FAILURES rust"
|
|
237
|
+
echo "❌ Rust install completed but rustc is not runnable."
|
|
238
|
+
fi
|
|
239
|
+
else
|
|
240
|
+
FAILURES="$FAILURES rust"
|
|
241
|
+
echo "❌ Rust installation failed."
|
|
242
|
+
fi
|
|
165
243
|
fi
|
|
166
|
-
else
|
|
167
|
-
echo "✅ Rust already installed."
|
|
168
244
|
fi
|
|
169
245
|
source $HOME/.cargo/env 2>/dev/null || true
|
|
170
246
|
|
|
@@ -231,83 +307,98 @@ else
|
|
|
231
307
|
echo "Run 'uso setup' again to retry failed components."
|
|
232
308
|
exit 1
|
|
233
309
|
fi
|
|
234
|
-
`.replace(/\r\n/g,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
310
|
+
`.replace(/\r\n/g, "\n");
|
|
311
|
+
|
|
312
|
+
const userScriptPath = path.join(process.cwd(), "uso_user_setup.sh");
|
|
313
|
+
fs.writeFileSync(userScriptPath, userScript);
|
|
314
|
+
const wslUserScriptPath = toWslPath(userScriptPath);
|
|
315
|
+
|
|
316
|
+
const spin2 = spinner(
|
|
317
|
+
"Phase 2/2: Installing Rust, Solana, Anchor (this takes a while)...",
|
|
318
|
+
).start();
|
|
319
|
+
const userRes = shell.exec(`wsl -d ${WSL_DISTRO} -e bash "${wslUserScriptPath}"`);
|
|
320
|
+
fs.unlinkSync(userScriptPath);
|
|
321
|
+
|
|
322
|
+
if (userRes.code === 0) {
|
|
323
|
+
spin2.succeed("Uso Engine configured successfully.");
|
|
324
|
+
} else {
|
|
325
|
+
spin2.warn("Uso Engine partially configured (some downloads timed out).");
|
|
326
|
+
log.info("👉 Run 'uso setup' again to retry failed components.");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Always set stealth mode config — even partial setup enables routing
|
|
330
|
+
const configPath = path.join(os.homedir(), ".uso-config.json");
|
|
331
|
+
const config = { mode: "wsl", distro: WSL_DISTRO };
|
|
332
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
333
|
+
|
|
334
|
+
log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
|
|
335
|
+
return true;
|
|
258
336
|
};
|
|
259
337
|
|
|
260
338
|
const hideFromWindowsTerminal = () => {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
339
|
+
try {
|
|
340
|
+
const localAppData = process.env.LOCALAPPDATA;
|
|
341
|
+
const packagesPath = path.join(localAppData, "Packages");
|
|
342
|
+
|
|
343
|
+
// Find Windows Terminal package folder (name varies slightly but starts with Microsoft.WindowsTerminal)
|
|
344
|
+
if (!fs.existsSync(packagesPath)) return;
|
|
345
|
+
|
|
346
|
+
const terminalDirs = fs
|
|
347
|
+
.readdirSync(packagesPath)
|
|
348
|
+
.filter((name) => name.startsWith("Microsoft.WindowsTerminal"));
|
|
349
|
+
|
|
350
|
+
if (terminalDirs.length === 0) return;
|
|
351
|
+
|
|
352
|
+
const settingsPath = path.join(
|
|
353
|
+
packagesPath,
|
|
354
|
+
terminalDirs[0],
|
|
355
|
+
"LocalState",
|
|
356
|
+
"settings.json",
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
if (fs.existsSync(settingsPath)) {
|
|
360
|
+
// Read settings
|
|
361
|
+
// Note: settings.json can contain comments which JSON.parse fails on.
|
|
362
|
+
// We'll use a simple regex to set hidden: true for Ubuntu if simpler parsing fails or just try.
|
|
363
|
+
// Actually, modifying this file safely without a robust comment-stripping parser is risky.
|
|
364
|
+
// A safer approach for "Stealth" might be just log that we configured it.
|
|
365
|
+
// BUT, if we want to do it, we should be careful.
|
|
366
|
+
|
|
367
|
+
// For now, let's just log a message that we would hide it,
|
|
368
|
+
// or maybe we skip the robust parsing complexity to avoid breaking their terminal settings.
|
|
369
|
+
// User requested "Programmatically edit".
|
|
370
|
+
|
|
371
|
+
const content = fs.readFileSync(settingsPath, "utf8");
|
|
372
|
+
// Check if Ubuntu is already there
|
|
373
|
+
if (content.includes('"name": "Ubuntu"')) {
|
|
374
|
+
// Very naive replacement to inject hidden: true.
|
|
375
|
+
// We look for the Ubuntu profile block.
|
|
376
|
+
// This is brittle. Let's try to parse if valid JSON.
|
|
377
|
+
try {
|
|
378
|
+
const settings = JSON.parse(content);
|
|
379
|
+
if (settings.profiles && settings.profiles.list) {
|
|
380
|
+
const profile = settings.profiles.list.find(
|
|
381
|
+
(p) => p.name === "Ubuntu",
|
|
382
|
+
);
|
|
383
|
+
if (profile) {
|
|
384
|
+
profile.hidden = true;
|
|
385
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 4));
|
|
386
|
+
log.info(
|
|
387
|
+
"🕵️ Hid 'Ubuntu' from Windows Terminal (Stealth Mode Active).",
|
|
388
|
+
);
|
|
306
389
|
}
|
|
390
|
+
}
|
|
391
|
+
} catch (e) {
|
|
392
|
+
// JSON parse failed (likely due to comments in settings.json)
|
|
393
|
+
log.warn(
|
|
394
|
+
"⚠️ Could not automatically hide Ubuntu icon (Comments in settings.json).",
|
|
395
|
+
);
|
|
307
396
|
}
|
|
308
|
-
|
|
309
|
-
// Silently fail to avoid alarming user
|
|
397
|
+
}
|
|
310
398
|
}
|
|
399
|
+
} catch (e) {
|
|
400
|
+
// Silently fail to avoid alarming user
|
|
401
|
+
}
|
|
311
402
|
};
|
|
312
403
|
|
|
313
404
|
module.exports = { installWslFeature, installWsl };
|