fix: sanitize colons in skill/agent names for Windows path compatibility (#398)

This commit is contained in:
Trevin Chow
2026-03-26 16:15:48 -07:00
committed by GitHub
parent 0877b693ce
commit b25480af9e
31 changed files with 356 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
import path from "path"
import type { ClaudeSkill } from "../types/claude"
import { ensureDir } from "../utils/files"
import { ensureDir, sanitizePathName } from "../utils/files"
import { forceSymlink, isValidSkillName } from "../utils/symlink"
export async function syncSkills(
@@ -9,13 +9,21 @@ export async function syncSkills(
): Promise<void> {
await ensureDir(skillsDir)
const seen = new Set<string>()
for (const skill of skills) {
if (!isValidSkillName(skill.name)) {
console.warn(`Skipping skill with invalid name: ${skill.name}`)
continue
}
const target = path.join(skillsDir, skill.name)
const safeName = sanitizePathName(skill.name)
if (seen.has(safeName)) {
console.warn(`Skipping skill "${skill.name}": sanitized name "${safeName}" collides with another skill`)
continue
}
seen.add(safeName)
const target = path.join(skillsDir, safeName)
await forceSymlink(skill.sourceDir, target)
}
}