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,4 +1,5 @@
import { formatFrontmatter } from "../utils/frontmatter"
import { sanitizePathName } from "../utils/files"
import type { ClaudeAgent, ClaudeCommand, ClaudeMcpServer, ClaudePlugin } from "../types/claude"
import type {
CopilotAgent,
@@ -21,9 +22,9 @@ export function convertClaudeToCopilot(
const agents = plugin.agents.map((agent) => convertAgent(agent, usedAgentNames))
// Reserve skill names first so generated skills (from commands) don't collide
// Reserve sanitized skill names so generated skills (from commands) don't collide on disk
const skillDirs = plugin.skills.map((skill) => {
usedSkillNames.add(skill.name)
usedSkillNames.add(sanitizePathName(skill.name))
return {
name: skill.name,
sourceDir: skill.sourceDir,

View File

@@ -1,4 +1,5 @@
import { formatFrontmatter } from "../utils/frontmatter"
import { sanitizePathName } from "../utils/files"
import type {
ClaudeAgent,
ClaudeCommand,
@@ -33,9 +34,9 @@ export function convertClaudeToOpenClaw(
}))
const allSkillDirs = [
...agentSkills.map((s) => s.dir),
...commandSkills.map((s) => s.dir),
...plugin.skills.map((s) => s.name),
...agentSkills.map((s) => sanitizePathName(s.dir)),
...commandSkills.map((s) => sanitizePathName(s.dir)),
...plugin.skills.map((s) => sanitizePathName(s.name)),
]
const manifest = buildManifest(plugin, allSkillDirs)

View File

@@ -1,4 +1,5 @@
import { formatFrontmatter } from "../utils/frontmatter"
import { sanitizePathName } from "../utils/files"
import { findServersWithPotentialSecrets } from "../utils/secrets"
import type { ClaudeAgent, ClaudeCommand, ClaudeMcpServer, ClaudePlugin } from "../types/claude"
import type { WindsurfBundle, WindsurfGeneratedSkill, WindsurfMcpConfig, WindsurfMcpServerEntry, WindsurfWorkflow } from "../types/windsurf"
@@ -20,8 +21,9 @@ export function convertClaudeToWindsurf(
sourceDir: skill.sourceDir,
}))
// Convert agents to skills (seed usedNames with pass-through skill names)
const usedSkillNames = new Set<string>(skillDirs.map((s) => s.name))
// Convert agents to skills (seed usedNames with sanitized pass-through skill names
// so generated agent skills detect collisions that would occur on disk)
const usedSkillNames = new Set<string>(skillDirs.map((s) => sanitizePathName(s.name)))
const agentSkills = plugin.agents.map((agent) =>
convertAgentToSkill(agent, knownAgentNames, usedSkillNames),
)