UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

44 lines (36 loc) 1.2 kB
#!/usr/bin/env node /** * WSL Browser Fix for npm * * This script allows npm commands to open browsers from WSL by redirecting * browser open requests to the Windows host system. * * Usage: * 1. Make this script executable: chmod +x wsl-browser-fix.js * 2. Set as your browser: export BROWSER=$(pwd)/scripts/wsl-browser-fix.js */ const { exec } = require('child_process'); const url = process.argv[2]; if (!url) { console.error('No URL provided'); process.exit(1); } // Convert WSL path to Windows path if needed function convertWslPathToWindows(url) { // If it's already a valid URL, return it as is if (url.startsWith('http://') || url.startsWith('https://')) { return url; } // Otherwise, try to convert it (assuming it's a file path) return url; } const windowsUrl = convertWslPathToWindows(url); // Use cmd.exe to open the URL in the default Windows browser const command = `cmd.exe /c start "" "${windowsUrl}"`; console.log(`Opening URL in Windows browser: ${windowsUrl}`); exec(command, (error) => { if (error) { console.error(`Error opening browser: ${error.message}`); process.exit(1); } });