// tools/create-spec/adapters/velocity-estimation.ts — Enrich estimation with calendar days (SPEC-555)
// Adapter pattern: called from create-spec.ts after estimation is computed.
// Silently falls back to null when no VelocityProfile is available.
import { hashProjectPath } from '../../../storage/index.js';
import { getVelocityProfile } from '../../../storage/velocity-store.js';
import { devHoursToCalendarDays, formatCalendarEstimate, } from '../../../engine/velocity/measure-velocity.js';
/**
 * Enrich an estimation with calendar days using the project's VelocityProfile.
 * Never throws — returns null calendarDays and a generic note on any failure.
 * SPEC-555
 */
export async function enrichEstimationWithVelocity(projectPath, devHours) {
    try {
        const projectId = hashProjectPath(projectPath);
        const profile = await getVelocityProfile(projectId);
        if (!profile) {
            return {
                calendarDays: null,
                velocityNote: 'No local velocity data yet — based on industry average',
            };
        }
        const calendarDays = devHoursToCalendarDays(devHours, profile);
        const velocityNote = formatCalendarEstimate(devHours, profile);
        return { calendarDays, velocityNote };
    }
    catch {
        return {
            calendarDays: null,
            velocityNote: 'No local velocity data yet — based on industry average',
        };
    }
}
//# sourceMappingURL=velocity-estimation.js.map