4runr-os 2.1.34 → 2.1.39

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 +152 -146
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "4runr-os",
3
- "version": "2.1.34",
3
+ "version": "2.1.39",
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
@@ -186,114 +186,114 @@ if (isWindows && rustInstalled && rustNeedsGNU) {
186
186
  'mingw-w64.mingw-w64', // Direct MinGW package
187
187
  'mingw-w64', // Alternative MinGW package name
188
188
  ];
189
-
190
- for (const pkg of wingetPackages) {
191
- try {
192
- console.log(` Trying: winget install ${pkg}...`);
193
- execSync(`winget install ${pkg} --accept-package-agreements --accept-source-agreements --silent`, {
194
- stdio: 'pipe',
195
- timeout: 120000 // 2 minutes for MSYS2
196
- });
197
- installed = true;
198
- console.log(` ✅ Installed via winget: ${pkg}`);
189
+
190
+ for (const pkg of wingetPackages) {
191
+ try {
192
+ console.log(` Trying: winget install ${pkg}...`);
193
+ execSync(`winget install ${pkg} --accept-package-agreements --accept-source-agreements --silent`, {
194
+ stdio: 'pipe',
195
+ timeout: 120000 // 2 minutes for MSYS2
196
+ });
197
+ installed = true;
198
+ console.log(` ✅ Installed via winget: ${pkg}`);
199
+
200
+ // If MSYS2 was just installed via winget, install MinGW inside it
201
+ if (pkg === 'msys2.msys2') {
202
+ // Wait a moment for MSYS2 installation to complete
203
+ console.log(' Waiting for MSYS2 installation to complete...');
204
+ const { setTimeout } = await import('timers/promises');
205
+ await setTimeout(5000);
199
206
 
200
- // If MSYS2 was just installed via winget, install MinGW inside it
201
- if (pkg === 'msys2.msys2') {
202
- // Wait a moment for MSYS2 installation to complete
203
- console.log(' Waiting for MSYS2 installation to complete...');
204
- const { setTimeout } = await import('timers/promises');
205
- await setTimeout(5000);
206
-
207
- // Check if MinGW is already installed
208
- if (fs.existsSync(path.join(msys2MingwPath, 'dlltool.exe'))) {
209
- console.log(` ✅ MinGW already installed in MSYS2`);
210
- mingwInstalled = true;
211
- mingwPath = msys2MingwPath;
212
- } else {
213
- // Automatically install MinGW toolchain via MSYS2
214
- console.log(' 🔨 Installing MinGW toolchain in MSYS2 (this may take 2-3 minutes)...');
215
- try {
216
- execSync(`"${msys2Bash}" -lc "pacman -S mingw-w64-x86_64-toolchain --noconfirm"`, {
217
- stdio: 'inherit',
218
- timeout: 300000 // 5 minutes for installation
219
- });
220
-
221
- // Verify installation
222
- if (fs.existsSync(path.join(msys2MingwPath, 'dlltool.exe'))) {
223
- console.log(' ✅ MinGW toolchain installed successfully');
224
- mingwInstalled = true;
225
- mingwPath = msys2MingwPath;
226
- } else {
227
- console.warn(' ⚠️ Installation completed but MinGW not found. Please restart terminal and run 4runr-setup again.');
228
- process.exit(0);
229
- }
230
- } catch (installError) {
231
- console.error(' ❌ Failed to install MinGW automatically');
232
- console.error(' Quick fix - run this command:');
233
- console.error(` "${msys2Bash}" -lc "pacman -S mingw-w64-x86_64-toolchain --noconfirm"`);
234
- console.error(' Then restart terminal and run: 4runr-setup\n');
235
- process.exit(1);
236
- }
237
- }
238
-
239
- // Add to PATH for current session
240
- if (mingwInstalled && mingwPath) {
241
- console.log(` ✅ Adding ${mingwPath} to PATH for this session...`);
242
- process.env.PATH = process.env.PATH ? `${mingwPath};${process.env.PATH}` : mingwPath;
243
- }
207
+ // Check if MinGW is already installed
208
+ if (fs.existsSync(path.join(msys2MingwPath, 'dlltool.exe'))) {
209
+ console.log(` ✅ MinGW already installed in MSYS2`);
210
+ mingwInstalled = true;
211
+ mingwPath = msys2MingwPath;
244
212
  } else {
245
- // Direct MinGW package - wait and check PATH
246
- const { setTimeout } = await import('timers/promises');
247
- await setTimeout(2000);
213
+ // Automatically install MinGW toolchain via MSYS2
214
+ console.log(' 🔨 Installing MinGW toolchain in MSYS2 (this may take 2-3 minutes)...');
248
215
  try {
249
- const dlltoolPath = execSync('where dlltool.exe', { encoding: 'utf-8', stdio: 'pipe' }).trim();
250
- mingwInstalled = true;
251
- mingwPath = path.dirname(dlltoolPath);
252
- } catch {
253
- // Not in PATH yet - user will need to restart terminal
254
- console.warn(' ⚠️ Installed but not in PATH - please restart terminal');
216
+ execSync(`"${msys2Bash}" -lc "pacman -S mingw-w64-x86_64-toolchain --noconfirm"`, {
217
+ stdio: 'inherit',
218
+ timeout: 300000 // 5 minutes for installation
219
+ });
220
+
221
+ // Verify installation
222
+ if (fs.existsSync(path.join(msys2MingwPath, 'dlltool.exe'))) {
223
+ console.log(' ✅ MinGW toolchain installed successfully');
224
+ mingwInstalled = true;
225
+ mingwPath = msys2MingwPath;
226
+ } else {
227
+ console.warn(' ⚠️ Installation completed but MinGW not found. Please restart terminal and run 4runr-setup again.');
228
+ process.exit(0);
229
+ }
230
+ } catch (installError) {
231
+ console.error(' ❌ Failed to install MinGW automatically');
232
+ console.error(' Quick fix - run this command:');
233
+ console.error(` "${msys2Bash}" -lc "pacman -S mingw-w64-x86_64-toolchain --noconfirm"`);
234
+ console.error(' Then restart terminal and run: 4runr-setup\n');
235
+ process.exit(1);
255
236
  }
256
237
  }
257
- break;
258
- } catch (err) {
259
- // Try next package
260
- continue;
238
+
239
+ // Add to PATH for current session
240
+ if (mingwInstalled && mingwPath) {
241
+ console.log(` ✅ Adding ${mingwPath} to PATH for this session...`);
242
+ process.env.PATH = process.env.PATH ? `${mingwPath};${process.env.PATH}` : mingwPath;
243
+ }
244
+ } else {
245
+ // Direct MinGW package - wait and check PATH
246
+ const { setTimeout } = await import('timers/promises');
247
+ await setTimeout(2000);
248
+ try {
249
+ const dlltoolPath = execSync('where dlltool.exe', { encoding: 'utf-8', stdio: 'pipe' }).trim();
250
+ mingwInstalled = true;
251
+ mingwPath = path.dirname(dlltoolPath);
252
+ } catch {
253
+ // Not in PATH yet - user will need to restart terminal
254
+ console.warn(' ⚠️ Installed but not in PATH - please restart terminal');
255
+ }
261
256
  }
257
+ break;
258
+ } catch (err) {
259
+ // Try next package
260
+ continue;
262
261
  }
263
-
264
- if (!installed) {
265
- console.error('\n❌ Failed to install MinGW automatically via winget');
266
- console.error('\n Please install MinGW-w64 manually using one of these methods:\n');
267
- console.error(' Option 1: MSYS2 via winget (Easiest)');
268
- console.error(' Run: winget install msys2.msys2');
269
- console.error(' Then:');
270
- console.error(' 1. Open MSYS2 terminal (search for "MSYS2 MSYS" in Start menu)');
271
- console.error(' 2. Run: pacman -S mingw-w64-x86_64-toolchain --noconfirm');
272
- console.error(' 3. Add C:\\msys64\\mingw64\\bin to your PATH');
273
- console.error(' 4. Restart terminal and run: 4runr-setup\n');
274
- console.error(' Option 1b: MSYS2 Manual Download');
275
- console.error(' 1. Download: https://www.msys2.org/');
276
- console.error(' 2. Install MSYS2');
277
- console.error(' 3. Open MSYS2 terminal and run: pacman -S mingw-w64-x86_64-toolchain --noconfirm');
278
- console.error(' 4. Add C:\\msys64\\mingw64\\bin to your PATH');
279
- console.error(' 5. Restart terminal and run: 4runr-setup\n');
280
- console.error(' Option 2: WinLibs (Direct Download)');
281
- console.error(' 1. Download: https://winlibs.com/');
282
- console.error(' 2. Extract to C:\\mingw64');
283
- console.error(' 3. Add C:\\mingw64\\bin to your PATH');
284
- console.error(' 4. Restart terminal and run: 4runr-setup\n');
285
- console.error(' Option 3: Chocolatey (if installed)');
286
- console.error(' choco install mingw\n');
287
- process.exit(1);
288
- } else {
289
- console.log('\n✅ MinGW-w64 installed!');
290
- console.log(' IMPORTANT: Please restart your terminal to update PATH');
291
- console.log(' Then run: 4runr-setup\n');
292
- process.exit(0);
293
- }
262
+ }
263
+
264
+ if (!installed) {
265
+ console.error('\n Failed to install MinGW automatically via winget');
266
+ console.error('\n Please install MinGW-w64 manually using one of these methods:\n');
267
+ console.error(' Option 1: MSYS2 via winget (Easiest)');
268
+ console.error(' Run: winget install msys2.msys2');
269
+ console.error(' Then:');
270
+ console.error(' 1. Open MSYS2 terminal (search for "MSYS2 MSYS" in Start menu)');
271
+ console.error(' 2. Run: pacman -S mingw-w64-x86_64-toolchain --noconfirm');
272
+ console.error(' 3. Add C:\\msys64\\mingw64\\bin to your PATH');
273
+ console.error(' 4. Restart terminal and run: 4runr-setup\n');
274
+ console.error(' Option 1b: MSYS2 Manual Download');
275
+ console.error(' 1. Download: https://www.msys2.org/');
276
+ console.error(' 2. Install MSYS2');
277
+ console.error(' 3. Open MSYS2 terminal and run: pacman -S mingw-w64-x86_64-toolchain --noconfirm');
278
+ console.error(' 4. Add C:\\msys64\\mingw64\\bin to your PATH');
279
+ console.error(' 5. Restart terminal and run: 4runr-setup\n');
280
+ console.error(' Option 2: WinLibs (Direct Download)');
281
+ console.error(' 1. Download: https://winlibs.com/');
282
+ console.error(' 2. Extract to C:\\mingw64');
283
+ console.error(' 3. Add C:\\mingw64\\bin to your PATH');
284
+ console.error(' 4. Restart terminal and run: 4runr-setup\n');
285
+ console.error(' Option 3: Chocolatey (if installed)');
286
+ console.error(' choco install mingw\n');
287
+ process.exit(1);
288
+ } else {
289
+ console.log('\n✅ MinGW-w64 installed!');
290
+ console.log(' IMPORTANT: Please restart your terminal to update PATH');
291
+ console.log(' Then run: 4runr-setup\n');
292
+ process.exit(0);
294
293
  }
295
294
  }
296
295
 
296
+ // Configure Rust to use GNU toolchain if MinGW is installed
297
297
  if (mingwInstalled) {
298
298
  // Make sure MinGW is in PATH for cargo
299
299
  if (mingwPath && process.env.PATH && !process.env.PATH.includes(mingwPath)) {
@@ -315,63 +315,69 @@ if (isWindows && rustInstalled && rustNeedsGNU) {
315
315
  }
316
316
  }
317
317
 
318
- // Check if 4runr-os is installed
319
- try {
320
- execSync('4r --version', { stdio: 'ignore' });
321
- console.log('✅ 4runr-os is installed');
322
- } catch {
323
- console.log('⚠️ 4runr-os not found in PATH');
324
- console.log(' Installing 4runr-os...');
318
+ // Check if 4runr-os is installed
325
319
  try {
326
- execSync('npm install -g 4runr-os@latest', { stdio: 'inherit' });
327
- console.log('✅ 4runr-os installed');
320
+ execSync('4r --version', { stdio: 'ignore' });
321
+ console.log('✅ 4runr-os is installed');
328
322
  } catch {
329
- console.error(' Failed to install 4runr-os');
330
- console.error(' Run manually: npm install -g 4runr-os@latest');
331
- process.exit(1);
323
+ console.log('⚠️ 4runr-os not found in PATH');
324
+ console.log(' Installing 4runr-os...');
325
+ try {
326
+ execSync('npm install -g 4runr-os@latest', { stdio: 'inherit' });
327
+ console.log('✅ 4runr-os installed');
328
+ } catch {
329
+ console.error('❌ Failed to install 4runr-os');
330
+ console.error(' Run manually: npm install -g 4runr-os@latest');
331
+ process.exit(1);
332
+ }
332
333
  }
333
- }
334
334
 
335
- // Verify mk3-tui binary (check global install location)
336
- let mk3Dir = null;
337
- try {
338
- // Try to find global install location
339
- const npmPrefix = execSync('npm config get prefix', { encoding: 'utf-8' }).trim();
340
- const globalPath = isWindows
341
- ? path.join(npmPrefix, 'node_modules', '4runr-os', 'mk3-tui')
342
- : path.join(npmPrefix, 'lib', 'node_modules', '4runr-os', 'mk3-tui');
343
-
344
- if (fs.existsSync(globalPath)) {
345
- mk3Dir = globalPath;
335
+ // Verify mk3-tui binary (check global install location)
336
+ let mk3Dir = null;
337
+ try {
338
+ // Try to find global install location
339
+ const npmPrefix = execSync('npm config get prefix', { encoding: 'utf-8' }).trim();
340
+ const globalPath = isWindows
341
+ ? path.join(npmPrefix, 'node_modules', '4runr-os', 'mk3-tui')
342
+ : path.join(npmPrefix, 'lib', 'node_modules', '4runr-os', 'mk3-tui');
343
+
344
+ if (fs.existsSync(globalPath)) {
345
+ mk3Dir = globalPath;
346
+ }
347
+ } catch {
348
+ // Fallback to local
349
+ mk3Dir = path.join(__dirname, '..', 'mk3-tui');
346
350
  }
347
- } catch {
348
- // Fallback to local
349
- mk3Dir = path.join(__dirname, '..', 'mk3-tui');
350
- }
351
351
 
352
- if (mk3Dir && fs.existsSync(mk3Dir)) {
353
- const binaryName = isWindows ? 'mk3-tui.exe' : 'mk3-tui';
354
- const binaryPath = path.join(mk3Dir, 'target', 'release', binaryName);
355
-
356
- if (!fs.existsSync(binaryPath)) {
357
- console.log('\n🔨 Building mk3-tui binary...');
358
- try {
359
- execSync('cargo build --release', {
360
- cwd: mk3Dir,
361
- stdio: 'inherit',
362
- });
363
- console.log('✅ mk3-tui built successfully');
364
- } catch (error) {
365
- console.warn('⚠️ Failed to build mk3-tui');
366
- console.warn(' The binary will be built automatically on first run of 4r');
352
+ if (mk3Dir && fs.existsSync(mk3Dir)) {
353
+ const binaryName = isWindows ? 'mk3-tui.exe' : 'mk3-tui';
354
+ const binaryPath = path.join(mk3Dir, 'target', 'release', binaryName);
355
+
356
+ if (!fs.existsSync(binaryPath)) {
357
+ console.log('\n🔨 Building mk3-tui binary...');
358
+ try {
359
+ execSync('cargo build --release', {
360
+ cwd: mk3Dir,
361
+ stdio: 'inherit',
362
+ });
363
+ console.log('✅ mk3-tui built successfully');
364
+ } catch (error) {
365
+ console.warn('⚠️ Failed to build mk3-tui');
366
+ console.warn(' The binary will be built automatically on first run of 4r');
367
+ }
368
+ } else {
369
+ console.log('✅ mk3-tui binary found');
367
370
  }
368
371
  } else {
369
- console.log('mk3-tui binary found');
372
+ console.log('⚠️ mk3-tui source not found - will build on first run of 4r');
370
373
  }
371
- } else {
372
- console.log('⚠️ mk3-tui source not found - will build on first run of 4r');
374
+
375
+ console.log('\n✅ Setup complete! You can now run: 4r\n');
373
376
  }
374
377
 
375
- console.log('\n✅ Setup complete! You can now run: 4r\n');
376
- })();
378
+ // Run the setup
379
+ runSetup().catch((error) => {
380
+ console.error('\n❌ Setup failed:', error);
381
+ process.exit(1);
382
+ });
377
383