import { defineHandler } from '@kb-labs/sdk';
import { buildDependencyGraph, findCircularDependencies } from '@kb-labs/quality-core/graph';

// src/rest/handlers/cycles-handler.ts
var cycles_handler_default = defineHandler({
  async execute(ctx, input) {
    const graph = buildDependencyGraph(ctx.cwd);
    const cycles = findCircularDependencies(graph);
    const affectedPackages = Array.from(
      new Set(cycles.flat())
    );
    return {
      cycles,
      cycleCount: cycles.length,
      hasCircular: cycles.length > 0,
      affectedPackages
    };
  }
});

export { cycles_handler_default as default };
//# sourceMappingURL=cycles-handler.js.map
//# sourceMappingURL=cycles-handler.js.map