@xaidenlabs/uso 1.1.21 → 1.1.22

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/bin/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  const { program } = require('commander');
3
3
  const { init } = require('../src/commands/init');
4
4
  const { doctor } = require('../src/commands/doctor');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaidenlabs/uso",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Universal Solana Orchestrator - A one-command setup tool for Solana and Anchor development environments on Windows, macOS, and Linux.",
5
5
  "bin": {
6
6
  "uso": "bin/index.js"
Binary file
@@ -2,6 +2,7 @@ const shell = require('shelljs');
2
2
  const { log, spinner } = require('../utils/logger');
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const os = require('os');
5
6
 
6
7
  const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
7
8
  log.header("đŸĒŸ Windows detected.");
@@ -41,24 +42,38 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
41
42
 
42
43
  if (!hasCl && hasCppTools) {
43
44
  log.warn("âš ī¸ C++ Build Tools are installed but 'cl.exe' is not in PATH.");
44
- log.warn(" You may need to restart your terminal or launch 'Developer Command Prompt for VS'.");
45
- // We continue, hoping rustup might find it, but it's risky.
45
+ log.warn(" This WILL cause Rust installation to fail with error 0xc0e90002 or similar.");
46
+ log.warn("👉 SOLUTION: Close this terminal and open 'Developer Command Prompt for VS 2022' (or similar).");
47
+ log.warn(" Then run `uso init` inside that prompt.");
48
+ // We give a chance to continue, but valid warning is given.
46
49
  }
47
50
  }
48
51
 
52
+ // Use specific temp directory to bypass AppLocker on Desktop
53
+ const tempDir = os.tmpdir();
54
+ const rustInstallerPath = path.join(tempDir, 'rustup-init.exe');
55
+ const solanaInstallerPath = path.join(tempDir, 'solana-install.exe');
56
+
49
57
  // 2. Install Rust
50
58
  if (shouldInstallRust) {
51
59
  log.info("đŸĻ€ Installing Rust (rustup-init.exe)...");
52
- shell.exec('powershell -Command "Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile rustup-init.exe"');
60
+ log.info(` Downloading to: ${rustInstallerPath}`);
61
+
62
+ shell.exec(`powershell -Command "Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile '${rustInstallerPath}'"`);
53
63
 
54
64
  // Unblock the file (Robust)
55
- const unblock = shell.exec('powershell -Command "Unblock-File -Path rustup-init.exe"');
65
+ log.info("â„šī¸ Debug: Attempting to unblock rustup-init.exe...");
66
+ const unblock = shell.exec(`powershell -Command "Unblock-File -Path '${rustInstallerPath}'"`);
67
+
56
68
  if (unblock.code !== 0) {
57
69
  log.warn("âš ī¸ Failed to unblock rustup-init.exe. Trying elevated...");
58
- shell.exec('powershell -Command "Start-Process powershell -ArgumentList \'Unblock-File -Path rustup-init.exe\' -Verb RunAs -Wait"');
70
+ shell.exec(`powershell -Command "Start-Process powershell -ArgumentList 'Unblock-File -Path \\"${rustInstallerPath}\\"' -Verb RunAs -Wait"`);
71
+ } else {
72
+ log.info("â„šī¸ Debug: Successfully unblocked rustup-init.exe");
59
73
  }
60
74
 
61
- const rustInstall = shell.exec('powershell -Command "./rustup-init.exe -y"');
75
+ // Run from temp
76
+ const rustInstall = shell.exec(`powershell -Command "& '${rustInstallerPath}' -y"`);
62
77
 
63
78
  if (rustInstall.code !== 0) {
64
79
  log.warn("âš ī¸ Rust installer finished with a non-zero code. It might have succeeded if you saw 'Rust is installed now'.");
@@ -66,8 +81,8 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
66
81
  log.success("✅ Rust installed.");
67
82
  }
68
83
 
69
- if (fs.existsSync('rustup-init.exe')) {
70
- shell.rm('rustup-init.exe');
84
+ if (fs.existsSync(rustInstallerPath)) {
85
+ try { fs.unlinkSync(rustInstallerPath); } catch (e) { }
71
86
  }
72
87
  } else {
73
88
  log.info("đŸĻ€ Rust is already installed. Skipping.");
@@ -76,16 +91,20 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
76
91
  // 3. Install Solana CLI (Agave)
77
92
  if (shouldInstallSolana) {
78
93
  log.info("â˜€ī¸ Installing Solana CLI (Agave)...");
79
- log.info(" Downloading solana-install-init.exe...");
94
+ log.info(` Downloading to: ${solanaInstallerPath}`);
80
95
 
81
- const downloadCmd = 'powershell -Command "Invoke-WebRequest -Uri https://release.anza.xyz/stable/solana-install-init-x86_64-pc-windows-msvc.exe -OutFile solana-install.exe"';
96
+ const downloadCmd = `powershell -Command "Invoke-WebRequest -Uri https://release.anza.xyz/stable/solana-install-init-x86_64-pc-windows-msvc.exe -OutFile '${solanaInstallerPath}'"`;
82
97
  const dlResult = shell.exec(downloadCmd);
83
98
 
84
99
  // Unblock the file (Robust)
85
- const unblockSolana = shell.exec('powershell -Command "Unblock-File -Path solana-install.exe"');
100
+ log.info("â„šī¸ Debug: Attempting to unblock solana-install.exe...");
101
+ const unblockSolana = shell.exec(`powershell -Command "Unblock-File -Path '${solanaInstallerPath}'"`);
102
+
86
103
  if (unblockSolana.code !== 0) {
87
104
  log.warn("âš ī¸ Failed to unblock solana-install.exe via Unblock-File. Trying elevated...");
88
- shell.exec('powershell -Command "Start-Process powershell -ArgumentList \'Unblock-File -Path solana-install.exe\' -Verb RunAs -Wait"');
105
+ shell.exec(`powershell -Command "Start-Process powershell -ArgumentList 'Unblock-File -Path \\"${solanaInstallerPath}\\"' -Verb RunAs -Wait"`);
106
+ } else {
107
+ log.info("â„šī¸ Debug: Successfully unblocked solana-install.exe");
89
108
  }
90
109
 
91
110
  if (dlResult.code !== 0) {
@@ -94,23 +113,21 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
94
113
  }
95
114
 
96
115
  // Try regular install first
97
- // Try regular install first (Silently to catch 1314 error without scaring user)
98
116
  log.info(" Running Solana Installer...");
99
- const installResult = shell.exec('solana-install.exe stable', { silent: true });
117
+ const installResult = shell.exec(`"${solanaInstallerPath}" stable`, { silent: true });
100
118
 
101
119
  // Check for Symlink Error (1314) for potential auto-elevation
102
120
  if (installResult.code !== 0) {
103
121
  const output = installResult.stderr + installResult.stdout;
104
122
 
105
- if (output.includes("os error 1314")) {
106
- log.info("â„šī¸ Privilege escalation required for symlinks.");
123
+ if (output.includes("os error 1314") || output.includes("blocked by your organization") || output.includes("Device Guard") || output.includes("Application Control policy")) {
124
+ log.info("â„šī¸ Privilege escalation required (Symlinks or Device Guard).");
107
125
  log.info("đŸ›Ąī¸ Triggering Run as Administrator (UAC)...");
108
126
  log.info("👉 Please click 'Yes' in the popup window to allow the installer.");
109
127
 
110
- const absPath = path.resolve('solana-install.exe');
111
128
  // Use Start-Process with -Verb RunAs to trigger elevation
112
129
  // -Wait ensures we actually wait for it to finish
113
- const elevateCmd = `powershell -Command "Start-Process -FilePath '${absPath}' -ArgumentList 'stable' -Verb RunAs -Wait"`;
130
+ const elevateCmd = `powershell -Command "Start-Process -FilePath '${solanaInstallerPath}' -ArgumentList 'stable' -Verb RunAs -Wait"`;
114
131
 
115
132
  const elevatedRun = shell.exec(elevateCmd);
116
133
 
@@ -134,8 +151,8 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
134
151
  log.success("✅ Solana CLI installed.");
135
152
  }
136
153
 
137
- if (fs.existsSync('solana-install.exe')) {
138
- shell.rm('solana-install.exe');
154
+ if (fs.existsSync(solanaInstallerPath)) {
155
+ try { fs.unlinkSync(solanaInstallerPath); } catch (e) { }
139
156
  }
140
157
  } else {
141
158
  log.info("â˜€ī¸ Solana CLI is already installed. Skipping.");