ali-skills 0.0.17 → 0.0.19
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.
|
@@ -2000,8 +2000,12 @@ async function fetchSkillFolderHash(ownerRepo, skillPath, token) {
|
|
|
2000
2000
|
if (folderPath.endsWith("/SKILL.md")) folderPath = folderPath.slice(0, -9);
|
|
2001
2001
|
else if (folderPath.endsWith("SKILL.md")) folderPath = folderPath.slice(0, -8);
|
|
2002
2002
|
if (folderPath.endsWith("/")) folderPath = folderPath.slice(0, -1);
|
|
2003
|
-
for (const
|
|
2004
|
-
|
|
2003
|
+
for (const ref of [
|
|
2004
|
+
"HEAD",
|
|
2005
|
+
"master",
|
|
2006
|
+
"main"
|
|
2007
|
+
]) try {
|
|
2008
|
+
const url = `https://api.github.com/repos/${ownerRepo}/git/trees/${ref}?recursive=1`;
|
|
2005
2009
|
const headers = {
|
|
2006
2010
|
Accept: "application/vnd.github.v3+json",
|
|
2007
2011
|
"User-Agent": "skills-cli"
|
|
@@ -2019,10 +2023,14 @@ async function fetchSkillFolderHash(ownerRepo, skillPath, token) {
|
|
|
2019
2023
|
return null;
|
|
2020
2024
|
}
|
|
2021
2025
|
async function fetchAliInternalCommitHash(source, skillPath = "", token) {
|
|
2022
|
-
const
|
|
2026
|
+
const refs = [
|
|
2027
|
+
"HEAD",
|
|
2028
|
+
"master",
|
|
2029
|
+
"main"
|
|
2030
|
+
];
|
|
2023
2031
|
const privateToken = token || process.env.GITLAB_PRIVATE_TOKEN || process.env.CODE_ALIBABA_TOKEN || GITLAB_ACCOUNT.token;
|
|
2024
|
-
for (const
|
|
2025
|
-
let url = `https://code.alibaba-inc.com/api/v4/projects/${encodeURIComponent(source)}/repository/commits?ref_name=${
|
|
2032
|
+
for (const ref of refs) try {
|
|
2033
|
+
let url = `https://code.alibaba-inc.com/api/v4/projects/${encodeURIComponent(source)}/repository/commits?ref_name=${ref}&per_page=1`;
|
|
2026
2034
|
if (skillPath) url += `&path=${encodeURIComponent(skillPath)}`;
|
|
2027
2035
|
const headers = {
|
|
2028
2036
|
Accept: "application/json",
|
|
@@ -2031,8 +2039,8 @@ async function fetchAliInternalCommitHash(source, skillPath = "", token) {
|
|
|
2031
2039
|
};
|
|
2032
2040
|
const response = await fetch(url, { headers });
|
|
2033
2041
|
if (!response.ok) continue;
|
|
2034
|
-
const
|
|
2035
|
-
if (
|
|
2042
|
+
const latestCommit = (await response.json())[0];
|
|
2043
|
+
if (latestCommit?.id) return latestCommit.id;
|
|
2036
2044
|
} catch {
|
|
2037
2045
|
continue;
|
|
2038
2046
|
}
|
|
@@ -2197,7 +2205,7 @@ function logSkillParseFailures(failures) {
|
|
|
2197
2205
|
if (f.hint) M.message(import_picocolors.default.yellow(` 提示: ${f.hint}`));
|
|
2198
2206
|
}
|
|
2199
2207
|
}
|
|
2200
|
-
var version$1 = "2.0.
|
|
2208
|
+
var version$1 = "2.0.19";
|
|
2201
2209
|
const isCancelled$1 = (value) => typeof value === "symbol";
|
|
2202
2210
|
function redactSensitiveText(text) {
|
|
2203
2211
|
return text.replace(/(https?:\/\/)([^/\s:@]+)(?::([^@/\s]*))?@/gi, "$1").replace(/([?&](?:private_token|access_token|token|api_key|access_key|secret|password)=)[^&\s]+/gi, "$1***");
|
|
@@ -5355,10 +5363,11 @@ ${BOLD}Publish:${RESET}
|
|
|
5355
5363
|
${BOLD}Updates:${RESET}
|
|
5356
5364
|
check Check for available skill updates (project-level by default)
|
|
5357
5365
|
check -g Check global skill updates
|
|
5366
|
+
check <skill> Check specific skill(s) for updates
|
|
5358
5367
|
update Update skills interactively (project-level by default)
|
|
5359
5368
|
update -g Update global skills
|
|
5360
5369
|
update -y Update all skills without prompting
|
|
5361
|
-
update <skill>
|
|
5370
|
+
update <skill> Update specific skill(s)
|
|
5362
5371
|
|
|
5363
5372
|
${BOLD}Project:${RESET}
|
|
5364
5373
|
experimental_install Restore skills from skills-lock.json
|
|
@@ -5411,6 +5420,7 @@ ${BOLD}Examples:${RESET}
|
|
|
5411
5420
|
${DIM}$${RESET} ali-skills find ${DIM}# interactive search${RESET}
|
|
5412
5421
|
${DIM}$${RESET} ali-skills find typescript ${DIM}# search by keyword${RESET}
|
|
5413
5422
|
${DIM}$${RESET} ali-skills check
|
|
5423
|
+
${DIM}$${RESET} ali-skills check web-design react-best-practices
|
|
5414
5424
|
${DIM}$${RESET} ali-skills update
|
|
5415
5425
|
${DIM}$${RESET} ali-skills experimental_install ${DIM}# restore from skills-lock.json${RESET}
|
|
5416
5426
|
${DIM}$${RESET} ali-skills init my-skill
|
|
@@ -5768,6 +5778,7 @@ async function checkSkillsForUpdates(skills, token) {
|
|
|
5768
5778
|
}
|
|
5769
5779
|
async function runCheck(args = []) {
|
|
5770
5780
|
const isGlobal = args.includes("-g") || args.includes("--global");
|
|
5781
|
+
const skillArgs = args.filter((arg) => !arg.startsWith("-"));
|
|
5771
5782
|
console.log(`${TEXT}Checking for skill updates...${RESET}`);
|
|
5772
5783
|
console.log();
|
|
5773
5784
|
const token = getGitHubToken();
|
|
@@ -5777,19 +5788,31 @@ async function runCheck(args = []) {
|
|
|
5777
5788
|
if (isGlobal) {
|
|
5778
5789
|
const { lock: globalLock, isOutdated: isGlobalLockOutdated } = readSkillLock();
|
|
5779
5790
|
const globalSkillNames = Object.keys(globalLock.skills);
|
|
5780
|
-
skillCount = globalSkillNames.length;
|
|
5781
5791
|
if (globalSkillNames.length === 0) {
|
|
5782
5792
|
console.log(`${DIM}No global skills found.${RESET}`);
|
|
5783
5793
|
console.log();
|
|
5784
5794
|
return;
|
|
5785
5795
|
}
|
|
5796
|
+
let globalSkillsToCheck = globalLock.skills;
|
|
5797
|
+
if (skillArgs.length > 0) {
|
|
5798
|
+
const requestedSkills = skillArgs.map((s) => s.toLowerCase());
|
|
5799
|
+
globalSkillsToCheck = Object.fromEntries(Object.entries(globalLock.skills).filter(([name]) => requestedSkills.includes(name.toLowerCase())));
|
|
5800
|
+
for (const reqSkill of skillArgs) if (!globalSkillNames.some((n) => n.toLowerCase() === reqSkill.toLowerCase())) console.log(`${DIM}Skill not found: ${reqSkill}${RESET}`);
|
|
5801
|
+
}
|
|
5802
|
+
const selectedGlobalSkillNames = Object.keys(globalSkillsToCheck);
|
|
5803
|
+
if (selectedGlobalSkillNames.length === 0) {
|
|
5804
|
+
console.log(`${DIM}No matching global skills to check.${RESET}`);
|
|
5805
|
+
console.log();
|
|
5806
|
+
return;
|
|
5807
|
+
}
|
|
5808
|
+
skillCount = selectedGlobalSkillNames.length;
|
|
5786
5809
|
console.log(`${BOLD}Global skills${RESET}`);
|
|
5787
|
-
console.log(`${DIM}Checking ${
|
|
5788
|
-
const result = await checkSkillsForUpdates(
|
|
5810
|
+
console.log(`${DIM}Checking ${selectedGlobalSkillNames.length} skill(s)...${RESET}`);
|
|
5811
|
+
const result = await checkSkillsForUpdates(globalSkillsToCheck, token);
|
|
5789
5812
|
updates = result.updates;
|
|
5790
5813
|
result.errors;
|
|
5791
5814
|
skipped = result.skipped;
|
|
5792
|
-
if (updates.length === 0) console.log(`${TEXT} ✓ All global skills are up to date${RESET}`);
|
|
5815
|
+
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}`);
|
|
5793
5816
|
else {
|
|
5794
5817
|
console.log(`${TEXT} ${updates.length} update(s) available:${RESET}`);
|
|
5795
5818
|
for (const update of updates) console.log(` ${TEXT}↑${RESET} ${update.name} ${DIM}(${update.source})${RESET}`);
|
|
@@ -5813,16 +5836,28 @@ async function runCheck(args = []) {
|
|
|
5813
5836
|
} else {
|
|
5814
5837
|
const { lock: projectLock, isOutdated: isLocalLockOutdated } = await readLocalLock();
|
|
5815
5838
|
const projectSkillNames = Object.keys(projectLock.skills);
|
|
5816
|
-
skillCount = projectSkillNames.length;
|
|
5817
5839
|
if (projectSkillNames.length === 0) {
|
|
5818
5840
|
console.log(`${DIM}No project-level skills found.${RESET}`);
|
|
5819
5841
|
console.log();
|
|
5820
5842
|
console.log(`${DIM}To check global skills, use:${RESET} ${TEXT}npx ali-skills check -g${RESET}`);
|
|
5821
5843
|
return;
|
|
5822
5844
|
}
|
|
5845
|
+
let projectSkillsToCheck = projectLock.skills;
|
|
5846
|
+
if (skillArgs.length > 0) {
|
|
5847
|
+
const requestedSkills = skillArgs.map((s) => s.toLowerCase());
|
|
5848
|
+
projectSkillsToCheck = Object.fromEntries(Object.entries(projectLock.skills).filter(([name]) => requestedSkills.includes(name.toLowerCase())));
|
|
5849
|
+
for (const reqSkill of skillArgs) if (!projectSkillNames.some((n) => n.toLowerCase() === reqSkill.toLowerCase())) console.log(`${DIM}Skill not found: ${reqSkill}${RESET}`);
|
|
5850
|
+
}
|
|
5851
|
+
const selectedProjectSkillNames = Object.keys(projectSkillsToCheck);
|
|
5852
|
+
if (selectedProjectSkillNames.length === 0) {
|
|
5853
|
+
console.log(`${DIM}No matching project-level skills to check.${RESET}`);
|
|
5854
|
+
console.log();
|
|
5855
|
+
return;
|
|
5856
|
+
}
|
|
5857
|
+
skillCount = selectedProjectSkillNames.length;
|
|
5823
5858
|
console.log(`${BOLD}Project-level skills${RESET}`);
|
|
5824
|
-
console.log(`${DIM}Checking ${
|
|
5825
|
-
for (const [skillName, entry] of Object.entries(
|
|
5859
|
+
console.log(`${DIM}Checking ${selectedProjectSkillNames.length} skill(s)...${RESET}`);
|
|
5860
|
+
for (const [skillName, entry] of Object.entries(projectSkillsToCheck)) {
|
|
5826
5861
|
if (entry.sourceType === "internal") {
|
|
5827
5862
|
if (!entry.commitHash) {
|
|
5828
5863
|
skipped.push({
|
|
@@ -5897,7 +5932,7 @@ async function runCheck(args = []) {
|
|
|
5897
5932
|
sourceUrl: entry.source
|
|
5898
5933
|
});
|
|
5899
5934
|
}
|
|
5900
|
-
if (updates.length === 0) console.log(`${TEXT} ✓ All project skills are up to date${RESET}`);
|
|
5935
|
+
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}`);
|
|
5901
5936
|
else {
|
|
5902
5937
|
console.log(`${TEXT} ${updates.length} update(s) available:${RESET}`);
|
|
5903
5938
|
for (const update of updates) console.log(` ${TEXT}↑${RESET} ${update.name} ${DIM}(${update.source})${RESET}`);
|
|
@@ -6072,6 +6107,9 @@ async function runUpdate(args = []) {
|
|
|
6072
6107
|
console.log();
|
|
6073
6108
|
console.log(`${TEXT}Updating ${selectedUpdates.length} ${scopeLabel} skill(s)...${RESET}`);
|
|
6074
6109
|
console.log();
|
|
6110
|
+
const installedSkills = await listInstalledSkills({ global: isGlobal });
|
|
6111
|
+
const installedAgentsBySkillName = /* @__PURE__ */ new Map();
|
|
6112
|
+
for (const skill of installedSkills) installedAgentsBySkillName.set(skill.name.toLowerCase(), [...skill.agents]);
|
|
6075
6113
|
let successCount = 0;
|
|
6076
6114
|
let failCount = 0;
|
|
6077
6115
|
for (const update of selectedUpdates) {
|
|
@@ -6089,9 +6127,16 @@ async function runUpdate(args = []) {
|
|
|
6089
6127
|
installUrl = `${installUrl}/tree/HEAD/${skillFolder}`;
|
|
6090
6128
|
} else installUrl = sourceUrl;
|
|
6091
6129
|
try {
|
|
6130
|
+
const installedAgents = installedAgentsBySkillName.get(update.name.toLowerCase());
|
|
6131
|
+
if (!installedAgents || installedAgents.length === 0) {
|
|
6132
|
+
failCount++;
|
|
6133
|
+
console.log(` ${DIM}✗ Skipped ${update.name}: unable to determine installed agents for safe update${RESET}`);
|
|
6134
|
+
continue;
|
|
6135
|
+
}
|
|
6092
6136
|
await runAdd([installUrl], {
|
|
6093
6137
|
yes: true,
|
|
6094
|
-
global: isGlobal
|
|
6138
|
+
global: isGlobal,
|
|
6139
|
+
agent: installedAgents
|
|
6095
6140
|
});
|
|
6096
6141
|
successCount++;
|
|
6097
6142
|
console.log(` ${TEXT}✓${RESET} Updated ${update.name}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ali-skills",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
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.
|
|
34
|
+
"@ali/cli-skills": "^2.0.19"
|
|
35
35
|
},
|
|
36
36
|
"bundleDependencies": [
|
|
37
37
|
"@ali/cli-skills"
|