import { r as ux } from "./cli-B86kvKcR.mjs";
import { a as loadAnvilManifest, b as validateAnvilManifest } from "./manifest-CslkSMd8.mjs";
import process from "node:process";
import { defineCommand } from "citty";
//#region src/commands/manifest/validate.ts
function runManifestValidateCommand() {
	const loadedManifest = loadAnvilManifest(process.cwd());
	if (!loadedManifest) {
		process.exitCode = 1;
		ux.log.error("No anvil.yaml found.");
		return false;
	}
	const validation = validateAnvilManifest(loadedManifest.manifest);
	if (!validation.valid) {
		process.exitCode = 1;
		for (const issue of validation.issues) console.log(`${issue.path}: ${issue.message}`);
		return false;
	}
	ux.log.success(`Valid: ${loadedManifest.filePath}`);
	return true;
}
var validate_default = defineCommand({
	meta: {
		name: "validate",
		description: "Validate the nearest anvil.yaml file"
	},
	run() {
		try {
			runManifestValidateCommand();
			if (!process.exitCode) process.exit(0);
		} catch (error) {
			ux.handleError(error);
		}
	}
});
//#endregion
export { validate_default as n, runManifestValidateCommand as t };

//# sourceMappingURL=validate-Dvu_9yan.mjs.map