Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix: v2.7.18 - Return false instead of throwing error to allow JSON fallback in npx

rUvc830c2b6d828
diff --git a/.claude-flow/metrics/performance.json b/.claude-flow/metrics/performance.json
index d60b8f501d..b40ee611a0 100644
--- a/.claude-flow/metrics/performance.json
+++ b/.claude-flow/metrics/performance.json
@@ -1,7 +1,7 @@
{
- "startTime": 1761423979194,
- "sessionId": "session-1761423979194",
- "lastActivity": 1761423979194,
+ "startTime": 1761424163202,
+ "sessionId": "session-1761424163202",
+ "lastActivity": 1761424163202,
"sessionDuration": 0,
"totalTasks": 1,
"successfulTasks": 1,
diff --git a/.claude-flow/metrics/system-metrics.json b/.claude-flow/metrics/system-metrics.json
index 82f8f9d18d..4c468842ed 100644
--- a/.claude-flow/metrics/system-metrics.json
+++ b/.claude-flow/metrics/system-metrics.json
@@ -5470,5 +5470,77 @@
"cpuLoad": 0.06125,
"platform": "linux",
"uptime": 15869.58
+ },
+ {
+ "timestamp": 1761423995586,
+ "memoryTotal": 67427540992,
+ "memoryUsed": 5787975680,
+ "memoryFree": 61639565312,
+ "memoryUsagePercent": 8.583993417002587,
+ "memoryEfficiency": 91.41600658299741,
+ "cpuCount": 16,
+ "cpuLoad": 0.0575,
+ "platform": "linux",
+ "uptime": 15899.61
+ },
+ {
+ "timestamp": 1761424025594,
+ "memoryTotal": 67427540992,
+ "memoryUsed": 5577269248,
+ "memoryFree": 61850271744,
+ "memoryUsagePercent": 8.27150028897201,
+ "memoryEfficiency": 91.728499711028,
+ "cpuCount": 16,
+ "cpuLoad": 0.04375,
+ "platform": "linux",
+ "uptime": 15929.62
+ },
+ {
+ "timestamp": 1761424055608,
+ "memoryTotal": 67427540992,
+ "memoryUsed": 5461463040,
+ "memoryFree": 61966077952,
+ "memoryUsagePercent": 8.099751169404175,
+ "memoryEfficiency": 91.90024883059583,
+ "cpuCount": 16,
+ "cpuLoad": 0.03375,
+ "platform": "linux",
+ "uptime": 15959.63
+ },
+ {
+ "timestamp": 1761424085638,
+ "memoryTotal": 67427540992,
+ "memoryUsed": 5471850496,
+ "memoryFree": 61955690496,
+ "memoryUsagePercent": 8.115156530251062,
+ "memoryEfficiency": 91.88484346974894,
+ "cpuCount": 16,
+ "cpuLoad": 0.029375,
+ "platform": "linux",
+ "uptime": 15989.66
+ },
+ {
+ "timestamp": 1761424115669,
+ "memoryTotal": 67427540992,
+ "memoryUsed": 5462982656,
+ "memoryFree": 61964558336,
+ "memoryUsagePercent": 8.102004871641634,
+ "memoryEfficiency": 91.89799512835836,
+ "cpuCount": 16,
+ "cpuLoad": 0.041875,
+ "platform": "linux",
+ "uptime": 16019.69
+ },
+ {
+ "timestamp": 1761424145699,
+ "memoryTotal": 67427540992,
+ "memoryUsed": 5443334144,
+ "memoryFree": 61984206848,
+ "memoryUsagePercent": 8.072864683951368,
+ "memoryEfficiency": 91.92713531604863,
+ "cpuCount": 16,
+ "cpuLoad": 0.05125,
+ "platform": "linux",
+ "uptime": 16049.72
}
]
\ No newline at end of file
diff --git a/.claude-flow/metrics/task-metrics.json b/.claude-flow/metrics/task-metrics.json
index 8d9b6dcda8..0aa1b17cfd 100644
--- a/.claude-flow/metrics/task-metrics.json
+++ b/.claude-flow/metrics/task-metrics.json
@@ -1,10 +1,10 @@
[
{
- "id": "cmd-hooks-1761423979293",
+ "id": "cmd-hooks-1761424163301",
"type": "hooks",
"success": true,
- "duration": 7.072566000000052,
- "timestamp": 1761423979300,
+ "duration": 7.17650900000001,
+ "timestamp": 1761424163309,
"metadata": {}
}
]
\ No newline at end of file
diff --git a/bin/claude-flow b/bin/claude-flow
index 971b2905a6..927f1d084c 100755
--- a/bin/claude-flow
+++ b/bin/claude-flow
@@ -1,7 +1,7 @@
#!/bin/sh
# Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
-VERSION="2.7.17"
+VERSION="2.7.18"
# Determine the correct path based on how the script is invoked
if [ -L "$0" ]; then
diff --git a/docker-test/Dockerfile.npx-test b/docker-test/Dockerfile.npx-test
new file mode 100644
index 0000000000..7f432adfb7
--- /dev/null
+++ b/docker-test/Dockerfile.npx-test
@@ -0,0 +1,20 @@
+FROM node:20-slim
+
+# Install basic tools
+RUN apt-get update && apt-get install -y \
+ curl \
+ git \
+ && rm -rf /var/lib/apt/lists/*
+
+# Create working directory
+WORKDIR /test
+
+# Copy test script
+COPY test-npx-memory.sh /test/test-npx-memory.sh
+RUN chmod +x /test/test-npx-memory.sh
+
+# Set environment to ensure we're testing npx behavior
+ENV NPM_CONFIG_LOGLEVEL=warn
+
+# Run tests
+CMD ["/test/test-npx-memory.sh"]
diff --git a/docker-test/test-npx-memory.sh b/docker-test/test-npx-memory.sh
new file mode 100755
index 0000000000..05f953e043
--- /dev/null
+++ b/docker-test/test-npx-memory.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+# Test npx memory commands in Docker to validate v2.7.17 fix
+# This simulates a clean remote environment without local dependencies
+
+set -e
+
+echo "🐳 Testing claude-flow@alpha npx memory commands in Docker"
+echo "============================================================"
+echo ""
+
+# Test 1: Version check
+echo "πŸ“‹ Test 1: Version Check"
+echo "Command: npx claude-flow@alpha --version"
+npx claude-flow@alpha --version
+echo "βœ… Version check passed"
+echo ""
+
+# Test 2: Memory store (should auto-fallback to JSON)
+echo "πŸ“‹ Test 2: Memory Store with Auto-Fallback"
+echo "Command: npx claude-flow@alpha memory store 'api-design' 'REST with JWT auth'"
+npx claude-flow@alpha memory store "api-design" "REST with JWT auth" 2>&1 | tee /tmp/store-output.txt
+echo ""
+
+# Validate output
+if grep -q "Automatically using JSON fallback" /tmp/store-output.txt; then
+ echo "βœ… Auto-fallback message detected"
+else
+ echo "⚠️ Auto-fallback message NOT found (may be using different mode)"
+fi
+
+if grep -q "Stored:" /tmp/store-output.txt || grep -q "βœ…" /tmp/store-output.txt; then
+ echo "βœ… Memory store succeeded"
+else
+ echo "❌ Memory store FAILED"
+ exit 1
+fi
+echo ""
+
+# Test 3: Memory query
+echo "πŸ“‹ Test 3: Memory Query"
+echo "Command: npx claude-flow@alpha memory query 'authentication'"
+npx claude-flow@alpha memory query "authentication" 2>&1 | tee /tmp/query-output.txt
+echo ""
+
+# Validate query output
+if grep -q "api-design" /tmp/query-output.txt || grep -q "REST" /tmp/query-output.txt; then
+ echo "βœ… Memory query found stored data"
+else
+ echo "⚠️ Memory query did not find data (may be namespace issue)"
+fi
+echo ""
+
+# Test 4: Memory stats
+echo "πŸ“‹ Test 4: Memory Statistics"
+echo "Command: npx claude-flow@alpha memory stats"
+npx claude-flow@alpha memory stats 2>&1 | tee /tmp/stats-output.txt
+echo ""
+
+if grep -q "Total Entries:" /tmp/stats-output.txt; then
+ echo "βœ… Memory stats succeeded"
+else
+ echo "❌ Memory stats FAILED"
+ exit 1
+fi
+echo ""
+
+# Test 5: Memory list
+echo "πŸ“‹ Test 5: Memory List"
+echo "Command: npx claude-flow@alpha memory list"
+npx claude-flow@alpha memory list 2>&1
+echo "βœ… Memory list succeeded"
+echo ""
+
+echo "============================================================"
+echo "βœ… ALL TESTS PASSED!"
+echo ""
+echo "Summary:"
+echo "- Version check: βœ…"
+echo "- Memory store with auto-fallback: βœ…"
+echo "- Memory query: βœ…"
+echo "- Memory stats: βœ…"
+echo "- Memory list: βœ…"
+echo ""
+echo "The npx memory command fix in v2.7.17 is working correctly!"
diff --git a/package.json b/package.json
index 45656f6ac9..d26a482015 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "2.7.17",
+ "version": "2.7.18",
"description": "Enterprise-grade AI agent orchestration with WASM-powered ReasoningBank memory and AgentDB vector database (always uses latest agentic-flow)",
"mcpName": "io.github.ruvnet/claude-flow",
"main": "cli.mjs",
diff --git a/src/reasoningbank/reasoningbank-adapter.js b/src/reasoningbank/reasoningbank-adapter.js
index b12aea84fb..782c779a83 100644
--- a/src/reasoningbank/reasoningbank-adapter.js
+++ b/src/reasoningbank/reasoningbank-adapter.js
@@ -41,31 +41,33 @@ async function ensureInitialized() {
console.log('[ReasoningBank] Node.js backend initialized successfully');
return true;
} catch (error) {
- console.error('[ReasoningBank] Backend initialization failed:', error);
-
// Check if this is the better-sqlite3 missing error (npx issue)
const isSqliteError = error.message?.includes('BetterSqlite3 is not a constructor') ||
error.message?.includes('better-sqlite3') ||
error.message?.includes('could not run migrations');
-
- if (isSqliteError) {
- const isNpx = process.env.npm_config_user_agent?.includes('npx') ||
- process.cwd().includes('_npx');
-
- if (isNpx) {
- console.error('\n⚠️ NPX LIMITATION DETECTED\n');
- console.error('ReasoningBank requires better-sqlite3, which is not available in npx temp directories.\n');
- console.error('πŸ“š Solutions:\n');
- console.error(' 1. LOCAL INSTALL (Recommended):');
- console.error(' npm install && node_modules/.bin/claude-flow memory store "key" "value"\n');
- console.error(' 2. USE MCP TOOLS instead:');
- console.error(' mcp__claude-flow__memory_usage({ action: "store", key: "test", value: "data" })\n');
- console.error(' 3. USE JSON FALLBACK:');
- console.error(' npx claude-flow@alpha memory store "key" "value" --basic\n');
- console.error('See: docs/MEMORY_COMMAND_FIX.md for details\n');
- }
+ const isNpx = process.env.npm_config_user_agent?.includes('npx') ||
+ process.cwd().includes('_npx');
+
+ if (isSqliteError && isNpx) {
+ // NPX limitation - show helpful message but DON'T throw
+ // This allows the command to fall back to JSON mode
+ console.error('\n⚠️ NPX LIMITATION DETECTED\n');
+ console.error('ReasoningBank requires better-sqlite3, which is not available in npx temp directories.\n');
+ console.error('πŸ“š Solutions:\n');
+ console.error(' 1. LOCAL INSTALL (Recommended):');
+ console.error(' npm install && node_modules/.bin/claude-flow memory store "key" "value"\n');
+ console.error(' 2. USE MCP TOOLS instead:');
+ console.error(' mcp__claude-flow__memory_usage({ action: "store", key: "test", value: "data" })\n');
+ console.error(' 3. USE JSON FALLBACK (automatic):');
+ console.error(' Command will continue with JSON storage...\n');
+ console.error('See: docs/MEMORY_COMMAND_FIX.md for details\n');
+
+ // Return false to signal initialization failed but allow fallback
+ return false;
}
+ // Not npx or not SQLite error - log and throw
+ console.error('[ReasoningBank] Backend initialization failed:', error);
throw new Error(`Failed to initialize ReasoningBank: ${error.message}`);
}
})();
@@ -75,11 +77,12 @@ async function ensureInitialized() {
/**
* Initialize ReasoningBank database (Node.js version)
+ * Returns true if initialized, false if failed (allows fallback)
*/
export async function initializeReasoningBank() {
// Initialize the Node.js backend
- await ensureInitialized();
- return true;
+ const result = await ensureInitialized();
+ return result;
}
/**