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.
- package/README.md +42 -5
- package/dist/cli/configurable-select.d.ts +15 -0
- package/dist/cli/configurable-select.d.ts.map +1 -0
- package/dist/cli/index.js +444 -106
- package/dist/{index-9gy9s47s.js → index-974mhezm.js} +919 -61
- package/dist/index-g5x6jpyb.js +2304 -0
- package/dist/{index-pkx4s2ef.js → index-nn4xptha.js} +42 -15
- package/dist/index-pfdh6eyh.js +2241 -0
- package/dist/{index-4shp3mqh.js → index-vf9nfyjb.js} +369 -60
- package/dist/{index-zrmn6fd2.js → index-wsqyam11.js} +301 -68
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/agents-md.d.ts +5 -0
- package/dist/lib/agents-md.d.ts.map +1 -1
- package/dist/lib/providers/cuda-feedstock.d.ts +6 -0
- package/dist/lib/providers/cuda-feedstock.d.ts.map +1 -0
- package/dist/lib/providers/generic.d.ts.map +1 -1
- package/dist/lib/providers/index.d.ts +3 -0
- package/dist/lib/providers/index.d.ts.map +1 -1
- package/dist/lib/providers/shadcn-svelte.d.ts +3 -0
- package/dist/lib/providers/shadcn-svelte.d.ts.map +1 -0
- package/dist/lib/providers/sveltekit.d.ts +3 -0
- package/dist/lib/providers/sveltekit.d.ts.map +1 -0
- package/dist/lib/skills.d.ts +13 -2
- package/dist/lib/skills.d.ts.map +1 -1
- package/dist/lib/types.d.ts +18 -3
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-57bfejpe.js +0 -1357
- package/dist/index-5h59833k.js +0 -1270
- package/dist/index-6dj5che8.js +0 -859
- package/dist/index-6e18afd7.js +0 -1229
- package/dist/index-7adbtddf.js +0 -1123
- package/dist/index-cfpc7eqp.js +0 -1265
- package/dist/index-db6kreh4.js +0 -1188
- package/dist/index-exr11by8.js +0 -708
- package/dist/index-fxmpwsct.js +0 -779
- package/dist/index-gtzz9131.js +0 -708
- package/dist/index-hr5jh9yq.js +0 -712
- package/dist/index-k299aha0.js +0 -1229
- package/dist/index-ntpyfcve.js +0 -1154
- package/dist/index-p0xjkwcp.js +0 -1283
- package/dist/index-pry8ssn1.js +0 -636
- package/dist/index-wgnqr8g3.js +0 -882
- package/dist/index-y6zqcrbh.js +0 -788
|
@@ -58,7 +58,13 @@ async function pullDocs(provider, options) {
|
|
|
58
58
|
if (fs.existsSync(docsPath)) {
|
|
59
59
|
fs.rmSync(docsPath, { recursive: true });
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const defaultVersionToTag = (v) => {
|
|
62
|
+
if (v.startsWith("v") || /^\d/.test(v)) {
|
|
63
|
+
return v.startsWith("v") ? v : `v${v}`;
|
|
64
|
+
}
|
|
65
|
+
return v;
|
|
66
|
+
};
|
|
67
|
+
const tag = provider.versionToTag ? provider.versionToTag(version) : defaultVersionToTag(version);
|
|
62
68
|
await cloneDocsFolder(provider.repo, provider.docsPath, tag, docsPath);
|
|
63
69
|
return {
|
|
64
70
|
success: true,
|
|
@@ -247,6 +253,15 @@ function hasExistingIndex(content, providerName) {
|
|
|
247
253
|
}
|
|
248
254
|
return content.includes(START_MARKER_PREFIX);
|
|
249
255
|
}
|
|
256
|
+
function getEmbeddedProviders(content) {
|
|
257
|
+
const providers = [];
|
|
258
|
+
const regex = /<!-- AGENTS-MD-EMBED-START:(\S+?) -->/g;
|
|
259
|
+
let match;
|
|
260
|
+
while ((match = regex.exec(content)) !== null) {
|
|
261
|
+
providers.push(match[1]);
|
|
262
|
+
}
|
|
263
|
+
return providers;
|
|
264
|
+
}
|
|
250
265
|
function removeDocsIndex(content, providerName) {
|
|
251
266
|
if (!hasExistingIndex(content, providerName)) {
|
|
252
267
|
return content;
|
|
@@ -345,7 +360,7 @@ async function embed(options) {
|
|
|
345
360
|
version,
|
|
346
361
|
output = "AGENTS.md",
|
|
347
362
|
docsDir: customDocsDir,
|
|
348
|
-
globalCache =
|
|
363
|
+
globalCache = true,
|
|
349
364
|
description
|
|
350
365
|
} = options;
|
|
351
366
|
let docsPath;
|
|
@@ -374,24 +389,39 @@ async function embed(options) {
|
|
|
374
389
|
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
|
|
375
390
|
isNewFile = false;
|
|
376
391
|
}
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
392
|
+
const cacheHit = fs.existsSync(docsPath) && fs.readdirSync(docsPath).length > 0;
|
|
393
|
+
let pullResult;
|
|
394
|
+
if (cacheHit) {
|
|
395
|
+
let resolvedVersion = version;
|
|
396
|
+
if (!resolvedVersion && provider.detectVersion) {
|
|
397
|
+
const detected = provider.detectVersion(cwd);
|
|
398
|
+
resolvedVersion = detected.version || undefined;
|
|
399
|
+
}
|
|
400
|
+
pullResult = {
|
|
401
|
+
success: true,
|
|
402
|
+
docsPath,
|
|
403
|
+
version: resolvedVersion
|
|
386
404
|
};
|
|
405
|
+
} else {
|
|
406
|
+
pullResult = await pullDocs(provider, {
|
|
407
|
+
cwd,
|
|
408
|
+
version,
|
|
409
|
+
docsDir: docsPath
|
|
410
|
+
});
|
|
411
|
+
if (!pullResult.success) {
|
|
412
|
+
return {
|
|
413
|
+
success: false,
|
|
414
|
+
error: pullResult.error
|
|
415
|
+
};
|
|
416
|
+
}
|
|
387
417
|
}
|
|
388
418
|
const docFiles = collectDocFiles(docsPath, {
|
|
389
419
|
extensions: provider.extensions,
|
|
390
420
|
excludePatterns: provider.excludePatterns
|
|
391
421
|
});
|
|
392
422
|
const sections = buildDocTree(docFiles);
|
|
393
|
-
const
|
|
394
|
-
const regenerateCommand = `npx agdex --provider ${provider.name} --output ${output}${
|
|
423
|
+
const localFlag = !globalCache ? " --local" : "";
|
|
424
|
+
const regenerateCommand = `npx agdex --provider ${provider.name} --output ${output}${localFlag}`;
|
|
395
425
|
const indexContent = generateIndex({
|
|
396
426
|
docsPath: docsLinkPath,
|
|
397
427
|
sections,
|
|
@@ -420,7 +450,8 @@ async function embed(options) {
|
|
|
420
450
|
sizeBefore,
|
|
421
451
|
sizeAfter,
|
|
422
452
|
isNewFile,
|
|
423
|
-
gitignoreUpdated
|
|
453
|
+
gitignoreUpdated,
|
|
454
|
+
cacheHit
|
|
424
455
|
};
|
|
425
456
|
}
|
|
426
457
|
|
|
@@ -911,9 +942,688 @@ var bunProvider = {
|
|
|
911
942
|
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Bun tasks."
|
|
912
943
|
};
|
|
913
944
|
|
|
914
|
-
// src/lib/providers/
|
|
945
|
+
// src/lib/providers/svelte.ts
|
|
915
946
|
import fs8 from "fs";
|
|
916
947
|
import path8 from "path";
|
|
948
|
+
function detectVersion8(cwd) {
|
|
949
|
+
const packageJsonPath = path8.join(cwd, "package.json");
|
|
950
|
+
if (!fs8.existsSync(packageJsonPath)) {
|
|
951
|
+
return {
|
|
952
|
+
version: null,
|
|
953
|
+
error: "No package.json found in the current directory"
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
try {
|
|
957
|
+
const packageJson = JSON.parse(fs8.readFileSync(packageJsonPath, "utf-8"));
|
|
958
|
+
const dependencies = packageJson.dependencies || {};
|
|
959
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
960
|
+
const svelteVersion = dependencies.svelte || devDependencies.svelte;
|
|
961
|
+
if (svelteVersion) {
|
|
962
|
+
const cleanVersion = svelteVersion.replace(/^[\^~>=<]+/, "");
|
|
963
|
+
return { version: cleanVersion };
|
|
964
|
+
}
|
|
965
|
+
return {
|
|
966
|
+
version: null,
|
|
967
|
+
error: "Svelte is not installed in this project."
|
|
968
|
+
};
|
|
969
|
+
} catch (err) {
|
|
970
|
+
return {
|
|
971
|
+
version: null,
|
|
972
|
+
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
var svelteProvider = {
|
|
977
|
+
name: "svelte",
|
|
978
|
+
displayName: "Svelte",
|
|
979
|
+
repo: "sveltejs/svelte",
|
|
980
|
+
docsPath: "documentation/docs",
|
|
981
|
+
extensions: [".md", ".mdx"],
|
|
982
|
+
detectVersion: detectVersion8,
|
|
983
|
+
versionToTag: (version) => {
|
|
984
|
+
const major = parseInt(version.split(".")[0], 10);
|
|
985
|
+
if (major >= 5) {
|
|
986
|
+
return `svelte@${version}`;
|
|
987
|
+
}
|
|
988
|
+
return version.startsWith("v") ? version : `v${version}`;
|
|
989
|
+
},
|
|
990
|
+
excludePatterns: ["**/index.md"],
|
|
991
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Svelte tasks."
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
// src/lib/providers/tailwind.ts
|
|
995
|
+
import fs9 from "fs";
|
|
996
|
+
import path9 from "path";
|
|
997
|
+
function detectVersion9(cwd) {
|
|
998
|
+
const packageJsonPath = path9.join(cwd, "package.json");
|
|
999
|
+
if (!fs9.existsSync(packageJsonPath)) {
|
|
1000
|
+
return {
|
|
1001
|
+
version: null,
|
|
1002
|
+
error: "No package.json found in the current directory"
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
try {
|
|
1006
|
+
const packageJson = JSON.parse(fs9.readFileSync(packageJsonPath, "utf-8"));
|
|
1007
|
+
const dependencies = packageJson.dependencies || {};
|
|
1008
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
1009
|
+
const tailwindVersion = dependencies.tailwindcss || devDependencies.tailwindcss;
|
|
1010
|
+
if (tailwindVersion) {
|
|
1011
|
+
const cleanVersion = tailwindVersion.replace(/^[\^~>=<]+/, "");
|
|
1012
|
+
return { version: cleanVersion };
|
|
1013
|
+
}
|
|
1014
|
+
return {
|
|
1015
|
+
version: null,
|
|
1016
|
+
error: "Tailwind CSS is not installed in this project."
|
|
1017
|
+
};
|
|
1018
|
+
} catch (err) {
|
|
1019
|
+
return {
|
|
1020
|
+
version: null,
|
|
1021
|
+
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
var tailwindProvider = {
|
|
1026
|
+
name: "tailwind",
|
|
1027
|
+
displayName: "Tailwind CSS",
|
|
1028
|
+
repo: "tailwindlabs/tailwindcss.com",
|
|
1029
|
+
docsPath: "src/docs",
|
|
1030
|
+
extensions: [".md", ".mdx"],
|
|
1031
|
+
detectVersion: detectVersion9,
|
|
1032
|
+
versionToTag: (version) => version.startsWith("v") ? version : `v${version}`,
|
|
1033
|
+
excludePatterns: ["**/index.md"],
|
|
1034
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Tailwind CSS tasks."
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
// src/lib/providers/ruff.ts
|
|
1038
|
+
import fs10 from "fs";
|
|
1039
|
+
import path10 from "path";
|
|
1040
|
+
function parseRuffVersion(content) {
|
|
1041
|
+
const patterns = [
|
|
1042
|
+
/ruff\s*=\s*["']([^"']+)["']/,
|
|
1043
|
+
/["']ruff([><=!~]+[\d.]+)["']/,
|
|
1044
|
+
/["']ruff\s*([><=!~]*[\d.]+)["']/
|
|
1045
|
+
];
|
|
1046
|
+
for (const pattern of patterns) {
|
|
1047
|
+
const match = content.match(pattern);
|
|
1048
|
+
if (match) {
|
|
1049
|
+
const versionMatch = match[1].match(/[\d]+\.[\d]+\.[\d]+/);
|
|
1050
|
+
if (versionMatch) {
|
|
1051
|
+
return versionMatch[0];
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return null;
|
|
1056
|
+
}
|
|
1057
|
+
function detectVersion10(cwd) {
|
|
1058
|
+
const pyprojectPath = path10.join(cwd, "pyproject.toml");
|
|
1059
|
+
if (fs10.existsSync(pyprojectPath)) {
|
|
1060
|
+
try {
|
|
1061
|
+
const content = fs10.readFileSync(pyprojectPath, "utf-8");
|
|
1062
|
+
if (content.includes("ruff")) {
|
|
1063
|
+
const version = parseRuffVersion(content);
|
|
1064
|
+
if (version) {
|
|
1065
|
+
return { version };
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
} catch {}
|
|
1069
|
+
}
|
|
1070
|
+
const ruffTomlPath = path10.join(cwd, "ruff.toml");
|
|
1071
|
+
if (fs10.existsSync(ruffTomlPath)) {}
|
|
1072
|
+
try {
|
|
1073
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1074
|
+
const output = execSync3("ruff --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1075
|
+
const versionMatch = output.match(/ruff ([\d]+\.[\d]+\.[\d]+)/);
|
|
1076
|
+
if (versionMatch) {
|
|
1077
|
+
return { version: versionMatch[1] };
|
|
1078
|
+
}
|
|
1079
|
+
} catch {}
|
|
1080
|
+
return {
|
|
1081
|
+
version: null,
|
|
1082
|
+
error: "Could not detect ruff version. Use --fw-version to specify."
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
var ruffProvider = {
|
|
1086
|
+
name: "ruff",
|
|
1087
|
+
displayName: "Ruff",
|
|
1088
|
+
repo: "astral-sh/ruff",
|
|
1089
|
+
docsPath: "docs",
|
|
1090
|
+
extensions: [".md", ".mdx"],
|
|
1091
|
+
detectVersion: detectVersion10,
|
|
1092
|
+
versionToTag: (version) => version.replace(/^v/, ""),
|
|
1093
|
+
excludePatterns: [
|
|
1094
|
+
"**/index.md",
|
|
1095
|
+
"**/assets/**",
|
|
1096
|
+
"**/stylesheets/**",
|
|
1097
|
+
"**/javascripts/**"
|
|
1098
|
+
],
|
|
1099
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Ruff tasks. Ruff is an extremely fast Python linter and formatter."
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
// src/lib/providers/ty.ts
|
|
1103
|
+
import fs11 from "fs";
|
|
1104
|
+
import path11 from "path";
|
|
1105
|
+
function parseTyVersion(content) {
|
|
1106
|
+
const patterns = [
|
|
1107
|
+
/\bty\s*=\s*["']([^"']+)["']/,
|
|
1108
|
+
/["']ty([><=!~]+[\d.]+)["']/,
|
|
1109
|
+
/["']ty\s*([><=!~]*[\d.]+)["']/
|
|
1110
|
+
];
|
|
1111
|
+
for (const pattern of patterns) {
|
|
1112
|
+
const match = content.match(pattern);
|
|
1113
|
+
if (match) {
|
|
1114
|
+
const versionMatch = match[1].match(/[\d]+\.[\d]+\.[\d]+/);
|
|
1115
|
+
if (versionMatch) {
|
|
1116
|
+
return versionMatch[0];
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return null;
|
|
1121
|
+
}
|
|
1122
|
+
function detectVersion11(cwd) {
|
|
1123
|
+
const pyprojectPath = path11.join(cwd, "pyproject.toml");
|
|
1124
|
+
if (fs11.existsSync(pyprojectPath)) {
|
|
1125
|
+
try {
|
|
1126
|
+
const content = fs11.readFileSync(pyprojectPath, "utf-8");
|
|
1127
|
+
if (content.includes("[tool.ty]") || /["']ty[>=<]/.test(content) || /\bty\s*=/.test(content)) {
|
|
1128
|
+
const version = parseTyVersion(content);
|
|
1129
|
+
if (version) {
|
|
1130
|
+
return { version };
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
} catch {}
|
|
1134
|
+
}
|
|
1135
|
+
try {
|
|
1136
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1137
|
+
const output = execSync3("ty --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1138
|
+
const versionMatch = output.match(/ty ([\d]+\.[\d]+\.[\d]+)/);
|
|
1139
|
+
if (versionMatch) {
|
|
1140
|
+
return { version: versionMatch[1] };
|
|
1141
|
+
}
|
|
1142
|
+
} catch {}
|
|
1143
|
+
return {
|
|
1144
|
+
version: null,
|
|
1145
|
+
error: "Could not detect ty version. Use --fw-version to specify."
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
var tyProvider = {
|
|
1149
|
+
name: "ty",
|
|
1150
|
+
displayName: "ty",
|
|
1151
|
+
repo: "astral-sh/ty",
|
|
1152
|
+
docsPath: "docs",
|
|
1153
|
+
extensions: [".md", ".mdx"],
|
|
1154
|
+
detectVersion: detectVersion11,
|
|
1155
|
+
versionToTag: (version) => version.replace(/^v/, ""),
|
|
1156
|
+
excludePatterns: [
|
|
1157
|
+
"**/index.md",
|
|
1158
|
+
"**/assets/**",
|
|
1159
|
+
"**/stylesheets/**",
|
|
1160
|
+
"**/javascripts/**"
|
|
1161
|
+
],
|
|
1162
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ty tasks. ty is an extremely fast Python type checker from Astral."
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
// src/lib/providers/basedpyright.ts
|
|
1166
|
+
import fs12 from "fs";
|
|
1167
|
+
import path12 from "path";
|
|
1168
|
+
function parseBasedpyrightVersion(content) {
|
|
1169
|
+
const patterns = [
|
|
1170
|
+
/basedpyright\s*=\s*["']([^"']+)["']/,
|
|
1171
|
+
/["']basedpyright([><=!~]+[\d.]+)["']/,
|
|
1172
|
+
/["']basedpyright\s*([><=!~]*[\d.]+)["']/
|
|
1173
|
+
];
|
|
1174
|
+
for (const pattern of patterns) {
|
|
1175
|
+
const match = content.match(pattern);
|
|
1176
|
+
if (match) {
|
|
1177
|
+
const versionMatch = match[1].match(/[\d]+\.[\d]+\.[\d]+/);
|
|
1178
|
+
if (versionMatch) {
|
|
1179
|
+
return versionMatch[0];
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
return null;
|
|
1184
|
+
}
|
|
1185
|
+
function detectVersion12(cwd) {
|
|
1186
|
+
const pyprojectPath = path12.join(cwd, "pyproject.toml");
|
|
1187
|
+
if (fs12.existsSync(pyprojectPath)) {
|
|
1188
|
+
try {
|
|
1189
|
+
const content = fs12.readFileSync(pyprojectPath, "utf-8");
|
|
1190
|
+
if (content.includes("basedpyright")) {
|
|
1191
|
+
const version = parseBasedpyrightVersion(content);
|
|
1192
|
+
if (version) {
|
|
1193
|
+
return { version };
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
} catch {}
|
|
1197
|
+
}
|
|
1198
|
+
try {
|
|
1199
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1200
|
+
const output = execSync3("basedpyright --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1201
|
+
const versionMatch = output.match(/basedpyright ([\d]+\.[\d]+\.[\d]+)/);
|
|
1202
|
+
if (versionMatch) {
|
|
1203
|
+
return { version: versionMatch[1] };
|
|
1204
|
+
}
|
|
1205
|
+
} catch {}
|
|
1206
|
+
return {
|
|
1207
|
+
version: null,
|
|
1208
|
+
error: "Could not detect basedpyright version. Use --fw-version to specify."
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
var basedpyrightProvider = {
|
|
1212
|
+
name: "basedpyright",
|
|
1213
|
+
displayName: "basedpyright",
|
|
1214
|
+
repo: "DetachHead/basedpyright",
|
|
1215
|
+
docsPath: "docs",
|
|
1216
|
+
extensions: [".md", ".mdx"],
|
|
1217
|
+
detectVersion: detectVersion12,
|
|
1218
|
+
versionToTag: (version) => version.startsWith("v") ? version : `v${version}`,
|
|
1219
|
+
excludePatterns: [
|
|
1220
|
+
"**/index.md",
|
|
1221
|
+
"**/assets/**",
|
|
1222
|
+
"**/stylesheets/**",
|
|
1223
|
+
"**/javascripts/**"
|
|
1224
|
+
],
|
|
1225
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any basedpyright tasks. basedpyright is a fork of pyright with various improvements."
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
// src/lib/providers/convex.ts
|
|
1229
|
+
import fs13 from "fs";
|
|
1230
|
+
import path13 from "path";
|
|
1231
|
+
function detectVersion13(cwd) {
|
|
1232
|
+
const packageJsonPath = path13.join(cwd, "package.json");
|
|
1233
|
+
if (!fs13.existsSync(packageJsonPath)) {
|
|
1234
|
+
return {
|
|
1235
|
+
version: null,
|
|
1236
|
+
error: "No package.json found in the current directory"
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
try {
|
|
1240
|
+
const packageJson = JSON.parse(fs13.readFileSync(packageJsonPath, "utf-8"));
|
|
1241
|
+
const dependencies = packageJson.dependencies || {};
|
|
1242
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
1243
|
+
const convexVersion = dependencies.convex || devDependencies.convex;
|
|
1244
|
+
if (convexVersion) {
|
|
1245
|
+
const cleanVersion = convexVersion.replace(/^[\^~>=<]+/, "");
|
|
1246
|
+
return { version: cleanVersion };
|
|
1247
|
+
}
|
|
1248
|
+
return {
|
|
1249
|
+
version: null,
|
|
1250
|
+
error: "Convex is not installed in this project."
|
|
1251
|
+
};
|
|
1252
|
+
} catch (err) {
|
|
1253
|
+
return {
|
|
1254
|
+
version: null,
|
|
1255
|
+
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
var convexProvider = {
|
|
1260
|
+
name: "convex",
|
|
1261
|
+
displayName: "Convex",
|
|
1262
|
+
repo: "get-convex/convex-backend",
|
|
1263
|
+
docsPath: "npm-packages/docs/docs",
|
|
1264
|
+
extensions: [".md", ".mdx"],
|
|
1265
|
+
detectVersion: detectVersion13,
|
|
1266
|
+
versionToTag: (version) => `precompiled-${version}`,
|
|
1267
|
+
excludePatterns: ["**/index.md"],
|
|
1268
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Convex tasks. Convex is a backend platform for web applications."
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
// src/lib/providers/polars.ts
|
|
1272
|
+
import fs14 from "fs";
|
|
1273
|
+
import path14 from "path";
|
|
1274
|
+
function parsePolarsVersion(content) {
|
|
1275
|
+
const patterns = [
|
|
1276
|
+
/polars\s*=\s*["']([^"']+)["']/,
|
|
1277
|
+
/["']polars([><=!~]+[\d.]+)["']/,
|
|
1278
|
+
/["']polars\s*([><=!~]*[\d.]+)["']/
|
|
1279
|
+
];
|
|
1280
|
+
for (const pattern of patterns) {
|
|
1281
|
+
const match = content.match(pattern);
|
|
1282
|
+
if (match) {
|
|
1283
|
+
const versionMatch = match[1].match(/[\d]+\.[\d]+\.[\d]+/);
|
|
1284
|
+
if (versionMatch) {
|
|
1285
|
+
return versionMatch[0];
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return null;
|
|
1290
|
+
}
|
|
1291
|
+
function parseRequirementsVersion(content) {
|
|
1292
|
+
const match = content.match(/polars[><=!~]*([\d]+\.[\d]+\.[\d]+)/);
|
|
1293
|
+
if (match) {
|
|
1294
|
+
return match[1];
|
|
1295
|
+
}
|
|
1296
|
+
return null;
|
|
1297
|
+
}
|
|
1298
|
+
function detectVersion14(cwd) {
|
|
1299
|
+
const pyprojectPath = path14.join(cwd, "pyproject.toml");
|
|
1300
|
+
if (fs14.existsSync(pyprojectPath)) {
|
|
1301
|
+
try {
|
|
1302
|
+
const content = fs14.readFileSync(pyprojectPath, "utf-8");
|
|
1303
|
+
if (content.includes("polars")) {
|
|
1304
|
+
const version = parsePolarsVersion(content);
|
|
1305
|
+
if (version) {
|
|
1306
|
+
return { version };
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
} catch {}
|
|
1310
|
+
}
|
|
1311
|
+
const requirementsPath = path14.join(cwd, "requirements.txt");
|
|
1312
|
+
if (fs14.existsSync(requirementsPath)) {
|
|
1313
|
+
try {
|
|
1314
|
+
const content = fs14.readFileSync(requirementsPath, "utf-8");
|
|
1315
|
+
if (content.includes("polars")) {
|
|
1316
|
+
const version = parseRequirementsVersion(content);
|
|
1317
|
+
if (version) {
|
|
1318
|
+
return { version };
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
} catch {}
|
|
1322
|
+
}
|
|
1323
|
+
try {
|
|
1324
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1325
|
+
const output = execSync3("pip show polars", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1326
|
+
const versionMatch = output.match(/Version:\s*([\d]+\.[\d]+\.[\d]+)/);
|
|
1327
|
+
if (versionMatch) {
|
|
1328
|
+
return { version: versionMatch[1] };
|
|
1329
|
+
}
|
|
1330
|
+
} catch {}
|
|
1331
|
+
return {
|
|
1332
|
+
version: null,
|
|
1333
|
+
error: "Could not detect polars version. Use --fw-version to specify."
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
var polarsProvider = {
|
|
1337
|
+
name: "polars",
|
|
1338
|
+
displayName: "Polars",
|
|
1339
|
+
repo: "pola-rs/polars",
|
|
1340
|
+
docsPath: "docs",
|
|
1341
|
+
extensions: [".md", ".mdx"],
|
|
1342
|
+
detectVersion: detectVersion14,
|
|
1343
|
+
versionToTag: (version) => `py-${version}`,
|
|
1344
|
+
excludePatterns: [
|
|
1345
|
+
"**/index.md",
|
|
1346
|
+
"**/assets/**",
|
|
1347
|
+
"**/stylesheets/**",
|
|
1348
|
+
"**/javascripts/**"
|
|
1349
|
+
],
|
|
1350
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Polars tasks. Polars is a blazingly fast DataFrame library."
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
// src/lib/providers/delta-rs.ts
|
|
1354
|
+
import fs15 from "fs";
|
|
1355
|
+
import path15 from "path";
|
|
1356
|
+
function parseDeltaLakeVersion(content) {
|
|
1357
|
+
const patterns = [
|
|
1358
|
+
/deltalake\s*=\s*["']([^"']+)["']/,
|
|
1359
|
+
/["']deltalake([><=!~]+[\d.]+)["']/,
|
|
1360
|
+
/["']deltalake\s*([><=!~]*[\d.]+)["']/
|
|
1361
|
+
];
|
|
1362
|
+
for (const pattern of patterns) {
|
|
1363
|
+
const match = content.match(pattern);
|
|
1364
|
+
if (match) {
|
|
1365
|
+
const versionMatch = match[1].match(/[\d]+\.[\d]+\.[\d]+/);
|
|
1366
|
+
if (versionMatch) {
|
|
1367
|
+
return versionMatch[0];
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
return null;
|
|
1372
|
+
}
|
|
1373
|
+
function parseRequirementsVersion2(content) {
|
|
1374
|
+
const match = content.match(/deltalake[><=!~]*([\d]+\.[\d]+\.[\d]+)/);
|
|
1375
|
+
if (match) {
|
|
1376
|
+
return match[1];
|
|
1377
|
+
}
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
function detectVersion15(cwd) {
|
|
1381
|
+
const pyprojectPath = path15.join(cwd, "pyproject.toml");
|
|
1382
|
+
if (fs15.existsSync(pyprojectPath)) {
|
|
1383
|
+
try {
|
|
1384
|
+
const content = fs15.readFileSync(pyprojectPath, "utf-8");
|
|
1385
|
+
if (content.includes("deltalake")) {
|
|
1386
|
+
const version = parseDeltaLakeVersion(content);
|
|
1387
|
+
if (version) {
|
|
1388
|
+
return { version };
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
} catch {}
|
|
1392
|
+
}
|
|
1393
|
+
const requirementsPath = path15.join(cwd, "requirements.txt");
|
|
1394
|
+
if (fs15.existsSync(requirementsPath)) {
|
|
1395
|
+
try {
|
|
1396
|
+
const content = fs15.readFileSync(requirementsPath, "utf-8");
|
|
1397
|
+
if (content.includes("deltalake")) {
|
|
1398
|
+
const version = parseRequirementsVersion2(content);
|
|
1399
|
+
if (version) {
|
|
1400
|
+
return { version };
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
} catch {}
|
|
1404
|
+
}
|
|
1405
|
+
try {
|
|
1406
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1407
|
+
const output = execSync3("pip show deltalake", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1408
|
+
const versionMatch = output.match(/Version:\s*([\d]+\.[\d]+\.[\d]+)/);
|
|
1409
|
+
if (versionMatch) {
|
|
1410
|
+
return { version: versionMatch[1] };
|
|
1411
|
+
}
|
|
1412
|
+
} catch {}
|
|
1413
|
+
return {
|
|
1414
|
+
version: null,
|
|
1415
|
+
error: "Could not detect deltalake version. Use --fw-version to specify."
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
var deltaRsProvider = {
|
|
1419
|
+
name: "delta-rs",
|
|
1420
|
+
displayName: "delta-rs",
|
|
1421
|
+
repo: "delta-io/delta-rs",
|
|
1422
|
+
docsPath: "docs",
|
|
1423
|
+
extensions: [".md", ".mdx"],
|
|
1424
|
+
detectVersion: detectVersion15,
|
|
1425
|
+
versionToTag: (version) => `python-v${version}`,
|
|
1426
|
+
excludePatterns: [
|
|
1427
|
+
"**/index.md",
|
|
1428
|
+
"**/assets/**",
|
|
1429
|
+
"**/stylesheets/**",
|
|
1430
|
+
"**/javascripts/**"
|
|
1431
|
+
],
|
|
1432
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any delta-rs/deltalake tasks. delta-rs is a native Rust implementation of Delta Lake."
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
// src/lib/providers/obsidian.ts
|
|
1436
|
+
import fs16 from "fs";
|
|
1437
|
+
import path16 from "path";
|
|
1438
|
+
function detectVersion16(cwd) {
|
|
1439
|
+
const packageJsonPath = path16.join(cwd, "package.json");
|
|
1440
|
+
if (!fs16.existsSync(packageJsonPath)) {
|
|
1441
|
+
return {
|
|
1442
|
+
version: null,
|
|
1443
|
+
error: "No package.json found in the current directory"
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
try {
|
|
1447
|
+
const packageJson = JSON.parse(fs16.readFileSync(packageJsonPath, "utf-8"));
|
|
1448
|
+
const dependencies = packageJson.dependencies || {};
|
|
1449
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
1450
|
+
const obsidianVersion = dependencies.obsidian || devDependencies.obsidian;
|
|
1451
|
+
if (obsidianVersion) {
|
|
1452
|
+
const cleanVersion = obsidianVersion.replace(/^[\^~>=<]+/, "");
|
|
1453
|
+
return { version: cleanVersion };
|
|
1454
|
+
}
|
|
1455
|
+
return {
|
|
1456
|
+
version: null,
|
|
1457
|
+
error: "Obsidian is not installed in this project."
|
|
1458
|
+
};
|
|
1459
|
+
} catch (err) {
|
|
1460
|
+
return {
|
|
1461
|
+
version: null,
|
|
1462
|
+
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
var obsidianProvider = {
|
|
1467
|
+
name: "obsidian",
|
|
1468
|
+
displayName: "Obsidian",
|
|
1469
|
+
repo: "obsidianmd/obsidian-developer-docs",
|
|
1470
|
+
docsPath: "en",
|
|
1471
|
+
extensions: [".md", ".mdx"],
|
|
1472
|
+
detectVersion: detectVersion16,
|
|
1473
|
+
versionToTag: (version) => version.startsWith("v") ? version : `v${version}`,
|
|
1474
|
+
excludePatterns: ["**/index.md"],
|
|
1475
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Obsidian plugin development tasks."
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
// src/lib/providers/obsidian-excalidraw.ts
|
|
1479
|
+
import fs17 from "fs";
|
|
1480
|
+
import path17 from "path";
|
|
1481
|
+
function detectVersion17(cwd) {
|
|
1482
|
+
const manifestPath = path17.join(cwd, "manifest.json");
|
|
1483
|
+
if (fs17.existsSync(manifestPath)) {
|
|
1484
|
+
try {
|
|
1485
|
+
const manifest = JSON.parse(fs17.readFileSync(manifestPath, "utf-8"));
|
|
1486
|
+
if (manifest.id === "obsidian-excalidraw-plugin" && manifest.version) {
|
|
1487
|
+
return { version: manifest.version };
|
|
1488
|
+
}
|
|
1489
|
+
} catch {}
|
|
1490
|
+
}
|
|
1491
|
+
return {
|
|
1492
|
+
version: null,
|
|
1493
|
+
error: "Could not detect obsidian-excalidraw-plugin version. Use --fw-version to specify."
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
var obsidianExcalidrawProvider = {
|
|
1497
|
+
name: "obsidian-excalidraw",
|
|
1498
|
+
displayName: "Obsidian Excalidraw",
|
|
1499
|
+
repo: "zsviczian/obsidian-excalidraw-plugin",
|
|
1500
|
+
docsPath: "docs",
|
|
1501
|
+
extensions: [".md", ".mdx"],
|
|
1502
|
+
detectVersion: detectVersion17,
|
|
1503
|
+
versionToTag: (version) => version,
|
|
1504
|
+
excludePatterns: ["**/index.md"],
|
|
1505
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Obsidian Excalidraw plugin tasks."
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
// src/lib/providers/ffmpeg.ts
|
|
1509
|
+
function detectVersion18() {
|
|
1510
|
+
try {
|
|
1511
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1512
|
+
const output = execSync3("ffmpeg -version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1513
|
+
const versionMatch = output.match(/ffmpeg version (\d+\.\d+(?:\.\d+)?)/);
|
|
1514
|
+
if (versionMatch) {
|
|
1515
|
+
return { version: versionMatch[1] };
|
|
1516
|
+
}
|
|
1517
|
+
} catch {}
|
|
1518
|
+
return {
|
|
1519
|
+
version: null,
|
|
1520
|
+
error: "Could not detect FFmpeg version. Use --fw-version to specify."
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
var ffmpegProvider = {
|
|
1524
|
+
name: "ffmpeg",
|
|
1525
|
+
displayName: "FFmpeg",
|
|
1526
|
+
repo: "FFmpeg/FFmpeg",
|
|
1527
|
+
docsPath: "doc",
|
|
1528
|
+
extensions: [".txt", ".md", ".texi"],
|
|
1529
|
+
detectVersion: detectVersion18,
|
|
1530
|
+
versionToTag: (version) => `n${version}`,
|
|
1531
|
+
excludePatterns: [
|
|
1532
|
+
"**/Makefile",
|
|
1533
|
+
"**/*.mak",
|
|
1534
|
+
"**/*.sh",
|
|
1535
|
+
"**/*.pl",
|
|
1536
|
+
"**/*.py"
|
|
1537
|
+
],
|
|
1538
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any FFmpeg tasks. FFmpeg is a multimedia framework for audio/video processing."
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
// src/lib/providers/manim.ts
|
|
1542
|
+
import fs18 from "fs";
|
|
1543
|
+
import path18 from "path";
|
|
1544
|
+
function parseManimVersion(content) {
|
|
1545
|
+
const patterns = [
|
|
1546
|
+
/manim\s*=\s*["']([^"']+)["']/,
|
|
1547
|
+
/["']manim([><=!~]+[\d.]+)["']/,
|
|
1548
|
+
/["']manim\s*([><=!~]*[\d.]+)["']/
|
|
1549
|
+
];
|
|
1550
|
+
for (const pattern of patterns) {
|
|
1551
|
+
const match = content.match(pattern);
|
|
1552
|
+
if (match) {
|
|
1553
|
+
const versionMatch = match[1].match(/[\d]+\.[\d]+\.[\d]+/);
|
|
1554
|
+
if (versionMatch) {
|
|
1555
|
+
return versionMatch[0];
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return null;
|
|
1560
|
+
}
|
|
1561
|
+
function parseRequirementsVersion3(content) {
|
|
1562
|
+
const match = content.match(/manim[><=!~]*([\d]+\.[\d]+\.[\d]+)/);
|
|
1563
|
+
if (match) {
|
|
1564
|
+
return match[1];
|
|
1565
|
+
}
|
|
1566
|
+
return null;
|
|
1567
|
+
}
|
|
1568
|
+
function detectVersion19(cwd) {
|
|
1569
|
+
const pyprojectPath = path18.join(cwd, "pyproject.toml");
|
|
1570
|
+
if (fs18.existsSync(pyprojectPath)) {
|
|
1571
|
+
try {
|
|
1572
|
+
const content = fs18.readFileSync(pyprojectPath, "utf-8");
|
|
1573
|
+
if (content.includes("manim")) {
|
|
1574
|
+
const version = parseManimVersion(content);
|
|
1575
|
+
if (version) {
|
|
1576
|
+
return { version };
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
} catch {}
|
|
1580
|
+
}
|
|
1581
|
+
const requirementsPath = path18.join(cwd, "requirements.txt");
|
|
1582
|
+
if (fs18.existsSync(requirementsPath)) {
|
|
1583
|
+
try {
|
|
1584
|
+
const content = fs18.readFileSync(requirementsPath, "utf-8");
|
|
1585
|
+
if (content.includes("manim")) {
|
|
1586
|
+
const version = parseRequirementsVersion3(content);
|
|
1587
|
+
if (version) {
|
|
1588
|
+
return { version };
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
} catch {}
|
|
1592
|
+
}
|
|
1593
|
+
try {
|
|
1594
|
+
const { execSync: execSync3 } = __require("child_process");
|
|
1595
|
+
const output = execSync3("pip show manim", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1596
|
+
const versionMatch = output.match(/Version:\s*([\d]+\.[\d]+\.[\d]+)/);
|
|
1597
|
+
if (versionMatch) {
|
|
1598
|
+
return { version: versionMatch[1] };
|
|
1599
|
+
}
|
|
1600
|
+
} catch {}
|
|
1601
|
+
return {
|
|
1602
|
+
version: null,
|
|
1603
|
+
error: "Could not detect manim version. Use --fw-version to specify."
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
var manimProvider = {
|
|
1607
|
+
name: "manim",
|
|
1608
|
+
displayName: "Manim",
|
|
1609
|
+
repo: "ManimCommunity/manim",
|
|
1610
|
+
docsPath: "docs",
|
|
1611
|
+
extensions: [".md", ".rst", ".py"],
|
|
1612
|
+
detectVersion: detectVersion19,
|
|
1613
|
+
versionToTag: (version) => version.startsWith("v") ? version : `v${version}`,
|
|
1614
|
+
excludePatterns: [
|
|
1615
|
+
"**/index.md",
|
|
1616
|
+
"**/conf.py",
|
|
1617
|
+
"**/Makefile",
|
|
1618
|
+
"**/_static/**",
|
|
1619
|
+
"**/_templates/**"
|
|
1620
|
+
],
|
|
1621
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Manim tasks. Manim is a Python library for mathematical animations."
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
// src/lib/providers/generic.ts
|
|
1625
|
+
import fs19 from "fs";
|
|
1626
|
+
import path19 from "path";
|
|
917
1627
|
function createProvider(options) {
|
|
918
1628
|
const {
|
|
919
1629
|
name,
|
|
@@ -922,20 +1632,25 @@ function createProvider(options) {
|
|
|
922
1632
|
docsPath,
|
|
923
1633
|
extensions = [".mdx", ".md"],
|
|
924
1634
|
packageName,
|
|
925
|
-
versionToTag = (v) =>
|
|
1635
|
+
versionToTag = (v) => {
|
|
1636
|
+
if (v.startsWith("v") || /^\d/.test(v)) {
|
|
1637
|
+
return v.startsWith("v") ? v : `v${v}`;
|
|
1638
|
+
}
|
|
1639
|
+
return v;
|
|
1640
|
+
},
|
|
926
1641
|
excludePatterns = ["**/index.mdx", "**/index.md"],
|
|
927
1642
|
instruction
|
|
928
1643
|
} = options;
|
|
929
|
-
const
|
|
930
|
-
const packageJsonPath =
|
|
931
|
-
if (!
|
|
1644
|
+
const detectVersion20 = packageName ? (cwd) => {
|
|
1645
|
+
const packageJsonPath = path19.join(cwd, "package.json");
|
|
1646
|
+
if (!fs19.existsSync(packageJsonPath)) {
|
|
932
1647
|
return {
|
|
933
1648
|
version: null,
|
|
934
1649
|
error: "No package.json found in the current directory"
|
|
935
1650
|
};
|
|
936
1651
|
}
|
|
937
1652
|
try {
|
|
938
|
-
const packageJson = JSON.parse(
|
|
1653
|
+
const packageJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
|
|
939
1654
|
const dependencies = packageJson.dependencies || {};
|
|
940
1655
|
const devDependencies = packageJson.devDependencies || {};
|
|
941
1656
|
const version = dependencies[packageName] || devDependencies[packageName];
|
|
@@ -960,7 +1675,7 @@ function createProvider(options) {
|
|
|
960
1675
|
repo,
|
|
961
1676
|
docsPath,
|
|
962
1677
|
extensions,
|
|
963
|
-
detectVersion:
|
|
1678
|
+
detectVersion: detectVersion20,
|
|
964
1679
|
versionToTag,
|
|
965
1680
|
excludePatterns,
|
|
966
1681
|
instruction: instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${displayName} tasks.`
|
|
@@ -977,6 +1692,90 @@ function createLocalProvider(options) {
|
|
|
977
1692
|
instruction: options.instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${options.displayName} tasks.`
|
|
978
1693
|
};
|
|
979
1694
|
}
|
|
1695
|
+
// src/lib/providers/sveltekit.ts
|
|
1696
|
+
import fs20 from "fs";
|
|
1697
|
+
import path20 from "path";
|
|
1698
|
+
function detectVersion20(cwd) {
|
|
1699
|
+
const packageJsonPath = path20.join(cwd, "package.json");
|
|
1700
|
+
if (!fs20.existsSync(packageJsonPath)) {
|
|
1701
|
+
return {
|
|
1702
|
+
version: null,
|
|
1703
|
+
error: "No package.json found in the current directory"
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
try {
|
|
1707
|
+
const packageJson = JSON.parse(fs20.readFileSync(packageJsonPath, "utf-8"));
|
|
1708
|
+
const dependencies = packageJson.dependencies || {};
|
|
1709
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
1710
|
+
const kitVersion = dependencies["@sveltejs/kit"] || devDependencies["@sveltejs/kit"];
|
|
1711
|
+
if (kitVersion) {
|
|
1712
|
+
const cleanVersion = kitVersion.replace(/^[\^~>=<]+/, "");
|
|
1713
|
+
return { version: cleanVersion };
|
|
1714
|
+
}
|
|
1715
|
+
return {
|
|
1716
|
+
version: null,
|
|
1717
|
+
error: "@sveltejs/kit is not installed in this project."
|
|
1718
|
+
};
|
|
1719
|
+
} catch (err) {
|
|
1720
|
+
return {
|
|
1721
|
+
version: null,
|
|
1722
|
+
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
var sveltekitProvider = {
|
|
1727
|
+
name: "sveltekit",
|
|
1728
|
+
displayName: "SvelteKit",
|
|
1729
|
+
repo: "sveltejs/kit",
|
|
1730
|
+
docsPath: "documentation/docs",
|
|
1731
|
+
extensions: [".md"],
|
|
1732
|
+
detectVersion: detectVersion20,
|
|
1733
|
+
versionToTag: (version) => `@sveltejs/kit@${version}`,
|
|
1734
|
+
excludePatterns: ["**/index.md"],
|
|
1735
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any SvelteKit tasks."
|
|
1736
|
+
};
|
|
1737
|
+
// src/lib/providers/shadcn-svelte.ts
|
|
1738
|
+
import fs21 from "fs";
|
|
1739
|
+
import path21 from "path";
|
|
1740
|
+
function detectVersion21(cwd) {
|
|
1741
|
+
const packageJsonPath = path21.join(cwd, "package.json");
|
|
1742
|
+
if (!fs21.existsSync(packageJsonPath)) {
|
|
1743
|
+
return {
|
|
1744
|
+
version: null,
|
|
1745
|
+
error: "No package.json found in the current directory"
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
try {
|
|
1749
|
+
const packageJson = JSON.parse(fs21.readFileSync(packageJsonPath, "utf-8"));
|
|
1750
|
+
const dependencies = packageJson.dependencies || {};
|
|
1751
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
1752
|
+
const version = dependencies["shadcn-svelte"] || devDependencies["shadcn-svelte"];
|
|
1753
|
+
if (version) {
|
|
1754
|
+
const cleanVersion = version.replace(/^[\^~>=<]+/, "");
|
|
1755
|
+
return { version: cleanVersion };
|
|
1756
|
+
}
|
|
1757
|
+
return {
|
|
1758
|
+
version: null,
|
|
1759
|
+
error: "shadcn-svelte is not installed in this project."
|
|
1760
|
+
};
|
|
1761
|
+
} catch (err) {
|
|
1762
|
+
return {
|
|
1763
|
+
version: null,
|
|
1764
|
+
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
var shadcnSvelteProvider = {
|
|
1769
|
+
name: "shadcn-svelte",
|
|
1770
|
+
displayName: "shadcn-svelte",
|
|
1771
|
+
repo: "huntabyte/shadcn-svelte",
|
|
1772
|
+
docsPath: "docs/content",
|
|
1773
|
+
extensions: [".md"],
|
|
1774
|
+
detectVersion: detectVersion21,
|
|
1775
|
+
versionToTag: (version) => `shadcn-svelte@${version}`,
|
|
1776
|
+
excludePatterns: ["**/index.md"],
|
|
1777
|
+
instruction: "IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any shadcn-svelte tasks."
|
|
1778
|
+
};
|
|
980
1779
|
// src/lib/providers/index.ts
|
|
981
1780
|
function getProvider(preset) {
|
|
982
1781
|
switch (preset) {
|
|
@@ -994,8 +1793,35 @@ function getProvider(preset) {
|
|
|
994
1793
|
return condaForgeProvider;
|
|
995
1794
|
case "bun":
|
|
996
1795
|
return bunProvider;
|
|
997
|
-
case "vue":
|
|
998
1796
|
case "svelte":
|
|
1797
|
+
return svelteProvider;
|
|
1798
|
+
case "sveltekit":
|
|
1799
|
+
return sveltekitProvider;
|
|
1800
|
+
case "shadcn-svelte":
|
|
1801
|
+
return shadcnSvelteProvider;
|
|
1802
|
+
case "tailwind":
|
|
1803
|
+
return tailwindProvider;
|
|
1804
|
+
case "ruff":
|
|
1805
|
+
return ruffProvider;
|
|
1806
|
+
case "ty":
|
|
1807
|
+
return tyProvider;
|
|
1808
|
+
case "basedpyright":
|
|
1809
|
+
return basedpyrightProvider;
|
|
1810
|
+
case "convex":
|
|
1811
|
+
return convexProvider;
|
|
1812
|
+
case "polars":
|
|
1813
|
+
return polarsProvider;
|
|
1814
|
+
case "delta-rs":
|
|
1815
|
+
return deltaRsProvider;
|
|
1816
|
+
case "obsidian":
|
|
1817
|
+
return obsidianProvider;
|
|
1818
|
+
case "obsidian-excalidraw":
|
|
1819
|
+
return obsidianExcalidrawProvider;
|
|
1820
|
+
case "ffmpeg":
|
|
1821
|
+
return ffmpegProvider;
|
|
1822
|
+
case "manim":
|
|
1823
|
+
return manimProvider;
|
|
1824
|
+
case "vue":
|
|
999
1825
|
case "astro":
|
|
1000
1826
|
return null;
|
|
1001
1827
|
default:
|
|
@@ -1003,23 +1829,23 @@ function getProvider(preset) {
|
|
|
1003
1829
|
}
|
|
1004
1830
|
}
|
|
1005
1831
|
function listProviders() {
|
|
1006
|
-
return ["nextjs", "react", "pixi", "rattler-build", "tauri", "conda-forge", "bun", "vue", "svelte", "astro"];
|
|
1832
|
+
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"];
|
|
1007
1833
|
}
|
|
1008
1834
|
function isProviderAvailable(preset) {
|
|
1009
1835
|
return getProvider(preset) !== null;
|
|
1010
1836
|
}
|
|
1011
1837
|
|
|
1012
1838
|
// src/lib/skills.ts
|
|
1013
|
-
import
|
|
1014
|
-
import
|
|
1839
|
+
import fs22 from "fs";
|
|
1840
|
+
import path22 from "path";
|
|
1015
1841
|
import os2 from "os";
|
|
1016
1842
|
var SKILLS_START_MARKER = "<!-- AGENTS-MD-SKILLS-START -->";
|
|
1017
1843
|
var SKILLS_END_MARKER = "<!-- AGENTS-MD-SKILLS-END -->";
|
|
1018
1844
|
function parseEnabledPlugins(settingsPath) {
|
|
1019
|
-
if (!
|
|
1845
|
+
if (!fs22.existsSync(settingsPath))
|
|
1020
1846
|
return [];
|
|
1021
1847
|
try {
|
|
1022
|
-
const content =
|
|
1848
|
+
const content = fs22.readFileSync(settingsPath, "utf-8");
|
|
1023
1849
|
const settings = JSON.parse(content);
|
|
1024
1850
|
const enabledPlugins = settings.enabledPlugins || {};
|
|
1025
1851
|
const plugins = [];
|
|
@@ -1040,17 +1866,17 @@ function parseEnabledPlugins(settingsPath) {
|
|
|
1040
1866
|
}
|
|
1041
1867
|
}
|
|
1042
1868
|
function findPluginSkillsPath(pluginRepo, skillName) {
|
|
1043
|
-
const cacheDir =
|
|
1044
|
-
if (!
|
|
1869
|
+
const cacheDir = path22.join(os2.homedir(), ".claude", "plugins", "cache", pluginRepo, skillName);
|
|
1870
|
+
if (!fs22.existsSync(cacheDir))
|
|
1045
1871
|
return null;
|
|
1046
1872
|
try {
|
|
1047
|
-
const entries =
|
|
1873
|
+
const entries = fs22.readdirSync(cacheDir, { withFileTypes: true });
|
|
1048
1874
|
const hashDirs = entries.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
1049
1875
|
if (hashDirs.length === 0)
|
|
1050
1876
|
return null;
|
|
1051
1877
|
const hashDir = hashDirs[0].name;
|
|
1052
|
-
const skillsPath =
|
|
1053
|
-
if (
|
|
1878
|
+
const skillsPath = path22.join(cacheDir, hashDir, "skills");
|
|
1879
|
+
if (fs22.existsSync(skillsPath)) {
|
|
1054
1880
|
return skillsPath;
|
|
1055
1881
|
}
|
|
1056
1882
|
return null;
|
|
@@ -1062,8 +1888,8 @@ function getEnabledPluginSources(cwd) {
|
|
|
1062
1888
|
const sources = [];
|
|
1063
1889
|
const seenPlugins = new Set;
|
|
1064
1890
|
const settingsPaths = [
|
|
1065
|
-
|
|
1066
|
-
|
|
1891
|
+
path22.join(os2.homedir(), ".claude", "settings.json"),
|
|
1892
|
+
path22.join(cwd, ".claude", "settings.json")
|
|
1067
1893
|
];
|
|
1068
1894
|
for (const settingsPath of settingsPaths) {
|
|
1069
1895
|
const plugins = parseEnabledPlugins(settingsPath);
|
|
@@ -1106,12 +1932,12 @@ function parseSkillFrontmatter(content) {
|
|
|
1106
1932
|
function getFilesRecursively(dir, baseDir) {
|
|
1107
1933
|
const files = [];
|
|
1108
1934
|
try {
|
|
1109
|
-
const entries =
|
|
1935
|
+
const entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
1110
1936
|
for (const entry of entries) {
|
|
1111
1937
|
if (entry.name.startsWith(".") || entry.name === "SKILL.md")
|
|
1112
1938
|
continue;
|
|
1113
|
-
const fullPath =
|
|
1114
|
-
const relativePath =
|
|
1939
|
+
const fullPath = path22.join(dir, entry.name);
|
|
1940
|
+
const relativePath = path22.relative(baseDir, fullPath);
|
|
1115
1941
|
if (entry.isDirectory()) {
|
|
1116
1942
|
files.push(...getFilesRecursively(fullPath, baseDir));
|
|
1117
1943
|
} else {
|
|
@@ -1122,29 +1948,29 @@ function getFilesRecursively(dir, baseDir) {
|
|
|
1122
1948
|
return files;
|
|
1123
1949
|
}
|
|
1124
1950
|
function getSiblingFiles(skillMdPath) {
|
|
1125
|
-
const dir =
|
|
1126
|
-
if (!
|
|
1951
|
+
const dir = path22.dirname(skillMdPath);
|
|
1952
|
+
if (!fs22.existsSync(dir))
|
|
1127
1953
|
return [];
|
|
1128
1954
|
return getFilesRecursively(dir, dir).sort();
|
|
1129
1955
|
}
|
|
1130
1956
|
function discoverPluginSkills(pluginsPath, label) {
|
|
1131
1957
|
const skills = [];
|
|
1132
|
-
const pluginsDir =
|
|
1133
|
-
if (!
|
|
1958
|
+
const pluginsDir = path22.join(pluginsPath, "plugins");
|
|
1959
|
+
if (!fs22.existsSync(pluginsDir)) {
|
|
1134
1960
|
return skills;
|
|
1135
1961
|
}
|
|
1136
|
-
const plugins =
|
|
1962
|
+
const plugins = fs22.readdirSync(pluginsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1137
1963
|
for (const plugin of plugins) {
|
|
1138
|
-
const skillsDir =
|
|
1139
|
-
if (!
|
|
1964
|
+
const skillsDir = path22.join(pluginsDir, plugin.name, "skills");
|
|
1965
|
+
if (!fs22.existsSync(skillsDir))
|
|
1140
1966
|
continue;
|
|
1141
|
-
const skillDirs =
|
|
1967
|
+
const skillDirs = fs22.readdirSync(skillsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1142
1968
|
for (const skillDir of skillDirs) {
|
|
1143
|
-
const skillMdPath =
|
|
1144
|
-
if (!
|
|
1969
|
+
const skillMdPath = path22.join(skillsDir, skillDir.name, "SKILL.md");
|
|
1970
|
+
if (!fs22.existsSync(skillMdPath))
|
|
1145
1971
|
continue;
|
|
1146
1972
|
try {
|
|
1147
|
-
const content =
|
|
1973
|
+
const content = fs22.readFileSync(skillMdPath, "utf-8");
|
|
1148
1974
|
const frontmatter = parseSkillFrontmatter(content);
|
|
1149
1975
|
if (!frontmatter)
|
|
1150
1976
|
continue;
|
|
@@ -1163,16 +1989,16 @@ function discoverPluginSkills(pluginsPath, label) {
|
|
|
1163
1989
|
}
|
|
1164
1990
|
function discoverFlatSkills(skillsPath, source, label) {
|
|
1165
1991
|
const skills = [];
|
|
1166
|
-
if (!
|
|
1992
|
+
if (!fs22.existsSync(skillsPath)) {
|
|
1167
1993
|
return skills;
|
|
1168
1994
|
}
|
|
1169
|
-
const skillDirs =
|
|
1995
|
+
const skillDirs = fs22.readdirSync(skillsPath, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1170
1996
|
for (const skillDir of skillDirs) {
|
|
1171
|
-
const skillMdPath =
|
|
1172
|
-
if (!
|
|
1997
|
+
const skillMdPath = path22.join(skillsPath, skillDir.name, "SKILL.md");
|
|
1998
|
+
if (!fs22.existsSync(skillMdPath))
|
|
1173
1999
|
continue;
|
|
1174
2000
|
try {
|
|
1175
|
-
const content =
|
|
2001
|
+
const content = fs22.readFileSync(skillMdPath, "utf-8");
|
|
1176
2002
|
const frontmatter = parseSkillFrontmatter(content);
|
|
1177
2003
|
if (!frontmatter)
|
|
1178
2004
|
continue;
|
|
@@ -1295,7 +2121,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1295
2121
|
sources.push({
|
|
1296
2122
|
type: "plugin",
|
|
1297
2123
|
path: pluginPath,
|
|
1298
|
-
label:
|
|
2124
|
+
label: path22.basename(pluginPath)
|
|
1299
2125
|
});
|
|
1300
2126
|
}
|
|
1301
2127
|
if (includeEnabledPlugins) {
|
|
@@ -1303,7 +2129,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1303
2129
|
sources.push(...enabledPluginSources);
|
|
1304
2130
|
}
|
|
1305
2131
|
if (includeUser) {
|
|
1306
|
-
const userSkillsPath =
|
|
2132
|
+
const userSkillsPath = path22.join(os2.homedir(), ".claude", "skills");
|
|
1307
2133
|
sources.push({
|
|
1308
2134
|
type: "user",
|
|
1309
2135
|
path: userSkillsPath,
|
|
@@ -1311,7 +2137,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1311
2137
|
});
|
|
1312
2138
|
}
|
|
1313
2139
|
if (includeProject) {
|
|
1314
|
-
const projectSkillsPath =
|
|
2140
|
+
const projectSkillsPath = path22.join(cwd, ".claude", "skills");
|
|
1315
2141
|
sources.push({
|
|
1316
2142
|
type: "project",
|
|
1317
2143
|
path: projectSkillsPath,
|
|
@@ -1322,12 +2148,12 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1322
2148
|
}
|
|
1323
2149
|
async function embedSkills(options) {
|
|
1324
2150
|
const { cwd, sources, output = "AGENTS.md" } = options;
|
|
1325
|
-
const targetPath =
|
|
2151
|
+
const targetPath = path22.join(cwd, output);
|
|
1326
2152
|
let sizeBefore = 0;
|
|
1327
2153
|
let isNewFile = true;
|
|
1328
2154
|
let existingContent = "";
|
|
1329
|
-
if (
|
|
1330
|
-
existingContent =
|
|
2155
|
+
if (fs22.existsSync(targetPath)) {
|
|
2156
|
+
existingContent = fs22.readFileSync(targetPath, "utf-8");
|
|
1331
2157
|
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
|
|
1332
2158
|
isNewFile = false;
|
|
1333
2159
|
}
|
|
@@ -1350,7 +2176,7 @@ async function embedSkills(options) {
|
|
|
1350
2176
|
regenerateCommand: `npx agdex skills embed`
|
|
1351
2177
|
});
|
|
1352
2178
|
const newContent = injectSkillsIndex(existingContent, indexContent);
|
|
1353
|
-
|
|
2179
|
+
fs22.writeFileSync(targetPath, newContent, "utf-8");
|
|
1354
2180
|
const sizeAfter = Buffer.byteLength(newContent, "utf-8");
|
|
1355
2181
|
return {
|
|
1356
2182
|
success: true,
|
|
@@ -1363,4 +2189,36 @@ async function embedSkills(options) {
|
|
|
1363
2189
|
};
|
|
1364
2190
|
}
|
|
1365
2191
|
|
|
1366
|
-
|
|
2192
|
+
// src/lib/config.ts
|
|
2193
|
+
import fs23 from "fs";
|
|
2194
|
+
import path23 from "path";
|
|
2195
|
+
var DEFAULT_CONFIG = {
|
|
2196
|
+
output: "CLAUDE.md"
|
|
2197
|
+
};
|
|
2198
|
+
function loadConfig(cwd = process.cwd()) {
|
|
2199
|
+
const rcPath = path23.join(cwd, ".agdexrc.json");
|
|
2200
|
+
if (fs23.existsSync(rcPath)) {
|
|
2201
|
+
try {
|
|
2202
|
+
const content = fs23.readFileSync(rcPath, "utf-8");
|
|
2203
|
+
const config = JSON.parse(content);
|
|
2204
|
+
return { ...DEFAULT_CONFIG, ...config };
|
|
2205
|
+
} catch {}
|
|
2206
|
+
}
|
|
2207
|
+
const packageJsonPath = path23.join(cwd, "package.json");
|
|
2208
|
+
if (fs23.existsSync(packageJsonPath)) {
|
|
2209
|
+
try {
|
|
2210
|
+
const content = fs23.readFileSync(packageJsonPath, "utf-8");
|
|
2211
|
+
const packageJson = JSON.parse(content);
|
|
2212
|
+
if (packageJson.agdex && typeof packageJson.agdex === "object") {
|
|
2213
|
+
return { ...DEFAULT_CONFIG, ...packageJson.agdex };
|
|
2214
|
+
}
|
|
2215
|
+
} catch {}
|
|
2216
|
+
}
|
|
2217
|
+
return DEFAULT_CONFIG;
|
|
2218
|
+
}
|
|
2219
|
+
function getDefaultOutput(cwd = process.cwd()) {
|
|
2220
|
+
const config = loadConfig(cwd);
|
|
2221
|
+
return config.output || "AGENTS.md";
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
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, getEnabledPluginSources, parseSkillFrontmatter, discoverPluginSkills, discoverFlatSkills, collectAllSkills, generateSkillsIndex, hasExistingSkillsIndex, removeSkillsIndex, injectSkillsIndex, getDefaultSkillSources, embedSkills, loadConfig, getDefaultOutput };
|