"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var check_exports = {};
__export(check_exports, {
  printHelp: () => printHelp,
  runCheck: () => runCheck
});
module.exports = __toCommonJS(check_exports);
var import_logger = require("../logger/logger");
var import_check_primordials = require("./check-primordials");
const logger = (0, import_logger.getDefaultLogger)();
const CHECKS = /* @__PURE__ */ new Map([
  ["primordials", "primordials"],
  ["prim", "primordials"]
]);
const ALIASES = /* @__PURE__ */ new Map([
  ["primordials", ["prim"]]
]);
function printHelp() {
  logger.log("socket-lib check \u2014 fleet-wide static-analysis checks");
  logger.log("");
  logger.log("Usage:");
  logger.log("  socket-lib check <name> [...opts]");
  logger.log("");
  logger.log("Checks:");
  for (const [canonical, aliases] of ALIASES) {
    const aliasStr = aliases.length > 0 ? ` (alias: ${aliases.join(", ")})` : "";
    logger.log(`  ${canonical}${aliasStr}`);
  }
  logger.log("");
  logger.log("Run `socket-lib check <name> --help` for check-specific options.");
}
async function runCheck(args) {
  const name = args[0];
  if (!name || name === "--help" || name === "-h") {
    printHelp();
    return 0;
  }
  const canonical = CHECKS.get(name);
  if (!canonical) {
    logger.error(`socket-lib check: unknown check '${name}'`);
    logger.error("Run `socket-lib check --help` for the list of checks.");
    return 1;
  }
  switch (canonical) {
    case "primordials":
      return await (0, import_check_primordials.runCheckPrimordials)(args.slice(1));
    // Unreachable; CHECKS map is exhaustive.
    /* c8 ignore start */
    default:
      logger.error(`socket-lib check: missing handler for '${canonical}'`);
      return 1;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  printHelp,
  runCheck
});
