mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
fix: Improve Deno detection for hybrid binary functionality
- 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 <noreply@anthropic.com>
This commit is contained in:
1 parent
838a6a9da7
commit
bbf17f0561
2 files changed
+62
-8
No files matched your search
+61
-7
@@ -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);
|
||||
// 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);
|
||||
});
|
||||
+1
-1
@@ -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": {
|
||||
|
||||
Reference in new issue
Block a user