fix: sanitize colons in skill/agent names for Windows path compatibility (#398)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user