@alexsun-top/skills 1.4.2 → 1.4.4

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/cli.mjs +19 -8
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -392,6 +392,16 @@ async function searchMultiselect(options) {
392
392
  });
393
393
  }
394
394
  const CLONE_TIMEOUT_MS = 6e4;
395
+ function isGitHubShorthand(source) {
396
+ if (source.includes("\\") || source.startsWith("./") || source.startsWith("../")) return false;
397
+ if (source.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(source)) return false;
398
+ if (source.includes("://") || source.includes("@")) return false;
399
+ return /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(source);
400
+ }
401
+ function resolveGitHubUrl(source) {
402
+ if (isGitHubShorthand(source)) return `https://github.com/${source}.git`;
403
+ return source;
404
+ }
395
405
  var GitCloneError = class extends Error {
396
406
  url;
397
407
  isTimeout;
@@ -407,13 +417,14 @@ var GitCloneError = class extends Error {
407
417
  }
408
418
  };
409
419
  async function cloneRepo(url, ref) {
420
+ const resolvedUrl = resolveGitHubUrl(url);
410
421
  const tempDir = await mkdtemp(join(tmpdir(), "skills-"));
411
422
  const git = esm_default({ timeout: { block: CLONE_TIMEOUT_MS } });
412
423
  const cloneOptions = ref ? [] : ["--depth", "1"];
413
424
  const previousPromptValue = process.env.GIT_TERMINAL_PROMPT;
414
425
  process.env.GIT_TERMINAL_PROMPT = "0";
415
426
  try {
416
- await git.clone(url, tempDir, cloneOptions);
427
+ await git.clone(resolvedUrl, tempDir, cloneOptions);
417
428
  const clonedRepo = esm_default({
418
429
  baseDir: tempDir,
419
430
  timeout: { block: CLONE_TIMEOUT_MS }
@@ -421,10 +432,10 @@ async function cloneRepo(url, ref) {
421
432
  if (ref) try {
422
433
  await clonedRepo.checkout(ref);
423
434
  } catch (error) {
424
- throw new GitCloneError(`Failed to checkout ref '${ref}' for ${url}.
435
+ throw new GitCloneError(`Failed to checkout ref '${ref}' for ${resolvedUrl}.
425
436
  - Verify the ref exists (tag/branch/commit)
426
437
  - Ensure the ref is accessible in this repository
427
- - Git error: ${error instanceof Error ? error.message : String(error)}`, url);
438
+ - Git error: ${error instanceof Error ? error.message : String(error)}`, resolvedUrl);
428
439
  }
429
440
  let resolvedRevision;
430
441
  try {
@@ -446,10 +457,10 @@ async function cloneRepo(url, ref) {
446
457
  const isTimeout = errorMessage.includes("block timeout") || errorMessage.includes("timed out");
447
458
  const isAuthError = errorMessage.includes("Authentication failed") || errorMessage.includes("could not read Username") || errorMessage.includes("Permission denied") || errorMessage.includes("Repository not found");
448
459
  const isUnreachableError = normalizedMessage.includes("could not resolve host") || normalizedMessage.includes("no route to host") || normalizedMessage.includes("connection timed out") || normalizedMessage.includes("failed to connect") || normalizedMessage.includes("connection refused") || normalizedMessage.includes("name or service not known") || normalizedMessage.includes("unable to access");
449
- 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)", url, true, false, false);
450
- if (isAuthError) throw new GitCloneError(`Authentication failed for ${url}.\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`, url, false, true, false);
451
- if (isUnreachableError) throw new GitCloneError(`Repository is unreachable: ${url}.\n - Verify the repository URL is correct\n - Check network connectivity and VPN/proxy settings\n - Confirm the Git host is accessible from your environment`, url, false, false, true);
452
- throw new GitCloneError(`Failed to clone ${url}: ${errorMessage}`, url, false, false, false);
460
+ 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)", resolvedUrl, true, false, false);
461
+ if (isAuthError) throw new GitCloneError(`Authentication failed for ${resolvedUrl}.\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`, resolvedUrl, false, true, false);
462
+ if (isUnreachableError) throw new GitCloneError(`Repository is unreachable: ${resolvedUrl}.\n - Verify the repository URL is correct\n - Check network connectivity and VPN/proxy settings\n - Confirm the Git host is accessible from your environment`, resolvedUrl, false, false, true);
463
+ throw new GitCloneError(`Failed to clone ${resolvedUrl}: ${errorMessage}`, resolvedUrl, false, false, false);
453
464
  } finally {
454
465
  if (previousPromptValue === void 0) delete process.env.GIT_TERMINAL_PROMPT;
455
466
  else process.env.GIT_TERMINAL_PROMPT = previousPromptValue;
@@ -2158,7 +2169,7 @@ function createEmptyLocalLock() {
2158
2169
  skills: {}
2159
2170
  };
2160
2171
  }
2161
- var version$1 = "1.4.2";
2172
+ var version$1 = "1.4.4";
2162
2173
  const isCancelled$1 = (value) => typeof value === "symbol";
2163
2174
  async function isSourcePrivate(source) {
2164
2175
  const ownerRepo = parseOwnerRepo(source);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexsun-top/skills",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {