import { hashProjectPath } from '../../../storage/base-store.js';
import { measureVelocity } from '../../velocity/measure-velocity.js';
import { saveVelocityProfile } from '../../../storage/velocity-store.js';
async function handler(ctx) {
    const { projectPath } = ctx;
    if (!projectPath) {
        return;
    }
    const velocityProjectId = hashProjectPath(projectPath);
    await measureVelocity(projectPath)
        .then((profile) => saveVelocityProfile(velocityProjectId, profile))
        .catch(() => {
        /* fire-and-forget — never blocks */
    });
}
export const velocityProfileHook = {
    id: 'velocity-profile',
    triggers: ['done'],
    requiresProjectPath: true,
    label: 'Auto-refresh VelocityProfile when a spec reaches done (SPEC-555)',
    handler,
};
//# sourceMappingURL=velocity-profile.hook.js.map