Merge pull request #490 from ruvnet/fix/windows-compatibility-alpha74

🚀 Alpha.75: Windows Compatibility Overhaul (Based on PR #483 by @alexx-ftw)
This commit is contained in:
rUv authored and GitHub committed 2025-07-28 15:33:27 -04:00
commit 620adee804
7 files changed
+8547 -31

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
VERSION="2.0.0-alpha.74"
VERSION="2.0.0-alpha.75"
# Determine the correct path based on how the script is invoked
if [ -L "$0" ]; then
+120
View File
@@ -0,0 +1,120 @@
#!/usr/bin/env node
/**
* Claude-Flow Cross-Platform Dispatcher
* Detects and uses the best available runtime
*/
import { fileURLToPath } from 'url';
import { dirname, join, resolve } from 'path';
import { existsSync } from 'fs';
import { spawn } from 'child_process';
import process from 'process';
const VERSION = "2.0.0-alpha.75";
// Get script directory and root directory
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const ROOT_DIR = resolve(__dirname, '..');
// Show help if no arguments provided
const args = process.argv.slice(2);
if (args.length === 0) {
args.push('--help');
}
// Quick version check
for (const arg of args) {
if (arg === '--version' || arg === '-v') {
console.log(`v${VERSION}`);
process.exit(0);
}
}
// Try to find the best runtime and execute
async function main() {
try {
// Try JavaScript version first (most reliable)
const jsFile = join(ROOT_DIR, 'src', 'cli', 'simple-cli.js');
if (existsSync(jsFile)) {
const child = spawn('node', [jsFile, ...args], {
stdio: 'inherit',
shell: false
});
child.on('error', (error) => {
console.error('❌ Node.js execution failed:', error.message);
process.exit(1);
});
child.on('exit', (code) => {
process.exit(code || 0);
});
return;
}
// Fallback to TypeScript version with tsx
const tsFile = join(ROOT_DIR, 'src', 'cli', 'simple-cli.ts');
if (existsSync(tsFile)) {
const child = spawn('tsx', [tsFile, ...args], {
stdio: 'inherit',
shell: false
});
child.on('error', (error) => {
console.error('❌ tsx execution failed:', error.message);
console.log('\n🔄 Trying npx tsx...');
// Try npx tsx as final fallback
const npxChild = spawn('npx', ['tsx', tsFile, ...args], {
stdio: 'inherit',
shell: false
});
npxChild.on('error', (npxError) => {
console.error('❌ npx tsx also failed:', npxError.message);
showFallbackHelp();
process.exit(1);
});
npxChild.on('exit', (code) => {
process.exit(code || 0);
});
});
child.on('exit', (code) => {
process.exit(code || 0);
});
return;
}
// No runtime found
showFallbackHelp();
process.exit(1);
} catch (error) {
console.error('❌ Unexpected error:', error.message);
showFallbackHelp();
process.exit(1);
}
}
function showFallbackHelp() {
console.log(`🧠 Claude-Flow v${VERSION} - Advanced AI Agent Orchestration System`);
console.log('');
console.log('⚠️ No compatible runtime found.');
console.log('');
console.log('To install and run:');
console.log(' 1. Install tsx: npm install -g tsx');
console.log(' 2. Run: claude-flow <command>');
console.log('');
console.log('Or use directly:');
console.log(' node src/cli/simple-cli.js <command>');
console.log('');
console.log('Documentation: https://github.com/ruvnet/claude-code-flow');
}
main();
+9 -6
View File
@@ -1,12 +1,13 @@
{
"name": "claude-flow",
"version": "2.0.0-alpha.74",
"version": "2.0.0-alpha.75",
"description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)",
"main": "cli.mjs",
"bin": {
"claude-flow": "./bin/claude-flow"
"claude-flow": "./bin/claude-flow.js"
},
"scripts": {
"preinstall": "node -e \"if(process.platform === 'win32' && process.env.npm_config_user_agent && process.env.npm_config_user_agent.includes('npm')) { console.warn('⚠️ Warning: On Windows, it is recommended to use pnpm to install this package to avoid potential native dependency build issues.'); console.warn('💡 Try: pnpm install or pnpx claude-flow@alpha'); }\"",
"dev": "tsx src/cli/main.ts",
"build": "npm run clean && npm run update-version && npm run build:esm && npm run build:cjs && npm run build:binary",
"update-version": "node scripts/update-bin-version.js",
@@ -45,7 +46,7 @@
"format": "prettier --write 'src/**/*.{ts,js,json}'",
"diagnostics": "node -e \"import('./dist/monitoring/diagnostics.js').then(m => m.DiagnosticManager.quickDiagnostic().then(console.log))\"",
"health-check": "node -e \"import('./dist/monitoring/health-check.js').then(m => new m.HealthCheckManager().performHealthCheck().then(console.log))\"",
"postinstall": "node scripts/install.js && node scripts/install-arm64.js",
"postinstall": "node scripts/install-arm64.js",
"prepublishOnly": "npm run update-version",
"publish:alpha": "npm publish --tag alpha",
"publish:major": "npm version major && npm publish",
@@ -105,13 +106,11 @@
"dependencies": {
"@modelcontextprotocol/sdk": "^1.0.4",
"@types/better-sqlite3": "^7.6.13",
"better-sqlite3": "^12.2.0",
"blessed": "^0.1.81",
"chalk": "^4.1.2",
"cli-table3": "^0.6.3",
"commander": "^11.1.0",
"cors": "^2.8.5",
"diskusage": "^1.1.3",
"express": "^4.18.2",
"figlet": "^1.8.1",
"fs-extra": "^11.2.0",
@@ -120,12 +119,16 @@
"helmet": "^7.1.0",
"inquirer": "^9.2.12",
"nanoid": "^5.0.4",
"node-pty": "^1.0.0",
"ora": "^7.0.1",
"p-queue": "^8.1.0",
"ruv-swarm": "^1.0.14",
"ws": "^8.18.3"
},
"optionalDependencies": {
"better-sqlite3": "^12.2.0",
"diskusage": "^1.1.3",
"node-pty": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.28.0",
"@babel/plugin-syntax-import-attributes": "^7.27.1",
+8382
View File
File diff suppressed because it is too large. Load diff
+31 -20
View File
@@ -4,7 +4,7 @@ import os from 'node:os';
import path from 'node:path';
import fs from 'node:fs';
import https from 'node:https';
import { spawn } from 'node:child_process';
import { spawn, exec } from 'node:child_process';
console.log('Installing Claude-Flow...');
@@ -26,28 +26,39 @@ async function installDeno() {
console.log('Deno not found. Installing Deno...');
const platform = os.platform();
const arch = os.arch();
if (platform === 'win32') {
console.log('Please install Deno manually from https://deno.land/');
process.exit(1);
}
return new Promise((resolve, reject) => {
const installScript = spawn('curl', ['-fsSL', 'https://deno.land/x/install/install.sh'], { stdio: 'pipe' });
const sh = spawn('sh', [], { stdio: ['pipe', 'inherit', 'inherit'] });
installScript.stdout.pipe(sh.stdin);
sh.on('close', (code) => {
if (code === 0) {
console.log('Deno installed successfully!');
resolve();
} else {
reject(new Error('Failed to install Deno'));
}
return new Promise((resolve, reject) => {
console.log('Installing Deno on Windows using PowerShell...');
const psCommand = `powershell -Command "irm https://deno.land/install.ps1 | iex"`;
exec(psCommand, (error, stdout, stderr) => {
if (error) {
console.error('Failed to install Deno with PowerShell:', stderr);
console.log('Please install Deno manually from https://deno.land/');
reject(new Error('Failed to install Deno'));
} else {
console.log('Deno installed successfully!');
resolve();
}
});
});
});
} else {
return new Promise((resolve, reject) => {
const installScript = spawn('curl', ['-fsSL', 'https://deno.land/x/install/install.sh'], { stdio: 'pipe' });
const sh = spawn('sh', [], { stdio: ['pipe', 'inherit', 'inherit'] });
installScript.stdout.pipe(sh.stdin);
sh.on('close', (code) => {
if (code === 0) {
console.log('Deno installed successfully!');
resolve();
} else {
reject(new Error('Failed to install Deno'));
}
});
});
}
}
// Main installation process
+2 -2
View File
@@ -5,14 +5,14 @@
import { HelpFormatter } from './help-formatter.js';
export const VERSION = '2.0.0-alpha.74';
export const VERSION = '2.0.0-alpha.75';
export const MAIN_HELP = `
🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with 87 MCP tools, neural networking, and production-ready infrastructure
🐝 NEW: Advanced Hive Mind System with Queen-led coordination, collective intelligence, and unlimited scaling
⚡ ALPHA 74: Fixed SQLite loading & hive-mind sessions, async/await corrections for better reliability
⚡ ALPHA 75: Windows compatibility overhaul with cross-platform Node.js dispatcher
USAGE:
claude-flow <command> [options]
+2 -2
View File
@@ -6,7 +6,7 @@
import { readdir, stat, mkdir, readFile, writeFile, unlink, rmdir } from 'fs/promises';
import { existsSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import { dirname, join, normalize } from 'path';
import process from 'process';
import { spawn } from 'child_process';
@@ -163,7 +163,7 @@ export const getFilename = (importMetaUrl) => {
// Check if this is the main module (Node.js equivalent of import.meta.main)
export const isMainModule = (importMetaUrl) => {
const __filename = fileURLToPath(importMetaUrl);
return process.argv[1] === __filename;
return normalize(process.argv[1]) === normalize(__filename);
};
// Helper to check file existence