// tools/checkpoint/reject-checkpoint-handler.ts — reject_checkpoint handler (SPEC-411)
import { rejectCheckpoint } from '../../engine/checkpoint/checkpoint-manager.js';
export async function handleRejectCheckpoint(args) {
    const { projectPath, checkpointId, rejectedBy = 'anonymous', reason } = args;
    let checkpoint;
    try {
        checkpoint = await rejectCheckpoint(projectPath, checkpointId, rejectedBy, reason);
    }
    catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        return {
            content: [{ type: 'text', text: `Error rejecting checkpoint: ${message}` }],
        };
    }
    return {
        content: [
            {
                type: 'text',
                text: [
                    `Checkpoint ${checkpointId} rejected by ${rejectedBy}.`,
                    `Spec: ${checkpoint.specId}`,
                    `Blocked transition: ${checkpoint.blockingTransition}`,
                    `Reason: ${reason}`,
                    '',
                    'The spec remains in its current status. Address the feedback and create a new checkpoint request when ready.',
                ].join('\n'),
            },
        ],
        structuredContent: { checkpoint },
    };
}
//# sourceMappingURL=reject-checkpoint-handler.js.map