import { formatExamples, register } from "../registry.js";
import { seedMainAgentProfileMarkdown } from "../../agent/context/workspace-seed.js";
import { initWorkspace } from "../utils/init-workspace.js";
import { getWorkspaceStatus } from "../utils/workspace.js";
import { Command } from "commander";
//#region src/cli/commands/setup.ts
function createSetupCommand(ctx) {
	return new Command("setup").description("Initialize config file and workspace directory").addHelpText("after", formatExamples([
		"xopc setup                    # Create config + workspace",
		"xopc setup --workspace /path  # Custom workspace path",
		"xopc init                     # Full state dirs + agent profile seeds"
	])).option("--workspace <path>", "Workspace directory path", ctx.workspacePath).action(async (options) => {
		const workspacePath = options.workspace || ctx.workspacePath;
		const configPath = ctx.configPath;
		console.log("🔧 xopc Setup\n");
		console.log("═".repeat(40));
		const status = getWorkspaceStatus(configPath, workspacePath);
		console.log("\n📊 Current Status:");
		console.log(`   Config: ${status.configExists ? "✅ exists" : "❌ not found"}`);
		console.log(`   Workspace: ${status.workspaceSetup ? "✅ setup" : "❌ not found"}`);
		const result = await initWorkspace({
			configPath,
			workspacePath
		});
		if (result.configCreated) console.log("\n📝 Created config file.");
		else console.log("\n📝 Config already present (verified).");
		if (result.workspaceCreated) console.log("\n📁 Created workspace + memory/.");
		else console.log("\n📁 Workspace already present (verified).");
		seedMainAgentProfileMarkdown(result.config);
		console.log("\n" + "═".repeat(40));
		console.log("\n✅ Setup complete!\n");
		console.log("📁 Files:");
		console.log("   Config:", configPath);
		console.log("   Workspace:", workspacePath);
		console.log("\n🚀 Next Steps:");
		console.log("   xopc init                 # Full Agent OS dirs (optional, beyond setup)");
		console.log("   xopc onboard              # Run full setup wizard");
		console.log("   xopc onboard --model      # Configure model only");
		console.log("   xopc onboard --channels  # Configure channels only");
	});
}
register({
	id: "setup",
	name: "setup",
	description: "Initialize config file and workspace directory",
	factory: createSetupCommand,
	metadata: {
		category: "setup",
		examples: ["xopc setup", "xopc setup --workspace ~/.my-workspace"]
	}
});
//#endregion
export {};

//# sourceMappingURL=setup.js.map