@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 CHANGED
@@ -1,6 +1,12 @@
1
1
  # Universal Solana Orchestrator (USO)
2
2
 
3
- The Universal Solana Orchestrator (USO) is a command-line interface designed to streamline the initialization and management of Solana development environments. By automating the installation of the Rust toolchain, Solana CLI, and Anchor framework, USO eliminates the complexity often associated with setting up a Web3 development workspace on Windows, macOS, and Linux.
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.46",
4
- "description": "Universal Solana Orchestrator - A one-command setup tool for Solana and Anchor development environments on Windows, macOS, and Linux.",
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
  },
@@ -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
  };
@@ -18,11 +18,14 @@ const installWsl = async () => {
18
18
  return false;
19
19
  }
20
20
 
21
- // 2. Install Ubuntu silently if missing
22
- // We target 'Ubuntu' as the standard distro.
23
- const checkDistro = shell.exec('wsl -l -v', { silent: true });
24
- if (!checkDistro.stdout.includes('Ubuntu')) {
25
- log.info("πŸ“¦ Installing Ubuntu (Please approve UAC prompt if asked)...");
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 install Ubuntu after multiple attempts.");
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("βœ… Ubuntu installed.");
64
+ log.success("βœ… Uso Engine configured.");
62
65
  } else {
63
- log.success("βœ… Ubuntu is already installed.");
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("βš™οΈ Configuring internal Linux environment...");
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 };
@@ -30,11 +30,14 @@ const isDistroInstalled = (distro = 'Ubuntu') => {
30
30
  */
31
31
  const toWslPath = (windowsPath) => {
32
32
  if (!windowsPath) return '';
33
- // Handle drive letter
34
- let wslPath = windowsPath.replace(/^([a-zA-Z]):/, (match, drive) => `/mnt/${drive.toLowerCase()}`);
35
- // Replace backslashes with forward slashes
36
- wslPath = wslPath.replace(/\\/g, '/');
37
- return wslPath;
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
  /**