Skip to content

Commit 8afe5cd

Browse files
committed
fix(summon): normalize path separators for cross-platform supporting file resolution
On Windows, Path::to_string_lossy() uses backslash separators but load() paths use forward slashes. Normalize discovered file paths to use forward slashes before comparison and in user-facing output so load(source: "skill/references/ops.md") matches consistently.
1 parent ef4f46e commit 8afe5cd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • crates/goose/src/agents/platform_extensions

crates/goose/src/agents/platform_extensions/summon.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ impl SummonClient {
500500

501501
for file_path in &skill.supporting_files {
502502
if let Ok(rel) = file_path.strip_prefix(&skill.path) {
503-
if rel.to_string_lossy() == relative_path {
503+
let rel_normalized = rel.to_string_lossy().replace('\\', "/");
504+
if rel_normalized == relative_path {
504505
let safe = file_path
505506
.canonicalize()
506507
.map(|p| p.starts_with(&canonical_skill_dir))
@@ -1112,11 +1113,10 @@ impl SummonClient {
11121113
));
11131114
for file in &source.supporting_files {
11141115
if let Ok(relative) = file.strip_prefix(&source.path) {
1116+
let rel_str = relative.to_string_lossy().replace('\\', "/");
11151117
output.push_str(&format!(
11161118
"- {} → load(source: \"{}/{}\")\n",
1117-
relative.display(),
1118-
source.name,
1119-
relative.display()
1119+
rel_str, source.name, rel_str
11201120
));
11211121
}
11221122
}
@@ -1140,7 +1140,7 @@ impl SummonClient {
11401140
.filter_map(|f| {
11411141
f.strip_prefix(&skill.path)
11421142
.ok()
1143-
.map(|r| r.to_string_lossy().to_string())
1143+
.map(|r| r.to_string_lossy().replace('\\', "/"))
11441144
})
11451145
.collect();
11461146
if !available.is_empty() {

0 commit comments

Comments
 (0)