agdex 0.5.0 → 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 +96 -16
- package/dist/{index-g5x6jpyb.js → index-1v32v5tn.js} +82 -30
- package/dist/{index-pfdh6eyh.js → index-cm3qmz9v.js} +146 -31
- package/dist/index-dtcewfnz.js +22431 -0
- package/dist/index-sh9kr6eq.js +22433 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/lib/agents-md.d.ts +2 -1
- package/dist/lib/agents-md.d.ts.map +1 -1
- package/dist/lib/providers/generic.d.ts +2 -0
- package/dist/lib/providers/generic.d.ts.map +1 -1
- package/dist/lib/providers/index.d.ts +2 -0
- package/dist/lib/providers/index.d.ts.map +1 -1
- package/dist/lib/providers/nextjs.d.ts.map +1 -1
- package/dist/lib/providers/tensorrt.d.ts +9 -0
- package/dist/lib/providers/tensorrt.d.ts.map +1 -0
- package/dist/lib/types.d.ts +25 -2
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/url-scraper.d.ts +19 -0
- package/dist/lib/url-scraper.d.ts.map +1 -0
- package/dist/url-scraper-5sj8c56t.js +8 -0
- package/dist/url-scraper-9xq4d56t.js +8 -0
- package/package.json +6 -3
- package/dist/index-974mhezm.js +0 -2224
- package/dist/index-nn4xptha.js +0 -2127
- package/dist/index-vf9nfyjb.js +0 -2180
- package/dist/index-wsqyam11.js +0 -2136
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -7099,16 +7101,27 @@ async function runEmbed(options) {
|
|
|
7099
7101
|
}
|
|
7100
7102
|
async function executeEmbed(cwd, provider, version, output, globalCache, description) {
|
|
7101
7103
|
let resolvedVersion = version;
|
|
7102
|
-
|
|
7104
|
+
let usingDefaultBranch = false;
|
|
7105
|
+
if (!resolvedVersion && provider.urlConfig) {
|
|
7106
|
+
resolvedVersion = "latest";
|
|
7107
|
+
usingDefaultBranch = true;
|
|
7108
|
+
} else if (!resolvedVersion && provider.detectVersion) {
|
|
7103
7109
|
const detected = provider.detectVersion(cwd);
|
|
7104
7110
|
if (!detected.version) {
|
|
7105
|
-
|
|
7106
|
-
|
|
7111
|
+
const fallbackBranch = provider.defaultBranch || "main";
|
|
7112
|
+
console.log(import_picocolors2.default.yellow(`
|
|
7113
|
+
⚠ ${detected.error || `Could not detect ${provider.displayName} version`}`));
|
|
7114
|
+
console.log(import_picocolors2.default.yellow(` Using latest documentation from '${fallbackBranch}' branch.
|
|
7115
|
+
`));
|
|
7116
|
+
resolvedVersion = fallbackBranch;
|
|
7117
|
+
usingDefaultBranch = true;
|
|
7118
|
+
} else {
|
|
7119
|
+
resolvedVersion = detected.version;
|
|
7107
7120
|
}
|
|
7108
|
-
resolvedVersion = detected.version;
|
|
7109
7121
|
}
|
|
7122
|
+
const versionLabel = usingDefaultBranch ? "latest" : resolvedVersion;
|
|
7110
7123
|
console.log(`
|
|
7111
|
-
Embedding ${import_picocolors2.default.cyan(provider.displayName)} ${import_picocolors2.default.cyan(
|
|
7124
|
+
Embedding ${import_picocolors2.default.cyan(provider.displayName)} ${import_picocolors2.default.cyan(versionLabel)} documentation...`);
|
|
7112
7125
|
const result = await embed({
|
|
7113
7126
|
cwd,
|
|
7114
7127
|
provider,
|
|
@@ -7547,6 +7560,68 @@ Building index from ${import_picocolors2.default.cyan(docsPath)}...`);
|
|
|
7547
7560
|
console.log(`${import_picocolors2.default.green("✓")} ${action} ${import_picocolors2.default.bold(output)} (${sizeInfo})`);
|
|
7548
7561
|
console.log("");
|
|
7549
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
|
+
}
|
|
7550
7625
|
function runList() {
|
|
7551
7626
|
console.log(import_picocolors2.default.cyan(`
|
|
7552
7627
|
\uD83D\uDCDA Built-in Documentation Providers
|
|
@@ -7555,8 +7630,8 @@ function runList() {
|
|
|
7555
7630
|
const provider = getProvider(preset);
|
|
7556
7631
|
const status = provider ? import_picocolors2.default.green("✓") : import_picocolors2.default.gray("○");
|
|
7557
7632
|
const name = provider?.displayName || preset;
|
|
7558
|
-
const
|
|
7559
|
-
console.log(` ${status} ${import_picocolors2.default.bold(preset)} - ${name} (${import_picocolors2.default.gray(
|
|
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)})`);
|
|
7560
7635
|
}
|
|
7561
7636
|
console.log("");
|
|
7562
7637
|
console.log(import_picocolors2.default.cyan(`\uD83D\uDCE6 Usage Examples
|
|
@@ -7571,6 +7646,9 @@ function runList() {
|
|
|
7571
7646
|
console.log(` ${import_picocolors2.default.white("agdex")} ${import_picocolors2.default.gray("(interactive)")}`);
|
|
7572
7647
|
console.log(` ${import_picocolors2.default.gray("→ then enter:")} ${import_picocolors2.default.white("https://github.com/anthropics/skills/tree/main/skills")}`);
|
|
7573
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("");
|
|
7574
7652
|
console.log(import_picocolors2.default.gray(" Local documentation:"));
|
|
7575
7653
|
console.log(` ${import_picocolors2.default.white('agdex local ./my-docs --name "My Docs"')}`);
|
|
7576
7654
|
console.log("");
|
|
@@ -7583,14 +7661,16 @@ function runList() {
|
|
|
7583
7661
|
program2.name("agdex").description(`Create compressed documentation indexes for AI coding agents.
|
|
7584
7662
|
|
|
7585
7663
|
Sources you can index:
|
|
7586
|
-
• Built-in providers (Next.js, React, Bun, Pixi, Tauri, etc.)
|
|
7664
|
+
• Built-in providers (Next.js, React, Bun, Pixi, Tauri, TensorRT, etc.)
|
|
7587
7665
|
• Any GitHub repository URL or owner/repo
|
|
7666
|
+
• Any documentation website URL
|
|
7588
7667
|
• Local documentation directories
|
|
7589
7668
|
• Claude Code skills
|
|
7590
7669
|
|
|
7591
7670
|
Run 'agdex' without arguments for interactive mode.`).version("0.4.2");
|
|
7592
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);
|
|
7593
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);
|
|
7594
7674
|
program2.command("list").description("List available documentation providers").action(runList);
|
|
7595
7675
|
async function runRemove(options) {
|
|
7596
7676
|
const cwd = process.cwd();
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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) {
|
|
@@ -40,17 +29,12 @@ async function pullDocs(provider, options) {
|
|
|
40
29
|
} else if (provider.detectVersion) {
|
|
41
30
|
const versionResult = provider.detectVersion(cwd);
|
|
42
31
|
if (!versionResult.version) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
32
|
+
version = provider.defaultBranch || "main";
|
|
33
|
+
} else {
|
|
34
|
+
version = versionResult.version;
|
|
47
35
|
}
|
|
48
|
-
version = versionResult.version;
|
|
49
36
|
} else {
|
|
50
|
-
|
|
51
|
-
success: false,
|
|
52
|
-
error: `No version provided and ${provider.displayName} does not support auto-detection`
|
|
53
|
-
};
|
|
37
|
+
version = provider.defaultBranch || "main";
|
|
54
38
|
}
|
|
55
39
|
const docsPath = docsDir ?? fs.mkdtempSync(path.join(os.tmpdir(), "agdex-"));
|
|
56
40
|
const useTempDir = !docsDir;
|
|
@@ -630,6 +614,7 @@ var nextjsProvider = {
|
|
|
630
614
|
docsPath: "docs",
|
|
631
615
|
extensions: [".mdx", ".md"],
|
|
632
616
|
detectVersion,
|
|
617
|
+
defaultBranch: "canary",
|
|
633
618
|
versionToTag: (version) => version.startsWith("v") ? version : `v${version}`,
|
|
634
619
|
excludePatterns: ["**/index.mdx", "**/index.md"],
|
|
635
620
|
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Next.js tasks."
|
|
@@ -1621,6 +1606,69 @@ var manimProvider = {
|
|
|
1621
1606
|
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Manim tasks. Manim is a Python library for mathematical animations."
|
|
1622
1607
|
};
|
|
1623
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
|
+
|
|
1624
1672
|
// src/lib/providers/generic.ts
|
|
1625
1673
|
import fs19 from "fs";
|
|
1626
1674
|
import path19 from "path";
|
|
@@ -1632,6 +1680,7 @@ function createProvider(options) {
|
|
|
1632
1680
|
docsPath,
|
|
1633
1681
|
extensions = [".mdx", ".md"],
|
|
1634
1682
|
packageName,
|
|
1683
|
+
defaultBranch,
|
|
1635
1684
|
versionToTag = (v) => {
|
|
1636
1685
|
if (v.startsWith("v") || /^\d/.test(v)) {
|
|
1637
1686
|
return v.startsWith("v") ? v : `v${v}`;
|
|
@@ -1676,6 +1725,7 @@ function createProvider(options) {
|
|
|
1676
1725
|
docsPath,
|
|
1677
1726
|
extensions,
|
|
1678
1727
|
detectVersion: detectVersion20,
|
|
1728
|
+
defaultBranch,
|
|
1679
1729
|
versionToTag,
|
|
1680
1730
|
excludePatterns,
|
|
1681
1731
|
instruction: instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${displayName} tasks.`
|
|
@@ -1838,6 +1888,8 @@ function getProvider(preset) {
|
|
|
1838
1888
|
return manimProvider;
|
|
1839
1889
|
case "cuda-feedstock":
|
|
1840
1890
|
return cudaFeedstockProvider;
|
|
1891
|
+
case "tensorrt":
|
|
1892
|
+
return tensorrtProvider;
|
|
1841
1893
|
case "vue":
|
|
1842
1894
|
case "astro":
|
|
1843
1895
|
return null;
|
|
@@ -1846,7 +1898,7 @@ function getProvider(preset) {
|
|
|
1846
1898
|
}
|
|
1847
1899
|
}
|
|
1848
1900
|
function listProviders() {
|
|
1849
|
-
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"];
|
|
1850
1902
|
}
|
|
1851
1903
|
function isProviderAvailable(preset) {
|
|
1852
1904
|
return getProvider(preset) !== null;
|
|
@@ -2301,4 +2353,4 @@ function getDefaultOutput(cwd = process.cwd()) {
|
|
|
2301
2353
|
return config.output || "AGENTS.md";
|
|
2302
2354
|
}
|
|
2303
2355
|
|
|
2304
|
-
export {
|
|
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 };
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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-dtcewfnz.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-5sj8c56t.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) {
|
|
@@ -40,17 +29,12 @@ async function pullDocs(provider, options) {
|
|
|
40
29
|
} else if (provider.detectVersion) {
|
|
41
30
|
const versionResult = provider.detectVersion(cwd);
|
|
42
31
|
if (!versionResult.version) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
32
|
+
version = provider.defaultBranch || "main";
|
|
33
|
+
} else {
|
|
34
|
+
version = versionResult.version;
|
|
47
35
|
}
|
|
48
|
-
version = versionResult.version;
|
|
49
36
|
} else {
|
|
50
|
-
|
|
51
|
-
success: false,
|
|
52
|
-
error: `No version provided and ${provider.displayName} does not support auto-detection`
|
|
53
|
-
};
|
|
37
|
+
version = provider.defaultBranch || "main";
|
|
54
38
|
}
|
|
55
39
|
const docsPath = docsDir ?? fs.mkdtempSync(path.join(os.tmpdir(), "agdex-"));
|
|
56
40
|
const useTempDir = !docsDir;
|
|
@@ -630,6 +614,7 @@ var nextjsProvider = {
|
|
|
630
614
|
docsPath: "docs",
|
|
631
615
|
extensions: [".mdx", ".md"],
|
|
632
616
|
detectVersion,
|
|
617
|
+
defaultBranch: "canary",
|
|
633
618
|
versionToTag: (version) => version.startsWith("v") ? version : `v${version}`,
|
|
634
619
|
excludePatterns: ["**/index.mdx", "**/index.md"],
|
|
635
620
|
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Next.js tasks."
|
|
@@ -1621,6 +1606,69 @@ var manimProvider = {
|
|
|
1621
1606
|
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Manim tasks. Manim is a Python library for mathematical animations."
|
|
1622
1607
|
};
|
|
1623
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
|
+
|
|
1624
1672
|
// src/lib/providers/generic.ts
|
|
1625
1673
|
import fs19 from "fs";
|
|
1626
1674
|
import path19 from "path";
|
|
@@ -1632,6 +1680,7 @@ function createProvider(options) {
|
|
|
1632
1680
|
docsPath,
|
|
1633
1681
|
extensions = [".mdx", ".md"],
|
|
1634
1682
|
packageName,
|
|
1683
|
+
defaultBranch,
|
|
1635
1684
|
versionToTag = (v) => {
|
|
1636
1685
|
if (v.startsWith("v") || /^\d/.test(v)) {
|
|
1637
1686
|
return v.startsWith("v") ? v : `v${v}`;
|
|
@@ -1676,6 +1725,7 @@ function createProvider(options) {
|
|
|
1676
1725
|
docsPath,
|
|
1677
1726
|
extensions,
|
|
1678
1727
|
detectVersion: detectVersion20,
|
|
1728
|
+
defaultBranch,
|
|
1679
1729
|
versionToTag,
|
|
1680
1730
|
excludePatterns,
|
|
1681
1731
|
instruction: instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${displayName} tasks.`
|
|
@@ -1838,6 +1888,8 @@ function getProvider(preset) {
|
|
|
1838
1888
|
return manimProvider;
|
|
1839
1889
|
case "cuda-feedstock":
|
|
1840
1890
|
return cudaFeedstockProvider;
|
|
1891
|
+
case "tensorrt":
|
|
1892
|
+
return tensorrtProvider;
|
|
1841
1893
|
case "vue":
|
|
1842
1894
|
case "astro":
|
|
1843
1895
|
return null;
|
|
@@ -1846,7 +1898,7 @@ function getProvider(preset) {
|
|
|
1846
1898
|
}
|
|
1847
1899
|
}
|
|
1848
1900
|
function listProviders() {
|
|
1849
|
-
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"];
|
|
1850
1902
|
}
|
|
1851
1903
|
function isProviderAvailable(preset) {
|
|
1852
1904
|
return getProvider(preset) !== null;
|
|
@@ -1858,6 +1910,16 @@ import path22 from "path";
|
|
|
1858
1910
|
import os2 from "os";
|
|
1859
1911
|
var SKILLS_START_MARKER = "<!-- AGENTS-MD-SKILLS-START -->";
|
|
1860
1912
|
var SKILLS_END_MARKER = "<!-- AGENTS-MD-SKILLS-END -->";
|
|
1913
|
+
var SKILLS_SH_API_BASE = "https://skills.sh";
|
|
1914
|
+
async function fetchSkillsShSearch(query, limit = 20) {
|
|
1915
|
+
const url = `${SKILLS_SH_API_BASE}/api/search?q=${encodeURIComponent(query)}&limit=${limit}`;
|
|
1916
|
+
const response = await fetch(url);
|
|
1917
|
+
if (!response.ok) {
|
|
1918
|
+
throw new Error(`skills.sh API returned ${response.status}`);
|
|
1919
|
+
}
|
|
1920
|
+
const data = await response.json();
|
|
1921
|
+
return data.skills;
|
|
1922
|
+
}
|
|
1861
1923
|
function parseEnabledPlugins(settingsPath) {
|
|
1862
1924
|
if (!fs22.existsSync(settingsPath))
|
|
1863
1925
|
return [];
|
|
@@ -2030,6 +2092,49 @@ function discoverFlatSkills(skillsPath, source, label) {
|
|
|
2030
2092
|
}
|
|
2031
2093
|
return skills;
|
|
2032
2094
|
}
|
|
2095
|
+
function discoverSkillsShRepo(repoDir, repoName) {
|
|
2096
|
+
const skills = [];
|
|
2097
|
+
const seen = new Set;
|
|
2098
|
+
const searchDirs = [
|
|
2099
|
+
"skills",
|
|
2100
|
+
".claude/skills",
|
|
2101
|
+
".agents/skills",
|
|
2102
|
+
"skills/.curated",
|
|
2103
|
+
"skills/.experimental"
|
|
2104
|
+
];
|
|
2105
|
+
const rootSkillMd = path22.join(repoDir, "SKILL.md");
|
|
2106
|
+
if (fs22.existsSync(rootSkillMd)) {
|
|
2107
|
+
try {
|
|
2108
|
+
const content = fs22.readFileSync(rootSkillMd, "utf-8");
|
|
2109
|
+
const frontmatter = parseSkillFrontmatter(content);
|
|
2110
|
+
if (frontmatter) {
|
|
2111
|
+
seen.add(frontmatter.name);
|
|
2112
|
+
skills.push({
|
|
2113
|
+
name: frontmatter.name,
|
|
2114
|
+
description: frontmatter.description,
|
|
2115
|
+
skillMdPath: rootSkillMd,
|
|
2116
|
+
siblingFiles: getSiblingFiles(rootSkillMd),
|
|
2117
|
+
source: "skills-sh",
|
|
2118
|
+
pluginName: repoName
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
} catch {}
|
|
2122
|
+
}
|
|
2123
|
+
for (const dir of searchDirs) {
|
|
2124
|
+
const fullDir = path22.join(repoDir, dir);
|
|
2125
|
+
if (!fs22.existsSync(fullDir))
|
|
2126
|
+
continue;
|
|
2127
|
+
const discovered = discoverFlatSkills(fullDir, "skills-sh", repoName);
|
|
2128
|
+
for (const skill of discovered) {
|
|
2129
|
+
if (!seen.has(skill.name)) {
|
|
2130
|
+
seen.add(skill.name);
|
|
2131
|
+
skill.pluginName = repoName;
|
|
2132
|
+
skills.push(skill);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
return skills;
|
|
2137
|
+
}
|
|
2033
2138
|
function collectAllSkills(sources) {
|
|
2034
2139
|
const allSkills = [];
|
|
2035
2140
|
for (const source of sources) {
|
|
@@ -2053,6 +2158,7 @@ function collectAllSkills(sources) {
|
|
|
2053
2158
|
function generateSkillsIndex(skills, options = {}) {
|
|
2054
2159
|
const parts = ["[Skills Index]"];
|
|
2055
2160
|
const pluginSkills = new Map;
|
|
2161
|
+
const skillsShSkills = new Map;
|
|
2056
2162
|
const userSkills = [];
|
|
2057
2163
|
const projectSkills = [];
|
|
2058
2164
|
for (const skill of skills) {
|
|
@@ -2060,6 +2166,10 @@ function generateSkillsIndex(skills, options = {}) {
|
|
|
2060
2166
|
const existing = pluginSkills.get(skill.pluginName) || [];
|
|
2061
2167
|
existing.push(skill);
|
|
2062
2168
|
pluginSkills.set(skill.pluginName, existing);
|
|
2169
|
+
} else if (skill.source === "skills-sh" && skill.pluginName) {
|
|
2170
|
+
const existing = skillsShSkills.get(skill.pluginName) || [];
|
|
2171
|
+
existing.push(skill);
|
|
2172
|
+
skillsShSkills.set(skill.pluginName, existing);
|
|
2063
2173
|
} else if (skill.source === "user") {
|
|
2064
2174
|
userSkills.push(skill);
|
|
2065
2175
|
} else if (skill.source === "project") {
|
|
@@ -2070,6 +2180,10 @@ function generateSkillsIndex(skills, options = {}) {
|
|
|
2070
2180
|
const skillParts = entries.map((s) => formatSkillEntry(s)).join(";");
|
|
2071
2181
|
parts.push(`plugin:${pluginName}:{${skillParts}}`);
|
|
2072
2182
|
}
|
|
2183
|
+
for (const [repoName, entries] of skillsShSkills) {
|
|
2184
|
+
const skillParts = entries.map((s) => formatSkillEntry(s)).join(";");
|
|
2185
|
+
parts.push(`skills-sh:${repoName}:{${skillParts}}`);
|
|
2186
|
+
}
|
|
2073
2187
|
if (userSkills.length > 0) {
|
|
2074
2188
|
const skillParts = userSkills.map((s) => formatSkillEntry(s)).join(";");
|
|
2075
2189
|
parts.push(`user:{${skillParts}}`);
|
|
@@ -2184,7 +2298,8 @@ async function embedSkills(options) {
|
|
|
2184
2298
|
const sourceBreakdown = {
|
|
2185
2299
|
plugin: 0,
|
|
2186
2300
|
user: 0,
|
|
2187
|
-
project: 0
|
|
2301
|
+
project: 0,
|
|
2302
|
+
"skills-sh": 0
|
|
2188
2303
|
};
|
|
2189
2304
|
for (const skill of skills) {
|
|
2190
2305
|
sourceBreakdown[skill.source]++;
|
|
@@ -2238,4 +2353,4 @@ function getDefaultOutput(cwd = process.cwd()) {
|
|
|
2238
2353
|
return config.output || "AGENTS.md";
|
|
2239
2354
|
}
|
|
2240
2355
|
|
|
2241
|
-
export {
|
|
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 };
|