From bbf17f05610a99b3823e2f53ce5887f1febe128c Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 17 Jun 2025 02:00:49 +0000 Subject: [PATCH] fix: Improve Deno detection for hybrid binary functionality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add comprehensive Deno path detection - Check multiple potential Deno installation paths - Restore full functionality when Deno is available - Maintain graceful fallback when Deno is missing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- bin/claude-flow | 68 ++++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/bin/claude-flow b/bin/claude-flow index c183800e5e..6b9edb7605 100755 --- a/bin/claude-flow +++ b/bin/claude-flow @@ -1,8 +1,34 @@ #!/usr/bin/env node // note to AI never remove this script from the repository bin directory -// Simple fallback version for npm compatibility -const VERSION = '1.0.56'; +const { spawn } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const VERSION = '1.0.57'; + +// Check if Deno is installed +function checkDeno() { + // List of potential Deno paths + const potentialPaths = [ + 'deno', // In PATH + path.join(os.homedir(), '.deno', 'bin', 'deno'), + '/usr/local/bin/deno', + '/opt/homebrew/bin/deno' + ]; + + for (const denoPath of potentialPaths) { + try { + require('child_process').execSync(`"${denoPath}" --version`, { stdio: 'ignore' }); + return denoPath; + } catch { + // Continue to next path + } + } + + return null; +} function printMinimalHelp() { console.log(`Claude-Flow v${VERSION}`); @@ -20,16 +46,44 @@ function printMinimalHelp() { const args = process.argv.slice(2); +// Handle version command if (args.includes('--version') || args.includes('-v')) { console.log(`v${VERSION}`); process.exit(0); } -if (args.length === 0 || args.includes('--help') || args.includes('-h')) { +// Check for Deno +const denoPath = checkDeno(); + +if (!denoPath) { printMinimalHelp(); - process.exit(0); + process.exit(1); } -// For any other command, just show the help -printMinimalHelp(); -process.exit(1); \ No newline at end of file +// Use the simple CLI JavaScript file which works well +const cliPath = path.join(__dirname, '..', 'src', 'cli', 'simple-cli.js'); + +// Check if the CLI file exists +if (!fs.existsSync(cliPath)) { + console.error('Error: CLI file not found. Please reinstall claude-flow.'); + process.exit(1); +} + +// Run the CLI with Deno +const deno = spawn(denoPath, ['run', '--allow-all', '--no-check', cliPath, ...process.argv.slice(2)], { + stdio: 'inherit', + env: { + ...process.env, + PWD: process.cwd() + } +}); + +deno.on('error', (err) => { + console.error('Failed to start Claude-Flow:', err.message); + printMinimalHelp(); + process.exit(1); +}); + +deno.on('close', (code) => { + process.exit(code || 0); +}); \ No newline at end of file diff --git a/package.json b/package.json index 41fd02d5ad..fa28680c24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claude-flow", - "version": "1.0.56", + "version": "1.0.57", "description": "Advanced AI agent orchestration system for Claude Code", "main": "src/cli/main.ts", "bin": {