'use server';
import { resolve } from '../../lib/server-container.js';
import { createDeploymentLogger } from '../../../../../packages/core/src/infrastructure/services/deployment/deployment-logger.js';
const log = createDeploymentLogger('[deployRepository]');
export async function deployRepository(repositoryPath) {
    log.info(`called — repositoryPath="${repositoryPath}"`);
    try {
        const useCase = resolve('StartRepositoryDeploymentUseCase');
        const status = await useCase.execute(repositoryPath);
        log.info(`start succeeded — state=${status.state}`);
        return { success: true, state: status.state };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to deploy repository';
        log.error(`error: ${message}`, error);
        return { success: false, error: message };
    }
}
