ali-skills 0.0.16 → 0.0.17
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.
|
@@ -224,20 +224,21 @@ function isWellKnownUrl(input) {
|
|
|
224
224
|
return false;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function getDisplaySource(sourceUrl) {
|
|
227
|
+
function getDisplaySource(sourceUrl, options = {}) {
|
|
228
|
+
const format = options.format ?? "compact";
|
|
228
229
|
if (sourceUrl.startsWith("/") || sourceUrl.startsWith(".") || sourceUrl.startsWith("~")) return sourceUrl;
|
|
229
230
|
const sshMatch = sourceUrl.match(/^git@([^:]+):(.+)$/);
|
|
230
231
|
if (sshMatch) {
|
|
231
232
|
const [, host, path] = sshMatch;
|
|
232
233
|
if (!host || !path) return sourceUrl;
|
|
233
234
|
const cleanPath = path.replace(/\.git$/, "");
|
|
234
|
-
if (host === "code.alibaba-inc.com" || host === "gitlab.alibaba-inc.com") return cleanPath;
|
|
235
|
+
if (format === "compact" && (host === "code.alibaba-inc.com" || host === "gitlab.alibaba-inc.com")) return cleanPath;
|
|
235
236
|
return `https://${host}/${cleanPath}`;
|
|
236
237
|
}
|
|
237
238
|
if (sourceUrl.startsWith("http://") || sourceUrl.startsWith("https://")) try {
|
|
238
239
|
const url = new URL(sourceUrl);
|
|
239
240
|
const cleanPath = url.pathname.replace(/\.git$/, "").replace(/^\//, "");
|
|
240
|
-
if (url.hostname === "code.alibaba-inc.com" || url.hostname === "gitlab.alibaba-inc.com") return cleanPath;
|
|
241
|
+
if (format === "compact" && (url.hostname === "code.alibaba-inc.com" || url.hostname === "gitlab.alibaba-inc.com")) return cleanPath;
|
|
241
242
|
return `https://${url.hostname}/${cleanPath}`;
|
|
242
243
|
} catch {
|
|
243
244
|
return sourceUrl.replace(/^https?:\/\/[^@]+@/, "https://");
|
|
@@ -408,6 +409,9 @@ async function searchMultiselect(options) {
|
|
|
408
409
|
});
|
|
409
410
|
}
|
|
410
411
|
const CLONE_TIMEOUT_MS = 6e4;
|
|
412
|
+
function redactSensitiveText$1(text) {
|
|
413
|
+
return text.replace(/(https?:\/\/)([^/\s:@]+)(?::([^@/\s]*))?@/gi, "$1").replace(/([?&](?:private_token|access_token|token|api_key|access_key|secret|password)=)[^&\s]+/gi, "$1***");
|
|
414
|
+
}
|
|
411
415
|
function getGitUserConfig() {
|
|
412
416
|
try {
|
|
413
417
|
const name = execSync("git config user.name", {
|
|
@@ -475,11 +479,13 @@ async function cloneRepo(url, ref) {
|
|
|
475
479
|
force: true
|
|
476
480
|
}).catch(() => {});
|
|
477
481
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
482
|
+
const safeUrl = getDisplaySource(url);
|
|
483
|
+
const safeErrorMessage = redactSensitiveText$1(errorMessage);
|
|
478
484
|
const isTimeout = errorMessage.includes("block timeout") || errorMessage.includes("timed out");
|
|
479
485
|
const isAuthError = errorMessage.includes("Authentication failed") || errorMessage.includes("could not read Username") || errorMessage.includes("Permission denied") || errorMessage.includes("Repository not found") || errorMessage.includes("HTTP Basic: Access denied") || errorMessage.includes("could not be found or you don") || errorMessage.toLowerCase().includes("you don't have permission") || /repository .+ not found/i.test(errorMessage);
|
|
480
|
-
if (isTimeout) throw new GitCloneError("Clone timed out after 60s. This often happens with private repos that require authentication.\n Ensure you have access and your SSH keys or credentials are configured:\n - For SSH: ssh-add -l (to check loaded keys)\n - For HTTPS: gh auth status (if using GitHub CLI)",
|
|
481
|
-
if (isAuthError) throw new GitCloneError(`Authentication failed for ${
|
|
482
|
-
throw new GitCloneError(`Failed to clone ${
|
|
486
|
+
if (isTimeout) throw new GitCloneError("Clone timed out after 60s. This often happens with private repos that require authentication.\n Ensure you have access and your SSH keys or credentials are configured:\n - For SSH: ssh-add -l (to check loaded keys)\n - For HTTPS: gh auth status (if using GitHub CLI)", safeUrl, true, false);
|
|
487
|
+
if (isAuthError) throw new GitCloneError(`Authentication failed for ${safeUrl}.\n - For private repos, ensure you have access\n - For SSH: Check your keys with 'ssh -T git@github.com'\n - For HTTPS: Run 'gh auth login' or configure git credentials`, safeUrl, false, true);
|
|
488
|
+
throw new GitCloneError(`Failed to clone ${safeUrl}: ${safeErrorMessage}`, safeUrl, false, false);
|
|
483
489
|
}
|
|
484
490
|
}
|
|
485
491
|
async function listRemoteBranches(url) {
|
|
@@ -2191,8 +2197,11 @@ function logSkillParseFailures(failures) {
|
|
|
2191
2197
|
if (f.hint) M.message(import_picocolors.default.yellow(` 提示: ${f.hint}`));
|
|
2192
2198
|
}
|
|
2193
2199
|
}
|
|
2194
|
-
var version$1 = "2.0.
|
|
2200
|
+
var version$1 = "2.0.17";
|
|
2195
2201
|
const isCancelled$1 = (value) => typeof value === "symbol";
|
|
2202
|
+
function redactSensitiveText(text) {
|
|
2203
|
+
return text.replace(/(https?:\/\/)([^/\s:@]+)(?::([^@/\s]*))?@/gi, "$1").replace(/([?&](?:private_token|access_token|token|api_key|access_key|secret|password)=)[^&\s]+/gi, "$1***");
|
|
2204
|
+
}
|
|
2196
2205
|
async function isSourcePrivate(source) {
|
|
2197
2206
|
const ownerRepo = parseOwnerRepo(source);
|
|
2198
2207
|
if (!ownerRepo) return false;
|
|
@@ -2711,7 +2720,8 @@ async function runAdd(args, options = {}) {
|
|
|
2711
2720
|
}
|
|
2712
2721
|
} catch {}
|
|
2713
2722
|
}
|
|
2714
|
-
|
|
2723
|
+
const displaySource = parsed.type === "local" ? parsed.localPath : getDisplaySource(parsed.url, { format: "absolute" });
|
|
2724
|
+
spinner.stop(`Source: ${displaySource}${parsed.ref ? ` @ ${import_picocolors.default.yellow(parsed.ref)}` : ""}${parsed.subpath ? ` (${parsed.subpath})` : ""}${parsed.skillFilter ? ` ${import_picocolors.default.dim("@")}${import_picocolors.default.cyan(parsed.skillFilter)}` : ""}`);
|
|
2715
2725
|
if (parsed.type === "well-known") {
|
|
2716
2726
|
await handleWellKnownSkills(source, parsed.url, options, spinner);
|
|
2717
2727
|
return;
|
|
@@ -3300,8 +3310,8 @@ async function runAdd(args, options = {}) {
|
|
|
3300
3310
|
} catch (error) {
|
|
3301
3311
|
if (error instanceof GitCloneError) {
|
|
3302
3312
|
M.error(import_picocolors.default.red("Failed to clone repository"));
|
|
3303
|
-
for (const line of error.message.split("\n")) M.message(import_picocolors.default.dim(line));
|
|
3304
|
-
} else M.error(error instanceof Error ? error.message : "Unknown error occurred");
|
|
3313
|
+
for (const line of error.message.split("\n")) M.message(import_picocolors.default.dim(redactSensitiveText(line)));
|
|
3314
|
+
} else M.error(redactSensitiveText(error instanceof Error ? error.message : "Unknown error occurred"));
|
|
3305
3315
|
showInstallTip();
|
|
3306
3316
|
Se(import_picocolors.default.red("Installation failed"));
|
|
3307
3317
|
process.exit(1);
|
|
@@ -6214,10 +6224,20 @@ async function main() {
|
|
|
6214
6224
|
}
|
|
6215
6225
|
main().then(async () => {
|
|
6216
6226
|
if (getPendingTelemetryCount() > 0) {
|
|
6227
|
+
const syncStartAt = Date.now();
|
|
6228
|
+
const longSyncThresholdMs = 800;
|
|
6229
|
+
let didShowStartMessage = false;
|
|
6230
|
+
const startMessageTimer = setTimeout(() => {
|
|
6231
|
+
didShowStartMessage = true;
|
|
6232
|
+
console.log();
|
|
6233
|
+
console.log(`${DIM}Syncing telemetry data...${RESET}`);
|
|
6234
|
+
}, longSyncThresholdMs);
|
|
6235
|
+
await flushTelemetry();
|
|
6236
|
+
clearTimeout(startMessageTimer);
|
|
6217
6237
|
console.log();
|
|
6218
|
-
console.log(`${DIM}
|
|
6219
|
-
|
|
6220
|
-
await flushTelemetry();
|
|
6238
|
+
if (didShowStartMessage || Date.now() - syncStartAt >= longSyncThresholdMs) console.log(`${DIM}Telemetry data sync complete${RESET}`);
|
|
6239
|
+
else console.log(`${DIM}Telemetry data synced${RESET}`);
|
|
6240
|
+
} else await flushTelemetry();
|
|
6221
6241
|
process.exit(0);
|
|
6222
6242
|
}).catch(async (error) => {
|
|
6223
6243
|
console.error(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ali-skills",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
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.17"
|
|
35
35
|
},
|
|
36
36
|
"bundleDependencies": [
|
|
37
37
|
"@ali/cli-skills"
|