async function handler(ctx) {
    const { projectPath, allSpecs } = ctx;
    if (!projectPath) {
        return;
    }
    try {
        const { resolveNextSpec } = await import('../../../engine/next-spec-resolver/index.js');
        const { writeNextSpec } = await import('../../../engine/next-spec-resolver/session-writer.js');
        const result = await resolveNextSpec(projectPath, allSpecs);
        await writeNextSpec(projectPath, result.spec ? { id: result.spec.id, title: result.spec.title, reason: result.reason } : null);
    }
    catch {
        /* best-effort — never throw */
    }
}
export const nextSpecResolverHook = {
    id: 'next-spec-resolver',
    triggers: ['done'],
    requiresProjectPath: true,
    label: 'Auto-resolve next spec after done (SPEC-686, Scenario 1)',
    handler,
};
//# sourceMappingURL=next-spec-resolver.hook.js.map