skild 0.2.2 → 0.2.3
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/index.js +76 -24
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -55,10 +55,10 @@ var logger = {
|
|
|
55
55
|
/**
|
|
56
56
|
* Log a skill entry with status indicator.
|
|
57
57
|
*/
|
|
58
|
-
skillEntry: (name,
|
|
58
|
+
skillEntry: (name, path3, hasSkillMd) => {
|
|
59
59
|
const status = hasSkillMd ? chalk.green("\u2713") : chalk.yellow("\u26A0");
|
|
60
60
|
console.log(` ${status} ${chalk.cyan(name)}`);
|
|
61
|
-
console.log(chalk.dim(` \u2514\u2500 ${
|
|
61
|
+
console.log(chalk.dim(` \u2514\u2500 ${path3}`));
|
|
62
62
|
},
|
|
63
63
|
/**
|
|
64
64
|
* Log installation result details.
|
|
@@ -136,7 +136,52 @@ async function reportDownload(record, registryOverride) {
|
|
|
136
136
|
|
|
137
137
|
// src/commands/list.ts
|
|
138
138
|
import chalk3 from "chalk";
|
|
139
|
+
import fs from "fs";
|
|
140
|
+
import path from "path";
|
|
139
141
|
import { PLATFORMS, listAllSkills, listSkills } from "@skild/core";
|
|
142
|
+
function toDisplayName(name, mapping) {
|
|
143
|
+
return mapping.get(name) || name;
|
|
144
|
+
}
|
|
145
|
+
function buildDisplayEntries(skills) {
|
|
146
|
+
const nameToDisplay = /* @__PURE__ */ new Map();
|
|
147
|
+
for (const skill of skills) {
|
|
148
|
+
const displayName = skill.record?.canonicalName || skill.name;
|
|
149
|
+
nameToDisplay.set(skill.name, displayName);
|
|
150
|
+
}
|
|
151
|
+
const entries = skills.map((skill) => {
|
|
152
|
+
const displayName = toDisplayName(skill.name, nameToDisplay);
|
|
153
|
+
const flags = [];
|
|
154
|
+
if (skill.record?.skillset || skill.record?.skill?.frontmatter?.skillset) {
|
|
155
|
+
flags.push("skillset");
|
|
156
|
+
}
|
|
157
|
+
if (skill.record?.dependedBy?.length) {
|
|
158
|
+
const dependedBy = skill.record.dependedBy.map((name) => toDisplayName(name, nameToDisplay));
|
|
159
|
+
flags.push(`dep of: ${dependedBy.join(", ")}`);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
name: displayName,
|
|
163
|
+
installDir: skill.installDir,
|
|
164
|
+
status: skill.hasSkillMd ? "ok" : "warn",
|
|
165
|
+
flags
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
for (const skill of skills) {
|
|
169
|
+
const inlineDeps = skill.record?.installedDependencies?.filter((dep) => dep.sourceType === "inline") || [];
|
|
170
|
+
if (!inlineDeps.length) continue;
|
|
171
|
+
const ownerName = toDisplayName(skill.name, nameToDisplay);
|
|
172
|
+
for (const dep of inlineDeps) {
|
|
173
|
+
const inlineDir = dep.inlinePath ? path.join(skill.installDir, dep.inlinePath) : path.join(skill.installDir, dep.name);
|
|
174
|
+
const hasSkillMd = fs.existsSync(path.join(inlineDir, "SKILL.md"));
|
|
175
|
+
entries.push({
|
|
176
|
+
name: dep.name,
|
|
177
|
+
installDir: inlineDir,
|
|
178
|
+
status: hasSkillMd ? "ok" : "warn",
|
|
179
|
+
flags: [`dep of: ${ownerName}`]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return entries;
|
|
184
|
+
}
|
|
140
185
|
async function list(options = {}) {
|
|
141
186
|
const scope = options.local ? "project" : "global";
|
|
142
187
|
const platform = options.target;
|
|
@@ -151,14 +196,15 @@ async function list(options = {}) {
|
|
|
151
196
|
console.log(chalk3.dim(`Use ${chalk3.cyan("skild install <source>")} to install a skill.`));
|
|
152
197
|
return;
|
|
153
198
|
}
|
|
199
|
+
const entries = buildDisplayEntries(skills);
|
|
154
200
|
console.log(chalk3.bold(`
|
|
155
|
-
\u{1F4E6} Installed Skills (${
|
|
201
|
+
\u{1F4E6} Installed Skills (${entries.length}) \u2014 ${platform} (${scope}):
|
|
156
202
|
`));
|
|
157
|
-
for (const
|
|
158
|
-
const status =
|
|
159
|
-
const
|
|
160
|
-
console.log(` ${status} ${chalk3.cyan(
|
|
161
|
-
console.log(chalk3.dim(` \u2514\u2500 ${
|
|
203
|
+
for (const entry of entries) {
|
|
204
|
+
const status = entry.status === "ok" ? chalk3.green("\u2713") : chalk3.yellow("\u26A0");
|
|
205
|
+
const label = entry.flags.length ? `${entry.name} (${entry.flags.join("; ")})` : entry.name;
|
|
206
|
+
console.log(` ${status} ${chalk3.cyan(label)}`);
|
|
207
|
+
console.log(chalk3.dim(` \u2514\u2500 ${entry.installDir}`));
|
|
162
208
|
}
|
|
163
209
|
console.log("");
|
|
164
210
|
return;
|
|
@@ -178,17 +224,18 @@ async function list(options = {}) {
|
|
|
178
224
|
`));
|
|
179
225
|
for (const p of PLATFORMS) {
|
|
180
226
|
const platformSkills = allSkills.filter((s) => s.platform === p).sort((a, b) => a.name.localeCompare(b.name));
|
|
181
|
-
const
|
|
227
|
+
const entries = buildDisplayEntries(platformSkills);
|
|
228
|
+
const header = `${p} (${entries.length})`;
|
|
182
229
|
console.log(chalk3.bold(` ${header}`));
|
|
183
|
-
if (
|
|
230
|
+
if (entries.length === 0) {
|
|
184
231
|
console.log(chalk3.dim(" (none)"));
|
|
185
232
|
continue;
|
|
186
233
|
}
|
|
187
|
-
for (const
|
|
188
|
-
const status =
|
|
189
|
-
const
|
|
190
|
-
console.log(` ${status} ${chalk3.cyan(
|
|
191
|
-
console.log(chalk3.dim(` \u2514\u2500 ${
|
|
234
|
+
for (const entry of entries) {
|
|
235
|
+
const status = entry.status === "ok" ? chalk3.green("\u2713") : chalk3.yellow("\u26A0");
|
|
236
|
+
const label = entry.flags.length ? `${entry.name} (${entry.flags.join("; ")})` : entry.name;
|
|
237
|
+
console.log(` ${status} ${chalk3.cyan(label)}`);
|
|
238
|
+
console.log(chalk3.dim(` \u2514\u2500 ${entry.installDir}`));
|
|
192
239
|
}
|
|
193
240
|
}
|
|
194
241
|
console.log("");
|
|
@@ -246,7 +293,12 @@ async function uninstall(skill, options = {}) {
|
|
|
246
293
|
const resolvedName = canonical.startsWith("@") && canonical.includes("/") ? canonicalNameToInstallDirName2(canonical) : canonical;
|
|
247
294
|
const spinner = createSpinner(`Uninstalling ${chalk5.cyan(canonical)} from ${chalk5.dim(platform)} (${scope})...`);
|
|
248
295
|
try {
|
|
249
|
-
uninstallSkill(resolvedName, {
|
|
296
|
+
uninstallSkill(resolvedName, {
|
|
297
|
+
platform,
|
|
298
|
+
scope,
|
|
299
|
+
allowMissingMetadata: Boolean(options.force),
|
|
300
|
+
withDeps: Boolean(options.withDeps)
|
|
301
|
+
});
|
|
250
302
|
spinner.succeed(`Uninstalled ${chalk5.green(canonical)}`);
|
|
251
303
|
} catch (error) {
|
|
252
304
|
spinner.fail(`Failed to uninstall ${chalk5.red(canonical)}`);
|
|
@@ -532,9 +584,9 @@ async function whoami() {
|
|
|
532
584
|
}
|
|
533
585
|
|
|
534
586
|
// src/commands/publish.ts
|
|
535
|
-
import
|
|
587
|
+
import fs2 from "fs";
|
|
536
588
|
import os from "os";
|
|
537
|
-
import
|
|
589
|
+
import path2 from "path";
|
|
538
590
|
import crypto from "crypto";
|
|
539
591
|
import * as tar from "tar";
|
|
540
592
|
import chalk13 from "chalk";
|
|
@@ -557,7 +609,7 @@ async function publish(options = {}) {
|
|
|
557
609
|
process.exitCode = 1;
|
|
558
610
|
return;
|
|
559
611
|
}
|
|
560
|
-
const dir =
|
|
612
|
+
const dir = path2.resolve(options.dir || process.cwd());
|
|
561
613
|
const validation = validateSkillDir(dir);
|
|
562
614
|
if (!validation.ok) {
|
|
563
615
|
console.error(chalk13.red("Skill validation failed:"));
|
|
@@ -614,8 +666,8 @@ async function publish(options = {}) {
|
|
|
614
666
|
return;
|
|
615
667
|
}
|
|
616
668
|
const spinner = createSpinner(`Publishing ${chalk13.cyan(`${name}@${version2}`)} to ${chalk13.dim(registry)}...`);
|
|
617
|
-
const tempDir =
|
|
618
|
-
const tarballPath =
|
|
669
|
+
const tempDir = fs2.mkdtempSync(path2.join(os.tmpdir(), "skild-publish-"));
|
|
670
|
+
const tarballPath = path2.join(tempDir, "skill.tgz");
|
|
619
671
|
try {
|
|
620
672
|
await tar.c(
|
|
621
673
|
{
|
|
@@ -627,7 +679,7 @@ async function publish(options = {}) {
|
|
|
627
679
|
},
|
|
628
680
|
["."]
|
|
629
681
|
);
|
|
630
|
-
const buf =
|
|
682
|
+
const buf = fs2.readFileSync(tarballPath);
|
|
631
683
|
const integrity = sha256Hex(buf);
|
|
632
684
|
const form = new FormData();
|
|
633
685
|
form.set("version", version2);
|
|
@@ -669,7 +721,7 @@ async function publish(options = {}) {
|
|
|
669
721
|
console.error(chalk13.red(message));
|
|
670
722
|
process.exitCode = 1;
|
|
671
723
|
} finally {
|
|
672
|
-
|
|
724
|
+
fs2.rmSync(tempDir, { recursive: true, force: true });
|
|
673
725
|
}
|
|
674
726
|
}
|
|
675
727
|
|
|
@@ -716,7 +768,7 @@ program.command("install <source>").alias("i").description("Install a Skill from
|
|
|
716
768
|
});
|
|
717
769
|
program.command("list").alias("ls").description("List installed Skills").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")} (optional; omit to list all)`).option("-l, --local", "List project-level directory instead of global").option("--json", "Output JSON").action(async (options) => list(options));
|
|
718
770
|
program.command("info <skill>").description("Show installed Skill details").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("--json", "Output JSON").action(async (skill, options) => info(skill, options));
|
|
719
|
-
program.command("uninstall <skill>").alias("rm").description("Uninstall a Skill").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("-f, --force", "Uninstall even if metadata is missing").action(async (skill, options) => uninstall(skill, options));
|
|
771
|
+
program.command("uninstall <skill>").alias("rm").description("Uninstall a Skill").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("-f, --force", "Uninstall even if metadata is missing").option("--with-deps", "Uninstall dependencies that are only required by this skill").action(async (skill, options) => uninstall(skill, options));
|
|
720
772
|
program.command("update [skill]").alias("up").description("Update one or all installed Skills").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("--json", "Output JSON").action(async (skill, options) => update(skill, options));
|
|
721
773
|
program.command("validate [target]").alias("v").description("Validate a Skill folder (path) or an installed Skill name").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("--json", "Output JSON").action(async (target, options) => validate(target, options));
|
|
722
774
|
program.command("init <name>").description("Create a new Skill project").option("--dir <path>", "Target directory (defaults to <name>)").option("--description <text>", "Skill description").option("-f, --force", "Overwrite target directory if it exists").action(async (name, options) => init(name, options));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skild",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "The npm for Agent Skills — Discover, install, manage, and publish AI Agent Skills with ease.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"commander": "^12.1.0",
|
|
38
38
|
"ora": "^8.0.1",
|
|
39
39
|
"tar": "^7.4.3",
|
|
40
|
-
"@skild/core": "^0.2.
|
|
40
|
+
"@skild/core": "^0.2.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^20.10.0",
|