// @bun
import {
  findAgentRoot,
  findAgentRootOrFail
} from "./chunk-6fad0ts7.js";
import {
  createCliLogger
} from "./chunk-t993tmz7.js";
import"./chunk-px7fts59.js";
import {
  AgentProject,
  ProjectState
} from "./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"./chunk-dhs2bg35.js";

// src/commands/adk-info.ts
var logger = createCliLogger();
async function adkInfo(directory, options = {}) {
  const startPath = directory || process.cwd();
  const projectPath = await findAgentRoot(startPath) || startPath;
  try {
    const agentRoot = await findAgentRootOrFail(process.cwd());
    const project = await AgentProject.load(agentRoot, {
      noCache: options.noCache
    });
    const info = project.info;
    logger.info("\uD83E\uDD16 Botpress ADK Agent", "blue");
    logger.info("\u2500".repeat(40), "gray");
    logger.info(`Name: ${info.config.name || "(unnamed)"}`, "cyan");
    logger.info(`Description: ${info.config.description || "(no description)"}`, "cyan");
    logger.info(`Path: ${info.path}`, "cyan");
    if (projectPath !== startPath) {
      logger.info(`Working Directory: ${startPath}`, "cyan");
    }
    const stateColor = info.state === ProjectState.Ready ? "green" : info.state === ProjectState.Error ? "red" : "yellow";
    logger.info(`State: ${info.state}`, stateColor);
    if (info.dependencies?.integrations) {
      const integrations = Object.keys(info.dependencies.integrations);
      logger.info(`Integrations: ${integrations.length > 0 ? integrations.join(", ") : "(none)"}`, "cyan");
      try {
        const integrationsDetail = await project.getIntegrations();
        const hasChannels = integrationsDetail.some((i) => i.hasChannels);
        if (!hasChannels && integrations.length > 0) {
          logger.warn("\u26A0 Warning: No integrations with channels found");
          logger.info("  Add an integration with channels to enable conversations", "gray");
        }
      } catch (err) {
        logger.debug(`Failed to fetch integration details: ${err instanceof Error ? err.message : String(err)}`);
      }
    }
    if (info.errorCount > 0 || info.warningCount > 0) {
      logger.newline();
      logger.warn("\u26A0 Validation Issues:");
      if (info.errors && info.errors.length > 0) {
        logger.error("Errors:");
        info.errors.forEach((err) => {
          logger.error(`  \u2022 ${err.message}`);
          if (err.hint) {
            logger.info(`    ${err.hint}`, "gray");
          }
        });
      }
      if (info.warnings && info.warnings.length > 0) {
        logger.warn("Warnings:");
        info.warnings.forEach((warn) => {
          logger.warn(`  \u2022 ${warn.message}`);
          if (warn.hint) {
            logger.info(`    ${warn.hint}`, "gray");
          }
        });
      }
    }
    if (info.lastBuildTime) {
      logger.info(`Last Build: ${new Date(info.lastBuildTime).toLocaleString()}`, "cyan");
    }
    logger.newline();
    logger.info("Run 'adk --help' to see available commands", "gray");
  } catch (error) {
    const foundAgentConfig = await findAgentRoot(startPath) !== null;
    logger.error(String(error));
    logger.newline();
    logger.error("\u2717 Error: Not in a valid ADK agent directory.");
    logger.newline();
    if (foundAgentConfig && error instanceof Error && error.message.includes("validation failed")) {
      try {
        const project = new AgentProject(projectPath);
        const validation = await project.validate();
        if (validation.errors.length > 0 || validation.warnings.length > 0) {
          logger.warn("This directory appears to be an agent project but has validation errors:");
          logger.newline();
          if (validation.errors.length > 0) {
            logger.error("Errors:");
            validation.errors.forEach((err) => {
              logger.error(`  \u2022 ${err.message}`);
              if (err.hint) {
                logger.info(`    ${err.hint}`, "gray");
              }
            });
            logger.newline();
          }
          if (validation.warnings.length > 0) {
            logger.warn("Warnings:");
            validation.warnings.forEach((warn) => {
              logger.warn(`  \u2022 ${warn.message}`);
              if (warn.hint) {
                logger.info(`    ${warn.hint}`, "gray");
              }
            });
            logger.newline();
          }
        }
      } catch {
        logger.warn("This directory appears to be an agent project but has validation errors.");
        logger.newline();
      }
    } else {
      logger.info("The ADK command should be run inside an agent directory.", "gray");
      logger.info("To create a new agent, run:", "gray");
      logger.newline();
      logger.info("  adk init my-agent");
    }
    logger.newline();
    logger.info("For more information, run:", "gray");
    logger.newline();
    logger.info("  adk --help");
    logger.newline();
    process.exit(1);
  }
}
export {
  adkInfo
};
