fix: Use dynamic imports in hooks to fix better-sqlite3 loading

Changed all hook entry points to use dynamic imports after bootstrap runs. This ensures that better-sqlite3 is installed before Node.js attempts to resolve the import.

Changes:
- Modified src/bin/hooks/*.ts to call ensureDependencies() before dynamic import
- Moved from static `import { hook } from '...'` to `const { hook } = await import('...')`
- This delays module resolution until after npm install completes
- Bumped version to 4.0.6

The previous approach failed because static imports are resolved at module link time, before any runtime code (including ensureDependencies) executes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2025-10-20 16:54:28 -04:00
parent 9b1d801a46
commit 9dd8b180ac
12 changed files with 69 additions and 54 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "claude-mem",
"version": "4.0.5",
"version": "4.0.6",
"description": "Memory compression system for Claude Code - persist context across sessions",
"keywords": [
"claude",