import { t as formatDocsLink } from "./links-DKdh5pW0.js";
import { r as theme } from "./theme-C89FAhqx.js";
import { n as defaultRuntime } from "./runtime-Cz7YGH5v.js";
import { n as runCommandWithRuntime } from "./cli-utils-uaH7d0qF.js";
import { t as formatHelpExamples } from "./help-format-CtD0oXKh.js";
import { t as backupVerifyCommand } from "./backup-verify-DiGD9IUj.js";
import { t as backupCreateCommand } from "./backup-I1t6Cm09.js";
//#region src/cli/program/register.backup.ts
function registerBackupCommand(program) {
	const backup = program.command("backup").description("Create and verify local backup archives for Nodmix state").addHelpText("after", () => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/backup", "docs.nodmix.ai/cli/backup")}\n`);
	backup.command("create").description("Write a backup archive for config, credentials, sessions, and workspaces").option("--output <path>", "Archive path or destination directory").option("--json", "Output JSON", false).option("--dry-run", "Print the backup plan without writing the archive", false).option("--verify", "Verify the archive after writing it", false).option("--only-config", "Back up only the active JSON config file", false).option("--no-include-workspace", "Exclude workspace directories from the backup").addHelpText("after", () => `\n${theme.heading("Examples:")}\n${formatHelpExamples([
		["nodmix backup create", "Create a timestamped backup in the current directory."],
		["nodmix backup create --output ~/Backups", "Write the archive into an existing backup directory."],
		["nodmix backup create --dry-run --json", "Preview the archive plan without writing any files."],
		["nodmix backup create --verify", "Create the archive and immediately validate its manifest and payload layout."],
		["nodmix backup create --no-include-workspace", "Back up state/config without agent workspace files."],
		["nodmix backup create --only-config", "Back up only the active JSON config file."]
	])}`).action(async (opts) => {
		await runCommandWithRuntime(defaultRuntime, async () => {
			await backupCreateCommand(defaultRuntime, {
				output: opts.output,
				json: Boolean(opts.json),
				dryRun: Boolean(opts.dryRun),
				verify: Boolean(opts.verify),
				onlyConfig: Boolean(opts.onlyConfig),
				includeWorkspace: opts.includeWorkspace
			});
		});
	});
	backup.command("verify <archive>").description("Validate a backup archive and its embedded manifest").option("--json", "Output JSON", false).addHelpText("after", () => `\n${theme.heading("Examples:")}\n${formatHelpExamples([["nodmix backup verify ./2026-03-09T08-00-00.000+08-00-nodmix-backup.tar.gz", "Check that the archive structure and manifest are intact."], ["nodmix backup verify ~/Backups/latest.tar.gz --json", "Emit machine-readable verification output."]])}`).action(async (archive, opts) => {
		await runCommandWithRuntime(defaultRuntime, async () => {
			await backupVerifyCommand(defaultRuntime, {
				archive,
				json: Boolean(opts.json)
			});
		});
	});
}
//#endregion
export { registerBackupCommand };
