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,48 @@ 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
|
+
};
|
|
1470
1737
|
// src/lib/providers/index.ts
|
|
1471
1738
|
function getProvider(preset) {
|
|
1472
1739
|
switch (preset) {
|
|
@@ -1486,6 +1753,8 @@ function getProvider(preset) {
|
|
|
1486
1753
|
return bunProvider;
|
|
1487
1754
|
case "svelte":
|
|
1488
1755
|
return svelteProvider;
|
|
1756
|
+
case "sveltekit":
|
|
1757
|
+
return sveltekitProvider;
|
|
1489
1758
|
case "tailwind":
|
|
1490
1759
|
return tailwindProvider;
|
|
1491
1760
|
case "ruff":
|
|
@@ -1500,6 +1769,14 @@ function getProvider(preset) {
|
|
|
1500
1769
|
return polarsProvider;
|
|
1501
1770
|
case "delta-rs":
|
|
1502
1771
|
return deltaRsProvider;
|
|
1772
|
+
case "obsidian":
|
|
1773
|
+
return obsidianProvider;
|
|
1774
|
+
case "obsidian-excalidraw":
|
|
1775
|
+
return obsidianExcalidrawProvider;
|
|
1776
|
+
case "ffmpeg":
|
|
1777
|
+
return ffmpegProvider;
|
|
1778
|
+
case "manim":
|
|
1779
|
+
return manimProvider;
|
|
1503
1780
|
case "vue":
|
|
1504
1781
|
case "astro":
|
|
1505
1782
|
return null;
|
|
@@ -1508,23 +1785,23 @@ function getProvider(preset) {
|
|
|
1508
1785
|
}
|
|
1509
1786
|
}
|
|
1510
1787
|
function listProviders() {
|
|
1511
|
-
return ["nextjs", "react", "pixi", "rattler-build", "tauri", "conda-forge", "bun", "vue", "svelte", "astro", "tailwind", "ruff", "ty", "basedpyright", "convex", "polars", "delta-rs"];
|
|
1788
|
+
return ["nextjs", "react", "pixi", "rattler-build", "tauri", "conda-forge", "bun", "vue", "svelte", "sveltekit", "astro", "tailwind", "ruff", "ty", "basedpyright", "convex", "polars", "delta-rs", "obsidian", "obsidian-excalidraw", "ffmpeg", "manim"];
|
|
1512
1789
|
}
|
|
1513
1790
|
function isProviderAvailable(preset) {
|
|
1514
1791
|
return getProvider(preset) !== null;
|
|
1515
1792
|
}
|
|
1516
1793
|
|
|
1517
1794
|
// src/lib/skills.ts
|
|
1518
|
-
import
|
|
1519
|
-
import
|
|
1795
|
+
import fs21 from "fs";
|
|
1796
|
+
import path21 from "path";
|
|
1520
1797
|
import os2 from "os";
|
|
1521
1798
|
var SKILLS_START_MARKER = "<!-- AGENTS-MD-SKILLS-START -->";
|
|
1522
1799
|
var SKILLS_END_MARKER = "<!-- AGENTS-MD-SKILLS-END -->";
|
|
1523
1800
|
function parseEnabledPlugins(settingsPath) {
|
|
1524
|
-
if (!
|
|
1801
|
+
if (!fs21.existsSync(settingsPath))
|
|
1525
1802
|
return [];
|
|
1526
1803
|
try {
|
|
1527
|
-
const content =
|
|
1804
|
+
const content = fs21.readFileSync(settingsPath, "utf-8");
|
|
1528
1805
|
const settings = JSON.parse(content);
|
|
1529
1806
|
const enabledPlugins = settings.enabledPlugins || {};
|
|
1530
1807
|
const plugins = [];
|
|
@@ -1545,17 +1822,17 @@ function parseEnabledPlugins(settingsPath) {
|
|
|
1545
1822
|
}
|
|
1546
1823
|
}
|
|
1547
1824
|
function findPluginSkillsPath(pluginRepo, skillName) {
|
|
1548
|
-
const cacheDir =
|
|
1549
|
-
if (!
|
|
1825
|
+
const cacheDir = path21.join(os2.homedir(), ".claude", "plugins", "cache", pluginRepo, skillName);
|
|
1826
|
+
if (!fs21.existsSync(cacheDir))
|
|
1550
1827
|
return null;
|
|
1551
1828
|
try {
|
|
1552
|
-
const entries =
|
|
1829
|
+
const entries = fs21.readdirSync(cacheDir, { withFileTypes: true });
|
|
1553
1830
|
const hashDirs = entries.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
1554
1831
|
if (hashDirs.length === 0)
|
|
1555
1832
|
return null;
|
|
1556
1833
|
const hashDir = hashDirs[0].name;
|
|
1557
|
-
const skillsPath =
|
|
1558
|
-
if (
|
|
1834
|
+
const skillsPath = path21.join(cacheDir, hashDir, "skills");
|
|
1835
|
+
if (fs21.existsSync(skillsPath)) {
|
|
1559
1836
|
return skillsPath;
|
|
1560
1837
|
}
|
|
1561
1838
|
return null;
|
|
@@ -1567,8 +1844,8 @@ function getEnabledPluginSources(cwd) {
|
|
|
1567
1844
|
const sources = [];
|
|
1568
1845
|
const seenPlugins = new Set;
|
|
1569
1846
|
const settingsPaths = [
|
|
1570
|
-
|
|
1571
|
-
|
|
1847
|
+
path21.join(os2.homedir(), ".claude", "settings.json"),
|
|
1848
|
+
path21.join(cwd, ".claude", "settings.json")
|
|
1572
1849
|
];
|
|
1573
1850
|
for (const settingsPath of settingsPaths) {
|
|
1574
1851
|
const plugins = parseEnabledPlugins(settingsPath);
|
|
@@ -1611,12 +1888,12 @@ function parseSkillFrontmatter(content) {
|
|
|
1611
1888
|
function getFilesRecursively(dir, baseDir) {
|
|
1612
1889
|
const files = [];
|
|
1613
1890
|
try {
|
|
1614
|
-
const entries =
|
|
1891
|
+
const entries = fs21.readdirSync(dir, { withFileTypes: true });
|
|
1615
1892
|
for (const entry of entries) {
|
|
1616
1893
|
if (entry.name.startsWith(".") || entry.name === "SKILL.md")
|
|
1617
1894
|
continue;
|
|
1618
|
-
const fullPath =
|
|
1619
|
-
const relativePath =
|
|
1895
|
+
const fullPath = path21.join(dir, entry.name);
|
|
1896
|
+
const relativePath = path21.relative(baseDir, fullPath);
|
|
1620
1897
|
if (entry.isDirectory()) {
|
|
1621
1898
|
files.push(...getFilesRecursively(fullPath, baseDir));
|
|
1622
1899
|
} else {
|
|
@@ -1627,29 +1904,29 @@ function getFilesRecursively(dir, baseDir) {
|
|
|
1627
1904
|
return files;
|
|
1628
1905
|
}
|
|
1629
1906
|
function getSiblingFiles(skillMdPath) {
|
|
1630
|
-
const dir =
|
|
1631
|
-
if (!
|
|
1907
|
+
const dir = path21.dirname(skillMdPath);
|
|
1908
|
+
if (!fs21.existsSync(dir))
|
|
1632
1909
|
return [];
|
|
1633
1910
|
return getFilesRecursively(dir, dir).sort();
|
|
1634
1911
|
}
|
|
1635
1912
|
function discoverPluginSkills(pluginsPath, label) {
|
|
1636
1913
|
const skills = [];
|
|
1637
|
-
const pluginsDir =
|
|
1638
|
-
if (!
|
|
1914
|
+
const pluginsDir = path21.join(pluginsPath, "plugins");
|
|
1915
|
+
if (!fs21.existsSync(pluginsDir)) {
|
|
1639
1916
|
return skills;
|
|
1640
1917
|
}
|
|
1641
|
-
const plugins =
|
|
1918
|
+
const plugins = fs21.readdirSync(pluginsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1642
1919
|
for (const plugin of plugins) {
|
|
1643
|
-
const skillsDir =
|
|
1644
|
-
if (!
|
|
1920
|
+
const skillsDir = path21.join(pluginsDir, plugin.name, "skills");
|
|
1921
|
+
if (!fs21.existsSync(skillsDir))
|
|
1645
1922
|
continue;
|
|
1646
|
-
const skillDirs =
|
|
1923
|
+
const skillDirs = fs21.readdirSync(skillsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1647
1924
|
for (const skillDir of skillDirs) {
|
|
1648
|
-
const skillMdPath =
|
|
1649
|
-
if (!
|
|
1925
|
+
const skillMdPath = path21.join(skillsDir, skillDir.name, "SKILL.md");
|
|
1926
|
+
if (!fs21.existsSync(skillMdPath))
|
|
1650
1927
|
continue;
|
|
1651
1928
|
try {
|
|
1652
|
-
const content =
|
|
1929
|
+
const content = fs21.readFileSync(skillMdPath, "utf-8");
|
|
1653
1930
|
const frontmatter = parseSkillFrontmatter(content);
|
|
1654
1931
|
if (!frontmatter)
|
|
1655
1932
|
continue;
|
|
@@ -1668,16 +1945,16 @@ function discoverPluginSkills(pluginsPath, label) {
|
|
|
1668
1945
|
}
|
|
1669
1946
|
function discoverFlatSkills(skillsPath, source, label) {
|
|
1670
1947
|
const skills = [];
|
|
1671
|
-
if (!
|
|
1948
|
+
if (!fs21.existsSync(skillsPath)) {
|
|
1672
1949
|
return skills;
|
|
1673
1950
|
}
|
|
1674
|
-
const skillDirs =
|
|
1951
|
+
const skillDirs = fs21.readdirSync(skillsPath, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
1675
1952
|
for (const skillDir of skillDirs) {
|
|
1676
|
-
const skillMdPath =
|
|
1677
|
-
if (!
|
|
1953
|
+
const skillMdPath = path21.join(skillsPath, skillDir.name, "SKILL.md");
|
|
1954
|
+
if (!fs21.existsSync(skillMdPath))
|
|
1678
1955
|
continue;
|
|
1679
1956
|
try {
|
|
1680
|
-
const content =
|
|
1957
|
+
const content = fs21.readFileSync(skillMdPath, "utf-8");
|
|
1681
1958
|
const frontmatter = parseSkillFrontmatter(content);
|
|
1682
1959
|
if (!frontmatter)
|
|
1683
1960
|
continue;
|
|
@@ -1800,7 +2077,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1800
2077
|
sources.push({
|
|
1801
2078
|
type: "plugin",
|
|
1802
2079
|
path: pluginPath,
|
|
1803
|
-
label:
|
|
2080
|
+
label: path21.basename(pluginPath)
|
|
1804
2081
|
});
|
|
1805
2082
|
}
|
|
1806
2083
|
if (includeEnabledPlugins) {
|
|
@@ -1808,7 +2085,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1808
2085
|
sources.push(...enabledPluginSources);
|
|
1809
2086
|
}
|
|
1810
2087
|
if (includeUser) {
|
|
1811
|
-
const userSkillsPath =
|
|
2088
|
+
const userSkillsPath = path21.join(os2.homedir(), ".claude", "skills");
|
|
1812
2089
|
sources.push({
|
|
1813
2090
|
type: "user",
|
|
1814
2091
|
path: userSkillsPath,
|
|
@@ -1816,7 +2093,7 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1816
2093
|
});
|
|
1817
2094
|
}
|
|
1818
2095
|
if (includeProject) {
|
|
1819
|
-
const projectSkillsPath =
|
|
2096
|
+
const projectSkillsPath = path21.join(cwd, ".claude", "skills");
|
|
1820
2097
|
sources.push({
|
|
1821
2098
|
type: "project",
|
|
1822
2099
|
path: projectSkillsPath,
|
|
@@ -1827,12 +2104,12 @@ function getDefaultSkillSources(cwd, options = {}) {
|
|
|
1827
2104
|
}
|
|
1828
2105
|
async function embedSkills(options) {
|
|
1829
2106
|
const { cwd, sources, output = "AGENTS.md" } = options;
|
|
1830
|
-
const targetPath =
|
|
2107
|
+
const targetPath = path21.join(cwd, output);
|
|
1831
2108
|
let sizeBefore = 0;
|
|
1832
2109
|
let isNewFile = true;
|
|
1833
2110
|
let existingContent = "";
|
|
1834
|
-
if (
|
|
1835
|
-
existingContent =
|
|
2111
|
+
if (fs21.existsSync(targetPath)) {
|
|
2112
|
+
existingContent = fs21.readFileSync(targetPath, "utf-8");
|
|
1836
2113
|
sizeBefore = Buffer.byteLength(existingContent, "utf-8");
|
|
1837
2114
|
isNewFile = false;
|
|
1838
2115
|
}
|
|
@@ -1855,7 +2132,7 @@ async function embedSkills(options) {
|
|
|
1855
2132
|
regenerateCommand: `npx agdex skills embed`
|
|
1856
2133
|
});
|
|
1857
2134
|
const newContent = injectSkillsIndex(existingContent, indexContent);
|
|
1858
|
-
|
|
2135
|
+
fs21.writeFileSync(targetPath, newContent, "utf-8");
|
|
1859
2136
|
const sizeAfter = Buffer.byteLength(newContent, "utf-8");
|
|
1860
2137
|
return {
|
|
1861
2138
|
success: true,
|
|
@@ -1869,24 +2146,24 @@ async function embedSkills(options) {
|
|
|
1869
2146
|
}
|
|
1870
2147
|
|
|
1871
2148
|
// src/lib/config.ts
|
|
1872
|
-
import
|
|
1873
|
-
import
|
|
2149
|
+
import fs22 from "fs";
|
|
2150
|
+
import path22 from "path";
|
|
1874
2151
|
var DEFAULT_CONFIG = {
|
|
1875
2152
|
output: "CLAUDE.md"
|
|
1876
2153
|
};
|
|
1877
2154
|
function loadConfig(cwd = process.cwd()) {
|
|
1878
|
-
const rcPath =
|
|
1879
|
-
if (
|
|
2155
|
+
const rcPath = path22.join(cwd, ".agdexrc.json");
|
|
2156
|
+
if (fs22.existsSync(rcPath)) {
|
|
1880
2157
|
try {
|
|
1881
|
-
const content =
|
|
2158
|
+
const content = fs22.readFileSync(rcPath, "utf-8");
|
|
1882
2159
|
const config = JSON.parse(content);
|
|
1883
2160
|
return { ...DEFAULT_CONFIG, ...config };
|
|
1884
2161
|
} catch {}
|
|
1885
2162
|
}
|
|
1886
|
-
const packageJsonPath =
|
|
1887
|
-
if (
|
|
2163
|
+
const packageJsonPath = path22.join(cwd, "package.json");
|
|
2164
|
+
if (fs22.existsSync(packageJsonPath)) {
|
|
1888
2165
|
try {
|
|
1889
|
-
const content =
|
|
2166
|
+
const content = fs22.readFileSync(packageJsonPath, "utf-8");
|
|
1890
2167
|
const packageJson = JSON.parse(content);
|
|
1891
2168
|
if (packageJson.agdex && typeof packageJson.agdex === "object") {
|
|
1892
2169
|
return { ...DEFAULT_CONFIG, ...packageJson.agdex };
|
|
@@ -1900,4 +2177,4 @@ function getDefaultOutput(cwd = process.cwd()) {
|
|
|
1900
2177
|
return config.output || "AGENTS.md";
|
|
1901
2178
|
}
|
|
1902
2179
|
|
|
1903
|
-
export { __toESM, __commonJS, __require, pullDocs, collectDocFiles, buildDocTree, generateIndex, hasExistingIndex, removeDocsIndex, injectIndex, ensureGitignoreEntry, getGlobalCacheDir, getLocalCacheDir, embed, nextjsProvider, reactProvider, pixiProvider, rattlerBuildProvider, tauriProvider, condaForgeProvider, bunProvider, svelteProvider, tailwindProvider, ruffProvider, tyProvider, basedpyrightProvider, convexProvider, polarsProvider, deltaRsProvider, createProvider, createLocalProvider, getProvider, listProviders, isProviderAvailable, getEnabledPluginSources, parseSkillFrontmatter, discoverPluginSkills, discoverFlatSkills, collectAllSkills, generateSkillsIndex, hasExistingSkillsIndex, removeSkillsIndex, injectSkillsIndex, getDefaultSkillSources, embedSkills, loadConfig, getDefaultOutput };
|
|
2180
|
+
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 };
|