"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_map_set = require('../primordials/map-set.js');
const require_logger_default = require('../logger/default.js');
const require_bin_check_primordials = require('./check-primordials.js');

//#region src/bin/check.ts
/**
* @file `socket-lib check <name>` subcommand group. Routes to per-check
*   handlers by name. Each check resolves its config file and runs its check;
*   the group itself just dispatches and prints help. Available checks:
*   primordials Drift between a repo's `primordials` destructures and
*   socket-lib's userland mirror. Aliases let callers shorten the common ones:
*   prim → primordials.
*/
const logger = require_logger_default.getDefaultLogger();
const CHECKS = new require_primordials_map_set.MapCtor([["primordials", "primordials"], ["prim", "primordials"]]);
const ALIASES = new require_primordials_map_set.MapCtor([["primordials", ["prim"]]]);
function printHelp() {
	logger.log("socket-lib check — 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 require_bin_check_primordials.runCheckPrimordials(args.slice(1));
		/* c8 ignore start */
		default:
			logger.error(`socket-lib check: missing handler for '${canonical}'`);
			return 1;
	}
}

//#endregion
exports.printHelp = printHelp;
exports.runCheck = runCheck;