/** Threshold: ratio of criteria to files above this value is a concern. */
const CRITERIA_FILES_RATIO_THRESHOLD = 3;
/** Minimum criteria count that triggers the hours-mismatch check. */
const CRITERIA_HOURS_MIN_CRITERIA = 15;
/** Maximum hours under which the hours-mismatch warning fires. */
const CRITERIA_HOURS_MAX_HOURS = 2;
/**
 * Detects over-specification in a spec based on:
 * 1. Criteria/files ratio > 3
 * 2. 15+ criteria for a task estimated at <2 hours
 */
export function detectOverSpec(criteriaCount, filesToModify, estimatedHours) {
    const effectiveFiles = Math.max(filesToModify, 1);
    const ratio = criteriaCount / effectiveFiles;
    const warnings = [];
    // Check 1: criteria vs hours mismatch
    if (criteriaCount >= CRITERIA_HOURS_MIN_CRITERIA && estimatedHours < CRITERIA_HOURS_MAX_HOURS) {
        warnings.push({
            type: 'criteria-hours-mismatch',
            message: `${criteriaCount} criteria for a task estimated at ${estimatedHours}h is over-specified.`,
            suggestion: 'Reduce to 3-5 key criteria that capture the essential behavior.',
            metricValue: criteriaCount,
            threshold: CRITERIA_HOURS_MIN_CRITERIA,
        });
    }
    // Check 2: criteria to files ratio
    if (ratio > CRITERIA_FILES_RATIO_THRESHOLD) {
        warnings.push({
            type: 'criteria-files-ratio',
            message: `Criteria/files ratio is ${ratio.toFixed(1)} (${criteriaCount} criteria, ${filesToModify} file${filesToModify !== 1 ? 's' : ''}).`,
            suggestion: 'Consider splitting into smaller specs or reducing criteria count.',
            metricValue: ratio,
            threshold: CRITERIA_FILES_RATIO_THRESHOLD,
        });
    }
    return {
        isOverSpecified: warnings.length > 0,
        warnings,
        criteriaToFilesRatio: ratio,
    };
}
//# sourceMappingURL=over-spec-detector.js.map