Refactor database integration to use bun:sqlite instead of better-sqlite3

- Updated import statements across multiple files to use bun:sqlite.
- Changed database query methods from `prepare` to `query` for consistency.
- Removed dependency on better-sqlite3 from package.json and adjusted package.json to specify bun as the engine.
- Modified hook installation process to eliminate unnecessary dependency installation.
- Updated migration scripts to align with bun:sqlite's API.
This commit is contained in:
Alex Newman
2025-10-15 15:03:43 -04:00
parent b5bfc029c3
commit 2663121d9f
14 changed files with 351 additions and 364 deletions
+2 -15
View File
@@ -262,25 +262,12 @@ function writeHookFiles(timeout: number = 180000): void {
};
writeFileSync(join(runtimeHooksDir, 'config.json'), JSON.stringify(hookConfig, null, 2));
// Create package.json and install dependencies in hooks directory
// Create package.json in hooks directory (no dependencies needed with bun:sqlite)
const hookPackageJson = {
name: "claude-mem-hooks",
type: "module",
dependencies: {
"better-sqlite3": "^11.8.0"
}
type: "module"
};
writeFileSync(join(runtimeHooksDir, 'package.json'), JSON.stringify(hookPackageJson, null, 2));
// Install dependencies
try {
execSync('npm install --silent', {
cwd: runtimeHooksDir,
stdio: 'pipe'
});
} catch (error) {
// Silent fail - hooks might still work if better-sqlite3 is globally available
}
}