ruvnet / ruvnet/ruflo

Fix: Remove all Deno dependencies and fix npx/global execution

Open
#146 7 comments 0 reactions 0 assignees View on GitHub
already-fixed
Dominant language
TypeScript
Stars
72.7k
Forks
8.6k
Avg merge
2d 23h
Merged PRs (30d)
83

Description

## Problem
The `claude-flow init` command was failing when run with `npx claude-flow init` or global `claude-flow init` commands because:

1. **Deno APIs throughout codebase** - The init system was using `Deno.writeTextFile`, `Deno.mkdir`, etc. which don't exist in Node.js
2. **Working directory issues** - Commands were executing in wrong directory due to spawn() configuration
3. **Command routing problems** - TypeScript CLI was being used instead of working JavaScript CLI

## Solution
✅ **Completely removed all Deno dependencies** and replaced with Node.js equivalents:

### File System Operations Fixed:
- `Deno.writeTextFile()` → `fs.writeFile()`
- `Deno.mkdir()` → `fs.mkdir()`
- `Deno.stat()` → `fs.stat()`
- `Deno.Command()` → `execSync()`
- `Deno.env.get()` → `process.env`
- `Deno.cwd()` → `process.cwd()`

### Command Routing Fixed:
- Added init, hooks, mcp commands to simple-cli.js routing in cli.mjs
- Fixed working directory by using `process.cwd()` instead of `__dirname`
- Properly imported `fs/promises` and `child_process`

### Template System Fixed:
- Silenced non-fatal template loading errors
- All commands now use fallback content when templates missing

## Testing Results
✅ All invocation methods now work correctly:

```bash
# Local wrapper - WORKS
./claude-flow init --force

# NPX command - WORKS
npx claude-flow init --force

# Global command - WORKS
claude-flow init --force
```

✅ **Files properly created**:
- `CLAUDE.md` (8455 bytes)
- `.claude/settings.json` (Claude Code hooks)
- `.claude/commands/` (All documentation)
- `.claude/helpers/` (Setup scripts)
- Memory and coordination directories

## Impact
- **No more Deno dependencies** - Pure Node.js/npm workflow
- **Consistent behavior** across all command invocation methods
- **Proper Claude Code integration** with working hooks
- **Production ready** for npm publishing

Fixes the core issue where users couldn't run `npx claude-flow init` successfully.

Contributor guide

Open the contributing guide

Research direction

Start by tracing command routing in cli.mjs and simple-cli.js, then inspect the init system for the listed Deno APIs and the fs/promises and child_process replacements. Run the local, npx, and global init commands with --force; done means each invocation uses the correct working directory and creates the listed Claude configuration files without Deno dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.