skilld 0.12.0 → 0.13.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.
@@ -1406,6 +1406,27 @@ async function findLatestReleaseTag(owner, repo, packageName) {
1406
1406
  function filterDocFiles(files, pathPrefix) {
1407
1407
  return files.filter((f) => f.startsWith(pathPrefix) && /\.(?:md|mdx)$/.test(f));
1408
1408
  }
1409
+ const FRAMEWORK_NAMES = new Set([
1410
+ "vue",
1411
+ "react",
1412
+ "solid",
1413
+ "angular",
1414
+ "svelte",
1415
+ "preact",
1416
+ "lit",
1417
+ "qwik"
1418
+ ]);
1419
+ function filterFrameworkDocs(files, packageName) {
1420
+ if (!packageName) return files;
1421
+ const shortName = packageName.replace(/^@.*\//, "");
1422
+ const targetFramework = [...FRAMEWORK_NAMES].find((fw) => shortName.includes(fw));
1423
+ if (!targetFramework) return files;
1424
+ const frameworkPattern = new RegExp(`(?:^|/)(?:framework/)?(?:${[...FRAMEWORK_NAMES].join("|")})/`);
1425
+ if (!files.some((f) => frameworkPattern.test(f))) return files;
1426
+ const otherFrameworks = [...FRAMEWORK_NAMES].filter((fw) => fw !== targetFramework);
1427
+ const excludePattern = new RegExp(`(?:^|/)(?:framework/)?(?:${otherFrameworks.join("|")})/`);
1428
+ return files.filter((f) => !excludePattern.test(f));
1429
+ }
1409
1430
  const NOISE_PATTERNS = [
1410
1431
  /^\.changeset\//,
1411
1432
  /CHANGELOG\.md$/i,
@@ -1455,8 +1476,16 @@ function scoreDocDir(dir, fileCount) {
1455
1476
  const depth = getPathDepth(dir) || 1;
1456
1477
  return fileCount * (hasDocDirBonus(dir) ? 1.5 : 1) / depth;
1457
1478
  }
1458
- function discoverDocFiles(allFiles) {
1479
+ function discoverDocFiles(allFiles, packageName) {
1459
1480
  const mdFiles = allFiles.filter((f) => /\.(?:md|mdx)$/.test(f)).filter((f) => !NOISE_PATTERNS.some((p) => p.test(f))).filter((f) => f.includes("/"));
1481
+ if (packageName?.includes("/")) {
1482
+ const subPkgPrefix = `packages/${packageName.split("/").pop().toLowerCase()}/`;
1483
+ const subPkgFiles = mdFiles.filter((f) => f.startsWith(subPkgPrefix));
1484
+ if (subPkgFiles.length >= 3) return {
1485
+ files: subPkgFiles,
1486
+ prefix: subPkgPrefix
1487
+ };
1488
+ }
1460
1489
  const docsGroups = /* @__PURE__ */ new Map();
1461
1490
  for (const file of mdFiles) {
1462
1491
  const docsIdx = file.lastIndexOf("/docs/");
@@ -1519,13 +1548,14 @@ async function fetchGitDocs(owner, repo, version, packageName, repoUrl) {
1519
1548
  let docsPrefix;
1520
1549
  let allFiles;
1521
1550
  if (docs.length === 0) {
1522
- const discovered = discoverDocFiles(tag.files);
1551
+ const discovered = discoverDocFiles(tag.files, packageName);
1523
1552
  if (discovered) {
1524
1553
  docs = discovered.files;
1525
1554
  docsPrefix = discovered.prefix || void 0;
1526
1555
  allFiles = tag.files;
1527
1556
  }
1528
1557
  }
1558
+ docs = filterFrameworkDocs(docs, packageName);
1529
1559
  if (docs.length === 0) return null;
1530
1560
  return {
1531
1561
  baseUrl: `https://raw.githubusercontent.com/${owner}/${repo}/${tag.ref}`,