"use strict";
var import_vitest = require("vitest");
var import_commands = require("./commands.js");
function createAgent(capabilities) {
  const skillManager = {
    list: import_vitest.vi.fn().mockResolvedValue([]),
    get: import_vitest.vi.fn().mockResolvedValue(null),
    readFile: import_vitest.vi.fn(),
    invoke: import_vitest.vi.fn(),
    refresh: import_vitest.vi.fn()
  };
  return {
    capabilities,
    listPrompts: import_vitest.vi.fn(),
    skillManager,
    logger: {
      debug: import_vitest.vi.fn(),
      info: import_vitest.vi.fn(),
      warn: import_vitest.vi.fn(),
      error: import_vitest.vi.fn(),
      getLevel: import_vitest.vi.fn(),
      getLogFilePath: import_vitest.vi.fn()
    }
  };
}
(0, import_vitest.describe)("executeCommand", () => {
  (0, import_vitest.it)("returns unknown-command guidance when prompts are unsupported and the command is not real", async () => {
    const agent = createAgent({ prompts: false });
    const result = await (0, import_commands.executeCommand)("typoed-command", [], agent);
    (0, import_vitest.expect)(result).toContain("Unknown command");
  });
  (0, import_vitest.it)("still blocks static prompt commands when the prompts capability is disabled", async () => {
    const agent = createAgent({ prompts: false });
    const result = await (0, import_commands.executeCommand)("prompts", [], agent);
    (0, import_vitest.expect)(result).toBe("\u26A0\uFE0F  Command /prompts is not available for this chat target.");
  });
  (0, import_vitest.it)("lists skills through SkillManager when prompt commands are disabled", async () => {
    const agent = createAgent({ prompts: false });
    const skillManager = agent.skillManager;
    if (!skillManager) throw new Error("Expected test agent to have skills");
    import_vitest.vi.mocked(skillManager.list).mockResolvedValue([
      {
        id: "review",
        displayName: "Code Review",
        description: "Review code changes"
      }
    ]);
    const result = await (0, import_commands.executeCommand)("skills", [], agent);
    (0, import_vitest.expect)(skillManager.list).toHaveBeenCalled();
    (0, import_vitest.expect)(agent.listPrompts).not.toHaveBeenCalled();
    (0, import_vitest.expect)(result).toContain("Available Skills");
    (0, import_vitest.expect)(result).toContain("Code Review");
  });
  (0, import_vitest.it)("reads one skill through SkillManager", async () => {
    const agent = createAgent();
    const skillManager = agent.skillManager;
    if (!skillManager) throw new Error("Expected test agent to have skills");
    import_vitest.vi.mocked(skillManager.get).mockResolvedValue({
      id: "review",
      displayName: "Code Review",
      description: "Review code changes",
      instructions: "Check tests and edge cases."
    });
    const result = await (0, import_commands.executeCommand)("skills", ["review"], agent);
    (0, import_vitest.expect)(skillManager.get).toHaveBeenCalledWith("review");
    (0, import_vitest.expect)(agent.listPrompts).not.toHaveBeenCalled();
    (0, import_vitest.expect)(result).toContain("Code Review");
    (0, import_vitest.expect)(result).toContain("Check tests and edge cases.");
  });
});
