File size: 604 Bytes
3201ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/** True when `source` is a filesystem path or URL worth copying (not a scope label like "global"). */
export function isCopyableSkillSource(
  source: string | null | undefined,
): boolean {
  const trimmed = source?.trim();
  if (!trimmed) return false;

  if (/^https?:\/\//i.test(trimmed)) return true;
  if (
    trimmed.startsWith("/") ||
    trimmed.startsWith("./") ||
    trimmed.startsWith("../") ||
    trimmed.startsWith("~")
  ) {
    return true;
  }
  if (/^[A-Za-z]:[\\/]/.test(trimmed)) return true;
  if (trimmed.includes("/") || trimmed.includes("\\")) return true;

  return false;
}