Refactor path management: Migrate path discovery logic to shared paths module
- Removed `path-discovery.ts` service and replaced its usage with a new `paths.ts` module. - Updated all commands and services to utilize the new path constants and helper functions. - Ensured all necessary directories are created using the new utility functions. - Improved code readability and maintainability by centralizing path configurations.
This commit is contained in:
+2
-6
@@ -6,10 +6,9 @@
|
||||
|
||||
import net from 'net';
|
||||
import { unlinkSync, existsSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { query } from '@anthropic-ai/claude-agent-sdk';
|
||||
import { HooksDatabase } from '../services/sqlite/HooksDatabase.js';
|
||||
import { PathDiscovery } from '../services/path-discovery.js';
|
||||
import { getWorkerSocketPath } from '../shared/paths.js';
|
||||
import { buildInitPrompt, buildObservationPrompt, buildFinalizePrompt } from './prompts.js';
|
||||
import { parseObservations, parseSummary } from './parser.js';
|
||||
import type { SDKSession } from './prompts.js';
|
||||
@@ -64,10 +63,7 @@ class SDKWorker {
|
||||
this.sessionDbId = sessionDbId;
|
||||
this.db = new HooksDatabase();
|
||||
this.abortController = new AbortController();
|
||||
|
||||
// Socket path: ~/.claude-mem/worker-{sessionId}.sock
|
||||
const dataDir = PathDiscovery.getInstance().getDataDirectory();
|
||||
this.socketPath = join(dataDir, `worker-${sessionDbId}.sock`);
|
||||
this.socketPath = getWorkerSocketPath(sessionDbId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user