Skip to content

Commit d929b71

Browse files
authored
Merge pull request #506 from tmeschter/251219-FixYamlParser
Look for assets in subdirectories
2 parents c3913bc + d688be1 commit d929b71

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

eng/yaml-parser.mjs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,26 @@ function parseSkillMetadata(skillPath) {
161161
return null;
162162
}
163163

164-
// List bundled assets (all files except SKILL.md)
165-
const assets = fs
166-
.readdirSync(skillPath)
167-
.filter((file) => {
168-
const filePath = path.join(skillPath, file);
169-
return file !== "SKILL.md" && fs.statSync(filePath).isFile();
170-
})
171-
.sort();
164+
// List bundled assets (all files except SKILL.md), recursing through subdirectories
165+
const getAllFiles = (dirPath, arrayOfFiles = []) => {
166+
const files = fs.readdirSync(dirPath);
167+
168+
files.forEach((file) => {
169+
const filePath = path.join(dirPath, file);
170+
if (fs.statSync(filePath).isDirectory()) {
171+
arrayOfFiles = getAllFiles(filePath, arrayOfFiles);
172+
} else {
173+
const relativePath = path.relative(skillPath, filePath);
174+
if (relativePath !== "SKILL.md") {
175+
arrayOfFiles.push(relativePath);
176+
}
177+
}
178+
});
179+
180+
return arrayOfFiles;
181+
};
182+
183+
const assets = getAllFiles(skillPath).sort();
172184

173185
return {
174186
name: frontmatter.name,

0 commit comments

Comments
 (0)