4runr-os 2.1.30 → 2.1.32

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/setup.js +71 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "4runr-os",
3
- "version": "2.1.30",
3
+ "version": "2.1.32",
4
4
  "type": "module",
5
5
  "description": "4Runr AI Agent OS - Interactive terminal for managing AI agents",
6
6
  "main": "dist/index.js",
package/scripts/setup.js CHANGED
@@ -9,6 +9,7 @@ import * as fs from 'fs';
9
9
  import * as path from 'path';
10
10
  import { fileURLToPath } from 'url';
11
11
  import { dirname } from 'path';
12
+ import * as readline from 'readline';
12
13
 
13
14
  const __filename = fileURLToPath(import.meta.url);
14
15
  const __dirname = dirname(__filename);
@@ -148,14 +149,77 @@ if (isWindows && rustInstalled && rustNeedsGNU) {
148
149
  installed = true;
149
150
  console.log(` ✅ Installed via winget: ${pkg}`);
150
151
 
151
- // If MSYS2 was installed, need to install MinGW inside it
152
+ // If MSYS2 was installed, automatically install MinGW toolchain
152
153
  if (pkg === 'msys2.msys2') {
153
- console.log('\n ⚠️ MSYS2 installed. You need to:');
154
- console.log(' 1. Open MSYS2 terminal (search for "MSYS2 MSYS" in Start menu)');
155
- console.log(' 2. Run: pacman -S mingw-w64-x86_64-toolchain --noconfirm');
156
- console.log(' 3. Add C:\\msys64\\mingw64\\bin to your PATH');
157
- console.log(' 4. Restart terminal and run: 4runr-setup\n');
158
- process.exit(0);
154
+ const msys2MingwPath = 'C:\\msys64\\mingw64\\bin';
155
+ const msys2Bash = 'C:\\msys64\\usr\\bin\\bash.exe';
156
+
157
+ // Check if MinGW is already installed
158
+ if (fs.existsSync(path.join(msys2MingwPath, 'dlltool.exe'))) {
159
+ console.log(`\n ✅ MinGW already installed in MSYS2`);
160
+ mingwInstalled = true;
161
+ mingwPath = msys2MingwPath;
162
+ } else {
163
+ // Automatically install MinGW toolchain via MSYS2
164
+ console.log('\n 🔨 Installing MinGW toolchain in MSYS2 (this may take a few minutes)...');
165
+ try {
166
+ execSync(`"${msys2Bash}" -lc "pacman -S mingw-w64-x86_64-toolchain --noconfirm"`, {
167
+ stdio: 'inherit',
168
+ timeout: 300000 // 5 minutes for installation
169
+ });
170
+
171
+ // Verify installation
172
+ if (fs.existsSync(path.join(msys2MingwPath, 'dlltool.exe'))) {
173
+ console.log(' ✅ MinGW toolchain installed successfully');
174
+ mingwInstalled = true;
175
+ mingwPath = msys2MingwPath;
176
+ } else {
177
+ console.warn(' ⚠️ Installation completed but MinGW not found. Please restart terminal and run 4runr-setup again.');
178
+ process.exit(0);
179
+ }
180
+ } catch (installError) {
181
+ console.error(' ❌ Failed to install MinGW automatically');
182
+ console.error(' Please install manually:');
183
+ console.error(' 1. Open MSYS2 terminal');
184
+ console.error(' 2. Run: pacman -S mingw-w64-x86_64-toolchain --noconfirm');
185
+ console.error(' 3. Restart terminal and run: 4runr-setup\n');
186
+ process.exit(1);
187
+ }
188
+ }
189
+
190
+ // Add to PATH for current session
191
+ if (mingwInstalled && mingwPath) {
192
+ console.log(` ✅ Adding ${mingwPath} to PATH for this session...`);
193
+ process.env.PATH = process.env.PATH ? `${mingwPath};${process.env.PATH}` : mingwPath;
194
+
195
+ // Try to add to permanent PATH (may require admin)
196
+ try {
197
+ const currentPath = execSync('powershell -Command "[Environment]::GetEnvironmentVariable(\'Path\', \'User\')"', { encoding: 'utf-8' }).trim();
198
+ if (!currentPath.includes(mingwPath)) {
199
+ // Use synchronous readline for simpler flow
200
+ process.stdout.write('\n Add MinGW to PATH permanently? (recommended) [Y/n]: ');
201
+ const rl = readline.createInterface({
202
+ input: process.stdin,
203
+ output: process.stdout
204
+ });
205
+
206
+ rl.on('line', (answer) => {
207
+ rl.close();
208
+ if (!answer || answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
209
+ try {
210
+ execSync(`powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';${mingwPath}', 'User')"`, { stdio: 'pipe' });
211
+ console.log(' ✅ Added to PATH permanently');
212
+ } catch {
213
+ console.log(' ⚠️ Could not add to PATH permanently. Please add manually:');
214
+ console.log(` ${mingwPath}`);
215
+ }
216
+ }
217
+ });
218
+ }
219
+ } catch {
220
+ // Ignore - PATH update failed, user can add manually
221
+ }
222
+ }
159
223
  }
160
224
  break;
161
225
  } catch (err) {