Refactor hooks and worker service for improved error handling and initialization

- Removed try-catch blocks in new-hook, save-hook, and summary-hook for cleaner flow.
- Enhanced error handling in save and summary hooks to throw errors instead of logging and returning.
- Introduced ensureWorkerRunning utility to manage worker service lifecycle and health checks.
- Replaced dynamic port allocation with a fixed port for the worker service.
- Simplified path management and removed unused port allocator utility.
- Added database schema initialization for fresh installations and improved migration handling.
This commit is contained in:
Alex Newman
2025-10-19 00:57:49 -04:00
parent cf9d1d4a0b
commit 7ff611feb5
23 changed files with 832 additions and 434 deletions
+3 -9
View File
@@ -11,13 +11,7 @@ import { stdin } from 'process';
let input = '';
stdin.on('data', (chunk) => input += chunk);
stdin.on('end', async () => {
try {
const parsed = input.trim() ? JSON.parse(input) : undefined;
await saveHook(parsed);
process.exit(0);
} catch (error: any) {
console.error(`[claude-mem save-hook error: ${error.message}]`);
console.log('{"continue": true, "suppressOutput": true}');
process.exit(0);
}
const parsed = input.trim() ? JSON.parse(input) : undefined;
await saveHook(parsed);
process.exit(0);
});