/**
* Deploy Tool Handler
* Executes a deployment on Komodo
*/
import type { KomodoClient } from '../../core/KomodoClient';
import { Logger } from '../../utils/logger';
export interface DeployOptions {
force?: boolean;
stopBeforeStart?: boolean;
skipPull?: boolean;
}
export interface DeployRequest {
id: string;
options?: DeployOptions;
}
export interface DeployResponse {
success: boolean;
deploymentId: string;
jobId?: string;
status: 'queued' | 'running' | 'completed' | 'failed';
message: string;
startedAt?: string;
logs?: string[];
}
/**
* Execute a deployment
*/
export async function executeDeploy(
client: KomodoClient,
request: DeployRequest
): Promise<DeployResponse> {
const logger = Logger.getInstance();
try {
logger.info('Executing deployment', { deploymentId: request.id });
const response = await client.post<DeployResponse>(
`/execute/deploy/${request.id}`,
request.options || {}
);
logger.info('Deployment execution initiated', {
deploymentId: request.id,
jobId: response.jobId,
status: response.status
});
return response;
} catch (error) {
logger.error('Failed to execute deployment', {
deploymentId: request.id,
error: error instanceof Error ? error.message : String(error)
});
throw error;
}
}