diff --git a/backend/src/index.ts b/backend/src/index.ts index 798c849d..bc0b50df 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -10,7 +10,7 @@ import { createIPCServer, type IPCServer } from './ipc/ipcServer' import { GitAuthService } from './services/git-auth' import { createSettingsRoutes } from './routes/settings' import { createHealthRoutes } from './routes/health' -import { createTTSRoutes, cleanupExpiredCache } from './routes/tts' +import { createTTSRoutes, cleanupExpiredCache } from './routes/tts'; import { createSTTRoutes } from './routes/stt' import { createFileRoutes } from './routes/files' import { createProvidersRoutes } from './routes/providers' @@ -27,7 +27,6 @@ import { sseAggregator } from './services/sse-aggregator' import { ensureDirectoryExists, writeFileContent, fileExists, readFileContent } from './services/file-operations' import { SettingsService } from './services/settings' import { opencodeServerManager } from './services/opencode-single-server' -import { cleanupOrphanedDirectories } from './services/repo' import { proxyRequest, proxyMcpAuthStart, proxyMcpAuthAuthenticate } from './services/proxy' import { NotificationService } from './services/notification' import { logger } from './utils/logger' @@ -181,9 +180,6 @@ try { await ensureDirectoryExists(getConfigPath()) logger.info('Workspace directories initialized') - await cleanupOrphanedDirectories(db) - logger.info('Orphaned directory cleanup completed') - await cleanupExpiredCache() await ensureDefaultConfigExists() diff --git a/backend/src/services/repo.ts b/backend/src/services/repo.ts index 6d15afa9..84cc4abd 100644 --- a/backend/src/services/repo.ts +++ b/backend/src/services/repo.ts @@ -710,30 +710,6 @@ function normalizeRepoUrl(url: string, preserveSSH: boolean = false): { url: str } } -export async function cleanupOrphanedDirectories(database: Database): Promise { - try { - const reposPath = getReposPath() - await ensureDirectoryExists(reposPath) - - const dirResult = await executeCommand(['ls', '-1'], reposPath).catch(() => '') - const directories = dirResult.split('\n').filter(d => d.trim()) - - if (directories.length === 0) { - return - } - - const allRepos = db.listRepos(database) - const trackedPaths = new Set(allRepos.map(r => r.localPath.split('/').pop())) - const orphanedDirs = directories.filter(dir => !trackedPaths.has(dir)) - - for (const dir of orphanedDirs) { - await executeCommand(['rm', '-rf', dir], reposPath).catch(() => {}) - } - } catch { - // Cleanup is best-effort - } -} - async function createWorktreeSafely(baseRepoPath: string, worktreePath: string, branch: string, env: Record): Promise { const currentBranch = await safeGetCurrentBranch(baseRepoPath, env) if (currentBranch === branch) {