agdex 0.4.1 → 0.5.0

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 (46) 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 +444 -106
  5. package/dist/{index-9gy9s47s.js → index-974mhezm.js} +919 -61
  6. package/dist/index-g5x6jpyb.js +2304 -0
  7. package/dist/{index-pkx4s2ef.js → index-nn4xptha.js} +42 -15
  8. package/dist/index-pfdh6eyh.js +2241 -0
  9. package/dist/{index-4shp3mqh.js → index-vf9nfyjb.js} +369 -60
  10. package/dist/{index-zrmn6fd2.js → index-wsqyam11.js} +301 -68
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -1
  14. package/dist/lib/agents-md.d.ts +5 -0
  15. package/dist/lib/agents-md.d.ts.map +1 -1
  16. package/dist/lib/providers/cuda-feedstock.d.ts +6 -0
  17. package/dist/lib/providers/cuda-feedstock.d.ts.map +1 -0
  18. package/dist/lib/providers/generic.d.ts.map +1 -1
  19. package/dist/lib/providers/index.d.ts +3 -0
  20. package/dist/lib/providers/index.d.ts.map +1 -1
  21. package/dist/lib/providers/shadcn-svelte.d.ts +3 -0
  22. package/dist/lib/providers/shadcn-svelte.d.ts.map +1 -0
  23. package/dist/lib/providers/sveltekit.d.ts +3 -0
  24. package/dist/lib/providers/sveltekit.d.ts.map +1 -0
  25. package/dist/lib/skills.d.ts +13 -2
  26. package/dist/lib/skills.d.ts.map +1 -1
  27. package/dist/lib/types.d.ts +18 -3
  28. package/dist/lib/types.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/index-57bfejpe.js +0 -1357
  31. package/dist/index-5h59833k.js +0 -1270
  32. package/dist/index-6dj5che8.js +0 -859
  33. package/dist/index-6e18afd7.js +0 -1229
  34. package/dist/index-7adbtddf.js +0 -1123
  35. package/dist/index-cfpc7eqp.js +0 -1265
  36. package/dist/index-db6kreh4.js +0 -1188
  37. package/dist/index-exr11by8.js +0 -708
  38. package/dist/index-fxmpwsct.js +0 -779
  39. package/dist/index-gtzz9131.js +0 -708
  40. package/dist/index-hr5jh9yq.js +0 -712
  41. package/dist/index-k299aha0.js +0 -1229
  42. package/dist/index-ntpyfcve.js +0 -1154
  43. package/dist/index-p0xjkwcp.js +0 -1283
  44. package/dist/index-pry8ssn1.js +0 -636
  45. package/dist/index-wgnqr8g3.js +0 -882
  46. package/dist/index-y6zqcrbh.js +0 -788
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-pkx4s2ef.js";
45
+ } from "../index-g5x6jpyb.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,30 @@ 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;
6954
7102
  if (!resolvedVersion && provider.detectVersion) {
6955
7103
  const detected = provider.detectVersion(cwd);
6956
7104
  if (!detected.version) {
6957
- console.error(import_picocolors.default.red(detected.error || `Could not detect ${provider.displayName} version`));
7105
+ console.error(import_picocolors2.default.red(detected.error || `Could not detect ${provider.displayName} version`));
6958
7106
  process.exit(1);
6959
7107
  }
6960
7108
  resolvedVersion = detected.version;
6961
7109
  }
6962
- const displayPath = globalCache ? `~/.cache/agdex/${provider.name}` : `.agdex/${provider.name}`;
6963
7110
  console.log(`
6964
- Downloading ${import_picocolors.default.cyan(provider.displayName)} ${import_picocolors.default.cyan(resolvedVersion)} documentation to ${import_picocolors.default.cyan(displayPath)}...`);
7111
+ Embedding ${import_picocolors2.default.cyan(provider.displayName)} ${import_picocolors2.default.cyan(resolvedVersion)} documentation...`);
6965
7112
  const result = await embed({
6966
7113
  cwd,
6967
7114
  provider,
@@ -6971,14 +7118,19 @@ Downloading ${import_picocolors.default.cyan(provider.displayName)} ${import_pic
6971
7118
  description
6972
7119
  });
6973
7120
  if (!result.success) {
6974
- console.error(import_picocolors.default.red(`Failed: ${result.error}`));
7121
+ console.error(import_picocolors2.default.red(`Failed: ${result.error}`));
6975
7122
  process.exit(1);
6976
7123
  }
7124
+ if (result.cacheHit) {
7125
+ console.log(`${import_picocolors2.default.green("✓")} Using cached docs from ${import_picocolors2.default.bold(result.docsPath)}`);
7126
+ } else {
7127
+ console.log(`${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolors2.default.bold(result.docsPath)}`);
7128
+ }
6977
7129
  const action = result.isNewFile ? "Created" : "Updated";
6978
7130
  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})`);
7131
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
6980
7132
  if (result.gitignoreUpdated) {
6981
- console.log(`${import_picocolors.default.green("✓")} Added ${import_picocolors.default.bold(".agdex")} to .gitignore`);
7133
+ console.log(`${import_picocolors2.default.green("✓")} Added ${import_picocolors2.default.bold(".agdex")} to .gitignore`);
6982
7134
  }
6983
7135
  console.log("");
6984
7136
  }
@@ -7061,14 +7213,14 @@ async function detectRepoContent(repo, branch) {
7061
7213
  }
7062
7214
  async function promptForOptions(cwd) {
7063
7215
  const detected = autoDetectProvider(cwd);
7064
- console.log(import_picocolors.default.cyan(`
7216
+ console.log(import_picocolors2.default.cyan(`
7065
7217
  agdex - Documentation Index for AI Coding Agents
7066
7218
  `));
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.
7219
+ console.log(import_picocolors2.default.gray(" Create compressed documentation indexes for AI coding assistants."));
7220
+ console.log(import_picocolors2.default.gray(` Indexes are embedded into AGENTS.md/CLAUDE.md files.
7069
7221
  `));
7070
7222
  if (detected) {
7071
- console.log(import_picocolors.default.green(` ✓ Detected ${detected.provider.displayName} v${detected.version}
7223
+ console.log(import_picocolors2.default.green(` ✓ Detected ${detected.provider.displayName} v${detected.version}
7072
7224
  `));
7073
7225
  }
7074
7226
  const actionResponse = await import_prompts.default({
@@ -7106,12 +7258,12 @@ agdex - Documentation Index for AI Coding Agents
7106
7258
  }, { onCancel });
7107
7259
  if (actionResponse.action === "detected" && detected) {
7108
7260
  const output2 = await promptForOutputFile();
7109
- const description2 = await promptForDescription();
7261
+ const description = await promptForDescription();
7110
7262
  return {
7111
7263
  provider: detected.provider,
7112
7264
  version: detected.version,
7113
7265
  output: output2,
7114
- description: description2
7266
+ description
7115
7267
  };
7116
7268
  }
7117
7269
  if (actionResponse.action === "local") {
@@ -7147,41 +7299,37 @@ agdex - Documentation Index for AI Coding Agents
7147
7299
  return await promptForGitHubRepo(cwd);
7148
7300
  }
7149
7301
  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;
7302
+ const choices = availableProviders.map((p) => {
7303
+ const provider = getProvider(p);
7304
+ let defaultVersion = "";
7305
+ if (provider.detectVersion) {
7306
+ const detected2 = provider.detectVersion(cwd);
7307
+ if (detected2.version) {
7308
+ defaultVersion = detected2.version;
7309
+ }
7168
7310
  }
7311
+ return {
7312
+ title: provider.displayName,
7313
+ value: p,
7314
+ defaultVersion
7315
+ };
7316
+ });
7317
+ const selected = await configurableMultiselect({
7318
+ message: "Select documentation providers",
7319
+ choices
7320
+ });
7321
+ if (!selected || selected.length === 0) {
7322
+ console.log(import_picocolors2.default.yellow(`
7323
+ No providers selected.
7324
+ `));
7325
+ process.exit(0);
7169
7326
  }
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
7327
  const output = await promptForOutputFile();
7178
- const description = await promptForDescription();
7179
- return {
7180
- provider,
7181
- version: versionResponse.version,
7182
- output,
7183
- description
7184
- };
7328
+ for (const item of selected) {
7329
+ const provider = getProvider(item.value);
7330
+ await executeEmbed(cwd, provider, item.version, output, undefined, item.description || undefined);
7331
+ }
7332
+ process.exit(0);
7185
7333
  }
7186
7334
  async function promptForOutputFile() {
7187
7335
  const defaultOutput = getDefaultOutput();
@@ -7222,10 +7370,10 @@ async function promptForDescription() {
7222
7370
  }
7223
7371
  async function promptForGitHubRepo(cwd) {
7224
7372
  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"));
7373
+ console.log(import_picocolors2.default.gray(" Enter a GitHub URL or owner/repo. Examples:"));
7374
+ console.log(import_picocolors2.default.gray(" • anthropics/skills"));
7375
+ console.log(import_picocolors2.default.gray(" • https://github.com/vercel/next.js"));
7376
+ console.log(import_picocolors2.default.gray(" • https://github.com/anthropics/skills/tree/main/skills"));
7229
7377
  console.log("");
7230
7378
  const urlResponse = await import_prompts.default({
7231
7379
  type: "text",
@@ -7242,10 +7390,10 @@ async function promptForGitHubRepo(cwd) {
7242
7390
  }, { onCancel });
7243
7391
  const parsed = parseGitHubInput(urlResponse.url);
7244
7392
  console.log(`
7245
- ${import_picocolors.default.gray("Checking repository contents...")}`);
7393
+ ${import_picocolors2.default.gray("Checking repository contents...")}`);
7246
7394
  const repoContent = await detectRepoContent(parsed.repo, parsed.branch);
7247
7395
  if (parsed.path) {
7248
- console.log(import_picocolors.default.green(` ✓ Using specified path: ${parsed.path}
7396
+ console.log(import_picocolors2.default.green(` ✓ Using specified path: ${parsed.path}
7249
7397
  `));
7250
7398
  const nameResponse2 = await import_prompts.default({
7251
7399
  type: "text",
@@ -7277,10 +7425,10 @@ ${import_picocolors.default.gray("Checking repository contents...")}`);
7277
7425
  if (repoContent.hasSkills)
7278
7426
  detected.push(`skills (${repoContent.skillsPath})`);
7279
7427
  if (detected.length > 0) {
7280
- console.log(import_picocolors.default.green(` ✓ Found: ${detected.join(", ")}
7428
+ console.log(import_picocolors2.default.green(` ✓ Found: ${detected.join(", ")}
7281
7429
  `));
7282
7430
  } else {
7283
- console.log(import_picocolors.default.yellow(` No standard docs/skills directories detected.
7431
+ console.log(import_picocolors2.default.yellow(` No standard docs/skills directories detected.
7284
7432
  `));
7285
7433
  }
7286
7434
  const choices = [];
@@ -7325,10 +7473,8 @@ ${import_picocolors.default.gray("Checking repository contents...")}`);
7325
7473
  docsPath = ".";
7326
7474
  displayName = `${parsed.repo.split("/")[1]} README`;
7327
7475
  } 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
- `));
7476
+ const output2 = await promptForOutputFile();
7477
+ await runSkillsEmbed({ repo: parsed.repo, output: output2 });
7332
7478
  process.exit(0);
7333
7479
  } else {
7334
7480
  const pathResponse = await import_prompts.default({
@@ -7365,14 +7511,14 @@ async function runLocal(docsPath, options) {
7365
7511
  const cwd = process.cwd();
7366
7512
  const absoluteDocsPath = path.isAbsolute(docsPath) ? docsPath : path.join(cwd, docsPath);
7367
7513
  if (!fs.existsSync(absoluteDocsPath)) {
7368
- console.error(import_picocolors.default.red(`Documentation directory not found: ${docsPath}`));
7514
+ console.error(import_picocolors2.default.red(`Documentation directory not found: ${docsPath}`));
7369
7515
  process.exit(1);
7370
7516
  }
7371
7517
  const name = options.name || path.basename(docsPath);
7372
7518
  const output = options.output || getDefaultOutput();
7373
7519
  const extensions = options.extensions?.split(",") || [".md", ".mdx"];
7374
7520
  console.log(`
7375
- Building index from ${import_picocolors.default.cyan(docsPath)}...`);
7521
+ Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
7376
7522
  const targetPath = path.join(cwd, output);
7377
7523
  let existingContent = "";
7378
7524
  let sizeBefore = 0;
@@ -7398,38 +7544,40 @@ Building index from ${import_picocolors.default.cyan(docsPath)}...`);
7398
7544
  const sizeAfter = Buffer.byteLength(newContent, "utf-8");
7399
7545
  const action = isNewFile ? "Created" : "Updated";
7400
7546
  const sizeInfo = isNewFile ? formatSize(sizeAfter) : `${formatSize(sizeBefore)} → ${formatSize(sizeAfter)}`;
7401
- console.log(`${import_picocolors.default.green("✓")} ${action} ${import_picocolors.default.bold(output)} (${sizeInfo})`);
7547
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(output)} (${sizeInfo})`);
7402
7548
  console.log("");
7403
7549
  }
7404
7550
  function runList() {
7405
- console.log(import_picocolors.default.cyan(`
7551
+ console.log(import_picocolors2.default.cyan(`
7406
7552
  \uD83D\uDCDA Built-in Documentation Providers
7407
7553
  `));
7408
7554
  for (const preset of listProviders()) {
7409
7555
  const provider = getProvider(preset);
7410
- const status = provider ? import_picocolors.default.green("✓") : import_picocolors.default.gray("○");
7556
+ const status = provider ? import_picocolors2.default.green("✓") : import_picocolors2.default.gray("○");
7411
7557
  const name = provider?.displayName || preset;
7412
7558
  const repo = provider?.repo || "not implemented";
7413
- console.log(` ${status} ${import_picocolors.default.bold(preset)} - ${name} (${import_picocolors.default.gray(repo)})`);
7559
+ console.log(` ${status} ${import_picocolors2.default.bold(preset)} - ${name} (${import_picocolors2.default.gray(repo)})`);
7414
7560
  }
7415
7561
  console.log("");
7416
- console.log(import_picocolors.default.cyan(`\uD83D\uDCE6 Usage Examples
7562
+ console.log(import_picocolors2.default.cyan(`\uD83D\uDCE6 Usage Examples
7417
7563
  `));
7418
- console.log(import_picocolors.default.gray(" Built-in provider:"));
7419
- console.log(` ${import_picocolors.default.white("agdex --provider nextjs")}`);
7564
+ console.log(import_picocolors2.default.gray(" Built-in provider:"));
7565
+ console.log(` ${import_picocolors2.default.white("agdex --provider nextjs")}`);
7420
7566
  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")}`);
7567
+ console.log(import_picocolors2.default.gray(" Any GitHub repository:"));
7568
+ console.log(` ${import_picocolors2.default.white("agdex --repo owner/repo --docs-path docs")}`);
7423
7569
  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")}`);
7570
+ console.log(import_picocolors2.default.gray(" GitHub URL with path:"));
7571
+ console.log(` ${import_picocolors2.default.white("agdex")} ${import_picocolors2.default.gray("(interactive)")}`);
7572
+ console.log(` ${import_picocolors2.default.gray("→ then enter:")} ${import_picocolors2.default.white("https://github.com/anthropics/skills/tree/main/skills")}`);
7427
7573
  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"')}`);
7574
+ console.log(import_picocolors2.default.gray(" Local documentation:"));
7575
+ console.log(` ${import_picocolors2.default.white('agdex local ./my-docs --name "My Docs"')}`);
7430
7576
  console.log("");
7431
- console.log(import_picocolors.default.gray(" Skills indexing:"));
7432
- console.log(` ${import_picocolors.default.white("agdex skills embed")}`);
7577
+ console.log(import_picocolors2.default.gray(" Skills indexing:"));
7578
+ console.log(` ${import_picocolors2.default.white("agdex skills embed")}`);
7579
+ console.log(` ${import_picocolors2.default.white("agdex skills embed --repo vercel-labs/agent-skills")}`);
7580
+ console.log(` ${import_picocolors2.default.white("agdex skills find react")}`);
7433
7581
  console.log("");
7434
7582
  }
7435
7583
  program2.name("agdex").description(`Create compressed documentation indexes for AI coding agents.
@@ -7440,20 +7588,77 @@ Sources you can index:
7440
7588
  • Local documentation directories
7441
7589
  • Claude Code skills
7442
7590
 
7443
- Run 'agdex' without arguments for interactive mode.`).version("0.2.0");
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);
7591
+ Run 'agdex' without arguments for interactive mode.`).version("0.4.2");
7592
+ 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
7593
  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
7594
  program2.command("list").description("List available documentation providers").action(runList);
7447
- function runRemove(options) {
7595
+ async function runRemove(options) {
7448
7596
  const cwd = process.cwd();
7449
7597
  const output = options.output || getDefaultOutput();
7450
7598
  const targetPath = path.join(cwd, output);
7451
7599
  if (!fs.existsSync(targetPath)) {
7452
- console.error(import_picocolors.default.red(`File not found: ${output}`));
7600
+ console.error(import_picocolors2.default.red(`File not found: ${output}`));
7453
7601
  process.exit(1);
7454
7602
  }
7455
7603
  let content = fs.readFileSync(targetPath, "utf-8");
7456
7604
  const sizeBefore = Buffer.byteLength(content, "utf-8");
7605
+ const hasExplicitFlags = options.docs || options.skills || options.provider;
7606
+ if (!hasExplicitFlags) {
7607
+ const embeddedProviders = getEmbeddedProviders(content);
7608
+ const hasSkills = hasExistingSkillsIndex(content);
7609
+ if (embeddedProviders.length === 0 && !hasSkills) {
7610
+ console.log(import_picocolors2.default.yellow(`
7611
+ No indices found to remove.
7612
+ `));
7613
+ return;
7614
+ }
7615
+ const choices = [];
7616
+ for (const provider of embeddedProviders) {
7617
+ choices.push({ title: `docs: ${provider}`, value: `docs:${provider}` });
7618
+ }
7619
+ if (hasSkills) {
7620
+ choices.push({ title: "skills", value: "skills" });
7621
+ }
7622
+ const response = await import_prompts.default({
7623
+ type: "multiselect",
7624
+ name: "indices",
7625
+ message: "Select indices to remove",
7626
+ choices,
7627
+ instructions: false,
7628
+ hint: "- Space to select, Return to confirm"
7629
+ });
7630
+ if (!response.indices || response.indices.length === 0) {
7631
+ console.log(import_picocolors2.default.yellow(`
7632
+ No indices selected.
7633
+ `));
7634
+ return;
7635
+ }
7636
+ const selected = response.indices;
7637
+ let docsRemoved2 = [];
7638
+ let skillsRemoved2 = false;
7639
+ for (const item of selected) {
7640
+ if (item === "skills") {
7641
+ content = removeSkillsIndex(content);
7642
+ skillsRemoved2 = true;
7643
+ } else if (item.startsWith("docs:")) {
7644
+ const provider = item.slice(5);
7645
+ content = removeDocsIndex(content, provider);
7646
+ docsRemoved2.push(provider);
7647
+ }
7648
+ }
7649
+ fs.writeFileSync(targetPath, content, "utf-8");
7650
+ const sizeAfter2 = Buffer.byteLength(content, "utf-8");
7651
+ console.log("");
7652
+ for (const provider of docsRemoved2) {
7653
+ console.log(`${import_picocolors2.default.green("✓")} Removed docs index (${provider}) from ${import_picocolors2.default.bold(output)}`);
7654
+ }
7655
+ if (skillsRemoved2) {
7656
+ console.log(`${import_picocolors2.default.green("✓")} Removed skills index from ${import_picocolors2.default.bold(output)}`);
7657
+ }
7658
+ console.log(import_picocolors2.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter2)})`));
7659
+ console.log("");
7660
+ return;
7661
+ }
7457
7662
  const removeAll = !options.docs && !options.skills;
7458
7663
  const removeDocs = removeAll || options.docs;
7459
7664
  const removeSkillsIdx = removeAll || options.skills;
@@ -7468,7 +7673,7 @@ function runRemove(options) {
7468
7673
  skillsRemoved = true;
7469
7674
  }
7470
7675
  if (!docsRemoved && !skillsRemoved) {
7471
- console.log(import_picocolors.default.yellow(`
7676
+ console.log(import_picocolors2.default.yellow(`
7472
7677
  No indices found to remove.
7473
7678
  `));
7474
7679
  return;
@@ -7478,12 +7683,12 @@ No indices found to remove.
7478
7683
  console.log("");
7479
7684
  if (docsRemoved) {
7480
7685
  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)}`);
7686
+ console.log(`${import_picocolors2.default.green("✓")} Removed docs index${providerInfo} from ${import_picocolors2.default.bold(output)}`);
7482
7687
  }
7483
7688
  if (skillsRemoved) {
7484
- console.log(`${import_picocolors.default.green("✓")} Removed skills index from ${import_picocolors.default.bold(output)}`);
7689
+ console.log(`${import_picocolors2.default.green("✓")} Removed skills index from ${import_picocolors2.default.bold(output)}`);
7485
7690
  }
7486
- console.log(import_picocolors.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter)})`));
7691
+ console.log(import_picocolors2.default.gray(` (${formatSize(sizeBefore)} → ${formatSize(sizeAfter)})`));
7487
7692
  console.log("");
7488
7693
  }
7489
7694
  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 +7702,77 @@ async function runSkillsEmbed(options) {
7497
7702
  includeEnabledPlugins: options.plugins !== false,
7498
7703
  pluginPaths: options.plugin || []
7499
7704
  });
7705
+ if (options.repo) {
7706
+ const { execSync } = await import("child_process");
7707
+ const repoName = options.repo;
7708
+ console.log(`
7709
+ Fetching skills from ${import_picocolors2.default.cyan(repoName)}...`);
7710
+ const cacheDir = path.join(os.homedir(), ".cache", "agdex", "skills-sh", repoName.replace("/", path.sep));
7711
+ const cacheHit = fs.existsSync(cacheDir) && fs.readdirSync(cacheDir).length > 0;
7712
+ if (!cacheHit) {
7713
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "agdex-skills-"));
7714
+ try {
7715
+ execSync(`git clone --depth 1 --filter=blob:none https://github.com/${repoName}.git .`, { cwd: tempDir, stdio: "pipe" });
7716
+ fs.mkdirSync(cacheDir, { recursive: true });
7717
+ fs.cpSync(tempDir, cacheDir, { recursive: true });
7718
+ } catch (error) {
7719
+ const msg = error instanceof Error ? error.message : String(error);
7720
+ console.error(import_picocolors2.default.red(`Failed to clone ${repoName}: ${msg}`));
7721
+ process.exit(1);
7722
+ } finally {
7723
+ if (fs.existsSync(tempDir)) {
7724
+ fs.rmSync(tempDir, { recursive: true });
7725
+ }
7726
+ }
7727
+ console.log(`${import_picocolors2.default.green("✓")} Cloned ${import_picocolors2.default.bold(repoName)}`);
7728
+ } else {
7729
+ console.log(`${import_picocolors2.default.green("✓")} Using cached ${import_picocolors2.default.bold(repoName)}`);
7730
+ }
7731
+ const remoteSkills = discoverSkillsShRepo(cacheDir, repoName);
7732
+ if (remoteSkills.length === 0) {
7733
+ console.error(import_picocolors2.default.red(`No skills found in ${repoName}`));
7734
+ process.exit(1);
7735
+ }
7736
+ console.log(`${import_picocolors2.default.green("✓")} Found ${import_picocolors2.default.bold(remoteSkills.length.toString())} skills`);
7737
+ const localSkills = collectAllSkills(sources);
7738
+ const allSkills = [...remoteSkills, ...localSkills];
7739
+ const targetPath = path.join(cwd, output);
7740
+ let existingContent = "";
7741
+ let sizeBefore = 0;
7742
+ let isNewFile = true;
7743
+ if (fs.existsSync(targetPath)) {
7744
+ existingContent = fs.readFileSync(targetPath, "utf-8");
7745
+ sizeBefore = Buffer.byteLength(existingContent, "utf-8");
7746
+ isNewFile = false;
7747
+ }
7748
+ const indexContent = generateSkillsIndex(allSkills, {
7749
+ regenerateCommand: `npx agdex skills embed --repo ${repoName}`
7750
+ });
7751
+ const newContent = injectSkillsIndex(existingContent, indexContent);
7752
+ fs.writeFileSync(targetPath, newContent, "utf-8");
7753
+ const sizeAfter = Buffer.byteLength(newContent, "utf-8");
7754
+ const action2 = isNewFile ? "Created" : "Updated";
7755
+ const sizeInfo2 = isNewFile ? formatSize(sizeAfter) : `${formatSize(sizeBefore)} → ${formatSize(sizeAfter)}`;
7756
+ console.log(`${import_picocolors2.default.green("✓")} ${action2} ${import_picocolors2.default.bold(output)} (${sizeInfo2})`);
7757
+ console.log(`${import_picocolors2.default.green("✓")} Indexed ${import_picocolors2.default.bold(allSkills.length.toString())} skills`);
7758
+ console.log("");
7759
+ return;
7760
+ }
7500
7761
  if (sources.length === 0) {
7501
- console.error(import_picocolors.default.red("No skill sources configured. Use --plugin, --user, --project, or --plugins flags."));
7762
+ console.error(import_picocolors2.default.red("No skill sources configured. Use --plugin, --user, --project, or --plugins flags."));
7502
7763
  process.exit(1);
7503
7764
  }
7504
7765
  console.log(`
7505
- Discovering skills from ${import_picocolors.default.cyan(sources.length.toString())} sources...`);
7766
+ Discovering skills from ${import_picocolors2.default.cyan(sources.length.toString())} sources...`);
7506
7767
  const result = await embedSkills({ cwd, sources, output });
7507
7768
  if (!result.success) {
7508
- console.error(import_picocolors.default.red(`Failed: ${result.error}`));
7769
+ console.error(import_picocolors2.default.red(`Failed: ${result.error}`));
7509
7770
  process.exit(1);
7510
7771
  }
7511
7772
  const action = result.isNewFile ? "Created" : "Updated";
7512
7773
  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`);
7774
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
7775
+ console.log(`${import_picocolors2.default.green("✓")} Indexed ${import_picocolors2.default.bold(result.skillCount.toString())} skills`);
7515
7776
  if (result.sourceBreakdown) {
7516
7777
  const breakdown = [];
7517
7778
  if (result.sourceBreakdown.plugin > 0) {
@@ -7523,7 +7784,7 @@ Discovering skills from ${import_picocolors.default.cyan(sources.length.toString
7523
7784
  if (result.sourceBreakdown.project > 0) {
7524
7785
  breakdown.push(`${result.sourceBreakdown.project} project`);
7525
7786
  }
7526
- console.log(import_picocolors.default.gray(` (${breakdown.join(", ")})`));
7787
+ console.log(import_picocolors2.default.gray(` (${breakdown.join(", ")})`));
7527
7788
  }
7528
7789
  console.log("");
7529
7790
  }
@@ -7537,12 +7798,12 @@ function runSkillsList(options) {
7537
7798
  });
7538
7799
  const skills = collectAllSkills(sources);
7539
7800
  if (skills.length === 0) {
7540
- console.log(import_picocolors.default.yellow(`
7801
+ console.log(import_picocolors2.default.yellow(`
7541
7802
  No skills found in any of the specified sources.
7542
7803
  `));
7543
7804
  return;
7544
7805
  }
7545
- console.log(import_picocolors.default.cyan(`
7806
+ console.log(import_picocolors2.default.cyan(`
7546
7807
  Discovered ${skills.length} skills:
7547
7808
  `));
7548
7809
  const grouped = new Map;
@@ -7553,11 +7814,11 @@ Discovered ${skills.length} skills:
7553
7814
  grouped.set(key, existing);
7554
7815
  }
7555
7816
  for (const [source, sourceSkills] of grouped) {
7556
- console.log(import_picocolors.default.bold(` ${source}:`));
7817
+ console.log(import_picocolors2.default.bold(` ${source}:`));
7557
7818
  for (const skill of sourceSkills) {
7558
- console.log(` ${import_picocolors.default.green("•")} ${import_picocolors.default.bold(skill.name)} - ${skill.description}`);
7819
+ console.log(` ${import_picocolors2.default.green("•")} ${import_picocolors2.default.bold(skill.name)} - ${skill.description}`);
7559
7820
  if (skill.siblingFiles.length > 0) {
7560
- console.log(import_picocolors.default.gray(` Files: ${skill.siblingFiles.join(", ")}`));
7821
+ console.log(import_picocolors2.default.gray(` Files: ${skill.siblingFiles.join(", ")}`));
7561
7822
  }
7562
7823
  }
7563
7824
  console.log("");
@@ -7567,7 +7828,7 @@ async function runSkillsLocal(skillsPath, options) {
7567
7828
  const cwd = process.cwd();
7568
7829
  const absolutePath = path.isAbsolute(skillsPath) ? skillsPath : path.join(cwd, skillsPath);
7569
7830
  if (!fs.existsSync(absolutePath)) {
7570
- console.error(import_picocolors.default.red(`Skills directory not found: ${skillsPath}`));
7831
+ console.error(import_picocolors2.default.red(`Skills directory not found: ${skillsPath}`));
7571
7832
  process.exit(1);
7572
7833
  }
7573
7834
  const output = options.output || getDefaultOutput();
@@ -7579,19 +7840,96 @@ async function runSkillsLocal(skillsPath, options) {
7579
7840
  label
7580
7841
  }];
7581
7842
  console.log(`
7582
- Discovering skills from ${import_picocolors.default.cyan(skillsPath)}...`);
7843
+ Discovering skills from ${import_picocolors2.default.cyan(skillsPath)}...`);
7583
7844
  const result = await embedSkills({ cwd, sources, output });
7584
7845
  if (!result.success) {
7585
- console.error(import_picocolors.default.red(`Failed: ${result.error}`));
7846
+ console.error(import_picocolors2.default.red(`Failed: ${result.error}`));
7586
7847
  process.exit(1);
7587
7848
  }
7588
7849
  const action = result.isNewFile ? "Created" : "Updated";
7589
7850
  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`);
7851
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(result.targetFile)} (${sizeInfo})`);
7852
+ console.log(`${import_picocolors2.default.green("✓")} Indexed ${import_picocolors2.default.bold(result.skillCount.toString())} skills`);
7592
7853
  console.log("");
7593
7854
  }
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);
7855
+ async function runSkillsFind(query, options) {
7856
+ const limit = options.limit || 20;
7857
+ if (query) {
7858
+ console.log(`
7859
+ Searching skills.sh for ${import_picocolors2.default.cyan(query)}...`);
7860
+ try {
7861
+ const results = await fetchSkillsShSearch(query, limit);
7862
+ if (results.length === 0) {
7863
+ console.log(import_picocolors2.default.yellow(`
7864
+ No skills found matching "${query}".
7865
+ `));
7866
+ return;
7867
+ }
7868
+ console.log(import_picocolors2.default.cyan(`
7869
+ Found ${results.length} skills:
7870
+ `));
7871
+ const maxNameLen = Math.max(...results.map((r) => r.name.length));
7872
+ for (const result of results) {
7873
+ const name = import_picocolors2.default.bold(result.name.padEnd(maxNameLen));
7874
+ const source = import_picocolors2.default.gray(result.source);
7875
+ const installs = import_picocolors2.default.green(`${result.installs.toLocaleString()} installs`);
7876
+ console.log(` ${name} ${source} ${installs}`);
7877
+ }
7878
+ console.log("");
7879
+ console.log(import_picocolors2.default.gray(` To embed: agdex skills embed --repo <owner/repo>`));
7880
+ console.log("");
7881
+ } catch (error) {
7882
+ const msg = error instanceof Error ? error.message : String(error);
7883
+ console.error(import_picocolors2.default.red(`Failed to search skills.sh: ${msg}`));
7884
+ process.exit(1);
7885
+ }
7886
+ return;
7887
+ }
7888
+ console.log(import_picocolors2.default.cyan(`
7889
+ agdex - Search skills.sh
7890
+ `));
7891
+ console.log(import_picocolors2.default.gray(` Search the skills.sh ecosystem for agent skills.
7892
+ `));
7893
+ const searchResponse = await import_prompts.default({
7894
+ type: "text",
7895
+ name: "query",
7896
+ message: "Search skills",
7897
+ validate: (v) => v.trim() ? true : "Please enter a search query"
7898
+ }, { onCancel });
7899
+ console.log(`
7900
+ ${import_picocolors2.default.gray("Searching...")}`);
7901
+ try {
7902
+ const results = await fetchSkillsShSearch(searchResponse.query, limit);
7903
+ if (results.length === 0) {
7904
+ console.log(import_picocolors2.default.yellow(`
7905
+ No skills found matching "${searchResponse.query}".
7906
+ `));
7907
+ return;
7908
+ }
7909
+ const choices = results.map((r) => ({
7910
+ title: `${r.name} ${import_picocolors2.default.gray(`(${r.source})`)} ${import_picocolors2.default.green(`${r.installs.toLocaleString()}`)}`,
7911
+ value: r
7912
+ }));
7913
+ const selectResponse = await import_prompts.default({
7914
+ type: "select",
7915
+ name: "skill",
7916
+ message: "Select a skill to embed",
7917
+ choices
7918
+ }, { onCancel });
7919
+ const selected = selectResponse.skill;
7920
+ const repoName = selected.source;
7921
+ console.log(`
7922
+ Selected ${import_picocolors2.default.bold(selected.name)} from ${import_picocolors2.default.cyan(repoName)}`);
7923
+ const output = options.output || await promptForOutputFile();
7924
+ await runSkillsEmbed({ repo: repoName, output });
7925
+ } catch (error) {
7926
+ const msg = error instanceof Error ? error.message : String(error);
7927
+ console.error(import_picocolors2.default.red(`Failed to search skills.sh: ${msg}`));
7928
+ process.exit(1);
7929
+ }
7930
+ }
7931
+ 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
7932
  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
7933
  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);
7934
+ 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
7935
  program2.parse();