import { defineHandler } from '@kb-labs/sdk';
import { analyzeStalePackages } from '@kb-labs/quality-core/stale';

// src/rest/handlers/stale-handler.ts
var stale_handler_default = defineHandler({
  async execute(ctx, input) {
    const { detailed } = input.query ?? {};
    const analysis = await analyzeStalePackages(ctx.cwd, detailed);
    return {
      stalePackages: analysis.stalePackages,
      totalStale: analysis.totalStale,
      totalAffected: analysis.totalAffected,
      criticalChains: detailed ? analysis.criticalChains : void 0
    };
  }
});

export { stale_handler_default as default };
//# sourceMappingURL=stale-handler.js.map
//# sourceMappingURL=stale-handler.js.map