agdex 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +42 -5
  2. package/dist/cli/configurable-select.d.ts +15 -0
  3. package/dist/cli/configurable-select.d.ts.map +1 -0
  4. package/dist/cli/index.js +453 -107
  5. package/dist/{index-2hm5b6yq.js → index-thmt54kg.js} +261 -70
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -1
  9. package/dist/lib/agents-md.d.ts +5 -0
  10. package/dist/lib/agents-md.d.ts.map +1 -1
  11. package/dist/lib/providers/cuda-feedstock.d.ts +6 -0
  12. package/dist/lib/providers/cuda-feedstock.d.ts.map +1 -0
  13. package/dist/lib/providers/generic.d.ts +2 -0
  14. package/dist/lib/providers/generic.d.ts.map +1 -1
  15. package/dist/lib/providers/index.d.ts +3 -0
  16. package/dist/lib/providers/index.d.ts.map +1 -1
  17. package/dist/lib/providers/nextjs.d.ts.map +1 -1
  18. package/dist/lib/providers/shadcn-svelte.d.ts +3 -0
  19. package/dist/lib/providers/shadcn-svelte.d.ts.map +1 -0
  20. package/dist/lib/providers/sveltekit.d.ts +3 -0
  21. package/dist/lib/providers/sveltekit.d.ts.map +1 -0
  22. package/dist/lib/skills.d.ts +13 -2
  23. package/dist/lib/skills.d.ts.map +1 -1
  24. package/dist/lib/types.d.ts +20 -3
  25. package/dist/lib/types.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/index-4shp3mqh.js +0 -1871
  28. package/dist/index-57bfejpe.js +0 -1357
  29. package/dist/index-5h59833k.js +0 -1270
  30. package/dist/index-6dj5che8.js +0 -859
  31. package/dist/index-6e18afd7.js +0 -1229
  32. package/dist/index-7adbtddf.js +0 -1123
  33. package/dist/index-9gy9s47s.js +0 -1366
  34. package/dist/index-cfpc7eqp.js +0 -1265
  35. package/dist/index-db6kreh4.js +0 -1188
  36. package/dist/index-exr11by8.js +0 -708
  37. package/dist/index-fxmpwsct.js +0 -779
  38. package/dist/index-gtzz9131.js +0 -708
  39. package/dist/index-hr5jh9yq.js +0 -712
  40. package/dist/index-k299aha0.js +0 -1229
  41. package/dist/index-ntpyfcve.js +0 -1154
  42. package/dist/index-p0xjkwcp.js +0 -1283
  43. package/dist/index-pkx4s2ef.js +0 -2100
  44. package/dist/index-pry8ssn1.js +0 -636
  45. package/dist/index-wgnqr8g3.js +0 -882
  46. package/dist/index-y6zqcrbh.js +0 -788
  47. package/dist/index-zrmn6fd2.js +0 -1903
package/dist/cli/index.js CHANGED
@@ -11,16 +11,21 @@ import {
11
11
  convexProvider,
12
12
  createProvider,
13
13
  deltaRsProvider,
14
+ discoverSkillsShRepo,
14
15
  embed,
15
16
  embedSkills,
17
+ fetchSkillsShSearch,
16
18
  ffmpegProvider,
17
19
  generateIndex,
20
+ generateSkillsIndex,
18
21
  getDefaultOutput,
19
22
  getDefaultSkillSources,
23
+ getEmbeddedProviders,
20
24
  getProvider,
21
25
  hasExistingIndex,
22
26
  hasExistingSkillsIndex,
23
27
  injectIndex,
28
+ injectSkillsIndex,
24
29
  isProviderAvailable,
25
30
  listProviders,
26
31
  manimProvider,
@@ -37,7 +42,7 @@ import {
37
42
  tailwindProvider,
38
43
  tauriProvider,
39
44
  tyProvider
40
- } from "../index-2hm5b6yq.js";
45
+ } from "../index-thmt54kg.js";
41
46
 
42
47
  // node_modules/commander/lib/error.js
43
48
  var require_error = __commonJS((exports) => {
@@ -6883,7 +6888,147 @@ var {
6883
6888
 
6884
6889
  // src/cli/index.ts
6885
6890
  var import_prompts = __toESM(require_prompts3(), 1);
6891
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
6892
+
6893
+ // src/cli/configurable-select.ts
6886
6894
  var import_picocolors = __toESM(require_picocolors(), 1);
6895
+ async function configurableMultiselect(options) {
6896
+ return new Promise((resolve) => {
6897
+ const items = options.choices.map((c) => ({
6898
+ title: c.title,
6899
+ value: c.value,
6900
+ selected: false,
6901
+ version: c.defaultVersion,
6902
+ description: "",
6903
+ defaultVersion: c.defaultVersion
6904
+ }));
6905
+ let cursor = 0;
6906
+ let state = "browsing";
6907
+ let editBuffer = "";
6908
+ let renderedLines = 0;
6909
+ const stdin = process.stdin;
6910
+ const stdout = process.stdout;
6911
+ const wasRaw = stdin.isRaw;
6912
+ stdin.setRawMode(true);
6913
+ stdin.resume();
6914
+ stdin.setEncoding("utf8");
6915
+ function cleanup() {
6916
+ stdout.write("\x1B[?25h");
6917
+ stdin.setRawMode(wasRaw ?? false);
6918
+ stdin.removeAllListeners("data");
6919
+ stdin.pause();
6920
+ }
6921
+ function render() {
6922
+ if (renderedLines > 0) {
6923
+ stdout.write(`\x1B[${renderedLines}A\x1B[0J`);
6924
+ }
6925
+ const lines = [];
6926
+ lines.push(import_picocolors.default.cyan("? ") + import_picocolors.default.bold(options.message));
6927
+ if (state === "browsing") {
6928
+ lines.push(import_picocolors.default.gray(" Space: toggle · Tab: configure · Enter: confirm"));
6929
+ } else {
6930
+ lines.push(import_picocolors.default.gray(" Tab/Enter: next field · Esc: cancel"));
6931
+ }
6932
+ lines.push("");
6933
+ for (let i = 0;i < items.length; i++) {
6934
+ const item = items[i];
6935
+ const isCursor = i === cursor;
6936
+ const checkbox = item.selected ? import_picocolors.default.green("◉") : "○";
6937
+ const arrow = isCursor ? import_picocolors.default.cyan("❯ ") : " ";
6938
+ const title = isCursor ? import_picocolors.default.cyan(item.title) : item.title;
6939
+ let configInfo = "";
6940
+ if (item.version) {
6941
+ configInfo += import_picocolors.default.gray(` (v${item.version})`);
6942
+ }
6943
+ if (item.description) {
6944
+ configInfo += import_picocolors.default.gray(` - ${item.description}`);
6945
+ }
6946
+ lines.push(`${arrow}${checkbox} ${title}${configInfo}`);
6947
+ if (isCursor && state !== "browsing") {
6948
+ const vActive = state === "editing-version";
6949
+ const dActive = state === "editing-description";
6950
+ const vLabel = vActive ? import_picocolors.default.cyan(" Version: ") : import_picocolors.default.gray(" Version: ");
6951
+ const vValue = vActive ? editBuffer + import_picocolors.default.inverse(" ") : item.version || import_picocolors.default.gray("(auto-detect)");
6952
+ lines.push(` ${vLabel}${vValue}`);
6953
+ const dLabel = dActive ? import_picocolors.default.cyan(" Description: ") : import_picocolors.default.gray(" Description: ");
6954
+ const dValue = dActive ? editBuffer + import_picocolors.default.inverse(" ") : item.description || import_picocolors.default.gray("(optional)");
6955
+ lines.push(` ${dLabel}${dValue}`);
6956
+ }
6957
+ }
6958
+ stdout.write("\x1B[?25l");
6959
+ stdout.write(lines.join(`
6960
+ `) + `
6961
+ `);
6962
+ renderedLines = lines.length;
6963
+ }
6964
+ function onData(key) {
6965
+ if (key === "\x03") {
6966
+ cleanup();
6967
+ if (renderedLines > 0) {
6968
+ stdout.write(`\x1B[${renderedLines}A\x1B[0J`);
6969
+ }
6970
+ process.exit(0);
6971
+ }
6972
+ if (state === "browsing") {
6973
+ if (key === "\x1B[A" || key === "k") {
6974
+ cursor = Math.max(0, cursor - 1);
6975
+ } else if (key === "\x1B[B" || key === "j") {
6976
+ cursor = Math.min(items.length - 1, cursor + 1);
6977
+ } else if (key === " ") {
6978
+ items[cursor].selected = !items[cursor].selected;
6979
+ } else if (key === "\t") {
6980
+ state = "editing-version";
6981
+ editBuffer = items[cursor].version;
6982
+ items[cursor].selected = true;
6983
+ } else if (key === "\r") {
6984
+ cleanup();
6985
+ if (renderedLines > 0) {
6986
+ stdout.write(`\x1B[${renderedLines}A\x1B[0J`);
6987
+ }
6988
+ const selected = items.filter((i) => i.selected);
6989
+ stdout.write(import_picocolors.default.cyan("? ") + import_picocolors.default.bold(options.message) + " ");
6990
+ if (selected.length === 0) {
6991
+ stdout.write(import_picocolors.default.gray("(none selected)") + `
6992
+ `);
6993
+ } else {
6994
+ stdout.write(import_picocolors.default.green(selected.map((s) => s.title).join(", ")) + `
6995
+ `);
6996
+ }
6997
+ resolve(selected.map((i) => ({
6998
+ value: i.value,
6999
+ version: i.version,
7000
+ description: i.description
7001
+ })));
7002
+ return;
7003
+ }
7004
+ } else if (state === "editing-version" || state === "editing-description") {
7005
+ if (key === "\t" || key === "\r") {
7006
+ if (state === "editing-version") {
7007
+ items[cursor].version = editBuffer || items[cursor].defaultVersion;
7008
+ state = "editing-description";
7009
+ editBuffer = items[cursor].description;
7010
+ } else {
7011
+ items[cursor].description = editBuffer;
7012
+ state = "browsing";
7013
+ }
7014
+ } else if (key === "\x1B" || key === "\x1B\x1B") {
7015
+ if (state === "editing-version") {} else {}
7016
+ state = "browsing";
7017
+ } else if (key === "" || key === "\b") {
7018
+ editBuffer = editBuffer.slice(0, -1);
7019
+ } else if (key.length === 1 && key.charCodeAt(0) >= 32) {
7020
+ editBuffer += key;
7021
+ }
7022
+ }
7023
+ render();
7024
+ }
7025
+ stdin.on("data", onData);
7026
+ render();
7027
+ });
7028
+ }
7029
+
7030
+ // src/cli/index.ts
7031
+ import os from "os";
6887
7032
  import fs from "fs";
6888
7033
  import path from "path";
6889
7034
  var program2 = new Command;
@@ -6897,7 +7042,7 @@ function formatSize(bytes) {
6897
7042
  return `${mb.toFixed(1)} MB`;
6898
7043
  }
6899
7044
  function onCancel() {
6900
- console.log(import_picocolors.default.yellow(`
7045
+ console.log(import_picocolors2.default.yellow(`
6901
7046
  Cancelled.`));
6902
7047
  process.exit(0);
6903
7048
  }
@@ -6917,7 +7062,7 @@ async function runEmbed(options) {
6917
7062
  const preset = options.provider;
6918
7063
  const builtIn = getProvider(preset);
6919
7064
  if (!builtIn) {
6920
- console.error(import_picocolors.default.red(`Unknown provider: ${options.provider}. Available: ${listProviders().join(", ")}`));
7065
+ console.error(import_picocolors2.default.red(`Unknown provider: ${options.provider}. Available: ${listProviders().join(", ")}`));
6921
7066
  process.exit(1);
6922
7067
  }
6923
7068
  provider = builtIn;
@@ -6931,7 +7076,8 @@ async function runEmbed(options) {
6931
7076
  provider = result.provider;
6932
7077
  version = result.version;
6933
7078
  output = result.output;
6934
- await executeEmbed(cwd, provider, version, output, options.global, result.description);
7079
+ const useGlobal = options.local ? false : undefined;
7080
+ await executeEmbed(cwd, provider, version, output, useGlobal, result.description);
6935
7081
  return;
6936
7082
  }
6937
7083
  } else {
@@ -6939,29 +7085,38 @@ async function runEmbed(options) {
6939
7085
  provider = result.provider;
6940
7086
  version = result.version;
6941
7087
  output = result.output;
6942
- await executeEmbed(cwd, provider, version, output, options.global, result.description);
7088
+ const useGlobal = options.local ? false : undefined;
7089
+ await executeEmbed(cwd, provider, version, output, useGlobal, result.description);
6943
7090
  return;
6944
7091
  }
6945
7092
  output = options.output || getDefaultOutput();
6946
7093
  if (!version && !provider.detectVersion) {
6947
- console.error(import_picocolors.default.red(`Provider ${provider.displayName} requires --version flag since auto-detection is not supported.`));
7094
+ console.error(import_picocolors2.default.red(`Provider ${provider.displayName} requires --version flag since auto-detection is not supported.`));
6948
7095
  process.exit(1);
6949
7096
  }
6950
- await executeEmbed(cwd, provider, version, output, options.global, options.description);
7097
+ const useGlobalCache = options.local ? false : undefined;
7098
+ await executeEmbed(cwd, provider, version, output, useGlobalCache, options.description);
6951
7099
  }
6952
7100
  async function executeEmbed(cwd, provider, version, output, globalCache, description) {
6953
7101
  let resolvedVersion = version;
7102
+ let usingDefaultBranch = false;
6954
7103
  if (!resolvedVersion && provider.detectVersion) {
6955
7104
  const detected = provider.detectVersion(cwd);
6956
7105
  if (!detected.version) {
6957
- console.error(import_picocolors.default.red(detected.error || `Could not detect ${provider.displayName} version`));
6958
- process.exit(1);
7106
+ const fallbackBranch = provider.defaultBranch || "main";
7107
+ console.log(import_picocolors2.default.yellow(`
7108
+ ⚠ ${detected.error || `Could not detect ${provider.displayName} version`}`));
7109
+ console.log(import_picocolors2.default.yellow(` Using latest documentation from '${fallbackBranch}' branch.
7110
+ `));
7111
+ resolvedVersion = fallbackBranch;
7112
+ usingDefaultBranch = true;
7113
+ } else {
7114
+ resolvedVersion = detected.version;
6959
7115
  }
6960
- resolvedVersion = detected.version;
6961
7116
  }
6962
- const displayPath = globalCache ? `~/.cache/agdex/${provider.name}` : `.agdex/${provider.name}`;
7117
+ const versionLabel = usingDefaultBranch ? "latest" : resolvedVersion;
6963
7118
  console.log(`
6964
- Downloading ${import_picocolors.default.cyan(provider.displayName)} ${import_picocolors.default.cyan(resolvedVersion)} documentation to ${import_picocolors.default.cyan(displayPath)}...`);
7119
+ Embedding ${import_picocolors2.default.cyan(provider.displayName)} ${import_picocolors2.default.cyan(versionLabel)} documentation...`);
6965
7120
  const result = await embed({
6966
7121
  cwd,
6967
7122
  provider,
@@ -6971,14 +7126,19 @@ Downloading ${import_picocolors.default.cyan(provider.displayName)} ${import_pic
6971
7126
  description
6972
7127
  });
6973
7128
  if (!result.success) {
6974
- console.error(import_picocolors.default.red(`Failed: ${result.error}`));
7129
+ console.error(import_picocolors2.default.red(`Failed: ${result.error}`));
6975
7130
  process.exit(1);
6976
7131
  }
7132
+ if (result.cacheHit) {
7133
+ console.log(`${import_picocolors2.default.green("✓")} Using cached docs from ${import_picocolors2.default.bold(result.docsPath)}`);
7134
+ } else {
7135
+ console.log(`${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolors2.default.bold(result.docsPath)}`);
7136
+ }
6977
7137
  const action = result.isNewFile ? "Created" : "Updated";
6978
7138
  const sizeInfo = result.isNewFile ? formatSize(result.sizeAfter) : `${formatSize(result.sizeBefore)} → ${formatSize(result.sizeAfter)}`;
6979
- console.log(`${import_picocolors.default.green("✓")} ${action} ${import_picocolors.default.bold(result.targetFile)} (${sizeInfo})`);
7139
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
6980
7140
  if (result.gitignoreUpdated) {
6981
- console.log(`${import_picocolors.default.green("✓")} Added ${import_picocolors.default.bold(".agdex")} to .gitignore`);
7141
+ console.log(`${import_picocolors2.default.green("✓")} Added ${import_picocolors2.default.bold(".agdex")} to .gitignore`);
6982
7142
  }
6983
7143
  console.log("");
6984
7144
  }
@@ -7061,14 +7221,14 @@ async function detectRepoContent(repo, branch) {
7061
7221
  }
7062
7222
  async function promptForOptions(cwd) {
7063
7223
  const detected = autoDetectProvider(cwd);
7064
- console.log(import_picocolors.default.cyan(`
7224
+ console.log(import_picocolors2.default.cyan(`
7065
7225
  agdex - Documentation Index for AI Coding Agents
7066
7226
  `));
7067
- console.log(import_picocolors.default.gray(" Create compressed documentation indexes for AI coding assistants."));
7068
- console.log(import_picocolors.default.gray(` Indexes are embedded into AGENTS.md/CLAUDE.md files.
7227
+ console.log(import_picocolors2.default.gray(" Create compressed documentation indexes for AI coding assistants."));
7228
+ console.log(import_picocolors2.default.gray(` Indexes are embedded into AGENTS.md/CLAUDE.md files.
7069
7229
  `));
7070
7230
  if (detected) {
7071
- console.log(import_picocolors.default.green(` ✓ Detected ${detected.provider.displayName} v${detected.version}
7231
+ console.log(import_picocolors2.default.green(` ✓ Detected ${detected.provider.displayName} v${detected.version}
7072
7232
  `));
7073
7233
  }
7074
7234
  const actionResponse = await import_prompts.default({
@@ -7106,12 +7266,12 @@ agdex - Documentation Index for AI Coding Agents
7106
7266
  }, { onCancel });
7107
7267
  if (actionResponse.action === "detected" && detected) {
7108
7268
  const output2 = await promptForOutputFile();
7109
- const description2 = await promptForDescription();
7269
+ const description = await promptForDescription();
7110
7270
  return {
7111
7271
  provider: detected.provider,
7112
7272
  version: detected.version,
7113
7273
  output: output2,
7114
- description: description2
7274
+ description
7115
7275
  };
7116
7276
  }
7117
7277
  if (actionResponse.action === "local") {
@@ -7147,41 +7307,37 @@ agdex - Documentation Index for AI Coding Agents
7147
7307
  return await promptForGitHubRepo(cwd);
7148
7308
  }
7149
7309
  const availableProviders = listProviders().filter(isProviderAvailable);
7150
- const response = await import_prompts.default([
7151
- {
7152
- type: "select",
7153
- name: "provider",
7154
- message: "Documentation provider",
7155
- choices: availableProviders.map((p) => ({
7156
- title: getProvider(p).displayName,
7157
- value: p
7158
- })),
7159
- initial: detected ? availableProviders.indexOf(detected.provider.name) : 0
7160
- }
7161
- ], { onCancel });
7162
- const provider = getProvider(response.provider);
7163
- let initialVersion = "";
7164
- if (provider.detectVersion) {
7165
- const detectedVersion = provider.detectVersion(cwd);
7166
- if (detectedVersion.version) {
7167
- initialVersion = detectedVersion.version;
7310
+ const choices = availableProviders.map((p) => {
7311
+ const provider = getProvider(p);
7312
+ let defaultVersion = "";
7313
+ if (provider.detectVersion) {
7314
+ const detected2 = provider.detectVersion(cwd);
7315
+ if (detected2.version) {
7316
+ defaultVersion = detected2.version;
7317
+ }
7168
7318
  }
7319
+ return {
7320
+ title: provider.displayName,
7321
+ value: p,
7322
+ defaultVersion
7323
+ };
7324
+ });
7325
+ const selected = await configurableMultiselect({
7326
+ message: "Select documentation providers",
7327
+ choices
7328
+ });
7329
+ if (!selected || selected.length === 0) {
7330
+ console.log(import_picocolors2.default.yellow(`
7331
+ No providers selected.
7332
+ `));
7333
+ process.exit(0);
7169
7334
  }
7170
- const versionResponse = await import_prompts.default({
7171
- type: "text",
7172
- name: "version",
7173
- message: `${provider.displayName} version`,
7174
- initial: initialVersion,
7175
- validate: (v) => v.trim() ? true : "Please enter a version"
7176
- }, { onCancel });
7177
7335
  const output = await promptForOutputFile();
7178
- const description = await promptForDescription();
7179
- return {
7180
- provider,
7181
- version: versionResponse.version,
7182
- output,
7183
- description
7184
- };
7336
+ for (const item of selected) {
7337
+ const provider = getProvider(item.value);
7338
+ await executeEmbed(cwd, provider, item.version, output, undefined, item.description || undefined);
7339
+ }
7340
+ process.exit(0);
7185
7341
  }
7186
7342
  async function promptForOutputFile() {
7187
7343
  const defaultOutput = getDefaultOutput();
@@ -7222,10 +7378,10 @@ async function promptForDescription() {
7222
7378
  }
7223
7379
  async function promptForGitHubRepo(cwd) {
7224
7380
  console.log("");
7225
- console.log(import_picocolors.default.gray(" Enter a GitHub URL or owner/repo. Examples:"));
7226
- console.log(import_picocolors.default.gray(" • anthropics/skills"));
7227
- console.log(import_picocolors.default.gray(" • https://github.com/vercel/next.js"));
7228
- console.log(import_picocolors.default.gray(" • https://github.com/anthropics/skills/tree/main/skills"));
7381
+ console.log(import_picocolors2.default.gray(" Enter a GitHub URL or owner/repo. Examples:"));
7382
+ console.log(import_picocolors2.default.gray(" • anthropics/skills"));
7383
+ console.log(import_picocolors2.default.gray(" • https://github.com/vercel/next.js"));
7384
+ console.log(import_picocolors2.default.gray(" • https://github.com/anthropics/skills/tree/main/skills"));
7229
7385
  console.log("");
7230
7386
  const urlResponse = await import_prompts.default({
7231
7387
  type: "text",
@@ -7242,10 +7398,10 @@ async function promptForGitHubRepo(cwd) {
7242
7398
  }, { onCancel });
7243
7399
  const parsed = parseGitHubInput(urlResponse.url);
7244
7400
  console.log(`
7245
- ${import_picocolors.default.gray("Checking repository contents...")}`);
7401
+ ${import_picocolors2.default.gray("Checking repository contents...")}`);
7246
7402
  const repoContent = await detectRepoContent(parsed.repo, parsed.branch);
7247
7403
  if (parsed.path) {
7248
- console.log(import_picocolors.default.green(` ✓ Using specified path: ${parsed.path}
7404
+ console.log(import_picocolors2.default.green(` ✓ Using specified path: ${parsed.path}
7249
7405
  `));
7250
7406
  const nameResponse2 = await import_prompts.default({
7251
7407
  type: "text",
@@ -7277,10 +7433,10 @@ ${import_picocolors.default.gray("Checking repository contents...")}`);
7277
7433
  if (repoContent.hasSkills)
7278
7434
  detected.push(`skills (${repoContent.skillsPath})`);
7279
7435
  if (detected.length > 0) {
7280
- console.log(import_picocolors.default.green(` ✓ Found: ${detected.join(", ")}
7436
+ console.log(import_picocolors2.default.green(` ✓ Found: ${detected.join(", ")}
7281
7437
  `));
7282
7438
  } else {
7283
- console.log(import_picocolors.default.yellow(` No standard docs/skills directories detected.
7439
+ console.log(import_picocolors2.default.yellow(` No standard docs/skills directories detected.
7284
7440
  `));
7285
7441
  }
7286
7442
  const choices = [];
@@ -7325,10 +7481,8 @@ ${import_picocolors.default.gray("Checking repository contents...")}`);
7325
7481
  docsPath = ".";
7326
7482
  displayName = `${parsed.repo.split("/")[1]} README`;
7327
7483
  } else if (contentChoice.content === "skills") {
7328
- console.log(import_picocolors.default.yellow(`
7329
- Skills indexing from GitHub URLs is coming soon!`));
7330
- console.log(import_picocolors.default.gray(`For now, clone the repo and use: agdex skills local <path>
7331
- `));
7484
+ const output2 = await promptForOutputFile();
7485
+ await runSkillsEmbed({ repo: parsed.repo, output: output2 });
7332
7486
  process.exit(0);
7333
7487
  } else {
7334
7488
  const pathResponse = await import_prompts.default({
@@ -7365,14 +7519,14 @@ async function runLocal(docsPath, options) {
7365
7519
  const cwd = process.cwd();
7366
7520
  const absoluteDocsPath = path.isAbsolute(docsPath) ? docsPath : path.join(cwd, docsPath);
7367
7521
  if (!fs.existsSync(absoluteDocsPath)) {
7368
- console.error(import_picocolors.default.red(`Documentation directory not found: ${docsPath}`));
7522
+ console.error(import_picocolors2.default.red(`Documentation directory not found: ${docsPath}`));
7369
7523
  process.exit(1);
7370
7524
  }
7371
7525
  const name = options.name || path.basename(docsPath);
7372
7526
  const output = options.output || getDefaultOutput();
7373
7527
  const extensions = options.extensions?.split(",") || [".md", ".mdx"];
7374
7528
  console.log(`
7375
- Building index from ${import_picocolors.default.cyan(docsPath)}...`);
7529
+ Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
7376
7530
  const targetPath = path.join(cwd, output);
7377
7531
  let existingContent = "";
7378
7532
  let sizeBefore = 0;
@@ -7398,38 +7552,40 @@ Building index from ${import_picocolors.default.cyan(docsPath)}...`);
7398
7552
  const sizeAfter = Buffer.byteLength(newContent, "utf-8");
7399
7553
  const action = isNewFile ? "Created" : "Updated";
7400
7554
  const sizeInfo = isNewFile ? formatSize(sizeAfter) : `${formatSize(sizeBefore)} → ${formatSize(sizeAfter)}`;
7401
- console.log(`${import_picocolors.default.green("✓")} ${action} ${import_picocolors.default.bold(output)} (${sizeInfo})`);
7555
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(output)} (${sizeInfo})`);
7402
7556
  console.log("");
7403
7557
  }
7404
7558
  function runList() {
7405
- console.log(import_picocolors.default.cyan(`
7559
+ console.log(import_picocolors2.default.cyan(`
7406
7560
  \uD83D\uDCDA Built-in Documentation Providers
7407
7561
  `));
7408
7562
  for (const preset of listProviders()) {
7409
7563
  const provider = getProvider(preset);
7410
- const status = provider ? import_picocolors.default.green("✓") : import_picocolors.default.gray("○");
7564
+ const status = provider ? import_picocolors2.default.green("✓") : import_picocolors2.default.gray("○");
7411
7565
  const name = provider?.displayName || preset;
7412
7566
  const repo = provider?.repo || "not implemented";
7413
- console.log(` ${status} ${import_picocolors.default.bold(preset)} - ${name} (${import_picocolors.default.gray(repo)})`);
7567
+ console.log(` ${status} ${import_picocolors2.default.bold(preset)} - ${name} (${import_picocolors2.default.gray(repo)})`);
7414
7568
  }
7415
7569
  console.log("");
7416
- console.log(import_picocolors.default.cyan(`\uD83D\uDCE6 Usage Examples
7570
+ console.log(import_picocolors2.default.cyan(`\uD83D\uDCE6 Usage Examples
7417
7571
  `));
7418
- console.log(import_picocolors.default.gray(" Built-in provider:"));
7419
- console.log(` ${import_picocolors.default.white("agdex --provider nextjs")}`);
7572
+ console.log(import_picocolors2.default.gray(" Built-in provider:"));
7573
+ console.log(` ${import_picocolors2.default.white("agdex --provider nextjs")}`);
7420
7574
  console.log("");
7421
- console.log(import_picocolors.default.gray(" Any GitHub repository:"));
7422
- console.log(` ${import_picocolors.default.white("agdex --repo owner/repo --docs-path docs")}`);
7575
+ console.log(import_picocolors2.default.gray(" Any GitHub repository:"));
7576
+ console.log(` ${import_picocolors2.default.white("agdex --repo owner/repo --docs-path docs")}`);
7423
7577
  console.log("");
7424
- console.log(import_picocolors.default.gray(" GitHub URL with path:"));
7425
- console.log(` ${import_picocolors.default.white("agdex")} ${import_picocolors.default.gray("(interactive)")}`);
7426
- console.log(` ${import_picocolors.default.gray("→ then enter:")} ${import_picocolors.default.white("https://github.com/anthropics/skills/tree/main/skills")}`);
7578
+ console.log(import_picocolors2.default.gray(" GitHub URL with path:"));
7579
+ console.log(` ${import_picocolors2.default.white("agdex")} ${import_picocolors2.default.gray("(interactive)")}`);
7580
+ console.log(` ${import_picocolors2.default.gray("→ then enter:")} ${import_picocolors2.default.white("https://github.com/anthropics/skills/tree/main/skills")}`);
7427
7581
  console.log("");
7428
- console.log(import_picocolors.default.gray(" Local documentation:"));
7429
- console.log(` ${import_picocolors.default.white('agdex local ./my-docs --name "My Docs"')}`);
7582
+ console.log(import_picocolors2.default.gray(" Local documentation:"));
7583
+ console.log(` ${import_picocolors2.default.white('agdex local ./my-docs --name "My Docs"')}`);
7430
7584
  console.log("");
7431
- console.log(import_picocolors.default.gray(" Skills indexing:"));
7432
- console.log(` ${import_picocolors.default.white("agdex skills embed")}`);
7585
+ console.log(import_picocolors2.default.gray(" Skills indexing:"));
7586
+ console.log(` ${import_picocolors2.default.white("agdex skills embed")}`);
7587
+ console.log(` ${import_picocolors2.default.white("agdex skills embed --repo vercel-labs/agent-skills")}`);
7588
+ console.log(` ${import_picocolors2.default.white("agdex skills find react")}`);
7433
7589
  console.log("");
7434
7590
  }
7435
7591
  program2.name("agdex").description(`Create compressed documentation indexes for AI coding agents.
@@ -7441,19 +7597,76 @@ Sources you can index:
7441
7597
  • Claude Code skills
7442
7598
 
7443
7599
  Run 'agdex' without arguments for interactive mode.`).version("0.4.2");
7444
- program2.command("embed", { isDefault: true }).description("Embed documentation index into AGENTS.md/CLAUDE.md").option("-p, --provider <name>", "Documentation provider (nextjs, react, etc.)").option("--fw-version <version>", "Framework version (auto-detected if not provided)").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("--repo <owner/repo>", "Custom GitHub repository").option("--docs-path <path>", "Path to docs folder in repository").option("-g, --global", "Store docs in global cache (~/.cache/agdex/) instead of local .agdex/").option("-d, --description <text>", "Additional description to include in the index").action(runEmbed);
7600
+ program2.command("embed", { isDefault: true }).description("Embed documentation index into AGENTS.md/CLAUDE.md").option("-p, --provider <name>", "Documentation provider (nextjs, react, etc.)").option("--fw-version <version>", "Framework version (auto-detected if not provided)").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("--repo <owner/repo>", "Custom GitHub repository").option("--docs-path <path>", "Path to docs folder in repository").option("-g, --global", "Store docs in global cache (~/.cache/agdex/) (default)").option("-l, --local", "Store docs in local .agdex/ instead of global cache").option("-d, --description <text>", "Additional description to include in the index").action(runEmbed);
7445
7601
  program2.command("local <docs-path>").description("Build index from local documentation directory").option("-n, --name <name>", "Display name for the documentation").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("-e, --extensions <exts>", "File extensions to include (comma-separated, default: .md,.mdx)").action(runLocal);
7446
7602
  program2.command("list").description("List available documentation providers").action(runList);
7447
- function runRemove(options) {
7603
+ async function runRemove(options) {
7448
7604
  const cwd = process.cwd();
7449
7605
  const output = options.output || getDefaultOutput();
7450
7606
  const targetPath = path.join(cwd, output);
7451
7607
  if (!fs.existsSync(targetPath)) {
7452
- console.error(import_picocolors.default.red(`File not found: ${output}`));
7608
+ console.error(import_picocolors2.default.red(`File not found: ${output}`));
7453
7609
  process.exit(1);
7454
7610
  }
7455
7611
  let content = fs.readFileSync(targetPath, "utf-8");
7456
7612
  const sizeBefore = Buffer.byteLength(content, "utf-8");
7613
+ const hasExplicitFlags = options.docs || options.skills || options.provider;
7614
+ if (!hasExplicitFlags) {
7615
+ const embeddedProviders = getEmbeddedProviders(content);
7616
+ const hasSkills = hasExistingSkillsIndex(content);
7617
+ if (embeddedProviders.length === 0 && !hasSkills) {
7618
+ console.log(import_picocolors2.default.yellow(`
7619
+ No indices found to remove.
7620
+ `));
7621
+ return;
7622
+ }
7623
+ const choices = [];
7624
+ for (const provider of embeddedProviders) {
7625
+ choices.push({ title: `docs: ${provider}`, value: `docs:${provider}` });
7626
+ }
7627
+ if (hasSkills) {
7628
+ choices.push({ title: "skills", value: "skills" });
7629
+ }
7630
+ const response = await import_prompts.default({
7631
+ type: "multiselect",
7632
+ name: "indices",
7633
+ message: "Select indices to remove",
7634
+ choices,
7635
+ instructions: false,
7636
+ hint: "- Space to select, Return to confirm"
7637
+ });
7638
+ if (!response.indices || response.indices.length === 0) {
7639
+ console.log(import_picocolors2.default.yellow(`
7640
+ No indices selected.
7641
+ `));
7642
+ return;
7643
+ }
7644
+ const selected = response.indices;
7645
+ let docsRemoved2 = [];
7646
+ let skillsRemoved2 = false;
7647
+ for (const item of selected) {
7648
+ if (item === "skills") {
7649
+ content = removeSkillsIndex(content);
7650
+ skillsRemoved2 = true;
7651
+ } else if (item.startsWith("docs:")) {
7652
+ const provider = item.slice(5);
7653
+ content = removeDocsIndex(content, provider);
7654
+ docsRemoved2.push(provider);
7655
+ }
7656
+ }
7657
+ fs.writeFileSync(targetPath, content, "utf-8");
7658
+ const sizeAfter2 = Buffer.byteLength(content, "utf-8");
7659
+ console.log("");
7660
+ for (const provider of docsRemoved2) {
7661
+ console.log(`${import_picocolors2.default.green("✓")} Removed docs index (${provider}) from ${import_picocolors2.default.bold(output)}`);
7662
+ }
7663
+ if (skillsRemoved2) {
7664
+ console.log(`${import_picocolors2.default.green("✓")} Removed skills index from ${import_picocolors2.default.bold(output)}`);
7665
+ }
7666
+ console.log(import_picocolors2.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter2)})`));
7667
+ console.log("");
7668
+ return;
7669
+ }
7457
7670
  const removeAll = !options.docs && !options.skills;
7458
7671
  const removeDocs = removeAll || options.docs;
7459
7672
  const removeSkillsIdx = removeAll || options.skills;
@@ -7468,7 +7681,7 @@ function runRemove(options) {
7468
7681
  skillsRemoved = true;
7469
7682
  }
7470
7683
  if (!docsRemoved && !skillsRemoved) {
7471
- console.log(import_picocolors.default.yellow(`
7684
+ console.log(import_picocolors2.default.yellow(`
7472
7685
  No indices found to remove.
7473
7686
  `));
7474
7687
  return;
@@ -7478,12 +7691,12 @@ No indices found to remove.
7478
7691
  console.log("");
7479
7692
  if (docsRemoved) {
7480
7693
  const providerInfo = options.provider ? ` (${options.provider})` : " (all providers)";
7481
- console.log(`${import_picocolors.default.green("✓")} Removed docs index${providerInfo} from ${import_picocolors.default.bold(output)}`);
7694
+ console.log(`${import_picocolors2.default.green("✓")} Removed docs index${providerInfo} from ${import_picocolors2.default.bold(output)}`);
7482
7695
  }
7483
7696
  if (skillsRemoved) {
7484
- console.log(`${import_picocolors.default.green("✓")} Removed skills index from ${import_picocolors.default.bold(output)}`);
7697
+ console.log(`${import_picocolors2.default.green("✓")} Removed skills index from ${import_picocolors2.default.bold(output)}`);
7485
7698
  }
7486
- console.log(import_picocolors.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter)})`));
7699
+ console.log(import_picocolors2.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter)})`));
7487
7700
  console.log("");
7488
7701
  }
7489
7702
  program2.command("remove").description("Remove embedded indices from AGENTS.md/CLAUDE.md").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("--docs", "Remove only docs index").option("--skills", "Remove only skills index").option("-p, --provider <name>", "Remove only a specific provider's docs index").action(runRemove);
@@ -7497,21 +7710,77 @@ async function runSkillsEmbed(options) {
7497
7710
  includeEnabledPlugins: options.plugins !== false,
7498
7711
  pluginPaths: options.plugin || []
7499
7712
  });
7713
+ if (options.repo) {
7714
+ const { execSync } = await import("child_process");
7715
+ const repoName = options.repo;
7716
+ console.log(`
7717
+ Fetching skills from ${import_picocolors2.default.cyan(repoName)}...`);
7718
+ const cacheDir = path.join(os.homedir(), ".cache", "agdex", "skills-sh", repoName.replace("/", path.sep));
7719
+ const cacheHit = fs.existsSync(cacheDir) && fs.readdirSync(cacheDir).length > 0;
7720
+ if (!cacheHit) {
7721
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "agdex-skills-"));
7722
+ try {
7723
+ execSync(`git clone --depth 1 --filter=blob:none https://github.com/${repoName}.git .`, { cwd: tempDir, stdio: "pipe" });
7724
+ fs.mkdirSync(cacheDir, { recursive: true });
7725
+ fs.cpSync(tempDir, cacheDir, { recursive: true });
7726
+ } catch (error) {
7727
+ const msg = error instanceof Error ? error.message : String(error);
7728
+ console.error(import_picocolors2.default.red(`Failed to clone ${repoName}: ${msg}`));
7729
+ process.exit(1);
7730
+ } finally {
7731
+ if (fs.existsSync(tempDir)) {
7732
+ fs.rmSync(tempDir, { recursive: true });
7733
+ }
7734
+ }
7735
+ console.log(`${import_picocolors2.default.green("✓")} Cloned ${import_picocolors2.default.bold(repoName)}`);
7736
+ } else {
7737
+ console.log(`${import_picocolors2.default.green("✓")} Using cached ${import_picocolors2.default.bold(repoName)}`);
7738
+ }
7739
+ const remoteSkills = discoverSkillsShRepo(cacheDir, repoName);
7740
+ if (remoteSkills.length === 0) {
7741
+ console.error(import_picocolors2.default.red(`No skills found in ${repoName}`));
7742
+ process.exit(1);
7743
+ }
7744
+ console.log(`${import_picocolors2.default.green("✓")} Found ${import_picocolors2.default.bold(remoteSkills.length.toString())} skills`);
7745
+ const localSkills = collectAllSkills(sources);
7746
+ const allSkills = [...remoteSkills, ...localSkills];
7747
+ const targetPath = path.join(cwd, output);
7748
+ let existingContent = "";
7749
+ let sizeBefore = 0;
7750
+ let isNewFile = true;
7751
+ if (fs.existsSync(targetPath)) {
7752
+ existingContent = fs.readFileSync(targetPath, "utf-8");
7753
+ sizeBefore = Buffer.byteLength(existingContent, "utf-8");
7754
+ isNewFile = false;
7755
+ }
7756
+ const indexContent = generateSkillsIndex(allSkills, {
7757
+ regenerateCommand: `npx agdex skills embed --repo ${repoName}`
7758
+ });
7759
+ const newContent = injectSkillsIndex(existingContent, indexContent);
7760
+ fs.writeFileSync(targetPath, newContent, "utf-8");
7761
+ const sizeAfter = Buffer.byteLength(newContent, "utf-8");
7762
+ const action2 = isNewFile ? "Created" : "Updated";
7763
+ const sizeInfo2 = isNewFile ? formatSize(sizeAfter) : `${formatSize(sizeBefore)} → ${formatSize(sizeAfter)}`;
7764
+ console.log(`${import_picocolors2.default.green("✓")} ${action2} ${import_picocolors2.default.bold(output)} (${sizeInfo2})`);
7765
+ console.log(`${import_picocolors2.default.green("✓")} Indexed ${import_picocolors2.default.bold(allSkills.length.toString())} skills`);
7766
+ console.log("");
7767
+ return;
7768
+ }
7500
7769
  if (sources.length === 0) {
7501
- console.error(import_picocolors.default.red("No skill sources configured. Use --plugin, --user, --project, or --plugins flags."));
7770
+ console.error(import_picocolors2.default.red("No skill sources configured. Use --plugin, --user, --project, or --plugins flags."));
7502
7771
  process.exit(1);
7503
7772
  }
7504
7773
  console.log(`
7505
- Discovering skills from ${import_picocolors.default.cyan(sources.length.toString())} sources...`);
7774
+ Discovering skills from ${import_picocolors2.default.cyan(sources.length.toString())} sources...`);
7506
7775
  const result = await embedSkills({ cwd, sources, output });
7507
7776
  if (!result.success) {
7508
- console.error(import_picocolors.default.red(`Failed: ${result.error}`));
7777
+ console.error(import_picocolors2.default.red(`Failed: ${result.error}`));
7509
7778
  process.exit(1);
7510
7779
  }
7511
7780
  const action = result.isNewFile ? "Created" : "Updated";
7512
7781
  const sizeInfo = result.isNewFile ? formatSize(result.sizeAfter) : `${formatSize(result.sizeBefore)} → ${formatSize(result.sizeAfter)}`;
7513
- console.log(`${import_picocolors.default.green("✓")} ${action} ${import_picocolors.default.bold(result.targetFile)} (${sizeInfo})`);
7514
- console.log(`${import_picocolors.default.green("✓")} Indexed ${import_picocolors.default.bold(result.skillCount.toString())} skills`);
7782
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
7783
+ console.log(`${import_picocolors2.default.green("✓")} Indexed ${import_picocolors2.default.bold(result.skillCount.toString())} skills`);
7515
7784
  if (result.sourceBreakdown) {
7516
7785
  const breakdown = [];
7517
7786
  if (result.sourceBreakdown.plugin > 0) {
@@ -7523,7 +7792,7 @@ Discovering skills from ${import_picocolors.default.cyan(sources.length.toString
7523
7792
  if (result.sourceBreakdown.project > 0) {
7524
7793
  breakdown.push(`${result.sourceBreakdown.project} project`);
7525
7794
  }
7526
- console.log(import_picocolors.default.gray(` (${breakdown.join(", ")})`));
7795
+ console.log(import_picocolors2.default.gray(` (${breakdown.join(", ")})`));
7527
7796
  }
7528
7797
  console.log("");
7529
7798
  }
@@ -7537,12 +7806,12 @@ function runSkillsList(options) {
7537
7806
  });
7538
7807
  const skills = collectAllSkills(sources);
7539
7808
  if (skills.length === 0) {
7540
- console.log(import_picocolors.default.yellow(`
7809
+ console.log(import_picocolors2.default.yellow(`
7541
7810
  No skills found in any of the specified sources.
7542
7811
  `));
7543
7812
  return;
7544
7813
  }
7545
- console.log(import_picocolors.default.cyan(`
7814
+ console.log(import_picocolors2.default.cyan(`
7546
7815
  Discovered ${skills.length} skills:
7547
7816
  `));
7548
7817
  const grouped = new Map;
@@ -7553,11 +7822,11 @@ Discovered ${skills.length} skills:
7553
7822
  grouped.set(key, existing);
7554
7823
  }
7555
7824
  for (const [source, sourceSkills] of grouped) {
7556
- console.log(import_picocolors.default.bold(` ${source}:`));
7825
+ console.log(import_picocolors2.default.bold(` ${source}:`));
7557
7826
  for (const skill of sourceSkills) {
7558
- console.log(` ${import_picocolors.default.green("•")} ${import_picocolors.default.bold(skill.name)} - ${skill.description}`);
7827
+ console.log(` ${import_picocolors2.default.green("•")} ${import_picocolors2.default.bold(skill.name)} - ${skill.description}`);
7559
7828
  if (skill.siblingFiles.length > 0) {
7560
- console.log(import_picocolors.default.gray(` Files: ${skill.siblingFiles.join(", ")}`));
7829
+ console.log(import_picocolors2.default.gray(` Files: ${skill.siblingFiles.join(", ")}`));
7561
7830
  }
7562
7831
  }
7563
7832
  console.log("");
@@ -7567,7 +7836,7 @@ async function runSkillsLocal(skillsPath, options) {
7567
7836
  const cwd = process.cwd();
7568
7837
  const absolutePath = path.isAbsolute(skillsPath) ? skillsPath : path.join(cwd, skillsPath);
7569
7838
  if (!fs.existsSync(absolutePath)) {
7570
- console.error(import_picocolors.default.red(`Skills directory not found: ${skillsPath}`));
7839
+ console.error(import_picocolors2.default.red(`Skills directory not found: ${skillsPath}`));
7571
7840
  process.exit(1);
7572
7841
  }
7573
7842
  const output = options.output || getDefaultOutput();
@@ -7579,19 +7848,96 @@ async function runSkillsLocal(skillsPath, options) {
7579
7848
  label
7580
7849
  }];
7581
7850
  console.log(`
7582
- Discovering skills from ${import_picocolors.default.cyan(skillsPath)}...`);
7851
+ Discovering skills from ${import_picocolors2.default.cyan(skillsPath)}...`);
7583
7852
  const result = await embedSkills({ cwd, sources, output });
7584
7853
  if (!result.success) {
7585
- console.error(import_picocolors.default.red(`Failed: ${result.error}`));
7854
+ console.error(import_picocolors2.default.red(`Failed: ${result.error}`));
7586
7855
  process.exit(1);
7587
7856
  }
7588
7857
  const action = result.isNewFile ? "Created" : "Updated";
7589
7858
  const sizeInfo = result.isNewFile ? formatSize(result.sizeAfter) : `${formatSize(result.sizeBefore)} → ${formatSize(result.sizeAfter)}`;
7590
- console.log(`${import_picocolors.default.green("✓")} ${action} ${import_picocolors.default.bold(result.targetFile)} (${sizeInfo})`);
7591
- console.log(`${import_picocolors.default.green("✓")} Indexed ${import_picocolors.default.bold(result.skillCount.toString())} skills`);
7859
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
7860
+ console.log(`${import_picocolors2.default.green("✓")} Indexed ${import_picocolors2.default.bold(result.skillCount.toString())} skills`);
7592
7861
  console.log("");
7593
7862
  }
7594
- skillsCommand.command("embed").description("Embed skills index into AGENTS.md").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("--plugin <path...>", "Additional plugin repo paths (with plugins/ structure)").option("--plugins", "Include enabled plugins from settings.json (default: true)").option("--no-plugins", "Exclude enabled plugins from settings.json").option("--user", "Include ~/.claude/skills (default: true)").option("--no-user", "Exclude ~/.claude/skills").option("--project", "Include .claude/skills (default: true)").option("--no-project", "Exclude .claude/skills").action(runSkillsEmbed);
7863
+ async function runSkillsFind(query, options) {
7864
+ const limit = options.limit || 20;
7865
+ if (query) {
7866
+ console.log(`
7867
+ Searching skills.sh for ${import_picocolors2.default.cyan(query)}...`);
7868
+ try {
7869
+ const results = await fetchSkillsShSearch(query, limit);
7870
+ if (results.length === 0) {
7871
+ console.log(import_picocolors2.default.yellow(`
7872
+ No skills found matching "${query}".
7873
+ `));
7874
+ return;
7875
+ }
7876
+ console.log(import_picocolors2.default.cyan(`
7877
+ Found ${results.length} skills:
7878
+ `));
7879
+ const maxNameLen = Math.max(...results.map((r) => r.name.length));
7880
+ for (const result of results) {
7881
+ const name = import_picocolors2.default.bold(result.name.padEnd(maxNameLen));
7882
+ const source = import_picocolors2.default.gray(result.source);
7883
+ const installs = import_picocolors2.default.green(`${result.installs.toLocaleString()} installs`);
7884
+ console.log(` ${name} ${source} ${installs}`);
7885
+ }
7886
+ console.log("");
7887
+ console.log(import_picocolors2.default.gray(` To embed: agdex skills embed --repo <owner/repo>`));
7888
+ console.log("");
7889
+ } catch (error) {
7890
+ const msg = error instanceof Error ? error.message : String(error);
7891
+ console.error(import_picocolors2.default.red(`Failed to search skills.sh: ${msg}`));
7892
+ process.exit(1);
7893
+ }
7894
+ return;
7895
+ }
7896
+ console.log(import_picocolors2.default.cyan(`
7897
+ agdex - Search skills.sh
7898
+ `));
7899
+ console.log(import_picocolors2.default.gray(` Search the skills.sh ecosystem for agent skills.
7900
+ `));
7901
+ const searchResponse = await import_prompts.default({
7902
+ type: "text",
7903
+ name: "query",
7904
+ message: "Search skills",
7905
+ validate: (v) => v.trim() ? true : "Please enter a search query"
7906
+ }, { onCancel });
7907
+ console.log(`
7908
+ ${import_picocolors2.default.gray("Searching...")}`);
7909
+ try {
7910
+ const results = await fetchSkillsShSearch(searchResponse.query, limit);
7911
+ if (results.length === 0) {
7912
+ console.log(import_picocolors2.default.yellow(`
7913
+ No skills found matching "${searchResponse.query}".
7914
+ `));
7915
+ return;
7916
+ }
7917
+ const choices = results.map((r) => ({
7918
+ title: `${r.name} ${import_picocolors2.default.gray(`(${r.source})`)} ${import_picocolors2.default.green(`${r.installs.toLocaleString()}`)}`,
7919
+ value: r
7920
+ }));
7921
+ const selectResponse = await import_prompts.default({
7922
+ type: "select",
7923
+ name: "skill",
7924
+ message: "Select a skill to embed",
7925
+ choices
7926
+ }, { onCancel });
7927
+ const selected = selectResponse.skill;
7928
+ const repoName = selected.source;
7929
+ console.log(`
7930
+ Selected ${import_picocolors2.default.bold(selected.name)} from ${import_picocolors2.default.cyan(repoName)}`);
7931
+ const output = options.output || await promptForOutputFile();
7932
+ await runSkillsEmbed({ repo: repoName, output });
7933
+ } catch (error) {
7934
+ const msg = error instanceof Error ? error.message : String(error);
7935
+ console.error(import_picocolors2.default.red(`Failed to search skills.sh: ${msg}`));
7936
+ process.exit(1);
7937
+ }
7938
+ }
7939
+ skillsCommand.command("embed").description("Embed skills index into AGENTS.md").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("--plugin <path...>", "Additional plugin repo paths (with plugins/ structure)").option("--plugins", "Include enabled plugins from settings.json (default: true)").option("--no-plugins", "Exclude enabled plugins from settings.json").option("--user", "Include ~/.claude/skills (default: true)").option("--no-user", "Exclude ~/.claude/skills").option("--project", "Include .claude/skills (default: true)").option("--no-project", "Exclude .claude/skills").option("--repo <owner/repo>", "Fetch and index skills from a skills.sh-compatible GitHub repository").action(runSkillsEmbed);
7595
7940
  skillsCommand.command("list").description("List discovered skills").option("--plugin <path...>", "Additional plugin repo paths (with plugins/ structure)").option("--plugins", "Include enabled plugins from settings.json (default: true)").option("--no-plugins", "Exclude enabled plugins from settings.json").option("--user", "Include ~/.claude/skills (default: true)").option("--no-user", "Exclude ~/.claude/skills").option("--project", "Include .claude/skills (default: true)").option("--no-project", "Exclude .claude/skills").action(runSkillsList);
7596
7941
  skillsCommand.command("local <skills-path>").description("Index skills from a local path").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("-n, --name <name>", "Label for this skill source").action(runSkillsLocal);
7942
+ skillsCommand.command("find [query]").description("Search skills.sh for agent skills").option("-l, --limit <n>", "Max results (default: 20)", parseInt).option("-o, --output <file>", "Target file for embedding").action(runSkillsFind);
7597
7943
  program2.parse();