// @bun
import {
  init_featureCheck,
  init_overlayContext,
  isSkillSearchEnabled,
  useRegisterOverlay
} from "./chunk-e91vvygt.js";
import"./chunk-k60b56gr.js";
import"./chunk-14p6wvsq.js";
import"./chunk-n66h7gtd.js";
import"./chunk-28jd8qjx.js";
import"./chunk-djt39ze3.js";
import"./chunk-9a9g5hbj.js";
import"./chunk-ptxteaeh.js";
import"./chunk-ftrj0crk.js";
import"./chunk-yrpthe2x.js";
import"./chunk-10fpzkhd.js";
import"./chunk-awz3dq2e.js";
import"./chunk-2tabctw9.js";
import"./chunk-z21x0z3h.js";
import"./chunk-9hn8e6h1.js";
import"./chunk-rgyzsbs3.js";
import"./chunk-qn6me9n1.js";
import"./chunk-9rwstxn3.js";
import"./chunk-td4ter5p.js";
import"./chunk-71sdcaq6.js";
import"./chunk-cb6yemrf.js";
import"./chunk-tj8te4np.js";
import"./chunk-jjh8y2m7.js";
import"./chunk-dr2x4ze7.js";
import"./chunk-8ad8jmrf.js";
import"./chunk-24kv69g3.js";
import"./chunk-68n1gfc7.js";
import"./chunk-1w7c5hws.js";
import"./chunk-4gyjc4jm.js";
import"./chunk-4spgkgr3.js";
import"./chunk-e8dhxycp.js";
import"./chunk-hf0jvnz1.js";
import"./chunk-9pygs2bc.js";
import"./chunk-60fkafk2.js";
import"./chunk-gaazk5m4.js";
import"./chunk-vgmsapsy.js";
import"./chunk-093ej2sf.js";
import"./chunk-7tfdhkpy.js";
import"./chunk-nde5ym6a.js";
import"./chunk-zypcr179.js";
import"./chunk-etcs82b2.js";
import"./chunk-7wy0nfkf.js";
import"./chunk-1emjj9xz.js";
import"./chunk-m1hz377a.js";
import"./chunk-4nctdw69.js";
import"./chunk-vhghhw4q.js";
import"./chunk-935nrvdb.js";
import"./chunk-8zz4z1q3.js";
import"./chunk-hdwp8fte.js";
import"./chunk-hqxp6b72.js";
import"./chunk-3cwfww0q.js";
import"./chunk-xqc9bbe3.js";
import"./chunk-w5hnghah.js";
import"./chunk-qm7pdcft.js";
import"./chunk-x59e8cv0.js";
import"./chunk-s76nvx50.js";
import"./chunk-7jyr5758.js";
import"./chunk-zrpa39fh.js";
import"./chunk-nkg1b3qw.js";
import"./chunk-c1kx8bry.js";
import"./chunk-epvbnq43.js";
import"./chunk-swgt1px0.js";
import"./chunk-8kf8h7xf.js";
import"./chunk-swz6krys.js";
import"./chunk-7eywm3ed.js";
import"./chunk-bgan4cpf.js";
import"./chunk-jmv7k0jn.js";
import"./chunk-25w7rxtr.js";
import"./chunk-5xfj4jkd.js";
import"./chunk-c1t99xmt.js";
import"./chunk-vwenx8ke.js";
import"./chunk-8thwr7p8.js";
import"./chunk-v4ypszbb.js";
import"./chunk-bk6ck5c2.js";
import"./chunk-ym6j0wv1.js";
import"./chunk-hjmatcgt.js";
import"./chunk-6mdh70q0.js";
import"./chunk-ch92ycde.js";
import"./chunk-e4dsy4g1.js";
import"./chunk-326zehp8.js";
import"./chunk-kc67kt75.js";
import"./chunk-40t1d75v.js";
import"./chunk-rt34thxn.js";
import"./chunk-e3abfxpy.js";
import"./chunk-q44zc68f.js";
import"./chunk-fejeqe61.js";
import"./chunk-kgkdmr0x.js";
import"./chunk-hn4w9pkj.js";
import {
  Dialog,
  ThemedBox_default,
  ThemedText,
  init_src,
  require_react,
  use_input_default
} from "./chunk-cswpvb8x.js";
import {
  require_jsx_runtime
} from "./chunk-gxyx8b8w.js";
import"./chunk-j1mep9ck.js";
import"./chunk-6x35ffpx.js";
import"./chunk-1zbwhcbt.js";
import"./chunk-ddaxg4xh.js";
import"./chunk-vvh31np8.js";
import"./chunk-tywrrc1m.js";
import"./chunk-e3j7m7k2.js";
import"./chunk-4p0hxk2c.js";
import"./chunk-c4dyxsat.js";
import"./chunk-34rn09za.js";
import"./chunk-m28vg9w4.js";
import"./chunk-rk9fgqmg.js";
import"./chunk-nw4zt0y4.js";
import"./chunk-c1yc761e.js";
import"./chunk-c5g9shkw.js";
import"./chunk-k9jzhhww.js";
import"./chunk-kb3758f7.js";
import"./chunk-xqs9r7pg.js";
import"./chunk-tj0dzck2.js";
import"./chunk-aeysytks.js";
import"./chunk-ns1htxgd.js";
import"./chunk-ztqzmfx1.js";
import"./chunk-6k1rsk85.js";
import"./chunk-nxzx0ey9.js";
import"./chunk-yes1my80.js";
import"./chunk-pecy49yr.js";
import"./chunk-azbab59e.js";
import"./chunk-3nk9q8dr.js";
import {
  __esm,
  __require,
  __toESM
} from "./chunk-hhsxm2yr.js";

// src/commands/skill-search/skillSearchPanel.tsx
function getStatusText() {
  return [
    "Skill Search (\u81EA\u52A8\u6280\u80FD\u5339\u914D)",
    `Status: ${isSkillSearchEnabled() ? "enabled" : "disabled"}`,
    "",
    "When enabled, relevant skills are automatically matched and",
    "injected into conversation context each turn."
  ].join(`
`);
}
async function startSkillSearch() {
  if (isSkillSearchEnabled() && process.env.SKILL_SEARCH_ENABLED !== "0") {
    return "Skill Search: already enabled";
  }
  process.env.SKILL_SEARCH_ENABLED = "1";
  const lines = ["Skill Search: enabled (SKILL_SEARCH_ENABLED=1)"];
  try {
    const { clearSkillIndexCache } = await import("./chunk-jkr6dkqr.js");
    clearSkillIndexCache();
    lines.push("Skill index cache: cleared (will rebuild on next search)");
  } catch {
    lines.push("Skill index cache: clear skipped");
  }
  return lines.join(`
`);
}
async function stopSkillSearch() {
  if (!isSkillSearchEnabled()) {
    return "Skill Search: already disabled";
  }
  process.env.SKILL_SEARCH_ENABLED = "0";
  return "Skill Search: disabled (SKILL_SEARCH_ENABLED=0)";
}
function SkillSearchPanel({ onDone }) {
  useRegisterOverlay("skill-search-panel");
  const [selectedIndex, setSelectedIndex] = import_react.useState(0);
  const actions = import_react.useMemo(() => [
    {
      label: "Status",
      description: "Show whether automatic skill matching is active",
      run: () => Promise.resolve(getStatusText())
    },
    {
      label: "Start",
      description: "Enable automatic skill matching for this session",
      run: startSkillSearch
    },
    {
      label: "Stop",
      description: "Disable automatic skill matching for this session",
      run: stopSkillSearch
    },
    {
      label: "About",
      description: "How automatic skill matching works",
      run: () => Promise.resolve(ABOUT_TEXT)
    }
  ], []);
  const selectCurrent = () => {
    const action = actions[selectedIndex];
    if (!action)
      return;
    action.run().then((result) => {
      onDone(result, { display: "system" });
    });
  };
  use_input_default((_input, key) => {
    if (key.upArrow) {
      setSelectedIndex((index) => Math.max(0, index - 1));
      return;
    }
    if (key.downArrow) {
      setSelectedIndex((index) => Math.min(actions.length - 1, index + 1));
      return;
    }
    if (key.return) {
      selectCurrent();
    }
  });
  return /* @__PURE__ */ jsx_runtime.jsx(Dialog, {
    title: "Skill Search",
    subtitle: `${actions.length} actions`,
    onCancel: () => onDone("Skill search panel dismissed", { display: "system" }),
    color: "background",
    hideInputGuide: true,
    children: /* @__PURE__ */ jsx_runtime.jsxs(ThemedBox_default, {
      flexDirection: "column",
      children: [
        actions.map((action, index) => /* @__PURE__ */ jsx_runtime.jsxs(ThemedBox_default, {
          flexDirection: "row",
          children: [
            /* @__PURE__ */ jsx_runtime.jsx(ThemedText, {
              children: `${index === selectedIndex ? "\u203A" : " "} ${action.label}`.padEnd(ACTION_LABEL_COLUMN_WIDTH)
            }),
            /* @__PURE__ */ jsx_runtime.jsx(ThemedText, {
              dimColor: true,
              children: action.description
            })
          ]
        }, action.label)),
        /* @__PURE__ */ jsx_runtime.jsx(ThemedBox_default, {
          marginTop: 1,
          children: /* @__PURE__ */ jsx_runtime.jsx(ThemedText, {
            dimColor: true,
            children: "\u2191/\u2193 select \xB7 Enter run \xB7 Esc close"
          })
        })
      ]
    })
  });
}
async function call(onDone, _context, args) {
  const trimmed = args?.trim() ?? "";
  if (trimmed === "start") {
    onDone(await startSkillSearch(), { display: "system" });
    return null;
  }
  if (trimmed === "stop") {
    onDone(await stopSkillSearch(), { display: "system" });
    return null;
  }
  if (trimmed === "about") {
    onDone(ABOUT_TEXT, { display: "system" });
    return null;
  }
  if (trimmed === "status") {
    onDone(getStatusText(), { display: "system" });
    return null;
  }
  return /* @__PURE__ */ jsx_runtime.jsx(SkillSearchPanel, {
    onDone
  });
}
var import_react, jsx_runtime, ACTION_LABEL_COLUMN_WIDTH = 28, ABOUT_TEXT;
var init_skillSearchPanel = __esm(() => {
  init_src();
  init_src();
  init_overlayContext();
  init_featureCheck();
  import_react = __toESM(require_react(), 1);
  jsx_runtime = __toESM(require_jsx_runtime(), 1);
  ABOUT_TEXT = `# Skill Search (\u81EA\u52A8\u6280\u80FD\u5339\u914D)

Skill Search \u63A7\u5236\u5BF9\u8BDD\u4E2D\u7684\u81EA\u52A8\u6280\u80FD\u5339\u914D\u529F\u80FD\u3002

\u542F\u7528\u540E\uFF0CClaude Code \u4F1A\u5728\u6BCF\u8F6E\u5BF9\u8BDD\u4E2D\u81EA\u52A8\u641C\u7D22\u5E76\u52A0\u8F7D\u4E0E\u5F53\u524D\u4EFB\u52A1\u6700\u76F8\u5173\u7684 skill \u6587\u4EF6\uFF0C
\u65E0\u9700\u624B\u52A8\u6307\u5B9A\u3002\u641C\u7D22\u57FA\u4E8E TF-IDF \u5411\u91CF\u4F59\u5F26\u76F8\u4F3C\u5EA6\uFF0C\u652F\u6301\u82F1\u6587\u8BCD\u5E72\u5316\u548C CJK bi-gram \u5206\u8BCD\u3002

## \u5DE5\u4F5C\u539F\u7406
1. \u5BF9\u8BDD\u5F00\u59CB\u65F6\uFF0C\u81EA\u52A8\u7D22\u5F15 .claude/skills/ \u548C ~/.claude/skills/ \u4E0B\u7684 Markdown \u6587\u4EF6
2. \u6BCF\u8F6E\u5BF9\u8BDD\u6839\u636E\u4E0A\u4E0B\u6587\u81EA\u52A8\u5339\u914D\u6700\u76F8\u5173\u7684 skill
3. \u5339\u914D\u5230\u7684 skill \u5185\u5BB9\u4F1A\u4F5C\u4E3A\u4E0A\u4E0B\u6587\u6CE8\u5165\uFF0C\u6307\u5BFC Claude Code \u7684\u884C\u4E3A

## \u63A7\u5236\u65B9\u5F0F
- /skill-search start  \u2014 \u542F\u7528\u81EA\u52A8\u5339\u914D
- /skill-search stop   \u2014 \u7981\u7528\u81EA\u52A8\u5339\u914D
- /skill-search status \u2014 \u67E5\u770B\u5F53\u524D\u72B6\u6001

\u5F53\u524D\u72B6\u6001: ${isSkillSearchEnabled() ? "\u5DF2\u542F\u7528" : "\u672A\u542F\u7528"}
`;
});
init_skillSearchPanel();

export {
  call
};

//# debugId=8266659BD5E5EA4F64756E2164756E21
//# sourceMappingURL=chunk-d50f79rr.js.map
