@xaidenlabs/uso 1.1.82 → 1.1.83

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/bin/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  const { program } = require('commander');
3
3
  const { init } = require('../src/commands/init');
4
4
  const { doctor } = require('../src/commands/doctor');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaidenlabs/uso",
3
- "version": "1.1.82",
3
+ "version": "1.1.83",
4
4
  "description": "Universal Solana Development Toolchain. Native or Stealth WSL Mode. Build, test, and deploy without the friction.",
5
5
  "bin": {
6
6
  "uso": "bin/index.js"
@@ -45,7 +45,6 @@ const commandExists = (command, stealth) => {
45
45
  const wslPathExists = (wslPath, stealth) => {
46
46
  const result = runInStealth(`[ -e "${wslPath}" ]`, stealth, true);
47
47
  return result.code === 0;
48
- <<<<<<< HEAD
49
48
  };
50
49
 
51
50
  const getInstalledAvmVersions = (stealth) => {
@@ -101,118 +100,6 @@ const uninstallAnchorComponents = (stealth) => {
101
100
  }
102
101
 
103
102
  log.success("Anchor removal steps completed.");
104
- =======
105
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
106
- };
107
-
108
- /**
109
- * Runs a command and attempts to elevate privileges if it fails with a permission error.
110
- */
111
- const runOrElevate = (
112
- command,
113
- description,
114
- stealth = { enabled: false, distro: "Ubuntu" },
115
- ) => {
116
- if (stealth.enabled) {
117
- const result = runInStealth(command, stealth, true);
118
-
119
- if (result.code === 0) {
120
- if (result.stdout) console.log(result.stdout);
121
- return true;
122
- }
123
-
124
- if (result.stdout) console.log(result.stdout);
125
- if (result.stderr) console.error(result.stderr);
126
- log.error(`❌ Command failed in WSL: ${description}`);
127
- return false;
128
- }
129
-
130
- // We run without silent:true initially to let the user see output,
131
- // but detecting the error code is what matters.
132
- // actually, to detect the specific string "os error 1314", we need to capture output.
133
- // So we run silently first? Or we just run and if it fails, we assume it *might* be elevation if on Windows?
134
- // Let's run synchronously and capture output.
135
-
136
- const result = shell.exec(command, { silent: true });
137
-
138
- if (result.code === 0) {
139
- console.log(result.stdout);
140
- return true;
141
- }
142
-
143
- // Print the error output to the user
144
- console.log(result.stdout);
145
- console.error(result.stderr);
146
-
147
- const output = result.stderr + result.stdout;
148
-
149
- // Check for common permission errors
150
- // "os error 1314" is specific to Windows symlink privilege
151
- if (
152
- (output.includes("os error 1314") ||
153
- output.includes("EPERM") ||
154
- output.includes("permission denied")) &&
155
- os.platform() === "win32"
156
- ) {
157
- log.warn(`⚠️ Permission denied during: ${description}`);
158
- log.info("🛡️ Triggering Run as Administrator (UAC) to retry...");
159
-
160
- // Construct PowerShell command to run cmd /c <command> as admin
161
- // We need to be careful with quoting.
162
- const escapedCommand = command.replace(/'/g, "''"); // Basic PowerShell escaping for single quotes
163
- const elevateCmd = `powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c ${escapedCommand}' -Verb RunAs -Wait"`;
164
-
165
- const elevatedRun = shell.exec(elevateCmd);
166
-
167
- if (elevatedRun.code === 0) {
168
- log.success(`✅ ${description} completed (Elevated).`);
169
- return true;
170
- } else {
171
- log.error(`❌ Elevated execution failed for: ${description}`);
172
- return false;
173
- }
174
- }
175
-
176
- log.error(`❌ Command failed: ${description}`);
177
- return false;
178
- };
179
-
180
- const uninstall = async (component) => {
181
- const stealth = getStealthContext();
182
- log.header("🗑️ USO Uninstallation & Cleanup");
183
- if (stealth.enabled) {
184
- log.info(
185
- `🐧 Stealth Mode detected. Uninstall targets WSL distro: ${stealth.distro}`,
186
- );
187
- }
188
-
189
- if (component) {
190
- component = component.toLowerCase();
191
- log.info(`🎯 Targeted uninstallation: ${component}`);
192
-
193
- if (component === "anchor") {
194
- const anchorInstalled = commandExists("anchor", stealth);
195
- if (anchorInstalled) {
196
- log.info("Removing Anchor...");
197
- <<<<<<< HEAD
198
- uninstallAnchorComponents(stealth);
199
- =======
200
- // Try avm uninstall first if available
201
- if (commandExists("avm", stealth)) {
202
- runOrElevate(
203
- "avm uninstall latest",
204
- "Uninstall Anchor (AVM)",
205
- stealth,
206
- );
207
- }
208
- runOrElevate(
209
- "cargo uninstall anchor-cli",
210
- "Uninstall anchor-cli",
211
- stealth,
212
- );
213
- runOrElevate("cargo uninstall avm", "Uninstall avm", stealth);
214
- log.success("Anchor removal steps completed.");
215
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
216
103
  } else {
217
104
  log.success("✅ Anchor is not installed.");
218
105
  }
@@ -315,21 +202,7 @@ const uninstall = async (component) => {
315
202
  );
316
203
  if (removeAnchor.toLowerCase() === "y") {
317
204
  log.info("Removing Anchor...");
318
- <<<<<<< HEAD
319
205
  uninstallAnchorComponents(stealth);
320
- =======
321
- // Try avm uninstall first if available
322
- if (commandExists("avm", stealth)) {
323
- runOrElevate("avm uninstall latest", "Uninstall Anchor (AVM)", stealth);
324
- }
325
- runOrElevate(
326
- "cargo uninstall anchor-cli",
327
- "Uninstall anchor-cli",
328
- stealth,
329
- );
330
- runOrElevate("cargo uninstall avm", "Uninstall avm", stealth);
331
- log.success("Anchor removal steps completed.");
332
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
333
206
  }
334
207
  }
335
208
 
@@ -6,7 +6,6 @@ const fs = require("fs");
6
6
  const os = require("os");
7
7
  const { spawnSync } = require("child_process");
8
8
  const chalk = require("chalk");
9
- <<<<<<< HEAD
10
9
  const WSL_DISTRO = "Ubuntu";
11
10
 
12
11
  const progressHelpers = `
@@ -41,80 +40,6 @@ run_with_progress() {
41
40
  return "$status"
42
41
  }
43
42
  `.replace(/\r\n/g, "\n");
44
- =======
45
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
46
-
47
- /**
48
- * Installs the WSL Windows Feature via an elevated PowerShell UAC prompt.
49
- * This is needed when `wsl.exe` is not present on the system at all.
50
- * Returns true if WSL is now available after the attempt, false otherwise.
51
- */
52
- const installWslFeature = async () => {
53
- log.warn(
54
- "⚠️ WSL (Windows Subsystem for Linux) is not installed on this machine.",
55
- );
56
- log.info("🛡️ Administrator permission is required to install WSL.");
57
- log.info(
58
- "👉 A UAC (User Account Control) popup will appear — please click 'Yes' to allow the installation.",
59
- );
60
- console.log("");
61
-
62
- // Run `wsl --install --no-distribution` elevated.
63
- // --no-distribution: only enables the WSL feature, does not pull a distro yet.
64
- // We wait for it to finish (-Wait) so we can check the result.
65
- const elevateCmd = `powershell -Command "Start-Process -FilePath 'wsl.exe' -ArgumentList '--install', '--no-distribution' -Verb RunAs -Wait"`;
66
- const result = shell.exec(elevateCmd, { silent: false });
67
-
68
- if (result.code !== 0) {
69
- // User likely denied UAC or the command failed
70
- log.error("❌ WSL installation was cancelled or failed.");
71
- log.warn(
72
- "👉 To install manually, open PowerShell as Administrator and run:",
73
- );
74
- console.log(chalk.bold.yellow(" wsl --install"));
75
- return false;
76
- }
77
-
78
- // Verify wsl is now available
79
- const check = shell.exec("wsl --status", { silent: true });
80
- if (check.code !== 0) {
81
- // WSL was just installed — a reboot is almost certainly required
82
- log.warn(
83
- "⚠️ WSL feature has been installed, but a system restart is required to complete setup.",
84
- );
85
- log.warn(
86
- "👉 Please RESTART your computer, then run `uso install` again to set up the toolchain.",
87
- );
88
- return false; // Signal caller that we need a restart before proceeding
89
- }
90
-
91
- log.success("✅ WSL feature installed successfully.");
92
- return true;
93
- };
94
-
95
- const installWsl = async () => {
96
- log.header("🐧 Configuring Stealth WSL Environment...");
97
-
98
- // 1. Check if WSL is enabled
99
- if (!shell.which("wsl")) {
100
- log.error("❌ WSL is not enabled on this Windows machine.");
101
- log.warn(
102
- "👉 Please enable 'Windows Subsystem for Linux' in 'Turn Windows features on or off'.",
103
- );
104
- log.warn("👉 Or run this in PowerShell as Admin: wsl --install");
105
- return false;
106
- }
107
-
108
- // 2. Install Ubuntu silently (Branded as Uso Engine)
109
- // We use 'wsl -d Ubuntu -e true' to check if it's installed and runnable.
110
- // 'wsl -l -v' output is notoriously unreliable due to charset encoding (UTF-16) on Windows.
111
- <<<<<<< HEAD
112
- const checkDistro = shell.exec(`wsl -d ${WSL_DISTRO} -e true`, {
113
- silent: true,
114
- });
115
- =======
116
- const checkDistro = shell.exec("wsl -d Ubuntu -e true", { silent: true });
117
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
118
43
 
119
44
  // If exit code is 0, it's installed and working.
120
45
  if (checkDistro.code !== 0) {
@@ -132,14 +57,10 @@ const installWsl = async () => {
132
57
  };
133
58
 
134
59
  // Attempt 1: Standard Install
135
- <<<<<<< HEAD
136
60
  let success = tryInstall(
137
61
  ["--install", "-d", WSL_DISTRO],
138
62
  "Standard Install",
139
63
  );
140
- =======
141
- let success = tryInstall(["--install", "-d", "Ubuntu"], "Standard Install");
142
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
143
64
 
144
65
  // Attempt 2: Update WSL Kernel (Fixes network/protocol issues)
145
66
  if (!success) {
@@ -148,11 +69,7 @@ const installWsl = async () => {
148
69
  );
149
70
  spawnSync("wsl", ["--update"], { stdio: "inherit", shell: false });
150
71
  success = tryInstall(
151
- <<<<<<< HEAD
152
72
  ["--install", "-d", WSL_DISTRO],
153
- =======
154
- ["--install", "-d", "Ubuntu"],
155
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
156
73
  "Install after Update",
157
74
  );
158
75
  }
@@ -161,11 +78,7 @@ const installWsl = async () => {
161
78
  if (!success) {
162
79
  log.warn("⚠️ Still failing. Trying --web-download (Bypasses Store)...");
163
80
  success = tryInstall(
164
- <<<<<<< HEAD
165
81
  ["--install", "-d", WSL_DISTRO, "--web-download"],
166
- =======
167
- ["--install", "-d", "Ubuntu", "--web-download"],
168
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
169
82
  "Web Download Install",
170
83
  );
171
84
  }
@@ -178,18 +91,13 @@ const installWsl = async () => {
178
91
  "\n👉 ACTION REQUIRED: Run this command manually in PowerShell as Administrator:",
179
92
  );
180
93
  console.log(
181
- <<<<<<< HEAD
182
94
  chalk.bold.yellow(` wsl --install -d ${WSL_DISTRO} --web-download`),
183
- =======
184
- chalk.bold.yellow(" wsl --install -d Ubuntu --web-download"),
185
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
186
95
  );
187
96
  log.warn(
188
97
  "\nOnce that completes successfully, run 'uso setup --wsl' again.",
189
98
  );
190
99
  return false;
191
100
  }
192
- <<<<<<< HEAD
193
101
 
194
102
  const verifyInstall = shell.exec(`wsl -d ${WSL_DISTRO} -e true`, {
195
103
  silent: true,
@@ -215,19 +123,6 @@ const installWsl = async () => {
215
123
  // 3. Configure Internal Environment (Rust + Solana + Anchor)
216
124
  // We create a shell script and run it inside WSL.
217
125
 
218
- =======
219
- log.success("✅ Uso Engine configured.");
220
- } else {
221
- log.success("✅ Uso Engine is ready.");
222
- }
223
-
224
- // 2.5 Hide from Windows Terminal (Stealth Mode)
225
- hideFromWindowsTerminal();
226
-
227
- // 3. Configure Internal Environment (Rust + Solana + Anchor)
228
- // We create a shell script and run it inside WSL.
229
-
230
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
231
126
  log.info("⚙️ Initializing Uso Engine environment...");
232
127
 
233
128
  // --- PHASE 1: System Dependencies (as root, no sudo needed) ---
@@ -252,11 +147,7 @@ fi
252
147
 
253
148
  const spin1 = spinner("Phase 1/2: Installing system dependencies...").start();
254
149
  const rootRes = shell.exec(
255
- <<<<<<< HEAD
256
150
  `wsl -d ${WSL_DISTRO} -u root -e bash "${wslRootScriptPath}"`,
257
- =======
258
- `wsl -d Ubuntu -u root -e bash "${wslRootScriptPath}"`,
259
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
260
151
  );
261
152
  fs.unlinkSync(rootScriptPath);
262
153
 
@@ -456,13 +347,9 @@ fi
456
347
  const spin2 = spinner(
457
348
  "Phase 2/2: Installing Rust, Solana, Anchor (this takes a while)...",
458
349
  ).start();
459
- <<<<<<< HEAD
460
350
  const userRes = shell.exec(
461
351
  `wsl -d ${WSL_DISTRO} -e bash "${wslUserScriptPath}"`,
462
352
  );
463
- =======
464
- const userRes = shell.exec(`wsl -d Ubuntu -e bash "${wslUserScriptPath}"`);
465
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
466
353
  fs.unlinkSync(userScriptPath);
467
354
 
468
355
  if (userRes.code === 0) {
@@ -474,11 +361,7 @@ fi
474
361
 
475
362
  // Always set stealth mode config — even partial setup enables routing
476
363
  const configPath = path.join(os.homedir(), ".uso-config.json");
477
- <<<<<<< HEAD
478
364
  const config = { mode: "wsl", distro: WSL_DISTRO };
479
- =======
480
- const config = { mode: "wsl", distro: "Ubuntu" };
481
- >>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
482
365
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
483
366
 
484
367
  log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");