skilld 0.3.0 → 0.3.1
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/dist/cli.mjs +38 -21
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import "./agent/index.mjs";
|
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { homedir } from "node:os";
|
|
12
12
|
import { join, relative, resolve } from "pathe";
|
|
13
|
-
import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { appendFileSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
14
14
|
import { execSync } from "node:child_process";
|
|
15
15
|
import pLimit from "p-limit";
|
|
16
16
|
import * as p from "@clack/prompts";
|
|
@@ -1340,7 +1340,7 @@ async function enhanceSkillWithLLM(opts) {
|
|
|
1340
1340
|
async function installCommand(opts) {
|
|
1341
1341
|
const cwd = process.cwd();
|
|
1342
1342
|
const agent = targets[opts.agent];
|
|
1343
|
-
const skillsDir = opts.global ? join(
|
|
1343
|
+
const skillsDir = opts.global ? join(homedir(), ".skilld", "skills") : join(cwd, agent.skillsDir);
|
|
1344
1344
|
const allSkillsDirs = Object.values(targets).map((t) => opts.global ? t.globalSkillsDir : join(cwd, t.skillsDir));
|
|
1345
1345
|
const allLocks = allSkillsDirs.map((dir) => readLock(dir)).filter((l) => !!l && Object.keys(l.skills).length > 0);
|
|
1346
1346
|
if (allLocks.length === 0) {
|
|
@@ -1418,13 +1418,15 @@ async function installCommand(opts) {
|
|
|
1418
1418
|
const cachedSections = join(globalCachePath, "sections");
|
|
1419
1419
|
if (existsSync(sectionsLink)) unlinkSync(sectionsLink);
|
|
1420
1420
|
if (existsSync(cachedSections)) symlinkSync(cachedSections, sectionsLink, "junction");
|
|
1421
|
-
if (
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1421
|
+
if (!copyFromExistingAgent(skillDir, name, allSkillsDirs)) {
|
|
1422
|
+
if (regenerateBaseSkillMd(skillDir, pkgName, version, cwd, allSkillNames, info.source, info.packages)) regenerated.push({
|
|
1423
|
+
name,
|
|
1424
|
+
pkgName,
|
|
1425
|
+
version,
|
|
1426
|
+
skillDir,
|
|
1427
|
+
packages: info.packages
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1428
1430
|
spin.stop(`Linked ${name}`);
|
|
1429
1431
|
continue;
|
|
1430
1432
|
}
|
|
@@ -1564,13 +1566,15 @@ async function installCommand(opts) {
|
|
|
1564
1566
|
type: e.type
|
|
1565
1567
|
}
|
|
1566
1568
|
})), { dbPath: getPackageDbPath(pkgName, version) });
|
|
1567
|
-
if (
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1569
|
+
if (!copyFromExistingAgent(skillDir, name, allSkillsDirs)) {
|
|
1570
|
+
if (regenerateBaseSkillMd(skillDir, pkgName, version, cwd, allSkillNames, info.source, info.packages)) regenerated.push({
|
|
1571
|
+
name,
|
|
1572
|
+
pkgName,
|
|
1573
|
+
version,
|
|
1574
|
+
skillDir,
|
|
1575
|
+
packages: info.packages
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1574
1578
|
spin.stop(`Downloaded and linked ${name}`);
|
|
1575
1579
|
} else spin.stop(`No docs found for ${name}`);
|
|
1576
1580
|
}
|
|
@@ -1587,6 +1591,20 @@ async function installCommand(opts) {
|
|
|
1587
1591
|
await shutdownWorker();
|
|
1588
1592
|
p.outro("Install complete");
|
|
1589
1593
|
}
|
|
1594
|
+
function copyFromExistingAgent(skillDir, name, allSkillsDirs) {
|
|
1595
|
+
const targetMd = join(skillDir, "SKILL.md");
|
|
1596
|
+
if (existsSync(targetMd)) return false;
|
|
1597
|
+
for (const dir of allSkillsDirs) {
|
|
1598
|
+
if (dir === skillDir) continue;
|
|
1599
|
+
const candidateMd = join(dir, name, "SKILL.md");
|
|
1600
|
+
if (existsSync(candidateMd) && !lstatSync(candidateMd).isSymbolicLink()) {
|
|
1601
|
+
mkdirSync(skillDir, { recursive: true });
|
|
1602
|
+
copyFileSync(candidateMd, targetMd);
|
|
1603
|
+
return true;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1590
1608
|
function unsanitizeName(sanitized, source) {
|
|
1591
1609
|
if (source?.includes("ungh://")) {
|
|
1592
1610
|
const match = source.match(/ungh:\/\/([^/]+)\/(.+)/);
|
|
@@ -2211,8 +2229,7 @@ async function interactiveSearch(packageFilter) {
|
|
|
2211
2229
|
stdin.on("data", onData);
|
|
2212
2230
|
});
|
|
2213
2231
|
}
|
|
2214
|
-
const
|
|
2215
|
-
const { version: skilldVersion } = require$1("../package.json");
|
|
2232
|
+
const version = createRequire(import.meta.url)("../package.json").version;
|
|
2216
2233
|
function countDocs(packageName, version) {
|
|
2217
2234
|
if (!version) return 0;
|
|
2218
2235
|
const cacheDir = getCacheDir(packageName, version);
|
|
@@ -2236,7 +2253,7 @@ function countEmbeddings(packageName, version) {
|
|
|
2236
2253
|
const dbPath = getPackageDbPath(packageName, version);
|
|
2237
2254
|
if (!existsSync(dbPath)) return null;
|
|
2238
2255
|
try {
|
|
2239
|
-
const { DatabaseSync } =
|
|
2256
|
+
const { DatabaseSync } = __require("node:sqlite");
|
|
2240
2257
|
const db = new DatabaseSync(dbPath, {
|
|
2241
2258
|
open: true,
|
|
2242
2259
|
readOnly: true
|
|
@@ -2281,7 +2298,7 @@ function getLastSynced$1() {
|
|
|
2281
2298
|
function buildConfigLines() {
|
|
2282
2299
|
const config = readConfig();
|
|
2283
2300
|
const lines = [];
|
|
2284
|
-
lines.push(`Version v${
|
|
2301
|
+
lines.push(`Version v${version}`);
|
|
2285
2302
|
const lastSynced = getLastSynced$1();
|
|
2286
2303
|
if (lastSynced) lines.push(`Synced ${dim(lastSynced)}`);
|
|
2287
2304
|
lines.push(`Config ${dim(join(CACHE_DIR, "config.yaml"))}${hasConfig() ? "" : dim(" (not created)")}`);
|
|
@@ -2599,7 +2616,6 @@ async function runWizard() {
|
|
|
2599
2616
|
}
|
|
2600
2617
|
const _emit = process.emit;
|
|
2601
2618
|
process.emit = (event, ...args) => event === "warning" && args[0]?.name === "ExperimentalWarning" && args[0]?.message?.includes("SQLite") ? false : _emit.apply(process, [event, ...args]);
|
|
2602
|
-
const { version } = createRequire(import.meta.url)("../package.json");
|
|
2603
2619
|
function getRepoHint(name, cwd) {
|
|
2604
2620
|
const pkgJsonPath = join(cwd, "node_modules", name, "package.json");
|
|
2605
2621
|
if (!existsSync(pkgJsonPath)) return void 0;
|
|
@@ -3060,6 +3076,7 @@ const searchSubCommand = defineCommand({
|
|
|
3060
3076
|
runMain(defineCommand({
|
|
3061
3077
|
meta: {
|
|
3062
3078
|
name: "skilld",
|
|
3079
|
+
version,
|
|
3063
3080
|
description: "Sync package documentation for agentic use"
|
|
3064
3081
|
},
|
|
3065
3082
|
args: {
|