import {
  discoverResources
} from "./chunk-HOGMCHWI.js";
import "./chunk-Y4VZACTC.js";
import "./chunk-EMQMCXIC.js";
import "./chunk-VDBUUHJF.js";
import "./chunk-ITCDZXBZ.js";
import "./chunk-FB5CMO3J.js";
import {
  errorResponse,
  outputAndExit,
  successResponse
} from "./chunk-7EBJ4BCH.js";
import "./chunk-C7KWYVS3.js";

// src/cli/commands/discover.ts
var discoverCommand = async (input) => {
  const result = await discoverResources("cli:discover", input);
  if (result.found) {
    return outputAndExit(successResponse(result), input);
  }
  const origin = "origin" in result ? result.origin : input.url;
  return outputAndExit(
    errorResponse({
      code: "GENERAL_ERROR",
      message: result.message ?? `No OpenAPI spec found for ${origin}. Tried: /openapi.json, /.well-known/x402`,
      surface: "cli:discover",
      cause: result.cause,
      details: { origin }
    }),
    input
  );
};
export {
  discoverCommand
};
//# sourceMappingURL=discover-RV2HPYM3.js.map