agdex 0.4.2 → 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 +443 -105
- package/dist/{index-4shp3mqh.js → index-974mhezm.js} +413 -60
- package/dist/index-g5x6jpyb.js +2304 -0
- package/dist/{index-2hm5b6yq.js → index-nn4xptha.js} +29 -13
- package/dist/index-pfdh6eyh.js +2241 -0
- package/dist/{index-zrmn6fd2.js → index-vf9nfyjb.js} +345 -68
- package/dist/{index-pkx4s2ef.js → index-wsqyam11.js} +52 -16
- 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/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-9gy9s47s.js +0 -1366
- 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
|
|
|
@@ -1401,9 +1432,198 @@ var deltaRsProvider = {
|
|
|
1401
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."
|
|
1402
1433
|
};
|
|
1403
1434
|
|
|
1404
|
-
// src/lib/providers/
|
|
1435
|
+
// src/lib/providers/obsidian.ts
|
|
1405
1436
|
import fs16 from "fs";
|
|
1406
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";
|
|
1407
1627
|
function createProvider(options) {
|
|
1408
1628
|
const {
|
|
1409
1629
|
name,
|
|
@@ -1412,20 +1632,25 @@ function createProvider(options) {
|
|
|
1412
1632
|
docsPath,
|
|
1413
1633
|
extensions = [".mdx", ".md"],
|
|
1414
1634
|
packageName,
|
|
1415
|
-
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
|
+
},
|
|
1416
1641
|
excludePatterns = ["**/index.mdx", "**/index.md"],
|
|
1417
1642
|
instruction
|
|
1418
1643
|
} = options;
|
|
1419
|
-
const
|
|
1420
|
-
const packageJsonPath =
|
|
1421
|
-
if (!
|
|
1644
|
+
const detectVersion20 = packageName ? (cwd) => {
|
|
1645
|
+
const packageJsonPath = path19.join(cwd, "package.json");
|
|
1646
|
+
if (!fs19.existsSync(packageJsonPath)) {
|
|
1422
1647
|
return {
|
|
1423
1648
|
version: null,
|
|
1424
1649
|
error: "No package.json found in the current directory"
|
|
1425
1650
|
};
|
|
1426
1651
|
}
|
|
1427
1652
|
try {
|
|
1428
|
-
const packageJson = JSON.parse(
|
|
1653
|
+
const packageJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
|
|
1429
1654
|
const dependencies = packageJson.dependencies || {};
|
|
1430
1655
|
const devDependencies = packageJson.devDependencies || {};
|
|
1431
1656
|
const version = dependencies[packageName] || devDependencies[packageName];
|
|
@@ -1450,7 +1675,7 @@ function createProvider(options) {
|
|
|
1450
1675
|
repo,
|
|
1451
1676
|
docsPath,
|
|
1452
1677
|
extensions,
|
|
1453
|
-
detectVersion:
|
|
1678
|
+
detectVersion: detectVersion20,
|
|
1454
1679
|
versionToTag,
|
|
1455
1680
|
excludePatterns,
|
|
1456
1681
|
instruction: instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${displayName} tasks.`
|
|
@@ -1467,6 +1692,90 @@ function createLocalProvider(options) {
|
|
|
1467
1692
|
instruction: options.instruction || `IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any ${options.displayName} tasks.`
|
|
1468
1693
|
};
|
|
1469
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
|
+
};
|
|
1470
1779
|
// src/lib/providers/index.ts
|
|
1471
1780
|
function getProvider(preset) {
|
|
1472
1781
|
switch (preset) {
|
|
@@ -1486,6 +1795,10 @@ function getProvider(preset) {
|
|
|
1486
1795
|
return bunProvider;
|
|
1487
1796
|
case "svelte":
|
|
1488
1797
|
return svelteProvider;
|
|
1798
|
+
case "sveltekit":
|
|
1799
|
+
return sveltekitProvider;
|
|
1800
|
+
case "shadcn-svelte":
|
|
1801
|
+
return shadcnSvelteProvider;
|
|
1489
1802
|
case "tailwind":
|
|
1490
1803
|
return tailwindProvider;
|
|
1491
1804
|
case "ruff":
|
|
@@ -1500,6 +1813,14 @@ function getProvider(preset) {
|
|
|
1500
1813
|
return polarsProvider;
|
|
1501
1814
|
case "delta-rs":
|
|
1502
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;
|
|
1503
1824
|
case "vue":
|
|
1504
1825
|
case "astro":
|
|
1505
1826
|
return null;
|
|
@@ -1508,23 +1829,23 @@ function getProvider(preset) {
|
|
|
1508
1829
|
}
|
|
1509
1830
|
}
|
|
1510
1831
|
function listProviders() {
|
|
1511
|
-
return ["nextjs", "react", "pixi", "rattler-build", "tauri", "conda-forge", "bun", "vue", "svelte", "astro", "tailwind", "ruff", "ty", "basedpyright", "convex", "polars", "delta-rs"];
|
|
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"];
|
|
1512
1833
|
}
|
|
1513
1834
|
function isProviderAvailable(preset) {
|
|
1514
1835
|
return getProvider(preset) !== null;
|
|
1515
1836
|
}
|
|
1516
1837
|
|
|
1517
1838
|
// src/lib/skills.ts
|
|
1518
|
-
import
|
|
1519
|
-
import
|
|
1839
|
+
import fs22 from "fs";
|
|
1840
|
+
import path22 from "path";
|
|
1520
1841
|
import os2 from "os";
|
|
1521
1842
|
var SKILLS_START_MARKER = "<!-- AGENTS-MD-SKILLS-START -->";
|
|
1522
1843
|
var SKILLS_END_MARKER = "<!-- AGENTS-MD-SKILLS-END -->";
|
|
1523
1844
|
function parseEnabledPlugins(settingsPath) {
|
|
1524
|
-
if (!
|
|
1845
|
+
if (!fs22.existsSync(settingsPath))
|
|
1525
1846
|
return [];
|
|
1526
1847
|
try {
|
|
1527
|
-
const content =
|
|
1848
|
+
const content = fs22.readFileSync(settingsPath, "utf-8");
|
|
1528
1849
|
const settings = JSON.parse(content);
|
|
1529
1850
|
const enabledPlugins = settings.enabledPlugins || {};
|
|
1530
1851
|
const plugins = [];
|
|
@@ -1545,17 +1866,17 @@ function parseEnabledPlugins(settingsPath) {
|
|
|
1545
1866
|
}
|
|
1546
1867
|
}
|
|
1547
1868
|
function findPluginSkillsPath(pluginRepo, skillName) {
|
|
1548
|
-
const cacheDir =
|
|
1549
|
-
if (!
|
|
1869
|
+
const cacheDir = path22.join(os2.homedir(), ".claude", "plugins", "cache", pluginRepo, skillName);
|
|
1870
|
+
if (!fs22.existsSync(cacheDir))
|
|
1550
1871
|
return null;
|
|
1551
1872
|
try {
|
|
1552
|
-
const entries =
|
|
1873
|
+
const entries = fs22.readdirSync(cacheDir, { withFileTypes: true });
|
|
1553
1874
|
const hashDirs = entries.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
1554
1875
|
if (hashDirs.length === 0)
|
|
1555
1876
|
return null;
|
|
1556
1877
|
const hashDir = hashDirs[0].name;
|
|
1557
|
-
const skillsPath =
|
|
1558
|
-
if (
|
|
1878
|
+
const skillsPath = path22.join(cacheDir, hashDir, "skills");
|
|
1879
|
+
if (fs22.existsSync(skillsPath)) {
|
|
1559
1880
|
return skillsPath;
|
|
1560
1881
|
}
|
|
1561
1882
|
return null;
|
|
@@ -1567,8 +1888,8 @@ function getEnabledPluginSources(cwd) {
|
|
|
1567
1888
|
const sources = [];
|
|
1568
1889
|
const seenPlugins = new Set;
|
|
1569
1890
|
const settingsPaths = [
|
|
1570
|
-
|
|
1571
|
-
|
|
1891
|
+
path22.join(os2.homedir(), ".claude", "settings.json"),
|
|
1892
|
+
path22.join(cwd, ".claude", "settings.json")
|
|
1572
1893
|
];
|
|
1573
1894
|
for (const settingsPath of settingsPaths) {
|
|
1574
1895
|
const plugins = parseEnabledPlugins(settingsPath);
|
|
@@ -1611,12 +1932,12 @@ function parseSkillFrontmatter(content) {
|
|
|
1611
1932
|
function getFilesRecursively(dir, baseDir) {
|
|
1612
1933
|
const files = [];
|
|
1613
1934
|
try {
|
|
1614
|
-
const entries =
|
|
1935
|
+
const entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
1615
1936
|
for (const entry of entries) {
|
|
1616
1937
|
if (entry.name.startsWith(".") || entry.name === "SKILL.md")
|
|
1617
1938
|
continue;
|
|
1618
|
-
const fullPath =
|
|
1619
|
-
const relativePath =
|
|
1939
|
+
const fullPath = path22.join(dir, entry.name);
|
|
1940
|
+
const relativePath = path22.relative(baseDir, fullPath);
|
|
1620
1941
|
if (entry.isDirectory()) {
|
|
1621
1942
|
files.push(...getFilesRecursively(fullPath, baseDir));
|
|
1622
1943
|
} else {
|
|
@@ -1627,29 +1948,29 @@ function getFilesRecursively(dir, baseDir) {
|
|
|
1627
1948
|
return files;
|
|
1628
1949
|
}
|
|
1629
1950
|
function getSiblingFiles(skillMdPath) {
|
|
1630
|
-
const dir =
|
|
1631
|
-
if (!
|
|
1951
|
+
const dir = path22.dirname(skillMdPath);
|
|
1952
|
+
if (!fs22.existsSync(dir))
|
|
1632
1953
|
return [];
|
|
1633
1954
|
return getFilesRecursively(dir, dir).sort();
|
|
1634
1955
|
}
|
|
1635
1956
|
function discoverPluginSkills(pluginsPath, label) {
|
|
1636
1957
|
const skills = [];
|
|
1637
|
-
const pluginsDir =
|
|
1638
|
-
if (!
|
|
1958
|
+
const pluginsDir = path22.join(pluginsPath, "plugins");
|
|
1959
|
+
if (!fs22.existsSync(pluginsDir)) {
|
|
1639
1960
|
return skills;
|
|
1640
1961
|
}
|
|
1641
|
-
const plugins =
|
|
1962
|
+
const plugins = fs22.readdirSync(pluginsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1642
1963
|
for (const plugin of plugins) {
|
|
1643
|
-
const skillsDir =
|
|
1644
|
-
if (!
|
|
1964
|
+
const skillsDir = path22.join(pluginsDir, plugin.name, "skills");
|
|
1965
|
+
if (!fs22.existsSync(skillsDir))
|
|
1645
1966
|
continue;
|
|
1646
|
-
const skillDirs =
|
|
1967
|
+
const skillDirs = fs22.readdirSync(skillsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1647
1968
|
for (const skillDir of skillDirs) {
|
|
1648
|
-
const skillMdPath =
|
|
1649
|
-
if (!
|
|
1969
|
+
const skillMdPath = path22.join(skillsDir, skillDir.name, "SKILL.md");
|
|
1970
|
+
if (!fs22.existsSync(skillMdPath))
|
|
1650
1971
|
continue;
|
|
1651
1972
|
try {
|
|
1652
|
-
const content =
|
|
1973
|
+
const content = fs22.readFileSync(skillMdPath, "utf-8");
|
|
1653
1974
|
const frontmatter = parseSkillFrontmatter(content);
|
|
1654
1975
|
if (!frontmatter)
|
|
1655
1976
|
continue;
|
|
@@ -1668,16 +1989,16 @@ function discoverPluginSkills(pluginsPath, label) {
|
|
|
1668
1989
|
}
|
|
1669
1990
|
function discoverFlatSkills(skillsPath, source, label) {
|
|
1670
1991
|
const skills = [];
|
|
1671
|
-
if (!
|
|
1992
|
+
if (!fs22.existsSync(skillsPath)) {
|
|
1672
1993
|
return skills;
|
|
1673
1994
|
}
|
|
1674
|
-
const skillDirs =
|
|
1995
|
+
const skillDirs = fs22.readdirSync(skillsPath, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1675
1996
|
for (const skillDir of skillDirs) {
|
|
1676
|
-
const skillMdPath =
|
|
1677
|
-
if (!
|
|
1997
|
+
const skillMdPath = path22.join(skillsPath, skillDir.name, "SKILL.md");
|
|
1998
|
+
if (!fs22.existsSync(skillMdPath))
|
|
1678
1999
|
continue;
|
|
1679
2000
|
try {
|
|
1680
|
-
const content =
|
|
2001
|
+
const content = fs22.readFileSync(skillMdPath, "utf-8");
|
|
1681
2002
|
const frontmatter = parseSkillFrontmatter(content);
|
|
1682
2003
|
if (!frontmatter)
|
|
1683
2004
|
continue;
|
|
@@ -1800,7 +2121,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1800
2121
|
sources.push({
|
|
1801
2122
|
type: "plugin",
|
|
1802
2123
|
path: pluginPath,
|
|
1803
|
-
label:
|
|
2124
|
+
label: path22.basename(pluginPath)
|
|
1804
2125
|
});
|
|
1805
2126
|
}
|
|
1806
2127
|
if (includeEnabledPlugins) {
|
|
@@ -1808,7 +2129,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1808
2129
|
sources.push(...enabledPluginSources);
|
|
1809
2130
|
}
|
|
1810
2131
|
if (includeUser) {
|
|
1811
|
-
const userSkillsPath =
|
|
2132
|
+
const userSkillsPath = path22.join(os2.homedir(), ".claude", "skills");
|
|
1812
2133
|
sources.push({
|
|
1813
2134
|
type: "user",
|
|
1814
2135
|
path: userSkillsPath,
|
|
@@ -1816,7 +2137,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1816
2137
|
});
|
|
1817
2138
|
}
|
|
1818
2139
|
if (includeProject) {
|
|
1819
|
-
const projectSkillsPath =
|
|
2140
|
+
const projectSkillsPath = path22.join(cwd, ".claude", "skills");
|
|
1820
2141
|
sources.push({
|
|
1821
2142
|
type: "project",
|
|
1822
2143
|
path: projectSkillsPath,
|
|
@@ -1827,12 +2148,12 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1827
2148
|
}
|
|
1828
2149
|
async function embedSkills(options) {
|
|
1829
2150
|
const { cwd, sources, output = "AGENTS.md" } = options;
|
|
1830
|
-
const targetPath =
|
|
2151
|
+
const targetPath = path22.join(cwd, output);
|
|
1831
2152
|
let sizeBefore = 0;
|
|
1832
2153
|
let isNewFile = true;
|
|
1833
2154
|
let existingContent = "";
|
|
1834
|
-
if (
|
|
1835
|
-
existingContent =
|
|
2155
|
+
if (fs22.existsSync(targetPath)) {
|
|
2156
|
+
existingContent = fs22.readFileSync(targetPath, "utf-8");
|
|
1836
2157
|
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
|
|
1837
2158
|
isNewFile = false;
|
|
1838
2159
|
}
|
|
@@ -1855,7 +2176,7 @@ async function embedSkills(options) {
|
|
|
1855
2176
|
regenerateCommand: `npx agdex skills embed`
|
|
1856
2177
|
});
|
|
1857
2178
|
const newContent = injectSkillsIndex(existingContent, indexContent);
|
|
1858
|
-
|
|
2179
|
+
fs22.writeFileSync(targetPath, newContent, "utf-8");
|
|
1859
2180
|
const sizeAfter = Buffer.byteLength(newContent, "utf-8");
|
|
1860
2181
|
return {
|
|
1861
2182
|
success: true,
|
|
@@ -1868,4 +2189,36 @@ async function embedSkills(options) {
|
|
|
1868
2189
|
};
|
|
1869
2190
|
}
|
|
1870
2191
|
|
|
1871
|
-
|
|
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 };
|