import { execSync } from 'node:child_process';
import { GitLabReviewActionCliGateway } from '../../../modules/review-execution/interface-adapters/gateways/cli/reviewAction.gitlab.cli.gateway.js';
import { GitHubReviewActionCliGateway } from '../../../modules/review-execution/interface-adapters/gateways/cli/reviewAction.github.cli.gateway.js';
const COMMAND_TIMEOUT_MS = 30000;
/**
 * @deprecated Use GitLabReviewActionCliGateway or GitHubReviewActionCliGateway directly
 */
export async function executeThreadActions(actions, context, _logger, executor) {
    const gatewayContext = {
        projectPath: context.projectPath,
        mrNumber: context.mrNumber,
        localPath: context.localPath,
        diffMetadata: context.diffMetadata,
        baseUrl: null,
    };
    const gateway = context.platform === 'gitlab'
        ? new GitLabReviewActionCliGateway(executor)
        : new GitHubReviewActionCliGateway(executor);
    return gateway.execute(actions, gatewayContext);
}
export const defaultCommandExecutor = (command, args, cwd) => {
    execSync(`${command} ${args.map(a => `'${a.replace(/'/g, "'\\''")}'`).join(' ')}`, {
        cwd,
        encoding: 'utf-8',
        timeout: COMMAND_TIMEOUT_MS,
    });
};
//# sourceMappingURL=threadActionsExecutor.js.map