fix(ui): normalize Windows paths in skill visibility filtering

This commit is contained in:
Ttungx
2026-08-14 15:34:34 +08:00
parent b5c9da4ff0
commit 6334293035
2 changed files with 34 additions and 2 deletions
+6 -2
View File
@@ -35,8 +35,12 @@ const AGENTS_ROOT = /(^|\/)\.agents\//;
type SkillRoot = 'claude' | 'agents' | 'opencode';
export const resolveSkillRoot = (skillPath: string): SkillRoot => {
if (CLAUDE_ROOT.test(skillPath)) return 'claude';
if (AGENTS_ROOT.test(skillPath)) return 'agents';
// Server discovery joins paths with the platform separator, so Windows
// skill paths arrive with backslashes. Normalize before matching the
// root regexes, which are expressed with forward slashes.
const normalized = skillPath.replace(/\\/g, '/');
if (CLAUDE_ROOT.test(normalized)) return 'claude';
if (AGENTS_ROOT.test(normalized)) return 'agents';
return 'opencode';
};