@xaidenlabs/uso 1.1.51 → 1.1.54

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaidenlabs/uso",
3
- "version": "1.1.51",
3
+ "version": "1.1.54",
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"
@@ -15,14 +15,18 @@ const { installWsl } = require('../platforms/wsl');
15
15
  const init = async (component, options) => {
16
16
  const platform = os.platform();
17
17
 
18
- // Check for Stealth WSL Mode
19
- if (options && options.wsl) {
20
- if (platform !== 'win32') {
21
- log.error("❌ WSL Stealth Mode is only available on Windows.");
18
+ // --- AUTO-DETECT: On Windows, silently use WSL Stealth Mode if available ---
19
+ if (platform === 'win32') {
20
+ const forceWsl = options && options.wsl;
21
+ // Check if WSL + Ubuntu is available (quick check: wsl -d Ubuntu -e true)
22
+ const wslCheck = shell.exec('wsl -d Ubuntu -e true', { silent: true });
23
+ const wslAvailable = wslCheck.code === 0;
24
+
25
+ if (forceWsl || wslAvailable) {
26
+ await installWsl();
22
27
  return;
23
28
  }
24
- await installWsl();
25
- return;
29
+ // If WSL not available and --wsl not forced, fall through to native install
26
30
  }
27
31
 
28
32
  if (component) {
@@ -183,9 +183,32 @@ const runElevatedWithProgress = (command, args = [], binary = 'anchor') => {
183
183
  };
184
184
 
185
185
  const build = () => runProxyCommand('build', [], 'anchor');
186
- const test = (args = []) => runProxyCommand('test', Array.isArray(args) ? args : [], 'anchor');
187
186
  const deploy = () => runProxyCommand('deploy', [], 'anchor');
188
187
  const clean = () => runProxyCommand('clean', [], 'anchor');
188
+
189
+ const test = async (args = []) => {
190
+ const userArgs = Array.isArray(args) ? args : [];
191
+
192
+ // On Windows, auto-detect validator to prevent anchor test from hanging
193
+ if (os.platform() === 'win32' && !userArgs.includes('--skip-local-validator')) {
194
+ const isValidatorUp = () => {
195
+ const res = shell.exec('netstat -an | findstr 8899', { silent: true });
196
+ return res.code === 0 && res.stdout.length > 0;
197
+ };
198
+
199
+ if (isValidatorUp()) {
200
+ log.info("✅ Validator detected on port 8899. Running tests against it.");
201
+ userArgs.push('--skip-local-validator');
202
+ } else {
203
+ log.warn("⚠️ No validator detected. Starting one first...");
204
+ log.info("👉 Run 'uso val' in a separate terminal, then re-run 'uso test'.");
205
+ log.info(" Or use 'uso dev' to do both automatically.");
206
+ return;
207
+ }
208
+ }
209
+
210
+ return runProxyCommand('test', userArgs, 'anchor');
211
+ };
189
212
  const airdrop = (amount, recipient) => {
190
213
  const args = [amount];
191
214
  if (recipient) args.push(recipient);
@@ -108,37 +108,91 @@ fi
108
108
  // --- PHASE 2: User Tools (Rust, Solana, Anchor as normal user) ---
109
109
  const userScript = `
110
110
  #!/bin/bash
111
- set -e
111
+ # NO set -e — we handle errors per-step
112
+ FAILURES=""
112
113
 
113
114
  # Hush login
114
115
  touch ~/.hushlogin
115
116
 
116
- # Install Rust
117
+ # --- Rust ---
118
+ source $HOME/.cargo/env 2>/dev/null || true
117
119
  if ! command -v cargo &> /dev/null; then
118
120
  echo "🦀 Installing Rust..."
119
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
121
+ if curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; then
122
+ source $HOME/.cargo/env 2>/dev/null || true
123
+ echo "✅ Rust installed."
124
+ else
125
+ FAILURES="$FAILURES rust"
126
+ echo "❌ Rust installation failed."
127
+ fi
128
+ else
129
+ echo "✅ Rust already installed."
120
130
  fi
121
131
  source $HOME/.cargo/env 2>/dev/null || true
122
132
 
123
- # Install Solana
133
+ # --- Solana ---
134
+ export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
124
135
  if ! command -v solana &> /dev/null; then
125
136
  echo "☀️ Installing Solana CLI..."
126
- if ! sh -c "$(curl -sSfL https://release.solana.com/stable/install)" 2>/dev/null; then
127
- echo "Retrying with Agave installer..."
128
- sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" 2>/dev/null || true
137
+ if sh -c "$(curl -sSfL https://release.solana.com/stable/install)" 2>/dev/null; then
138
+ echo " Solana installed."
139
+ elif sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" 2>/dev/null; then
140
+ echo "✅ Solana installed (via Agave)."
141
+ else
142
+ FAILURES="$FAILURES solana"
143
+ echo "⚠️ Solana install timed out. Run 'uso setup' again later to retry."
129
144
  fi
145
+ export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
146
+ else
147
+ echo "✅ Solana already installed."
130
148
  fi
131
- export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
132
149
 
133
- # Install Anchor (AVM)
134
- if ! command -v avm &> /dev/null; then
135
- echo "⚓ Installing AVM (this compiles from source, ~5 min)..."
136
- cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
137
- avm install latest
138
- avm use latest
150
+ # --- Anchor (AVM) ---
151
+ if ! command -v anchor &> /dev/null; then
152
+ # Install AVM if not present
153
+ if ! command -v avm &> /dev/null; then
154
+ echo "⚓ Installing AVM (compiling from source, ~5 min)..."
155
+ if cargo install --git https://github.com/coral-xyz/anchor avm --locked --force; then
156
+ echo "✅ AVM compiled."
157
+ else
158
+ FAILURES="$FAILURES avm"
159
+ echo "❌ AVM compilation failed."
160
+ fi
161
+ else
162
+ echo "✅ AVM already installed."
163
+ fi
164
+
165
+ # Install Anchor via AVM (try binary first, then compile from source)
166
+ if command -v avm &> /dev/null; then
167
+ echo "⚓ Installing Anchor CLI..."
168
+ if avm install latest 2>/dev/null; then
169
+ avm use latest
170
+ echo "✅ Anchor installed."
171
+ else
172
+ echo "⚠️ Binary download timed out. Building from source (this takes ~10 min)..."
173
+ if avm install latest --force 2>/dev/null; then
174
+ avm use latest
175
+ echo "✅ Anchor built from source."
176
+ else
177
+ FAILURES="$FAILURES anchor"
178
+ echo "⚠️ Anchor install timed out. Run 'uso setup' again later."
179
+ fi
180
+ fi
181
+ fi
182
+ else
183
+ echo "✅ Anchor already installed."
139
184
  fi
140
185
 
141
- echo "✅ Uso Engine Setup Complete."
186
+ # --- Report ---
187
+ if [ -z "$FAILURES" ]; then
188
+ echo "✅ Uso Engine Setup Complete."
189
+ exit 0
190
+ else
191
+ echo ""
192
+ echo "⚠️ Partial setup. Failed:$FAILURES"
193
+ echo "Run 'uso setup' again to retry failed components."
194
+ exit 1
195
+ fi
142
196
  `.replace(/\r\n/g, '\n');
143
197
 
144
198
  const userScriptPath = path.join(process.cwd(), 'uso_user_setup.sh');
@@ -151,19 +205,18 @@ echo "✅ Uso Engine Setup Complete."
151
205
 
152
206
  if (userRes.code === 0) {
153
207
  spin2.succeed('Uso Engine configured successfully.');
154
-
155
- // Set "Stealth Mode" config
156
- const configPath = path.join(os.homedir(), '.uso-config.json');
157
- const config = { mode: 'wsl', distro: 'Ubuntu' };
158
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
159
-
160
- log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
161
- return true;
162
208
  } else {
163
- spin2.fail('Setup script failed.');
164
- log.error(userRes.stderr || 'Check the output above for errors.');
165
- return false;
209
+ spin2.warn('Uso Engine partially configured (some downloads timed out).');
210
+ log.info("👉 Run 'uso setup' again to retry failed components.");
166
211
  }
212
+
213
+ // Always set stealth mode config — even partial setup enables routing
214
+ const configPath = path.join(os.homedir(), '.uso-config.json');
215
+ const config = { mode: 'wsl', distro: 'Ubuntu' };
216
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
217
+
218
+ log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
219
+ return true;
167
220
  };
168
221
 
169
222
  const hideFromWindowsTerminal = () => {