From 502cd0e478814360b5b8c68c8a5955c8adc242bc Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 16 Feb 2026 18:22:49 +0000 Subject: [PATCH] Fix ruflo CLI wrapper and hook paths for subdirectory execution - Fix ruflo bin to walk node_modules tree instead of using require.resolve (blocked by @claude-flow/cli strict exports map) - Use git rev-parse --show-toplevel for all hook paths in settings.json so hooks work from any subdirectory - Update CLAUDE.md publishing rules to include ruflo as third package - Bump ruflo to 3.1.0-alpha.16 Co-Authored-By: claude-flow --- .claude/settings.json | 30 +++++++++++++++--------------- CLAUDE.md | 32 ++++++++++++++++++++++---------- ruflo/bin/ruflo.js | 26 +++++++++++++++++++------- ruflo/package.json | 2 +- 4 files changed, 57 insertions(+), 33 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index adcd2d7b0f..e131e51d69 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -47,7 +47,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs pre-bash", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" pre-bash", "timeout": 5000 } ] @@ -59,7 +59,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs post-edit", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" post-edit", "timeout": 10000 } ] @@ -70,7 +70,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs route", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" route", "timeout": 10000 } ] @@ -81,12 +81,12 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs session-restore", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" session-restore", "timeout": 15000 }, { "type": "command", - "command": "node .claude/helpers/auto-memory-hook.mjs import", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/auto-memory-hook.mjs\" import", "timeout": 8000 } ] @@ -97,7 +97,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs session-end", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" session-end", "timeout": 10000 } ] @@ -108,7 +108,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/auto-memory-hook.mjs sync", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/auto-memory-hook.mjs\" sync", "timeout": 10000 } ] @@ -120,11 +120,11 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs compact-manual" + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" compact-manual" }, { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs session-end", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" session-end", "timeout": 5000 } ] @@ -134,11 +134,11 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs compact-auto" + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" compact-auto" }, { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs session-end", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" session-end", "timeout": 6000 } ] @@ -149,7 +149,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs status", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" status", "timeout": 3000 } ] @@ -160,7 +160,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs post-task", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" post-task", "timeout": 5000 } ] @@ -171,7 +171,7 @@ "hooks": [ { "type": "command", - "command": "node .claude/helpers/hook-handler.cjs post-task", + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/hook-handler.cjs\" post-task", "timeout": 5000 } ] @@ -286,7 +286,7 @@ }, "statusLine": { "type": "command", - "command": "node .claude/helpers/statusline.cjs" + "command": "node \"$(git rev-parse --show-toplevel)/.claude/helpers/statusline.cjs\"" }, "mcpServers": { "claude-flow": { diff --git a/CLAUDE.md b/CLAUDE.md index 96c32ea8a0..32346b6c74 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -826,10 +826,10 @@ npx claude-flow@v3alpha doctor --fix ### Publishing Rules -- MUST publish BOTH packages when publishing CLI changes -- MUST update ALL dist-tags for BOTH packages after publishing -- Always publish `@claude-flow/cli` first, then `claude-flow` (umbrella) -- MUST run verification before telling user publishing is complete +- MUST publish ALL THREE packages when publishing CLI changes: `@claude-flow/cli`, `claude-flow`, AND `ruflo` +- MUST update ALL dist-tags for ALL THREE packages after publishing +- Publish order: `@claude-flow/cli` first, then `claude-flow` (umbrella), then `ruflo` (alias umbrella) +- MUST run verification for ALL THREE before telling user publishing is complete ```bash # STEP 1: Build and publish CLI @@ -839,21 +839,28 @@ npm run build npm publish --tag alpha npm dist-tag add @claude-flow/cli@3.0.0-alpha.XXX latest -# STEP 2: Publish umbrella +# STEP 2: Publish claude-flow umbrella cd /workspaces/claude-flow -npm version 3.0.0-alpha.YYY --no-git-tag-version +npm version 3.0.0-alpha.XXX --no-git-tag-version npm publish --tag v3alpha -# STEP 3: Update ALL umbrella tags (CRITICAL - DON'T SKIP!) -npm dist-tag add claude-flow@3.0.0-alpha.YYY latest -npm dist-tag add claude-flow@3.0.0-alpha.YYY alpha +# STEP 3: Update ALL claude-flow umbrella tags (CRITICAL - DON'T SKIP!) +npm dist-tag add claude-flow@3.0.0-alpha.XXX latest +npm dist-tag add claude-flow@3.0.0-alpha.XXX alpha + +# STEP 4: Publish ruflo umbrella (CRITICAL - DON'T FORGET!) +cd /workspaces/claude-flow/ruflo +npm version 3.0.0-alpha.XXX --no-git-tag-version +npm publish --tag alpha +npm dist-tag add ruflo@3.0.0-alpha.XXX latest ``` **Verification (run before telling user):** ```bash npm view @claude-flow/cli dist-tags --json npm view claude-flow dist-tags --json -# BOTH packages need: alpha AND latest pointing to newest version +npm view ruflo dist-tags --json +# ALL THREE packages need: alpha AND latest pointing to newest version ``` ### All Tags That Must Be Updated @@ -861,11 +868,16 @@ npm view claude-flow dist-tags --json |---------|-----|-------------------| | `@claude-flow/cli` | `alpha` | `npx @claude-flow/cli@alpha` | | `@claude-flow/cli` | `latest` | `npx @claude-flow/cli@latest` | +| `@claude-flow/cli` | `v3alpha` | `npx @claude-flow/cli@v3alpha` | | `claude-flow` | `alpha` | `npx claude-flow@alpha` — EASY TO FORGET | | `claude-flow` | `latest` | `npx claude-flow@latest` | | `claude-flow` | `v3alpha` | `npx claude-flow@v3alpha` | +| `ruflo` | `alpha` | `npx ruflo@alpha` — EASY TO FORGET | +| `ruflo` | `latest` | `npx ruflo@latest` | +- Never forget the `ruflo` package — it's a thin wrapper users run via `npx ruflo@alpha` - Never forget the umbrella `alpha` tag — users run `npx claude-flow@alpha` +- `ruflo` source is in `/ruflo/` — it depends on `@claude-flow/cli` ## Plugin Registry Maintenance (IPFS/Pinata) diff --git a/ruflo/bin/ruflo.js b/ruflo/bin/ruflo.js index c00b6cbe49..5d79114f1f 100755 --- a/ruflo/bin/ruflo.js +++ b/ruflo/bin/ruflo.js @@ -1,16 +1,28 @@ #!/usr/bin/env node // Ruflo CLI - thin wrapper around @claude-flow/cli -import { createRequire } from 'node:module'; import { fileURLToPath } from 'node:url'; -import { dirname, resolve } from 'node:path'; +import { dirname, resolve, join } from 'node:path'; +import { existsSync } from 'node:fs'; const __dirname = dirname(fileURLToPath(import.meta.url)); -// Try loading from @claude-flow/cli dependency first, fall back to bundled -try { - const cliPath = createRequire(import.meta.url).resolve('@claude-flow/cli/bin/cli.js'); +// Walk up from ruflo/bin/ to find @claude-flow/cli in node_modules +function findCliPath() { + let dir = resolve(__dirname, '..'); + for (let i = 0; i < 10; i++) { + const candidate = join(dir, 'node_modules', '@claude-flow', 'cli', 'bin', 'cli.js'); + if (existsSync(candidate)) return candidate; + const parent = dirname(dir); + if (parent === dir) break; + dir = parent; + } + return null; +} + +const cliPath = findCliPath(); +if (cliPath) { await import(cliPath); -} catch { - // Fallback: try relative path (for development / linked installs) +} else { + // Fallback: dev/linked installs await import(resolve(__dirname, '../../v3/@claude-flow/cli/bin/cli.js')); } diff --git a/ruflo/package.json b/ruflo/package.json index ce2e1c962b..b08c9e7629 100644 --- a/ruflo/package.json +++ b/ruflo/package.json @@ -1,6 +1,6 @@ { "name": "ruflo", - "version": "3.1.0-alpha.14", + "version": "3.1.0-alpha.16", "description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration", "main": "bin/ruflo.js", "type": "module",