skilld 2.0.0 → 2.2.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 +94 -0
- package/dist/_chunks/add.mjs +10 -9
- package/dist/_chunks/add.mjs.map +1 -1
- package/dist/_chunks/agent-prompt.mjs +4 -4
- package/dist/_chunks/agent-prompt.mjs.map +1 -1
- package/dist/_chunks/agent.mjs +282 -109
- package/dist/_chunks/agent.mjs.map +1 -1
- package/dist/_chunks/args.mjs +2 -2
- package/dist/_chunks/args.mjs.map +1 -1
- package/dist/_chunks/assemble.mjs +4 -4
- package/dist/_chunks/assemble.mjs.map +1 -1
- package/dist/_chunks/author.mjs +12 -11
- package/dist/_chunks/author.mjs.map +1 -1
- package/dist/_chunks/cache.mjs +21 -138
- package/dist/_chunks/cache.mjs.map +1 -1
- package/dist/_chunks/cache2.mjs +3 -3
- package/dist/_chunks/cache2.mjs.map +1 -1
- package/dist/_chunks/client.mjs +4 -3
- package/dist/_chunks/client.mjs.map +1 -1
- package/dist/_chunks/core.mjs +1 -1
- package/dist/_chunks/detect.mjs +1 -1
- package/dist/_chunks/detect.mjs.map +1 -1
- package/dist/_chunks/detect2.mjs +1 -1
- package/dist/_chunks/eject.mjs +7 -7
- package/dist/_chunks/eject.mjs.map +1 -1
- package/dist/_chunks/embedding-cache.mjs +1 -1
- package/dist/_chunks/embedding-cache2.mjs +14 -13
- package/dist/_chunks/embedding-cache2.mjs.map +1 -1
- package/dist/_chunks/env.mjs +1 -1
- package/dist/_chunks/env.mjs.map +1 -1
- package/dist/_chunks/index-identity.mjs +365 -0
- package/dist/_chunks/index-identity.mjs.map +1 -0
- package/dist/_chunks/index-identity2.mjs +2 -0
- package/dist/_chunks/install-many.mjs +20 -18
- package/dist/_chunks/install-many.mjs.map +1 -1
- package/dist/_chunks/install.mjs +34 -29
- package/dist/_chunks/install.mjs.map +1 -1
- package/dist/_chunks/intro.mjs +6 -6
- package/dist/_chunks/intro.mjs.map +1 -1
- package/dist/_chunks/list.mjs +5 -4
- package/dist/_chunks/list.mjs.map +1 -1
- package/dist/_chunks/lockfile.mjs +8 -6
- package/dist/_chunks/lockfile.mjs.map +1 -1
- package/dist/_chunks/login.mjs +7 -6
- package/dist/_chunks/login.mjs.map +1 -1
- package/dist/_chunks/logout.mjs +2 -2
- package/dist/_chunks/logout.mjs.map +1 -1
- package/dist/_chunks/map.mjs +1 -1
- package/dist/_chunks/map.mjs.map +1 -1
- package/dist/_chunks/markdown.mjs +2 -2
- package/dist/_chunks/markdown.mjs.map +1 -1
- package/dist/_chunks/menu.mjs +1 -1
- package/dist/_chunks/menu.mjs.map +1 -1
- package/dist/_chunks/model-picker.mjs +1 -1
- package/dist/_chunks/model-picker.mjs.map +1 -1
- package/dist/_chunks/monorepo.mjs +5 -4
- package/dist/_chunks/monorepo.mjs.map +1 -1
- package/dist/_chunks/package-json.mjs +7 -5
- package/dist/_chunks/package-json.mjs.map +1 -1
- package/dist/_chunks/paths.mjs +1 -1
- package/dist/_chunks/paths.mjs.map +1 -1
- package/dist/_chunks/pipeline.mjs +34 -26
- package/dist/_chunks/pipeline.mjs.map +1 -1
- package/dist/_chunks/pool.mjs +1 -1
- package/dist/_chunks/pool2.mjs +2 -2
- package/dist/_chunks/pool2.mjs.map +1 -1
- package/dist/_chunks/portable.mjs +8 -7
- package/dist/_chunks/portable.mjs.map +1 -1
- package/dist/_chunks/prepare-hook.mjs +1 -1
- package/dist/_chunks/prepare-hook2.mjs +3 -3
- package/dist/_chunks/prepare-hook2.mjs.map +1 -1
- package/dist/_chunks/prepare.mjs +17 -11
- package/dist/_chunks/prepare.mjs.map +1 -1
- package/dist/_chunks/prepare2.mjs +12 -10
- package/dist/_chunks/prepare2.mjs.map +1 -1
- package/dist/_chunks/prompts.mjs +8 -6
- package/dist/_chunks/prompts.mjs.map +1 -1
- package/dist/_chunks/pull.mjs +9 -8
- package/dist/_chunks/pull.mjs.map +1 -1
- package/dist/_chunks/regex.mjs +1 -1
- package/dist/_chunks/retriv.mjs +2 -2
- package/dist/_chunks/retriv2.mjs +22 -4
- package/dist/_chunks/retriv2.mjs.map +1 -1
- package/dist/_chunks/sanitize.mjs +1 -1
- package/dist/_chunks/sanitize.mjs.map +1 -1
- package/dist/_chunks/search-helpers.mjs +5 -5
- package/dist/_chunks/search-helpers.mjs.map +1 -1
- package/dist/_chunks/search-interactive.mjs +4 -4
- package/dist/_chunks/search-interactive.mjs.map +1 -1
- package/dist/_chunks/search.mjs +6 -6
- package/dist/_chunks/search.mjs.map +1 -1
- package/dist/_chunks/semver.mjs +111 -77
- package/dist/_chunks/semver.mjs.map +1 -1
- package/dist/_chunks/skill-installer.mjs +1 -1
- package/dist/_chunks/skill-installer2.mjs +26 -17
- package/dist/_chunks/skill-installer2.mjs.map +1 -1
- package/dist/_chunks/skills.mjs +7 -7
- package/dist/_chunks/skills.mjs.map +1 -1
- package/dist/_chunks/store.mjs +2 -2
- package/dist/_chunks/store.mjs.map +1 -1
- package/dist/_chunks/sync.mjs +26 -19
- package/dist/_chunks/sync.mjs.map +1 -1
- package/dist/_chunks/sync2.mjs +1 -1
- package/dist/_chunks/telemetry.mjs +3 -3
- package/dist/_chunks/telemetry.mjs.map +1 -1
- package/dist/_chunks/uninstall.mjs +32 -28
- package/dist/_chunks/uninstall.mjs.map +1 -1
- package/dist/_chunks/update.mjs +14 -13
- package/dist/_chunks/update.mjs.map +1 -1
- package/dist/_chunks/upload.mjs +13 -10
- package/dist/_chunks/upload.mjs.map +1 -1
- package/dist/_chunks/validate.mjs +1 -1
- package/dist/_chunks/validate.mjs.map +1 -1
- package/dist/_chunks/version.mjs +1 -1
- package/dist/_chunks/version.mjs.map +1 -1
- package/dist/_chunks/whoami.mjs +1 -1
- package/dist/_chunks/whoami.mjs.map +1 -1
- package/dist/_chunks/wizard.mjs +1 -1
- package/dist/_chunks/wizard2.mjs +8 -8
- package/dist/_chunks/wizard2.mjs.map +1 -1
- package/dist/_chunks/yaml.mjs +1 -1
- package/dist/_chunks/yaml.mjs.map +1 -1
- package/dist/cli-entry.d.mts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +111 -35
- package/dist/cli.mjs.map +1 -1
- package/dist/prepare.d.mts +1 -1
- package/dist/prepare.mjs +6 -4
- package/dist/prepare.mjs.map +1 -1
- package/dist/retriv/worker.d.mts.map +1 -1
- package/dist/retriv/worker.mjs +11 -5
- package/dist/retriv/worker.mjs.map +1 -1
- package/package.json +24 -24
package/dist/_chunks/semver.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { getBlogPreset, getCrawlUrl, getDocOverride } from "./prompts.mjs";
|
|
2
|
+
import { GITHUB_SSH_URL_PREFIX_RE, GIT_PLUS_PREFIX_RE, GIT_PROTOCOL_PREFIX_RE, GIT_SUFFIX_RE, LEADING_SLASH_RE, NPM_SCOPE_PREFIX_RE, NPM_SCOPE_WITH_SLASH_RE, README_FILENAME_RE, TRAILING_SLASH_RE, VERSION_RANGE_PREFIX_RE, V_PREFIX_RE } from "./regex.mjs";
|
|
3
|
+
import { yamlEscape } from "./yaml.mjs";
|
|
4
|
+
import { getCacheDir } from "./prepare.mjs";
|
|
5
|
+
import { readPackageJsonSafe } from "./package-json.mjs";
|
|
6
6
|
import "./cache.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { mapInsert } from "./map.mjs";
|
|
8
|
+
import { extractDescription, extractLinks, extractTitle, parseFrontmatter } from "./markdown.mjs";
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
10
|
import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
11
11
|
import pLimit from "p-limit";
|
|
@@ -19,10 +19,10 @@ import { ofetch } from "ofetch";
|
|
|
19
19
|
import { crawlAndGenerate } from "@mdream/crawl";
|
|
20
20
|
import { downloadTemplate } from "giget";
|
|
21
21
|
import { Writable } from "node:stream";
|
|
22
|
-
import {
|
|
22
|
+
import { difference, isGreater, normalize } from "verkit";
|
|
23
23
|
const STATIC_REGEX_1$9 = /```[\s\S]*?```/;
|
|
24
24
|
const STATIC_REGEX_2$4 = /`[^`]+`/;
|
|
25
|
-
const BOT_USERS = new Set([
|
|
25
|
+
const BOT_USERS = /* @__PURE__ */ new Set([
|
|
26
26
|
"renovate[bot]",
|
|
27
27
|
"dependabot[bot]",
|
|
28
28
|
"renovate-bot",
|
|
@@ -332,7 +332,7 @@ async function fetchChangelog(owner, repo, ref, packageName) {
|
|
|
332
332
|
if (packageName) {
|
|
333
333
|
const shortName = packageName.replace(NPM_SCOPE_WITH_SLASH_RE, "");
|
|
334
334
|
const scopeless = packageName.replace(NPM_SCOPE_PREFIX_RE, "").replace("/", "-");
|
|
335
|
-
const candidates = [
|
|
335
|
+
const candidates = [.../* @__PURE__ */ new Set([shortName, scopeless])];
|
|
336
336
|
for (const name of candidates) paths.push(`packages/${name}/CHANGELOG.md`);
|
|
337
337
|
}
|
|
338
338
|
paths.push("CHANGELOG.md", "changelog.md", "CHANGES.md");
|
|
@@ -505,7 +505,7 @@ function isLikelyCodeHostUrl(url) {
|
|
|
505
505
|
return false;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
const USELESS_HOSTS = new Set([
|
|
508
|
+
const USELESS_HOSTS = /* @__PURE__ */ new Set([
|
|
509
509
|
"twitter.com",
|
|
510
510
|
"x.com",
|
|
511
511
|
"facebook.com",
|
|
@@ -598,7 +598,7 @@ const isShallowGitDocs = (n) => n > 0 && n < 5;
|
|
|
598
598
|
function filterDocFiles(files, pathPrefix) {
|
|
599
599
|
return files.filter((f) => f.startsWith(pathPrefix) && STATIC_REGEX_1$6.test(f));
|
|
600
600
|
}
|
|
601
|
-
const FRAMEWORK_NAMES = new Set([
|
|
601
|
+
const FRAMEWORK_NAMES = /* @__PURE__ */ new Set([
|
|
602
602
|
"vue",
|
|
603
603
|
"react",
|
|
604
604
|
"solid",
|
|
@@ -623,7 +623,7 @@ const NOISE_PATTERNS = [
|
|
|
623
623
|
/CONTRIBUTING\.md$/i,
|
|
624
624
|
/^\.github\//
|
|
625
625
|
];
|
|
626
|
-
const EXCLUDE_DIRS = new Set([
|
|
626
|
+
const EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
627
627
|
"test",
|
|
628
628
|
"tests",
|
|
629
629
|
"__tests__",
|
|
@@ -641,7 +641,7 @@ const EXCLUDE_DIRS = new Set([
|
|
|
641
641
|
"mocks",
|
|
642
642
|
"__mocks__"
|
|
643
643
|
]);
|
|
644
|
-
const DOC_DIR_BONUS = new Set([
|
|
644
|
+
const DOC_DIR_BONUS = /* @__PURE__ */ new Set([
|
|
645
645
|
"docs",
|
|
646
646
|
"documentation",
|
|
647
647
|
"pages",
|
|
@@ -680,7 +680,8 @@ function discoverDocFiles(allFiles, packageName) {
|
|
|
680
680
|
for (const file of mdFiles) {
|
|
681
681
|
const docsIdx = file.lastIndexOf("/docs/");
|
|
682
682
|
if (docsIdx === -1) continue;
|
|
683
|
-
|
|
683
|
+
const prefix = file.slice(0, docsIdx + 6);
|
|
684
|
+
mapInsert(docsGroups, prefix, () => []).push(file);
|
|
684
685
|
}
|
|
685
686
|
if (docsGroups.size > 0) {
|
|
686
687
|
const largest = [...docsGroups.entries()].sort((a, b) => b[1].length - a[1].length)[0];
|
|
@@ -699,7 +700,8 @@ function discoverDocFiles(allFiles, packageName) {
|
|
|
699
700
|
if (hasExcludedDir(file)) continue;
|
|
700
701
|
const lastSlash = file.lastIndexOf("/");
|
|
701
702
|
if (lastSlash === -1) continue;
|
|
702
|
-
|
|
703
|
+
const dir = file.slice(0, lastSlash + 1);
|
|
704
|
+
mapInsert(dirGroups, dir, () => []).push(file);
|
|
703
705
|
}
|
|
704
706
|
if (dirGroups.size === 0) return null;
|
|
705
707
|
const scored = Array.from(dirGroups.entries(), ([dir, files]) => ({
|
|
@@ -795,7 +797,7 @@ function isGhAvailable() {
|
|
|
795
797
|
const { status } = spawnSync("gh", ["auth", "status"], { stdio: "ignore" });
|
|
796
798
|
return _ghAvailable = status === 0;
|
|
797
799
|
}
|
|
798
|
-
const NOISE_LABELS = new Set([
|
|
800
|
+
const NOISE_LABELS = /* @__PURE__ */ new Set([
|
|
799
801
|
"duplicate",
|
|
800
802
|
"stale",
|
|
801
803
|
"invalid",
|
|
@@ -806,7 +808,7 @@ const NOISE_LABELS = new Set([
|
|
|
806
808
|
"needs triage",
|
|
807
809
|
"triage"
|
|
808
810
|
]);
|
|
809
|
-
const FEATURE_LABELS = new Set([
|
|
811
|
+
const FEATURE_LABELS = /* @__PURE__ */ new Set([
|
|
810
812
|
"enhancement",
|
|
811
813
|
"feature",
|
|
812
814
|
"feature request",
|
|
@@ -816,7 +818,7 @@ const FEATURE_LABELS = new Set([
|
|
|
816
818
|
"idea",
|
|
817
819
|
"suggestion"
|
|
818
820
|
]);
|
|
819
|
-
const BUG_LABELS = new Set([
|
|
821
|
+
const BUG_LABELS = /* @__PURE__ */ new Set([
|
|
820
822
|
"bug",
|
|
821
823
|
"defect",
|
|
822
824
|
"regression",
|
|
@@ -826,7 +828,7 @@ const BUG_LABELS = new Set([
|
|
|
826
828
|
"confirmed",
|
|
827
829
|
"verified"
|
|
828
830
|
]);
|
|
829
|
-
const QUESTION_LABELS = new Set([
|
|
831
|
+
const QUESTION_LABELS = /* @__PURE__ */ new Set([
|
|
830
832
|
"question",
|
|
831
833
|
"help wanted",
|
|
832
834
|
"support",
|
|
@@ -835,7 +837,7 @@ const QUESTION_LABELS = new Set([
|
|
|
835
837
|
"help",
|
|
836
838
|
"assistance"
|
|
837
839
|
]);
|
|
838
|
-
const DOCS_LABELS = new Set([
|
|
840
|
+
const DOCS_LABELS = /* @__PURE__ */ new Set([
|
|
839
841
|
"documentation",
|
|
840
842
|
"docs",
|
|
841
843
|
"doc",
|
|
@@ -875,7 +877,7 @@ function isNonTechnical(issue) {
|
|
|
875
877
|
return false;
|
|
876
878
|
}
|
|
877
879
|
function freshnessScore(reactions, createdAt) {
|
|
878
|
-
return reactions * (1 / (1 + (Date.now() - new Date(createdAt).getTime()) /
|
|
880
|
+
return reactions * (1 / (1 + (Date.now() - new Date(createdAt).getTime()) / 315576e5 * .6));
|
|
879
881
|
}
|
|
880
882
|
function applyTypeQuotas(issues, limit) {
|
|
881
883
|
const byType = /* @__PURE__ */ new Map();
|
|
@@ -919,25 +921,27 @@ function fetchIssuesByState(owner, repo, state, count, releasedAt, fromDate) {
|
|
|
919
921
|
const fetchCount = Math.min(count * 3, 100);
|
|
920
922
|
let datePart = "";
|
|
921
923
|
if (fromDate) datePart = state === "closed" ? `+closed:>=${fromDate}` : `+created:>=${fromDate}`;
|
|
922
|
-
else if (state === "closed")
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
924
|
+
else if (state === "closed") {
|
|
925
|
+
if (releasedAt) {
|
|
926
|
+
datePart = `+closed:>=${isoDate(releasedAt)}`;
|
|
927
|
+
const cap = new Date(releasedAt);
|
|
928
|
+
cap.setMonth(cap.getMonth() + 6);
|
|
929
|
+
if (cap < /* @__PURE__ */ new Date()) datePart += `+closed:<=${isoDate(cap.toISOString())}`;
|
|
930
|
+
} else datePart = `+closed:>${oneYearAgo()}`;
|
|
931
|
+
} else if (releasedAt) {
|
|
929
932
|
const date = new Date(releasedAt);
|
|
930
933
|
date.setMonth(date.getMonth() + 6);
|
|
931
934
|
datePart = `+created:<=${isoDate(date.toISOString())}`;
|
|
932
935
|
}
|
|
936
|
+
const q = `repo:${owner}/${repo}+is:issue+is:${state}${datePart}`;
|
|
933
937
|
const { stdout: result } = spawnSync("gh", [
|
|
934
938
|
"api",
|
|
935
|
-
`search/issues?q=${
|
|
939
|
+
`search/issues?q=${q}&sort=reactions&order=desc&per_page=${fetchCount}`,
|
|
936
940
|
"-q",
|
|
937
941
|
".items[] | {number, title, state, labels: [.labels[]?.name], body, createdAt: .created_at, url: .html_url, reactions: .reactions[\"+1\"], comments: .comments, user: .user.login, userType: .user.type, authorAssociation: .author_association}"
|
|
938
942
|
], {
|
|
939
943
|
encoding: "utf-8",
|
|
940
|
-
maxBuffer:
|
|
944
|
+
maxBuffer: 10485760
|
|
941
945
|
});
|
|
942
946
|
if (!result) return [];
|
|
943
947
|
return result.trim().split("\n").filter(Boolean).map((line) => JSON.parse(line)).filter((issue) => !BOT_USERS.has(issue.user) && issue.userType !== "Bot").filter((issue) => !isNoiseIssue(issue)).filter((issue) => !isNonTechnical(issue)).map(({ user: _, userType: __, authorAssociation, ...issue }) => {
|
|
@@ -976,7 +980,7 @@ function enrichWithComments(owner, repo, issues, topN = 15) {
|
|
|
976
980
|
`repo=${repo}`
|
|
977
981
|
], {
|
|
978
982
|
encoding: "utf-8",
|
|
979
|
-
maxBuffer:
|
|
983
|
+
maxBuffer: 10485760
|
|
980
984
|
});
|
|
981
985
|
if (!result) return;
|
|
982
986
|
const repo_ = JSON.parse(result)?.data?.repository;
|
|
@@ -1199,7 +1203,8 @@ async function searchGitHubRepo(packageName) {
|
|
|
1199
1203
|
if (gh && await verifyNpmRepo(gh.owner, gh.repo, packageName)) return `https://github.com/${candidate.fullName}`;
|
|
1200
1204
|
}
|
|
1201
1205
|
} catch {}
|
|
1202
|
-
const
|
|
1206
|
+
const query = encodeURIComponent(`${searchTerm} in:name`);
|
|
1207
|
+
const data = await $fetch(`https://api.github.com/search/repositories?q=${query}&per_page=5`).catch(() => null);
|
|
1203
1208
|
if (!data?.items?.length) return null;
|
|
1204
1209
|
const match = data.items.find((r) => r.full_name.toLowerCase().endsWith(`/${packageName.toLowerCase()}`) || r.full_name.toLowerCase().endsWith(`/${shortName.toLowerCase()}`));
|
|
1205
1210
|
if (match) return `https://github.com/${match.full_name}`;
|
|
@@ -1259,7 +1264,8 @@ async function fetchReadmeContent(url) {
|
|
|
1259
1264
|
const owner = parts[0];
|
|
1260
1265
|
const repo = parts[1];
|
|
1261
1266
|
const subdir = parts.slice(2).join("/");
|
|
1262
|
-
const
|
|
1267
|
+
const unghUrl = subdir ? `https://ungh.cc/repos/${owner}/${repo}/files/${ref}/${subdir}/README.md` : `https://ungh.cc/repos/${owner}/${repo}/readme?ref=${ref}`;
|
|
1268
|
+
const text = await $fetch(unghUrl, { responseType: "text" }).catch(() => null);
|
|
1263
1269
|
if (!text) return null;
|
|
1264
1270
|
try {
|
|
1265
1271
|
const json = JSON.parse(text);
|
|
@@ -1522,7 +1528,7 @@ const HTML_LANG_RE = /<html[^>]*\slang=["']([^"']+)["']/i;
|
|
|
1522
1528
|
function extractHtmlLang(html) {
|
|
1523
1529
|
return HTML_LANG_RE.exec(html)?.[1]?.toLowerCase();
|
|
1524
1530
|
}
|
|
1525
|
-
const LOCALE_CODES = new Set([
|
|
1531
|
+
const LOCALE_CODES = /* @__PURE__ */ new Set([
|
|
1526
1532
|
"ar",
|
|
1527
1533
|
"de",
|
|
1528
1534
|
"es",
|
|
@@ -1557,13 +1563,13 @@ function getUserLang() {
|
|
|
1557
1563
|
function toCrawlPattern(docsUrl) {
|
|
1558
1564
|
return `${docsUrl.replace(STATIC_REGEX_3, "")}/**`;
|
|
1559
1565
|
}
|
|
1560
|
-
const HIGH_VALUE_CATEGORIES = new Set([
|
|
1566
|
+
const HIGH_VALUE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
1561
1567
|
"q&a",
|
|
1562
1568
|
"help",
|
|
1563
1569
|
"troubleshooting",
|
|
1564
1570
|
"support"
|
|
1565
1571
|
]);
|
|
1566
|
-
const LOW_VALUE_CATEGORIES = new Set([
|
|
1572
|
+
const LOW_VALUE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
1567
1573
|
"show and tell",
|
|
1568
1574
|
"ideas",
|
|
1569
1575
|
"polls"
|
|
@@ -1599,18 +1605,19 @@ async function fetchGitHubDiscussions(owner, repo, limit = 20, releasedAt, fromD
|
|
|
1599
1605
|
if (cutoff < /* @__PURE__ */ new Date()) return [];
|
|
1600
1606
|
}
|
|
1601
1607
|
try {
|
|
1608
|
+
const query = `query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { discussions(first: ${Math.min(limit * 3, 80)}, orderBy: {field: CREATED_AT, direction: DESC}) { nodes { number title body category { name } createdAt url upvoteCount comments(first: 10) { totalCount nodes { body author { login } authorAssociation reactions { totalCount } } } answer { body author { login } authorAssociation } author { login } authorAssociation } } } }`;
|
|
1602
1609
|
const { stdout: result } = spawnSync("gh", [
|
|
1603
1610
|
"api",
|
|
1604
1611
|
"graphql",
|
|
1605
1612
|
"-f",
|
|
1606
|
-
`query=${
|
|
1613
|
+
`query=${query}`,
|
|
1607
1614
|
"-f",
|
|
1608
1615
|
`owner=${owner}`,
|
|
1609
1616
|
"-f",
|
|
1610
1617
|
`repo=${repo}`
|
|
1611
1618
|
], {
|
|
1612
1619
|
encoding: "utf-8",
|
|
1613
|
-
maxBuffer:
|
|
1620
|
+
maxBuffer: 10485760
|
|
1614
1621
|
});
|
|
1615
1622
|
if (!result) return [];
|
|
1616
1623
|
const nodes = JSON.parse(result)?.data?.repository?.discussions?.nodes;
|
|
@@ -1704,7 +1711,10 @@ function formatDiscussionAsMarkdown(d) {
|
|
|
1704
1711
|
}
|
|
1705
1712
|
function generateDiscussionIndex(discussions) {
|
|
1706
1713
|
const byCategory = /* @__PURE__ */ new Map();
|
|
1707
|
-
for (const d of discussions)
|
|
1714
|
+
for (const d of discussions) {
|
|
1715
|
+
const cat = d.category || "Uncategorized";
|
|
1716
|
+
mapInsert(byCategory, cat, () => []).push(d);
|
|
1717
|
+
}
|
|
1708
1718
|
const answered = discussions.filter((d) => d.answer).length;
|
|
1709
1719
|
const sections = [
|
|
1710
1720
|
[
|
|
@@ -1804,7 +1814,7 @@ const SKIP_PATTERNS = [
|
|
|
1804
1814
|
"LICENSE*",
|
|
1805
1815
|
"README*"
|
|
1806
1816
|
];
|
|
1807
|
-
const MAX_FILE_SIZE =
|
|
1817
|
+
const MAX_FILE_SIZE = 512e3;
|
|
1808
1818
|
async function resolveEntryFiles(packageDir) {
|
|
1809
1819
|
if (!existsSync(join(packageDir, "package.json"))) return [];
|
|
1810
1820
|
const skipDirSet = new Set(SKIP_DIRS);
|
|
@@ -1844,6 +1854,19 @@ async function resolveEntryFiles(packageDir) {
|
|
|
1844
1854
|
return entries;
|
|
1845
1855
|
}
|
|
1846
1856
|
const STATIC_REGEX_1$3 = /^[\w.-]+\/[\w.-]+$/;
|
|
1857
|
+
const SKILL_ROOTS = [
|
|
1858
|
+
"skills",
|
|
1859
|
+
".agents/skills",
|
|
1860
|
+
".claude/skills",
|
|
1861
|
+
".github/skills"
|
|
1862
|
+
];
|
|
1863
|
+
function prepareGitSkillDir(skillDir) {
|
|
1864
|
+
if (existsSync(skillDir)) rmSync(skillDir, {
|
|
1865
|
+
recursive: true,
|
|
1866
|
+
force: true
|
|
1867
|
+
});
|
|
1868
|
+
mkdirSync(skillDir, { recursive: true });
|
|
1869
|
+
}
|
|
1847
1870
|
function parseGitSkillInput(input) {
|
|
1848
1871
|
const trimmed = input.trim();
|
|
1849
1872
|
if (trimmed.startsWith("@")) return null;
|
|
@@ -1951,10 +1974,12 @@ function fetchLocalSkills(source) {
|
|
|
1951
1974
|
const base = source.localPath;
|
|
1952
1975
|
if (!existsSync(base)) return { skills: [] };
|
|
1953
1976
|
const skills = [];
|
|
1954
|
-
const
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1977
|
+
for (const root of SKILL_ROOTS) {
|
|
1978
|
+
const skillsDir = resolve(base, root);
|
|
1979
|
+
if (existsSync(skillsDir)) for (const { dir, repoPath } of findSkillDirs(skillsDir, root)) {
|
|
1980
|
+
const skill = readLocalSkill(dir, repoPath);
|
|
1981
|
+
if (skill) skills.push(skill);
|
|
1982
|
+
}
|
|
1958
1983
|
}
|
|
1959
1984
|
if (skills.length === 0) {
|
|
1960
1985
|
const skill = readLocalSkill(base, "");
|
|
@@ -2002,23 +2027,25 @@ async function downloadGitHubSkills(owner, repo, ref, skillPath, onProgress) {
|
|
|
2002
2027
|
const skill = readLocalSkill(dir, skillPath);
|
|
2003
2028
|
return skill ? [skill] : [];
|
|
2004
2029
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
dir
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2030
|
+
for (const root of SKILL_ROOTS) {
|
|
2031
|
+
onProgress?.(`Downloading ${owner}/${repo}/${root}@${ref}`);
|
|
2032
|
+
try {
|
|
2033
|
+
const { dir } = await downloadTemplate(`github:${owner}/${repo}/${root}#${ref}`, {
|
|
2034
|
+
dir: tempDir,
|
|
2035
|
+
force: true,
|
|
2036
|
+
auth: getGitHubToken() || void 0
|
|
2037
|
+
});
|
|
2038
|
+
const skills = [];
|
|
2039
|
+
for (const { dir: skillDir, repoPath } of findSkillDirs(dir, root)) {
|
|
2040
|
+
const skill = readLocalSkill(skillDir, repoPath);
|
|
2041
|
+
if (skill) skills.push(skill);
|
|
2042
|
+
}
|
|
2043
|
+
if (skills.length > 0) {
|
|
2044
|
+
onProgress?.(`Found ${skills.length} skill(s)`);
|
|
2045
|
+
return skills;
|
|
2046
|
+
}
|
|
2047
|
+
} catch {}
|
|
2048
|
+
}
|
|
2022
2049
|
const content = await fetchGitHubRaw(`https://raw.githubusercontent.com/${owner}/${repo}/${ref}/SKILL.md`);
|
|
2023
2050
|
if (content) {
|
|
2024
2051
|
const fm = parseSkillFrontmatterName(content);
|
|
@@ -2090,7 +2117,8 @@ async function fetchGitLabSkills(source, onProgress) {
|
|
|
2090
2117
|
const STATIC_REGEX_1$2 = /^[\^~>=<\d]/;
|
|
2091
2118
|
function parseVersionSpecifier(name, version, cwd) {
|
|
2092
2119
|
if (version.startsWith("link:")) {
|
|
2093
|
-
const
|
|
2120
|
+
const linkPath = resolve(cwd, version.slice(5));
|
|
2121
|
+
const linkedPkg = readPackageJsonSafe(join(linkPath, "package.json"));
|
|
2094
2122
|
if (linkedPkg) return {
|
|
2095
2123
|
name: linkedPkg.parsed.name || name,
|
|
2096
2124
|
version: linkedPkg.parsed.version || "0.0.0"
|
|
@@ -2123,14 +2151,17 @@ function parseVersionSpecifier(name, version, cwd) {
|
|
|
2123
2151
|
return null;
|
|
2124
2152
|
}
|
|
2125
2153
|
function resolveInstalledVersion(name, cwd) {
|
|
2126
|
-
const
|
|
2154
|
+
const directPackageJson = join(cwd, "node_modules", ...name.split("/"), "package.json");
|
|
2155
|
+
const direct = readPackageJsonSafe(directPackageJson);
|
|
2127
2156
|
if (direct) return direct.parsed.version || null;
|
|
2128
2157
|
const req = createRequire(join(cwd, "package.json"));
|
|
2129
2158
|
try {
|
|
2130
|
-
|
|
2159
|
+
const resolved = req.resolve(`${name}/package.json`);
|
|
2160
|
+
return readPackageJsonSafe(resolved)?.parsed.version || null;
|
|
2131
2161
|
} catch {
|
|
2132
2162
|
try {
|
|
2133
|
-
|
|
2163
|
+
const entry = req.resolve(name);
|
|
2164
|
+
let dir = dirname(entry);
|
|
2134
2165
|
while (dir && basename(dir) !== "node_modules") {
|
|
2135
2166
|
const pkg = readPackageJsonSafe(join(dir, "package.json"));
|
|
2136
2167
|
if (pkg) return pkg.parsed.version || null;
|
|
@@ -2143,7 +2174,8 @@ function resolveInstalledVersion(name, cwd) {
|
|
|
2143
2174
|
}
|
|
2144
2175
|
}
|
|
2145
2176
|
async function readLocalDependencies(cwd) {
|
|
2146
|
-
const
|
|
2177
|
+
const pkgPath = join(cwd, "package.json");
|
|
2178
|
+
const result = readPackageJsonSafe(pkgPath);
|
|
2147
2179
|
if (!result) throw new Error("No package.json found in current directory");
|
|
2148
2180
|
const pkg = result.parsed;
|
|
2149
2181
|
const deps = {
|
|
@@ -2645,12 +2677,14 @@ const defaultResolvers = [
|
|
|
2645
2677
|
if (!normalized.includes("://") && normalized.includes("/") && !normalized.includes(":")) result.repoUrl = `https://github.com/${normalized}`;
|
|
2646
2678
|
else result.repoUrl = normalized;
|
|
2647
2679
|
ctx.subdir = pkg.repository.directory;
|
|
2648
|
-
} else if (typeof pkg.repository === "string")
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2680
|
+
} else if (typeof pkg.repository === "string") {
|
|
2681
|
+
if (pkg.repository.includes("://")) {
|
|
2682
|
+
const gh = parseGitHubUrl(pkg.repository);
|
|
2683
|
+
if (gh) result.repoUrl = `https://github.com/${gh.owner}/${gh.repo}`;
|
|
2684
|
+
} else {
|
|
2685
|
+
const repo = pkg.repository.replace(STATIC_REGEX_1, "");
|
|
2686
|
+
if (repo.includes("/") && !repo.includes(":")) result.repoUrl = `https://github.com/${repo}`;
|
|
2687
|
+
}
|
|
2654
2688
|
}
|
|
2655
2689
|
if (pkg.homepage && !isGitHubRepoUrl(pkg.homepage) && !isUselessDocsUrl(pkg.homepage)) result.docsUrl = pkg.homepage;
|
|
2656
2690
|
ctx.npm = pkg;
|
|
@@ -2754,14 +2788,14 @@ async function resolvePackageOrCrate(packageSpec, opts) {
|
|
|
2754
2788
|
};
|
|
2755
2789
|
}
|
|
2756
2790
|
function semverValid(v) {
|
|
2757
|
-
return
|
|
2791
|
+
return normalize(v, { loose: true });
|
|
2758
2792
|
}
|
|
2759
2793
|
function semverGt(a, b) {
|
|
2760
|
-
return
|
|
2794
|
+
return isGreater(a, b, { loose: true });
|
|
2761
2795
|
}
|
|
2762
2796
|
function semverDiff(a, b) {
|
|
2763
|
-
return
|
|
2797
|
+
return difference(a, b);
|
|
2764
2798
|
}
|
|
2765
|
-
export {
|
|
2799
|
+
export { downloadLlmsDocs, fetchBlogReleases, fetchCrawledDocs, fetchGitDocs, fetchGitHubDiscussions, fetchGitHubIssues, fetchGitHubRaw, fetchGitSkills, fetchLatestVersion, fetchLlmsTxt, fetchNpmPackage, fetchNpmRegistryMeta, fetchPkgDist, fetchReadmeContent, fetchReleaseNotes, filterFrameworkDocs, formatDiscussionAsMarkdown, formatIssueAsMarkdown, generateDiscussionIndex, generateDocsIndex, generateIssueIndex, generateReleaseIndex, isCrateSpec, isGhAvailable, isPrerelease, isShallowGitDocs, normalizeLlmsLinks, parseGitHubRepoSlug, parseGitHubUrl, parsePackageSpec, parseSkillInput, prepareGitSkillDir, readLocalDependencies, readLocalPackageInfo, resolveEntryFiles, resolveGitHubRepo, resolvePackageDocs, resolvePackageOrCrate, resolveSkillName, searchNpmPackages, semverDiff, semverGt, semverValid, toCrawlPattern, toStoragePackageName };
|
|
2766
2800
|
|
|
2767
2801
|
//# sourceMappingURL=semver.mjs.map
|