mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
fix: Add automatic AgentDB import extension patch
Fixes ERR_MODULE_NOT_FOUND error when using npx claude-flow@alpha
## Problem
AgentDB v1.3.9 has missing .js extensions in controller imports:
```javascript
// node_modules/agentdb/dist/controllers/index.js
export { ReflexionMemory } from './ReflexionMemory'; // ❌ Missing .js
```
This causes MODULE_NOT_FOUND errors in ESM environments, especially
when using npx which gets fresh installs without local patches.
## Solution
Added automatic postinstall patch that fixes AgentDB imports:
1. **patches/agentdb-fix-imports.patch** - Patch definition
2. **scripts/fix-agentdb-imports.sh** - Auto-apply script
3. **package.json** - Updated postinstall to run fix
The fix is applied automatically on:
- npm install
- npm update
- npx claude-flow@alpha (fresh installs)
## Changes
- Added patches/agentdb-fix-imports.patch
- Added scripts/fix-agentdb-imports.sh (executable)
- Updated package.json postinstall script
## Testing
✅ Verified locally with npx claude-flow@alpha memory list
✅ Import errors resolved
✅ All memory commands working
## Note
This is a temporary workaround until agentdb@1.3.9 is fixed upstream.
The patch adds .js extensions to ESM imports:
- ReflexionMemory.js
- SkillLibrary.js
- EmbeddingService.js
🚀 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
e683a92853
commit
b77c2967b4
3 files changed
+31
-1
No files matched your search
+1
-1
@@ -50,7 +50,7 @@
|
||||
"format": "prettier --write 'src/**/*.{ts,js,json}'",
|
||||
"diagnostics": "node -e \"import('./dist/monitoring/diagnostics.js').then(m => m.DiagnosticManager.quickDiagnostic().then(console.log))\"",
|
||||
"health-check": "node -e \"import('./dist/monitoring/health-check.js').then(m => new m.HealthCheckManager().performHealthCheck().then(console.log))\"",
|
||||
"postinstall": "node scripts/install-arm64.js",
|
||||
"postinstall": "node scripts/install-arm64.js && bash scripts/fix-agentdb-imports.sh",
|
||||
"prepublishOnly": "npm run update-version",
|
||||
"publish:alpha": "npm publish --tag alpha",
|
||||
"publish:major": "npm version major && npm publish",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/node_modules/agentdb/dist/controllers/index.js
|
||||
+++ b/node_modules/agentdb/dist/controllers/index.js
|
||||
@@ -3,6 +3,6 @@
|
||||
*
|
||||
* Export all memory controllers for agent systems
|
||||
*/
|
||||
-export { ReflexionMemory } from './ReflexionMemory';
|
||||
-export { SkillLibrary } from './SkillLibrary';
|
||||
-export { EmbeddingService } from './EmbeddingService';
|
||||
+export { ReflexionMemory } from './ReflexionMemory.js';
|
||||
+export { SkillLibrary } from './SkillLibrary.js';
|
||||
+export { EmbeddingService } from './EmbeddingService.js';
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Fix AgentDB missing .js extensions in imports
|
||||
# This is a workaround until agentdb@1.3.9 is fixed upstream
|
||||
|
||||
AGENTDB_INDEX="node_modules/agentdb/dist/controllers/index.js"
|
||||
|
||||
if [ -f "$AGENTDB_INDEX" ]; then
|
||||
echo "🔧 Fixing AgentDB import extensions..."
|
||||
|
||||
# Fix missing .js extensions
|
||||
sed -i "s/from '\.\/ReflexionMemory'/from '.\/ReflexionMemory.js'/g" "$AGENTDB_INDEX"
|
||||
sed -i "s/from '\.\/SkillLibrary'/from '.\/SkillLibrary.js'/g" "$AGENTDB_INDEX"
|
||||
sed -i "s/from '\.\/EmbeddingService'/from '.\/EmbeddingService.js'/g" "$AGENTDB_INDEX"
|
||||
|
||||
echo "✅ AgentDB imports fixed"
|
||||
else
|
||||
echo "⚠️ AgentDB not installed, skipping patch"
|
||||
fi
|
||||
Reference in new issue
Block a user