// @bun
import {
  loadProjectDM,
  parseFormat,
  parseTarget,
  runDependencyCommand
} 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/plugins/upgrade.ts
async function adkPluginsUpgrade(alias, options) {
  await runDependencyCommand({
    options,
    run: async (logger) => {
      const format = parseFormat(options.format);
      const parsed = parseTarget(options.target);
      if (parsed === "all") {
        const { DependencyError } = await import("./chunk-q1scss64.js");
        throw new DependencyError({
          code: "MISSING_INPUT",
          message: `'all' is not valid for --target on this command. Use 'dev' or 'prod'.`
        });
      }
      const target = parsed;
      const { dm } = await loadProjectDM(target);
      const result = await dm.upgrade("plugin", alias, options.to);
      if (format === "text") {
        if (result.noop) {
          logger.info(`\u2713 ${alias} already at ${result.resource?.version}, no-op`, "green");
        } else {
          logger.info(`\u2713 Upgraded ${alias} to ${result.resource?.version}`, "green");
        }
        return {};
      }
      return { data: { result }, extras: { noop: result.noop ?? false } };
    }
  });
}
export {
  adkPluginsUpgrade
};
