import { formatForInkCli } from "./utils/format-output.js";
const skillCommands = [
  {
    name: "skills",
    description: "List available skills, or read one skill by id",
    usage: "/skills [skill-id]",
    category: "Skill Management",
    handler: async (args, agent, _ctx) => {
      const skillManager = agent.skillManager;
      if (!skillManager) {
        return formatForInkCli("\u26A0\uFE0F  Skills are not available for this chat target.");
      }
      const skillId = args[0];
      try {
        if (skillId) {
          const skill = await skillManager.get(skillId);
          if (!skill) {
            return formatForInkCli(`\u26A0\uFE0F  Skill '${skillId}' not found`);
          }
          const outputLines2 = [`
\u{1F9E9} ${skill.displayName}`, `ID: ${skill.id}`];
          if (skill.description) {
            outputLines2.push(`Description: ${skill.description}`);
          }
          outputLines2.push("", skill.instructions);
          return formatForInkCli(outputLines2.join("\n"));
        }
        const skills = await skillManager.list();
        if (skills.length === 0) {
          return formatForInkCli("\n\u26A0\uFE0F  No skills available");
        }
        const outputLines = ["\n\u{1F9E9} Available Skills:\n"];
        for (const skill of skills) {
          const desc = skill.description ? ` - ${skill.description}` : "";
          outputLines.push(`  ${skill.displayName} (${skill.id})${desc}`);
        }
        outputLines.push("", `Total: ${skills.length} skills`);
        return formatForInkCli(outputLines.join("\n"));
      } catch (error) {
        const errorMsg = `Error loading skills: ${error instanceof Error ? error.message : String(error)}`;
        agent.logger.error(errorMsg);
        return formatForInkCli(`\u274C ${errorMsg}`);
      }
    }
  }
];
export {
  skillCommands
};
