agdex 0.5.1 → 0.6.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.
package/dist/cli/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- __commonJS,
4
- __require,
5
- __toESM,
6
3
  basedpyrightProvider,
7
4
  buildDocTree,
8
5
  bunProvider,
@@ -42,7 +39,12 @@ import {
42
39
  tailwindProvider,
43
40
  tauriProvider,
44
41
  tyProvider
45
- } from "../index-thmt54kg.js";
42
+ } from "../index-cm3qmz9v.js";
43
+ import {
44
+ __commonJS,
45
+ __require,
46
+ __toESM
47
+ } from "../index-dtcewfnz.js";
46
48
 
47
49
  // node_modules/commander/lib/error.js
48
50
  var require_error = __commonJS((exports) => {
@@ -2107,7 +2109,7 @@ var require_clear = __commonJS((exports, module) => {
2107
2109
  if (it)
2108
2110
  o = it;
2109
2111
  var i = 0;
2110
- var F = function F() {};
2112
+ var F = function F2() {};
2111
2113
  return { s: F, n: function n() {
2112
2114
  if (i >= o.length)
2113
2115
  return { done: true };
@@ -4439,7 +4441,7 @@ var require_dist = __commonJS((exports, module) => {
4439
4441
  if (it)
4440
4442
  o = it;
4441
4443
  var i = 0;
4442
- var F = function F() {};
4444
+ var F = function F2() {};
4443
4445
  return { s: F, n: function n() {
4444
4446
  if (i >= o.length)
4445
4447
  return { done: true };
@@ -4542,7 +4544,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4542
4544
  }
4543
4545
  return question2.format ? yield question2.format(answer2, answers) : answer2;
4544
4546
  });
4545
- return function getFormattedAnswer(_x, _x2) {
4547
+ return function getFormattedAnswer2(_x, _x2) {
4546
4548
  return _ref.apply(this, arguments);
4547
4549
  };
4548
4550
  }();
@@ -7090,7 +7092,7 @@ async function runEmbed(options) {
7090
7092
  return;
7091
7093
  }
7092
7094
  output = options.output || getDefaultOutput();
7093
- if (!version && !provider.detectVersion) {
7095
+ if (!version && !provider.detectVersion && !provider.urlConfig) {
7094
7096
  console.error(import_picocolors2.default.red(`Provider ${provider.displayName} requires --version flag since auto-detection is not supported.`));
7095
7097
  process.exit(1);
7096
7098
  }
@@ -7100,7 +7102,10 @@ async function runEmbed(options) {
7100
7102
  async function executeEmbed(cwd, provider, version, output, globalCache, description) {
7101
7103
  let resolvedVersion = version;
7102
7104
  let usingDefaultBranch = false;
7103
- if (!resolvedVersion && provider.detectVersion) {
7105
+ if (!resolvedVersion && provider.urlConfig) {
7106
+ resolvedVersion = "latest";
7107
+ usingDefaultBranch = true;
7108
+ } else if (!resolvedVersion && provider.detectVersion) {
7104
7109
  const detected = provider.detectVersion(cwd);
7105
7110
  if (!detected.version) {
7106
7111
  const fallbackBranch = provider.defaultBranch || "main";
@@ -7555,6 +7560,68 @@ Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
7555
7560
  console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(output)} (${sizeInfo})`);
7556
7561
  console.log("");
7557
7562
  }
7563
+ async function runUrl(url, options) {
7564
+ const cwd = process.cwd();
7565
+ const { createUrlProvider } = await import("../url-scraper-5sj8c56t.js");
7566
+ const { pullDocsFromUrl } = await import("../url-scraper-5sj8c56t.js");
7567
+ const name = options.name || new URL(url).hostname.replace(/^docs\./, "").replace(/\.\w+$/, "");
7568
+ const providerName = name.toLowerCase().replace(/\s+/g, "-");
7569
+ const output = options.output || getDefaultOutput();
7570
+ const cacheBase = path.join(os.homedir(), ".cache", "agdex");
7571
+ const docsPath = path.join(cacheBase, providerName);
7572
+ console.log(`
7573
+ Scraping documentation from ${import_picocolors2.default.cyan(url)}...`);
7574
+ const cacheHit = fs.existsSync(docsPath) && fs.readdirSync(docsPath).length > 0;
7575
+ if (cacheHit) {
7576
+ console.log(`${import_picocolors2.default.green("✓")} Using cached docs from ${import_picocolors2.default.bold(docsPath)}`);
7577
+ } else {
7578
+ const urlConfig = {
7579
+ baseUrl: url,
7580
+ contentSelector: options.selector || "main#main-content, main, article, .body",
7581
+ removeSelectors: [],
7582
+ concurrency: options.concurrency ? parseInt(options.concurrency, 10) : 5,
7583
+ fetchDelay: options.delay ? parseInt(options.delay, 10) : 200
7584
+ };
7585
+ const pullResult = await pullDocsFromUrl(urlConfig, docsPath, {
7586
+ onProgress: (current, total, page) => {
7587
+ process.stdout.write(`\r Fetching pages... ${current}/${total} (${page})`);
7588
+ }
7589
+ });
7590
+ if (!pullResult.success) {
7591
+ console.error(import_picocolors2.default.red(`
7592
+ Failed: ${pullResult.error}`));
7593
+ process.exit(1);
7594
+ }
7595
+ console.log(`
7596
+ ${import_picocolors2.default.green("✓")} Downloaded docs to ${import_picocolors2.default.bold(docsPath)}`);
7597
+ }
7598
+ const targetPath = path.join(cwd, output);
7599
+ let existingContent = "";
7600
+ let sizeBefore = 0;
7601
+ let isNewFile = true;
7602
+ if (fs.existsSync(targetPath)) {
7603
+ existingContent = fs.readFileSync(targetPath, "utf-8");
7604
+ sizeBefore = Buffer.byteLength(existingContent, "utf-8");
7605
+ isNewFile = false;
7606
+ }
7607
+ const docFiles = collectDocFiles(docsPath, { extensions: [".md"] });
7608
+ const sections = buildDocTree(docFiles);
7609
+ const indexContent = generateIndex({
7610
+ docsPath,
7611
+ sections,
7612
+ outputFile: output,
7613
+ providerName: name,
7614
+ instruction: `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${name} tasks.`,
7615
+ regenerateCommand: `npx agdex url "${url}" --name "${name}" --output ${output}`
7616
+ });
7617
+ const newContent = injectIndex(existingContent, indexContent, providerName);
7618
+ fs.writeFileSync(targetPath, newContent, "utf-8");
7619
+ const sizeAfter = Buffer.byteLength(newContent, "utf-8");
7620
+ const action = isNewFile ? "Created" : "Updated";
7621
+ const sizeInfo = isNewFile ? formatSize(sizeAfter) : `${formatSize(sizeBefore)} → ${formatSize(sizeAfter)}`;
7622
+ console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(output)} (${sizeInfo})`);
7623
+ console.log("");
7624
+ }
7558
7625
  function runList() {
7559
7626
  console.log(import_picocolors2.default.cyan(`
7560
7627
  \uD83D\uDCDA Built-in Documentation Providers
@@ -7563,8 +7630,8 @@ function runList() {
7563
7630
  const provider = getProvider(preset);
7564
7631
  const status = provider ? import_picocolors2.default.green("✓") : import_picocolors2.default.gray("○");
7565
7632
  const name = provider?.displayName || preset;
7566
- const repo = provider?.repo || "not implemented";
7567
- console.log(` ${status} ${import_picocolors2.default.bold(preset)} - ${name} (${import_picocolors2.default.gray(repo)})`);
7633
+ const source = provider?.urlConfig ? provider.urlConfig.baseUrl : provider?.repo || "not implemented";
7634
+ console.log(` ${status} ${import_picocolors2.default.bold(preset)} - ${name} (${import_picocolors2.default.gray(source)})`);
7568
7635
  }
7569
7636
  console.log("");
7570
7637
  console.log(import_picocolors2.default.cyan(`\uD83D\uDCE6 Usage Examples
@@ -7579,6 +7646,9 @@ function runList() {
7579
7646
  console.log(` ${import_picocolors2.default.white("agdex")} ${import_picocolors2.default.gray("(interactive)")}`);
7580
7647
  console.log(` ${import_picocolors2.default.gray("→ then enter:")} ${import_picocolors2.default.white("https://github.com/anthropics/skills/tree/main/skills")}`);
7581
7648
  console.log("");
7649
+ console.log(import_picocolors2.default.gray(" Website URL:"));
7650
+ console.log(` ${import_picocolors2.default.white('agdex url https://docs.example.com/latest/index.html --name "My Docs"')}`);
7651
+ console.log("");
7582
7652
  console.log(import_picocolors2.default.gray(" Local documentation:"));
7583
7653
  console.log(` ${import_picocolors2.default.white('agdex local ./my-docs --name "My Docs"')}`);
7584
7654
  console.log("");
@@ -7591,14 +7661,16 @@ function runList() {
7591
7661
  program2.name("agdex").description(`Create compressed documentation indexes for AI coding agents.
7592
7662
 
7593
7663
  Sources you can index:
7594
- • Built-in providers (Next.js, React, Bun, Pixi, Tauri, etc.)
7664
+ • Built-in providers (Next.js, React, Bun, Pixi, Tauri, TensorRT, etc.)
7595
7665
  • Any GitHub repository URL or owner/repo
7666
+ • Any documentation website URL
7596
7667
  • Local documentation directories
7597
7668
  • Claude Code skills
7598
7669
 
7599
7670
  Run 'agdex' without arguments for interactive mode.`).version("0.4.2");
7600
7671
  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);
7601
7672
  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);
7673
+ program2.command("url <url>").description("Scrape documentation from a website URL and build index").option("-n, --name <name>", "Display name for the documentation (default: derived from URL)").option("-o, --output <file>", "Target file (default: from config or CLAUDE.md)").option("-s, --selector <css>", "CSS selector for main content (default: main#main-content, main, article)").option("-c, --concurrency <n>", "Max concurrent fetches (default: 5)").option("--delay <ms>", "Delay between fetch batches in ms (default: 200)").action(runUrl);
7602
7674
  program2.command("list").description("List available documentation providers").action(runList);
7603
7675
  async function runRemove(options) {
7604
7676
  const cwd = process.cwd();
@@ -1,22 +1,6 @@
1
- import { createRequire } from "node:module";
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
1
+ import {
2
+ __require
3
+ } from "./index-sh9kr6eq.js";
20
4
 
21
5
  // src/lib/agents-md.ts
22
6
  import { execSync } from "child_process";
@@ -33,6 +17,11 @@ function getEndMarker(providerName) {
33
17
  return providerName ? `${END_MARKER_PREFIX}:${providerName}${MARKER_SUFFIX}` : `${END_MARKER_PREFIX}${MARKER_SUFFIX}`;
34
18
  }
35
19
  async function pullDocs(provider, options) {
20
+ if (provider.urlConfig) {
21
+ const { pullDocsFromUrl } = await import("./url-scraper-9xq4d56t.js");
22
+ const docsPath2 = options.docsDir ?? fs.mkdtempSync(path.join(os.tmpdir(), "agdex-"));
23
+ return pullDocsFromUrl(provider.urlConfig, docsPath2, { onProgress: options.onProgress });
24
+ }
36
25
  const { cwd, version: versionOverride, docsDir } = options;
37
26
  let version;
38
27
  if (versionOverride) {
@@ -1617,6 +1606,69 @@ var manimProvider = {
1617
1606
  instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Manim tasks. Manim is a Python library for mathematical animations."
1618
1607
  };
1619
1608
 
1609
+ // src/lib/providers/tensorrt.ts
1610
+ var tensorrtProvider = {
1611
+ name: "tensorrt",
1612
+ displayName: "NVIDIA TensorRT",
1613
+ repo: "",
1614
+ docsPath: "",
1615
+ extensions: [".md"],
1616
+ excludePatterns: [],
1617
+ defaultBranch: "latest",
1618
+ instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any NVIDIA TensorRT tasks. These docs cover TensorRT SDK for optimizing deep learning models for high-performance inference.",
1619
+ urlConfig: {
1620
+ baseUrl: "https://docs.nvidia.com/deeplearning/tensorrt/latest/index.html",
1621
+ contentSelector: "main#main-content, main, article, .body",
1622
+ removeSelectors: [
1623
+ ".headerlink",
1624
+ ".toctree-wrapper",
1625
+ ".breadcrumb",
1626
+ ".page-navigation",
1627
+ ".related-pages"
1628
+ ],
1629
+ pages: [
1630
+ "getting-started/release-notes.html",
1631
+ "getting-started/quick-start-guide.html",
1632
+ "getting-started/support-matrix.html",
1633
+ "installing-tensorrt/overview.html",
1634
+ "installing-tensorrt/prerequisites.html",
1635
+ "installing-tensorrt/installing.html",
1636
+ "installing-tensorrt/upgrading.html",
1637
+ "installing-tensorrt/uninstalling.html",
1638
+ "architecture/architecture-overview.html",
1639
+ "architecture/capabilities.html",
1640
+ "architecture/how-trt-works.html",
1641
+ "inference-library/c-api-docs.html",
1642
+ "inference-library/python-api-docs.html",
1643
+ "inference-library/sample-support-guide.html",
1644
+ "inference-library/advanced.html",
1645
+ "inference-library/work-quantized-types.html",
1646
+ "inference-library/accuracy-considerations.html",
1647
+ "inference-library/work-dynamic-shapes.html",
1648
+ "inference-library/extending-custom-layers.html",
1649
+ "inference-library/work-with-loops.html",
1650
+ "inference-library/work-with-conditionals.html",
1651
+ "inference-library/work-with-dla.html",
1652
+ "inference-library/capture-replay.html",
1653
+ "inference-library/work-with-transformers.html",
1654
+ "performance/best-practices.html",
1655
+ "api/c-api.html",
1656
+ "api/python-api.html",
1657
+ "api/migration-guide.html",
1658
+ "api/onnx-graphsurgeon-api.html",
1659
+ "api/polygraphy-api.html",
1660
+ "reference/troubleshooting.html",
1661
+ "reference/data-format-desc.html",
1662
+ "reference/command-line-programs.html",
1663
+ "reference/operators.html",
1664
+ "reference/additional-resources.html",
1665
+ "reference/glossary.html"
1666
+ ],
1667
+ concurrency: 3,
1668
+ fetchDelay: 300
1669
+ }
1670
+ };
1671
+
1620
1672
  // src/lib/providers/generic.ts
1621
1673
  import fs19 from "fs";
1622
1674
  import path19 from "path";
@@ -1836,6 +1888,8 @@ function getProvider(preset) {
1836
1888
  return manimProvider;
1837
1889
  case "cuda-feedstock":
1838
1890
  return cudaFeedstockProvider;
1891
+ case "tensorrt":
1892
+ return tensorrtProvider;
1839
1893
  case "vue":
1840
1894
  case "astro":
1841
1895
  return null;
@@ -1844,7 +1898,7 @@ function getProvider(preset) {
1844
1898
  }
1845
1899
  }
1846
1900
  function listProviders() {
1847
- return ["nextjs", "react", "pixi", "rattler-build", "tauri", "conda-forge", "bun", "vue", "svelte", "sveltekit", "shadcn-svelte", "astro", "tailwind", "ruff", "ty", "basedpyright", "convex", "polars", "delta-rs", "obsidian", "obsidian-excalidraw", "ffmpeg", "manim", "cuda-feedstock"];
1901
+ return ["nextjs", "react", "pixi", "rattler-build", "tauri", "conda-forge", "bun", "vue", "svelte", "sveltekit", "shadcn-svelte", "astro", "tailwind", "ruff", "ty", "basedpyright", "convex", "polars", "delta-rs", "obsidian", "obsidian-excalidraw", "ffmpeg", "manim", "cuda-feedstock", "tensorrt"];
1848
1902
  }
1849
1903
  function isProviderAvailable(preset) {
1850
1904
  return getProvider(preset) !== null;
@@ -2299,4 +2353,4 @@ function getDefaultOutput(cwd = process.cwd()) {
2299
2353
  return config.output || "AGENTS.md";
2300
2354
  }
2301
2355
 
2302
- export { __toESM, __commonJS, __require, pullDocs, collectDocFiles, buildDocTree, generateIndex, hasExistingIndex, getEmbeddedProviders, removeDocsIndex, injectIndex, ensureGitignoreEntry, getGlobalCacheDir, getLocalCacheDir, embed, nextjsProvider, reactProvider, pixiProvider, rattlerBuildProvider, tauriProvider, condaForgeProvider, bunProvider, svelteProvider, tailwindProvider, ruffProvider, tyProvider, basedpyrightProvider, convexProvider, polarsProvider, deltaRsProvider, obsidianProvider, obsidianExcalidrawProvider, ffmpegProvider, manimProvider, createProvider, createLocalProvider, getProvider, listProviders, isProviderAvailable, fetchSkillsShSearch, getEnabledPluginSources, parseSkillFrontmatter, discoverPluginSkills, discoverFlatSkills, discoverSkillsShRepo, collectAllSkills, generateSkillsIndex, hasExistingSkillsIndex, removeSkillsIndex, injectSkillsIndex, getDefaultSkillSources, embedSkills, loadConfig, getDefaultOutput };
2356
+ export { pullDocs, collectDocFiles, buildDocTree, generateIndex, hasExistingIndex, getEmbeddedProviders, removeDocsIndex, injectIndex, ensureGitignoreEntry, getGlobalCacheDir, getLocalCacheDir, embed, nextjsProvider, reactProvider, pixiProvider, rattlerBuildProvider, tauriProvider, condaForgeProvider, bunProvider, svelteProvider, tailwindProvider, ruffProvider, tyProvider, basedpyrightProvider, convexProvider, polarsProvider, deltaRsProvider, obsidianProvider, obsidianExcalidrawProvider, ffmpegProvider, manimProvider, tensorrtProvider, createProvider, createLocalProvider, getProvider, listProviders, isProviderAvailable, fetchSkillsShSearch, getEnabledPluginSources, parseSkillFrontmatter, discoverPluginSkills, discoverFlatSkills, discoverSkillsShRepo, collectAllSkills, generateSkillsIndex, hasExistingSkillsIndex, removeSkillsIndex, injectSkillsIndex, getDefaultSkillSources, embedSkills, loadConfig, getDefaultOutput };