import { defineCommand, findRepoRoot } from '@kb-labs/sdk';
import { hasPlan, clearPlan } from '@kb-labs/commit-core';

// src/cli/commands/reset.ts
var reset_default = defineCommand({
  id: "commit:reset",
  description: "Clear current commit plan",
  handler: {
    async execute(ctx, input) {
      const startTime = Date.now();
      const cwd = await findRepoRoot(ctx.cwd || process.cwd()) ?? process.cwd();
      const scope = input.scope ?? "root";
      const exists = await hasPlan(cwd, scope);
      if (!exists) {
        ctx.ui?.info?.("No commit plan to clear.");
        return {
          exitCode: 0,
          result: {
            success: true,
            message: "No commit plan to clear."
          },
          meta: {
            timing: Date.now() - startTime
          }
        };
      }
      await clearPlan(cwd, scope);
      ctx.ui?.success?.("Plan Cleared", {
        sections: [{
          items: [
            "Status: \u2705 Cleared successfully",
            "Action: Run `kb commit:generate` to create a new plan"
          ]
        }]
      });
      return {
        exitCode: 0,
        result: {
          success: true,
          message: "Commit plan cleared successfully."
        },
        meta: {
          timing: Date.now() - startTime
        }
      };
    }
  }
});

export { reset_default as default };
//# sourceMappingURL=reset.js.map
//# sourceMappingURL=reset.js.map