"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var skill_commands_exports = {};
__export(skill_commands_exports, {
  skillCommands: () => skillCommands
});
module.exports = __toCommonJS(skill_commands_exports);
var import_format_output = require("./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 (0, import_format_output.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 (0, import_format_output.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 (0, import_format_output.formatForInkCli)(outputLines2.join("\n"));
        }
        const skills = await skillManager.list();
        if (skills.length === 0) {
          return (0, import_format_output.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 (0, import_format_output.formatForInkCli)(outputLines.join("\n"));
      } catch (error) {
        const errorMsg = `Error loading skills: ${error instanceof Error ? error.message : String(error)}`;
        agent.logger.error(errorMsg);
        return (0, import_format_output.formatForInkCli)(`\u274C ${errorMsg}`);
      }
    }
  }
];
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  skillCommands
});
