import { commandRegistry } from "../registry.js";
import { bulletList, commandBullet, joinBlocks, kvList, section } from "../format-output.js";
//#region src/chat-commands/builtins/system.ts
const helpCommand = {
	id: "system.help",
	name: "help",
	aliases: ["h", "commands"],
	description: "Show available commands",
	category: "system",
	scope: [
		"global",
		"private",
		"group"
	],
	handler: async (_ctx) => {
		const allCommands = commandRegistry.list();
		const byCategory = /* @__PURE__ */ new Map();
		for (const cmd of allCommands) {
			if (!byCategory.has(cmd.category)) byCategory.set(cmd.category, []);
			byCategory.get(cmd.category).push(cmd);
		}
		const categoryBlocks = [];
		for (const [category, commands] of byCategory) categoryBlocks.push(joinBlocks(section(category.toUpperCase()), commands.map((cmd) => commandBullet(cmd.name, cmd.description, cmd.aliases)).join("\n")));
		return {
			content: joinBlocks(section("📖 Available Commands"), ...categoryBlocks),
			success: true
		};
	}
};
const startCommand = {
	id: "system.start",
	name: "start",
	description: "Show welcome message",
	category: "system",
	scope: [
		"global",
		"private",
		"group"
	],
	handler: async (_ctx) => {
		return {
			content: joinBlocks(section("👋 Welcome to xopc!"), "I am your AI assistant. Here's what I can do:", bulletList([
				"**AI Chat** — Just send a message to start chatting",
				"**Session Management** — Use `/new`, `/list`, `/usage`",
				"**Model Selection** — `/models` shows names and `provider/model` refs; `/switch` uses that ref"
			]), "Type `/help` to see all available commands."),
			success: true
		};
	}
};
const settingsCommand = {
	id: "system.settings",
	name: "settings",
	description: "Show current settings",
	category: "system",
	scope: [
		"global",
		"private",
		"group"
	],
	handler: async (ctx) => {
		const model = ctx.getCurrentModel();
		const sessionKey = ctx.sessionKey;
		return {
			content: joinBlocks(section("⚙️ Current Settings"), kvList([
				{
					key: "Model",
					value: model
				},
				{
					key: "Session",
					value: sessionKey
				},
				{
					key: "Platform",
					value: ctx.source
				},
				{
					key: "Group",
					value: ctx.isGroup ? "Yes" : "No"
				}
			])),
			success: true
		};
	}
};
const skillsCommand = {
	id: "system.skills",
	name: "skills",
	description: "Manage skills (e.g., /skills reload)",
	category: "system",
	scope: [
		"global",
		"private",
		"group"
	],
	acceptsArgs: true,
	examples: ["/skills reload"],
	handler: async (ctx, args) => {
		if (args === "reload") return {
			content: "✅ Skills reloaded successfully",
			success: true
		};
		return {
			content: joinBlocks(section("🛠️ Skills Management"), bulletList(["`/skills reload` — Reload all skills from disk"])),
			success: true
		};
	}
};
function registerSystemCommands() {
	commandRegistry.register(helpCommand);
	commandRegistry.register(startCommand);
	commandRegistry.register(settingsCommand);
	commandRegistry.register(skillsCommand);
}
//#endregion
export { registerSystemCommands };

//# sourceMappingURL=system.js.map