import { defineHandler } from '@kb-labs/sdk';
import { COMMIT_CACHE_PREFIX } from '@kb-labs/commit-contracts';
import { clearPlan } from '@kb-labs/commit-core/storage';

// src/rest/handlers/reset-handler.ts
var reset_handler_default = defineHandler({
  async execute(ctx, input) {
    const scope = input.query?.scope || "root";
    try {
      await clearPlan(ctx.cwd, scope);
      const appliedCacheKey = `${COMMIT_CACHE_PREFIX}plan-applied:${scope}`;
      await ctx.platform.cache.delete(appliedCacheKey);
      return {
        success: true,
        message: "Commit plan deleted successfully",
        scope
      };
    } catch (error) {
      return {
        success: false,
        message: `Failed to delete plan: ${error}`,
        scope
      };
    }
  }
});

export { reset_handler_default as default };
//# sourceMappingURL=reset-handler.js.map
//# sourceMappingURL=reset-handler.js.map