From d688be1b0bccc10a06e98a85dbb96ecabaeadcf4 Mon Sep 17 00:00:00 2001 From: "Tom Meschter (from Dev Box)" Date: Fri, 19 Dec 2025 13:25:18 -0800 Subject: [PATCH] Look for assets in subdirectories Fixes #503. When running `npm start` the README.skills.md file will be updated to include any newly-added skills. This includes the name and description from the skill's frontmatter, but also a list of assets in the skill-- that is, files other than SKILL.md. However, the code in yaml-parser.mjs to enumerate the asset files only looks in the immediate skill directory, not any subdirectories. Those files will be missing from README.skills.md. Here we update yaml-parser.mjs to recurse through the subdirectories as well. --- eng/yaml-parser.mjs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/eng/yaml-parser.mjs b/eng/yaml-parser.mjs index 0143d319..31bc9aeb 100644 --- a/eng/yaml-parser.mjs +++ b/eng/yaml-parser.mjs @@ -161,14 +161,26 @@ function parseSkillMetadata(skillPath) { return null; } - // List bundled assets (all files except SKILL.md) - const assets = fs - .readdirSync(skillPath) - .filter((file) => { - const filePath = path.join(skillPath, file); - return file !== "SKILL.md" && fs.statSync(filePath).isFile(); - }) - .sort(); + // List bundled assets (all files except SKILL.md), recursing through subdirectories + const getAllFiles = (dirPath, arrayOfFiles = []) => { + const files = fs.readdirSync(dirPath); + + files.forEach((file) => { + const filePath = path.join(dirPath, file); + if (fs.statSync(filePath).isDirectory()) { + arrayOfFiles = getAllFiles(filePath, arrayOfFiles); + } else { + const relativePath = path.relative(skillPath, filePath); + if (relativePath !== "SKILL.md") { + arrayOfFiles.push(relativePath); + } + } + }); + + return arrayOfFiles; + }; + + const assets = getAllFiles(skillPath).sort(); return { name: frontmatter.name,