// tools/checkpoint/approve-checkpoint-handler.ts — approve_checkpoint handler (SPEC-411)
import { approveCheckpoint } from '../../engine/checkpoint/checkpoint-manager.js';
export async function handleApproveCheckpoint(args) {
    const { projectPath, checkpointId, approvedBy = 'anonymous' } = args;
    let result;
    try {
        result = await approveCheckpoint(projectPath, checkpointId, approvedBy);
    }
    catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        return {
            content: [{ type: 'text', text: `Error approving checkpoint: ${message}` }],
        };
    }
    const { checkpoint } = result;
    return {
        content: [
            {
                type: 'text',
                text: [
                    `Checkpoint ${checkpointId} approved by ${approvedBy}.`,
                    `Spec: ${checkpoint.specId}`,
                    `Transition unblocked: ${checkpoint.blockingTransition}`,
                    '',
                    'Next step: run update_status to apply the transition now that the checkpoint is approved.',
                ].join('\n'),
            },
        ],
        structuredContent: { checkpoint, transitionApplied: result.transitionApplied },
    };
}
//# sourceMappingURL=approve-checkpoint-handler.js.map