#!/usr/bin/env node
"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../_virtual/_rolldown/runtime.js');
const require_logger_default = require('../logger/default.js');
const require_bin_check = require('./check.js');
let node_process = require("node:process");
node_process = require_runtime.__toESM(node_process);

//#region src/bin/socket-lib.ts
/**
* @file `socket-lib` CLI entry point — top-level dispatcher. socket-lib — print
*   help, list commands socket-lib check <name> [opts...] — run a fleet-wide
*   check Subcommands live as siblings under `src/bin/`; each is its own file
*   so a misbehaving check can't crash other commands at parse time. The
*   dispatcher just routes; subcommands own their own arg parsing. The CLI is
*   shipped via the `bin` field in package.json and intended to be invoked as
*   `pnpm exec socket-lib <command>` from any consumer that has
*   `@socketsecurity/lib` as a (dev)dependency.
*/
const logger = require_logger_default.getDefaultLogger();
function printHelp() {
	logger.log("socket-lib — fleet-wide static-analysis CLI");
	logger.log("");
	logger.log("Usage:");
	logger.log("  socket-lib <command> [...args]");
	logger.log("");
	logger.log("Commands:");
	logger.log("  check <name>   Run a fleet-wide check (primordials, ...).");
	logger.log("");
	logger.log("Run `socket-lib check --help` for the list of checks.");
}
async function main(args = node_process.default.argv.slice(2)) {
	const command = args[0];
	if (!command || command === "--help" || command === "-h") {
		printHelp();
		return 0;
	}
	switch (command) {
		case "check": return await require_bin_check.runCheck(args.slice(1));
		default:
			logger.error(`socket-lib: unknown command '${command}'`);
			logger.error("Run `socket-lib --help` for the list of commands.");
			return 1;
	}
}
/* c8 ignore start - CJS CLI entry guard; only fires when this
module is invoked as the bin (`socket-lib`), not when imported. */
if (typeof require !== "undefined" && require.main === module) main().then((code) => {
	node_process.default.exit(code);
});
/* c8 ignore stop */

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