import { r as ux } from "./cli-B86kvKcR.mjs";
import process from "node:process";
import { defineCommand } from "citty";
import { execa } from "execa";
//#region src/commands/release/check.ts
async function runReleaseCheckCommand(options = {}) {
	try {
		const cwd = process.cwd();
		const effectiveOptions = { quiet: options.quiet ?? true };
		ux.intro("Release Check");
		await ux.running("Building packages through Turbo", async () => runTurboReleaseCheck(cwd, ["build", "--filter=@prata.ma/*"], effectiveOptions));
		await ux.running("Running package checks through Turbo", async () => runTurboReleaseCheck(cwd, [
			"lint",
			"test",
			"test:type",
			"--filter=@prata.ma/*"
		], effectiveOptions));
		await ux.running("Running block checks through Turbo", async () => runTurboReleaseCheck(cwd, [
			"lint",
			"test",
			"--filter=@repo/block-*"
		], effectiveOptions));
		ux.log.success("Release checks passed.");
		ux.outro();
	} catch (error) {
		ux.handleError(error);
	}
}
async function runTurboReleaseCheck(cwd, args, options) {
	const result = await execa("pnpm", [
		"turbo",
		"run",
		...args
	], {
		cwd,
		reject: false,
		stdio: options.quiet ? "pipe" : "inherit"
	});
	if (result.exitCode !== 0) {
		const output = [result.stdout, result.stderr].map((stream) => (stream ?? "").trim()).filter(Boolean).join("\n");
		throw new Error(output ? `Turbo release check failed:\n${output}` : "Turbo release check failed.");
	}
}
var check_default = defineCommand({
	meta: {
		name: "check",
		description: "Validate release readiness"
	},
	async run() {
		await runReleaseCheckCommand();
		if (!process.exitCode) process.exit(0);
	}
});
//#endregion
export { runReleaseCheckCommand as n, check_default as t };

//# sourceMappingURL=check-NyDIOUkU.mjs.map