import { InMemorySupervisorStatusStore } from '../modules/supervisor-management/interface-adapters/gateways/supervisorStatusStore.memory.gateway.js';
import { FileSystemReviewRequestTrackingGateway } from '../modules/tracking/interface-adapters/gateways/fileSystem/reviewRequestTracking.fileSystem.js';
import { FileSystemStatsGateway } from '../modules/statistics-insights/interface-adapters/gateways/fileSystem/stats.fileSystem.js';
import { FileSystemInsightsGateway } from '../modules/statistics-insights/interface-adapters/gateways/fileSystem/insights.fileSystem.js';
import { FileSystemReviewFileGateway } from '../modules/review-execution/interface-adapters/gateways/fileSystem/reviewFile.fileSystem.js';
import { FileSystemReviewLogFileGateway } from '../modules/data-lifecycle/interface-adapters/gateways/fileSystem/reviewLogFile.fileSystem.gateway.js';
import { ReviewContextFileSystemGateway } from '../modules/review-execution/interface-adapters/gateways/reviewContext.fileSystem.gateway.js';
import { ReviewContextWatcherService } from '../modules/review-execution/services/reviewContextWatcher.service.js';
import { ReviewContextProgressPresenter } from '../modules/review-execution/interface-adapters/presenters/reviewContextProgress.presenter.js';
import { ProjectStatsCalculator } from '../modules/statistics-insights/interface-adapters/presenters/projectStats.calculator.js';
import { createDefaultClaudeInvocationDeps, } from '../frameworks/claude/claudeInvoker.js';
import { GitCommandCliGateway } from '../modules/worktree-management/interface-adapters/gateways/gitCommand.cli.gateway.js';
import { WorktreeFileSystemGateway } from '../modules/worktree-management/interface-adapters/gateways/worktree.fileSystem.gateway.js';
import { WorktreeSizeProbeCliGateway } from '../modules/worktree-management/interface-adapters/gateways/worktreeSizeProbe.cli.gateway.js';
import { WorktreePanelPresenter } from '../modules/worktree-management/interface-adapters/presenters/worktreePanel.presenter.js';
import { WorktreeHealthProbeFileSystemGateway } from '../modules/worktree-management/interface-adapters/gateways/worktreeHealthProbe.fileSystem.gateway.js';
import { InMemoryForceCleanupLockService } from '../modules/worktree-management/services/forceCleanupLock.js';
import { pino } from 'pino';
import { mkdirSync } from 'node:fs';
import { LOG_DIR, LOG_FILE_PATH } from '../shared/services/daemonPaths.js';
function createLoggerOptions() {
    const isDaemon = process.env.REVIEWFLOW_DAEMON === '1';
    if (isDaemon) {
        mkdirSync(LOG_DIR, { recursive: true });
        return {
            level: process.env.LOG_LEVEL || 'info',
        };
    }
    return {
        level: process.env.LOG_LEVEL || 'info',
        transport: process.env.NODE_ENV !== 'production'
            ? { target: 'pino-pretty', options: { colorize: true } }
            : undefined,
    };
}
function createLogger() {
    const isDaemon = process.env.REVIEWFLOW_DAEMON === '1';
    const options = createLoggerOptions();
    if (isDaemon) {
        return pino(options, pino.destination(LOG_FILE_PATH));
    }
    return pino(options);
}
export function createDependencies(config) {
    const logger = createLogger();
    const reviewContextGateway = new ReviewContextFileSystemGateway();
    const gitCommandExecutor = new GitCommandCliGateway();
    const worktreeGateway = new WorktreeFileSystemGateway({ executor: gitCommandExecutor });
    const worktreeSizeProbeGateway = new WorktreeSizeProbeCliGateway();
    const worktreeHealthProbeGateway = new WorktreeHealthProbeFileSystemGateway({
        executor: gitCommandExecutor,
    });
    const worktreePanelPresenter = new WorktreePanelPresenter({
        sizeProbe: worktreeSizeProbeGateway,
    });
    const forceCleanupLock = new InMemoryForceCleanupLockService();
    return {
        reviewRequestTrackingGateway: new FileSystemReviewRequestTrackingGateway(new ProjectStatsCalculator()),
        statsGateway: new FileSystemStatsGateway(),
        reviewFileGateway: new FileSystemReviewFileGateway(),
        reviewLogFileGateway: new FileSystemReviewLogFileGateway(),
        reviewContextGateway,
        insightsGateway: new FileSystemInsightsGateway(),
        reviewContextWatcher: new ReviewContextWatcherService(reviewContextGateway),
        progressPresenter: new ReviewContextProgressPresenter(),
        claudeInvocationDeps: createDefaultClaudeInvocationDeps(),
        supervisorStatusStore: new InMemorySupervisorStatusStore(),
        gitCommandExecutor,
        worktreeGateway,
        worktreeSizeProbeGateway,
        worktreeHealthProbeGateway,
        worktreePanelPresenter,
        sweepSchedulerControls: null,
        forceCleanupLock,
        logger,
        config,
    };
}
//# sourceMappingURL=dependencies.js.map