ali-skills 0.0.18 → 0.0.20

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.
@@ -2205,7 +2205,7 @@ function logSkillParseFailures(failures) {
2205
2205
  if (f.hint) M.message(import_picocolors.default.yellow(` 提示: ${f.hint}`));
2206
2206
  }
2207
2207
  }
2208
- var version$1 = "2.0.18";
2208
+ var version$1 = "2.0.20";
2209
2209
  const isCancelled$1 = (value) => typeof value === "symbol";
2210
2210
  function redactSensitiveText(text) {
2211
2211
  return text.replace(/(https?:\/\/)([^/\s:@]+)(?::([^@/\s]*))?@/gi, "$1").replace(/([?&](?:private_token|access_token|token|api_key|access_key|secret|password)=)[^&\s]+/gi, "$1***");
@@ -5283,6 +5283,16 @@ async function runConfig(args) {
5283
5283
  }
5284
5284
  }
5285
5285
  }
5286
+ function getUpdateComparisonStrategy(entry) {
5287
+ if (entry.sourceType === "internal") return {
5288
+ field: "commitHash",
5289
+ value: entry.commitHash
5290
+ };
5291
+ return {
5292
+ field: "skillFolderHash",
5293
+ value: entry.skillFolderHash
5294
+ };
5295
+ }
5286
5296
  const __dirname = dirname(fileURLToPath(import.meta.url));
5287
5297
  function getVersion() {
5288
5298
  try {
@@ -5363,10 +5373,11 @@ ${BOLD}Publish:${RESET}
5363
5373
  ${BOLD}Updates:${RESET}
5364
5374
  check Check for available skill updates (project-level by default)
5365
5375
  check -g Check global skill updates
5376
+ check <skill> Check specific skill(s) for updates
5366
5377
  update Update skills interactively (project-level by default)
5367
5378
  update -g Update global skills
5368
5379
  update -y Update all skills without prompting
5369
- update <skill> Update specific skill(s)
5380
+ update <skill> Update specific skill(s)
5370
5381
 
5371
5382
  ${BOLD}Project:${RESET}
5372
5383
  experimental_install Restore skills from skills-lock.json
@@ -5419,6 +5430,7 @@ ${BOLD}Examples:${RESET}
5419
5430
  ${DIM}$${RESET} ali-skills find ${DIM}# interactive search${RESET}
5420
5431
  ${DIM}$${RESET} ali-skills find typescript ${DIM}# search by keyword${RESET}
5421
5432
  ${DIM}$${RESET} ali-skills check
5433
+ ${DIM}$${RESET} ali-skills check web-design react-best-practices
5422
5434
  ${DIM}$${RESET} ali-skills update
5423
5435
  ${DIM}$${RESET} ali-skills experimental_install ${DIM}# restore from skills-lock.json${RESET}
5424
5436
  ${DIM}$${RESET} ali-skills init my-skill
@@ -5695,7 +5707,7 @@ function readSkillLock() {
5695
5707
  function getSkipReason(entry) {
5696
5708
  if (entry.sourceType === "local") return "Local path";
5697
5709
  if (entry.sourceType === "git") return "Git URL (hash tracking not supported)";
5698
- if (!(entry.sourceType === "internal" ? entry.commitHash : entry.skillFolderHash)) return "No version hash available";
5710
+ if (!getUpdateComparisonStrategy(entry).value) return "No version hash available";
5699
5711
  if (!entry.skillPath) return "No skill path recorded";
5700
5712
  return "No version tracking";
5701
5713
  }
@@ -5776,6 +5788,7 @@ async function checkSkillsForUpdates(skills, token) {
5776
5788
  }
5777
5789
  async function runCheck(args = []) {
5778
5790
  const isGlobal = args.includes("-g") || args.includes("--global");
5791
+ const skillArgs = args.filter((arg) => !arg.startsWith("-"));
5779
5792
  console.log(`${TEXT}Checking for skill updates...${RESET}`);
5780
5793
  console.log();
5781
5794
  const token = getGitHubToken();
@@ -5785,19 +5798,31 @@ async function runCheck(args = []) {
5785
5798
  if (isGlobal) {
5786
5799
  const { lock: globalLock, isOutdated: isGlobalLockOutdated } = readSkillLock();
5787
5800
  const globalSkillNames = Object.keys(globalLock.skills);
5788
- skillCount = globalSkillNames.length;
5789
5801
  if (globalSkillNames.length === 0) {
5790
5802
  console.log(`${DIM}No global skills found.${RESET}`);
5791
5803
  console.log();
5792
5804
  return;
5793
5805
  }
5806
+ let globalSkillsToCheck = globalLock.skills;
5807
+ if (skillArgs.length > 0) {
5808
+ const requestedSkills = skillArgs.map((s) => s.toLowerCase());
5809
+ globalSkillsToCheck = Object.fromEntries(Object.entries(globalLock.skills).filter(([name]) => requestedSkills.includes(name.toLowerCase())));
5810
+ for (const reqSkill of skillArgs) if (!globalSkillNames.some((n) => n.toLowerCase() === reqSkill.toLowerCase())) console.log(`${DIM}Skill not found: ${reqSkill}${RESET}`);
5811
+ }
5812
+ const selectedGlobalSkillNames = Object.keys(globalSkillsToCheck);
5813
+ if (selectedGlobalSkillNames.length === 0) {
5814
+ console.log(`${DIM}No matching global skills to check.${RESET}`);
5815
+ console.log();
5816
+ return;
5817
+ }
5818
+ skillCount = selectedGlobalSkillNames.length;
5794
5819
  console.log(`${BOLD}Global skills${RESET}`);
5795
- console.log(`${DIM}Checking ${globalSkillNames.length} skill(s)...${RESET}`);
5796
- const result = await checkSkillsForUpdates(globalLock.skills, token);
5820
+ console.log(`${DIM}Checking ${selectedGlobalSkillNames.length} skill(s)...${RESET}`);
5821
+ const result = await checkSkillsForUpdates(globalSkillsToCheck, token);
5797
5822
  updates = result.updates;
5798
5823
  result.errors;
5799
5824
  skipped = result.skipped;
5800
- if (updates.length === 0) console.log(`${TEXT} ✓ All global skills are up to date${RESET}`);
5825
+ if (updates.length === 0) console.log(`${TEXT} ✓ ${skillArgs.length > 0 ? "All selected global skills are up to date" : "All global skills are up to date"}${RESET}`);
5801
5826
  else {
5802
5827
  console.log(`${TEXT} ${updates.length} update(s) available:${RESET}`);
5803
5828
  for (const update of updates) console.log(` ${TEXT}↑${RESET} ${update.name} ${DIM}(${update.source})${RESET}`);
@@ -5821,16 +5846,28 @@ async function runCheck(args = []) {
5821
5846
  } else {
5822
5847
  const { lock: projectLock, isOutdated: isLocalLockOutdated } = await readLocalLock();
5823
5848
  const projectSkillNames = Object.keys(projectLock.skills);
5824
- skillCount = projectSkillNames.length;
5825
5849
  if (projectSkillNames.length === 0) {
5826
5850
  console.log(`${DIM}No project-level skills found.${RESET}`);
5827
5851
  console.log();
5828
5852
  console.log(`${DIM}To check global skills, use:${RESET} ${TEXT}npx ali-skills check -g${RESET}`);
5829
5853
  return;
5830
5854
  }
5855
+ let projectSkillsToCheck = projectLock.skills;
5856
+ if (skillArgs.length > 0) {
5857
+ const requestedSkills = skillArgs.map((s) => s.toLowerCase());
5858
+ projectSkillsToCheck = Object.fromEntries(Object.entries(projectLock.skills).filter(([name]) => requestedSkills.includes(name.toLowerCase())));
5859
+ for (const reqSkill of skillArgs) if (!projectSkillNames.some((n) => n.toLowerCase() === reqSkill.toLowerCase())) console.log(`${DIM}Skill not found: ${reqSkill}${RESET}`);
5860
+ }
5861
+ const selectedProjectSkillNames = Object.keys(projectSkillsToCheck);
5862
+ if (selectedProjectSkillNames.length === 0) {
5863
+ console.log(`${DIM}No matching project-level skills to check.${RESET}`);
5864
+ console.log();
5865
+ return;
5866
+ }
5867
+ skillCount = selectedProjectSkillNames.length;
5831
5868
  console.log(`${BOLD}Project-level skills${RESET}`);
5832
- console.log(`${DIM}Checking ${projectSkillNames.length} skill(s)...${RESET}`);
5833
- for (const [skillName, entry] of Object.entries(projectLock.skills)) {
5869
+ console.log(`${DIM}Checking ${selectedProjectSkillNames.length} skill(s)...${RESET}`);
5870
+ for (const [skillName, entry] of Object.entries(projectSkillsToCheck)) {
5834
5871
  if (entry.sourceType === "internal") {
5835
5872
  if (!entry.commitHash) {
5836
5873
  skipped.push({
@@ -5905,7 +5942,7 @@ async function runCheck(args = []) {
5905
5942
  sourceUrl: entry.source
5906
5943
  });
5907
5944
  }
5908
- if (updates.length === 0) console.log(`${TEXT} ✓ All project skills are up to date${RESET}`);
5945
+ if (updates.length === 0) console.log(`${TEXT} ✓ ${skillArgs.length > 0 ? "All selected project skills are up to date" : "All project skills are up to date"}${RESET}`);
5909
5946
  else {
5910
5947
  console.log(`${TEXT} ${updates.length} update(s) available:${RESET}`);
5911
5948
  for (const update of updates) console.log(` ${TEXT}↑${RESET} ${update.name} ${DIM}(${update.source})${RESET}`);
@@ -5956,6 +5993,7 @@ async function runUpdate(args = []) {
5956
5993
  sourceType: entry.sourceType,
5957
5994
  sourceUrl,
5958
5995
  skillPath: entry.skillPath || "",
5996
+ commitHash: entry.commitHash,
5959
5997
  skillFolderHash: entry.skillFolderHash || entry.computedHash,
5960
5998
  installedAt: (/* @__PURE__ */ new Date()).toISOString(),
5961
5999
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -5975,9 +6013,11 @@ async function runUpdate(args = []) {
5975
6013
  for (const skillName of skillNames) {
5976
6014
  const entry = skillsToCheck[skillName];
5977
6015
  if (!entry) continue;
5978
- if (entry.sourceType === "internal" && projectLock) {
5979
- const localEntry = projectLock.skills[skillName];
5980
- if (!localEntry?.commitHash) {
6016
+ if (entry.sourceType === "internal") {
6017
+ const localEntry = projectLock?.skills[skillName];
6018
+ const commitHash = getUpdateComparisonStrategy(entry).value || getUpdateComparisonStrategy(localEntry || {}).value;
6019
+ const storedSkillPath = entry.skillPath || localEntry?.skillPath || "";
6020
+ if (!commitHash) {
5981
6021
  skipped.push({
5982
6022
  name: skillName,
5983
6023
  reason: "Reinstall required to enable update checking (missing commit hash)",
@@ -5986,9 +6026,9 @@ async function runUpdate(args = []) {
5986
6026
  continue;
5987
6027
  }
5988
6028
  try {
5989
- const skillPath = (localEntry.skillPath || "").replace(/\/?SKILL\.md$/i, "");
6029
+ const skillPath = storedSkillPath.replace(/\/?SKILL\.md$/i, "");
5990
6030
  const latestCommit = await fetchAliInternalCommitHash(entry.source, skillPath, null);
5991
- if (latestCommit && latestCommit !== localEntry.commitHash) availableUpdates.push({
6031
+ if (latestCommit && latestCommit !== commitHash) availableUpdates.push({
5992
6032
  name: skillName,
5993
6033
  source: entry.source,
5994
6034
  entry
@@ -6080,6 +6120,9 @@ async function runUpdate(args = []) {
6080
6120
  console.log();
6081
6121
  console.log(`${TEXT}Updating ${selectedUpdates.length} ${scopeLabel} skill(s)...${RESET}`);
6082
6122
  console.log();
6123
+ const installedSkills = await listInstalledSkills({ global: isGlobal });
6124
+ const installedAgentsBySkillName = /* @__PURE__ */ new Map();
6125
+ for (const skill of installedSkills) installedAgentsBySkillName.set(skill.name.toLowerCase(), [...skill.agents]);
6083
6126
  let successCount = 0;
6084
6127
  let failCount = 0;
6085
6128
  for (const update of selectedUpdates) {
@@ -6097,9 +6140,16 @@ async function runUpdate(args = []) {
6097
6140
  installUrl = `${installUrl}/tree/HEAD/${skillFolder}`;
6098
6141
  } else installUrl = sourceUrl;
6099
6142
  try {
6143
+ const installedAgents = installedAgentsBySkillName.get(update.name.toLowerCase());
6144
+ if (!installedAgents || installedAgents.length === 0) {
6145
+ failCount++;
6146
+ console.log(` ${DIM}✗ Skipped ${update.name}: unable to determine installed agents for safe update${RESET}`);
6147
+ continue;
6148
+ }
6100
6149
  await runAdd([installUrl], {
6101
6150
  yes: true,
6102
- global: isGlobal
6151
+ global: isGlobal,
6152
+ agent: installedAgents
6103
6153
  });
6104
6154
  successCount++;
6105
6155
  console.log(` ${TEXT}✓${RESET} Updated ${update.name}`);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ali/cli-skills",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ali-skills",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "author": "",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@ali/cli-skills": "^2.0.18"
34
+ "@ali/cli-skills": "^2.0.20"
35
35
  },
36
36
  "bundleDependencies": [
37
37
  "@ali/cli-skills"