@xaidenlabs/uso 1.1.82 → 1.1.84
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 +1 -1
- package/package.json +41 -41
- package/src/commands/uninstall.js +0 -127
- package/src/platforms/wsl.js +0 -49
package/bin/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xaidenlabs/uso",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Universal Solana Development Toolchain. Native or Stealth WSL Mode. Build, test, and deploy without the friction.",
|
|
5
|
-
"bin": {
|
|
6
|
-
"uso": "bin/index.js"
|
|
7
|
-
},
|
|
8
|
-
"files": [
|
|
9
|
-
"bin",
|
|
10
|
-
"src",
|
|
11
|
-
"templates",
|
|
12
|
-
"anchor_program",
|
|
13
|
-
"anchor_project/Anchor.toml",
|
|
14
|
-
"anchor_project/package.json",
|
|
15
|
-
"anchor_project/tsconfig.json",
|
|
16
|
-
"anchor_project/programs/uso_verifier/Cargo.toml",
|
|
17
|
-
"anchor_project/programs/uso_verifier/src",
|
|
18
|
-
"anchor_project/tests"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"solana",
|
|
25
|
-
"anchor",
|
|
26
|
-
"web3",
|
|
27
|
-
"rust",
|
|
28
|
-
"install",
|
|
29
|
-
"setup",
|
|
30
|
-
"developer-tools"
|
|
31
|
-
],
|
|
32
|
-
"author": "Xaiden Labs",
|
|
33
|
-
"license": "ISC",
|
|
34
|
-
"type": "commonjs",
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"chalk": "^4.1.2",
|
|
37
|
-
"commander": "^14.0.3",
|
|
38
|
-
"ora": "^5.4.1",
|
|
39
|
-
"shelljs": "^0.10.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xaidenlabs/uso",
|
|
3
|
+
"version": "1.1.84",
|
|
4
|
+
"description": "Universal Solana Development Toolchain. Native or Stealth WSL Mode. Build, test, and deploy without the friction.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"uso": "bin/index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"src",
|
|
11
|
+
"templates",
|
|
12
|
+
"anchor_program",
|
|
13
|
+
"anchor_project/Anchor.toml",
|
|
14
|
+
"anchor_project/package.json",
|
|
15
|
+
"anchor_project/tsconfig.json",
|
|
16
|
+
"anchor_project/programs/uso_verifier/Cargo.toml",
|
|
17
|
+
"anchor_project/programs/uso_verifier/src",
|
|
18
|
+
"anchor_project/tests"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"solana",
|
|
25
|
+
"anchor",
|
|
26
|
+
"web3",
|
|
27
|
+
"rust",
|
|
28
|
+
"install",
|
|
29
|
+
"setup",
|
|
30
|
+
"developer-tools"
|
|
31
|
+
],
|
|
32
|
+
"author": "Xaiden Labs",
|
|
33
|
+
"license": "ISC",
|
|
34
|
+
"type": "commonjs",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"chalk": "^4.1.2",
|
|
37
|
+
"commander": "^14.0.3",
|
|
38
|
+
"ora": "^5.4.1",
|
|
39
|
+
"shelljs": "^0.10.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -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
|
|
package/src/platforms/wsl.js
CHANGED
|
@@ -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,8 +40,6 @@ run_with_progress() {
|
|
|
41
40
|
return "$status"
|
|
42
41
|
}
|
|
43
42
|
`.replace(/\r\n/g, "\n");
|
|
44
|
-
=======
|
|
45
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
46
43
|
|
|
47
44
|
/**
|
|
48
45
|
* Installs the WSL Windows Feature via an elevated PowerShell UAC prompt.
|
|
@@ -108,13 +105,9 @@ const installWsl = async () => {
|
|
|
108
105
|
// 2. Install Ubuntu silently (Branded as Uso Engine)
|
|
109
106
|
// We use 'wsl -d Ubuntu -e true' to check if it's installed and runnable.
|
|
110
107
|
// 'wsl -l -v' output is notoriously unreliable due to charset encoding (UTF-16) on Windows.
|
|
111
|
-
<<<<<<< HEAD
|
|
112
108
|
const checkDistro = shell.exec(`wsl -d ${WSL_DISTRO} -e true`, {
|
|
113
109
|
silent: true,
|
|
114
110
|
});
|
|
115
|
-
=======
|
|
116
|
-
const checkDistro = shell.exec("wsl -d Ubuntu -e true", { silent: true });
|
|
117
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
118
111
|
|
|
119
112
|
// If exit code is 0, it's installed and working.
|
|
120
113
|
if (checkDistro.code !== 0) {
|
|
@@ -132,14 +125,10 @@ const installWsl = async () => {
|
|
|
132
125
|
};
|
|
133
126
|
|
|
134
127
|
// Attempt 1: Standard Install
|
|
135
|
-
<<<<<<< HEAD
|
|
136
128
|
let success = tryInstall(
|
|
137
129
|
["--install", "-d", WSL_DISTRO],
|
|
138
130
|
"Standard Install",
|
|
139
131
|
);
|
|
140
|
-
=======
|
|
141
|
-
let success = tryInstall(["--install", "-d", "Ubuntu"], "Standard Install");
|
|
142
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
143
132
|
|
|
144
133
|
// Attempt 2: Update WSL Kernel (Fixes network/protocol issues)
|
|
145
134
|
if (!success) {
|
|
@@ -148,11 +137,7 @@ const installWsl = async () => {
|
|
|
148
137
|
);
|
|
149
138
|
spawnSync("wsl", ["--update"], { stdio: "inherit", shell: false });
|
|
150
139
|
success = tryInstall(
|
|
151
|
-
<<<<<<< HEAD
|
|
152
140
|
["--install", "-d", WSL_DISTRO],
|
|
153
|
-
=======
|
|
154
|
-
["--install", "-d", "Ubuntu"],
|
|
155
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
156
141
|
"Install after Update",
|
|
157
142
|
);
|
|
158
143
|
}
|
|
@@ -161,11 +146,7 @@ const installWsl = async () => {
|
|
|
161
146
|
if (!success) {
|
|
162
147
|
log.warn("⚠️ Still failing. Trying --web-download (Bypasses Store)...");
|
|
163
148
|
success = tryInstall(
|
|
164
|
-
<<<<<<< HEAD
|
|
165
149
|
["--install", "-d", WSL_DISTRO, "--web-download"],
|
|
166
|
-
=======
|
|
167
|
-
["--install", "-d", "Ubuntu", "--web-download"],
|
|
168
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
169
150
|
"Web Download Install",
|
|
170
151
|
);
|
|
171
152
|
}
|
|
@@ -178,18 +159,13 @@ const installWsl = async () => {
|
|
|
178
159
|
"\n👉 ACTION REQUIRED: Run this command manually in PowerShell as Administrator:",
|
|
179
160
|
);
|
|
180
161
|
console.log(
|
|
181
|
-
<<<<<<< HEAD
|
|
182
162
|
chalk.bold.yellow(` wsl --install -d ${WSL_DISTRO} --web-download`),
|
|
183
|
-
=======
|
|
184
|
-
chalk.bold.yellow(" wsl --install -d Ubuntu --web-download"),
|
|
185
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
186
163
|
);
|
|
187
164
|
log.warn(
|
|
188
165
|
"\nOnce that completes successfully, run 'uso setup --wsl' again.",
|
|
189
166
|
);
|
|
190
167
|
return false;
|
|
191
168
|
}
|
|
192
|
-
<<<<<<< HEAD
|
|
193
169
|
|
|
194
170
|
const verifyInstall = shell.exec(`wsl -d ${WSL_DISTRO} -e true`, {
|
|
195
171
|
silent: true,
|
|
@@ -215,19 +191,6 @@ const installWsl = async () => {
|
|
|
215
191
|
// 3. Configure Internal Environment (Rust + Solana + Anchor)
|
|
216
192
|
// We create a shell script and run it inside WSL.
|
|
217
193
|
|
|
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
194
|
log.info("⚙️ Initializing Uso Engine environment...");
|
|
232
195
|
|
|
233
196
|
// --- PHASE 1: System Dependencies (as root, no sudo needed) ---
|
|
@@ -252,11 +215,7 @@ fi
|
|
|
252
215
|
|
|
253
216
|
const spin1 = spinner("Phase 1/2: Installing system dependencies...").start();
|
|
254
217
|
const rootRes = shell.exec(
|
|
255
|
-
<<<<<<< HEAD
|
|
256
218
|
`wsl -d ${WSL_DISTRO} -u root -e bash "${wslRootScriptPath}"`,
|
|
257
|
-
=======
|
|
258
|
-
`wsl -d Ubuntu -u root -e bash "${wslRootScriptPath}"`,
|
|
259
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
260
219
|
);
|
|
261
220
|
fs.unlinkSync(rootScriptPath);
|
|
262
221
|
|
|
@@ -456,13 +415,9 @@ fi
|
|
|
456
415
|
const spin2 = spinner(
|
|
457
416
|
"Phase 2/2: Installing Rust, Solana, Anchor (this takes a while)...",
|
|
458
417
|
).start();
|
|
459
|
-
<<<<<<< HEAD
|
|
460
418
|
const userRes = shell.exec(
|
|
461
419
|
`wsl -d ${WSL_DISTRO} -e bash "${wslUserScriptPath}"`,
|
|
462
420
|
);
|
|
463
|
-
=======
|
|
464
|
-
const userRes = shell.exec(`wsl -d Ubuntu -e bash "${wslUserScriptPath}"`);
|
|
465
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
466
421
|
fs.unlinkSync(userScriptPath);
|
|
467
422
|
|
|
468
423
|
if (userRes.code === 0) {
|
|
@@ -474,11 +429,7 @@ fi
|
|
|
474
429
|
|
|
475
430
|
// Always set stealth mode config — even partial setup enables routing
|
|
476
431
|
const configPath = path.join(os.homedir(), ".uso-config.json");
|
|
477
|
-
<<<<<<< HEAD
|
|
478
432
|
const config = { mode: "wsl", distro: WSL_DISTRO };
|
|
479
|
-
=======
|
|
480
|
-
const config = { mode: "wsl", distro: "Ubuntu" };
|
|
481
|
-
>>>>>>> d47ca156cb2a252419c54c520c7fcd0f0c18c525
|
|
482
433
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
483
434
|
|
|
484
435
|
log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
|