// @bun
import {
  emitDeprecation,
  exitCodeFor,
  formatJsonError,
  parseFormat,
  pushPendingWarning
} from "./chunk-kph1bab2.js";
import"./chunk-2jcqy5j6.js";
import"./chunk-g85b0ce9.js";
import"./chunk-6fad0ts7.js";
import"./chunk-t993tmz7.js";
import"./chunk-px7fts59.js";
import"./chunk-7krp2mgz.js";
import"./chunk-np5wcwfv.js";
import"./chunk-je8v6rhj.js";
import"./chunk-6w0knnta.js";
import"./chunk-w15xmtkn.js";
import"./chunk-3sd5p4qp.js";
import"./chunk-nh2akp42.js";
import"./chunk-kat1bv74.js";
import"./chunk-2a5b6azq.js";
import"./chunk-s8cp3qe6.js";
import"./chunk-fv5teh9w.js";
import"./chunk-8ab2w9a1.js";
import"./chunk-3xrpxgq4.js";
import"./chunk-w346ejn9.js";
import"./chunk-n8gath4k.js";
import"./chunk-v3ens42y.js";
import"./chunk-8839jtgk.js";
import"./chunk-s2akeqpw.js";
import"./chunk-6771vrjp.js";
import"./chunk-g8mm42v1.js";
import"./chunk-0q5d80bn.js";
import"./chunk-300xaact.js";
import"./chunk-b8c41yvb.js";
import"./chunk-jsqe5am4.js";
import"./chunk-m4c14gcg.js";
import"./chunk-gspjbr79.js";
import"./chunk-wesykvkp.js";
import"./chunk-gzj56z73.js";
import {
  __require
} from "./chunk-dhs2bg35.js";

// src/commands/adk-remove.ts
async function adkRemove(resource, options) {
  if (!resource) {
    const { DependencyError } = await import("./chunk-q1scss64.js");
    const err = new DependencyError({ code: "MISSING_INPUT", message: "<resource> is required for adk remove" });
    const format2 = parseFormat(options?.format);
    if (format2 === "json")
      process.stdout.write(formatJsonError(err) + `
`);
    else
      process.stderr.write(`\u2717 ${err.message}
`);
    process.exit(exitCodeFor(err));
    return;
  }
  const format = parseFormat(options?.format);
  const isPlugin = resource.startsWith("plugin:");
  const isInterface = resource.startsWith("interface:");
  const cleanResource = resource.replace(/^(interface|plugin|integration):/, "");
  if (isInterface) {
    const dep2 = emitDeprecation({
      oldCommand: `adk remove interface:${cleanResource}`,
      newCommand: "adk interfaces list",
      format
    });
    if (dep2.stderrLine)
      process.stderr.write(dep2.stderrLine + `
`);
    if (dep2.warning)
      pushPendingWarning(dep2.warning);
    const { DependencyError } = await import("./chunk-q1scss64.js");
    throw new DependencyError({ code: "BUILTIN_INTERFACE_IMMUTABLE", message: "Interfaces cannot be removed" });
  }
  if (isPlugin) {
    const dep2 = emitDeprecation({
      oldCommand: `adk remove plugin:${cleanResource}`,
      newCommand: `adk plugins remove ${cleanResource}`,
      format
    });
    if (dep2.stderrLine)
      process.stderr.write(dep2.stderrLine + `
`);
    if (dep2.warning)
      pushPendingWarning(dep2.warning);
    const { adkPluginsRemove } = await import("./chunk-sdtb10cx.js");
    await adkPluginsRemove(cleanResource, { format: options?.format });
    return;
  }
  const dep = emitDeprecation({
    oldCommand: `adk remove ${cleanResource}`,
    newCommand: `adk integrations remove ${cleanResource}`,
    format
  });
  if (dep.stderrLine)
    process.stderr.write(dep.stderrLine + `
`);
  if (dep.warning)
    pushPendingWarning(dep.warning);
  const { adkIntegrationsRemove } = await import("./chunk-5fpk3bgf.js");
  await adkIntegrationsRemove(cleanResource, { format: options?.format });
}
export {
  adkRemove
};
