@xaidenlabs/uso 1.1.46 β 1.1.49
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 +7 -1
- package/package.json +2 -2
- package/src/commands/workflow.js +52 -0
- package/src/platforms/wsl.js +68 -9
- package/src/utils/stealth.js +25 -0
- package/src/utils/wsl-bridge.js +8 -5
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Universal Solana Orchestrator (USO)
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
**The fastest way to build on Solana.**
|
|
4
|
+
|
|
5
|
+
USO (Universal Solana Orchestrator) is a "Zero-Friction" toolchain that handles the complex setup of Rust, Anchor, and Solana CLIβinstantly.
|
|
6
|
+
|
|
7
|
+
**Native or Stealth Mode? Both.**
|
|
8
|
+
- **Universal:** Runs natively on macOS, Linux, and Windows.
|
|
9
|
+
- **Stealth WSL:** On Windows, USO can deploy a hidden "Uso Engine" (WSL2) to run your build, test, and validator commands in a rock-solid Linux environment, while you stay in PowerShell. No "Access Denied" errors. No friction.
|
|
4
10
|
|
|
5
11
|
This tool is engineered to support developers at all levels, from beginners setting up their first environment to senior engineers managing multiple workstations.
|
|
6
12
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaidenlabs/uso",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Universal Solana
|
|
3
|
+
"version": "1.1.49",
|
|
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"
|
|
7
7
|
},
|
package/src/commands/workflow.js
CHANGED
|
@@ -3,8 +3,32 @@ const os = require('os');
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { log, spinner } = require('../utils/logger');
|
|
6
|
+
const { isStealthMode } = require('../utils/stealth');
|
|
7
|
+
const { runWsl, toWslPath } = require('../utils/wsl-bridge');
|
|
6
8
|
|
|
7
9
|
const runProxyCommand = async (command, args = [], binary = 'anchor') => {
|
|
10
|
+
const stealth = isStealthMode();
|
|
11
|
+
|
|
12
|
+
// --- STEALTH WSL MODE ---
|
|
13
|
+
if (stealth.enabled) {
|
|
14
|
+
const fullCommand = `${binary} ${command} ${args.join(' ')}`;
|
|
15
|
+
log.header(`π Running: ${fullCommand}`);
|
|
16
|
+
log.info(`π§ Routing through Uso Engine...`);
|
|
17
|
+
|
|
18
|
+
// Source cargo/solana paths inside WSL before running
|
|
19
|
+
const envSetup = 'source $HOME/.cargo/env 2>/dev/null; export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"';
|
|
20
|
+
const wslCwd = toWslPath(process.cwd());
|
|
21
|
+
const execution = runWsl(`${envSetup} && ${fullCommand}`, { distro: stealth.distro, cwd: process.cwd() });
|
|
22
|
+
|
|
23
|
+
if (execution.code === 0) {
|
|
24
|
+
log.success(`β
'${command}' completed successfully.`);
|
|
25
|
+
} else {
|
|
26
|
+
log.error(`β '${command}' failed.`);
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// --- NATIVE MODE ---
|
|
8
32
|
// Check if binary is available
|
|
9
33
|
if (!shell.which(binary)) {
|
|
10
34
|
log.error(`β ${binary} is not found in PATH.`);
|
|
@@ -169,6 +193,28 @@ const airdrop = (amount, recipient) => {
|
|
|
169
193
|
};
|
|
170
194
|
|
|
171
195
|
const validator = async (args = []) => {
|
|
196
|
+
const stealth = isStealthMode();
|
|
197
|
+
|
|
198
|
+
// --- STEALTH WSL MODE ---
|
|
199
|
+
if (stealth.enabled) {
|
|
200
|
+
const flags = Array.isArray(args) ? args : [];
|
|
201
|
+
const cmdArgs = flags.join(' ');
|
|
202
|
+
const fullCmd = cmdArgs ? `solana-test-validator ${cmdArgs}` : 'solana-test-validator';
|
|
203
|
+
|
|
204
|
+
log.header(`π Starting Validator via Uso Engine...`);
|
|
205
|
+
log.info(`π§ Running: ${fullCmd}`);
|
|
206
|
+
log.info("π Press Ctrl+C to stop it.");
|
|
207
|
+
|
|
208
|
+
const envSetup = 'source $HOME/.cargo/env 2>/dev/null; export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"';
|
|
209
|
+
runWsl(`${envSetup} && ${fullCmd}`, {
|
|
210
|
+
distro: stealth.distro,
|
|
211
|
+
cwd: process.cwd(),
|
|
212
|
+
execOpts: { async: false }
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// --- NATIVE MODE ---
|
|
172
218
|
if (!shell.which('solana-test-validator')) {
|
|
173
219
|
log.error("β 'solana-test-validator' is not found in PATH.");
|
|
174
220
|
log.warn("π Run 'uso init' to install it.");
|
|
@@ -340,10 +386,16 @@ module.exports = {
|
|
|
340
386
|
};
|
|
341
387
|
|
|
342
388
|
const dev = async () => {
|
|
389
|
+
const stealth = isStealthMode();
|
|
343
390
|
log.header("π Starting Development Environment...");
|
|
344
391
|
|
|
345
392
|
// 1. Check if validator is running
|
|
346
393
|
const isValidatorRunning = () => {
|
|
394
|
+
if (stealth.enabled) {
|
|
395
|
+
// Check from Windows side β validator in WSL still binds to host port
|
|
396
|
+
const res = shell.exec('netstat -an | findstr 8899', { silent: true });
|
|
397
|
+
return res.code === 0 && res.stdout.length > 0;
|
|
398
|
+
}
|
|
347
399
|
const res = shell.exec('netstat -an | findstr 8899', { silent: true });
|
|
348
400
|
return res.code === 0 && res.stdout.length > 0;
|
|
349
401
|
};
|
package/src/platforms/wsl.js
CHANGED
|
@@ -18,11 +18,14 @@ const installWsl = async () => {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// 2. Install Ubuntu silently
|
|
22
|
-
// We
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// 2. Install Ubuntu silently (Branded as Uso Engine)
|
|
22
|
+
// We use 'wsl -d Ubuntu -e true' to check if it's installed and runnable.
|
|
23
|
+
// 'wsl -l -v' output is notoriously unreliable due to charset encoding (UTF-16) on Windows.
|
|
24
|
+
const checkDistro = shell.exec('wsl -d Ubuntu -e true', { silent: true });
|
|
25
|
+
|
|
26
|
+
// If exit code is 0, it's installed and working.
|
|
27
|
+
if (checkDistro.code !== 0) {
|
|
28
|
+
log.info("π¦ Configuring Uso Engine (Please approve UAC prompt if asked)...");
|
|
26
29
|
log.warn("β³ This may take a few minutes (Downloading ~500MB)...");
|
|
27
30
|
|
|
28
31
|
// Helper to try install commands
|
|
@@ -51,22 +54,25 @@ const installWsl = async () => {
|
|
|
51
54
|
|
|
52
55
|
// Final Failure Handler
|
|
53
56
|
if (!success) {
|
|
54
|
-
log.error("β Failed to
|
|
57
|
+
log.error("β Failed to configure Uso Engine.");
|
|
55
58
|
log.error("π Possible Causes: Internet Timeout, Firewall, or VPN.");
|
|
56
59
|
log.warn("\nπ ACTION REQUIRED: Run this command manually in PowerShell as Administrator:");
|
|
57
60
|
console.log(chalk.bold.yellow(" wsl --install -d Ubuntu --web-download"));
|
|
58
61
|
log.warn("\nOnce that completes successfully, run 'uso setup --wsl' again.");
|
|
59
62
|
return false;
|
|
60
63
|
}
|
|
61
|
-
log.success("β
|
|
64
|
+
log.success("β
Uso Engine configured.");
|
|
62
65
|
} else {
|
|
63
|
-
log.success("β
|
|
66
|
+
log.success("β
Uso Engine is ready.");
|
|
64
67
|
}
|
|
65
68
|
|
|
69
|
+
// 2.5 Hide from Windows Terminal (Stealth Mode)
|
|
70
|
+
hideFromWindowsTerminal();
|
|
71
|
+
|
|
66
72
|
// 3. Configure Internal Environment (Rust + Solana + Anchor)
|
|
67
73
|
// We create a shell script and run it inside WSL.
|
|
68
74
|
|
|
69
|
-
log.info("βοΈ
|
|
75
|
+
log.info("βοΈ Initializing Uso Engine environment...");
|
|
70
76
|
|
|
71
77
|
const setupScript = `
|
|
72
78
|
#!/bin/bash
|
|
@@ -146,4 +152,57 @@ const installWsl = async () => {
|
|
|
146
152
|
}
|
|
147
153
|
};
|
|
148
154
|
|
|
155
|
+
const hideFromWindowsTerminal = () => {
|
|
156
|
+
try {
|
|
157
|
+
const localAppData = process.env.LOCALAPPDATA;
|
|
158
|
+
const packagesPath = path.join(localAppData, 'Packages');
|
|
159
|
+
|
|
160
|
+
// Find Windows Terminal package folder (name varies slightly but starts with Microsoft.WindowsTerminal)
|
|
161
|
+
if (!fs.existsSync(packagesPath)) return;
|
|
162
|
+
|
|
163
|
+
const terminalDirs = fs.readdirSync(packagesPath).filter(name => name.startsWith('Microsoft.WindowsTerminal'));
|
|
164
|
+
|
|
165
|
+
if (terminalDirs.length === 0) return;
|
|
166
|
+
|
|
167
|
+
const settingsPath = path.join(packagesPath, terminalDirs[0], 'LocalState', 'settings.json');
|
|
168
|
+
|
|
169
|
+
if (fs.existsSync(settingsPath)) {
|
|
170
|
+
// Read settings
|
|
171
|
+
// Note: settings.json can contain comments which JSON.parse fails on.
|
|
172
|
+
// We'll use a simple regex to set hidden: true for Ubuntu if simpler parsing fails or just try.
|
|
173
|
+
// Actually, modifying this file safely without a robust comment-stripping parser is risky.
|
|
174
|
+
// A safer approach for "Stealth" might be just log that we configured it.
|
|
175
|
+
// BUT, if we want to do it, we should be careful.
|
|
176
|
+
|
|
177
|
+
// For now, let's just log a message that we would hide it,
|
|
178
|
+
// or maybe we skip the robust parsing complexity to avoid breaking their terminal settings.
|
|
179
|
+
// User requested "Programmatically edit".
|
|
180
|
+
|
|
181
|
+
const content = fs.readFileSync(settingsPath, 'utf8');
|
|
182
|
+
// Check if Ubuntu is already there
|
|
183
|
+
if (content.includes('"name": "Ubuntu"')) {
|
|
184
|
+
// Very naive replacement to inject hidden: true.
|
|
185
|
+
// We look for the Ubuntu profile block.
|
|
186
|
+
// This is brittle. Let's try to parse if valid JSON.
|
|
187
|
+
try {
|
|
188
|
+
const settings = JSON.parse(content);
|
|
189
|
+
if (settings.profiles && settings.profiles.list) {
|
|
190
|
+
const profile = settings.profiles.list.find(p => p.name === 'Ubuntu');
|
|
191
|
+
if (profile) {
|
|
192
|
+
profile.hidden = true;
|
|
193
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 4));
|
|
194
|
+
log.info("π΅οΈ Hid 'Ubuntu' from Windows Terminal (Stealth Mode Active).");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} catch (e) {
|
|
198
|
+
// JSON parse failed (likely due to comments in settings.json)
|
|
199
|
+
log.warn("β οΈ Could not automatically hide Ubuntu icon (Comments in settings.json).");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} catch (e) {
|
|
204
|
+
// Silently fail to avoid alarming user
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
149
208
|
module.exports = { installWsl };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if Stealth WSL Mode is enabled.
|
|
7
|
+
* Reads ~/.uso-config.json and returns the mode configuration.
|
|
8
|
+
* @returns {{ enabled: boolean, distro: string }}
|
|
9
|
+
*/
|
|
10
|
+
const isStealthMode = () => {
|
|
11
|
+
try {
|
|
12
|
+
const configPath = path.join(os.homedir(), '.uso-config.json');
|
|
13
|
+
if (!fs.existsSync(configPath)) return { enabled: false, distro: 'Ubuntu' };
|
|
14
|
+
|
|
15
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
16
|
+
return {
|
|
17
|
+
enabled: config.mode === 'wsl',
|
|
18
|
+
distro: config.distro || 'Ubuntu'
|
|
19
|
+
};
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return { enabled: false, distro: 'Ubuntu' };
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = { isStealthMode };
|
package/src/utils/wsl-bridge.js
CHANGED
|
@@ -30,11 +30,14 @@ const isDistroInstalled = (distro = 'Ubuntu') => {
|
|
|
30
30
|
*/
|
|
31
31
|
const toWslPath = (windowsPath) => {
|
|
32
32
|
if (!windowsPath) return '';
|
|
33
|
-
//
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
// 1. Normalize the path to use forward slashes
|
|
34
|
+
let normalized = windowsPath.replace(/\\/g, '/');
|
|
35
|
+
|
|
36
|
+
// 2. Extract and replace the drive letter (e.g., 'C:') with '/mnt/c/'
|
|
37
|
+
// This regex ensures we only match the start of the string
|
|
38
|
+
normalized = normalized.replace(/^([a-zA-Z]):/, (match, drive) => `/mnt/${drive.toLowerCase()}`);
|
|
39
|
+
|
|
40
|
+
return normalized;
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
/**
|