add-skill 1.0.25 → 1.0.27

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 +24 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -173,6 +173,7 @@ async function parseSkillMd(skillMdPath) {
173
173
  name: data.name,
174
174
  description: data.description,
175
175
  path: dirname(skillMdPath),
176
+ rawContent: content,
176
177
  metadata: data.metadata
177
178
  };
178
179
  } catch {
@@ -1055,9 +1056,10 @@ registerProvider(huggingFaceProvider);
1055
1056
  import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
1056
1057
  import { join as join5, dirname as dirname2 } from "path";
1057
1058
  import { homedir as homedir3 } from "os";
1059
+ import { createHash } from "crypto";
1058
1060
  var AGENTS_DIR2 = ".agents";
1059
1061
  var LOCK_FILE = ".skill-lock.json";
1060
- var CURRENT_VERSION = 1;
1062
+ var CURRENT_VERSION = 3;
1061
1063
  function getSkillLockPath() {
1062
1064
  return join5(homedir3(), AGENTS_DIR2, LOCK_FILE);
1063
1065
  }
@@ -1069,6 +1071,12 @@ async function readSkillLock() {
1069
1071
  if (typeof parsed.version !== "number" || !parsed.skills) {
1070
1072
  return createEmptyLockFile();
1071
1073
  }
1074
+ if (parsed.version < 2) {
1075
+ return createEmptyLockFile();
1076
+ }
1077
+ if (parsed.version < CURRENT_VERSION) {
1078
+ parsed.version = CURRENT_VERSION;
1079
+ }
1072
1080
  return parsed;
1073
1081
  } catch (error) {
1074
1082
  return createEmptyLockFile();
@@ -1080,6 +1088,9 @@ async function writeSkillLock(lock) {
1080
1088
  const content = JSON.stringify(lock, null, 2);
1081
1089
  await writeFile2(lockPath, content, "utf-8");
1082
1090
  }
1091
+ function computeContentHash(content) {
1092
+ return createHash("sha256").update(content, "utf-8").digest("hex");
1093
+ }
1083
1094
  async function addSkillToLock(skillName, entry) {
1084
1095
  const lock = await readSkillLock();
1085
1096
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -1101,7 +1112,7 @@ function createEmptyLockFile() {
1101
1112
  // package.json
1102
1113
  var package_default = {
1103
1114
  name: "add-skill",
1104
- version: "1.0.25",
1115
+ version: "1.0.27",
1105
1116
  description: "Install agent skills onto coding agents (OpenCode, Claude Code, Codex, Cursor)",
1106
1117
  type: "module",
1107
1118
  bin: {
@@ -1456,10 +1467,13 @@ async function handleRemoteSkill(source, url, options, spinner2) {
1456
1467
  });
1457
1468
  if (successful.length > 0 && installGlobally) {
1458
1469
  try {
1470
+ const contentHash = computeContentHash(remoteSkill.content);
1459
1471
  await addSkillToLock(remoteSkill.installName, {
1460
1472
  source: remoteSkill.sourceIdentifier,
1461
1473
  sourceType: remoteSkill.providerId,
1462
- sourceUrl: url
1474
+ sourceUrl: url,
1475
+ contentHash
1476
+ // skillFolderHash will be populated by server during update check
1463
1477
  });
1464
1478
  } catch {
1465
1479
  }
@@ -1713,10 +1727,13 @@ async function handleDirectUrlSkillLegacy(source, url, options, spinner2) {
1713
1727
  });
1714
1728
  if (successful.length > 0 && installGlobally) {
1715
1729
  try {
1730
+ const contentHash = computeContentHash(mintlifySkill.content);
1716
1731
  await addSkillToLock(mintlifySkill.mintlifySite, {
1717
1732
  source: `mintlify/${mintlifySkill.mintlifySite}`,
1718
1733
  sourceType: "mintlify",
1719
- sourceUrl: url
1734
+ sourceUrl: url,
1735
+ contentHash
1736
+ // skillFolderHash will be populated by server during update check
1720
1737
  });
1721
1738
  } catch {
1722
1739
  }
@@ -2092,7 +2109,9 @@ async function main(source, options) {
2092
2109
  source: normalizedSource,
2093
2110
  sourceType: parsed.type,
2094
2111
  sourceUrl: parsed.url,
2095
- skillPath: skillFiles[skill.name]
2112
+ skillPath: skillFiles[skill.name],
2113
+ contentHash: skill.rawContent ? computeContentHash(skill.rawContent) : ""
2114
+ // skillFolderHash is populated by server via GitHub Trees API
2096
2115
  });
2097
2116
  } catch {
2098
2117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-skill",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "Install agent skills onto coding agents (OpenCode, Claude Code, Codex, Cursor)",
5
5
  "type": "module",
6
6
  "bin": {