skild 0.2.9 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +74 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { createRequire } from "module";
9
9
  import fs from "fs";
10
10
  import path from "path";
11
11
  import chalk2 from "chalk";
12
- import { fetchWithTimeout, installRegistrySkill, installSkill, isValidAlias, loadRegistryAuth, resolveRegistryAlias, resolveRegistryUrl, SkildError } from "@skild/core";
12
+ import { fetchWithTimeout, installRegistrySkill, installSkill, isValidAlias, loadRegistryAuth, resolveRegistryAlias, resolveRegistryUrl, SkildError, PLATFORMS } from "@skild/core";
13
13
 
14
14
  // src/utils/logger.ts
15
15
  import chalk from "chalk";
@@ -83,10 +83,16 @@ function looksLikeAlias(input) {
83
83
  return true;
84
84
  }
85
85
  async function install(source, options = {}) {
86
- const platform = options.target || "claude";
87
86
  const scope = options.local ? "project" : "global";
88
87
  const auth = loadRegistryAuth();
89
88
  const registryUrlForDeps = options.registry || auth?.registryUrl;
89
+ const all = Boolean(options.all);
90
+ const platform = options.target || "claude";
91
+ if (all && options.target) {
92
+ console.error(chalk2.red("Invalid options: use either --all or --target, not both."));
93
+ process.exitCode = 1;
94
+ return;
95
+ }
90
96
  let resolvedSource = source.trim();
91
97
  try {
92
98
  if (looksLikeAlias(resolvedSource)) {
@@ -101,29 +107,68 @@ async function install(source, options = {}) {
101
107
  process.exitCode = 1;
102
108
  return;
103
109
  }
104
- const spinner = createSpinner(`Installing ${chalk2.cyan(source)} to ${chalk2.dim(platform)} (${scope})...`);
110
+ const targets = all ? [...PLATFORMS] : [platform];
111
+ const results = [];
112
+ const errors = [];
113
+ const spinner = createSpinner(
114
+ all ? `Installing ${chalk2.cyan(source)} to ${chalk2.dim("all platforms")} (${scope})...` : `Installing ${chalk2.cyan(source)} to ${chalk2.dim(platform)} (${scope})...`
115
+ );
105
116
  try {
106
- const record = resolvedSource.startsWith("@") && resolvedSource.includes("/") ? await installRegistrySkill(
107
- { spec: resolvedSource, registryUrl: registryUrlForDeps },
108
- { platform, scope, force: Boolean(options.force) }
109
- ) : await installSkill({ source: resolvedSource }, { platform, scope, force: Boolean(options.force), registryUrl: registryUrlForDeps });
110
- const displayName = record.canonicalName || record.name;
111
- spinner.succeed(`Installed ${chalk2.green(displayName)} to ${chalk2.dim(record.installDir)}`);
112
- if (options.json) {
113
- console.log(JSON.stringify(record, null, 2));
114
- return;
117
+ for (const targetPlatform of targets) {
118
+ spinner.text = `Installing ${chalk2.cyan(source)} to ${chalk2.dim(targetPlatform)} (${scope})...`;
119
+ try {
120
+ const record = resolvedSource.startsWith("@") && resolvedSource.includes("/") ? await installRegistrySkill(
121
+ { spec: resolvedSource, registryUrl: registryUrlForDeps },
122
+ { platform: targetPlatform, scope, force: Boolean(options.force) }
123
+ ) : await installSkill(
124
+ { source: resolvedSource },
125
+ { platform: targetPlatform, scope, force: Boolean(options.force), registryUrl: registryUrlForDeps }
126
+ );
127
+ results.push(record);
128
+ void reportDownload(record, registryUrlForDeps);
129
+ } catch (error) {
130
+ const message = error instanceof SkildError ? error.message : error instanceof Error ? error.message : String(error);
131
+ errors.push({ platform: targetPlatform, error: message });
132
+ }
115
133
  }
116
- if (record.hasSkillMd) {
117
- logger.installDetail("SKILL.md found \u2713");
134
+ if (errors.length === 0) {
135
+ const displayName = results[0]?.canonicalName || results[0]?.name || source;
136
+ spinner.succeed(
137
+ all ? `Installed ${chalk2.green(displayName)} to ${chalk2.dim(`${results.length} platforms`)}` : `Installed ${chalk2.green(displayName)} to ${chalk2.dim(results[0]?.installDir || "")}`
138
+ );
118
139
  } else {
119
- logger.installDetail("Warning: No SKILL.md found", true);
140
+ spinner.fail(`Failed to install ${chalk2.red(source)} to ${errors.length}/${targets.length} platforms`);
141
+ }
142
+ if (options.json) {
143
+ if (!all) {
144
+ console.log(JSON.stringify(results[0] ?? null, null, 2));
145
+ } else {
146
+ console.log(JSON.stringify({ ok: errors.length === 0, source, resolvedSource, scope, results, errors }, null, 2));
147
+ }
148
+ process.exitCode = errors.length ? 1 : 0;
149
+ return;
120
150
  }
121
- if (record.skill?.validation && !record.skill.validation.ok) {
122
- logger.installDetail(`Validation: ${chalk2.yellow("failed")} (${record.skill.validation.issues.length} issues)`, true);
123
- } else if (record.skill?.validation?.ok) {
124
- logger.installDetail(`Validation: ${chalk2.green("ok")}`);
151
+ if (!all && results[0]) {
152
+ const record = results[0];
153
+ if (record.hasSkillMd) logger.installDetail("SKILL.md found \u2713");
154
+ else logger.installDetail("Warning: No SKILL.md found", true);
155
+ if (record.skill?.validation && !record.skill.validation.ok) {
156
+ logger.installDetail(`Validation: ${chalk2.yellow("failed")} (${record.skill.validation.issues.length} issues)`, true);
157
+ } else if (record.skill?.validation?.ok) {
158
+ logger.installDetail(`Validation: ${chalk2.green("ok")}`);
159
+ }
160
+ } else if (all) {
161
+ for (const r of results) {
162
+ const displayName = r.canonicalName || r.name;
163
+ const suffix = r.hasSkillMd ? chalk2.green("\u2713") : chalk2.yellow("\u26A0");
164
+ console.log(` ${suffix} ${chalk2.cyan(displayName)} \u2192 ${chalk2.dim(r.platform)}`);
165
+ }
166
+ if (errors.length) {
167
+ console.log(chalk2.yellow("\nFailures:"));
168
+ for (const e of errors) console.log(chalk2.yellow(` - ${e.platform}: ${e.error}`));
169
+ }
170
+ process.exitCode = errors.length ? 1 : 0;
125
171
  }
126
- void reportDownload(record, registryUrlForDeps);
127
172
  } catch (error) {
128
173
  spinner.fail(`Failed to install ${chalk2.red(source)}`);
129
174
  const message = error instanceof SkildError ? error.message : error instanceof Error ? error.message : String(error);
@@ -164,7 +209,7 @@ async function reportDownload(record, registryOverride) {
164
209
 
165
210
  // src/commands/list.ts
166
211
  import chalk3 from "chalk";
167
- import { PLATFORMS, listAllSkills, listSkills } from "@skild/core";
212
+ import { PLATFORMS as PLATFORMS2, listAllSkills, listSkills } from "@skild/core";
168
213
  function isSkillset(skill) {
169
214
  return Boolean(skill.record?.skillset || skill.record?.skill?.frontmatter?.skillset);
170
215
  }
@@ -300,7 +345,7 @@ async function list(options = {}) {
300
345
  console.log(chalk3.dim(`Use ${chalk3.cyan("skild install <source>")} to install a skill.`));
301
346
  return;
302
347
  }
303
- for (const p of PLATFORMS) {
348
+ for (const p of PLATFORMS2) {
304
349
  const platformSkills = allSkills.filter((s) => s.platform === p).sort((a, b) => a.name.localeCompare(b.name));
305
350
  if (platformSkills.length === 0) continue;
306
351
  printPlatform(platformSkills, p, scope, { paths, verbose });
@@ -912,19 +957,19 @@ async function search(query, options = {}) {
912
957
  }
913
958
 
914
959
  // src/index.ts
915
- import { PLATFORMS as PLATFORMS2 } from "@skild/core";
960
+ import { PLATFORMS as PLATFORMS3 } from "@skild/core";
916
961
  var require2 = createRequire(import.meta.url);
917
962
  var { version } = require2("../package.json");
918
963
  var program = new Command();
919
964
  program.name("skild").description("The npm for Agent Skills \u2014 Discover, install, manage, and publish AI Agent Skills with ease.").version(version);
920
- program.command("install <source>").alias("i").description("Install a Skill from a Git URL, degit shorthand, or local directory").option("-t, --target <platform>", `Target platform: ${PLATFORMS2.join(", ")}`, "claude").option("-l, --local", "Install to project-level directory instead of global").option("-f, --force", "Overwrite existing installation").option("--registry <url>", "Registry base URL (default: https://registry.skild.sh)").option("--json", "Output JSON").action(async (source, options) => {
965
+ program.command("install <source>").alias("i").description("Install a Skill from a Git URL, degit shorthand, or local directory").option("-t, --target <platform>", `Target platform: ${PLATFORMS3.join(", ")}`).option("--all", `Install to all platforms: ${PLATFORMS3.join(", ")}`).option("-l, --local", "Install to project-level directory instead of global").option("-f, --force", "Overwrite existing installation").option("--registry <url>", "Registry base URL (default: https://registry.skild.sh)").option("--json", "Output JSON").action(async (source, options) => {
921
966
  await install(source, options);
922
967
  });
923
- 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("--paths", "Show install paths").option("--verbose", "Show skillset dependency details").option("--json", "Output JSON").action(async (options) => list(options));
924
- 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));
925
- 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));
926
- 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));
927
- 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));
968
+ program.command("list").alias("ls").description("List installed Skills").option("-t, --target <platform>", `Target platform: ${PLATFORMS3.join(", ")} (optional; omit to list all)`).option("-l, --local", "List project-level directory instead of global").option("--paths", "Show install paths").option("--verbose", "Show skillset dependency details").option("--json", "Output JSON").action(async (options) => list(options));
969
+ program.command("info <skill>").description("Show installed Skill details").option("-t, --target <platform>", `Target platform: ${PLATFORMS3.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("--json", "Output JSON").action(async (skill, options) => info(skill, options));
970
+ program.command("uninstall <skill>").alias("rm").description("Uninstall a Skill").option("-t, --target <platform>", `Target platform: ${PLATFORMS3.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));
971
+ program.command("update [skill]").alias("up").description("Update one or all installed Skills").option("-t, --target <platform>", `Target platform: ${PLATFORMS3.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("--json", "Output JSON").action(async (skill, options) => update(skill, options));
972
+ program.command("validate [target]").alias("v").description("Validate a Skill folder (path) or an installed Skill name").option("-t, --target <platform>", `Target platform: ${PLATFORMS3.join(", ")}`, "claude").option("-l, --local", "Use project-level directory instead of global").option("--json", "Output JSON").action(async (target, options) => validate(target, options));
928
973
  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));
929
974
  program.command("signup").description("Create a publisher account in the registry (no GitHub required)").option("--registry <url>", "Registry base URL (default: https://registry.skild.sh)").option("--email <email>", "Email (optional; will prompt)").option("--handle <handle>", "Publisher handle (owns @handle/* scope) (optional; will prompt)").option("--password <password>", "Password (optional; will prompt)").option("--json", "Output JSON").action(async (options) => signup(options));
930
975
  program.command("login").description("Login to a registry and store an access token locally").option("--registry <url>", "Registry base URL (default: https://registry.skild.sh)").option("--handle-or-email <value>", "Handle or email (optional; will prompt)").option("--password <password>", "Password (optional; will prompt)").option("--token-name <name>", "Token label").option("--json", "Output JSON").action(async (options) => login(options));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skild",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
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",