@xaidenlabs/uso 1.1.49 → 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.49",
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,71 +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 Dependencies
85
- if ! command -v curl &> /dev/null; then
86
- sudo apt-get update && sudo apt-get install -y curl build-essential pkg-config libssl-dev
87
- fi
88
-
89
- # 3. Install Rust
90
- if ! command -v cargo &> /dev/null; then
91
- echo "Installing Rust..."
92
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
93
- source $HOME/.cargo/env
94
- fi
95
-
96
- # 4. Install Solana
97
- if ! command -v solana &> /dev/null; then
98
- echo "Installing Solana..."
99
- sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
100
- export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
101
- fi
102
-
103
- # 5. Install Anchor (AVM)
104
- if ! command -v avm &> /dev/null; then
105
- echo "Installing AVM..."
106
- cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
107
- avm install latest
108
- avm use latest
109
- fi
110
-
111
- echo "✅ WSL Setup Complete."
112
- `;
113
-
114
- // Write script to a temporary file in Windows (which is mounted in WSL)
115
- const scriptPath = path.join(process.cwd(), 'setup_wsl.sh');
116
- fs.writeFileSync(scriptPath, setupScript);
117
-
118
- // Convert path to WSL format
119
- const wslScriptPath = toWslPath(scriptPath);
120
-
121
- // Run the script inside WSL
122
- // We pipe the script content to bash to avoid permission issues with the file itself
123
- // Or just run it. Let's run it.
124
-
125
- const spin = spinner('Running Linux setup script (this takes a while)...').start();
126
-
127
- // Ensure line endings are LF
128
- const linuxScript = setupScript.replace(/\r\n/g, '\n');
129
- fs.writeFileSync(scriptPath, linuxScript);
130
-
131
- const res = shell.exec(`wsl -d Ubuntu -e bash "${wslScriptPath}"`);
132
-
133
- // Clean up
134
- fs.unlinkSync(scriptPath);
135
-
136
- if (res.code === 0) {
137
- spin.succeed('Linux environment configured successfully.');
138
-
139
- // 4. Set "Stealth Mode" config (could be a local file or env var)
140
- // For now, we assume if the user ran --wsl, they want to use it.
141
- // 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
142
156
  const configPath = path.join(os.homedir(), '.uso-config.json');
143
157
  const config = { mode: 'wsl', distro: 'Ubuntu' };
144
158
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
@@ -146,8 +160,8 @@ const installWsl = async () => {
146
160
  log.success("✅ Stealth Mode Enabled. 'uso' commands will now run via WSL.");
147
161
  return true;
148
162
  } else {
149
- spin.fail('Setup script failed.');
150
- log.error(res.stderr);
163
+ spin2.fail('Setup script failed.');
164
+ log.error(userRes.stderr || 'Check the output above for errors.');
151
165
  return false;
152
166
  }
153
167
  };