import {
  icons,
  theme
} from "../../chunk-kbtqrkwh.js";
import"../../chunk-3sfn889r.js";
import {
  exports_external
} from "../../chunk-c6ge431q.js";
import {
  __require
} from "../../chunk-9wyra8hs.js";

// src/commands/logout/spec.ts
var LogoutOptionsSchema = exports_external.object({
  force: exports_external.boolean().default(false),
  clearConfig: exports_external.boolean().default(false)
});
var LogoutInputSchema = exports_external.object({
  force: exports_external.boolean().default(false),
  clearConfig: exports_external.boolean().default(false)
});
var LogoutErrorCode = exports_external.enum([
  "GCLOUD_NOT_FOUND",
  "REVOKE_FAILED",
  "CONFIG_CLEAR_FAILED",
  "UNKNOWN_ERROR"
]);
var LogoutSuccess = exports_external.object({
  success: exports_external.literal(true),
  data: exports_external.object({
    userRevoked: exports_external.boolean(),
    adcRevoked: exports_external.boolean(),
    configCleared: exports_external.boolean()
  })
});
var LogoutFailure = exports_external.object({
  success: exports_external.literal(false),
  error: exports_external.object({
    code: exports_external.enum(["GCLOUD_NOT_FOUND", "REVOKE_FAILED", "CONFIG_CLEAR_FAILED", "UNKNOWN_ERROR"]),
    message: exports_external.string(),
    recoverable: exports_external.boolean()
  })
});

// src/commands/logout/command.ts
var command = {
  name: "logout",
  description: "Log out of Google Cloud and revoke credentials",
  options: [
    { flags: "--force", description: "Skip confirmation prompts", defaultValue: false },
    { flags: "--clear-config", description: "Delete entire gcloud config directory", defaultValue: false }
  ],
  action: async (_args, options) => {
    try {
      const parsedOptions = LogoutOptionsSchema.parse(options);
      const { LogoutHandler } = await import("../../chunk-yej34vkc.js");
      const handler = new LogoutHandler;
      const result = await handler.execute({
        force: parsedOptions.force,
        clearConfig: parsedOptions.clearConfig
      });
      if (!result.success) {
        console.error(theme.red(`
${icons.error} Logout failed: ${result.error.message}`));
        process.exit(1);
      }
      process.exit(0);
    } catch (error) {
      console.error(theme.red(`
${icons.error} Unexpected error:`), error);
      process.exit(1);
    }
  }
};
export {
  command
};

//# debugId=0DD24266AA79E4B364756E2164756E21
