-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Description
When running agentdb CLI commands in a project with "type": "module" in package.json, the CLI fails with:
❌ __dirname is not defined
Root Cause
dist/agentdb/cli/agentdb-cli.js line 55 uses __dirname:
const schemaPath = path.join(__dirname, '../schemas/frontier-schema.sql');But __dirname is a CommonJS global that doesn't exist in ESM modules.
Fix
Add ESM compatibility shim at the top of the file:
import { fileURLToPath } from 'url';
import { dirname } from 'path';
// ESM compatibility fix for __dirname
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);Environment
- Node.js: v22.x
- agentic-flow: 1.10.2
- OS: macOS
- Project type: ESM (
"type": "module"in package.json)
Workaround
Using pnpm patch to apply the fix locally until this is released.
Metadata
Metadata
Assignees
Labels
No labels