@xaidenlabs/uso 1.1.50 → 1.1.51

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.50",
3
+ "version": "1.1.51",
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"
@@ -74,77 +74,85 @@ const installWsl = async () => {
74
74
 
75
75
  log.info("⚙️ Initializing Uso Engine environment...");
76
76
 
77
- const setupScript = `
78
- #!/bin/bash
79
- set -e
80
-
81
- # 1. Hush Login
82
- touch ~/.hushlogin
83
-
84
- # 2. Update & Install Build Dependencies (ALWAYS check for cc linker)
85
- if ! command -v cc &> /dev/null || ! command -v pkg-config &> /dev/null; then
86
- echo "Installing build tools..."
87
- sudo apt-get update -y && sudo apt-get install -y curl build-essential pkg-config libssl-dev libudev-dev
88
- fi
89
-
90
- # 3. Install Rust
91
- if ! command -v cargo &> /dev/null; then
92
- echo "Installing Rust..."
93
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
94
- fi
95
- # Always source cargo env for subsequent steps
96
- source $HOME/.cargo/env 2>/dev/null || true
97
-
98
- # 4. Install Solana
99
- if ! command -v solana &> /dev/null; then
100
- echo "Installing Solana CLI..."
101
- # Try official installer first, fall back to Agave
102
- if ! sh -c "$(curl -sSfL https://release.solana.com/stable/install)" 2>/dev/null; then
103
- echo "Retrying with Agave installer..."
104
- sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" 2>/dev/null || true
105
- fi
106
- export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
107
- fi
108
-
109
- # 5. Install Anchor (AVM)
110
- if ! command -v avm &> /dev/null; then
111
- echo "Installing AVM..."
112
- cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
113
- avm install latest
114
- avm use latest
115
- fi
116
-
117
- echo "✅ Uso Engine Setup Complete."
118
- `;
119
-
120
- // Write script to a temporary file in Windows (which is mounted in WSL)
121
- const scriptPath = path.join(process.cwd(), 'setup_wsl.sh');
122
- fs.writeFileSync(scriptPath, setupScript);
123
-
124
- // Convert path to WSL format
125
- const wslScriptPath = toWslPath(scriptPath);
126
-
127
- // Run the script inside WSL
128
- // We pipe the script content to bash to avoid permission issues with the file itself
129
- // Or just run it. Let's run it.
130
-
131
- const spin = spinner('Running Linux setup script (this takes a while)...').start();
132
-
133
- // Ensure line endings are LF
134
- const linuxScript = setupScript.replace(/\r\n/g, '\n');
135
- fs.writeFileSync(scriptPath, linuxScript);
136
-
137
- const res = shell.exec(`wsl -d Ubuntu -e bash "${wslScriptPath}"`);
138
-
139
- // Clean up
140
- fs.unlinkSync(scriptPath);
141
-
142
- if (res.code === 0) {
143
- spin.succeed('Linux environment configured successfully.');
144
-
145
- // 4. Set "Stealth Mode" config (could be a local file or env var)
146
- // For now, we assume if the user ran --wsl, they want to use it.
147
- // We could create a .uso-config.json
77
+ // --- PHASE 1: System Dependencies (as root, no sudo needed) ---
78
+ const rootScript = `
79
+ #!/bin/bash
80
+ set -e
81
+ export DEBIAN_FRONTEND=noninteractive
82
+
83
+ if ! command -v cc &> /dev/null || ! command -v pkg-config &> /dev/null; then
84
+ echo "📦 Installing system build tools..."
85
+ apt-get update -y -qq
86
+ apt-get install -y -qq curl build-essential pkg-config libssl-dev libudev-dev
87
+ echo "✅ Build tools installed."
88
+ else
89
+ echo "✅ Build tools already present."
90
+ fi
91
+ `.replace(/\r\n/g, '\n');
92
+
93
+ const rootScriptPath = path.join(process.cwd(), 'uso_root_setup.sh');
94
+ fs.writeFileSync(rootScriptPath, rootScript);
95
+ const wslRootScriptPath = toWslPath(rootScriptPath);
96
+
97
+ const spin1 = spinner('Phase 1/2: Installing system dependencies...').start();
98
+ const rootRes = shell.exec(`wsl -d Ubuntu -u root -e bash "${wslRootScriptPath}"`);
99
+ fs.unlinkSync(rootScriptPath);
100
+
101
+ if (rootRes.code !== 0) {
102
+ spin1.fail('System dependency installation failed.');
103
+ log.error(rootRes.stderr || 'Unknown error during root setup.');
104
+ return false;
105
+ }
106
+ spin1.succeed('System dependencies ready.');
107
+
108
+ // --- PHASE 2: User Tools (Rust, Solana, Anchor as normal user) ---
109
+ const userScript = `
110
+ #!/bin/bash
111
+ set -e
112
+
113
+ # Hush login
114
+ touch ~/.hushlogin
115
+
116
+ # Install Rust
117
+ if ! command -v cargo &> /dev/null; then
118
+ echo "🦀 Installing Rust..."
119
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
120
+ fi
121
+ source $HOME/.cargo/env 2>/dev/null || true
122
+
123
+ # Install Solana
124
+ if ! command -v solana &> /dev/null; then
125
+ 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
129
+ fi
130
+ fi
131
+ export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
132
+
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
139
+ fi
140
+
141
+ echo "✅ Uso Engine Setup Complete."
142
+ `.replace(/\r\n/g, '\n');
143
+
144
+ const userScriptPath = path.join(process.cwd(), 'uso_user_setup.sh');
145
+ fs.writeFileSync(userScriptPath, userScript);
146
+ const wslUserScriptPath = toWslPath(userScriptPath);
147
+
148
+ const spin2 = spinner('Phase 2/2: Installing Rust, Solana, Anchor (this takes a while)...').start();
149
+ const userRes = shell.exec(`wsl -d Ubuntu -e bash "${wslUserScriptPath}"`);
150
+ fs.unlinkSync(userScriptPath);
151
+
152
+ if (userRes.code === 0) {
153
+ spin2.succeed('Uso Engine configured successfully.');
154
+
155
+ // Set "Stealth Mode" config
148
156
  const configPath = path.join(os.homedir(), '.uso-config.json');
149
157
  const config = { mode: 'wsl', distro: 'Ubuntu' };
150
158
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
@@ -152,8 +160,8 @@ const installWsl = async () => {
152
160
  log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
153
161
  return true;
154
162
  } else {
155
- spin.fail('Setup script failed.');
156
- log.error(res.stderr);
163
+ spin2.fail('Setup script failed.');
164
+ log.error(userRes.stderr || 'Check the output above for errors.');
157
165
  return false;
158
166
  }
159
167
  };