// tools/checkpoint/list-checkpoints-handler.ts — list_pending_checkpoints handler (SPEC-411)
import { getPendingWorkflowCheckpoints } from '../../storage/workflow-checkpoint-store.js';
export async function handleListPendingCheckpoints(args) {
    const { projectPath, role } = args;
    const pending = await getPendingWorkflowCheckpoints(projectPath, role);
    if (pending.length === 0) {
        const roleNote = role !== undefined ? ` for role "${role}"` : '';
        return {
            content: [{ type: 'text', text: `No pending checkpoints${roleNote}.` }],
            structuredContent: { checkpoints: [] },
        };
    }
    const lines = pending.map((c) => `• [${c.id.slice(0, 8)}] ${c.specId} — ${c.blockingTransition} — needs ${c.requiredRole} (requested by ${c.requestedBy} at ${c.requestedAt})`);
    const roleNote = role !== undefined ? ` (filtered by role: ${role})` : '';
    return {
        content: [
            {
                type: 'text',
                text: [`Pending checkpoints${roleNote}:`, '', ...lines].join('\n'),
            },
        ],
        structuredContent: { checkpoints: pending },
    };
}
//# sourceMappingURL=list-checkpoints-handler.js.map