// engine/human-summary.ts — Plain-language one/two-sentence summaries for tool responses.
// Rules: no IDs/hashes, no jargon, max 2 sentences, always end with a next-step suggestion.
/** create_spec — plan was created successfully */
export function buildCreateSpecSummary(title, devHours) {
    const hours = devHours > 0 ? `Estimated ${String(devHours)}h` : 'Estimation ready';
    return `Plan created for "${title}". ${hours} — tell me when you're ready to review it.`;
}
/** update_status — status transition completed */
export function buildUpdateStatusSummary(title, newStatus) {
    if (newStatus === 'done') {
        return `Done! "${title}" is complete and recorded. Run estimate or start a new plan when you're ready.`;
    }
    if (newStatus === 'approved') {
        return `"${title}" is approved and ready to build. Start implementing whenever you like.`;
    }
    if (newStatus === 'implementing') {
        return `Implementation started for "${title}". Run validate when you think it's done.`;
    }
    if (newStatus === 'review') {
        return `"${title}" is now under review. Approve it or request changes to move forward.`;
    }
    if (newStatus === 'discarded') {
        return `"${title}" has been discarded. Create a new plan whenever you want to restart.`;
    }
    return `"${title}" moved to ${newStatus}. Check the next step suggestion above to continue.`;
}
/** check_readiness — readiness score evaluated */
export function buildCheckReadinessSummary(score, blockerCount) {
    if (score >= 90 && blockerCount === 0) {
        return `This plan has enough detail to start building. No blockers found — go ahead and approve it.`;
    }
    if (blockerCount > 0) {
        const noun = blockerCount === 1 ? 'blocker' : 'blockers';
        return `This plan has ${String(blockerCount)} ${noun} that must be fixed before building. Address them, then run check_readiness again.`;
    }
    if (score >= 70) {
        return `This plan is mostly ready with a score of ${String(score)}/100. Review the warnings, then approve it when satisfied.`;
    }
    return `This plan scores ${String(score)}/100 and needs more detail before it can be approved. Check the recommendations and fill in the gaps.`;
}
/** challenge_spec — risks and scenarios identified */
export function buildChallengeSpecSummary(topScenarios, overallRisk) {
    const count = topScenarios.length;
    if (count === 0) {
        return `No critical issues found — this plan looks solid. Approve it when you're ready to build.`;
    }
    const noun = count === 1 ? 'thing' : 'things';
    const items = topScenarios.map((s) => s.scenario);
    const list = count <= 3
        ? items.join(', ')
        : `${items.slice(0, 3).join(', ')}, and ${String(count - 3)} more`;
    const urgency = overallRisk === 'critical' || overallRisk === 'high' ? ' before coding' : '';
    return `${String(count)} ${noun} you must handle${urgency}: ${list}. Fix these, then run challenge_spec again to confirm.`;
}
/** validate — criteria checked against implementation */
export function buildValidateSummary(passing, total) {
    if (total === 0) {
        return `No criteria could be checked. Add acceptance criteria to the plan and run validate again.`;
    }
    const failing = total - passing;
    if (failing === 0) {
        return `All ${String(total)} criteria pass. Mark this feature as done when you're satisfied.`;
    }
    const noun = failing === 1 ? 'failing one' : `${String(failing)} failing ones`;
    return `${String(passing)} of ${String(total)} criteria pass. Fix the ${noun}, then run validate again.`;
}
/** list_specs — specs listed for a project */
export function buildListSpecsSummary(total, byStatus) {
    if (total === 0) {
        return `No plans found in this project yet. Use create_spec to add your first one.`;
    }
    const get = (key) => byStatus[key] ?? 0;
    const inProgress = get('implementing') + get('approved');
    const inReview = get('review');
    if (inReview > 0 && inProgress > 0) {
        const reviewNoun = inReview === 1 ? 'plan' : 'plans';
        return `You have ${String(inProgress)} in progress and ${String(inReview)} ${reviewNoun} ready to review. Start with the ones under review.`;
    }
    if (inReview > 0) {
        const noun = inReview === 1 ? 'plan' : 'plans';
        return `You have ${String(inReview)} ${noun} ready to review. Approve or request changes to move forward.`;
    }
    if (inProgress > 0) {
        const noun = inProgress === 1 ? 'plan' : 'plans';
        return `You have ${String(inProgress)} ${noun} in progress. Run validate when implementation is done.`;
    }
    return `You have ${String(total)} plans in this project. Approve a plan to start implementing.`;
}
/** estimate — time and cost estimated for a spec */
export function buildEstimateSummary(title, totalHours, taskCount) {
    const taskLabel = taskCount === 1 ? 'task' : 'tasks';
    const taskSuffix = taskCount > 0 ? ` across ${String(taskCount)} ${taskLabel}` : '';
    return `Estimated ${String(totalHours)}h total${taskSuffix} for "${title}". Approve the plan to start implementing.`;
}
//# sourceMappingURL=human-summary.js.map